From 85aaf69fd15749509134f7b6c0e400cf5f0a5d12 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 22 Feb 2015 09:41:28 +0100 Subject: [PATCH] Imported Upstream version 1.0.0-alpha.2 --- AUTHORS.txt | 129 +- CONTRIBUTING.md | 182 +- COPYRIGHT | 22 +- LICENSE-MIT | 2 +- Makefile.in | 8 +- README.md | 84 +- RELEASES.md | 102 +- configure | 32 +- debian/README.Debian | 53 - debian/README.source | 89 - debian/TODO.Debian | 10 - debian/changelog | 21 - debian/compat | 1 - debian/control | 92 - debian/copyright | 417 -- debian/gbp.conf | 9 - debian/kate-syntax-rust.install | 1 - debian/make_orig-dl_tarball.py | 58 - debian/rules | 129 - debian/rust-doc.doc-base.book | 12 - debian/rust-doc.doc-base.intro | 11 - debian/rust-doc.doc-base.reference | 14 - debian/rust-doc.docs | 1 - debian/rust-doc.install | 1 - debian/rust-mode.docs | 1 - debian/rust-mode.emacsen-install | 20 - debian/rust-mode.emacsen-remove | 11 - debian/rust-mode.emacsen-startup | 22 - debian/rust-mode.install | 2 - debian/rust.install | 2 - debian/rust.lintian-overrides | 4 - debian/rust.manpages | 3 - debian/source/format | 1 - debian/source/include-binaries | 2 - debian/source/lintian-overrides | 5 - debian/vim-syntax-rust.install | 2 - debian/vim-syntax-rust.yaml | 14 - debian/watch | 5 - man/rustc.1 | 13 +- man/rustdoc.1 | 30 + mk/cfg/aarch64-apple-ios.mk | 36 + mk/cfg/aarch64-linux-android.mk | 30 + mk/cfg/arm-apple-ios.mk | 35 - mk/cfg/armv7-apple-ios.mk | 34 + mk/cfg/armv7s-apple-ios.mk | 34 + mk/cfg/i386-apple-ios.mk | 33 +- mk/cfg/i686-pc-windows-gnu.mk | 10 +- mk/cfg/powerpc-unknown-linux-gnu.mk | 28 + mk/cfg/x86_64-apple-ios.mk | 36 + mk/cfg/x86_64-pc-windows-gnu.mk | 10 +- mk/cfg/x86_64-unknown-openbsd.mk | 26 + mk/crates.mk | 27 +- mk/dist.mk | 21 +- mk/docs.mk | 51 +- mk/grammar.mk | 48 + mk/install.mk | 12 +- mk/main.mk | 25 +- mk/platform.mk | 4 +- mk/prepare.mk | 2 +- mk/rt.mk | 2 +- mk/tests.mk | 128 +- src/compiler-rt/Makefile | 6 +- src/compiler-rt/lib/builtins/CMakeLists.txt | 5 +- src/compiler-rt/lib/builtins/Makefile.mk | 2 +- .../lib/builtins/aarch64/Makefile.mk | 22 + src/compiler-rt/lib/builtins/clear_cache.c | 4 + src/compiler-rt/make/platform/triple.mk | 10 +- src/compiletest/common.rs | 58 +- src/compiletest/compiletest.rs | 186 +- src/compiletest/errors.rs | 75 +- src/compiletest/header.rs | 58 +- src/compiletest/procsrv.rs | 16 +- src/compiletest/runtest.rs | 400 +- src/compiletest/util.rs | 13 +- src/doc/complement-bugreport.md | 63 - src/doc/complement-lang-faq.md | 2 +- src/doc/complement-project-faq.md | 2 +- src/doc/grammar.md | 774 +++ src/doc/guide-crates.md | 4 + src/doc/guide-error-handling.md | 4 + src/doc/guide-ffi.md | 4 + src/doc/guide-macros.md | 4 + src/doc/guide-ownership.md | 4 + src/doc/guide-plugins.md | 4 + src/doc/guide-pointers.md | 4 + src/doc/guide-strings.md | 4 + src/doc/guide-tasks.md | 4 + src/doc/guide-testing.md | 4 + src/doc/guide-unsafe.md | 4 + src/doc/guide.md | 4 + src/doc/index.md | 11 +- src/doc/intro.md | 109 +- src/doc/not_found.md | 5 +- src/doc/reference.md | 779 +-- src/doc/rust.css | 6 +- src/doc/rustdoc.md | 266 +- src/doc/style/README.md | 64 + src/doc/style/SUMMARY.md | 54 + src/doc/style/changing/README.md | 5 + src/doc/style/changing/post-1-0.md | 12 + src/doc/style/changing/pre-1-0.md | 17 + src/doc/style/changing/unclear.md | 28 + src/doc/style/errors/README.md | 3 + src/doc/style/errors/ergonomics.md | 66 + src/doc/style/errors/handling.md | 7 + src/doc/style/errors/propagation.md | 8 + src/doc/style/errors/signaling.md | 125 + src/doc/style/features/README.md | 9 + src/doc/style/features/crates.md | 6 + .../features/functions-and-methods/README.md | 43 + .../functions-and-methods/convenience.md | 43 + .../features/functions-and-methods/input.md | 201 + .../features/functions-and-methods/output.md | 56 + src/doc/style/features/let.md | 103 + src/doc/style/features/loops.md | 13 + src/doc/style/features/match.md | 26 + src/doc/style/features/modules.md | 133 + src/doc/style/features/traits/README.md | 22 + src/doc/style/features/traits/common.md | 71 + src/doc/style/features/traits/extensions.md | 7 + src/doc/style/features/traits/generics.md | 68 + src/doc/style/features/traits/objects.md | 49 + src/doc/style/features/traits/overloading.md | 7 + src/doc/style/features/traits/reuse.md | 30 + src/doc/style/features/types/README.md | 68 + src/doc/style/features/types/conversions.md | 22 + src/doc/style/features/types/newtype.md | 69 + src/doc/style/ownership/README.md | 3 + src/doc/style/ownership/builders.md | 176 + src/doc/style/ownership/cell-smart.md | 4 + src/doc/style/ownership/constructors.md | 62 + src/doc/style/ownership/destructors.md | 22 + src/doc/style/ownership/raii.md | 12 + src/doc/style/platform.md | 7 + src/doc/style/safety/README.md | 19 + src/doc/style/safety/lib-guarantees.md | 81 + src/doc/style/safety/unsafe.md | 22 + src/doc/style/style/README.md | 5 + src/doc/style/style/braces.md | 77 + src/doc/style/style/comments.md | 87 + src/doc/style/style/features.md | 13 + src/doc/style/style/imports.md | 50 + src/doc/style/style/naming/README.md | 115 + src/doc/style/style/naming/containers.md | 69 + src/doc/style/style/naming/conversions.md | 32 + src/doc/style/style/naming/iterators.md | 32 + src/doc/style/style/naming/ownership.md | 34 + src/doc/style/style/optional.md | 3 + src/doc/style/style/organization.md | 14 + src/doc/style/style/whitespace.md | 133 + src/doc/style/testing/README.md | 5 + src/doc/style/testing/unit.md | 30 + src/doc/style/todo.md | 5 + src/doc/trpl/README.md | 10 +- src/doc/trpl/SUMMARY.md | 9 +- src/doc/trpl/advanced-macros.md | 210 + src/doc/trpl/advanced.md | 2 +- src/doc/trpl/arrays-vectors-and-slices.md | 26 +- src/doc/trpl/closures.md | 75 +- src/doc/trpl/comments.md | 9 +- src/doc/trpl/compound-data-types.md | 243 +- src/doc/trpl/conclusion.md | 11 +- src/doc/trpl/concurrency.md | 373 ++ src/doc/trpl/crates-and-modules.md | 32 +- src/doc/trpl/documentation.md | 319 + src/doc/trpl/error-handling.md | 36 +- src/doc/trpl/ffi.md | 132 +- src/doc/trpl/functions.md | 81 +- src/doc/trpl/generics.md | 40 +- src/doc/trpl/glossary.md | 16 + src/doc/trpl/guessing-game.md | 206 +- src/doc/trpl/hello-cargo.md | 4 +- src/doc/trpl/hello-world.md | 22 +- src/doc/trpl/if.md | 14 +- src/doc/trpl/installing-rust.md | 11 +- src/doc/trpl/iterators.md | 171 +- src/doc/trpl/looping.md | 14 +- src/doc/trpl/macros.md | 815 +-- src/doc/trpl/match.md | 18 +- src/doc/trpl/method-syntax.md | 122 +- src/doc/trpl/more-strings.md | 283 + src/doc/trpl/ownership.md | 179 +- src/doc/trpl/patterns.md | 60 +- src/doc/trpl/plugins.md | 39 +- src/doc/trpl/pointers.md | 165 +- src/doc/trpl/rust-book.css | 59 - src/doc/trpl/standard-input.md | 36 +- src/doc/trpl/static-and-dynamic-dispatch.md | 286 + src/doc/trpl/strings.md | 30 +- src/doc/trpl/tasks.md | 384 -- src/doc/trpl/testing.md | 32 +- src/doc/trpl/traits.md | 186 +- src/doc/trpl/unsafe.md | 81 +- src/doc/trpl/variable-bindings.md | 39 +- src/doc/tutorial.md | 2 +- src/driver/driver.rs | 3 + src/etc/CONFIGS.md | 10 + src/etc/adb_run_wrapper.sh | 3 +- src/etc/check-links.pl | 34 - src/etc/check-summary.py | 8 +- src/etc/emacs/README.md | 79 - src/etc/emacs/run_rust_emacs_tests.sh | 14 - src/etc/emacs/rust-mode-tests.el | 896 --- src/etc/emacs/rust-mode.el | 488 -- src/etc/errorck.py | 67 + src/etc/extract_grammar.py | 136 +- src/etc/featureck.py | 245 + src/etc/gdb_rust_pretty_printing.py | 364 +- src/etc/gedit/readme.txt | 10 - .../language-specs/rust.lang | 340 -- src/etc/gedit/share/mime/packages/rust.xml | 6 - src/etc/generate-deriving-span-tests.py | 19 +- src/etc/generate-keyword-tests.py | 2 +- src/etc/get-snapshot.py | 94 +- src/etc/htmldocck.py | 381 ++ src/etc/indenter | 29 +- src/etc/kate/rust.xml | 304 - src/etc/latest-unix-snaps.py | 22 +- src/etc/licenseck.py | 50 +- src/etc/lldb_batchmode.py | 218 +- src/etc/lldb_rust_formatters.py | 340 +- src/etc/local_stage0.sh | 7 +- src/etc/make-win-dist.py | 10 +- src/etc/maketest.py | 40 +- src/etc/mirror-all-snapshots.py | 7 +- src/etc/mklldeps.py | 3 +- src/etc/rustup.sh | 39 +- src/etc/snapshot.py | 290 +- src/etc/snapshot.pyc | Bin 9958 -> 10047 bytes src/etc/sugarise-doc-comments.py | 6 +- src/etc/tidy.py | 217 +- src/etc/unicode.py | 14 +- src/etc/vim/after/syntax/rust.vim | 31 - src/etc/vim/autoload/rust.vim | 225 - src/etc/vim/compiler/cargo.vim | 65 - src/etc/vim/compiler/rustc.vim | 33 - src/etc/vim/doc/rust.txt | 178 - src/etc/vim/ftdetect/rust.vim | 1 - src/etc/vim/ftplugin/rust.vim | 150 - src/etc/vim/indent/rust.vim | 196 - src/etc/vim/plugin/rust.vim | 22 - src/etc/vim/syntax/rust.vim | 264 - src/etc/vim/syntax_checkers/rust/rustc.vim | 35 - src/etc/zsh/_rust | 215 - src/jemalloc/VERSION | 2 +- src/liballoc/arc.rs | 222 +- src/liballoc/boxed.rs | 270 +- src/liballoc/boxed_test.rs | 117 + src/liballoc/heap.rs | 99 +- src/liballoc/lib.rs | 22 +- src/liballoc/rc.rs | 275 +- src/libarena/lib.rs | 176 +- src/libbacktrace/configure | 2 +- src/libcollections/bench.rs | 199 +- src/libcollections/binary_heap.rs | 261 +- src/libcollections/bit.rs | 1649 ++--- src/libcollections/borrow.rs | 316 + src/libcollections/borrow_stage0.rs | 313 + src/libcollections/btree/map.rs | 883 +-- src/libcollections/btree/node.rs | 508 +- src/libcollections/btree/set.rs | 375 +- src/libcollections/enum_set.rs | 137 +- src/{libstd => libcollections}/fmt.rs | 118 +- src/libcollections/lib.rs | 102 +- .../{dlist.rs => linked_list.rs} | 801 ++- src/libcollections/macros.rs | 54 +- src/libcollections/slice.rs | 1550 ++--- src/libcollections/str.rs | 683 ++- src/libcollections/string.rs | 385 +- src/libcollections/vec.rs | 953 +-- .../{ring_buf.rs => vec_deque.rs} | 1236 ++-- src/libcollections/vec_map.rs | 655 +- src/libcore/any.rs | 66 +- src/libcore/array.rs | 85 +- src/libcore/atomic.rs | 512 +- src/libcore/borrow.rs | 252 - src/libcore/cell.rs | 435 +- src/libcore/char.rs | 398 +- src/libcore/clone.rs | 20 +- src/libcore/cmp.rs | 389 +- src/libcore/default.rs | 42 +- src/{libstd => libcore}/error.rs | 57 +- src/libcore/finally.rs | 14 +- src/libcore/fmt/float.rs | 28 +- src/libcore/fmt/mod.rs | 408 +- src/libcore/fmt/num.rs | 31 +- src/libcore/fmt/{rt.rs => rt/v1.rs} | 72 +- src/libcore/hash/mod.rs | 327 +- src/libcore/hash/sip.rs | 51 +- src/libcore/intrinsics.rs | 86 +- src/libcore/iter.rs | 1461 +++-- src/libcore/lib.rs | 38 +- src/libcore/macros.rs | 38 +- src/libcore/marker.rs | 497 +- src/libcore/mem.rs | 77 +- src/libcore/nonzero.rs | 15 +- src/libcore/num/f32.rs | 90 +- src/libcore/num/f64.rs | 88 +- src/libcore/num/i16.rs | 2 +- src/libcore/num/i32.rs | 2 +- src/libcore/num/i64.rs | 2 +- src/libcore/num/i8.rs | 2 +- src/libcore/num/int.rs | 10 +- src/libcore/num/int_macros.rs | 8 +- src/libcore/num/isize.rs | 8 +- src/libcore/num/mod.rs | 366 +- src/libcore/num/u16.rs | 2 +- src/libcore/num/u32.rs | 2 +- src/libcore/num/u64.rs | 2 +- src/libcore/num/u8.rs | 2 +- src/libcore/num/uint.rs | 3 +- src/libcore/num/uint_macros.rs | 8 +- src/libcore/num/usize.rs | 2 +- src/libcore/ops.rs | 520 +- src/libcore/option.rs | 231 +- src/libcore/prelude.rs | 6 +- src/libcore/ptr.rs | 206 +- src/libcore/raw.rs | 123 +- src/libcore/result.rs | 250 +- src/libcore/simd.rs | 41 +- src/libcore/slice.rs | 630 +- src/libcore/str/mod.rs | 630 +- src/libcore/tuple.rs | 20 +- src/libcoretest/any.rs | 26 +- src/libcoretest/atomic.rs | 16 +- src/libcoretest/cell.rs | 51 +- src/libcoretest/char.rs | 32 +- src/libcoretest/clone.rs | 6 +- src/libcoretest/cmp.rs | 48 +- src/libcoretest/finally.rs | 17 +- src/libcoretest/fmt/mod.rs | 2 +- src/libcoretest/fmt/num.rs | 156 +- src/libcoretest/hash/mod.rs | 50 +- src/libcoretest/hash/sip.rs | 12 +- src/libcoretest/intrinsics.rs | 2 +- src/libcoretest/iter.rs | 420 +- src/libcoretest/lib.rs | 7 +- src/libcoretest/mem.rs | 70 +- src/libcoretest/nonzero.rs | 18 +- src/libcoretest/num/int_macros.rs | 46 +- src/libcoretest/num/mod.rs | 66 +- src/libcoretest/num/uint_macros.rs | 8 +- src/libcoretest/ops.rs | 18 +- src/libcoretest/option.rs | 26 +- src/libcoretest/ptr.rs | 19 +- src/libcoretest/result.rs | 24 +- src/libcoretest/slice.rs | 32 +- src/libcoretest/str.rs | 22 +- src/libcoretest/tuple.rs | 16 +- src/libflate/lib.rs | 39 +- src/libfmt_macros/lib.rs | 19 +- src/libgetopts/lib.rs | 185 +- src/libgraphviz/lib.rs | 84 +- src/libgraphviz/maybe_owned_vec.rs | 164 - src/liblibc/lib.rs | 779 ++- src/liblog/directive.rs | 19 +- src/liblog/lib.rs | 77 +- src/liblog/macros.rs | 10 +- src/librand/chacha.rs | 29 +- src/librand/distributions/exponential.rs | 4 +- src/librand/distributions/gamma.rs | 14 +- src/librand/distributions/mod.rs | 75 +- src/librand/distributions/normal.rs | 6 +- src/librand/distributions/range.rs | 16 +- src/librand/isaac.rs | 62 +- src/librand/lib.rs | 44 +- src/librand/rand_impls.rs | 4 +- src/librand/reseeding.rs | 16 +- src/librbml/io.rs | 38 +- src/librbml/lib.rs | 174 +- src/libregex/compile.rs | 275 - src/libregex/lib.rs | 92 - src/libregex/parse.rs | 1086 ---- src/libregex/re.rs | 684 --- src/libregex/test/bench.rs | 183 - src/libregex/test/matches.rs | 373 -- src/libregex/test/tests.rs | 245 - src/libregex/testdata/LICENSE | 19 - src/libregex/testdata/README | 17 - src/libregex/testdata/basic.dat | 221 - src/libregex/testdata/nullsubexpr.dat | 79 - src/libregex/testdata/repetition.dat | 163 - src/libregex/vm.rs | 582 -- src/librustc/README.txt | 6 +- src/librustc/diagnostics.rs | 107 +- src/librustc/lib.rs | 31 +- src/librustc/lint/builtin.rs | 780 ++- src/librustc/lint/context.rs | 132 +- src/librustc/lint/mod.rs | 13 +- src/librustc/metadata/common.rs | 33 +- src/librustc/metadata/creader.rs | 230 +- src/librustc/metadata/csearch.rs | 51 +- src/librustc/metadata/cstore.rs | 32 +- src/librustc/metadata/decoder.rs | 116 +- src/librustc/metadata/encoder.rs | 333 +- src/librustc/metadata/filesearch.rs | 43 +- src/librustc/metadata/loader.rs | 137 +- src/librustc/metadata/macro_import.rs | 186 + src/librustc/metadata/mod.rs | 1 + src/librustc/metadata/tydecode.rs | 122 +- src/librustc/metadata/tyencode.rs | 68 +- src/librustc/middle/astconv_util.rs | 4 +- src/librustc/middle/astencode.rs | 337 +- src/librustc/middle/cfg/construct.rs | 58 +- src/librustc/middle/cfg/graphviz.rs | 11 +- src/librustc/middle/check_const.rs | 718 ++- src/librustc/middle/check_loop.rs | 14 +- src/librustc/middle/check_match.rs | 215 +- src/librustc/middle/check_static.rs | 341 -- src/librustc/middle/check_static_recursion.rs | 10 +- src/librustc/middle/const_eval.rs | 476 +- src/librustc/middle/dataflow.rs | 94 +- src/librustc/middle/dead.rs | 34 +- src/librustc/middle/def.rs | 12 +- src/librustc/middle/dependency_format.rs | 10 +- src/librustc/middle/effect.rs | 2 +- src/librustc/middle/entry.rs | 8 +- src/librustc/middle/expr_use_visitor.rs | 170 +- src/librustc/middle/fast_reject.rs | 6 +- src/librustc/middle/graph.rs | 32 +- src/librustc/middle/infer/README.md | 237 + src/librustc/middle/infer/bivariate.rs | 145 + src/librustc/middle/infer/combine.rs | 232 +- src/librustc/middle/infer/doc.rs | 247 - src/librustc/middle/infer/equate.rs | 37 +- src/librustc/middle/infer/error_reporting.rs | 168 +- src/librustc/middle/infer/freshen.rs | 10 +- src/librustc/middle/infer/glb.rs | 57 +- .../middle/infer/higher_ranked/README.md | 403 ++ .../middle/infer/higher_ranked/doc.rs | 413 -- .../middle/infer/higher_ranked/mod.rs | 20 +- src/librustc/middle/infer/lub.rs | 58 +- src/librustc/middle/infer/mod.rs | 124 +- .../middle/infer/region_inference/README.md | 364 ++ .../middle/infer/region_inference/doc.rs | 374 -- .../middle/infer/region_inference/graphviz.rs | 87 +- .../middle/infer/region_inference/mod.rs | 82 +- src/librustc/middle/infer/sub.rs | 56 +- src/librustc/middle/infer/type_variable.rs | 25 +- src/librustc/middle/infer/unify.rs | 130 +- src/librustc/middle/lang_items.rs | 47 +- src/librustc/middle/liveness.rs | 152 +- src/librustc/middle/mem_categorization.rs | 432 +- src/librustc/middle/pat_util.rs | 2 +- src/librustc/middle/privacy.rs | 1568 +---- src/librustc/middle/reachable.rs | 9 +- src/librustc/middle/recursion_limit.rs | 11 +- src/librustc/middle/region.rs | 489 +- src/librustc/middle/resolve_lifetime.rs | 151 +- src/librustc/middle/stability.rs | 392 +- src/librustc/middle/subst.rs | 48 +- .../middle/traits/{doc.rs => README.md} | 106 +- src/librustc/middle/traits/coherence.rs | 160 +- src/librustc/middle/traits/error_reporting.rs | 241 +- src/librustc/middle/traits/fulfill.rs | 20 +- src/librustc/middle/traits/mod.rs | 158 +- src/librustc/middle/traits/object_safety.rs | 70 +- src/librustc/middle/traits/project.rs | 410 +- src/librustc/middle/traits/select.rs | 628 +- src/librustc/middle/traits/util.rs | 140 +- src/librustc/middle/ty.rs | 1375 +++-- src/librustc/middle/ty_fold.rs | 95 +- src/librustc/middle/ty_walk.rs | 11 +- src/librustc/middle/weak_lang_items.rs | 18 +- src/librustc/plugin/build.rs | 4 +- src/librustc/plugin/load.rs | 228 +- src/librustc/plugin/mod.rs | 7 +- src/librustc/plugin/registry.rs | 17 +- src/librustc/session/config.rs | 202 +- src/librustc/session/mod.rs | 107 +- src/librustc/session/search_paths.rs | 24 +- src/librustc/util/common.rs | 110 +- src/librustc/util/lev_distance.rs | 6 +- src/librustc/util/nodemap.rs | 69 +- src/librustc/util/ppaux.rs | 459 +- src/librustc/util/snapshot_vec.rs | 37 +- src/librustc_back/abi.rs | 6 +- src/librustc_back/archive.rs | 57 +- src/librustc_back/arm.rs | 4 +- src/librustc_back/fs.rs | 26 +- src/librustc_back/lib.rs | 17 +- src/librustc_back/mips.rs | 4 +- src/librustc_back/mipsel.rs | 4 +- src/librustc_back/rpath.rs | 47 +- src/librustc_back/sha2.rs | 62 +- src/librustc_back/svh.rs | 47 +- src/librustc_back/target/aarch64_apple_ios.rs | 31 + .../target/aarch64_linux_android.rs | 29 + src/librustc_back/target/apple_ios_base.rs | 100 + src/librustc_back/target/arm_apple_ios.rs | 37 - .../target/arm_linux_androideabi.rs | 1 + src/librustc_back/target/armv7_apple_ios.rs | 27 + src/librustc_back/target/armv7s_apple_ios.rs | 27 + src/librustc_back/target/i386_apple_ios.rs | 4 +- src/librustc_back/target/i686_apple_darwin.rs | 1 + .../target/i686_pc_windows_gnu.rs | 1 + .../target/i686_unknown_dragonfly.rs | 1 + .../target/i686_unknown_linux_gnu.rs | 1 + src/librustc_back/target/mod.rs | 64 +- src/librustc_back/target/openbsd_base.rs | 28 + .../target/powerpc_unknown_linux_gnu.rs | 26 + .../target/x86_64_apple_darwin.rs | 1 + src/librustc_back/target/x86_64_apple_ios.rs | 26 + .../target/x86_64_pc_windows_gnu.rs | 1 + .../target/x86_64_unknown_dragonfly.rs | 1 + .../target/x86_64_unknown_freebsd.rs | 1 + .../target/x86_64_unknown_linux_gnu.rs | 1 + .../target/x86_64_unknown_openbsd.rs | 28 + src/librustc_back/x86.rs | 5 +- src/librustc_back/x86_64.rs | 7 +- .../bitflags.rs => librustc_bitflags/lib.rs} | 27 +- src/librustc_borrowck/borrowck/README.md | 1212 ++++ src/librustc_borrowck/borrowck/check_loans.rs | 54 +- src/librustc_borrowck/borrowck/doc.rs | 1222 ---- src/librustc_borrowck/borrowck/fragments.rs | 77 +- .../borrowck/gather_loans/gather_moves.rs | 10 +- .../borrowck/gather_loans/mod.rs | 4 +- .../borrowck/gather_loans/move_error.rs | 23 +- .../borrowck/gather_loans/restrictions.rs | 8 +- src/librustc_borrowck/borrowck/mod.rs | 104 +- src/librustc_borrowck/borrowck/move_data.rs | 35 +- src/librustc_borrowck/graphviz.rs | 12 +- src/librustc_borrowck/lib.rs | 13 +- src/librustc_driver/driver.rs | 397 +- src/librustc_driver/lib.rs | 572 +- src/librustc_driver/pretty.rs | 128 +- src/librustc_driver/test.rs | 27 +- src/librustc_llvm/archive_ro.rs | 4 +- src/librustc_llvm/diagnostic.rs | 46 +- src/librustc_llvm/lib.rs | 192 +- src/librustc_privacy/lib.rs | 1583 +++++ src/librustc_resolve/build_reduced_graph.rs | 523 +- src/librustc_resolve/check_unused.rs | 38 +- src/librustc_resolve/diagnostics.rs | 30 + src/librustc_resolve/lib.rs | 519 +- src/librustc_resolve/record_exports.rs | 8 +- src/librustc_trans/back/link.rs | 144 +- src/librustc_trans/back/lto.rs | 27 +- src/librustc_trans/back/write.rs | 192 +- src/librustc_trans/lib.rs | 21 +- src/librustc_trans/save/mod.rs | 590 +- src/librustc_trans/save/recorder.rs | 77 +- src/librustc_trans/save/span_utils.rs | 40 +- src/librustc_trans/trans/_match.rs | 366 +- src/librustc_trans/trans/adt.rs | 93 +- src/librustc_trans/trans/asm.rs | 27 +- src/librustc_trans/trans/base.rs | 724 ++- src/librustc_trans/trans/basic_block.rs | 7 +- src/librustc_trans/trans/build.rs | 447 +- src/librustc_trans/trans/builder.rs | 41 +- src/librustc_trans/trans/cabi.rs | 11 +- src/librustc_trans/trans/cabi_aarch64.rs | 33 +- src/librustc_trans/trans/cabi_arm.rs | 115 +- src/librustc_trans/trans/cabi_mips.rs | 36 +- src/librustc_trans/trans/cabi_powerpc.rs | 183 + src/librustc_trans/trans/cabi_x86.rs | 2 +- src/librustc_trans/trans/cabi_x86_64.rs | 190 +- src/librustc_trans/trans/cabi_x86_win64.rs | 2 +- src/librustc_trans/trans/callee.rs | 161 +- src/librustc_trans/trans/cleanup.rs | 213 +- src/librustc_trans/trans/closure.rs | 504 +- src/librustc_trans/trans/common.rs | 181 +- src/librustc_trans/trans/consts.rs | 573 +- src/librustc_trans/trans/context.rs | 126 +- src/librustc_trans/trans/controlflow.rs | 240 +- src/librustc_trans/trans/datum.rs | 109 +- src/librustc_trans/trans/debuginfo.rs | 610 +- src/librustc_trans/trans/doc.rs | 233 - src/librustc_trans/trans/expr.rs | 725 +-- src/librustc_trans/trans/foreign.rs | 121 +- src/librustc_trans/trans/glue.rs | 138 +- src/librustc_trans/trans/inline.rs | 19 +- src/librustc_trans/trans/intrinsic.rs | 449 +- src/librustc_trans/trans/machine.rs | 11 - src/librustc_trans/trans/meth.rs | 230 +- src/librustc_trans/trans/mod.rs | 2 +- src/librustc_trans/trans/monomorphize.rs | 26 +- src/librustc_trans/trans/tvec.rs | 155 +- src/librustc_trans/trans/type_.rs | 45 +- src/librustc_trans/trans/type_of.rs | 45 +- src/librustc_trans/trans/value.rs | 1 - src/librustc_typeck/astconv.rs | 666 +- src/librustc_typeck/check/_match.rs | 92 +- src/librustc_typeck/check/assoc.rs | 4 +- src/librustc_typeck/check/callee.rs | 222 +- src/librustc_typeck/check/closure.rs | 249 +- .../check}/coercion.rs | 333 +- src/librustc_typeck/check/compare_method.rs | 403 ++ src/librustc_typeck/check/demand.rs | 7 +- src/librustc_typeck/check/dropck.rs | 293 + .../check/{regionmanip.rs => implicator.rs} | 320 +- src/librustc_typeck/check/method/README.md | 111 + src/librustc_typeck/check/method/confirm.rs | 104 +- src/librustc_typeck/check/method/doc.rs | 121 - src/librustc_typeck/check/method/mod.rs | 130 +- src/librustc_typeck/check/method/probe.rs | 241 +- src/librustc_typeck/check/method/suggest.rs | 378 ++ src/librustc_typeck/check/mod.rs | 1994 +++--- src/librustc_typeck/check/regionck.rs | 454 +- src/librustc_typeck/check/upvar.rs | 328 +- src/librustc_typeck/check/vtable.rs | 162 +- src/librustc_typeck/check/wf.rs | 279 +- src/librustc_typeck/check/writeback.rs | 72 +- src/librustc_typeck/coherence/impls.rs | 47 + src/librustc_typeck/coherence/mod.rs | 50 +- src/librustc_typeck/coherence/orphan.rs | 23 +- src/librustc_typeck/coherence/overlap.rs | 39 +- src/librustc_typeck/coherence/unsafety.rs | 39 +- src/librustc_typeck/collect.rs | 1161 ++-- .../constrained_type_params.rs | 61 + src/librustc_typeck/diagnostics.rs | 134 +- src/librustc_typeck/lib.rs | 52 +- src/librustc_typeck/rscope.rs | 93 +- src/librustc_typeck/variance.rs | 460 +- src/librustdoc/clean/inline.rs | 70 +- src/librustdoc/clean/mod.rs | 724 ++- src/librustdoc/core.rs | 33 +- src/librustdoc/doctree.rs | 26 +- src/librustdoc/externalfiles.rs | 16 +- src/librustdoc/flock.rs | 26 +- src/librustdoc/html/escape.rs | 8 +- src/librustdoc/html/format.rs | 231 +- src/librustdoc/html/highlight.rs | 18 +- src/librustdoc/html/item_type.rs | 42 +- src/librustdoc/html/layout.rs | 10 +- src/librustdoc/html/markdown.rs | 174 +- src/librustdoc/html/render.rs | 422 +- src/librustdoc/html/static/main.css | 38 +- src/librustdoc/html/static/main.js | 20 +- src/librustdoc/html/static/playpen.js | 3 +- src/librustdoc/html/toc.rs | 17 +- src/librustdoc/lib.rs | 90 +- src/librustdoc/markdown.rs | 27 +- src/librustdoc/passes.rs | 34 +- src/librustdoc/plugins.rs | 4 +- src/librustdoc/stability_summary.rs | 46 +- src/librustdoc/test.rs | 78 +- src/librustdoc/visit_ast.rs | 125 +- src/libserialize/base64.rs | 428 -- src/libserialize/collection_impls.rs | 126 +- src/libserialize/hex.rs | 18 +- src/libserialize/json.rs | 501 +- src/libserialize/lib.rs | 20 +- src/libserialize/serialize.rs | 28 +- src/libstd/ascii.rs | 222 +- src/libstd/bool.rs | 2 +- src/libstd/collections/hash/bench.rs | 22 +- src/libstd/collections/hash/map.rs | 685 ++- src/libstd/collections/hash/map_stage0.rs | 2330 +++++++ src/libstd/collections/hash/mod.rs | 8 + src/libstd/collections/hash/set.rs | 461 +- src/libstd/collections/hash/set_stage0.rs | 1252 ++++ src/libstd/collections/hash/state.rs | 9 +- src/libstd/collections/hash/table.rs | 199 +- src/libstd/collections/mod.rs | 115 +- src/libstd/dynamic_lib.rs | 183 +- src/libstd/env.rs | 958 +++ src/libstd/ffi/c_str.rs | 417 +- src/libstd/ffi/mod.rs | 20 +- src/libstd/ffi/os_str.rs | 358 ++ src/libstd/fs.rs | 1501 +++++ src/libstd/io/buffered.rs | 633 +- src/libstd/io/cursor.rs | 408 ++ src/libstd/io/error.rs | 183 + src/libstd/io/impls.rs | 88 + src/libstd/io/mod.rs | 2434 +++----- src/libstd/io/prelude.rs | 28 + src/libstd/io/util.rs | 480 +- src/libstd/lib.rs | 79 +- src/libstd/macros.rs | 242 +- src/libstd/net/addr.rs | 608 ++ src/libstd/net/ip.rs | 465 ++ src/libstd/net/mod.rs | 99 + src/libstd/net/parser.rs | 330 + src/libstd/net/tcp.rs | 793 +++ src/libstd/net/test.rs | 39 + src/libstd/net/udp.rs | 291 + src/libstd/num/f32.rs | 62 +- src/libstd/num/f64.rs | 62 +- src/libstd/num/float_macros.rs | 2 +- src/libstd/num/i16.rs | 2 +- src/libstd/num/i32.rs | 2 +- src/libstd/num/i64.rs | 2 +- src/libstd/num/i8.rs | 2 +- src/libstd/num/int.rs | 3 +- src/libstd/num/int_macros.rs | 2 +- src/libstd/num/isize.rs | 2 +- src/libstd/num/mod.rs | 1172 +++- src/libstd/num/strconv.rs | 27 +- src/libstd/num/u16.rs | 2 +- src/libstd/num/u32.rs | 2 +- src/libstd/num/u64.rs | 2 +- src/libstd/num/u8.rs | 2 +- src/libstd/num/uint.rs | 3 +- src/libstd/num/uint_macros.rs | 30 +- src/libstd/num/usize.rs | 2 +- src/libstd/old_io/buffered.rs | 697 +++ src/libstd/{io => old_io}/comm_adapters.rs | 49 +- src/libstd/{io => old_io}/extensions.rs | 86 +- src/libstd/{io => old_io}/fs.rs | 292 +- src/libstd/{io => old_io}/mem.rs | 115 +- src/libstd/old_io/mod.rs | 1964 ++++++ src/libstd/{io => old_io}/net/addrinfo.rs | 18 +- src/libstd/{io => old_io}/net/ip.rs | 160 +- src/libstd/{io => old_io}/net/mod.rs | 4 +- src/libstd/{io => old_io}/net/pipe.rs | 117 +- src/libstd/{io => old_io}/net/tcp.rs | 222 +- src/libstd/{io => old_io}/net/udp.rs | 61 +- src/libstd/{io => old_io}/pipe.rs | 12 +- src/libstd/{io => old_io}/process.rs | 155 +- src/libstd/{io => old_io}/result.rs | 30 +- src/libstd/{io => old_io}/stdio.rs | 40 +- src/libstd/{io => old_io}/tempfile.rs | 25 +- src/libstd/{io => old_io}/test.rs | 45 +- src/libstd/{io => old_io}/timer.rs | 40 +- src/libstd/old_io/util.rs | 444 ++ src/libstd/{path => old_path}/mod.rs | 33 +- src/libstd/{path => old_path}/posix.rs | 91 +- src/libstd/{path => old_path}/windows.rs | 145 +- src/libstd/os.rs | 451 +- src/libstd/{failure.rs => panicking.rs} | 16 +- src/libstd/path.rs | 2597 ++++++++ src/libstd/prelude/mod.rs | 3 +- src/libstd/prelude/v1.rs | 63 +- src/libstd/process.rs | 834 +++ src/libstd/rand/mod.rs | 144 +- src/libstd/rand/os.rs | 47 +- src/libstd/rand/reader.rs | 8 +- src/libstd/rt/args.rs | 16 +- src/libstd/rt/at_exit_imp.rs | 6 +- src/libstd/rt/backtrace.rs | 22 +- src/libstd/rt/libunwind.rs | 5 +- src/libstd/rt/mod.rs | 8 +- src/libstd/rt/unwind.rs | 53 +- src/libstd/rt/util.rs | 80 +- src/libstd/rtdeps.rs | 6 +- src/libstd/sync/barrier.rs | 23 +- src/libstd/sync/condvar.rs | 198 +- src/libstd/sync/future.rs | 43 +- src/libstd/sync/mod.rs | 2 +- src/libstd/sync/mpsc/blocking.rs | 15 +- src/libstd/sync/mpsc/mod.rs | 438 +- src/libstd/sync/mpsc/mpsc_queue.rs | 33 +- src/libstd/sync/mpsc/oneshot.rs | 12 +- src/libstd/sync/mpsc/select.rs | 111 +- src/libstd/sync/mpsc/shared.rs | 42 +- src/libstd/sync/mpsc/spsc_queue.rs | 51 +- src/libstd/sync/mpsc/stream.rs | 26 +- src/libstd/sync/mpsc/sync.rs | 39 +- src/libstd/sync/mutex.rs | 101 +- src/libstd/sync/once.rs | 36 +- src/libstd/sync/poison.rs | 99 +- src/libstd/sync/rwlock.rs | 132 +- src/libstd/sync/semaphore.rs | 19 +- src/libstd/sync/task_pool.rs | 47 +- src/libstd/sys/common/backtrace.rs | 40 +- src/libstd/sys/common/helper_thread.rs | 11 +- src/libstd/sys/common/mod.rs | 38 +- src/libstd/sys/common/mutex.rs | 7 - src/libstd/sys/common/net.rs | 57 +- src/libstd/sys/common/net2.rs | 393 ++ src/libstd/sys/common/rwlock.rs | 7 - src/libstd/sys/common/stack.rs | 33 +- src/libstd/sys/common/thread.rs | 4 +- src/libstd/sys/common/thread_info.rs | 4 +- src/libstd/sys/common/thread_local.rs | 13 +- src/libstd/sys/common/wtf8.rs | 1266 ++++ src/libstd/sys/unix/backtrace.rs | 31 +- src/libstd/sys/unix/c.rs | 104 +- src/libstd/sys/unix/condvar.rs | 69 +- src/libstd/sys/unix/ext.rs | 178 +- src/libstd/sys/unix/fd.rs | 73 + src/libstd/sys/unix/fs.rs | 70 +- src/libstd/sys/unix/fs2.rs | 378 ++ src/libstd/sys/unix/mod.rs | 110 +- src/libstd/sys/unix/mutex.rs | 12 + src/libstd/sys/unix/net.rs | 74 + src/libstd/sys/unix/os.rs | 487 +- src/libstd/sys/unix/os_str.rs | 86 + src/libstd/sys/unix/pipe.rs | 18 +- src/libstd/sys/unix/pipe2.rs | 49 + src/libstd/sys/unix/process.rs | 302 +- src/libstd/sys/unix/process2.rs | 445 ++ src/libstd/sys/unix/rwlock.rs | 13 + src/libstd/sys/unix/stack_overflow.rs | 36 +- src/libstd/sys/unix/sync.rs | 22 +- src/libstd/sys/unix/tcp.rs | 4 +- src/libstd/sys/unix/thread.rs | 118 +- src/libstd/sys/unix/thread_local.rs | 8 +- src/libstd/sys/unix/time.rs | 125 + src/libstd/sys/unix/timer.rs | 6 +- src/libstd/sys/unix/tty.rs | 47 +- src/libstd/sys/windows/backtrace.rs | 59 +- src/libstd/sys/windows/c.rs | 241 +- src/libstd/sys/windows/condvar.rs | 14 +- src/libstd/sys/windows/ext.rs | 120 +- src/libstd/sys/windows/fs.rs | 52 +- src/libstd/sys/windows/fs2.rs | 412 ++ src/libstd/sys/windows/handle.rs | 76 + src/libstd/sys/windows/mod.rs | 225 +- src/libstd/sys/windows/mutex.rs | 72 +- src/libstd/sys/windows/net.rs | 121 + src/libstd/sys/windows/os.rs | 457 +- src/libstd/sys/windows/os_str.rs | 82 + src/libstd/sys/windows/pipe.rs | 39 +- src/libstd/sys/windows/pipe2.rs | 77 + src/libstd/sys/windows/process.rs | 248 +- src/libstd/sys/windows/process2.rs | 479 ++ src/libstd/sys/windows/rwlock.rs | 3 - src/libstd/sys/windows/stack_overflow.rs | 12 +- src/libstd/sys/windows/sync.rs | 46 +- src/libstd/sys/windows/tcp.rs | 17 +- src/libstd/sys/windows/thread.rs | 18 +- src/libstd/sys/windows/thread_local.rs | 12 +- src/libstd/sys/windows/time.rs | 50 + src/libstd/sys/windows/timer.rs | 6 +- src/libstd/sys/windows/tty.rs | 13 +- src/libstd/thread.rs | 594 +- src/libstd/thread_local/mod.rs | 55 +- src/libstd/thread_local/scoped.rs | 31 +- src/libstd/thunk.rs | 22 +- src/libstd/time/duration.rs | 42 +- src/libstd/time/mod.rs | 70 +- src/libstd/tuple.rs | 12 +- src/libstd/unit.rs | 2 +- src/libsyntax/abi.rs | 32 +- src/libsyntax/ast.rs | 384 +- src/libsyntax/ast_map/blocks.rs | 8 +- src/libsyntax/ast_map/mod.rs | 86 +- src/libsyntax/ast_util.rs | 180 +- src/libsyntax/attr.rs | 206 +- src/libsyntax/codemap.rs | 165 +- src/libsyntax/config.rs | 107 +- src/libsyntax/diagnostic.rs | 246 +- src/libsyntax/diagnostics/macros.rs | 22 +- src/libsyntax/diagnostics/plugin.rs | 34 +- src/libsyntax/diagnostics/registry.rs | 5 +- src/libsyntax/ext/asm.rs | 21 +- src/libsyntax/ext/base.rs | 140 +- src/libsyntax/ext/build.rs | 216 +- src/libsyntax/ext/cfg.rs | 2 +- src/libsyntax/ext/cfg_attr.rs | 34 - src/libsyntax/ext/concat.rs | 6 +- src/libsyntax/ext/concat_idents.rs | 13 +- src/libsyntax/ext/deriving/bounds.rs | 23 +- src/libsyntax/ext/deriving/clone.rs | 17 +- src/libsyntax/ext/deriving/cmp/eq.rs | 11 +- src/libsyntax/ext/deriving/cmp/ord.rs | 23 +- src/libsyntax/ext/deriving/cmp/totaleq.rs | 7 +- src/libsyntax/ext/deriving/cmp/totalord.rs | 15 +- src/libsyntax/ext/deriving/decodable.rs | 35 +- src/libsyntax/ext/deriving/default.rs | 16 +- src/libsyntax/ext/deriving/encodable.rs | 28 +- src/libsyntax/ext/deriving/generic/mod.rs | 190 +- src/libsyntax/ext/deriving/generic/ty.rs | 18 +- src/libsyntax/ext/deriving/hash.rs | 58 +- src/libsyntax/ext/deriving/mod.rs | 50 +- src/libsyntax/ext/deriving/primitive.rs | 26 +- src/libsyntax/ext/deriving/rand.rs | 31 +- src/libsyntax/ext/deriving/show.rs | 19 +- src/libsyntax/ext/env.rs | 24 +- src/libsyntax/ext/expand.rs | 601 +- src/libsyntax/ext/format.rs | 184 +- src/libsyntax/ext/log_syntax.rs | 8 + src/libsyntax/ext/mtwt.rs | 16 +- src/libsyntax/ext/quote.rs | 46 +- src/libsyntax/ext/source_util.rs | 36 +- src/libsyntax/ext/trace_macros.rs | 10 + src/libsyntax/ext/tt/macro_parser.rs | 100 +- src/libsyntax/ext/tt/macro_rules.rs | 165 +- src/libsyntax/ext/tt/transcribe.rs | 14 +- src/libsyntax/feature_gate.rs | 510 +- src/libsyntax/fold.rs | 232 +- src/libsyntax/lib.rs | 19 +- src/libsyntax/owned_slice.rs | 12 +- src/libsyntax/parse/attr.rs | 9 +- src/libsyntax/parse/lexer/comments.rs | 44 +- src/libsyntax/parse/lexer/mod.rs | 107 +- src/libsyntax/parse/mod.rs | 190 +- src/libsyntax/parse/obsolete.rs | 82 +- src/libsyntax/parse/parser.rs | 1392 ++--- src/libsyntax/parse/token.rs | 155 +- src/libsyntax/print/pp.rs | 327 +- src/libsyntax/print/pprust.rs | 907 ++- src/libsyntax/ptr.rs | 18 +- src/libsyntax/show_span.rs | 9 +- src/libsyntax/std_inject.rs | 74 +- src/libsyntax/test.rs | 186 +- src/libsyntax/util/interner.rs | 121 +- src/libsyntax/util/parser_testing.rs | 11 +- src/libsyntax/util/small_vector.rs | 45 +- src/libsyntax/visit.rs | 195 +- src/libterm/lib.rs | 36 +- src/libterm/terminfo/mod.rs | 45 +- src/libterm/terminfo/parm.rs | 34 +- src/libterm/terminfo/parser/compiled.rs | 18 +- src/libterm/terminfo/searcher.rs | 27 +- src/libterm/win.rs | 12 +- src/libtest/lib.rs | 738 +-- src/libtest/stats.rs | 170 +- src/libunicode/lib.rs | 19 +- src/libunicode/normalize.rs | 4 +- src/libunicode/tables.rs | 15 +- src/libunicode/u_char.rs | 132 +- src/libunicode/u_str.rs | 58 +- src/llvm/.clang-tidy | 2 +- src/llvm/CMakeLists.txt | 64 +- src/llvm/CODE_OWNERS.TXT | 40 +- src/llvm/Makefile.config.in | 12 +- src/llvm/Makefile.rules | 2 +- src/llvm/README.txt | 5 +- src/llvm/autoconf/config.sub | 4 +- src/llvm/autoconf/configure.ac | 114 +- src/llvm/bindings/Makefile | 6 +- src/llvm/bindings/go/README.txt | 53 + src/llvm/bindings/go/build.sh | 28 + src/llvm/bindings/go/conftest.go | 16 + .../bindings/go/llvm/DIBuilderBindings.cpp | 242 + src/llvm/bindings/go/llvm/DIBuilderBindings.h | 135 + src/llvm/bindings/go/llvm/IRBindings.cpp | 100 + src/llvm/bindings/go/llvm/IRBindings.h | 73 + .../go/llvm/InstrumentationBindings.cpp | 42 + .../go/llvm/InstrumentationBindings.h | 38 + src/llvm/bindings/go/llvm/SupportBindings.cpp | 27 + src/llvm/bindings/go/llvm/SupportBindings.h | 30 + src/llvm/bindings/go/llvm/analysis.go | 68 + src/llvm/bindings/go/llvm/bitreader.go | 50 + src/llvm/bindings/go/llvm/bitwriter.go | 39 + src/llvm/bindings/go/llvm/dibuilder.go | 491 ++ src/llvm/bindings/go/llvm/executionengine.go | 177 + .../bindings/go/llvm/executionengine_test.go | 98 + src/llvm/bindings/go/llvm/ir.go | 1846 ++++++ src/llvm/bindings/go/llvm/ir_test.go | 95 + src/llvm/bindings/go/llvm/linker.go | 32 + src/llvm/bindings/go/llvm/llvm_config.go.in | 12 + src/llvm/bindings/go/llvm/llvm_dep.go | 19 + src/llvm/bindings/go/llvm/string.go | 105 + src/llvm/bindings/go/llvm/string_test.go | 28 + src/llvm/bindings/go/llvm/support.go | 54 + src/llvm/bindings/go/llvm/target.go | 300 + .../go/llvm/transforms_instrumentation.go | 43 + src/llvm/bindings/go/llvm/transforms_ipo.go | 42 + .../bindings/go/llvm/transforms_pmbuilder.go | 48 + .../bindings/go/llvm/transforms_scalar.go | 45 + src/llvm/bindings/go/llvm/version.go | 21 + src/llvm/bindings/ocaml/CMakeLists.txt | 11 + src/llvm/bindings/ocaml/Makefile | 4 +- src/llvm/bindings/ocaml/Makefile.ocaml | 142 +- .../ocaml/all_backends/CMakeLists.txt | 5 + src/llvm/bindings/ocaml/all_backends/Makefile | 4 +- .../bindings/ocaml/analysis/CMakeLists.txt | 5 + src/llvm/bindings/ocaml/analysis/Makefile | 8 +- .../bindings/ocaml/analysis/analysis_ocaml.c | 9 +- .../bindings/ocaml/analysis/llvm_analysis.ml | 2 +- .../bindings/ocaml/analysis/llvm_analysis.mli | 2 +- .../bindings/ocaml/backends/CMakeLists.txt | 27 + .../ocaml/backends/META.llvm_backend.in | 1 - .../bindings/ocaml/backends/backend_ocaml.c | 9 +- .../bindings/ocaml/bitreader/CMakeLists.txt | 5 + src/llvm/bindings/ocaml/bitreader/Makefile | 8 +- .../ocaml/bitreader/bitreader_ocaml.c | 56 +- .../ocaml/bitreader/llvm_bitreader.ml | 17 +- .../ocaml/bitreader/llvm_bitreader.mli | 3 +- .../bindings/ocaml/bitwriter/CMakeLists.txt | 5 + src/llvm/bindings/ocaml/bitwriter/Makefile | 8 +- .../ocaml/bitwriter/bitwriter_ocaml.c | 23 +- .../ocaml/bitwriter/llvm_bitwriter.ml | 17 +- .../ocaml/bitwriter/llvm_bitwriter.mli | 19 +- .../ocaml/executionengine/CMakeLists.txt | 6 + .../bindings/ocaml/executionengine/Makefile | 13 +- .../executionengine/executionengine_ocaml.c | 315 +- .../executionengine/llvm_executionengine.ml | 151 +- .../executionengine/llvm_executionengine.mli | 221 +- .../bindings/ocaml/irreader/CMakeLists.txt | 5 + .../bindings/ocaml/irreader/irreader_ocaml.c | 30 +- .../bindings/ocaml/irreader/llvm_irreader.ml | 3 +- src/llvm/bindings/ocaml/linker/CMakeLists.txt | 5 + src/llvm/bindings/ocaml/linker/linker_ocaml.c | 34 +- src/llvm/bindings/ocaml/linker/llvm_linker.ml | 13 +- .../bindings/ocaml/linker/llvm_linker.mli | 9 +- src/llvm/bindings/ocaml/llvm/CMakeLists.txt | 11 + src/llvm/bindings/ocaml/llvm/META.llvm.in | 11 +- src/llvm/bindings/ocaml/llvm/Makefile | 9 +- src/llvm/bindings/ocaml/llvm/llvm.ml | 78 +- src/llvm/bindings/ocaml/llvm/llvm.mli | 190 +- src/llvm/bindings/ocaml/llvm/llvm_ocaml.c | 223 +- src/llvm/bindings/ocaml/target/CMakeLists.txt | 5 + src/llvm/bindings/ocaml/target/llvm_target.ml | 5 +- .../bindings/ocaml/target/llvm_target.mli | 6 +- src/llvm/bindings/ocaml/target/target_ocaml.c | 68 +- .../bindings/ocaml/transforms/CMakeLists.txt | 5 + src/llvm/bindings/ocaml/transforms/Makefile | 2 +- .../ocaml/transforms/ipo/CMakeLists.txt | 5 + .../bindings/ocaml/transforms/ipo/Makefile | 4 +- .../bindings/ocaml/transforms/ipo/ipo_ocaml.c | 10 +- .../bindings/ocaml/transforms/ipo/llvm_ipo.ml | 70 +- .../ocaml/transforms/ipo/llvm_ipo.mli | 124 +- .../transforms/passmgr_builder/CMakeLists.txt | 5 + .../passmgr_builder/llvm_passmgr_builder.mli | 20 +- .../passmgr_builder/passmgr_builder_ocaml.c | 8 +- .../transforms/scalar/llvm_scalar_opts.ml | 114 - .../transforms/scalar/llvm_scalar_opts.mli | 168 - .../transforms/scalar_opts/CMakeLists.txt | 5 + .../{scalar => scalar_opts}/Makefile | 2 +- .../scalar_opts/llvm_scalar_opts.ml | 120 + .../scalar_opts/llvm_scalar_opts.mli | 198 + .../scalar_opts_ocaml.c | 130 +- .../ocaml/transforms/utils/CMakeLists.txt | 5 + .../bindings/ocaml/transforms/utils/Makefile | 19 + .../transforms/utils/llvm_transform_utils.ml | 10 + .../transforms/utils/llvm_transform_utils.mli | 17 + .../transforms/utils/transform_utils_ocaml.c | 31 + .../ocaml/transforms/vectorize/CMakeLists.txt | 5 + .../ocaml/transforms/vectorize/Makefile | 2 +- .../transforms/vectorize/llvm_vectorize.ml | 15 +- .../transforms/vectorize/llvm_vectorize.mli | 17 +- src/llvm/cmake/config-ix.cmake | 54 +- src/llvm/cmake/modules/AddLLVM.cmake | 124 +- src/llvm/cmake/modules/AddOCaml.cmake | 201 + src/llvm/cmake/modules/CMakeLists.txt | 2 +- src/llvm/cmake/modules/FindOCaml.cmake | 103 + src/llvm/cmake/modules/GetSVN.cmake | 128 +- .../cmake/modules/HandleLLVMOptions.cmake | 22 +- src/llvm/cmake/modules/LLVM-Config.cmake | 50 +- src/llvm/cmake/modules/LLVMConfig.cmake.in | 2 + src/llvm/cmake/modules/Makefile | 3 +- src/llvm/configure | 704 +-- src/llvm/docs/Atomics.rst | 54 +- src/llvm/docs/BitCodeFormat.rst | 10 +- src/llvm/docs/CMake.rst | 8 +- src/llvm/docs/CMakeLists.txt | 43 + src/llvm/docs/CodeGenerator.rst | 6 +- src/llvm/docs/CodingStandards.rst | 19 + .../docs/CommandGuide/llvm-symbolizer.rst | 7 + src/llvm/docs/CommandGuide/opt.rst | 23 +- src/llvm/docs/CommandLine.rst | 10 +- src/llvm/docs/CompilerWriterInfo.rst | 1 + src/llvm/docs/ExtendingLLVM.rst | 8 +- src/llvm/docs/GettingStarted.rst | 4 +- src/llvm/docs/GettingStartedVS.rst | 4 +- src/llvm/docs/GoldPlugin.rst | 8 +- src/llvm/docs/HowToSubmitABug.rst | 2 +- src/llvm/docs/LangRef.rst | 611 +- src/llvm/docs/LinkTimeOptimization.rst | 2 +- src/llvm/docs/Makefile | 7 +- src/llvm/docs/MergeFunctions.rst | 802 +++ src/llvm/docs/Passes.rst | 25 +- src/llvm/docs/Phabricator.rst | 3 +- src/llvm/docs/R600Usage.rst | 43 + src/llvm/docs/ReleaseNotes.rst | 468 +- src/llvm/docs/SourceLevelDebugging.rst | 911 +-- src/llvm/docs/StackMaps.rst | 6 + src/llvm/docs/Statepoints.rst | 411 ++ src/llvm/docs/TableGen/index.rst | 3 +- src/llvm/docs/TestingGuide.rst | 54 +- src/llvm/docs/WritingAnLLVMBackend.rst | 2 +- src/llvm/docs/WritingAnLLVMPass.rst | 13 +- src/llvm/docs/index.rst | 20 + src/llvm/docs/tutorial/LangImpl3.rst | 2 +- src/llvm/docs/tutorial/LangImpl4.rst | 2 +- src/llvm/docs/tutorial/LangImpl5.rst | 2 +- src/llvm/docs/tutorial/LangImpl6.rst | 2 +- src/llvm/docs/tutorial/LangImpl7.rst | 2 +- src/llvm/docs/tutorial/LangImpl8.rst | 716 ++- src/llvm/docs/tutorial/LangImpl9.rst | 267 + .../examples/ExceptionDemo/CMakeLists.txt | 1 + .../examples/ExceptionDemo/ExceptionDemo.cpp | 4 +- src/llvm/examples/Kaleidoscope/CMakeLists.txt | 9 + .../Kaleidoscope/Chapter2/CMakeLists.txt | 2 +- .../Kaleidoscope/Chapter3/CMakeLists.txt | 2 +- .../Kaleidoscope/Chapter4/CMakeLists.txt | 5 +- .../examples/Kaleidoscope/Chapter4/toy.cpp | 261 +- .../Kaleidoscope/Chapter5/CMakeLists.txt | 5 +- .../examples/Kaleidoscope/Chapter5/toy.cpp | 458 +- .../Kaleidoscope/Chapter6/CMakeLists.txt | 5 +- .../examples/Kaleidoscope/Chapter6/toy.cpp | 513 +- .../Kaleidoscope/Chapter7/CMakeLists.txt | 5 +- .../examples/Kaleidoscope/Chapter7/toy.cpp | 597 +- .../Kaleidoscope/Chapter8/CMakeLists.txt | 18 + .../Kaleidoscope/Chapter8}/Makefile | 17 +- .../examples/Kaleidoscope/Chapter8/toy.cpp | 1494 +++++ src/llvm/examples/Kaleidoscope/Makefile | 2 +- src/llvm/examples/ParallelJIT/CMakeLists.txt | 1 + src/llvm/include/llvm-c/BitWriter.h | 3 + src/llvm/include/llvm-c/Core.h | 94 +- src/llvm/include/llvm-c/ExecutionEngine.h | 4 + src/llvm/include/llvm-c/Linker.h | 9 +- src/llvm/include/llvm-c/Support.h | 11 + src/llvm/include/llvm-c/lto.h | 50 +- src/llvm/include/llvm/ADT/APFloat.h | 103 +- src/llvm/include/llvm/ADT/APInt.h | 10 +- src/llvm/include/llvm/ADT/APSInt.h | 16 +- src/llvm/include/llvm/ADT/BitVector.h | 3 + src/llvm/include/llvm/ADT/DenseMap.h | 202 +- src/llvm/include/llvm/ADT/DenseSet.h | 54 +- .../include/llvm/ADT/DepthFirstIterator.h | 2 +- src/llvm/include/llvm/ADT/MapVector.h | 48 +- src/llvm/include/llvm/ADT/PostOrderIterator.h | 7 +- src/llvm/include/llvm/ADT/STLExtras.h | 27 +- src/llvm/include/llvm/ADT/ScopedHashTable.h | 4 +- src/llvm/include/llvm/ADT/SetVector.h | 4 +- src/llvm/include/llvm/ADT/SmallBitVector.h | 8 +- src/llvm/include/llvm/ADT/SmallPtrSet.h | 19 +- src/llvm/include/llvm/ADT/SmallSet.h | 16 +- src/llvm/include/llvm/ADT/SmallVector.h | 71 +- src/llvm/include/llvm/ADT/SparseBitVector.h | 2 +- src/llvm/include/llvm/ADT/SparseMultiSet.h | 2 +- src/llvm/include/llvm/ADT/SparseSet.h | 2 +- src/llvm/include/llvm/ADT/StringMap.h | 45 +- src/llvm/include/llvm/ADT/StringRef.h | 12 +- src/llvm/include/llvm/ADT/StringSet.h | 15 +- src/llvm/include/llvm/ADT/TinyPtrVector.h | 7 + src/llvm/include/llvm/ADT/Triple.h | 25 +- src/llvm/include/llvm/ADT/Twine.h | 14 +- src/llvm/include/llvm/ADT/iterator.h | 2 +- src/llvm/include/llvm/ADT/iterator_range.h | 5 +- .../include/llvm/Analysis/AliasAnalysis.h | 35 +- .../include/llvm/Analysis/AliasSetTracker.h | 9 +- .../include/llvm/Analysis/AssumptionCache.h | 142 + .../include/llvm/Analysis/AssumptionTracker.h | 128 - .../llvm/Analysis/BlockFrequencyInfoImpl.h | 2 +- .../llvm/Analysis/BranchProbabilityInfo.h | 4 + .../include/llvm/Analysis/CGSCCPassManager.h | 192 +- src/llvm/include/llvm/Analysis/CallGraph.h | 35 +- src/llvm/include/llvm/Analysis/CodeMetrics.h | 10 +- .../llvm/Analysis/DependenceAnalysis.h | 8 +- .../include/llvm/Analysis/DominanceFrontier.h | 2 + .../llvm/Analysis/DominanceFrontierImpl.h | 4 +- .../include/llvm/Analysis/FindUsedTypes.h | 66 - .../Analysis/FunctionTargetTransformInfo.h | 2 +- src/llvm/include/llvm/Analysis/InlineCost.h | 4 +- .../llvm/Analysis/InstructionSimplify.h | 84 +- .../include/llvm/Analysis/IntervalIterator.h | 4 +- .../llvm/Analysis/JumpInstrTableInfo.h | 15 +- .../include/llvm/Analysis/LazyCallGraph.h | 14 +- .../include/llvm/Analysis/LazyValueInfo.h | 25 +- .../llvm/Analysis/MemoryDependenceAnalysis.h | 18 +- src/llvm/include/llvm/Analysis/PHITransAddr.h | 10 +- src/llvm/include/llvm/Analysis/Passes.h | 2 + src/llvm/include/llvm/Analysis/RegionInfo.h | 4 + .../include/llvm/Analysis/RegionInfoImpl.h | 2 +- .../include/llvm/Analysis/ScalarEvolution.h | 36 +- .../Analysis/ScalarEvolutionExpressions.h | 6 +- .../llvm/Analysis/TargetTransformInfo.h | 7 + .../include/llvm/Analysis/ValueTracking.h | 31 +- .../include/llvm/Bitcode/BitcodeWriterPass.h | 2 +- .../include/llvm/Bitcode/BitstreamReader.h | 273 +- src/llvm/include/llvm/Bitcode/LLVMBitCodes.h | 12 +- src/llvm/include/llvm/Bitcode/ReaderWriter.h | 70 +- src/llvm/include/llvm/CodeGen/Analysis.h | 21 +- src/llvm/include/llvm/CodeGen/AsmPrinter.h | 17 +- .../include/llvm/CodeGen/CalcSpillWeights.h | 6 +- .../include/llvm/CodeGen/CallingConvLower.h | 51 +- src/llvm/include/llvm/CodeGen/CommandFlags.h | 47 +- src/llvm/include/llvm/CodeGen/DFAPacketizer.h | 1 - .../AsmPrinter => include/llvm/CodeGen}/DIE.h | 0 src/llvm/include/llvm/CodeGen/FastISel.h | 11 +- .../CodeGen/ForwardControlFlowIntegrity.h | 122 + .../llvm/CodeGen/FunctionLoweringInfo.h | 15 +- src/llvm/include/llvm/CodeGen/GCMetadata.h | 36 +- .../include/llvm/CodeGen/GCMetadataPrinter.h | 26 +- src/llvm/include/llvm/CodeGen/GCStrategy.h | 173 +- src/llvm/include/llvm/CodeGen/GCs.h | 2 + src/llvm/include/llvm/CodeGen/ISDOpcodes.h | 13 +- .../include/llvm/CodeGen/JumpInstrTables.h | 31 +- src/llvm/include/llvm/CodeGen/LexicalScopes.h | 16 +- .../llvm/CodeGen/LinkAllCodegenComponents.h | 1 + src/llvm/include/llvm/CodeGen/LiveInterval.h | 180 +- .../llvm/CodeGen/LiveIntervalAnalysis.h | 49 +- .../include/llvm/CodeGen/LiveIntervalUnion.h | 10 +- .../include/llvm/CodeGen/MachineBasicBlock.h | 6 + .../include/llvm/CodeGen/MachineDominators.h | 2 +- .../include/llvm/CodeGen/MachineFrameInfo.h | 17 +- .../include/llvm/CodeGen/MachineFunction.h | 18 +- src/llvm/include/llvm/CodeGen/MachineInstr.h | 21 +- .../llvm/CodeGen/MachineInstrBuilder.h | 49 +- .../include/llvm/CodeGen/MachineModuleInfo.h | 43 +- .../llvm/CodeGen/MachineRegisterInfo.h | 13 + .../include/llvm/CodeGen/MachineScheduler.h | 1 - .../include/llvm/CodeGen/MachineValueType.h | 54 + .../include/llvm/CodeGen/PBQP/CostAllocator.h | 119 +- src/llvm/include/llvm/CodeGen/PBQP/Graph.h | 185 +- src/llvm/include/llvm/CodeGen/PBQP/Math.h | 65 +- .../llvm/CodeGen/PBQP/ReductionRules.h | 4 +- .../llvm/CodeGen/PBQP/RegAllocSolver.h | 359 -- src/llvm/include/llvm/CodeGen/PBQP/Solution.h | 4 +- .../include/llvm/CodeGen/PBQPRAConstraint.h | 69 + src/llvm/include/llvm/CodeGen/Passes.h | 71 +- src/llvm/include/llvm/CodeGen/RegAllocPBQP.h | 615 +- .../include/llvm/CodeGen/RuntimeLibcalls.h | 10 + src/llvm/include/llvm/CodeGen/ScheduleDAG.h | 6 + src/llvm/include/llvm/CodeGen/SelectionDAG.h | 36 +- .../include/llvm/CodeGen/SelectionDAGISel.h | 15 +- .../include/llvm/CodeGen/SelectionDAGNodes.h | 90 +- src/llvm/include/llvm/CodeGen/StackMaps.h | 58 +- .../CodeGen/TargetLoweringObjectFileImpl.h | 2 - src/llvm/include/llvm/Config/config.h.cmake | 15 +- src/llvm/include/llvm/Config/config.h.in | 6 + .../include/llvm/Config/llvm-config.h.cmake | 3 + src/llvm/include/llvm/Config/llvm-config.h.in | 3 + src/llvm/include/llvm/DebugInfo/DIContext.h | 15 +- .../DebugInfo/DWARFAbbreviationDeclaration.h | 0 .../llvm/DebugInfo/DWARFAcceleratorTable.h | 49 + .../llvm}/DebugInfo/DWARFCompileUnit.h | 10 +- .../llvm}/DebugInfo/DWARFContext.h | 74 +- .../llvm}/DebugInfo/DWARFDebugAbbrev.h | 2 +- .../llvm}/DebugInfo/DWARFDebugArangeSet.h | 0 .../llvm}/DebugInfo/DWARFDebugAranges.h | 0 .../llvm}/DebugInfo/DWARFDebugFrame.h | 0 .../llvm}/DebugInfo/DWARFDebugInfoEntry.h | 13 +- .../llvm}/DebugInfo/DWARFDebugLine.h | 2 +- .../llvm}/DebugInfo/DWARFDebugLoc.h | 2 +- .../llvm}/DebugInfo/DWARFDebugRangeList.h | 0 .../include/llvm/DebugInfo/DWARFFormValue.h | 7 + .../llvm}/DebugInfo/DWARFRelocMap.h | 0 .../include/llvm/DebugInfo/DWARFSection.h | 24 + .../llvm}/DebugInfo/DWARFTypeUnit.h | 10 +- .../llvm}/DebugInfo/DWARFUnit.h | 60 +- .../llvm/ExecutionEngine/ExecutionEngine.h | 23 +- .../llvm/ExecutionEngine/JITEventListener.h | 36 +- .../llvm/ExecutionEngine/ObjectBuffer.h | 76 - .../llvm/ExecutionEngine/ObjectImage.h | 76 - .../ExecutionEngine/RTDyldMemoryManager.h | 7 +- .../llvm/ExecutionEngine/RuntimeDyld.h | 43 +- src/llvm/include/llvm/IR/CFG.h | 6 + src/llvm/include/llvm/IR/CallingConv.h | 6 +- src/llvm/include/llvm/IR/ConstantRange.h | 95 +- src/llvm/include/llvm/IR/Constants.h | 5 +- src/llvm/include/llvm/IR/DIBuilder.h | 140 +- src/llvm/include/llvm/IR/DataLayout.h | 300 +- src/llvm/include/llvm/IR/DebugInfo.h | 717 ++- src/llvm/include/llvm/IR/DebugLoc.h | 98 +- src/llvm/include/llvm/IR/DerivedTypes.h | 12 +- src/llvm/include/llvm/IR/DiagnosticInfo.h | 4 + src/llvm/include/llvm/IR/Dominators.h | 49 + src/llvm/include/llvm/IR/Function.h | 33 +- src/llvm/include/llvm/IR/GVMaterializer.h | 10 +- src/llvm/include/llvm/IR/GlobalObject.h | 16 +- src/llvm/include/llvm/IR/GlobalValue.h | 11 +- src/llvm/include/llvm/IR/IRBuilder.h | 91 +- src/llvm/include/llvm/IR/IRPrintingPasses.h | 4 +- src/llvm/include/llvm/IR/InstrTypes.h | 25 +- src/llvm/include/llvm/IR/Instruction.h | 14 +- src/llvm/include/llvm/IR/Instructions.h | 2 +- src/llvm/include/llvm/IR/IntrinsicInst.h | 46 +- src/llvm/include/llvm/IR/Intrinsics.h | 44 +- src/llvm/include/llvm/IR/Intrinsics.td | 55 +- src/llvm/include/llvm/IR/IntrinsicsARM.td | 9 +- src/llvm/include/llvm/IR/IntrinsicsPowerPC.td | 66 + src/llvm/include/llvm/IR/IntrinsicsR600.td | 14 +- src/llvm/include/llvm/IR/IntrinsicsX86.td | 547 ++ src/llvm/include/llvm/IR/LLVMContext.h | 14 +- src/llvm/include/llvm/IR/LeakDetector.h | 92 - src/llvm/include/llvm/IR/LegacyPassManager.h | 12 +- src/llvm/include/llvm/IR/LegacyPassManagers.h | 9 + src/llvm/include/llvm/IR/MDBuilder.h | 5 + src/llvm/include/llvm/IR/Metadata.def | 59 + src/llvm/include/llvm/IR/Metadata.h | 938 ++- src/llvm/include/llvm/IR/MetadataTracking.h | 99 + src/llvm/include/llvm/IR/Module.h | 79 +- src/llvm/include/llvm/IR/Operator.h | 61 +- src/llvm/include/llvm/IR/PassManager.h | 801 +-- .../include/llvm/IR/PassManagerInternal.h | 349 ++ src/llvm/include/llvm/IR/PatternMatch.h | 755 ++- src/llvm/include/llvm/IR/Statepoint.h | 215 + src/llvm/include/llvm/IR/TrackingMDRef.h | 170 + src/llvm/include/llvm/IR/Type.h | 3 + src/llvm/include/llvm/IR/TypeFinder.h | 1 + src/llvm/include/llvm/IR/User.h | 45 +- src/llvm/include/llvm/IR/Value.h | 218 +- src/llvm/include/llvm/IR/ValueHandle.h | 170 +- src/llvm/include/llvm/IR/ValueMap.h | 32 +- src/llvm/include/llvm/IR/Verifier.h | 4 +- src/llvm/include/llvm/InitializePasses.h | 9 +- src/llvm/include/llvm/LTO/LTOCodeGenerator.h | 12 +- src/llvm/include/llvm/LTO/LTOModule.h | 22 +- src/llvm/include/llvm/LinkAllPasses.h | 8 +- src/llvm/include/llvm/Linker/Linker.h | 84 +- src/llvm/include/llvm/MC/ConstantPools.h | 2 + src/llvm/include/llvm/MC/MCAsmBackend.h | 8 - src/llvm/include/llvm/MC/MCAsmInfo.h | 64 +- src/llvm/include/llvm/MC/MCAsmInfoDarwin.h | 2 +- src/llvm/include/llvm/MC/MCAsmInfoELF.h | 3 + src/llvm/include/llvm/MC/MCAssembler.h | 74 +- src/llvm/include/llvm/MC/MCContext.h | 8 + src/llvm/include/llvm/MC/MCDisassembler.h | 31 +- src/llvm/include/llvm/MC/MCDwarf.h | 12 +- src/llvm/include/llvm/MC/MCELFStreamer.h | 5 +- src/llvm/include/llvm/MC/MCExpr.h | 32 +- src/llvm/include/llvm/MC/MCInst.h | 9 +- src/llvm/include/llvm/MC/MCInstrDesc.h | 11 +- src/llvm/include/llvm/MC/MCInstrItineraries.h | 51 +- .../llvm/MC/MCLinkerOptimizationHint.h | 2 +- src/llvm/include/llvm/MC/MCMachObjectWriter.h | 6 +- src/llvm/include/llvm/MC/MCObjectStreamer.h | 11 +- .../include/llvm/MC/MCParser/MCAsmLexer.h | 43 +- .../include/llvm/MC/MCParser/MCAsmParser.h | 71 +- .../llvm/MC/MCParser/MCAsmParserExtension.h | 9 + src/llvm/include/llvm/MC/MCRegisterInfo.h | 85 +- src/llvm/include/llvm/MC/MCSchedule.h | 2 +- src/llvm/include/llvm/MC/MCStreamer.h | 23 +- src/llvm/include/llvm/MC/MCSubtargetInfo.h | 9 + src/llvm/include/llvm/MC/MCSymbol.h | 18 +- src/llvm/include/llvm/MC/MCTargetAsmParser.h | 1 - src/llvm/include/llvm/MC/MCTargetOptions.h | 12 +- .../llvm/MC/MCTargetOptionsCommandFlags.h | 8 +- src/llvm/include/llvm/MC/MCWinCOFFStreamer.h | 2 +- src/llvm/include/llvm/MC/StringTableBuilder.h | 5 +- src/llvm/include/llvm/Object/Archive.h | 11 +- src/llvm/include/llvm/Object/Binary.h | 21 +- src/llvm/include/llvm/Object/COFF.h | 241 +- src/llvm/include/llvm/Object/COFFYAML.h | 32 + src/llvm/include/llvm/Object/ELFObjectFile.h | 137 +- src/llvm/include/llvm/Object/ELFTypes.h | 4 + src/llvm/include/llvm/Object/ELFYAML.h | 10 +- src/llvm/include/llvm/Object/IRObjectFile.h | 10 +- src/llvm/include/llvm/Object/MachO.h | 53 +- src/llvm/include/llvm/Object/MachOUniversal.h | 14 +- src/llvm/include/llvm/Object/ObjectFile.h | 99 +- src/llvm/include/llvm/Object/RelocVisitor.h | 319 +- src/llvm/include/llvm/Pass.h | 11 +- src/llvm/include/llvm/PassRegistry.h | 48 +- src/llvm/include/llvm/PassSupport.h | 9 + .../llvm/ProfileData/CoverageMapping.h | 104 +- .../llvm/ProfileData/CoverageMappingReader.h | 9 +- .../llvm/ProfileData/CoverageMappingWriter.h | 2 +- .../llvm/ProfileData/InstrProfReader.h | 7 +- .../llvm/ProfileData/InstrProfWriter.h | 1 - .../include/llvm/ProfileData/SampleProf.h | 247 + .../llvm/ProfileData/SampleProfReader.h | 200 +- .../llvm/ProfileData/SampleProfWriter.h | 110 + .../include/llvm/Support/ARMBuildAttributes.h | 5 + src/llvm/include/llvm/Support/Allocator.h | 4 +- src/llvm/include/llvm/Support/COFF.h | 13 +- src/llvm/include/llvm/Support/Casting.h | 34 + src/llvm/include/llvm/Support/CodeGen.h | 4 + src/llvm/include/llvm/Support/CommandLine.h | 819 +-- src/llvm/include/llvm/Support/Compiler.h | 57 +- src/llvm/include/llvm/Support/Compression.h | 2 +- .../llvm/Support/CrashRecoveryContext.h | 3 +- src/llvm/include/llvm/Support/DataExtractor.h | 11 + .../include/llvm/Support/DataTypes.h.cmake | 6 - src/llvm/include/llvm/Support/DataTypes.h.in | 6 - src/llvm/include/llvm/Support/Dwarf.h | 173 +- src/llvm/include/llvm/Support/ELF.h | 782 +-- .../llvm/Support/ELFRelocs/AArch64.def | 147 + .../include/llvm/Support/ELFRelocs/ARM.def | 138 + .../llvm/Support/ELFRelocs/Hexagon.def | 92 + .../include/llvm/Support/ELFRelocs/Mips.def | 112 + .../llvm/Support/ELFRelocs/PowerPC.def | 61 + .../llvm/Support/ELFRelocs/PowerPC64.def | 88 + .../include/llvm/Support/ELFRelocs/Sparc.def | 89 + .../llvm/Support/ELFRelocs/SystemZ.def | 67 + .../include/llvm/Support/ELFRelocs/i386.def | 47 + .../include/llvm/Support/ELFRelocs/x86_64.def | 44 + src/llvm/include/llvm/Support/ErrorOr.h | 8 +- .../include/llvm/Support/FileOutputBuffer.h | 2 +- src/llvm/include/llvm/Support/FileSystem.h | 42 +- src/llvm/include/llvm/Support/Format.h | 1 - .../include/llvm/Support/GenericDomTree.h | 294 +- .../llvm/Support/GenericDomTreeConstruction.h | 2 +- src/llvm/include/llvm/Support/MD5.h | 4 +- src/llvm/include/llvm/Support/MachO.h | 351 +- src/llvm/include/llvm/Support/MathExtras.h | 19 +- src/llvm/include/llvm/Support/MemoryBuffer.h | 22 +- src/llvm/include/llvm/Support/MemoryObject.h | 70 +- .../include/llvm/Support/OnDiskHashTable.h | 2 +- src/llvm/include/llvm/Support/Options.h | 120 + src/llvm/include/llvm/Support/Process.h | 117 +- src/llvm/include/llvm/Support/Program.h | 22 +- .../llvm/Support/RandomNumberGenerator.h | 35 +- src/llvm/include/llvm/Support/Registry.h | 1 - src/llvm/include/llvm/Support/ScaledNumber.h | 1 - .../llvm/Support/StreamableMemoryObject.h | 178 - .../llvm/Support/StreamingMemoryObject.h | 92 + src/llvm/include/llvm/Support/StringPool.h | 2 +- .../llvm/Support/StringRefMemoryObject.h | 41 - src/llvm/include/llvm/Support/SwapByteOrder.h | 7 +- .../include/llvm/Support/TargetRegistry.h | 22 +- src/llvm/include/llvm/Support/ThreadLocal.h | 2 +- src/llvm/include/llvm/Support/Threading.h | 3 +- src/llvm/include/llvm/TableGen/Record.h | 8 +- .../llvm/TableGen/StringToOffsetTable.h | 8 +- src/llvm/include/llvm/Target/Target.td | 55 +- .../include/llvm/Target/TargetCallingConv.td | 10 + .../include/llvm/Target/TargetFrameLowering.h | 14 + .../include/llvm/Target/TargetInstrInfo.h | 40 +- .../include/llvm/Target/TargetLibraryInfo.h | 23 + src/llvm/include/llvm/Target/TargetLowering.h | 222 +- .../llvm/Target/TargetLoweringObjectFile.h | 8 +- src/llvm/include/llvm/Target/TargetMachine.h | 4 + src/llvm/include/llvm/Target/TargetOpcodes.h | 13 +- src/llvm/include/llvm/Target/TargetOptions.h | 37 +- .../include/llvm/Target/TargetRegisterInfo.h | 55 +- .../include/llvm/Target/TargetSelectionDAG.td | 15 + .../include/llvm/Target/TargetSubtargetInfo.h | 13 + .../include/llvm/Transforms/Instrumentation.h | 46 +- src/llvm/include/llvm/Transforms/Scalar.h | 4 +- .../llvm/Transforms/Utils/BasicBlockUtils.h | 5 + .../llvm/Transforms/Utils/BuildLibCalls.h | 14 - .../include/llvm/Transforms/Utils/Cloning.h | 8 +- .../include/llvm/Transforms/Utils/Local.h | 13 +- .../include/llvm/Transforms/Utils/LoopUtils.h | 9 +- .../llvm/Transforms/Utils/PromoteMemToReg.h | 4 +- .../llvm/Transforms/Utils/SimplifyLibCalls.h | 55 +- .../llvm/Transforms/Utils/SymbolRewriter.h | 155 + .../llvm/Transforms/Utils/UnrollLoop.h | 4 +- .../llvm/Transforms/Utils/ValueMapper.h | 21 +- .../llvm/Transforms/Utils/VectorUtils.h | 14 +- src/llvm/include/llvm/module.modulemap | 20 +- src/llvm/lib/Analysis/AliasAnalysis.cpp | 45 +- src/llvm/lib/Analysis/AliasSetTracker.cpp | 49 +- src/llvm/lib/Analysis/AssumptionCache.cpp | 125 + src/llvm/lib/Analysis/AssumptionTracker.cpp | 113 - src/llvm/lib/Analysis/BasicAliasAnalysis.cpp | 135 +- .../lib/Analysis/BlockFrequencyInfoImpl.cpp | 25 +- .../lib/Analysis/BranchProbabilityInfo.cpp | 3 +- src/llvm/lib/Analysis/CFG.cpp | 6 +- src/llvm/lib/Analysis/CFLAliasAnalysis.cpp | 37 +- src/llvm/lib/Analysis/CGSCCPassManager.cpp | 103 +- src/llvm/lib/Analysis/CMakeLists.txt | 2 +- src/llvm/lib/Analysis/CaptureTracking.cpp | 4 +- src/llvm/lib/Analysis/CodeMetrics.cpp | 32 +- src/llvm/lib/Analysis/ConstantFolding.cpp | 119 +- src/llvm/lib/Analysis/DependenceAnalysis.cpp | 45 +- src/llvm/lib/Analysis/IPA/CMakeLists.txt | 1 - .../lib/Analysis/IPA/CallGraphSCCPass.cpp | 11 +- src/llvm/lib/Analysis/IPA/FindUsedTypes.cpp | 100 - src/llvm/lib/Analysis/IPA/IPA.cpp | 1 - src/llvm/lib/Analysis/IPA/InlineCost.cpp | 25 +- src/llvm/lib/Analysis/IVUsers.cpp | 4 +- src/llvm/lib/Analysis/InstructionSimplify.cpp | 655 +- src/llvm/lib/Analysis/JumpInstrTableInfo.cpp | 17 +- src/llvm/lib/Analysis/LazyCallGraph.cpp | 15 +- src/llvm/lib/Analysis/LazyValueInfo.cpp | 394 +- src/llvm/lib/Analysis/LibCallSemantics.cpp | 4 +- src/llvm/lib/Analysis/Lint.cpp | 31 +- src/llvm/lib/Analysis/Loads.cpp | 192 +- src/llvm/lib/Analysis/LoopInfo.cpp | 4 +- src/llvm/lib/Analysis/MemDepPrinter.cpp | 28 +- src/llvm/lib/Analysis/MemoryBuiltins.cpp | 10 +- .../lib/Analysis/MemoryDependenceAnalysis.cpp | 94 +- src/llvm/lib/Analysis/NoAliasAnalysis.cpp | 5 +- src/llvm/lib/Analysis/PHITransAddr.cpp | 6 +- src/llvm/lib/Analysis/PtrUseVisitor.cpp | 2 +- src/llvm/lib/Analysis/RegionInfo.cpp | 2 +- src/llvm/lib/Analysis/RegionPass.cpp | 3 +- src/llvm/lib/Analysis/ScalarEvolution.cpp | 1095 ++-- .../lib/Analysis/ScalarEvolutionExpander.cpp | 4 +- src/llvm/lib/Analysis/ScopedNoAliasAA.cpp | 18 +- src/llvm/lib/Analysis/StratifiedSets.h | 2 +- src/llvm/lib/Analysis/TargetTransformInfo.cpp | 18 +- .../lib/Analysis/TypeBasedAliasAnalysis.cpp | 41 +- src/llvm/lib/Analysis/ValueTracking.cpp | 499 +- src/llvm/lib/AsmParser/LLLexer.cpp | 118 +- src/llvm/lib/AsmParser/LLLexer.h | 1 + src/llvm/lib/AsmParser/LLParser.cpp | 443 +- src/llvm/lib/AsmParser/LLParser.h | 64 +- src/llvm/lib/AsmParser/LLToken.h | 7 +- src/llvm/lib/Bitcode/Reader/BitReader.cpp | 21 +- src/llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 924 +-- src/llvm/lib/Bitcode/Reader/BitcodeReader.h | 55 +- .../lib/Bitcode/Reader/BitstreamReader.cpp | 50 +- src/llvm/lib/Bitcode/Writer/BitWriter.cpp | 8 + src/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 239 +- .../lib/Bitcode/Writer/BitcodeWriterPass.cpp | 4 +- .../lib/Bitcode/Writer/ValueEnumerator.cpp | 302 +- src/llvm/lib/Bitcode/Writer/ValueEnumerator.h | 31 +- .../lib/CodeGen/AggressiveAntiDepBreaker.cpp | 26 +- src/llvm/lib/CodeGen/Analysis.cpp | 35 +- .../lib/CodeGen/AsmPrinter/ARMException.cpp | 6 +- .../lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 259 +- .../CodeGen/AsmPrinter/AsmPrinterDwarf.cpp | 177 +- .../AsmPrinter/AsmPrinterInlineAsm.cpp | 9 +- .../lib/CodeGen/AsmPrinter/ByteStreamer.h | 2 +- .../lib/CodeGen/AsmPrinter/CMakeLists.txt | 2 + src/llvm/lib/CodeGen/AsmPrinter/DIE.cpp | 33 +- src/llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp | 2 +- src/llvm/lib/CodeGen/AsmPrinter/DIEHash.h | 2 +- .../AsmPrinter/DbgValueHistoryCalculator.cpp | 62 +- .../lib/CodeGen/AsmPrinter/DebugLocEntry.h | 48 +- .../lib/CodeGen/AsmPrinter/DebugLocList.h | 2 +- .../CodeGen/AsmPrinter/DwarfAccelTable.cpp | 11 +- .../lib/CodeGen/AsmPrinter/DwarfAccelTable.h | 8 +- .../CodeGen/AsmPrinter/DwarfCFIException.cpp | 2 +- .../CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 836 +++ .../lib/CodeGen/AsmPrinter/DwarfCompileUnit.h | 250 + .../lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 876 +-- src/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | 177 +- .../CodeGen/AsmPrinter/DwarfExpression.cpp | 260 + .../lib/CodeGen/AsmPrinter/DwarfExpression.h | 133 + src/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp | 60 +- src/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h | 47 +- .../CodeGen/AsmPrinter/DwarfStringPool.cpp | 3 +- .../lib/CodeGen/AsmPrinter/DwarfStringPool.h | 1 - src/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 725 +-- src/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h | 236 +- .../lib/CodeGen/AsmPrinter/EHStreamer.cpp | 67 +- src/llvm/lib/CodeGen/AsmPrinter/EHStreamer.h | 18 +- .../CodeGen/AsmPrinter/ErlangGCPrinter.cpp | 17 +- .../lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp | 34 +- .../lib/CodeGen/AsmPrinter/Win64Exception.cpp | 149 +- .../lib/CodeGen/AsmPrinter/Win64Exception.h | 4 + .../AsmPrinter/WinCodeViewLineTables.cpp | 167 +- .../lib/CodeGen/BasicTargetTransformInfo.cpp | 6 +- src/llvm/lib/CodeGen/BranchFolding.cpp | 3 +- src/llvm/lib/CodeGen/CMakeLists.txt | 3 +- src/llvm/lib/CodeGen/CalcSpillWeights.cpp | 7 +- src/llvm/lib/CodeGen/CallingConvLower.cpp | 70 +- src/llvm/lib/CodeGen/CodeGenPrepare.cpp | 1691 +++++- .../lib/CodeGen/CriticalAntiDepBreaker.cpp | 1 - src/llvm/lib/CodeGen/DFAPacketizer.cpp | 6 +- .../CodeGen/DeadMachineInstructionElim.cpp | 5 +- src/llvm/lib/CodeGen/EarlyIfConversion.cpp | 2 +- src/llvm/lib/CodeGen/ExecutionDepsFix.cpp | 160 +- src/llvm/lib/CodeGen/ExpandISelPseudos.cpp | 1 - src/llvm/lib/CodeGen/ExpandPostRAPseudos.cpp | 1 - .../CodeGen/ForwardControlFlowIntegrity.cpp | 374 ++ src/llvm/lib/CodeGen/GCMetadata.cpp | 7 +- src/llvm/lib/CodeGen/GCMetadataPrinter.cpp | 8 - src/llvm/lib/CodeGen/GCStrategy.cpp | 20 +- src/llvm/lib/CodeGen/GlobalMerge.cpp | 2 +- src/llvm/lib/CodeGen/IfConversion.cpp | 1 - src/llvm/lib/CodeGen/InlineSpiller.cpp | 30 +- src/llvm/lib/CodeGen/JumpInstrTables.cpp | 19 +- src/llvm/lib/CodeGen/LLVMTargetMachine.cpp | 24 +- src/llvm/lib/CodeGen/LexicalScopes.cpp | 9 +- src/llvm/lib/CodeGen/LiveDebugVariables.cpp | 50 +- src/llvm/lib/CodeGen/LiveDebugVariables.h | 2 +- src/llvm/lib/CodeGen/LiveInterval.cpp | 322 +- src/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp | 602 +- src/llvm/lib/CodeGen/LiveIntervalUnion.cpp | 18 +- src/llvm/lib/CodeGen/LiveRangeCalc.cpp | 225 +- src/llvm/lib/CodeGen/LiveRangeCalc.h | 53 +- src/llvm/lib/CodeGen/LiveRangeEdit.cpp | 21 +- src/llvm/lib/CodeGen/LiveRegMatrix.cpp | 63 +- src/llvm/lib/CodeGen/LiveStackAnalysis.cpp | 2 +- src/llvm/lib/CodeGen/LiveVariables.cpp | 1 - .../lib/CodeGen/LocalStackSlotAllocation.cpp | 1 + src/llvm/lib/CodeGen/MachineBasicBlock.cpp | 15 +- .../lib/CodeGen/MachineBlockPlacement.cpp | 11 +- src/llvm/lib/CodeGen/MachineCSE.cpp | 31 + .../lib/CodeGen/MachineDominanceFrontier.cpp | 2 +- src/llvm/lib/CodeGen/MachineFunction.cpp | 73 +- .../lib/CodeGen/MachineFunctionAnalysis.cpp | 3 +- src/llvm/lib/CodeGen/MachineFunctionPass.cpp | 28 +- .../CodeGen/MachineFunctionPrinterPass.cpp | 2 +- src/llvm/lib/CodeGen/MachineInstr.cpp | 45 +- src/llvm/lib/CodeGen/MachineInstrBundle.cpp | 18 +- src/llvm/lib/CodeGen/MachineLICM.cpp | 41 +- src/llvm/lib/CodeGen/MachineModuleInfo.cpp | 16 +- src/llvm/lib/CodeGen/MachineRegionInfo.cpp | 2 +- src/llvm/lib/CodeGen/MachineRegisterInfo.cpp | 12 +- src/llvm/lib/CodeGen/MachineSSAUpdater.cpp | 1 - src/llvm/lib/CodeGen/MachineScheduler.cpp | 28 +- src/llvm/lib/CodeGen/MachineSink.cpp | 77 +- src/llvm/lib/CodeGen/MachineTraceMetrics.cpp | 2 +- src/llvm/lib/CodeGen/MachineVerifier.cpp | 171 +- src/llvm/lib/CodeGen/OptimizePHIs.cpp | 4 +- src/llvm/lib/CodeGen/PHIElimination.cpp | 3 +- src/llvm/lib/CodeGen/Passes.cpp | 146 +- src/llvm/lib/CodeGen/PeepholeOptimizer.cpp | 44 +- src/llvm/lib/CodeGen/PostRASchedulerList.cpp | 16 +- src/llvm/lib/CodeGen/PrologEpilogInserter.cpp | 62 +- src/llvm/lib/CodeGen/RegAllocBase.cpp | 5 +- src/llvm/lib/CodeGen/RegAllocBase.h | 3 + src/llvm/lib/CodeGen/RegAllocBasic.cpp | 1 - src/llvm/lib/CodeGen/RegAllocFast.cpp | 49 +- src/llvm/lib/CodeGen/RegAllocGreedy.cpp | 229 +- src/llvm/lib/CodeGen/RegAllocPBQP.cpp | 774 +-- src/llvm/lib/CodeGen/RegisterClassInfo.cpp | 5 +- src/llvm/lib/CodeGen/RegisterCoalescer.cpp | 955 ++- src/llvm/lib/CodeGen/RegisterPressure.cpp | 1 - src/llvm/lib/CodeGen/RegisterScavenging.cpp | 6 +- src/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp | 34 +- src/llvm/lib/CodeGen/ScheduleDAGPrinter.cpp | 1 - .../lib/CodeGen/SelectionDAG/CMakeLists.txt | 1 + .../lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 1267 +++- .../lib/CodeGen/SelectionDAG/FastISel.cpp | 45 +- .../SelectionDAG/FunctionLoweringInfo.cpp | 35 +- .../lib/CodeGen/SelectionDAG/InstrEmitter.cpp | 25 +- .../lib/CodeGen/SelectionDAG/InstrEmitter.h | 1 - .../lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 147 +- .../SelectionDAG/LegalizeFloatTypes.cpp | 50 + .../SelectionDAG/LegalizeIntegerTypes.cpp | 82 +- .../CodeGen/SelectionDAG/LegalizeTypes.cpp | 11 + .../lib/CodeGen/SelectionDAG/LegalizeTypes.h | 14 +- .../SelectionDAG/LegalizeVectorOps.cpp | 11 +- .../SelectionDAG/LegalizeVectorTypes.cpp | 194 +- .../SelectionDAG/ResourcePriorityQueue.cpp | 15 +- .../lib/CodeGen/SelectionDAG/SDNodeDbgValue.h | 54 +- .../CodeGen/SelectionDAG/ScheduleDAGFast.cpp | 32 +- .../SelectionDAG/ScheduleDAGRRList.cpp | 78 +- .../SelectionDAG/ScheduleDAGSDNodes.cpp | 40 +- .../CodeGen/SelectionDAG/ScheduleDAGVLIW.cpp | 7 +- .../lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 208 +- .../SelectionDAG/SelectionDAGBuilder.cpp | 1176 ++-- .../SelectionDAG/SelectionDAGBuilder.h | 59 +- .../SelectionDAG/SelectionDAGDumper.cpp | 6 +- .../CodeGen/SelectionDAG/SelectionDAGISel.cpp | 236 +- .../SelectionDAG/StatepointLowering.cpp | 684 +++ .../CodeGen/SelectionDAG/StatepointLowering.h | 138 + .../CodeGen/SelectionDAG/TargetLowering.cpp | 63 +- src/llvm/lib/CodeGen/ShadowStackGC.cpp | 2 +- src/llvm/lib/CodeGen/SjLjEHPrepare.cpp | 4 +- src/llvm/lib/CodeGen/SpillPlacement.cpp | 53 +- src/llvm/lib/CodeGen/SpillPlacement.h | 5 + src/llvm/lib/CodeGen/Spiller.cpp | 184 - src/llvm/lib/CodeGen/Spiller.h | 5 - src/llvm/lib/CodeGen/SplitKit.cpp | 53 +- src/llvm/lib/CodeGen/StackColoring.cpp | 3 +- .../lib/CodeGen/StackMapLivenessAnalysis.cpp | 2 + src/llvm/lib/CodeGen/StackMaps.cpp | 30 +- src/llvm/lib/CodeGen/StackProtector.cpp | 54 +- src/llvm/lib/CodeGen/StackSlotColoring.cpp | 1 - src/llvm/lib/CodeGen/StatepointExampleGC.cpp | 54 + .../lib/CodeGen/TargetFrameLoweringImpl.cpp | 3 +- src/llvm/lib/CodeGen/TargetInstrInfo.cpp | 23 + src/llvm/lib/CodeGen/TargetLoweringBase.cpp | 82 +- .../CodeGen/TargetLoweringObjectFileImpl.cpp | 48 +- src/llvm/lib/CodeGen/TargetOptionsImpl.cpp | 7 + src/llvm/lib/CodeGen/TargetRegisterInfo.cpp | 11 +- src/llvm/lib/CodeGen/TargetSchedule.cpp | 1 - .../lib/CodeGen/TwoAddressInstructionPass.cpp | 21 +- src/llvm/lib/CodeGen/VirtRegMap.cpp | 60 +- src/llvm/lib/DebugInfo/CMakeLists.txt | 2 + src/llvm/lib/DebugInfo/DIContext.cpp | 4 +- .../DWARFAbbreviationDeclaration.cpp | 2 +- .../lib/DebugInfo/DWARFAcceleratorTable.cpp | 132 + src/llvm/lib/DebugInfo/DWARFCompileUnit.cpp | 2 +- src/llvm/lib/DebugInfo/DWARFContext.cpp | 130 +- src/llvm/lib/DebugInfo/DWARFDebugAbbrev.cpp | 6 +- .../lib/DebugInfo/DWARFDebugArangeSet.cpp | 2 +- src/llvm/lib/DebugInfo/DWARFDebugAranges.cpp | 8 +- src/llvm/lib/DebugInfo/DWARFDebugFrame.cpp | 5 +- .../lib/DebugInfo/DWARFDebugInfoEntry.cpp | 111 +- src/llvm/lib/DebugInfo/DWARFDebugLine.cpp | 2 +- src/llvm/lib/DebugInfo/DWARFDebugLoc.cpp | 4 +- .../lib/DebugInfo/DWARFDebugRangeList.cpp | 2 +- src/llvm/lib/DebugInfo/DWARFFormValue.cpp | 64 +- src/llvm/lib/DebugInfo/DWARFTypeUnit.cpp | 2 +- src/llvm/lib/DebugInfo/DWARFUnit.cpp | 31 +- src/llvm/lib/DebugInfo/SyntaxHighlighting.cpp | 37 + src/llvm/lib/DebugInfo/SyntaxHighlighting.h | 39 + src/llvm/lib/ExecutionEngine/CMakeLists.txt | 2 +- .../lib/ExecutionEngine/EventListenerCommon.h | 135 +- .../lib/ExecutionEngine/ExecutionEngine.cpp | 32 +- .../ExecutionEngineBindings.cpp | 11 +- ...istrar.cpp => GDBRegistrationListener.cpp} | 90 +- .../IntelJITEvents/IntelJITEventListener.cpp | 155 +- .../IntelJITEvents/LLVMBuild.txt | 1 + .../lib/ExecutionEngine/JITEventListener.cpp | 15 - src/llvm/lib/ExecutionEngine/LLVMBuild.txt | 2 +- src/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp | 95 +- src/llvm/lib/ExecutionEngine/MCJIT/MCJIT.h | 22 +- .../lib/ExecutionEngine/MCJIT/ObjectBuffer.h | 48 + .../OProfileJIT/OProfileJITEventListener.cpp | 191 +- .../ExecutionEngine/RTDyldMemoryManager.cpp | 12 + .../RuntimeDyld/CMakeLists.txt | 1 - .../RuntimeDyld/JITRegistrar.h | 44 - .../RuntimeDyld/ObjectImageCommon.h | 86 - .../RuntimeDyld/RuntimeDyld.cpp | 283 +- .../RuntimeDyld/RuntimeDyldChecker.cpp | 13 +- .../RuntimeDyld/RuntimeDyldELF.cpp | 348 +- .../RuntimeDyld/RuntimeDyldELF.h | 29 +- .../RuntimeDyld/RuntimeDyldImpl.h | 39 +- .../RuntimeDyld/RuntimeDyldMachO.cpp | 109 +- .../RuntimeDyld/RuntimeDyldMachO.h | 35 +- .../Targets/RuntimeDyldMachOAArch64.h | 29 +- .../RuntimeDyld/Targets/RuntimeDyldMachOARM.h | 81 +- .../Targets/RuntimeDyldMachOI386.h | 101 +- .../Targets/RuntimeDyldMachOX86_64.h | 15 +- src/llvm/lib/IR/AsmWriter.cpp | 272 +- src/llvm/lib/IR/AutoUpgrade.cpp | 85 +- src/llvm/lib/IR/BasicBlock.cpp | 10 - src/llvm/lib/IR/CMakeLists.txt | 3 +- src/llvm/lib/IR/ConstantFold.cpp | 115 +- src/llvm/lib/IR/Constants.cpp | 40 +- src/llvm/lib/IR/Core.cpp | 206 +- src/llvm/lib/IR/DIBuilder.cpp | 1374 ++--- src/llvm/lib/IR/DataLayout.cpp | 57 +- src/llvm/lib/IR/DebugInfo.cpp | 644 +- src/llvm/lib/IR/DebugLoc.cpp | 303 +- src/llvm/lib/IR/DiagnosticInfo.cpp | 3 +- src/llvm/lib/IR/Dominators.cpp | 38 +- src/llvm/lib/IR/Function.cpp | 161 +- src/llvm/lib/IR/GCOV.cpp | 3 +- src/llvm/lib/IR/Globals.cpp | 41 +- src/llvm/lib/IR/IRBuilder.cpp | 128 +- src/llvm/lib/IR/IRPrintingPasses.cpp | 12 +- src/llvm/lib/IR/Instruction.cpp | 13 +- src/llvm/lib/IR/Instructions.cpp | 40 +- src/llvm/lib/IR/IntrinsicInst.cpp | 22 +- src/llvm/lib/IR/LLVMContext.cpp | 46 +- src/llvm/lib/IR/LLVMContextImpl.cpp | 54 +- src/llvm/lib/IR/LLVMContextImpl.h | 252 +- src/llvm/lib/IR/LeakDetector.cpp | 69 - src/llvm/lib/IR/LeaksContext.h | 5 + src/llvm/lib/IR/LegacyPassManager.cpp | 62 +- src/llvm/lib/IR/MDBuilder.cpp | 37 +- src/llvm/lib/IR/Mangler.cpp | 85 +- src/llvm/lib/IR/Metadata.cpp | 1139 ++-- src/llvm/lib/IR/MetadataTracking.cpp | 58 + src/llvm/lib/IR/Module.cpp | 108 +- src/llvm/lib/IR/PassManager.cpp | 165 +- src/llvm/lib/IR/PassRegistry.cpp | 56 +- src/llvm/lib/IR/Statepoint.cpp | 61 + src/llvm/lib/IR/Type.cpp | 36 +- src/llvm/lib/IR/TypeFinder.cpp | 32 +- src/llvm/lib/IR/User.cpp | 3 - src/llvm/lib/IR/Value.cpp | 157 +- src/llvm/lib/IR/ValueSymbolTable.cpp | 33 +- src/llvm/lib/IR/Verifier.cpp | 553 +- src/llvm/lib/IRReader/IRReader.cpp | 1 - src/llvm/lib/LTO/LTOCodeGenerator.cpp | 44 +- src/llvm/lib/LTO/LTOModule.cpp | 185 +- src/llvm/lib/Linker/LinkModules.cpp | 1662 +++-- src/llvm/lib/MC/ConstantPools.cpp | 2 +- src/llvm/lib/MC/ELFObjectWriter.cpp | 88 +- src/llvm/lib/MC/MCAsmInfo.cpp | 9 +- src/llvm/lib/MC/MCAsmInfoDarwin.cpp | 53 +- src/llvm/lib/MC/MCAsmInfoELF.cpp | 10 + src/llvm/lib/MC/MCAsmStreamer.cpp | 21 +- src/llvm/lib/MC/MCAssembler.cpp | 50 +- src/llvm/lib/MC/MCContext.cpp | 46 +- .../lib/MC/MCDisassembler/Disassembler.cpp | 37 +- src/llvm/lib/MC/MCDwarf.cpp | 20 +- src/llvm/lib/MC/MCELFStreamer.cpp | 57 +- src/llvm/lib/MC/MCExpr.cpp | 112 +- src/llvm/lib/MC/MCLinkerOptimizationHint.cpp | 2 +- src/llvm/lib/MC/MCNullStreamer.cpp | 1 - src/llvm/lib/MC/MCObjectFileInfo.cpp | 31 +- src/llvm/lib/MC/MCObjectStreamer.cpp | 42 +- src/llvm/lib/MC/MCParser/AsmParser.cpp | 82 +- src/llvm/lib/MC/MCParser/COFFAsmParser.cpp | 8 +- src/llvm/lib/MC/MCParser/MCAsmLexer.cpp | 4 + src/llvm/lib/MC/MCParser/MCAsmParser.cpp | 2 +- src/llvm/lib/MC/MCSectionCOFF.cpp | 8 +- src/llvm/lib/MC/MCSectionELF.cpp | 4 +- src/llvm/lib/MC/MCStreamer.cpp | 14 +- src/llvm/lib/MC/MCTargetOptions.cpp | 7 +- src/llvm/lib/MC/MCWinEH.cpp | 59 +- src/llvm/lib/MC/MachObjectWriter.cpp | 84 +- src/llvm/lib/MC/StringTableBuilder.cpp | 20 +- src/llvm/lib/MC/WinCOFFObjectWriter.cpp | 54 +- src/llvm/lib/MC/WinCOFFStreamer.cpp | 37 +- src/llvm/lib/Object/Archive.cpp | 22 +- src/llvm/lib/Object/Binary.cpp | 1 + src/llvm/lib/Object/COFFObjectFile.cpp | 745 ++- src/llvm/lib/Object/COFFYAML.cpp | 106 + src/llvm/lib/Object/ELF.cpp | 756 +-- src/llvm/lib/Object/ELFYAML.cpp | 297 +- src/llvm/lib/Object/IRObjectFile.cpp | 33 +- src/llvm/lib/Object/MachOObjectFile.cpp | 303 +- src/llvm/lib/Object/MachOUniversal.cpp | 30 +- src/llvm/lib/Object/Object.cpp | 15 +- src/llvm/lib/Object/ObjectFile.cpp | 1 + src/llvm/lib/Object/SymbolicFile.cpp | 5 +- src/llvm/lib/Option/ArgList.cpp | 2 +- src/llvm/lib/ProfileData/CMakeLists.txt | 2 + src/llvm/lib/ProfileData/CoverageMapping.cpp | 91 +- .../lib/ProfileData/CoverageMappingReader.cpp | 9 +- .../lib/ProfileData/CoverageMappingWriter.cpp | 58 +- src/llvm/lib/ProfileData/InstrProfIndexed.h | 1 + src/llvm/lib/ProfileData/InstrProfReader.cpp | 34 +- src/llvm/lib/ProfileData/InstrProfWriter.cpp | 4 +- src/llvm/lib/ProfileData/SampleProf.cpp | 51 + src/llvm/lib/ProfileData/SampleProfReader.cpp | 275 +- src/llvm/lib/ProfileData/SampleProfWriter.cpp | 126 + src/llvm/lib/Support/APFloat.cpp | 64 +- src/llvm/lib/Support/APInt.cpp | 73 +- src/llvm/lib/Support/CMakeLists.txt | 70 +- src/llvm/lib/Support/CommandLine.cpp | 559 +- src/llvm/lib/Support/Compression.cpp | 6 + src/llvm/lib/Support/DataStream.cpp | 4 +- src/llvm/lib/Support/Debug.cpp | 25 +- src/llvm/lib/Support/Dwarf.cpp | 73 +- src/llvm/lib/Support/Errno.cpp | 8 +- src/llvm/lib/Support/ErrorHandling.cpp | 11 +- src/llvm/lib/Support/FileOutputBuffer.cpp | 27 +- src/llvm/lib/Support/GraphWriter.cpp | 5 +- src/llvm/lib/Support/Host.cpp | 84 +- src/llvm/lib/Support/LineIterator.cpp | 46 +- src/llvm/lib/Support/MD5.cpp | 38 +- src/llvm/lib/Support/MemoryBuffer.cpp | 77 +- src/llvm/lib/Support/MemoryObject.cpp | 19 - src/llvm/lib/Support/Options.cpp | 33 + src/llvm/lib/Support/Path.cpp | 20 +- src/llvm/lib/Support/Process.cpp | 25 - .../lib/Support/RandomNumberGenerator.cpp | 30 +- src/llvm/lib/Support/ScaledNumber.cpp | 2 +- src/llvm/lib/Support/SmallPtrSet.cpp | 16 +- src/llvm/lib/Support/SourceMgr.cpp | 4 +- src/llvm/lib/Support/SpecialCaseList.cpp | 12 - ...ryObject.cpp => StreamingMemoryObject.cpp} | 79 +- .../lib/Support/StringRefMemoryObject.cpp | 29 - src/llvm/lib/Support/ThreadLocal.cpp | 47 +- src/llvm/lib/Support/Triple.cpp | 88 +- src/llvm/lib/Support/Unix/Host.inc | 6 +- src/llvm/lib/Support/Unix/Memory.inc | 4 +- src/llvm/lib/Support/Unix/Path.inc | 113 +- src/llvm/lib/Support/Unix/Process.inc | 134 +- src/llvm/lib/Support/Unix/Program.inc | 60 +- src/llvm/lib/Support/Unix/RWMutex.inc | 12 +- src/llvm/lib/Support/Unix/Signals.inc | 149 +- src/llvm/lib/Support/Unix/ThreadLocal.inc | 45 +- .../lib/Support/Windows/DynamicLibrary.inc | 41 +- src/llvm/lib/Support/Windows/Path.inc | 251 +- src/llvm/lib/Support/Windows/Process.inc | 41 +- src/llvm/lib/Support/Windows/Program.inc | 116 +- src/llvm/lib/Support/Windows/RWMutex.inc | 8 +- src/llvm/lib/Support/Windows/ThreadLocal.inc | 2 +- src/llvm/lib/Support/Windows/WindowsSupport.h | 6 + .../lib/Support/Windows/explicit_symbols.inc | 30 + src/llvm/lib/Support/YAMLTraits.cpp | 2 +- src/llvm/lib/Support/raw_ostream.cpp | 16 +- src/llvm/lib/Support/regcomp.c | 21 + src/llvm/lib/TableGen/Main.cpp | 7 +- src/llvm/lib/TableGen/Record.cpp | 2 +- src/llvm/lib/TableGen/TGParser.cpp | 177 +- src/llvm/lib/TableGen/TGParser.h | 2 +- src/llvm/lib/Target/AArch64/AArch64.h | 2 +- .../Target/AArch64/AArch64A53Fix835769.cpp | 240 + .../AArch64/AArch64A57FPLoadBalancing.cpp | 14 +- .../lib/Target/AArch64/AArch64AsmPrinter.cpp | 17 +- .../Target/AArch64/AArch64CallingConvention.h | 141 + .../AArch64/AArch64CallingConvention.td | 45 + .../AArch64/AArch64ConditionOptimizer.cpp | 29 +- .../lib/Target/AArch64/AArch64FastISel.cpp | 938 ++- .../Target/AArch64/AArch64FrameLowering.cpp | 31 +- .../Target/AArch64/AArch64ISelDAGToDAG.cpp | 75 +- .../Target/AArch64/AArch64ISelLowering.cpp | 388 +- .../lib/Target/AArch64/AArch64ISelLowering.h | 10 +- .../lib/Target/AArch64/AArch64InstrFormats.td | 2 +- .../lib/Target/AArch64/AArch64InstrInfo.cpp | 255 +- .../lib/Target/AArch64/AArch64InstrInfo.h | 7 +- .../lib/Target/AArch64/AArch64InstrInfo.td | 134 +- .../Target/AArch64/AArch64PBQPRegAlloc.cpp | 201 +- .../lib/Target/AArch64/AArch64PBQPRegAlloc.h | 38 + .../Target/AArch64/AArch64PromoteConstant.cpp | 4 +- .../Target/AArch64/AArch64RegisterInfo.cpp | 20 +- .../lib/Target/AArch64/AArch64SchedA57.td | 4 + .../lib/Target/AArch64/AArch64Subtarget.cpp | 21 +- .../lib/Target/AArch64/AArch64Subtarget.h | 7 +- .../Target/AArch64/AArch64TargetMachine.cpp | 96 +- .../lib/Target/AArch64/AArch64TargetMachine.h | 12 +- .../AArch64/AArch64TargetTransformInfo.cpp | 10 + .../AArch64/AsmParser/AArch64AsmParser.cpp | 97 +- src/llvm/lib/Target/AArch64/CMakeLists.txt | 1 + .../Disassembler/AArch64Disassembler.cpp | 21 +- .../Disassembler/AArch64Disassembler.h | 7 +- .../MCTargetDesc/AArch64AddressingModes.h | 100 +- .../MCTargetDesc/AArch64AsmBackend.cpp | 6 +- .../MCTargetDesc/AArch64ELFObjectWriter.cpp | 2 +- .../MCTargetDesc/AArch64ELFStreamer.cpp | 74 +- .../AArch64/MCTargetDesc/AArch64ELFStreamer.h | 2 +- .../AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp | 2 + .../MCTargetDesc/AArch64MCCodeEmitter.cpp | 3 +- .../MCTargetDesc/AArch64MCTargetDesc.cpp | 13 +- .../MCTargetDesc/AArch64MCTargetDesc.h | 8 + .../MCTargetDesc/AArch64TargetStreamer.cpp | 2 + src/llvm/lib/Target/ARM/A15SDOptimizer.cpp | 1 + src/llvm/lib/Target/ARM/ARM.td | 28 +- src/llvm/lib/Target/ARM/ARMAsmPrinter.cpp | 113 +- src/llvm/lib/Target/ARM/ARMAsmPrinter.h | 6 + src/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp | 130 +- src/llvm/lib/Target/ARM/ARMBaseInstrInfo.h | 17 +- .../lib/Target/ARM/ARMBaseRegisterInfo.cpp | 27 +- src/llvm/lib/Target/ARM/ARMBaseRegisterInfo.h | 2 - src/llvm/lib/Target/ARM/ARMCallingConv.h | 8 +- .../lib/Target/ARM/ARMConstantIslandPass.cpp | 41 +- .../lib/Target/ARM/ARMExpandPseudoInsts.cpp | 7 +- src/llvm/lib/Target/ARM/ARMFastISel.cpp | 32 +- src/llvm/lib/Target/ARM/ARMFrameLowering.cpp | 451 +- src/llvm/lib/Target/ARM/ARMFrameLowering.h | 2 + src/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp | 62 +- src/llvm/lib/Target/ARM/ARMISelLowering.cpp | 497 +- src/llvm/lib/Target/ARM/ARMISelLowering.h | 5 +- src/llvm/lib/Target/ARM/ARMInstrInfo.cpp | 43 +- src/llvm/lib/Target/ARM/ARMInstrInfo.td | 296 +- src/llvm/lib/Target/ARM/ARMInstrNEON.td | 25 +- src/llvm/lib/Target/ARM/ARMInstrThumb.td | 22 +- src/llvm/lib/Target/ARM/ARMInstrThumb2.td | 79 +- src/llvm/lib/Target/ARM/ARMInstrVFP.td | 18 +- .../lib/Target/ARM/ARMLoadStoreOptimizer.cpp | 19 +- src/llvm/lib/Target/ARM/ARMMCInstLower.cpp | 36 +- .../lib/Target/ARM/ARMMachineFunctionInfo.h | 7 +- .../Target/ARM/ARMOptimizeBarriersPass.cpp | 2 +- src/llvm/lib/Target/ARM/ARMSubtarget.cpp | 126 +- src/llvm/lib/Target/ARM/ARMSubtarget.h | 32 +- src/llvm/lib/Target/ARM/ARMTargetMachine.cpp | 125 +- src/llvm/lib/Target/ARM/ARMTargetMachine.h | 17 + .../lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 591 +- .../ARM/Disassembler/ARMDisassembler.cpp | 360 +- .../Target/ARM/InstPrinter/ARMInstPrinter.cpp | 99 +- .../Target/ARM/InstPrinter/ARMInstPrinter.h | 2 +- .../ARM/MCTargetDesc/ARMELFObjectWriter.cpp | 23 +- .../ARM/MCTargetDesc/ARMELFStreamer.cpp | 31 +- .../Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp | 4 +- .../Target/ARM/MCTargetDesc/ARMMCAsmInfo.h | 3 +- .../ARM/MCTargetDesc/ARMMCCodeEmitter.cpp | 22 + .../ARM/MCTargetDesc/ARMMCTargetDesc.cpp | 98 +- .../ARM/MCTargetDesc/ARMMachObjectWriter.cpp | 2 +- .../lib/Target/ARM/Thumb1FrameLowering.cpp | 21 +- .../lib/Target/ARM/Thumb1RegisterInfo.cpp | 370 +- src/llvm/lib/Target/ARM/Thumb2ITBlockPass.cpp | 2 +- .../lib/Target/ARM/Thumb2SizeReduction.cpp | 1 - src/llvm/lib/Target/Hexagon/CMakeLists.txt | 25 +- .../Hexagon/Disassembler/CMakeLists.txt | 3 + .../Disassembler/HexagonDisassembler.cpp | 181 + .../LLVMBuild.txt | 6 +- .../lib/Target/Hexagon/Disassembler/Makefile | 16 + src/llvm/lib/Target/Hexagon/Hexagon.td | 14 +- .../lib/Target/Hexagon/HexagonAsmPrinter.cpp | 26 +- .../Target/Hexagon/HexagonCFGOptimizer.cpp | 26 +- .../Target/Hexagon/HexagonCopyToCombine.cpp | 36 +- .../Hexagon/HexagonExpandPredSpillCode.cpp | 32 +- .../Target/Hexagon/HexagonFixupHwLoops.cpp | 12 +- .../Target/Hexagon/HexagonFrameLowering.cpp | 14 +- .../Target/Hexagon/HexagonHardwareLoops.cpp | 42 +- .../Target/Hexagon/HexagonISelDAGToDAG.cpp | 130 +- .../Target/Hexagon/HexagonISelLowering.cpp | 22 +- .../lib/Target/Hexagon/HexagonISelLowering.h | 11 +- .../lib/Target/Hexagon/HexagonInstrFormats.td | 22 +- .../Target/Hexagon/HexagonInstrFormatsV4.td | 5 + .../lib/Target/Hexagon/HexagonInstrInfo.cpp | 667 +- .../lib/Target/Hexagon/HexagonInstrInfo.h | 5 +- .../lib/Target/Hexagon/HexagonInstrInfo.td | 5350 ++++++++++++----- .../lib/Target/Hexagon/HexagonInstrInfoV3.td | 141 +- .../lib/Target/Hexagon/HexagonInstrInfoV4.td | 3592 +++++++---- .../lib/Target/Hexagon/HexagonInstrInfoV5.td | 495 +- .../lib/Target/Hexagon/HexagonIntrinsics.td | 4 +- .../Hexagon/HexagonIntrinsicsDerived.td | 7 +- .../lib/Target/Hexagon/HexagonMCInstLower.cpp | 1 - .../Target/Hexagon/HexagonMachineScheduler.h | 4 +- .../Target/Hexagon/HexagonNewValueJump.cpp | 45 +- .../lib/Target/Hexagon/HexagonOperands.td | 23 + .../lib/Target/Hexagon/HexagonPeephole.cpp | 21 +- .../Target/Hexagon/HexagonRegisterInfo.cpp | 31 +- .../lib/Target/Hexagon/HexagonRegisterInfo.td | 123 +- .../Target/Hexagon/HexagonRemoveSZExtArgs.cpp | 3 +- .../Hexagon/HexagonSplitTFRCondSets.cpp | 24 +- .../lib/Target/Hexagon/HexagonSubtarget.h | 2 +- .../Target/Hexagon/HexagonTargetMachine.cpp | 43 +- .../lib/Target/Hexagon/HexagonTargetMachine.h | 6 + .../Hexagon/HexagonTargetObjectFile.cpp | 2 +- .../Target/Hexagon/HexagonVLIWPacketizer.cpp | 118 +- .../Target/Hexagon/InstPrinter/CMakeLists.txt | 3 - src/llvm/lib/Target/Hexagon/LLVMBuild.txt | 4 +- .../Hexagon/MCTargetDesc/CMakeLists.txt | 6 + .../MCTargetDesc/HexagonAsmBackend.cpp | 74 + .../Hexagon/MCTargetDesc/HexagonBaseInfo.h | 10 + .../MCTargetDesc/HexagonELFObjectWriter.cpp | 62 + .../HexagonInstPrinter.cpp | 62 +- .../HexagonInstPrinter.h | 0 .../MCTargetDesc/HexagonMCCodeEmitter.cpp | 88 + .../MCTargetDesc/HexagonMCCodeEmitter.h | 60 + .../Hexagon/MCTargetDesc/HexagonMCInst.cpp | 117 +- .../Hexagon/MCTargetDesc/HexagonMCInst.h | 120 +- .../MCTargetDesc/HexagonMCTargetDesc.cpp | 63 +- .../MCTargetDesc/HexagonMCTargetDesc.h | 22 + .../Target/Hexagon/MCTargetDesc/LLVMBuild.txt | 2 +- src/llvm/lib/Target/Hexagon/Makefile | 16 +- .../lib/Target/MSP430/MSP430ISelLowering.cpp | 14 +- src/llvm/lib/Target/MSP430/MSP430InstrInfo.td | 6 +- src/llvm/lib/Target/MSP430/MSP430Subtarget.h | 2 +- .../lib/Target/MSP430/MSP430TargetMachine.cpp | 11 +- .../lib/Target/MSP430/MSP430TargetMachine.h | 6 + .../Target/Mips/AsmParser/MipsAsmParser.cpp | 538 +- src/llvm/lib/Target/Mips/CMakeLists.txt | 1 + .../Mips/Disassembler/MipsDisassembler.cpp | 537 +- .../Mips/InstPrinter/MipsInstPrinter.cpp | 33 +- .../Target/Mips/InstPrinter/MipsInstPrinter.h | 2 + .../Target/Mips/MCTargetDesc/CMakeLists.txt | 1 + .../Target/Mips/MCTargetDesc/MipsABIInfo.cpp | 45 + .../Target/Mips/MCTargetDesc/MipsABIInfo.h | 61 + .../Mips/MCTargetDesc/MipsAsmBackend.cpp | 17 +- .../Target/Mips/MCTargetDesc/MipsAsmBackend.h | 2 +- .../Mips/MCTargetDesc/MipsELFObjectWriter.cpp | 11 +- .../Mips/MCTargetDesc/MipsELFStreamer.cpp | 39 +- .../Mips/MCTargetDesc/MipsELFStreamer.h | 20 +- .../Target/Mips/MCTargetDesc/MipsFixupKinds.h | 3 + .../Mips/MCTargetDesc/MipsMCAsmInfo.cpp | 1 + .../Mips/MCTargetDesc/MipsMCCodeEmitter.cpp | 231 +- .../Mips/MCTargetDesc/MipsMCCodeEmitter.h | 56 +- .../lib/Target/Mips/MCTargetDesc/MipsMCNaCl.h | 3 +- .../Mips/MCTargetDesc/MipsMCTargetDesc.cpp | 9 +- .../Mips/MCTargetDesc/MipsNaClELFStreamer.cpp | 4 +- src/llvm/lib/Target/Mips/MicroMipsInstrFPU.td | 8 +- .../lib/Target/Mips/MicroMipsInstrFormats.td | 245 + .../lib/Target/Mips/MicroMipsInstrInfo.td | 455 +- src/llvm/lib/Target/Mips/Mips.td | 8 +- src/llvm/lib/Target/Mips/Mips16HardFloat.cpp | 28 +- src/llvm/lib/Target/Mips/Mips16HardFloat.h | 16 +- .../lib/Target/Mips/Mips16ISelDAGToDAG.cpp | 3 +- .../lib/Target/Mips/Mips16ISelLowering.cpp | 11 +- src/llvm/lib/Target/Mips/Mips16ISelLowering.h | 6 +- src/llvm/lib/Target/Mips/Mips16InstrInfo.cpp | 6 +- src/llvm/lib/Target/Mips/Mips16InstrInfo.td | 16 +- src/llvm/lib/Target/Mips/Mips32r6InstrInfo.td | 4 +- src/llvm/lib/Target/Mips/Mips64InstrInfo.td | 10 +- .../lib/Target/Mips/MipsAnalyzeImmediate.cpp | 3 +- src/llvm/lib/Target/Mips/MipsAsmPrinter.cpp | 69 +- src/llvm/lib/Target/Mips/MipsAsmPrinter.h | 8 +- src/llvm/lib/Target/Mips/MipsCCState.cpp | 142 + src/llvm/lib/Target/Mips/MipsCCState.h | 136 + src/llvm/lib/Target/Mips/MipsCallingConv.td | 159 +- src/llvm/lib/Target/Mips/MipsCondMov.td | 37 + .../Target/Mips/MipsConstantIslandPass.cpp | 8 +- .../lib/Target/Mips/MipsDelaySlotFiller.cpp | 120 +- src/llvm/lib/Target/Mips/MipsFastISel.cpp | 1169 +++- src/llvm/lib/Target/Mips/MipsISelLowering.cpp | 843 ++- src/llvm/lib/Target/Mips/MipsISelLowering.h | 158 +- src/llvm/lib/Target/Mips/MipsInstrFPU.td | 68 +- src/llvm/lib/Target/Mips/MipsInstrFormats.td | 16 +- src/llvm/lib/Target/Mips/MipsInstrInfo.cpp | 2 +- src/llvm/lib/Target/Mips/MipsInstrInfo.td | 172 +- src/llvm/lib/Target/Mips/MipsLongBranch.cpp | 27 +- .../lib/Target/Mips/MipsMachineFunction.cpp | 14 +- src/llvm/lib/Target/Mips/MipsRegisterInfo.td | 42 +- .../lib/Target/Mips/MipsSEFrameLowering.cpp | 5 +- .../lib/Target/Mips/MipsSEISelDAGToDAG.cpp | 5 +- .../lib/Target/Mips/MipsSEISelLowering.cpp | 31 +- src/llvm/lib/Target/Mips/MipsSEISelLowering.h | 6 +- src/llvm/lib/Target/Mips/MipsSEInstrInfo.cpp | 27 +- src/llvm/lib/Target/Mips/MipsSEInstrInfo.h | 1 - src/llvm/lib/Target/Mips/MipsSubtarget.cpp | 60 +- src/llvm/lib/Target/Mips/MipsSubtarget.h | 30 +- .../lib/Target/Mips/MipsTargetMachine.cpp | 31 +- src/llvm/lib/Target/Mips/MipsTargetMachine.h | 10 +- .../lib/Target/Mips/MipsTargetObjectFile.cpp | 70 +- .../lib/Target/Mips/MipsTargetObjectFile.h | 19 +- src/llvm/lib/Target/Mips/MipsTargetStreamer.h | 2 +- src/llvm/lib/Target/NVPTX/CMakeLists.txt | 24 +- .../NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp | 3 +- src/llvm/lib/Target/NVPTX/NVPTX.h | 6 +- .../lib/Target/NVPTX/NVPTXAllocaHoisting.h | 3 +- src/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp | 203 +- src/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.h | 9 +- .../lib/Target/NVPTX/NVPTXGenericToNVVM.cpp | 59 +- .../lib/Target/NVPTX/NVPTXISelLowering.cpp | 64 +- src/llvm/lib/Target/NVPTX/NVPTXISelLowering.h | 2 + .../lib/Target/NVPTX/NVPTXImageOptimizer.cpp | 2 +- src/llvm/lib/Target/NVPTX/NVPTXInstrInfo.cpp | 2 +- src/llvm/lib/Target/NVPTX/NVPTXInstrInfo.td | 10 +- .../lib/Target/NVPTX/NVPTXLowerAggrCopies.h | 3 +- .../lib/Target/NVPTX/NVPTXLowerStructArgs.cpp | 134 + .../Target/NVPTX/NVPTXReplaceImageHandles.cpp | 2 +- .../lib/Target/NVPTX/NVPTXTargetMachine.cpp | 23 +- .../lib/Target/NVPTX/NVPTXTargetMachine.h | 11 +- .../lib/Target/NVPTX/NVPTXTargetObjectFile.h | 3 + .../Target/NVPTX/NVPTXTargetTransformInfo.cpp | 115 + src/llvm/lib/Target/NVPTX/NVPTXUtilities.cpp | 19 +- src/llvm/lib/Target/NVPTX/NVPTXVector.td | 4 +- .../Target/PowerPC/AsmParser/PPCAsmParser.cpp | 47 +- .../PowerPC/Disassembler/PPCDisassembler.cpp | 26 +- src/llvm/lib/Target/PowerPC/LLVMBuild.txt | 2 +- .../PowerPC/MCTargetDesc/PPCAsmBackend.cpp | 2 +- .../MCTargetDesc/PPCELFObjectWriter.cpp | 3 + .../PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp | 5 +- .../PowerPC/MCTargetDesc/PPCMCAsmInfo.h | 3 +- .../PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp | 27 +- .../MCTargetDesc/PPCMachObjectWriter.cpp | 2 +- src/llvm/lib/Target/PowerPC/PPC.h | 7 +- src/llvm/lib/Target/PowerPC/PPC.td | 34 +- src/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | 295 +- .../lib/Target/PowerPC/PPCBranchSelector.cpp | 25 + src/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp | 18 + src/llvm/lib/Target/PowerPC/PPCCallingConv.h | 35 + src/llvm/lib/Target/PowerPC/PPCCallingConv.td | 38 + src/llvm/lib/Target/PowerPC/PPCFastISel.cpp | 175 +- .../lib/Target/PowerPC/PPCFrameLowering.cpp | 100 +- .../lib/Target/PowerPC/PPCISelDAGToDAG.cpp | 2289 ++++++- .../lib/Target/PowerPC/PPCISelLowering.cpp | 1114 +++- src/llvm/lib/Target/PowerPC/PPCISelLowering.h | 110 +- src/llvm/lib/Target/PowerPC/PPCInstr64Bit.td | 92 +- .../lib/Target/PowerPC/PPCInstrFormats.td | 45 + src/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp | 56 +- src/llvm/lib/Target/PowerPC/PPCInstrInfo.h | 9 + src/llvm/lib/Target/PowerPC/PPCInstrInfo.td | 170 +- src/llvm/lib/Target/PowerPC/PPCInstrVSX.td | 156 +- .../lib/Target/PowerPC/PPCMCInstLower.cpp | 10 +- .../Target/PowerPC/PPCMachineFunctionInfo.h | 7 + .../lib/Target/PowerPC/PPCRegisterInfo.cpp | 40 +- src/llvm/lib/Target/PowerPC/PPCRegisterInfo.h | 2 + .../lib/Target/PowerPC/PPCRegisterInfo.td | 20 +- src/llvm/lib/Target/PowerPC/PPCSchedule.td | 1 + src/llvm/lib/Target/PowerPC/PPCScheduleP7.td | 3 + src/llvm/lib/Target/PowerPC/PPCScheduleP8.td | 397 ++ src/llvm/lib/Target/PowerPC/PPCSubtarget.cpp | 53 +- src/llvm/lib/Target/PowerPC/PPCSubtarget.h | 16 +- .../lib/Target/PowerPC/PPCTargetMachine.cpp | 112 +- .../lib/Target/PowerPC/PPCTargetMachine.h | 11 +- .../Target/PowerPC/PPCTargetTransformInfo.cpp | 11 + src/llvm/lib/Target/PowerPC/README.txt | 275 - src/llvm/lib/Target/R600/AMDGPU.h | 17 +- src/llvm/lib/Target/R600/AMDGPU.td | 23 + .../Target/R600/AMDGPUAlwaysInlinePass.cpp | 66 + src/llvm/lib/Target/R600/AMDGPUAsmPrinter.cpp | 256 +- src/llvm/lib/Target/R600/AMDGPUAsmPrinter.h | 27 +- .../lib/Target/R600/AMDGPUISelDAGToDAG.cpp | 180 +- .../lib/Target/R600/AMDGPUISelLowering.cpp | 559 +- src/llvm/lib/Target/R600/AMDGPUISelLowering.h | 54 +- src/llvm/lib/Target/R600/AMDGPUInstrInfo.cpp | 52 +- src/llvm/lib/Target/R600/AMDGPUInstrInfo.h | 7 +- src/llvm/lib/Target/R600/AMDGPUInstrInfo.td | 56 +- .../lib/Target/R600/AMDGPUInstructions.td | 40 +- .../lib/Target/R600/AMDGPUMCInstLower.cpp | 37 +- src/llvm/lib/Target/R600/AMDGPUMCInstLower.h | 13 - .../lib/Target/R600/AMDGPUMachineFunction.h | 3 + .../lib/Target/R600/AMDGPUPromoteAlloca.cpp | 33 +- .../lib/Target/R600/AMDGPURegisterInfo.cpp | 3 +- src/llvm/lib/Target/R600/AMDGPUSubtarget.cpp | 42 +- src/llvm/lib/Target/R600/AMDGPUSubtarget.h | 34 +- .../lib/Target/R600/AMDGPUTargetMachine.cpp | 102 +- .../lib/Target/R600/AMDGPUTargetMachine.h | 21 + .../Target/R600/AMDGPUTargetTransformInfo.cpp | 4 +- src/llvm/lib/Target/R600/AMDKernelCodeT.h | 704 +++ .../Target/R600/AsmParser/AMDGPUAsmParser.cpp | 320 + .../lib/Target/R600/AsmParser/CMakeLists.txt | 3 + .../lib/Target/R600/AsmParser/LLVMBuild.txt | 23 + .../InstPrinter => R600/AsmParser}/Makefile | 8 +- src/llvm/lib/Target/R600/CIInstructions.td | 42 + src/llvm/lib/Target/R600/CMakeLists.txt | 6 + .../lib/Target/R600/EvergreenInstructions.td | 2 +- .../R600/InstPrinter/AMDGPUInstPrinter.cpp | 100 +- .../R600/InstPrinter/AMDGPUInstPrinter.h | 8 +- src/llvm/lib/Target/R600/LLVMBuild.txt | 5 +- .../R600/MCTargetDesc/AMDGPUAsmBackend.cpp | 11 +- .../R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp | 22 +- .../R600/MCTargetDesc/AMDGPUMCAsmInfo.h | 10 +- .../R600/MCTargetDesc/AMDGPUMCTargetDesc.cpp | 19 +- .../R600/MCTargetDesc/AMDGPUMCTargetDesc.h | 1 + .../R600/MCTargetDesc/SIMCCodeEmitter.cpp | 17 +- src/llvm/lib/Target/R600/Makefile | 4 +- src/llvm/lib/Target/R600/Processors.td | 32 +- .../Target/R600/R600ControlFlowFinalizer.cpp | 16 +- src/llvm/lib/Target/R600/R600ISelLowering.cpp | 108 +- src/llvm/lib/Target/R600/R600InstrFormats.td | 3 + src/llvm/lib/Target/R600/R600InstrInfo.cpp | 11 +- src/llvm/lib/Target/R600/R600InstrInfo.h | 4 +- src/llvm/lib/Target/R600/R600Instructions.td | 25 +- .../R600/R600OptimizeVectorRegisters.cpp | 5 +- .../lib/Target/R600/SIAnnotateControlFlow.cpp | 26 +- src/llvm/lib/Target/R600/SIDefines.h | 71 +- src/llvm/lib/Target/R600/SIFixSGPRCopies.cpp | 47 +- src/llvm/lib/Target/R600/SIFoldOperands.cpp | 275 + src/llvm/lib/Target/R600/SIISelLowering.cpp | 805 +-- src/llvm/lib/Target/R600/SIISelLowering.h | 28 +- src/llvm/lib/Target/R600/SIInsertWaits.cpp | 83 +- src/llvm/lib/Target/R600/SIInstrFormats.td | 173 +- src/llvm/lib/Target/R600/SIInstrInfo.cpp | 621 +- src/llvm/lib/Target/R600/SIInstrInfo.h | 111 +- src/llvm/lib/Target/R600/SIInstrInfo.td | 1028 +++- src/llvm/lib/Target/R600/SIInstructions.td | 2553 ++++---- .../lib/Target/R600/SILoadStoreOptimizer.cpp | 434 ++ .../lib/Target/R600/SILowerControlFlow.cpp | 40 +- src/llvm/lib/Target/R600/SILowerI1Copies.cpp | 82 +- .../lib/Target/R600/SIMachineFunctionInfo.cpp | 3 +- .../lib/Target/R600/SIMachineFunctionInfo.h | 4 + .../lib/Target/R600/SIPrepareScratchRegs.cpp | 208 + src/llvm/lib/Target/R600/SIRegisterInfo.cpp | 247 +- src/llvm/lib/Target/R600/SIRegisterInfo.h | 39 +- src/llvm/lib/Target/R600/SIRegisterInfo.td | 48 +- src/llvm/lib/Target/R600/SISchedule.td | 80 +- .../lib/Target/R600/SIShrinkInstructions.cpp | 45 +- src/llvm/lib/Target/R600/SITypeRewriter.cpp | 2 +- .../R600/TargetInfo/AMDGPUTargetInfo.cpp | 6 +- src/llvm/lib/Target/R600/VIInstrFormats.td | 145 + src/llvm/lib/Target/R600/VIInstructions.td | 64 + src/llvm/lib/Target/README.txt | 44 +- .../Target/Sparc/AsmParser/SparcAsmParser.cpp | 5 +- .../Sparc/Disassembler/SparcDisassembler.cpp | 61 +- .../Sparc/MCTargetDesc/SparcMCAsmInfo.cpp | 3 +- .../Sparc/MCTargetDesc/SparcMCTargetDesc.cpp | 6 +- .../lib/Target/Sparc/SparcISelDAGToDAG.cpp | 12 +- .../lib/Target/Sparc/SparcISelLowering.cpp | 11 +- .../lib/Target/Sparc/SparcTargetMachine.cpp | 19 +- .../lib/Target/Sparc/SparcTargetMachine.h | 5 + .../SystemZ/AsmParser/SystemZAsmParser.cpp | 1 - .../Disassembler/SystemZDisassembler.cpp | 21 +- .../SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp | 6 +- .../SystemZ/MCTargetDesc/SystemZMCAsmInfo.h | 3 - .../MCTargetDesc/SystemZMCTargetDesc.cpp | 15 +- .../lib/Target/SystemZ/SystemZElimCompare.cpp | 2 +- .../Target/SystemZ/SystemZISelLowering.cpp | 15 +- src/llvm/lib/Target/SystemZ/SystemZInstrFP.td | 4 +- .../lib/Target/SystemZ/SystemZInstrInfo.cpp | 2 +- .../lib/Target/SystemZ/SystemZInstrInfo.td | 26 +- .../Target/SystemZ/SystemZTargetMachine.cpp | 18 +- .../lib/Target/SystemZ/SystemZTargetMachine.h | 5 + src/llvm/lib/Target/TargetLibraryInfo.cpp | 19 +- .../lib/Target/TargetLoweringObjectFile.cpp | 25 - src/llvm/lib/Target/TargetMachine.cpp | 16 +- .../X86/AsmParser/X86AsmInstrumentation.cpp | 595 +- .../X86/AsmParser/X86AsmInstrumentation.h | 9 +- .../lib/Target/X86/AsmParser/X86AsmParser.cpp | 168 +- .../lib/Target/X86/AsmParser/X86Operand.h | 72 +- .../X86/Disassembler/X86Disassembler.cpp | 211 +- .../Target/X86/Disassembler/X86Disassembler.h | 12 +- .../Disassembler/X86DisassemblerDecoder.cpp | 171 +- .../X86/Disassembler/X86DisassemblerDecoder.h | 19 +- .../X86DisassemblerDecoderCommon.h | 29 +- .../X86/InstPrinter/X86ATTInstPrinter.cpp | 47 +- .../X86/InstPrinter/X86ATTInstPrinter.h | 8 +- .../X86/InstPrinter/X86InstComments.cpp | 112 +- .../X86/InstPrinter/X86IntelInstPrinter.cpp | 52 +- .../X86/InstPrinter/X86IntelInstPrinter.h | 8 +- .../Target/X86/MCTargetDesc/X86AsmBackend.cpp | 24 +- .../lib/Target/X86/MCTargetDesc/X86BaseInfo.h | 112 +- .../X86/MCTargetDesc/X86ELFObjectWriter.cpp | 5 +- .../Target/X86/MCTargetDesc/X86MCAsmInfo.cpp | 20 +- .../Target/X86/MCTargetDesc/X86MCAsmInfo.h | 5 +- .../X86/MCTargetDesc/X86MCCodeEmitter.cpp | 85 +- .../X86/MCTargetDesc/X86MCTargetDesc.cpp | 9 +- .../Target/X86/MCTargetDesc/X86MCTargetDesc.h | 4 +- .../X86/MCTargetDesc/X86MachObjectWriter.cpp | 19 +- .../Target/X86/TargetInfo/X86TargetInfo.cpp | 2 +- .../lib/Target/X86/Utils/X86ShuffleDecode.cpp | 86 +- .../lib/Target/X86/Utils/X86ShuffleDecode.h | 4 + src/llvm/lib/Target/X86/X86.td | 254 +- src/llvm/lib/Target/X86/X86AsmPrinter.cpp | 10 +- src/llvm/lib/Target/X86/X86CallingConv.h | 13 + src/llvm/lib/Target/X86/X86CallingConv.td | 64 + src/llvm/lib/Target/X86/X86FastISel.cpp | 140 +- src/llvm/lib/Target/X86/X86FixupLEAs.cpp | 3 +- src/llvm/lib/Target/X86/X86FloatingPoint.cpp | 6 +- src/llvm/lib/Target/X86/X86FrameLowering.cpp | 308 +- src/llvm/lib/Target/X86/X86FrameLowering.h | 14 + src/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp | 134 +- src/llvm/lib/Target/X86/X86ISelLowering.cpp | 3409 +++++++---- src/llvm/lib/Target/X86/X86ISelLowering.h | 223 +- src/llvm/lib/Target/X86/X86InstrAVX512.td | 2507 ++++---- src/llvm/lib/Target/X86/X86InstrArithmetic.td | 331 +- src/llvm/lib/Target/X86/X86InstrCompiler.td | 65 +- src/llvm/lib/Target/X86/X86InstrControl.td | 92 +- src/llvm/lib/Target/X86/X86InstrExtension.td | 26 +- src/llvm/lib/Target/X86/X86InstrFMA.td | 6 +- src/llvm/lib/Target/X86/X86InstrFPStack.td | 82 +- src/llvm/lib/Target/X86/X86InstrFormats.td | 130 +- .../lib/Target/X86/X86InstrFragmentsSIMD.td | 38 +- src/llvm/lib/Target/X86/X86InstrInfo.cpp | 912 +-- src/llvm/lib/Target/X86/X86InstrInfo.h | 6 +- src/llvm/lib/Target/X86/X86InstrInfo.td | 752 +-- src/llvm/lib/Target/X86/X86InstrMMX.td | 20 +- src/llvm/lib/Target/X86/X86InstrSSE.td | 1532 ++--- .../lib/Target/X86/X86InstrShiftRotate.td | 58 +- src/llvm/lib/Target/X86/X86InstrSystem.td | 28 +- src/llvm/lib/Target/X86/X86InstrTSX.td | 9 +- src/llvm/lib/Target/X86/X86IntrinsicsInfo.h | 280 +- src/llvm/lib/Target/X86/X86MCInstLower.cpp | 131 +- .../lib/Target/X86/X86MachineFunctionInfo.cpp | 19 + .../lib/Target/X86/X86MachineFunctionInfo.h | 28 +- src/llvm/lib/Target/X86/X86RegisterInfo.cpp | 10 +- src/llvm/lib/Target/X86/X86RegisterInfo.h | 1 + src/llvm/lib/Target/X86/X86RegisterInfo.td | 24 +- src/llvm/lib/Target/X86/X86Subtarget.cpp | 17 +- src/llvm/lib/Target/X86/X86Subtarget.h | 58 +- src/llvm/lib/Target/X86/X86TargetMachine.cpp | 88 +- src/llvm/lib/Target/X86/X86TargetMachine.h | 10 +- .../lib/Target/X86/X86TargetTransformInfo.cpp | 61 +- src/llvm/lib/Target/X86/X86VZeroUpper.cpp | 20 +- .../XCore/Disassembler/XCoreDisassembler.cpp | 54 +- .../lib/Target/XCore/XCoreFrameLowering.cpp | 7 +- .../lib/Target/XCore/XCoreISelLowering.cpp | 14 +- src/llvm/lib/Target/XCore/XCoreInstrInfo.cpp | 9 +- src/llvm/lib/Target/XCore/XCoreInstrInfo.td | 34 +- .../lib/Target/XCore/XCoreTargetMachine.cpp | 18 +- .../lib/Target/XCore/XCoreTargetMachine.h | 5 + .../lib/Transforms/IPO/ArgumentPromotion.cpp | 9 +- .../IPO/DeadArgumentElimination.cpp | 19 +- src/llvm/lib/Transforms/IPO/ExtractGV.cpp | 10 +- src/llvm/lib/Transforms/IPO/FunctionAttrs.cpp | 4 +- src/llvm/lib/Transforms/IPO/GlobalDCE.cpp | 46 +- src/llvm/lib/Transforms/IPO/GlobalOpt.cpp | 49 +- src/llvm/lib/Transforms/IPO/InlineAlways.cpp | 4 +- src/llvm/lib/Transforms/IPO/InlineSimple.cpp | 4 +- src/llvm/lib/Transforms/IPO/Inliner.cpp | 19 +- .../lib/Transforms/IPO/MergeFunctions.cpp | 2 +- .../lib/Transforms/IPO/PassManagerBuilder.cpp | 58 +- src/llvm/lib/Transforms/IPO/PruneEH.cpp | 4 +- src/llvm/lib/Transforms/IPO/StripSymbols.cpp | 24 +- .../lib/Transforms/InstCombine/InstCombine.h | 73 +- .../InstCombine/InstCombineAddSub.cpp | 161 +- .../InstCombine/InstCombineAndOrXor.cpp | 215 +- .../InstCombine/InstCombineCalls.cpp | 394 +- .../InstCombine/InstCombineCasts.cpp | 52 +- .../InstCombine/InstCombineCompares.cpp | 437 +- .../InstCombineLoadStoreAlloca.cpp | 376 +- .../InstCombine/InstCombineMulDivRem.cpp | 451 +- .../Transforms/InstCombine/InstCombinePHI.cpp | 8 +- .../InstCombine/InstCombineSelect.cpp | 149 +- .../InstCombine/InstCombineShifts.cpp | 14 +- .../InstCombine/InstructionCombining.cpp | 90 +- .../Instrumentation/AddressSanitizer.cpp | 756 ++- .../Transforms/Instrumentation/CMakeLists.txt | 3 +- .../Instrumentation/DataFlowSanitizer.cpp | 97 +- .../Transforms/Instrumentation/DebugIR.cpp | 617 -- .../lib/Transforms/Instrumentation/DebugIR.h | 98 - .../Instrumentation/GCOVProfiling.cpp | 48 +- .../Instrumentation/InstrProfiling.cpp | 309 + .../Instrumentation/Instrumentation.cpp | 2 + .../Transforms/Instrumentation/LLVMBuild.txt | 2 +- .../Instrumentation/MemorySanitizer.cpp | 396 +- .../Instrumentation/SanitizerCoverage.cpp | 314 + .../Instrumentation/ThreadSanitizer.cpp | 34 +- .../lib/Transforms/ObjCARC/CMakeLists.txt | 1 + .../Transforms/ObjCARC/DependencyAnalysis.cpp | 2 +- src/llvm/lib/Transforms/ObjCARC/ObjCARC.cpp | 1 + src/llvm/lib/Transforms/ObjCARC/ObjCARC.h | 14 +- .../lib/Transforms/ObjCARC/ObjCARCOpts.cpp | 24 +- .../Transforms/ObjCARC/ProvenanceAnalysis.cpp | 4 +- .../ObjCARC/ProvenanceAnalysisEvaluator.cpp | 92 + src/llvm/lib/Transforms/Scalar/ADCE.cpp | 2 +- .../Scalar/AlignmentFromAssumptions.cpp | 14 +- .../Transforms/Scalar/ConstantHoisting.cpp | 4 +- .../Scalar/DeadStoreElimination.cpp | 9 +- src/llvm/lib/Transforms/Scalar/EarlyCSE.cpp | 26 +- src/llvm/lib/Transforms/Scalar/GVN.cpp | 393 +- .../lib/Transforms/Scalar/IndVarSimplify.cpp | 84 +- .../lib/Transforms/Scalar/JumpThreading.cpp | 24 +- src/llvm/lib/Transforms/Scalar/LICM.cpp | 37 +- .../lib/Transforms/Scalar/LoadCombine.cpp | 23 +- .../Transforms/Scalar/LoopInstSimplify.cpp | 18 +- .../lib/Transforms/Scalar/LoopRerollPass.cpp | 58 +- .../lib/Transforms/Scalar/LoopRotation.cpp | 48 +- .../Transforms/Scalar/LoopStrengthReduce.cpp | 15 +- .../lib/Transforms/Scalar/LoopUnrollPass.cpp | 66 +- .../lib/Transforms/Scalar/LoopUnswitch.cpp | 21 +- .../lib/Transforms/Scalar/MemCpyOptimizer.cpp | 24 +- .../Scalar/MergedLoadStoreMotion.cpp | 145 +- .../Scalar/NullCheckElimination.cpp | 2 +- .../lib/Transforms/Scalar/Reassociate.cpp | 257 +- src/llvm/lib/Transforms/Scalar/Reg2Mem.cpp | 2 +- src/llvm/lib/Transforms/Scalar/SCCP.cpp | 6 +- src/llvm/lib/Transforms/Scalar/SROA.cpp | 1720 ++++-- .../lib/Transforms/Scalar/SampleProfile.cpp | 118 +- .../Scalar/ScalarReplAggregates.cpp | 39 +- src/llvm/lib/Transforms/Scalar/Scalarizer.cpp | 31 +- .../Scalar/SeparateConstOffsetFromGEP.cpp | 333 +- .../lib/Transforms/Scalar/SimplifyCFGPass.cpp | 18 +- .../lib/Transforms/Scalar/StructurizeCFG.cpp | 7 +- .../Scalar/TailRecursionElimination.cpp | 36 +- .../Transforms/Utils/AddDiscriminators.cpp | 2 +- .../lib/Transforms/Utils/BasicBlockUtils.cpp | 12 + .../Transforms/Utils/BreakCriticalEdges.cpp | 24 +- .../lib/Transforms/Utils/BuildLibCalls.cpp | 170 +- src/llvm/lib/Transforms/Utils/CMakeLists.txt | 7 +- .../lib/Transforms/Utils/CloneFunction.cpp | 20 +- src/llvm/lib/Transforms/Utils/CloneModule.cpp | 4 +- .../lib/Transforms/Utils/GlobalStatus.cpp | 2 +- .../lib/Transforms/Utils/InlineFunction.cpp | 123 +- .../lib/Transforms/Utils/IntegerDivision.cpp | 16 +- src/llvm/lib/Transforms/Utils/LCSSA.cpp | 49 +- src/llvm/lib/Transforms/Utils/Local.cpp | 92 +- .../lib/Transforms/Utils/LoopSimplify.cpp | 38 +- src/llvm/lib/Transforms/Utils/LoopUnroll.cpp | 62 +- .../Transforms/Utils/LoopUnrollRuntime.cpp | 26 +- src/llvm/lib/Transforms/Utils/LowerSwitch.cpp | 46 +- src/llvm/lib/Transforms/Utils/Mem2Reg.cpp | 11 +- .../Utils/PromoteMemoryToRegister.cpp | 27 +- src/llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 828 ++- .../lib/Transforms/Utils/SimplifyIndVar.cpp | 138 +- .../Transforms/Utils/SimplifyInstructions.cpp | 11 +- .../lib/Transforms/Utils/SimplifyLibCalls.cpp | 801 ++- .../lib/Transforms/Utils/SymbolRewriter.cpp | 550 ++ .../Utils/UnifyFunctionExitNodes.cpp | 1 - src/llvm/lib/Transforms/Utils/ValueMapper.cpp | 332 +- .../lib/Transforms/Vectorize/BBVectorize.cpp | 5 +- .../Transforms/Vectorize/LoopVectorize.cpp | 350 +- .../Transforms/Vectorize/SLPVectorizer.cpp | 165 +- src/llvm/test/Bindings/Go/go.test | 3 + src/llvm/test/Bindings/Go/lit.local.cfg | 57 + .../Bindings/{Ocaml => OCaml}/analysis.ml | 28 +- .../Bindings/{Ocaml => OCaml}/bitreader.ml | 22 +- .../Bindings/{Ocaml => OCaml}/bitwriter.ml | 13 +- .../{Ocaml/vmcore.ml => OCaml/core.ml} | 278 +- .../test/Bindings/OCaml/executionengine.ml | 112 + .../test/Bindings/{Ocaml => OCaml}/ext_exc.ml | 12 +- .../{Ocaml/ipo_opts.ml => OCaml/ipo.ml} | 12 +- .../Bindings/{Ocaml => OCaml}/irreader.ml | 8 +- .../test/Bindings/{Ocaml => OCaml}/linker.ml | 14 +- src/llvm/test/Bindings/OCaml/lit.local.cfg | 7 + .../{Ocaml => OCaml}/passmgr_builder.ml | 8 +- .../Bindings/{Ocaml => OCaml}/scalar_opts.ml | 55 +- .../test/Bindings/{Ocaml => OCaml}/target.ml | 16 +- .../test/Bindings/OCaml/transform_utils.ml | 21 + .../vectorize_opts.ml => OCaml/vectorize.ml} | 10 +- .../test/Bindings/Ocaml/executionengine.ml | 118 - src/llvm/test/Bindings/Ocaml/lit.local.cfg | 5 - .../test/Bindings/llvm-c/Inputs/invalid.ll.bc | Bin 0 -> 332 bytes .../test/Bindings/llvm-c/invalid-bitcode.test | 3 + .../Bitcode/function-local-metadata.3.5.ll.bc | Bin 0 -> 396 bytes src/llvm/test/Bitcode/metadata.3.5.ll.bc | Bin 0 -> 432 bytes src/llvm/test/CMakeLists.txt | 29 +- .../test/DebugInfo/Inputs/dwarfdump-objc.m | 16 + .../DebugInfo/Inputs/dwarfdump-objc.x86_64.o | Bin 0 -> 11512 bytes src/llvm/test/DebugInfo/dwarfdump-accel.test | 63 + src/llvm/test/DebugInfo/dwarfdump-objc.test | 40 + src/llvm/test/DebugInfo/dwarfdump-ranges.test | 14 + src/llvm/test/DebugInfo/llvm-symbolizer.test | 2 - .../llvm/test/DebugInfo/member-pointers.o | 0 .../missing-abstract-variable.o} | 0 .../DataFlowSanitizer/Inputs/debuglist.txt | 2 + src/llvm/test/JitListener/lit.local.cfg | 2 +- src/llvm/test/LTO/Inputs/invalid.ll.bc | Bin 0 -> 332 bytes src/llvm/test/MC/COFF/bigobj.py | 26 + .../test/MC/Disassembler/ARM/arm-tests.txt | 4 +- .../ARM/basic-arm-instructions.txt | 110 +- src/llvm/test/MC/Disassembler/ARM/d16.txt | 23 + .../Disassembler/ARM/invalid-virtexts.arm.txt | 10 + .../Disassembler/ARM/move-banked-regs-arm.txt | 66 +- .../test/MC/Disassembler/ARM/thumb-tests.txt | 2 +- .../MC/Disassembler/ARM/thumb2-preloads.txt | 69 + .../test/MC/Disassembler/ARM/virtexts-arm.txt | 41 + .../MC/Disassembler/ARM/virtexts-thumb.txt | 61 + .../MC/Disassembler/Hexagon/alu32_alu.txt | 44 + .../MC/Disassembler/Hexagon/alu32_perm.txt | 32 + .../MC/Disassembler/Hexagon/alu32_pred.txt | 70 + src/llvm/test/MC/Disassembler/Hexagon/cr.txt | 66 + src/llvm/test/MC/Disassembler/Hexagon/j.txt | 156 + src/llvm/test/MC/Disassembler/Hexagon/jr.txt | 26 + src/llvm/test/MC/Disassembler/Hexagon/ld.txt | 292 + .../MC/Disassembler/Hexagon/lit.local.cfg | 3 + .../test/MC/Disassembler/Hexagon/memop.txt | 50 + .../test/MC/Disassembler/Hexagon/nv_j.txt | 134 + .../test/MC/Disassembler/Hexagon/nv_st.txt | 166 + src/llvm/test/MC/Disassembler/Hexagon/st.txt | 274 + .../MC/Disassembler/Hexagon/system_user.txt | 12 + .../MC/Disassembler/Hexagon/xtype_alu.txt | 164 + .../MC/Disassembler/Hexagon/xtype_bit.txt | 92 + .../test/MC/Disassembler/Hexagon/xtype_fp.txt | 110 + .../MC/Disassembler/Hexagon/xtype_mpy.txt | 202 + .../MC/Disassembler/Hexagon/xtype_perm.txt | 14 + .../MC/Disassembler/Hexagon/xtype_pred.txt | 66 + .../MC/Disassembler/Hexagon/xtype_shift.txt | 188 + .../test/MC/Disassembler/Mips/micromips.txt | 180 + .../MC/Disassembler/Mips/micromips_le.txt | 180 + .../Mips/mips1/valid-mips1-el.txt | 116 + .../Disassembler/Mips/mips1/valid-mips1.txt | 116 + .../Disassembler/Mips/mips1/valid-xfail.txt | 5 + .../Mips/mips2/valid-mips2-el.txt | 159 + .../Disassembler/Mips/mips2/valid-mips2.txt | 159 + .../Mips/mips3/valid-mips3-el.txt | 209 + .../Disassembler/Mips/mips3/valid-mips3.txt | 209 + .../Mips/mips32/valid-mips32-el.txt | 294 + .../Disassembler/Mips/mips32/valid-mips32.txt | 294 + .../Mips/mips32/valid-xfail-mips32.txt | 30 + .../test/MC/Disassembler/Mips/mips32r2.txt | 3 + .../Mips/mips32r2/valid-mips32r2-le.txt | 337 ++ .../Mips/mips32r2/valid-mips32r2.txt | 337 ++ .../Mips/mips32r2/valid-xfail-mips32r2.txt | 83 + .../test/MC/Disassembler/Mips/mips32r2_le.txt | 3 + .../Mips/mips4/valid-mips4-el.txt | 229 + .../Disassembler/Mips/mips4/valid-mips4.txt | 229 + .../Mips/mips4/valid-xfail-mips4.txt | 42 + .../PowerPC/ppc64-encoding-ext.txt | 21 + .../Disassembler/PowerPC/ppc64-encoding.txt | 3 + src/llvm/test/MC/Disassembler/X86/avx-512.txt | 9 +- .../MC/Disassembler/X86/intel-syntax-32.txt | 12 + .../test/MC/Disassembler/X86/intel-syntax.txt | 20 + .../MC/Disassembler/X86/invalid-cmp-imm.txt | 10 - src/llvm/test/MC/Disassembler/X86/moffs.txt | 106 +- .../test/MC/Disassembler/X86/prefixes.txt | 15 +- .../test/MC/Disassembler/X86/simple-tests.txt | 15 + src/llvm/test/MC/Disassembler/X86/x86-32.txt | 29 + src/llvm/test/MC/Disassembler/X86/x86-64.txt | 15 + src/llvm/test/MC/Hexagon/lit.local.cfg | 3 + src/llvm/test/MC/R600/lit.local.cfg | 2 + src/llvm/test/Makefile | 15 +- .../AArch64/yaml2obj-elf-aarch64-rel.yaml | 55 + .../test/Object/ARM/macho-data-in-code.test | 2 +- .../Object/Inputs/COFF/long-section-name.yaml | 11 + .../Inputs/COFF/section-aux-symbol.yaml | 167 + .../Inputs/macho-archive-unsorted-x86_64.a | Bin 0 -> 1304 bytes .../test/Object/Inputs/macho-no-exports.dylib | Bin 0 -> 4208 bytes .../test/Object/Inputs/macho-rpath-x86_64 | Bin 0 -> 4296 bytes src/llvm/test/Object/Inputs/macho-zero-ncmds | Bin 0 -> 32 bytes .../test/Object/Inputs/micro-mips.elf-mipsel | Bin 0 -> 2394 bytes src/llvm/test/Object/Inputs/mri-crlf.mri | 2 + src/llvm/test/Object/Inputs/thin.a | Bin 0 -> 474 bytes .../test/Object/Mips/objdump-micro-mips.test | 12 + ...bjdump-disassembly-inline-relocations.test | 6 +- src/llvm/test/Object/archive-error-tmp.txt | 2 - src/llvm/test/Object/archive-symtab.test | 1 + src/llvm/test/Object/archive-toc.test | 8 + src/llvm/test/Object/coff-archive-short.test | 2 +- src/llvm/test/Object/coff-archive.test | 2 +- src/llvm/test/Object/mri-addlib.test | 14 + src/llvm/test/Object/mri-addmod.test | 33 + src/llvm/test/Object/mri-crlf.test | 1 + src/llvm/test/Object/mri1.test | 6 + src/llvm/test/Object/mri2.test | 7 + src/llvm/test/Object/mri3.test | 6 + src/llvm/test/Object/mri4.test | 4 + src/llvm/test/Object/mri5.test | 2 + src/llvm/test/Object/nm-archive.test | 4 +- src/llvm/test/Object/nm-trivial-object.test | 28 +- .../obj2yaml-coff-long-section-name.test | 3 + .../obj2yaml-coff-section-aux-symbol.test | 96 + src/llvm/test/Object/objdump-export-list.test | 4 + .../test/Object/objdump-macho-quirks.test | 9 + .../test/Object/objdump-private-headers.test | 7 + src/llvm/test/Object/objdump-relocations.test | 6 +- ...aml2obj-elf-file-headers-with-e_flags.yaml | 6 +- .../yaml2obj-elf-symbol-visibility.yaml | 4 +- src/llvm/test/SymbolRewriter/rewrite.map | 66 + .../IndVarSimplify/NVPTX/lit.local.cfg | 2 + .../SampleProfile/Inputs/fnptr.binprof | Bin 0 -> 112 bytes .../SampleProfile/Inputs/fnptr.prof | 12 + src/llvm/test/lit.cfg | 69 +- src/llvm/test/lit.site.cfg.in | 12 +- .../Inputs/basic-archive.macho.x86_64 | Bin 0 -> 9352 bytes .../dsymutil/Inputs/basic-lto.macho.x86_64 | Bin 0 -> 8912 bytes .../dsymutil/Inputs/basic-lto.macho.x86_64.o | Bin 0 -> 4516 bytes .../tools/dsymutil/Inputs/basic.macho.x86_64 | Bin 0 -> 9320 bytes src/llvm/test/tools/dsymutil/Inputs/basic1.c | 28 + .../dsymutil/Inputs/basic1.macho.x86_64.o | Bin 0 -> 2376 bytes src/llvm/test/tools/dsymutil/Inputs/basic2.c | 22 + .../dsymutil/Inputs/basic2.macho.x86_64.o | Bin 0 -> 3472 bytes src/llvm/test/tools/dsymutil/Inputs/basic3.c | 20 + .../dsymutil/Inputs/basic3.macho.x86_64.o | Bin 0 -> 3008 bytes .../test/tools/dsymutil/Inputs/libbasic.a | Bin 0 -> 6840 bytes .../tools/dsymutil/debug-map-parsing.test | 77 + .../tools/llvm-mc/line_end_with_space.test | 2 + .../AArch64/Inputs/ObjC.exe.macho-aarch64 | Bin 0 -> 49736 bytes .../AArch64/Inputs/ObjC.obj.macho-aarch64 | Bin 0 -> 2008 bytes .../AArch64/Inputs/hello.exe.macho-aarch64 | Bin 0 -> 49416 bytes .../AArch64/Inputs/hello.obj.macho-aarch64 | Bin 0 -> 604 bytes .../tools/llvm-objdump/AArch64/lit.local.cfg | 2 + .../AArch64/macho-private-headers.test | 312 + .../AArch64/macho-symbolized-disassembly.test | 23 + .../ARM/Inputs/hello.exe.macho-arm | Bin 0 -> 49408 bytes .../ARM/Inputs/hello.obj.macho-arm | Bin 0 -> 744 bytes .../ARM/macho-private-headers.test | 345 ++ .../ARM/macho-symbolized-disassembly.test | 8 + .../ARM/macho-symbolized-subtractor.test | 15 + .../Inputs/bad-ordinal.macho-x86_64 | Bin 0 -> 8496 bytes .../llvm-objdump/Inputs/bind2.macho-x86_64 | Bin 0 -> 8376 bytes .../X86/Inputs/ObjC.exe.macho-x86_64 | Bin 0 -> 8944 bytes .../X86/Inputs/ObjC.obj.macho-x86_64 | Bin 0 -> 1732 bytes .../X86/Inputs/dylibLoadKinds.macho-x86_64 | Bin 0 -> 4280 bytes .../X86/Inputs/dylibRoutines.macho-x86_64 | Bin 0 -> 4288 bytes .../X86/Inputs/dylibSubClient.macho-x86_64 | Bin 0 -> 4240 bytes .../X86/Inputs/dylibSubFramework.macho-x86_64 | Bin 0 -> 4240 bytes .../X86/Inputs/dylibSubLibrary.macho-x86_64 | Bin 0 -> 4220 bytes .../X86/Inputs/dylibSubUmbrella.macho-x86_64 | Bin 0 -> 4220 bytes .../X86/Inputs/exeThread.macho-x86_64 | Bin 0 -> 9100 bytes .../X86/Inputs/hello.exe.macho-i386 | Bin 0 -> 8476 bytes .../X86/Inputs/hello.obj.macho-i386 | Bin 0 -> 472 bytes .../X86/Inputs/hello_cpp.exe.macho-x86_64 | Bin 0 -> 15100 bytes .../X86/Inputs/linkerOption.macho-x86_64 | Bin 0 -> 744 bytes .../macho-universal-archive.x86_64.i386 | Bin 0 -> 1656 bytes .../X86/Inputs/macho-universal.x86_64.i386 | Bin 0 -> 16624 bytes .../X86/macho-private-headers.test | 106 + .../X86/macho-symbolized-disassembly.test | 30 + .../X86/macho-symbolized-subtractor-i386.test | 10 + .../X86/macho-universal-x86_64.i386.test | 44 + .../tools/llvm-objdump/coff-large-bss.test | 5 +- .../tools/llvm-objdump/macho-bad-ordinal.test | 6 + .../test/tools/llvm-objdump/macho-bind2.test | 5 + .../Inputs/sample-profile.proftext | 12 + .../llvm-profdata/sample-profile-basic.test | 30 + .../Inputs/bad-relocs.obj.coff-i386 | Bin 0 -> 97 bytes .../Inputs/basereloc.obj.coff-i386 | Bin 0 -> 2560 bytes ...dat-function-linetables.obj.coff-2012-i386 | Bin 0 -> 2005 bytes ...dat-function-linetables.obj.coff-2013-i386 | Bin 0 -> 8501 bytes .../Inputs/directives.obj.coff-x86_64 | Bin 0 -> 244 bytes .../tools/llvm-readobj/Inputs/export-arm.dll | Bin 0 -> 5632 bytes .../tools/llvm-readobj/Inputs/export-x64.dll | Bin 0 -> 6144 bytes .../tools/llvm-readobj/Inputs/export-x86.dll | Bin 0 -> 6144 bytes .../llvm-readobj/Inputs/imports.exe.coff-i386 | Bin 0 -> 3072 bytes .../Inputs/imports.exe.coff-x86-64 | Bin 0 -> 4096 bytes .../multifile-linetables.obj.coff-2012-i368 | Bin 0 -> 1631 bytes .../multifile-linetables.obj.coff-2012-x86_64 | Bin 0 -> 1799 bytes ...ultifunction-linetables.obj.coff-2012-i368 | Bin 0 -> 2155 bytes ...tifunction-linetables.obj.coff-2012-x86_64 | Bin 0 -> 2475 bytes .../Inputs/relocs-no-symtab.obj.coff-i386 | Bin 0 -> 97 bytes .../Inputs/relocs.obj.elf-aarch64 | Bin 3144 -> 4232 bytes .../llvm-readobj/Inputs/relocs.obj.elf-arm | Bin 2100 -> 2112 bytes .../test/tools/llvm-readobj/Inputs/relocs.py | 44 +- .../llvm-readobj/codeview-linetables.test | 148 +- .../tools/llvm-readobj/coff-basereloc.test | 24 + .../tools/llvm-readobj/coff-directives.test | 2 + .../test/tools/llvm-readobj/coff-exports.test | 11 + .../test/tools/llvm-readobj/file-headers.test | 122 +- src/llvm/test/tools/llvm-readobj/imports.test | 88 + src/llvm/test/tools/llvm-readobj/peplus.test | 2 +- .../test/tools/llvm-readobj/reloc-types.test | 45 +- .../test/tools/llvm-readobj/relocations.test | 10 + .../llvm-symbolizer/Inputs/dsym-test-exe | Bin 0 -> 4584 bytes .../Contents/Info.plist | 20 + .../Resources/DWARF/dsym-test-exe-second | Bin 0 -> 8833 bytes .../Inputs/dsym-test-exe-second | Bin 0 -> 4584 bytes .../dsym-test-exe.dSYM/Contents/Info.plist | 20 + .../Contents/Resources/DWARF/dsym-test-exe | Bin 0 -> 8833 bytes .../tools/llvm-symbolizer/Inputs/dsym-test.c | 8 + .../test/tools/llvm-symbolizer/Inputs/ppc64 | Bin 0 -> 1624 bytes src/llvm/test/tools/llvm-symbolizer/dsym.test | 14 + .../test/tools/llvm-symbolizer/ppc64.test | 11 + .../Inputs/trivial.obj.elf-i386 | Bin 0 -> 1032 bytes .../test/tools/llvm-vtabledump/trivial.test | 104 +- src/llvm/tools/CMakeLists.txt | 22 +- src/llvm/tools/LLVMBuild.txt | 2 +- src/llvm/tools/Makefile | 9 +- src/llvm/tools/bugpoint/BugDriver.cpp | 7 +- src/llvm/tools/bugpoint/Miscompilation.cpp | 28 +- src/llvm/tools/bugpoint/OptimizerDriver.cpp | 27 +- src/llvm/tools/bugpoint/ToolRunner.cpp | 39 +- src/llvm/tools/bugpoint/bugpoint.cpp | 10 - src/llvm/tools/dsymutil/BinaryHolder.cpp | 111 + src/llvm/tools/dsymutil/BinaryHolder.h | 104 + src/llvm/tools/dsymutil/CMakeLists.txt | 13 + src/llvm/tools/dsymutil/DebugMap.cpp | 80 + src/llvm/tools/dsymutil/DebugMap.h | 128 + src/llvm/tools/dsymutil/DwarfLinker.cpp | 20 + src/llvm/tools/dsymutil/LLVMBuild.txt | 22 + .../tools/dsymutil/MachODebugMapParser.cpp | 234 + src/llvm/tools/dsymutil/Makefile | 17 + src/llvm/tools/dsymutil/dsymutil.cpp | 71 + src/llvm/tools/dsymutil/dsymutil.h | 39 + src/llvm/tools/gold/CMakeLists.txt | 6 +- src/llvm/tools/gold/gold-plugin.cpp | 268 +- src/llvm/tools/llc/llc.cpp | 39 +- .../tools/lli/ChildTarget/ChildTarget.cpp | 14 +- src/llvm/tools/lli/RemoteMemoryManager.cpp | 3 +- src/llvm/tools/lli/RemoteMemoryManager.h | 3 +- src/llvm/tools/lli/lli.cpp | 15 +- src/llvm/tools/llvm-ar/CMakeLists.txt | 15 +- src/llvm/tools/llvm-ar/install_symlink.cmake | 25 + src/llvm/tools/llvm-ar/llvm-ar.cpp | 367 +- .../tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp | 6 +- src/llvm/tools/llvm-c-test/CMakeLists.txt | 28 + src/llvm/tools/llvm-c-test/llvm-c-test.h | 4 + src/llvm/tools/llvm-c-test/main.c | 4 + src/llvm/tools/llvm-c-test/metadata.c | 43 + .../tools/llvm-config/BuildVariables.inc.in | 1 + src/llvm/tools/llvm-config/Makefile | 2 + src/llvm/tools/llvm-config/llvm-config.cpp | 10 +- src/llvm/tools/llvm-cov/CodeCoverage.cpp | 44 +- src/llvm/tools/llvm-cov/CoverageFilters.h | 2 +- src/llvm/tools/llvm-cov/CoverageReport.cpp | 2 +- src/llvm/tools/llvm-cov/CoverageReport.h | 2 +- src/llvm/tools/llvm-cov/CoverageSummary.cpp | 46 +- src/llvm/tools/llvm-cov/CoverageSummary.h | 2 +- src/llvm/tools/llvm-cov/TestingSupport.cpp | 16 +- src/llvm/tools/llvm-cov/gcov.cpp | 3 +- src/llvm/tools/llvm-cov/llvm-cov.cpp | 45 +- src/llvm/tools/llvm-dis/llvm-dis.cpp | 39 +- .../tools/llvm-dwarfdump/llvm-dwarfdump.cpp | 5 +- src/llvm/tools/llvm-extract/llvm-extract.cpp | 25 +- src/llvm/tools/llvm-go/CMakeLists.txt | 9 + src/llvm/tools/llvm-go/Makefile | 16 + src/llvm/tools/llvm-go/llvm-go.go | 290 + .../tools/llvm-jitlistener/CMakeLists.txt | 43 +- .../llvm-jitlistener/llvm-jitlistener.cpp | 6 +- src/llvm/tools/llvm-link/llvm-link.cpp | 45 +- src/llvm/tools/llvm-lto/llvm-lto.cpp | 65 +- src/llvm/tools/llvm-mc/Disassembler.cpp | 71 +- src/llvm/tools/llvm-mc/llvm-mc.cpp | 108 +- src/llvm/tools/llvm-nm/llvm-nm.cpp | 30 +- src/llvm/tools/llvm-objdump/COFFDump.cpp | 2 +- src/llvm/tools/llvm-objdump/MachODump.cpp | 2567 +++++++- src/llvm/tools/llvm-objdump/llvm-objdump.cpp | 124 +- src/llvm/tools/llvm-objdump/llvm-objdump.h | 16 +- src/llvm/tools/llvm-profdata/CMakeLists.txt | 6 +- .../tools/llvm-profdata/llvm-profdata.cpp | 172 +- .../tools/llvm-readobj/ARMAttributeParser.cpp | 2 +- .../tools/llvm-readobj/ARMWinEHPrinter.cpp | 16 +- src/llvm/tools/llvm-readobj/COFFDumper.cpp | 312 +- src/llvm/tools/llvm-readobj/ELFDumper.cpp | 3 +- src/llvm/tools/llvm-readobj/Error.cpp | 2 +- src/llvm/tools/llvm-readobj/MachODumper.cpp | 183 +- src/llvm/tools/llvm-readobj/ObjDumper.h | 6 + src/llvm/tools/llvm-readobj/llvm-readobj.cpp | 30 +- src/llvm/tools/llvm-rtdyld/CMakeLists.txt | 1 + src/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp | 60 +- src/llvm/tools/llvm-shlib/CMakeLists.txt | 100 + src/llvm/tools/llvm-shlib/libllvm.cpp | 20 + src/llvm/tools/llvm-size/llvm-size.cpp | 49 +- .../tools/llvm-symbolizer/LLVMSymbolize.cpp | 186 +- .../tools/llvm-symbolizer/LLVMSymbolize.h | 50 +- .../tools/llvm-symbolizer/llvm-symbolizer.cpp | 14 + .../tools/llvm-vtabledump/llvm-vtabledump.cpp | 214 +- src/llvm/tools/lto/CMakeLists.txt | 1 + src/llvm/tools/lto/lto.cpp | 47 +- src/llvm/tools/lto/lto.exports | 3 + src/llvm/tools/macho-dump/macho-dump.cpp | 8 +- src/llvm/tools/obj2yaml/coff2yaml.cpp | 87 +- src/llvm/tools/obj2yaml/elf2yaml.cpp | 2 +- src/llvm/tools/opt/BreakpointPrinter.cpp | 2 +- src/llvm/tools/opt/NewPMDriver.cpp | 33 +- src/llvm/tools/opt/PassRegistry.def | 14 + src/llvm/tools/opt/Passes.cpp | 209 +- src/llvm/tools/opt/Passes.h | 27 +- src/llvm/tools/opt/opt.cpp | 66 +- .../verify-uselistorder.cpp | 10 +- src/llvm/tools/yaml2obj/yaml2coff.cpp | 218 +- src/llvm/tools/yaml2obj/yaml2elf.cpp | 8 +- src/llvm/unittests/ADT/APFloatTest.cpp | 205 + src/llvm/unittests/ADT/APIntTest.cpp | 13 +- src/llvm/unittests/ADT/CMakeLists.txt | 2 + src/llvm/unittests/ADT/DenseSetTest.cpp | 38 + src/llvm/unittests/ADT/FunctionRefTest.cpp | 28 + src/llvm/unittests/ADT/MapVectorTest.cpp | 251 + src/llvm/unittests/ADT/OptionalTest.cpp | 2 +- .../unittests/ADT/PostOrderIteratorTest.cpp | 37 + src/llvm/unittests/ADT/SmallVectorTest.cpp | 130 + src/llvm/unittests/ADT/StringMapTest.cpp | 22 +- src/llvm/unittests/ADT/TinyPtrVectorTest.cpp | 26 + src/llvm/unittests/ADT/TripleTest.cpp | 17 + src/llvm/unittests/Analysis/CMakeLists.txt | 2 + src/llvm/unittests/Analysis/CallGraphTest.cpp | 59 + .../unittests/Analysis/LazyCallGraphTest.cpp | 32 +- src/llvm/unittests/Analysis/Makefile | 2 +- src/llvm/unittests/Bitcode/BitReaderTest.cpp | 8 +- .../unittests/Bitcode/BitstreamReaderTest.cpp | 56 + src/llvm/unittests/Bitcode/CMakeLists.txt | 1 + src/llvm/unittests/CMakeLists.txt | 2 +- src/llvm/unittests/CodeGen/DIEHashTest.cpp | 4 +- .../ExecutionEngine/MCJIT/MCJITCAPITest.cpp | 32 + .../MCJIT/MCJITObjectCacheTest.cpp | 6 +- .../ExecutionEngine/MCJIT/MCJITTest.cpp | 12 + .../ExecutionEngine/MCJIT/MCJITTestBase.h | 13 +- src/llvm/unittests/IR/CMakeLists.txt | 2 +- src/llvm/unittests/IR/DebugInfoTest.cpp | 68 + src/llvm/unittests/IR/LeakDetectorTest.cpp | 31 - src/llvm/unittests/IR/MDBuilderTest.cpp | 21 +- src/llvm/unittests/IR/MetadataTest.cpp | 456 +- src/llvm/unittests/IR/PassManagerTest.cpp | 35 +- src/llvm/unittests/IR/UseTest.cpp | 2 +- src/llvm/unittests/IR/UserTest.cpp | 2 +- src/llvm/unittests/IR/ValueTest.cpp | 23 + src/llvm/unittests/IR/WaymarkTest.cpp | 5 +- src/llvm/unittests/Linker/CMakeLists.txt | 1 + src/llvm/unittests/Linker/LinkModulesTest.cpp | 46 +- src/llvm/unittests/Linker/Makefile | 2 +- src/llvm/unittests/MC/CMakeLists.txt | 3 + src/llvm/unittests/MC/Disassembler.cpp | 64 + src/llvm/unittests/MC/Makefile | 2 +- .../unittests/MC/StringTableBuilderTest.cpp | 2 +- src/llvm/unittests/Support/CMakeLists.txt | 6 + src/llvm/unittests/Support/Casting.cpp | 96 + .../unittests/Support/CompressionTest.cpp | 2 +- src/llvm/unittests/Support/ConvertUTFTest.cpp | 4 +- .../Support/FileOutputBufferTest.cpp | 7 +- .../unittests/Support/MemoryBufferTest.cpp | 50 + src/llvm/unittests/Support/MemoryTest.cpp | 2 +- src/llvm/unittests/Support/Path.cpp | 102 +- src/llvm/unittests/Support/ProcessTest.cpp | 20 - src/llvm/unittests/Support/ProgramTest.cpp | 50 + .../unittests/Support/ScaledNumberTest.cpp | 1 - .../unittests/Support/SpecialCaseListTest.cpp | 20 +- .../Support/StreamingMemoryObject.cpp | 29 + src/llvm/unittests/Support/StringPool.cpp | 4 +- .../unittests/Support/ThreadLocalTest.cpp | 23 +- src/llvm/unittests/Transforms/CMakeLists.txt | 1 - .../Transforms/DebugIR/CMakeLists.txt | 9 - .../unittests/Transforms/DebugIR/DebugIR.cpp | 308 - src/llvm/unittests/Transforms/Makefile | 2 +- .../unittests/Transforms/Utils/Cloning.cpp | 10 +- src/llvm/utils/FileCheck/FileCheck.cpp | 2 +- src/llvm/utils/TableGen/AsmMatcherEmitter.cpp | 421 +- src/llvm/utils/TableGen/AsmWriterEmitter.cpp | 80 +- src/llvm/utils/TableGen/AsmWriterInst.cpp | 4 +- src/llvm/utils/TableGen/AsmWriterInst.h | 3 +- .../utils/TableGen/CallingConvEmitter.cpp | 31 +- .../utils/TableGen/CodeGenDAGPatterns.cpp | 142 +- src/llvm/utils/TableGen/CodeGenDAGPatterns.h | 17 +- .../utils/TableGen/CodeGenInstruction.cpp | 13 +- src/llvm/utils/TableGen/CodeGenInstruction.h | 1 - src/llvm/utils/TableGen/CodeGenRegisters.cpp | 469 +- src/llvm/utils/TableGen/CodeGenRegisters.h | 81 +- src/llvm/utils/TableGen/CodeGenSchedule.cpp | 48 +- src/llvm/utils/TableGen/CodeGenTarget.cpp | 51 +- src/llvm/utils/TableGen/CodeGenTarget.h | 13 +- src/llvm/utils/TableGen/DAGISelEmitter.cpp | 8 +- src/llvm/utils/TableGen/DAGISelMatcher.h | 5 +- .../utils/TableGen/DAGISelMatcherEmitter.cpp | 2 +- src/llvm/utils/TableGen/DAGISelMatcherGen.cpp | 39 +- src/llvm/utils/TableGen/DAGISelMatcherOpt.cpp | 9 +- src/llvm/utils/TableGen/FastISelEmitter.cpp | 223 +- .../utils/TableGen/FixedLenDecoderEmitter.cpp | 87 +- src/llvm/utils/TableGen/InstrInfoEmitter.cpp | 8 +- src/llvm/utils/TableGen/IntrinsicEmitter.cpp | 24 +- .../utils/TableGen/RegisterInfoEmitter.cpp | 564 +- .../utils/TableGen/SequenceToOffsetTable.h | 5 + src/llvm/utils/TableGen/SubtargetEmitter.cpp | 4 +- src/llvm/utils/TableGen/TableGen.cpp | 16 +- .../utils/TableGen/X86DisassemblerTables.cpp | 58 +- .../utils/TableGen/X86DisassemblerTables.h | 4 +- .../utils/TableGen/X86RecognizableInstr.cpp | 149 +- .../utils/TableGen/X86RecognizableInstr.h | 4 +- src/llvm/utils/emacs/emacs.el | 21 +- src/llvm/utils/emacs/llvm-mode.el | 96 +- src/llvm/utils/emacs/tablegen-mode.el | 20 +- src/llvm/utils/findmisopt | 4 +- src/llvm/utils/git-svn/git-svnrevert | 25 +- src/llvm/utils/lit/lit/Test.py | 59 + src/llvm/utils/lit/lit/TestRunner.py | 86 +- src/llvm/utils/lit/lit/TestingConfig.py | 14 +- src/llvm/utils/lit/lit/__init__.py | 2 +- src/llvm/utils/lit/lit/discovery.py | 2 +- src/llvm/utils/lit/lit/formats/googletest.py | 1 - src/llvm/utils/lit/lit/main.py | 48 +- src/llvm/utils/lit/lit/util.py | 32 +- src/llvm/utils/lit/tests/test-output.py | 2 - src/llvm/utils/lit/tests/xunit-output.py | 10 + .../utils/llvm-build/llvmbuild/__init__.pyc | Bin 261 -> 261 bytes .../llvm-build/llvmbuild/componentinfo.pyc | Bin 20261 -> 20261 bytes .../utils/llvm-build/llvmbuild/configutil.pyc | Bin 2075 -> 2075 bytes src/llvm/utils/llvm-build/llvmbuild/main.py | 45 +- src/llvm/utils/llvm-build/llvmbuild/main.pyc | Bin 30658 -> 31108 bytes src/llvm/utils/llvm-build/llvmbuild/util.pyc | Bin 1644 -> 1644 bytes src/llvm/utils/not/not.cpp | 14 +- src/llvm/utils/release/merge.sh | 10 +- src/llvm/utils/release/tag.sh | 39 +- src/llvm/utils/release/test-release.sh | 48 +- src/llvm/utils/update_llc_test_checks.py | 207 + src/llvm/utils/vim/llvm.vim | 40 +- src/rt/arch/aarch64/morestack.S | 26 +- src/rt/arch/armv7/morestack.S | 70 + src/rt/arch/armv7/record_sp.S | 56 + src/rt/arch/armv7s/morestack.S | 70 + src/rt/arch/armv7s/record_sp.S | 56 + src/rt/arch/powerpc/morestack.S | 18 + src/rt/arch/powerpc/record_sp.S | 4 + src/rt/rust_builtin.c | 193 +- src/rust-installer/.gitmodules | 3 + src/rust-installer/README.md | 23 +- src/rust-installer/combine-installers.sh | 188 +- src/rust-installer/gen-install-script.sh | 157 +- src/rust-installer/gen-installer.sh | 185 +- src/rust-installer/install-template.sh | 1213 ++-- src/rust-installer/rust-installer-version | 2 +- src/rust-installer/test.sh | 1766 ++++-- src/rustbook/book.rs | 86 +- src/rustbook/build.rs | 69 +- src/rustbook/css.rs | 117 +- src/rustbook/error.rs | 11 +- src/rustbook/javascript.rs | 74 + src/rustbook/main.rs | 25 +- src/rustbook/term.rs | 6 +- src/rustbook/test.rs | 6 +- src/rustllvm/ExecutionEngineWrapper.cpp | 21 +- src/rustllvm/RustWrapper.cpp | 285 +- src/rustllvm/llvm-auto-clean-trigger | 2 +- src/snapshots.txt | 63 + .../blind-item-mixed-crate-use-item-foo.rs | 13 + .../blind-item-mixed-crate-use-item-foo2.rs | 13 + src/test/auxiliary/cci_capture_clause.rs | 6 +- src/test/auxiliary/cci_class_3.rs | 2 +- src/test/auxiliary/cci_class_4.rs | 4 +- src/test/auxiliary/cci_class_cast.rs | 4 +- src/test/auxiliary/cci_impl_lib.rs | 2 +- src/test/auxiliary/cci_iter_lib.rs | 4 +- src/test/auxiliary/cci_nested_lib.rs | 2 +- src/test/auxiliary/cci_no_inline_lib.rs | 4 +- src/test/auxiliary/coherence-orphan-lib.rs | 2 +- src/test/auxiliary/default_type_params_xc.rs | 3 +- src/test/auxiliary/i8.rs | 13 + src/test/auxiliary/inherited_stability.rs | 41 +- src/test/auxiliary/inner_static.rs | 12 +- src/test/auxiliary/issue-10028.rs | 2 + src/test/auxiliary/issue-11224.rs | 2 +- src/test/auxiliary/issue-14421.rs | 5 +- src/test/auxiliary/issue-14422.rs | 3 +- src/test/auxiliary/issue-16643.rs | 4 +- src/test/auxiliary/issue-17662.rs | 2 +- src/test/auxiliary/issue-17718.rs | 4 +- src/test/auxiliary/issue-18711.rs | 2 +- src/test/auxiliary/issue-21146-inc.rs | 13 + src/test/auxiliary/issue-21202.rs | 16 + src/test/auxiliary/issue-2380.rs | 5 +- src/test/auxiliary/issue-2526.rs | 8 +- src/test/auxiliary/issue-2631-a.rs | 3 +- src/test/auxiliary/issue-8044.rs | 2 +- src/test/auxiliary/issue-9906.rs | 2 +- src/test/auxiliary/issue13213aux.rs | 5 +- src/test/auxiliary/issue13507.rs | 2 +- src/test/auxiliary/issue_20389.rs | 1 + src/test/auxiliary/issue_3907.rs | 4 +- src/test/auxiliary/issue_8401.rs | 4 +- src/test/auxiliary/issue_9123.rs | 1 + src/test/auxiliary/lang-item-public.rs | 11 +- src/test/auxiliary/lint_group_plugin_test.rs | 4 +- src/test/auxiliary/lint_output_format.rs | 9 +- src/test/auxiliary/lint_plugin_test.rs | 2 +- src/test/auxiliary/lint_stability.rs | 186 +- src/test/auxiliary/logging_right_crate.rs | 2 +- src/test/auxiliary/macro_crate_test.rs | 37 +- src/test/auxiliary/macro_reexport_1.rs | 2 +- src/test/auxiliary/macro_reexport_2.rs | 1 + src/test/auxiliary/macro_reexport_2_no_use.rs | 1 + src/test/auxiliary/macro_with_super_1.rs | 26 + src/test/auxiliary/method_self_arg1.rs | 3 +- src/test/auxiliary/method_self_arg2.rs | 3 +- src/test/auxiliary/nested_item.rs | 2 +- .../auxiliary/no_method_suggested_traits.rs | 46 + src/test/auxiliary/no_std_crate.rs | 1 + .../auxiliary/orphan_check_diagnostics.rs | 11 + src/test/auxiliary/overloaded_autoderef_xc.rs | 5 +- src/test/auxiliary/plugin_args.rs | 9 +- src/test/auxiliary/plugin_with_plugin_lib.rs | 22 + src/test/auxiliary/private_trait_xc.rs | 2 +- src/test/auxiliary/roman_numerals.rs | 10 +- src/test/auxiliary/stability_cfg1.rs | 3 +- src/test/auxiliary/stability_cfg2.rs | 5 +- src/test/auxiliary/static-methods-crate.rs | 4 +- src/test/auxiliary/svh-a-base.rs | 6 +- src/test/auxiliary/svh-a-change-lit.rs | 6 +- .../auxiliary/svh-a-change-significant-cfg.rs | 6 +- .../auxiliary/svh-a-change-trait-bound.rs | 6 +- src/test/auxiliary/svh-a-change-type-arg.rs | 6 +- src/test/auxiliary/svh-a-change-type-ret.rs | 6 +- .../auxiliary/svh-a-change-type-static.rs | 6 +- src/test/auxiliary/svh-a-comment.rs | 6 +- src/test/auxiliary/svh-a-doc.rs | 6 +- src/test/auxiliary/svh-a-macro.rs | 6 +- src/test/auxiliary/svh-a-no-change.rs | 6 +- src/test/auxiliary/svh-a-redundant-cfg.rs | 6 +- src/test/auxiliary/svh-a-whitespace.rs | 6 +- ...rs => syntax_extension_with_dll_deps_1.rs} | 0 ...rs => syntax_extension_with_dll_deps_2.rs} | 2 +- .../trait_bounds_on_structs_and_enums_xc.rs | 4 +- src/test/auxiliary/trait_impl_conflict.rs | 2 +- .../trait_inheritance_overloading_xc.rs | 2 +- src/test/auxiliary/typeid-intrinsic.rs | 21 +- src/test/auxiliary/typeid-intrinsic2.rs | 21 +- .../auxiliary/unboxed-closures-cross-crate.rs | 12 +- src/test/auxiliary/use_from_trait_xc.rs | 2 +- src/test/auxiliary/weak-lang-items.rs | 1 + src/test/auxiliary/xcrate_unit_struct.rs | 15 +- src/test/bench/core-map.rs | 70 +- src/test/bench/core-set.rs | 61 +- src/test/bench/core-std.rs | 43 +- src/test/bench/core-uint-to-str.rs | 13 +- src/test/bench/msgsend-pipes-shared.rs | 27 +- src/test/bench/msgsend-pipes.rs | 33 +- src/test/bench/msgsend-ring-mutex-arcs.rs | 19 +- src/test/bench/noise.rs | 15 +- src/test/bench/rt-messaging-ping-pong.rs | 36 +- src/test/bench/rt-parfib.rs | 21 +- src/test/bench/shootout-ackermann.rs | 12 +- src/test/bench/shootout-binarytrees.rs | 79 +- src/test/bench/shootout-chameneos-redux.rs | 36 +- src/test/bench/shootout-fannkuch-redux.rs | 38 +- src/test/bench/shootout-fasta-redux.rs | 44 +- src/test/bench/shootout-fasta.rs | 33 +- src/test/bench/shootout-fibo.rs | 12 +- src/test/bench/shootout-k-nucleotide-pipes.rs | 67 +- src/test/bench/shootout-k-nucleotide.rs | 45 +- src/test/bench/shootout-mandelbrot.rs | 46 +- src/test/bench/shootout-meteor.rs | 64 +- src/test/bench/shootout-nbody.rs | 19 +- src/test/bench/shootout-pfib.rs | 44 +- src/test/bench/shootout-regex-dna.rs | 126 - src/test/bench/shootout-reverse-complement.rs | 37 +- src/test/bench/shootout-spectralnorm.rs | 37 +- src/test/bench/shootout-threadring.rs | 30 +- src/test/bench/std-smallintmap.rs | 33 +- src/test/bench/sudoku.rs | 64 +- src/test/bench/task-perf-alloc-unwind.rs | 24 +- .../bench/task-perf-jargon-metal-smoke.rs | 15 +- src/test/bench/task-perf-one-million.rs | 70 - src/test/bench/task-perf-spawnalot.rs | 25 +- .../compile-fail-fulldeps/gated-plugin.rs | 3 +- src/test/compile-fail-fulldeps/issue-18986.rs | 2 +- .../lint-group-plugin-deny-cmdline.rs | 4 +- .../lint-plugin-deny-attr.rs | 4 +- .../lint-plugin-deny-cmdline.rs | 4 +- .../lint-plugin-forbid-attrs.rs | 4 +- .../lint-plugin-forbid-cmdline.rs | 4 +- .../macro-crate-cannot-read-embedded-ident.rs | 5 +- .../macro-crate-doesnt-resolve.rs | 1 - .../compile-fail-fulldeps/macro-crate-rlib.rs | 4 +- .../macro-crate-unexported-macro.rs | 1 - .../plugin-MacroRulesTT.rs | 5 +- .../plugin-as-extern-crate.rs} | 24 +- .../plugin-plus-extern-crate.rs | 27 + src/test/compile-fail/array-not-vector.rs | 16 +- src/test/compile-fail/array-old-syntax-2.rs | 2 +- src/test/compile-fail/asm-gated2.rs | 15 + src/test/compile-fail/asm-in-bad-modifier.rs | 4 +- src/test/compile-fail/asm-misplaced-option.rs | 4 +- src/test/compile-fail/asm-out-assign-imm.rs | 3 +- src/test/compile-fail/asm-out-no-modifier.rs | 2 +- src/test/compile-fail/assign-to-method.rs | 6 +- src/test/compile-fail/assoc-inherent.rs | 2 +- ...ociated-type-projection-from-supertrait.rs | 4 +- ...ed-types-ICE-when-projecting-out-of-err.rs | 11 +- .../associated-types-coherence-failure.rs | 3 +- .../compile-fail/associated-types-eq-3.rs | 19 +- .../associated-types-eq-expr-path.rs | 2 +- .../associated-types-incomplete-object.rs | 8 +- .../associated-types-issue-17359.rs | 2 +- ...sociated-types-multiple-types-one-trait.rs | 2 +- ...associated-types-no-suitable-supertrait.rs | 2 +- .../compile-fail/associated-types-path-2.rs | 24 +- .../associated-types-subtyping-1.rs | 55 + .../associated-types-unconstrained.rs | 2 +- src/test/compile-fail/bad-bang-ann-3.rs | 4 +- src/test/compile-fail/bad-bang-ann.rs | 4 +- src/test/compile-fail/bad-const-type.rs | 9 +- .../compile-fail/bad-method-typaram-kind.rs | 2 +- .../compile-fail/bad-mid-path-type-params.rs | 6 - src/test/compile-fail/bad-sized.rs | 2 +- src/test/compile-fail/bang-tailexpr.rs | 2 +- src/test/compile-fail/binop-logic-int.rs | 4 +- .../blind-item-block-item-shadow.rs | 20 + .../compile-fail/blind-item-block-middle.rs | 18 + .../compile-fail/blind-item-item-shadow.rs | 15 + .../compile-fail/blind-item-local-shadow.rs | 20 + .../block-must-not-have-result-do.rs | 8 +- .../block-must-not-have-result-res.rs | 8 +- .../block-must-not-have-result-while.rs | 8 +- .../borrow-immutable-upvar-mutation.rs | 30 +- src/test/compile-fail/borrow-tuple-fields.rs | 12 +- .../borrowck-anon-fields-tuple.rs | 4 +- .../compile-fail/borrowck-assign-comp-idx.rs | 4 +- .../borrowck-borrow-from-owned-ptr.rs | 6 +- .../borrowck-borrow-from-stack-variable.rs | 6 +- ...rrowck-borrow-overloaded-auto-deref-mut.rs | 8 +- .../borrowck-borrow-overloaded-auto-deref.rs | 8 +- .../borrowck-borrow-overloaded-deref-mut.rs | 6 +- .../borrowck-borrow-overloaded-deref.rs | 6 +- .../borrowck-borrowed-uniq-rvalue-2.rs | 2 +- .../borrowck-borrowed-uniq-rvalue.rs | 3 +- .../compile-fail/borrowck-break-uninit-2.rs | 4 +- .../borrowck-call-is-borrow-issue-12224.rs | 12 +- .../borrowck-closures-mut-and-imm.rs | 36 +- .../borrowck-closures-mut-of-imm.rs | 4 +- .../compile-fail/borrowck-closures-two-mut.rs | 30 +- .../borrowck-closures-unique-imm.rs | 2 +- .../compile-fail/borrowck-closures-unique.rs | 18 +- .../borrowck-closures-use-after-free.rs | 2 +- ...rrowck-for-loop-correct-cmt-for-pattern.rs | 6 +- .../borrowck-for-loop-head-linkage.rs | 6 +- src/test/compile-fail/borrowck-if-no-else.rs | 2 +- .../compile-fail/borrowck-if-with-else.rs | 2 +- ...k-imm-ref-to-mut-rec-field-issue-3162-c.rs | 2 +- .../borrowck-init-in-called-fn-expr.rs | 2 +- .../compile-fail/borrowck-init-in-fn-expr.rs | 2 +- .../borrowck-insert-during-each.rs | 2 +- .../compile-fail/borrowck-issue-2657-1.rs | 2 +- .../compile-fail/borrowck-issue-2657-2.rs | 2 +- .../compile-fail/borrowck-lend-flow-loop.rs | 2 +- .../compile-fail/borrowck-lend-flow-match.rs | 6 +- .../borrowck-let-suggestion-suffixes.rs | 57 + .../compile-fail/borrowck-let-suggestion.rs | 4 +- .../borrowck-loan-blocks-move-cc.rs | 10 +- .../borrowck-loan-in-overloaded-op.rs | 1 + .../borrowck-match-binding-is-assignment.rs | 6 +- .../compile-fail/borrowck-move-by-capture.rs | 11 +- ...owck-move-from-subpath-of-borrowed-path.rs | 2 +- ...rowck-move-out-of-overloaded-auto-deref.rs | 2 +- .../borrowck-move-out-of-vec-tail.rs | 4 +- .../borrowck-multiple-captures.rs | 22 +- .../borrowck-mut-slice-of-imm-vec.rs | 2 +- .../compile-fail/borrowck-overloaded-call.rs | 12 +- .../borrowck-overloaded-index-2.rs | 2 +- .../borrowck-overloaded-index-autoderef.rs | 6 +- .../compile-fail/borrowck-overloaded-index.rs | 6 +- .../compile-fail/borrowck-partial-reinit-1.rs | 49 + .../compile-fail/borrowck-partial-reinit-2.rs | 34 + .../compile-fail/borrowck-partial-reinit-3.rs | 22 + .../compile-fail/borrowck-partial-reinit-4.rs | 33 + .../borrowck-report-with-custom-diagnostic.rs | 8 +- .../compile-fail/borrowck-uniq-via-lend.rs | 14 +- .../borrowck-use-in-index-lvalue.rs | 4 +- .../compile-fail/borrowck-use-mut-borrow.rs | 3 +- .../borrowck-vec-pattern-element-loan.rs | 6 +- .../borrowck-vec-pattern-loan-from-mut.rs | 2 +- .../borrowck-vec-pattern-move-tail.rs | 6 +- .../borrowck-vec-pattern-nesting.rs | 19 +- .../borrowck-vec-pattern-tail-element-loan.rs | 2 +- src/test/compile-fail/borrowck-while-break.rs | 2 +- src/test/compile-fail/borrowck-while.rs | 2 +- .../builtin-superkinds-self-type.rs | 4 +- .../compile-fail/builtin-superkinds-simple.rs | 4 +- .../cannot-mutate-captured-non-mut-var.rs | 12 +- src/test/compile-fail/cast-from-nil.rs | 2 +- src/test/compile-fail/cast-to-nil.rs | 2 +- src/test/compile-fail/cfg-attr-cfg-2.rs | 18 + src/test/compile-fail/cfg-attr-crate-2.rs | 17 + .../check-static-immutable-mut-slices.rs | 2 +- .../check-static-values-constraints.rs | 15 +- src/test/compile-fail/class-method-missing.rs | 2 +- src/test/compile-fail/class-missing-self.rs | 2 +- src/test/compile-fail/closure-reform-bad.rs | 2 +- src/test/compile-fail/coerce-mut.rs | 20 + .../coerce-overloaded-autoderef.rs | 40 + src/test/compile-fail/coercion-slice.rs | 7 +- src/test/compile-fail/coherence-all-remote.rs | 2 +- .../compile-fail/coherence-bigint-param.rs | 2 +- ...nket-conflicts-with-blanket-implemented.rs | 5 +- ...et-conflicts-with-blanket-unimplemented.rs | 4 +- ...herence-conflicting-negative-trait-impl.rs | 29 + .../compile-fail/coherence-cow-no-cover.rs | 23 + .../coherence-cross-crate-conflict.rs | 2 +- .../compile-fail/coherence-impls-builtin.rs | 42 + .../coherence-lone-type-parameter.rs | 3 +- .../coherence-negative-impls-safe.rs | 20 + src/test/compile-fail/coherence-orphan.rs | 8 +- .../coherence-overlapping-pairs.rs | 2 +- .../coherence-pair-covered-uncovered-1.rs | 24 + .../coherence-pair-covered-uncovered.rs | 2 +- src/test/compile-fail/coherence-subtyping.rs | 50 + src/test/compile-fail/concat_idents-gate.rs | 19 + src/test/compile-fail/concat_idents-gate2.rs | 17 + .../const-block-non-item-statement.rs | 8 +- .../const-cast-different-types.rs | 12 +- src/test/compile-fail/copy-a-resource.rs | 2 +- src/test/compile-fail/cross-borrow-trait.rs | 8 +- .../custom_attribute.rs} | 6 +- .../compile-fail/dead-code-closure-bang.rs | 2 +- .../derive-no-std-not-supported.rs | 38 + ...ugin-attr.rs => deriving-is-deprecated.rs} | 6 +- src/test/compile-fail/deriving-non-type.rs | 4 +- .../deriving-span-Show-enum-struct-variant.rs | 2 +- .../compile-fail/deriving-span-Show-enum.rs | 2 +- .../compile-fail/deriving-span-Show-struct.rs | 2 +- .../deriving-span-Show-tuple-struct.rs | 2 +- .../compile-fail/destructor-restrictions.rs | 21 + .../compile-fail/destructure-trait-ref.rs | 36 +- .../drop-with-active-borrows-1.rs | 4 +- .../drop-with-active-borrows-2.rs | 2 +- .../compile-fail/dropck_arr_cycle_checked.rs | 115 + .../dropck_direct_cycle_with_drop.rs | 55 + .../dropck_tarena_cycle_checked.rs | 130 + .../dropck_tarena_unsound_drop.rs | 54 + .../compile-fail/dropck_vec_cycle_checked.rs | 122 + src/test/compile-fail/dst-bad-assign.rs | 9 +- src/test/compile-fail/dst-bad-coerce1.rs | 8 +- src/test/compile-fail/dst-bad-coerce2.rs | 2 +- src/test/compile-fail/dst-bad-coerce3.rs | 2 +- src/test/compile-fail/dst-bad-coerce4.rs | 6 +- src/test/compile-fail/dst-bad-coercions.rs | 4 +- src/test/compile-fail/dst-bad-deep.rs | 2 +- src/test/compile-fail/dst-index.rs | 12 +- .../dst-object-from-unsized-type.rs | 2 +- .../enable-unstable-lib-feature.rs | 23 + src/test/compile-fail/estr-subtyping.rs | 4 +- .../compile-fail/exclusive-drop-and-copy.rs | 2 +- .../explicit-self-lifetime-mismatch.rs | 10 +- .../compile-fail/extern-with-type-bounds.rs | 4 +- .../compile-fail/extern-wrong-value-type.rs | 4 +- .../compile-fail/fail-no-dead-code-core.rs | 1 + .../feature-gate-advanced-slice-features.rs | 2 +- .../compile-fail/feature-gate-box-expr.rs | 6 +- src/test/compile-fail/feature-gate-box-pat.rs | 2 +- .../compile-fail/feature-gate-int-uint.rs | 14 +- src/test/compile-fail/feature-gate-main.rs | 12 + .../compile-fail/feature-gate-simd-ffi.rs | 26 + src/test/compile-fail/feature-gate-start.rs | 13 + ...ture-gate-unboxed-closures-manual-impls.rs | 26 +- ...ture-gate-unboxed-closures-method-calls.rs | 2 +- ...eature-gate-unboxed-closures-ufcs-calls.rs | 2 +- src/test/compile-fail/fn-item-type.rs | 12 +- src/test/compile-fail/fn-trait-formatting.rs | 29 +- src/test/compile-fail/for-loop-bogosity.rs | 5 +- ...obsolete-syntax.rs => for-loop-hygiene.rs} | 16 +- ...or-loop-refutable-pattern-error-message.rs | 5 +- .../fully-qualified-type-name1.rs | 6 +- .../fully-qualified-type-name2.rs | 6 +- .../fully-qualified-type-name4.rs | 6 +- ...nctional-struct-update-respects-privacy.rs | 42 + src/test/compile-fail/gated-bad-feature.rs | 1 - src/test/compile-fail/gated-no-std.rs | 13 + .../generic-impl-less-params-with-defaults.rs | 7 +- .../generic-impl-more-params-with-defaults.rs | 7 +- .../generic-lifetime-trait-impl.rs | 5 +- .../generic-type-less-params-with-defaults.rs | 5 +- .../generic-type-more-params-with-defaults.rs | 5 +- .../generic-type-params-name-repr.rs | 44 +- .../hashmap-iter-value-lifetime.rs | 2 +- src/test/compile-fail/hashmap-lifetimes.rs | 2 +- .../hrtb-precedence-of-plus-error-message.rs | 6 +- src/test/compile-fail/huge-enum.rs | 4 +- src/test/compile-fail/hygienic-label-3.rs | 2 +- src/test/compile-fail/hygienic-label-4.rs | 2 +- src/test/compile-fail/if-branch-types.rs | 8 +- src/test/compile-fail/if-let.rs | 14 +- .../compile-fail/if-without-else-result.rs | 6 +- .../compile-fail/immut-function-arguments.rs | 2 +- src/test/compile-fail/implicit-method-bind.rs | 2 +- src/test/compile-fail/import-glob-circular.rs | 4 +- src/test/compile-fail/index-bot.rs | 2 +- .../compile-fail/infinite-instantiation.rs | 6 +- .../integer-literal-suffix-inference.rs | 252 +- src/test/compile-fail/integral-indexing.rs | 14 +- .../integral-variable-unification-error.rs | 6 +- src/test/compile-fail/issue-10176.rs | 6 +- src/test/compile-fail/issue-10398.rs | 4 +- src/test/compile-fail/issue-10991.rs | 2 +- src/test/compile-fail/issue-11192.rs | 2 +- src/test/compile-fail/issue-11319.rs | 6 +- src/test/compile-fail/issue-11374.rs | 8 +- src/test/compile-fail/issue-11493.rs | 4 +- src/test/compile-fail/issue-11515.rs | 2 +- src/test/compile-fail/issue-11714.rs | 4 +- src/test/compile-fail/issue-11771.rs | 12 +- src/test/compile-fail/issue-11873.rs | 4 +- src/test/compile-fail/issue-11925.rs | 8 +- src/test/compile-fail/issue-12028.rs | 2 +- src/test/compile-fail/issue-12041.rs | 6 +- src/test/compile-fail/issue-12116.rs | 1 + src/test/compile-fail/issue-12127.rs | 7 +- src/test/compile-fail/issue-12369.rs | 2 +- src/test/compile-fail/issue-12997-2.rs | 6 +- src/test/compile-fail/issue-13058.rs | 8 +- src/test/compile-fail/issue-13359.rs | 12 +- src/test/compile-fail/issue-13466.rs | 17 +- src/test/compile-fail/issue-13482-2.rs | 7 +- src/test/compile-fail/issue-13482.rs | 6 +- src/test/compile-fail/issue-13497-2.rs | 2 +- src/test/compile-fail/issue-13497.rs | 2 +- src/test/compile-fail/issue-1362.rs | 2 +- src/test/compile-fail/issue-13624.rs | 13 +- src/test/compile-fail/issue-13853-2.rs | 4 +- src/test/compile-fail/issue-13853-3.rs | 5 +- src/test/compile-fail/issue-13853.rs | 6 +- src/test/compile-fail/issue-14091.rs | 6 +- src/test/compile-fail/issue-14285.rs | 4 +- src/test/compile-fail/issue-1448-2.rs | 4 +- src/test/compile-fail/issue-14541.rs | 7 +- src/test/compile-fail/issue-14845.rs | 12 +- src/test/compile-fail/issue-14853.rs | 10 +- src/test/compile-fail/issue-15094.rs | 12 +- src/test/compile-fail/issue-15167.rs | 2 +- src/test/compile-fail/issue-15381.rs | 2 +- src/test/compile-fail/issue-15480.rs | 4 +- src/test/compile-fail/issue-15783.rs | 9 +- src/test/compile-fail/issue-15896.rs | 7 +- src/test/compile-fail/issue-16338.rs | 7 +- src/test/compile-fail/issue-16401.rs | 7 +- src/test/compile-fail/issue-16538.rs | 3 +- src/test/compile-fail/issue-16747.rs | 4 +- src/test/compile-fail/issue-16939.rs | 2 +- src/test/compile-fail/issue-17033.rs | 6 +- src/test/compile-fail/issue-17283.rs | 20 +- src/test/compile-fail/issue-17337.rs | 4 +- src/test/compile-fail/issue-17385.rs | 4 +- src/test/compile-fail/issue-17405.rs | 2 +- src/test/compile-fail/issue-17431-4.rs | 4 +- src/test/compile-fail/issue-17431-5.rs | 4 +- src/test/compile-fail/issue-17441.rs | 8 +- src/test/compile-fail/issue-17458.rs | 2 +- src/test/compile-fail/issue-17545.rs | 2 +- src/test/compile-fail/issue-17551.rs | 8 +- src/test/compile-fail/issue-17651.rs | 2 +- .../issue-17718-const-bad-values.rs | 4 +- .../compile-fail/issue-17718-const-naming.rs | 2 +- src/test/compile-fail/issue-17718-patterns.rs | 2 +- .../compile-fail/issue-17718-static-sync.rs | 9 +- src/test/compile-fail/issue-17728.rs | 8 +- src/test/compile-fail/issue-17740.rs | 10 +- src/test/compile-fail/issue-17800.rs | 4 +- ...ing-span-Rand-enum.rs => issue-17904-2.rs} | 15 +- src/test/compile-fail/issue-17905.rs | 9 +- src/test/compile-fail/issue-17913.rs | 16 +- src/test/compile-fail/issue-17933.rs | 4 +- src/test/compile-fail/issue-17999.rs | 2 +- src/test/compile-fail/issue-18107.rs | 6 +- src/test/compile-fail/issue-18118.rs | 5 +- src/test/compile-fail/issue-18252.rs | 2 +- src/test/compile-fail/issue-18389.rs | 2 +- src/test/compile-fail/issue-18400.rs | 7 +- src/test/compile-fail/issue-18566.rs | 2 +- src/test/compile-fail/issue-18611.rs | 4 +- src/test/compile-fail/issue-18783.rs | 5 +- src/test/compile-fail/issue-18819.rs | 4 +- src/test/compile-fail/issue-18959.rs | 2 +- src/test/compile-fail/issue-1962.rs | 6 +- src/test/compile-fail/issue-19660.rs | 26 + src/test/compile-fail/issue-19991.rs | 6 +- src/test/compile-fail/issue-20427.rs | 66 + src/test/compile-fail/issue-20605.rs | 19 + src/test/compile-fail/issue-2063.rs | 3 +- src/test/compile-fail/issue-20801.rs | 47 + src/test/compile-fail/issue-20831-debruijn.rs | 50 + src/test/compile-fail/issue-21045.rs | 16 + src/test/compile-fail/issue-21146.rs | 13 + src/test/compile-fail/issue-21160.rs | 21 + src/test/compile-fail/issue-21202.rs | 25 + src/test/compile-fail/issue-21356.rs | 14 + src/test/compile-fail/issue-2149.rs | 6 +- src/test/compile-fail/issue-2150.rs | 2 +- src/test/compile-fail/issue-21554.rs | 15 + src/test/compile-fail/issue-21600.rs | 27 + src/test/compile-fail/issue-21763.rs | 21 + .../compile-fail/issue-21974.rs} | 26 +- src/test/compile-fail/issue-2611-4.rs | 5 +- src/test/compile-fail/issue-2951.rs | 7 +- src/test/compile-fail/issue-3008-3.rs | 4 +- src/test/compile-fail/issue-3044.rs | 2 +- src/test/compile-fail/issue-3477.rs | 7 +- src/test/compile-fail/issue-3521.rs | 2 +- src/test/compile-fail/issue-3563.rs | 9 +- src/test/compile-fail/issue-3601.rs | 1 + src/test/compile-fail/issue-3680.rs | 7 +- src/test/compile-fail/issue-3707.rs | 4 +- src/test/compile-fail/issue-4201.rs | 6 +- src/test/compile-fail/issue-4335.rs | 4 +- src/test/compile-fail/issue-4517.rs | 9 +- src/test/compile-fail/issue-4968.rs | 7 +- src/test/compile-fail/issue-4972.rs | 5 +- src/test/compile-fail/issue-5035-2.rs | 4 +- src/test/compile-fail/issue-5100.rs | 39 +- src/test/compile-fail/issue-5216.rs | 8 +- src/test/compile-fail/issue-5239-1.rs | 2 +- src/test/compile-fail/issue-5358-1.rs | 7 +- src/test/compile-fail/issue-5500.rs | 6 +- src/test/compile-fail/issue-5543.rs | 2 +- src/test/compile-fail/issue-5883.rs | 6 +- src/test/compile-fail/issue-6458.rs | 6 +- src/test/compile-fail/issue-6801.rs | 2 +- src/test/compile-fail/issue-6936.rs | 44 + src/test/compile-fail/issue-7013.rs | 1 - src/test/compile-fail/issue-7061.rs | 6 +- src/test/compile-fail/issue-7092.rs | 6 +- src/test/compile-fail/issue-7364.rs | 9 +- src/test/compile-fail/issue-7573.rs | 6 +- src/test/compile-fail/issue-7575.rs | 14 +- src/test/compile-fail/issue-7867.rs | 25 +- src/test/compile-fail/issue-8460-const.rs | 55 + src/test/compile-fail/issue-8727.rs | 10 +- src/test/compile-fail/issue-8761.rs | 12 +- src/test/compile-fail/issue-9243.rs | 2 +- src/test/compile-fail/issue-9575.rs | 2 + src/test/compile-fail/kindck-copy.rs | 7 +- .../compile-fail/kindck-impl-type-params-2.rs | 6 +- .../compile-fail/kindck-impl-type-params.rs | 22 +- .../kindck-inherited-copy-bound.rs | 5 +- src/test/compile-fail/kindck-nonsendable-1.rs | 3 +- src/test/compile-fail/kindck-send-object.rs | 8 +- src/test/compile-fail/kindck-send-object1.rs | 14 +- src/test/compile-fail/kindck-send-object2.rs | 8 +- src/test/compile-fail/kindck-send-owned.rs | 4 +- .../kindck-send-region-pointers.rs | 34 - src/test/compile-fail/lang-item-missing.rs | 1 + ...me-inference-give-expl-lifetime-param-3.rs | 4 +- ...time-inference-give-expl-lifetime-param.rs | 4 +- src/test/compile-fail/linkage1.rs | 1 + src/test/compile-fail/linkage4.rs | 2 +- src/test/compile-fail/lint-ctypes.rs | 1 + src/test/compile-fail/lint-dead-code-1.rs | 5 +- src/test/compile-fail/lint-dead-code-2.rs | 1 + src/test/compile-fail/lint-dead-code-3.rs | 3 +- src/test/compile-fail/lint-dead-code-4.rs | 4 +- .../compile-fail/lint-exceeding-bitshifts.rs | 5 +- src/test/compile-fail/lint-forbid-attr.rs | 4 +- src/test/compile-fail/lint-forbid-cmdline.rs | 5 +- src/test/compile-fail/lint-group-style.rs | 2 +- src/test/compile-fail/lint-missing-doc.rs | 21 +- .../compile-fail/lint-non-camel-case-types.rs | 1 + .../lint-non-uppercase-statics.rs | 2 +- src/test/compile-fail/lint-obsolete-attr.rs | 3 +- src/test/compile-fail/lint-output-format.rs | 8 +- src/test/compile-fail/lint-stability.rs | 360 +- src/test/compile-fail/lint-stability2.rs | 23 + src/test/compile-fail/lint-stability3.rs | 25 + src/test/compile-fail/lint-type-limits.rs | 12 +- src/test/compile-fail/lint-type-overflow.rs | 41 +- .../lint-unconditional-recursion.rs | 66 + .../compile-fail/lint-unexported-no-mangle.rs | 40 + src/test/compile-fail/lint-unknown-attr.rs | 1 + ...end.rs => lint-unknown-feature-default.rs} | 11 +- src/test/compile-fail/lint-unknown-feature.rs | 4 +- .../compile-fail/lint-unnecessary-parens.rs | 12 +- .../compile-fail/lint-unused-extern-crate.rs | 4 + src/test/compile-fail/lint-unused-imports.rs | 6 +- .../compile-fail/lint-unused-mut-variables.rs | 42 +- .../compile-fail/lint-uppercase-variables.rs | 17 +- .../lint-visible-private-types.rs | 8 +- src/test/compile-fail/liveness-bad-bang-2.rs | 4 +- .../liveness-return-last-stmt-semi.rs | 8 +- src/test/compile-fail/liveness-unused.rs | 30 +- .../compile-fail/liveness-use-after-move.rs | 2 +- .../compile-fail/liveness-use-after-send.rs | 8 +- .../{reserved-be.rs => log-syntax-gate2.rs} | 3 +- .../compile-fail/loop-does-not-diverge.rs | 2 +- src/test/compile-fail/lub-if.rs | 8 +- src/test/compile-fail/lub-match.rs | 8 +- .../compile-fail/macro-inner-attributes.rs | 2 + .../macro-no-implicit-reexport.rs | 2 +- .../compile-fail/macro-outer-attributes.rs | 2 + .../macro-reexport-malformed-1.rs | 2 + .../macro-reexport-malformed-2.rs | 2 + .../macro-reexport-malformed-3.rs | 2 + .../macro-reexport-not-locally-visible.rs | 4 +- .../macro-reexport-undef.rs} | 14 +- .../{lint-renaming.rs => macro-use-undef.rs} | 11 +- .../compile-fail/macros-nonfatal-errors.rs | 1 - src/test/compile-fail/malformed-plugin-1.rs | 13 + src/test/compile-fail/malformed-plugin-2.rs | 13 + src/test/compile-fail/malformed-plugin-3.rs | 13 + src/test/compile-fail/map-types.rs | 5 +- src/test/compile-fail/match-ill-type1.rs | 2 +- src/test/compile-fail/match-ill-type2.rs | 8 +- src/test/compile-fail/match-non-exhaustive.rs | 4 +- .../compile-fail/match-range-fail-dominate.rs | 18 +- src/test/compile-fail/match-range-fail.rs | 8 +- .../compile-fail/match-static-const-lc.rs | 6 +- src/test/compile-fail/match-struct.rs | 7 +- src/test/compile-fail/match-vec-fixed.rs | 2 +- src/test/compile-fail/match-vec-mismatch-2.rs | 6 +- .../compile-fail/match-vec-unreachable.rs | 6 +- .../method-ambig-one-trait-coerce.rs | 50 - .../method-ambig-two-traits-cross-crate.rs | 2 +- ...od-ambig-two-traits-with-default-method.rs | 2 +- src/test/compile-fail/method-missing-call.rs | 2 +- src/test/compile-fail/method-self-arg-1.rs | 13 +- src/test/compile-fail/method-self-arg-2.rs | 5 +- .../method-suggestion-no-duplication.rs | 24 + src/test/compile-fail/missing-stability.rs | 33 + src/test/compile-fail/missing_debug_impls.rs | 48 + src/test/compile-fail/move-fragments-1.rs | 2 + src/test/compile-fail/move-fragments-2.rs | 2 + src/test/compile-fail/move-fragments-3.rs | 2 + src/test/compile-fail/move-fragments-4.rs | 2 + src/test/compile-fail/move-fragments-5.rs | 2 + src/test/compile-fail/move-fragments-6.rs | 2 + src/test/compile-fail/move-fragments-7.rs | 2 + src/test/compile-fail/move-fragments-8.rs | 2 + src/test/compile-fail/move-fragments-9.rs | 55 +- .../compile-fail/move-into-dead-array-1.rs | 25 + .../compile-fail/move-into-dead-array-2.rs | 25 + src/test/compile-fail/move-out-of-array-1.rs | 28 + .../compile-fail/move-out-of-tuple-field.rs | 4 +- .../moves-based-on-type-block-bad.rs | 1 + .../moves-based-on-type-capture-clause-bad.rs | 4 +- .../compile-fail/moves-based-on-type-exprs.rs | 14 +- ...type-move-out-of-closure-env-issue-1965.rs | 6 +- src/test/compile-fail/multiple-main-2.rs | 2 + src/test/compile-fail/multiple-main-3.rs | 2 + src/test/compile-fail/mut-cant-alias.rs | 2 +- src/test/compile-fail/mut-cross-borrowing.rs | 2 +- src/test/compile-fail/mut-not-freeze.rs | 2 +- .../mut-pattern-internal-mutability.rs | 2 +- .../compile-fail/mut-pattern-mismatched.rs | 14 +- .../compile-fail/mut-ptr-cant-outlive-ref.rs | 2 +- .../compile-fail/mutable-class-fields-2.rs | 2 +- src/test/compile-fail/mutable-class-fields.rs | 2 +- .../compile-fail/mutable-enum-indirect.rs | 11 +- src/test/compile-fail/no-capture-arc.rs | 6 +- .../no-method-suggested-traits.rs | 134 + src/test/compile-fail/no-reuse-move-arc.rs | 6 +- src/test/compile-fail/no-send-res-ports.rs | 9 +- src/test/compile-fail/no-type-for-node-ice.rs | 15 + src/test/compile-fail/no_send-enum.rs | 11 +- src/test/compile-fail/no_send-rc.rs | 3 +- src/test/compile-fail/no_send-struct.rs | 9 +- src/test/compile-fail/no_share-enum.rs | 11 +- src/test/compile-fail/no_share-rc.rs | 3 +- src/test/compile-fail/no_share-struct.rs | 9 +- src/test/compile-fail/noexporttypeexe.rs | 6 +- src/test/compile-fail/non-exhaustive-match.rs | 18 +- .../non-exhaustive-pattern-witness.rs | 2 +- src/test/compile-fail/noncopyable-class.rs | 4 +- src/test/compile-fail/nonscalar-cast.rs | 2 +- .../object-does-not-impl-trait.rs | 3 +- .../object-lifetime-default-ambiguous.rs | 61 + .../object-lifetime-default-elision.rs | 89 + .../object-lifetime-default-from-box-error.rs | 45 + .../object-lifetime-default-mybox.rs | 43 + .../compile-fail/object-lifetime-default.rs | 34 + .../compile-fail/object-safety-issue-22040.rs | 50 + .../compile-fail/object-safety-no-static.rs | 2 +- .../compile-fail/object-safety-phantom-fn.rs | 34 + .../object-safety-supertrait-mentions-Self.rs | 32 + src/test/compile-fail/obsolete-tilde.rs | 21 - .../obsolete-tuple-struct-deref.rs | 15 - src/test/compile-fail/occurs-check-2.rs | 6 +- src/test/compile-fail/occurs-check.rs | 6 +- .../compile-fail/on-unimplemented-bad-anno.rs | 47 + src/test/compile-fail/on-unimplemented.rs | 42 + src/test/compile-fail/or-patter-mismatch.rs | 2 +- .../compile-fail/orphan-check-diagnostics.rs | 23 + src/test/compile-fail/overloaded-calls-bad.rs | 4 +- .../compile-fail/overloaded-calls-nontuple.rs | 3 +- .../packed-struct-generic-transmute.rs | 2 +- .../compile-fail/packed-struct-transmute.rs | 2 +- .../compile-fail/pattern-bindings-after-at.rs | 2 +- .../compile-fail/pattern-error-continue.rs | 13 +- .../plugin-extern-crate-attr-deprecated.rs | 15 + src/test/compile-fail/pptypedef.rs | 16 +- .../compile-fail/priv-in-bad-locations.rs | 4 +- src/test/compile-fail/privacy-ns2.rs | 8 +- src/test/compile-fail/privacy1.rs | 10 +- src/test/compile-fail/privacy2.rs | 1 + src/test/compile-fail/privacy3.rs | 1 + src/test/compile-fail/privacy4.rs | 10 +- src/test/compile-fail/private-method.rs | 2 +- .../private-struct-field-cross-crate.rs | 4 +- src/test/compile-fail/ptr-coercion.rs | 17 +- src/test/compile-fail/pub-item-macro.rs | 28 + src/test/compile-fail/pub-method-macro.rs | 34 + src/test/compile-fail/range-1.rs | 8 +- src/test/compile-fail/range-2.rs | 2 +- src/test/compile-fail/recursion.rs | 2 +- .../compile-fail/refutable-pattern-errors.rs | 2 +- .../refutable-pattern-in-fn-arg.rs | 2 +- .../region-bound-on-closure-outlives-call.rs | 2 +- ...n-bounds-on-objects-and-type-parameters.rs | 2 +- .../compile-fail/region-object-lifetime-1.rs | 30 +- .../compile-fail/region-object-lifetime-2.rs | 24 + .../compile-fail/region-object-lifetime-3.rs | 29 + .../compile-fail/region-object-lifetime-4.rs | 26 + .../compile-fail/region-object-lifetime-5.rs | 25 + .../region-object-lifetime-in-coercion.rs | 12 +- .../regionck-unboxed-closure-lifetimes.rs | 2 +- src/test/compile-fail/regions-addr-of-self.rs | 6 +- .../regions-addr-of-upvar-self.rs | 4 +- ...c-type-in-supertrait-outlives-container.rs | 56 + ...ions-assoc-type-outlives-container-hrtb.rs | 70 + ...egions-assoc-type-outlives-container-wc.rs | 50 + .../regions-assoc-type-outlives-container.rs | 89 + ...ssoc-type-region-bound-in-trait-not-met.rs | 34 + ...ssoc-type-static-bound-in-trait-not-met.rs | 29 + .../regions-bound-missing-bound-in-impl.rs | 13 +- .../compile-fail/regions-bounded-by-send.rs | 83 - ...gions-bounded-by-trait-requiring-static.rs | 12 +- ...nded-method-type-parameters-trait-bound.rs | 6 - .../regions-bounded-method-type-parameters.rs | 2 +- src/test/compile-fail/regions-bounds.rs | 10 +- ...gions-close-associated-type-into-object.rs | 4 +- .../regions-close-object-into-object-1.rs | 28 + .../regions-close-object-into-object-2.rs | 25 + .../regions-close-object-into-object-3.rs | 27 + .../regions-close-object-into-object-4.rs | 26 + ... => regions-close-object-into-object-5.rs} | 24 +- .../regions-close-over-borrowed-ref-in-obj.rs | 4 +- .../regions-close-over-type-parameter-2.rs | 2 +- .../regions-close-param-into-object.rs | 2 +- .../compile-fail/regions-creating-enums.rs | 4 +- .../regions-early-bound-error-method.rs | 8 +- .../compile-fail/regions-early-bound-error.rs | 7 +- .../regions-escape-loop-via-variable.rs | 4 +- .../regions-escape-loop-via-vec.rs | 2 +- .../regions-escape-unboxed-closure.rs | 2 +- .../regions-fn-subtyping-return-static.rs | 7 +- .../compile-fail/regions-glb-free-free.rs | 2 +- ...egions-infer-contravariance-due-to-decl.rs | 2 +- .../regions-infer-covariance-due-to-decl.rs | 2 +- .../regions-infer-invariance-due-to-decl.rs | 10 +- ...ns-infer-invariance-due-to-mutability-3.rs | 8 +- ...ns-infer-invariance-due-to-mutability-4.rs | 10 +- .../compile-fail/regions-infer-not-param.rs | 5 + .../regions-infer-paramd-indirect.rs | 5 +- .../regions-infer-proc-static-upvar.rs | 2 +- .../regions-pattern-typing-issue-19552.rs | 6 +- .../compile-fail/regions-ref-in-fn-arg.rs | 1 + ...regions-return-ref-to-upvar-issue-17403.rs | 4 +- .../compile-fail/regions-steal-closure.rs | 2 +- .../compile-fail/regions-struct-not-wf.rs | 1 + src/test/compile-fail/regions-trait-1.rs | 4 +- .../regions-var-type-out-of-scope.rs | 4 +- src/test/compile-fail/repeat_count.rs | 53 +- src/test/compile-fail/required-lang-item.rs | 8 +- src/test/compile-fail/reserved-become.rs | 14 + src/test/compile-fail/rustc-error.rs | 16 + src/test/compile-fail/self_type_keyword.rs | 49 + ... => send-is-not-static-ensures-scoping.rs} | 22 +- src/test/compile-fail/seq-args.rs | 2 +- src/test/compile-fail/shadowed-lifetime.rs | 10 +- .../compile-fail/shadowed-type-parameter.rs | 6 +- .../compile-fail/shift-various-bad-types.rs | 8 +- src/test/compile-fail/simd-binop.rs | 1 - src/test/compile-fail/slice-1.rs | 7 +- src/test/compile-fail/slice-2.rs | 2 +- src/test/compile-fail/slice-mut.rs | 7 +- .../slightly-nice-generic-literal-messages.rs | 12 +- .../stability-attribute-sanity.rs | 95 + src/test/compile-fail/stable-features.rs | 20 + src/test/compile-fail/staged_api.rs | 13 + src/test/compile-fail/static-assert2.rs | 2 +- .../compile-fail/static-mut-not-constant.rs | 2 +- src/test/compile-fail/static-mut-not-pat.rs | 2 +- src/test/compile-fail/static-region-bound.rs | 4 +- .../static-vec-repeat-not-constant.rs | 2 +- src/test/compile-fail/staticness-mismatch.rs | 2 +- .../compile-fail/std-uncopyable-atomics.rs | 4 +- .../compile-fail/struct-base-wrong-type.rs | 24 +- .../struct-fields-hints-no-dupe.rs | 24 + src/test/compile-fail/struct-fields-hints.rs | 23 + src/test/compile-fail/struct-fields-typo.rs | 24 + .../structure-constructor-type-mismatch.rs | 41 +- src/test/compile-fail/suppressed-error.rs | 6 +- .../tag-that-dare-not-speak-its-name.rs | 6 +- src/test/compile-fail/tail-typeck.rs | 2 +- .../compile-fail/task-rng-isnt-sendable.rs | 1 - src/test/compile-fail/terr-in-field.rs | 6 +- src/test/compile-fail/terr-sorts.rs | 6 +- src/test/compile-fail/trace_macros-gate.rs | 30 + src/test/compile-fail/trace_macros-gate2.rs | 20 + src/test/compile-fail/trace_macros-gate3.rs | 20 + .../trait-as-struct-constructor.rs | 2 +- .../compile-fail/trait-bounds-cant-coerce.rs | 7 +- .../trait-bounds-impl-comparison-1.rs | 29 +- .../trait-bounds-impl-comparison-2.rs | 6 +- .../trait-bounds-not-on-bare-trait.rs | 1 + ...rait-bounds-on-structs-and-enums-locals.rs | 6 +- ...rait-bounds-on-structs-and-enums-static.rs | 4 +- .../trait-bounds-on-structs-and-enums-xc1.rs | 2 +- .../trait-bounds-on-structs-and-enums.rs | 10 +- src/test/compile-fail/trait-bounds-sugar.rs | 6 +- .../trait-coercion-generic-regions.rs | 2 +- src/test/compile-fail/trait-impl-1.rs | 10 +- src/test/compile-fail/trait-object-safety.rs | 1 + .../trait-static-method-generic-inference.rs | 1 + src/test/compile-fail/trait-test-2.rs | 10 +- .../compile-fail/traits-multidispatch-bad.rs | 8 +- .../compile-fail/traits-negative-impls.rs | 58 + src/test/compile-fail/tuple-arity-mismatch.rs | 12 +- .../compile-fail/tuple-index-out-of-bounds.rs | 8 +- .../tutorial-suffix-inference-test.rs | 20 +- .../compile-fail/type-mismatch-multiple.rs | 14 +- ...rameter-defaults-referencing-Self-ppaux.rs | 26 + ...ype-parameter-defaults-referencing-Self.rs | 23 + src/test/compile-fail/type-parameter-names.rs | 6 +- .../type-params-in-different-spaces-1.rs | 6 +- .../typeck-cast-pointer-to-float.rs | 2 +- ...ct.rs => typeck-negative-impls-builtin.rs} | 15 +- .../typeck-unsafe-always-share.rs | 20 +- .../typeck_type_placeholder_item.rs | 4 +- .../typeck_type_placeholder_lifetime_1.rs | 2 +- .../typeck_type_placeholder_mismatch.rs | 22 +- .../compile-fail/ufcs-explicit-self-bad.rs | 11 +- ...e-9957.rs => ufcs-qpath-missing-params.rs} | 5 +- .../compile-fail/ufcs-qpath-self-mismatch.rs | 21 + .../unboxed-closer-non-implicit-copyable.rs | 4 +- .../unboxed-closure-feature-gate.rs | 7 +- .../unboxed-closure-illegal-move.rs | 28 +- .../unboxed-closure-immutable-capture.rs | 18 +- .../compile-fail/unboxed-closure-region.rs | 4 +- .../unboxed-closure-sugar-default.rs | 13 +- .../unboxed-closure-sugar-equiv.rs | 34 +- .../unboxed-closure-sugar-lifetime-elision.rs | 13 +- .../unboxed-closure-sugar-not-used-on-fn.rs | 23 + .../unboxed-closure-sugar-region.rs | 14 +- .../unboxed-closure-sugar-used-on-struct-1.rs | 5 +- .../unboxed-closure-sugar-used-on-struct.rs | 5 +- ...r-wrong-number-number-type-parameters-1.rs | 2 +- ...r-wrong-number-number-type-parameters-3.rs | 4 +- ...gar-wrong-number-number-type-parameters.rs | 4 +- .../unboxed-closure-sugar-wrong-trait.rs | 3 +- .../unboxed-closures-borrow-conflict.rs | 4 +- .../unboxed-closures-failed-recursive-fn-1.rs | 33 + .../unboxed-closures-failed-recursive-fn-2.rs | 39 + .../unboxed-closures-fnmut-as-fn.rs | 8 +- ...nfer-argument-types-two-region-pointers.rs | 2 +- ...-closures-infer-explicit-call-too-early.rs | 18 + ...osures-infer-fnmut-calling-fnmut-no-mut.rs | 32 + ...nboxed-closures-infer-fnmut-missing-mut.rs | 18 + ...d-closures-infer-fnmut-move-missing-mut.rs | 18 + ...nboxed-closures-infer-fnonce-call-twice.rs | 21 + ...d-closures-infer-fnonce-move-call-twice.rs | 21 + ...es-move-upvar-from-non-once-ref-closure.rs | 24 + .../unboxed-closures-mutate-upvar.rs | 67 + ...-closures-mutated-upvar-from-fn-closure.rs | 24 + ...oxed-closures-recursive-fn-using-fn-mut.rs | 48 + ...nboxed-closures-static-call-wrong-trait.rs | 6 +- .../unboxed-closures-type-mismatch.rs | 4 +- .../unboxed-closures-unsafe-extern-fn.rs | 4 +- .../unboxed-closures-vtable-mismatch.rs | 10 +- .../unboxed-closures-wrong-abi.rs | 4 +- ...boxed-closures-wrong-arg-type-extern-fn.rs | 4 +- src/test/compile-fail/unique-pinned-nocopy.rs | 2 +- src/test/compile-fail/unique-unique-kind.rs | 5 +- src/test/compile-fail/unique-vec-res.rs | 4 +- src/test/compile-fail/unnecessary-private.rs | 7 +- src/test/compile-fail/unreachable-arm.rs | 3 +- src/test/compile-fail/unreachable-code.rs | 2 +- src/test/compile-fail/unsendable-class.rs | 1 - .../unsized-inherent-impl-self-type.rs | 2 +- .../unsized-trait-impl-self-type.rs | 3 +- .../unsized-trait-impl-trait-arg.rs | 3 +- src/test/compile-fail/unsized3.rs | 9 +- src/test/compile-fail/unsized6.rs | 7 +- src/test/compile-fail/unsized7.rs | 8 +- src/test/compile-fail/unsupported-cast.rs | 2 +- src/test/compile-fail/unused-attr.rs | 6 +- .../unused-mut-warning-captured-var.rs | 4 +- src/test/compile-fail/use-mod.rs | 3 - src/test/compile-fail/useless-priv.rs | 8 +- src/test/compile-fail/useless-priv2.rs | 6 +- src/test/compile-fail/variadic-ffi.rs | 16 +- .../compile-fail/variance-associated-types.rs | 32 + .../variance-contravariant-arg-object.rs | 31 + .../variance-contravariant-arg-trait-match.rs | 31 + ...variance-contravariant-self-trait-match.rs | 31 + .../variance-covariant-arg-object.rs | 31 + .../variance-covariant-arg-trait-match.rs | 31 + .../variance-covariant-self-trait-match.rs | 31 + .../variance-deprecated-markers.rs | 35 + .../variance-invariant-arg-object.rs | 31 + .../variance-invariant-arg-trait-match.rs | 31 + .../variance-invariant-self-trait-match.rs | 31 + src/test/compile-fail/variance-issue-20533.rs | 54 + .../compile-fail/variance-object-types.rs | 26 + .../compile-fail/variance-regions-direct.rs | 3 + .../compile-fail/variance-regions-indirect.rs | 6 + .../variance-regions-unused-direct.rs} | 17 +- .../variance-regions-unused-indirect.rs | 21 + .../compile-fail/variance-trait-bounds.rs | 65 + .../variance-trait-object-bound.rs | 4 +- .../compile-fail/variance-types-bounds.rs | 76 + src/test/compile-fail/variance-types.rs | 52 + .../variance-unused-region-param.rs | 17 + .../variance-unused-type-param.rs | 36 + .../variance-use-contravariant-struct-1.rs | 26 + .../variance-use-contravariant-struct-2.rs | 27 + .../variance-use-covariant-struct-1.rs | 23 + .../variance-use-covariant-struct-2.rs | 26 + .../variance-use-invariant-struct-1.rs | 33 + .../vec-must-not-hide-type-from-dropck.rs | 135 + src/test/compile-fail/vec-mut-iter-borrow.rs | 4 +- src/test/compile-fail/vec-res-add.rs | 2 +- .../vec_refs_data_with_early_death.rs | 31 + .../visible-private-types-generics.rs | 4 +- .../visible-private-types-supertrait.rs | 4 +- .../compile-fail/vtable-res-trait-param.rs | 4 +- src/test/compile-fail/warn-path-statement.rs | 4 +- src/test/compile-fail/weak-lang-item.rs | 1 + .../where-clause-method-substituion.rs | 4 +- .../where-clauses-not-parameter.rs | 6 +- src/test/compile-fail/where-for-self-2.rs | 33 + src/test/compile-fail/where-for-self.rs | 29 + src/test/compile-fail/while-let.rs | 6 +- .../wrong-mul-method-signature.rs | 16 +- src/test/debuginfo/associated-types.rs | 151 + .../debuginfo/basic-types-globals-metadata.rs | 33 +- src/test/debuginfo/basic-types-globals.rs | 32 +- src/test/debuginfo/basic-types-metadata.rs | 3 +- src/test/debuginfo/basic-types-mut-globals.rs | 1 - src/test/debuginfo/basic-types.rs | 1 - src/test/debuginfo/borrowed-basic.rs | 1 - src/test/debuginfo/borrowed-c-style-enum.rs | 1 - src/test/debuginfo/borrowed-enum.rs | 1 - src/test/debuginfo/borrowed-struct.rs | 1 - src/test/debuginfo/borrowed-tuple.rs | 1 - src/test/debuginfo/borrowed-unique-basic.rs | 1 - src/test/debuginfo/box.rs | 5 +- src/test/debuginfo/boxed-struct.rs | 1 - .../by-value-non-immediate-argument.rs | 1 - .../by-value-self-argument-in-trait-impl.rs | 1 - .../debuginfo/c-style-enum-in-composite.rs | 1 - src/test/debuginfo/c-style-enum.rs | 1 - .../debuginfo/closure-in-generic-function.rs | 7 +- .../debuginfo/constant-in-match-pattern.rs | 92 + .../debuginfo/cross-crate-type-uniquing.rs | 1 - .../debuginfo/destructured-fn-argument.rs | 2 +- .../destructured-for-loop-variable.rs | 10 +- src/test/debuginfo/destructured-local.rs | 18 +- src/test/debuginfo/evec-in-struct.rs | 1 - .../debuginfo/function-arg-initialization.rs | 13 +- src/test/debuginfo/function-arguments.rs | 1 - ...nction-prologue-stepping-no-stack-check.rs | 12 +- .../function-prologue-stepping-regular.rs | 4 +- ...gdb-pretty-struct-and-enums-pre-gdb-7-7.rs | 1 + .../debuginfo/gdb-pretty-struct-and-enums.rs | 3 +- src/test/debuginfo/generic-function.rs | 5 +- .../debuginfo/generic-functions-nested.rs | 5 +- .../generic-method-on-generic-struct.rs | 4 +- ...eneric-static-method-on-struct-and-enum.rs | 5 +- .../debuginfo/generic-struct-style-enum.rs | 3 +- src/test/debuginfo/generic-struct.rs | 17 +- .../debuginfo/generic-tuple-style-enum.rs | 1 - src/test/debuginfo/include_string.rs | 1 - src/test/debuginfo/issue11600.rs | 1 - src/test/debuginfo/issue12886.rs | 3 +- src/test/debuginfo/issue13213.rs | 3 +- src/test/debuginfo/issue14411.rs | 1 - src/test/debuginfo/issue7712.rs | 2 +- .../debuginfo/lexical-scope-in-for-loop.rs | 9 +- src/test/debuginfo/lexical-scope-in-if.rs | 15 +- src/test/debuginfo/lexical-scope-in-match.rs | 11 +- .../lexical-scope-in-parameterless-closure.rs | 7 +- .../lexical-scope-in-stack-closure.rs | 3 +- .../lexical-scope-in-unconditional-loop.rs | 5 +- .../lexical-scope-in-unique-closure.rs | 3 +- src/test/debuginfo/lexical-scope-in-while.rs | 5 +- .../debuginfo/lexical-scope-with-macro.rs | 11 +- .../lexical-scopes-in-block-expression.rs | 9 +- src/test/debuginfo/limited-debuginfo.rs | 11 +- src/test/debuginfo/method-on-enum.rs | 4 +- .../debuginfo/method-on-generic-struct.rs | 4 +- src/test/debuginfo/method-on-struct.rs | 4 +- src/test/debuginfo/method-on-trait.rs | 4 +- src/test/debuginfo/method-on-tuple-struct.rs | 4 +- src/test/debuginfo/multi-byte-chars.rs | 3 +- .../multiple-functions-equal-var-names.rs | 7 +- src/test/debuginfo/multiple-functions.rs | 7 +- .../name-shadowing-and-scope-nesting.rs | 7 +- src/test/debuginfo/nil-enum.rs | 1 - src/test/debuginfo/no-debug-attribute.rs | 3 +- src/test/debuginfo/option-like-enum.rs | 41 +- .../packed-struct-with-destructor.rs | 1 - src/test/debuginfo/packed-struct.rs | 1 - src/test/debuginfo/recursive-enum.rs | 1 - src/test/debuginfo/recursive-struct.rs | 1 - src/test/debuginfo/self-in-default-method.rs | 4 +- .../self-in-generic-default-method.rs | 4 +- src/test/debuginfo/shadowed-argument.rs | 5 +- src/test/debuginfo/shadowed-variable.rs | 5 +- src/test/debuginfo/simd.rs | 2 - src/test/debuginfo/simple-lexical-scope.rs | 3 +- src/test/debuginfo/simple-struct.rs | 1 - src/test/debuginfo/simple-tuple.rs | 1 - .../static-method-on-struct-and-enum.rs | 1 - src/test/debuginfo/struct-in-enum.rs | 1 - src/test/debuginfo/struct-in-struct.rs | 1 - src/test/debuginfo/struct-style-enum.rs | 1 - src/test/debuginfo/struct-with-destructor.rs | 1 - src/test/debuginfo/trait-pointers.rs | 1 - src/test/debuginfo/tuple-in-struct.rs | 1 - src/test/debuginfo/tuple-in-tuple.rs | 1 - src/test/debuginfo/tuple-struct.rs | 1 - src/test/debuginfo/tuple-style-enum.rs | 1 - src/test/debuginfo/type-names.rs | 63 +- src/test/debuginfo/unique-enum.rs | 1 - src/test/debuginfo/unreachable-locals.rs | 13 +- .../var-captured-in-nested-closure.rs | 5 +- .../var-captured-in-sendable-closure.rs | 7 +- .../var-captured-in-stack-closure.rs | 5 +- src/test/debuginfo/vec-slices.rs | 1 + src/test/debuginfo/vec.rs | 3 +- .../array-old-syntax-1.rs | 2 +- .../ascii-only-character-escape.rs | 0 ...ciated-types-project-from-hrtb-explicit.rs | 0 .../attr-bad-meta.rs | 0 .../attr-before-eof.rs | 2 +- .../attr-before-ext.rs | 0 .../attr-before-let.rs | 2 +- .../attr-before-stmt.rs | 0 .../attr-dangling-in-fn.rs | 0 .../attr-dangling-in-mod.rs | 0 src/test/{compile-fail => parse-fail}/attr.rs | 0 .../attrs-after-extern-mod.rs | 0 .../bad-char-literals.rs | 0 .../bad-lit-suffixes.rs | 0 .../{compile-fail => parse-fail}/bad-match.rs | 0 .../{compile-fail => parse-fail}/bad-name.rs | 0 .../bad-value-ident-false.rs | 0 .../bad-value-ident-true.rs | 0 .../better-expected.rs | 2 +- .../bind-struct-early-modifiers.rs | 2 +- .../byte-literals.rs | 0 .../byte-string-literals.rs | 0 .../circular_modules_hello.rs | 0 .../circular_modules_main.rs | 0 .../class-implements-bad-trait.rs | 0 .../column-offset-1-based.rs | 0 .../doc-before-attr.rs | 2 +- .../doc-before-eof.rs | 0 .../doc-before-extern-rbrace.rs | 0 .../doc-before-macro.rs | 0 .../doc-before-rbrace.rs | 0 .../doc-before-semi.rs | 0 .../duplicate-visibility.rs | 0 .../empty-impl-semicolon.rs | 2 +- .../extern-crate-as-no-string-help.rs | 0 .../extern-expected-fn-or-brace.rs | 0 .../extern-foreign-crate.rs | 0 .../extern-no-fn.rs | 3 +- .../generic-non-trailing-defaults.rs | 0 .../import-from-path.rs | 0 .../import-from-rename.rs | 0 .../import-glob-path.rs | 0 .../import-glob-rename.rs | 0 .../int-literal-too-large-span.rs | 2 +- .../issue-10392-2.rs | 0 .../issue-10392.rs | 0 .../issue-10412.rs | 0 .../issue-10636-1.rs | 0 .../issue-10636-2.rs | 0 .../issue-12560-1.rs | 0 .../issue-14182.rs | 0 .../issue-14303-enum.rs | 0 .../issue-14303-fn-def.rs | 0 .../issue-14303-fncall.rs | 2 +- .../issue-14303-impl.rs | 0 .../issue-14303-path.rs | 0 .../issue-14303-struct.rs | 0 .../issue-14303-trait.rs | 0 .../issue-15914.rs | 0 .../issue-1655.rs | 0 .../issue-17383.rs | 0 .../issue-17718-const-mut.rs | 0 .../issue-17904.rs | 0 .../issue-1802-1.rs | 0 .../issue-1802-2.rs | 2 +- .../issue-19096.rs | 2 +- .../issue-19398.rs | 0 src/test/parse-fail/issue-20711-2.rs | 20 + src/test/parse-fail/issue-20711.rs | 17 + src/test/parse-fail/issue-21153.rs | 13 + .../issue-2354-1.rs | 0 .../issue-2354.rs | 0 .../issue-3036.rs | 0 .../issue-5544-a.rs | 2 +- .../issue-5544-b.rs | 2 +- .../issue-5806.rs | 0 .../issue-6610.rs | 0 .../issue-8537.rs | 2 +- .../keyword-abstract.rs | 0 .../keyword-as-as-identifier.rs | 0 .../keyword-break-as-identifier.rs | 0 .../keyword-do-as-identifier.rs | 0 .../keyword-else-as-identifier.rs | 0 .../keyword-enum-as-identifier.rs | 0 .../keyword-extern-as-identifier.rs | 0 .../keyword-final.rs | 0 .../keyword-fn-as-identifier.rs | 0 .../keyword-for-as-identifier.rs | 0 .../keyword-if-as-identifier.rs | 0 .../keyword-impl-as-identifier.rs | 0 .../keyword-let-as-identifier.rs | 0 .../keyword-loop-as-identifier.rs | 0 .../keyword-match-as-identifier.rs | 0 .../keyword-mod-as-identifier.rs | 0 .../keyword-mut-as-identifier.rs | 0 .../keyword-override.rs | 0 .../keyword-priv-as-identifier.rs | 0 .../keyword-pub-as-identifier.rs | 0 .../keyword-ref-as-identifier.rs | 0 .../keyword-return-as-identifier.rs | 0 .../keyword-self-as-identifier.rs | 0 .../keyword-static-as-identifier.rs | 0 .../keyword-struct-as-identifier.rs | 0 .../keyword-super-as-identifier.rs | 0 .../keyword-super.rs | 0 .../keyword-trait-as-identifier.rs | 0 .../keyword-type-as-identifier.rs | 0 .../keyword-typeof.rs | 0 .../keyword-unsafe-as-identifier.rs | 0 .../keyword-use-as-identifier.rs | 0 .../keyword-while-as-identifier.rs | 0 .../{compile-fail => parse-fail}/keyword.rs | 0 .../keywords-followed-by-double-colon.rs | 0 .../lex-bad-char-literals.rs | 0 .../lex-bad-numeric-literals.rs | 0 .../lex-bad-token.rs | 0 .../lex-bare-cr-string-literal-doc-comment.rs | 0 .../lifetime-no-keyword.rs | 0 .../lifetime-obsoleted-self.rs | 0 .../macro-attribute.rs | 0 .../macro-bad-delimiter-ident.rs | 0 .../macro-keyword.rs | 0 .../macro-mismatched-delim-brace-paren.rs | 0 .../macro-mismatched-delim-paren-brace.rs | 0 .../macros-no-semicolon-items.rs | 0 .../macros-no-semicolon.rs | 0 .../match-arrows-block-then-binop.rs | 0 .../match-vec-invalid.rs | 0 .../mod_file_not_exist.rs | 0 .../mod_file_with_path_attr.rs | 0 .../multiline-comment-line-tracking.rs | 0 .../multitrait.rs | 3 +- .../mut-patterns.rs | 0 .../new-unicode-escapes-1.rs | 0 .../new-unicode-escapes-2.rs | 0 .../new-unicode-escapes-3.rs | 0 .../new-unicode-escapes-4.rs | 0 .../no-binary-float-literal.rs | 0 .../no-hex-float-literal.rs | 0 .../no-unsafe-self.rs | 0 .../non-str-meta.rs | 0 .../not-a-pred.rs | 0 .../obsolete-for-sized.rs | 0 .../obsolete-proc.rs | 0 .../omitted-arg-in-item-fn.rs | 0 .../paamayim-nekudotayim.rs | 0 .../parenthesized-box-expr-message.rs | 0 .../pat-range-bad-dots.rs | 4 +- .../pat-ref-enum.rs | 0 .../{compile-fail => parse-fail}/qquote-1.rs | 0 .../{compile-fail => parse-fail}/qquote-2.rs | 0 src/test/parse-fail/range-3.rs | 16 + .../issue-6977.rs => parse-fail/range-4.rs} | 7 +- .../raw-byte-string-eof.rs | 0 .../raw-byte-string-literals.rs | 0 .../raw-str-delim.rs | 0 .../raw-str-unbalanced.rs | 0 .../raw-str-unterminated.rs | 0 .../regions-fn-bound.rs | 0 .../regions-infer-paramd-method.rs | 0 .../regions-out-of-scope-slice.rs | 0 .../regions-trait-2.rs | 0 .../regions-trait-3.rs | 0 .../removed-syntax-closure-lifetime.rs | 2 +- .../removed-syntax-enum-newtype.rs | 2 +- .../removed-syntax-extern-const.rs | 3 +- .../removed-syntax-field-let.rs | 0 .../removed-syntax-field-semicolon.rs | 0 .../removed-syntax-fixed-vec.rs | 2 +- .../removed-syntax-fn-pure.rs | 0 .../removed-syntax-fn-sigil.rs | 0 .../removed-syntax-larrow-init.rs | 0 .../removed-syntax-larrow-move.rs | 0 .../removed-syntax-mode.rs | 0 .../removed-syntax-mut-vec-expr.rs | 0 .../removed-syntax-mut-vec-ty.rs | 2 +- .../removed-syntax-ptr-lifetime.rs | 2 +- .../removed-syntax-record.rs | 0 .../removed-syntax-static-fn.rs | 3 +- .../removed-syntax-uniq-mut-expr.rs | 0 .../removed-syntax-uniq-mut-ty.rs | 2 +- .../removed-syntax-with-1.rs | 0 .../removed-syntax-with-2.rs | 0 .../require-parens-for-chained-comparison.rs | 8 +- .../struct-literal-in-for.rs | 0 .../struct-literal-in-if.rs | 0 .../struct-literal-in-match-discriminant.rs | 2 +- .../struct-literal-in-while.rs | 0 .../struct-no-fields-2.rs | 0 .../struct-no-fields-3.rs | 0 .../struct-no-fields-4.rs | 0 .../struct-no-fields-5.rs | 0 .../struct-no-fields-enumlike.rs | 0 .../struct-no-fields.rs | 0 .../struct-variant-no-fields.rs | 0 .../struct-variant-no-pub.rs | 0 .../syntax-trait-polarity.rs | 0 .../tag-variant-disr-non-nullary.rs | 0 .../trailing-carriage-return-in-string.rs | 0 .../trailing-plus-in-bounds.rs | 2 +- .../trait-bounds-not-on-impl.rs | 0 .../trait-keyword.rs | 0 .../type-parameters-in-field-exprs.rs | 0 .../unbalanced-doublequote.rs | 0 .../unboxed-closure-sugar-used-on-struct-3.rs | 0 .../{compile-fail => parse-fail}/unsized.rs | 0 .../{compile-fail => parse-fail}/unsized2.rs | 4 +- .../use-as-where-use-ends-with-mod-sep.rs | 12 + src/test/parse-fail/use-ends-with-mod-sep.rs | 11 + .../bar.rs => parse-fail/use-mod-4.rs} | 6 +- .../variadic-ffi-1.rs | 0 .../variadic-ffi-3.rs | 0 .../variadic-ffi-4.rs | 0 .../virtual-structs.rs | 0 .../where-clauses-no-bounds-or-predicates.rs | 0 src/test/pretty/attr-fn-inner.rs | 2 + src/test/pretty/block-comment-wchar.pp | 2 +- src/test/pretty/block-comment-wchar.rs | 2 +- src/test/pretty/block-disambig.rs | 15 +- src/test/pretty/empty-impl.rs | 4 +- src/test/pretty/empty-lines.rs | 2 +- src/test/pretty/fn-return.rs | 17 + src/test/pretty/for-comment.rs | 2 +- src/test/pretty/issue-4264.pp | 104 +- src/test/pretty/issue-4264.rs | 18 +- src/test/pretty/issue-929.rs | 2 +- src/test/pretty/match-block-expr.rs | 2 +- src/test/pretty/match-naked-expr-medium.rs | 2 +- src/test/pretty/match-naked-expr.rs | 2 +- src/test/pretty/path-type-bounds.rs | 6 +- src/test/pretty/trait-polarity.rs | 8 +- src/test/pretty/unary-op-disambig.rs | 4 +- src/test/pretty/vec-comments.pp | 24 +- src/test/pretty/vec-comments.rs | 24 +- src/test/run-fail/assert-as-macro.rs | 4 +- src/test/run-fail/assert-eq-macro-panic.rs | 4 +- src/test/run-fail/assert-macro-fmt.rs | 2 +- src/test/run-fail/binop-panic.rs | 2 +- src/test/run-fail/bounds-check-no-overflow.rs | 2 +- .../bug-2470-bounds-check-overflow-2.rs | 4 +- .../bug-2470-bounds-check-overflow-3.rs | 10 +- .../bug-2470-bounds-check-overflow.rs | 2 +- src/test/run-fail/bug-811.rs | 4 + src/test/run-fail/die-macro-expr.rs | 2 +- src/test/run-fail/divide-by-zero.rs | 4 +- src/test/run-fail/dst-raw-slice.rs | 2 +- src/test/run-fail/explicit-panic-msg.rs | 4 +- src/test/run-fail/expr-if-panic.rs | 2 +- src/test/run-fail/expr-match-panic.rs | 2 +- src/test/run-fail/extern-panic.rs | 8 +- src/test/run-fail/for-each-loop-panic.rs | 2 +- src/test/run-fail/if-check-panic.rs | 6 +- src/test/run-fail/issue-12920.rs | 2 +- src/test/run-fail/issue-20971.rs | 34 + src/test/run-fail/issue-3029.rs | 2 +- src/test/run-fail/mod-zero.rs | 4 +- src/test/run-fail/panic-macro-any.rs | 2 +- src/test/run-fail/panic-macro-fmt.rs | 2 +- src/test/run-fail/panic-task-name-none.rs | 5 +- src/test/run-fail/panic-task-name-owned.rs | 8 +- src/test/run-fail/panic.rs | 4 +- .../run-fail/rt-set-exit-status-panic2.rs | 4 +- src/test/run-fail/task-spawn-barefn.rs | 4 +- src/test/run-fail/tls-exit-status.rs | 4 +- src/test/run-fail/unwind-interleaved.rs | 4 +- src/test/run-fail/unwind-unique.rs | 2 +- .../run-make/alloc-extern-crates/Makefile | 5 + .../run-make/alloc-extern-crates/fakealloc.rs | 36 + .../allow-non-lint-warnings-cmdline/1} | 0 .../allow-non-lint-warnings-cmdline/Makefile | 12 + .../allow-non-lint-warnings-cmdline/foo.rs} | 7 +- .../allow-warnings-cmdline-stability/1 | 0 .../allow-warnings-cmdline-stability/Makefile | 19 + .../allow-warnings-cmdline-stability/bar.rs | 16 + .../allow-warnings-cmdline-stability/foo.rs | 13 + src/test/run-make/c-dynamic-dylib/cfoo.c | 1 + src/test/run-make/c-dynamic-rlib/cfoo.c | 1 + src/test/run-make/c-link-to-rust-dylib/bar.c | 1 + .../c-link-to-rust-staticlib/Makefile | 4 +- .../run-make/c-link-to-rust-staticlib/bar.c | 1 + src/test/run-make/c-static-dylib/cfoo.c | 1 + src/test/run-make/c-static-rlib/cfoo.c | 1 + .../create_and_compile.rs | 24 +- .../run-make/compiler-lookup-paths-2/Makefile | 8 + .../run-make/compiler-lookup-paths-2/a.rs} | 3 +- .../run-make/compiler-lookup-paths-2/b.rs | 12 + .../main.rs => compiler-lookup-paths-2/c.rs} | 9 +- src/test/run-make/crate-data-smoke/Makefile | 12 +- src/test/run-make/dep-info-custom/Makefile | 25 - .../run-make/dep-info-custom/Makefile.foo | 7 - src/test/run-make/dep-info-spaces/Makefile | 2 +- .../run-make/dep-info-spaces/Makefile.foo | 6 +- src/test/run-make/dep-info/Makefile | 2 +- .../duplicate-output-flavors/Makefile | 1 + .../Makefile | 5 + .../bar.rs | 15 + .../foo.rs | 2 +- .../error-writing-dependencies/Makefile | 4 +- .../extern-flag-disambiguates/Makefile | 2 + .../run-make/extern-flag-disambiguates/a.rs | 4 +- .../run-make/extern-flag-disambiguates/b.rs | 6 +- .../run-make/extern-flag-disambiguates/c.rs | 6 +- .../run-make/extern-flag-disambiguates/d.rs | 2 +- src/test/run-make/extern-fn-generic/test.c | 13 +- src/test/run-make/extern-fn-mangle/test.c | 3 +- .../extern-fn-with-packed-struct/test.c | 1 + .../extern-fn-with-packed-struct/test.rs | 4 +- src/test/run-make/extern-fn-with-union/test.c | 1 + .../extern-overrides-distribution/Makefile | 5 + .../extern-overrides-distribution/libc.rs | 13 + .../extern-overrides-distribution/main.rs | 16 + src/test/run-make/graphviz-flowgraph/Makefile | 4 +- .../graphviz-flowgraph/f01.dot-expected.dot | 6 +- src/test/run-make/graphviz-flowgraph/f01.rs | 2 +- .../graphviz-flowgraph/f03.dot-expected.dot | 8 +- src/test/run-make/graphviz-flowgraph/f03.rs | 2 +- .../graphviz-flowgraph/f04.dot-expected.dot | 6 +- src/test/run-make/graphviz-flowgraph/f04.rs | 2 +- .../graphviz-flowgraph/f05.dot-expected.dot | 10 +- src/test/run-make/graphviz-flowgraph/f05.rs | 2 +- .../graphviz-flowgraph/f07.dot-expected.dot | 16 +- src/test/run-make/graphviz-flowgraph/f07.rs | 2 +- .../graphviz-flowgraph/f08.dot-expected.dot | 20 +- src/test/run-make/graphviz-flowgraph/f08.rs | 6 +- .../graphviz-flowgraph/f09.dot-expected.dot | 34 +- src/test/run-make/graphviz-flowgraph/f09.rs | 8 +- .../graphviz-flowgraph/f10.dot-expected.dot | 20 +- src/test/run-make/graphviz-flowgraph/f10.rs | 6 +- .../graphviz-flowgraph/f11.dot-expected.dot | 18 +- src/test/run-make/graphviz-flowgraph/f11.rs | 4 +- .../graphviz-flowgraph/f12.dot-expected.dot | 24 +- src/test/run-make/graphviz-flowgraph/f12.rs | 6 +- .../graphviz-flowgraph/f14.dot-expected.dot | 12 +- src/test/run-make/graphviz-flowgraph/f14.rs | 4 +- .../graphviz-flowgraph/f15.dot-expected.dot | 58 +- src/test/run-make/graphviz-flowgraph/f15.rs | 14 +- .../graphviz-flowgraph/f16.dot-expected.dot | 60 +- src/test/run-make/graphviz-flowgraph/f16.rs | 14 +- .../graphviz-flowgraph/f17.dot-expected.dot | 12 +- src/test/run-make/graphviz-flowgraph/f17.rs | 2 +- .../graphviz-flowgraph/f20.dot-expected.dot | 18 +- src/test/run-make/graphviz-flowgraph/f20.rs | 4 +- .../graphviz-flowgraph/f21.dot-expected.dot | 52 +- src/test/run-make/graphviz-flowgraph/f21.rs | 12 +- .../graphviz-flowgraph/f22.dot-expected.dot | 54 +- src/test/run-make/graphviz-flowgraph/f22.rs | 12 +- .../graphviz-flowgraph/f23.dot-expected.dot | 66 +- src/test/run-make/graphviz-flowgraph/f23.rs | 18 +- .../graphviz-flowgraph/f24.dot-expected.dot | 84 +- src/test/run-make/graphviz-flowgraph/f24.rs | 20 +- .../graphviz-flowgraph/f25.dot-expected.dot | 84 +- src/test/run-make/graphviz-flowgraph/f25.rs | 20 +- .../run-make/interdependent-c-libraries/bar.c | 1 + .../run-make/interdependent-c-libraries/foo.c | 1 + src/test/run-make/issue-12446/foo.c | 1 + src/test/run-make/issue-15460/foo.c | 1 + src/test/run-make/issue-19371/foo.rs | 14 +- src/test/run-make/issue-22131/Makefile | 7 + src/test/run-make/issue-22131/foo.rs | 17 + src/test/run-make/issue-7349/Makefile | 4 +- src/test/run-make/issue-7349/foo.rs | 4 +- src/test/run-make/link-path-order/correct.c | 1 + src/test/run-make/link-path-order/wrong.c | 1 + .../run-make/linkage-attr-on-static/foo.c | 1 + src/test/run-make/lto-smoke-c/bar.c | 1 + src/test/run-make/manual-link/bar.c | 1 + src/test/run-make/manual-link/foo.c | 1 + .../mismatching-target-triples/bar.rs | 1 + .../mismatching-target-triples/foo.rs | 1 + src/test/run-make/no-duplicate-libs/bar.c | 1 + src/test/run-make/no-duplicate-libs/bar.rs | 2 +- src/test/run-make/no-duplicate-libs/foo.c | 1 + src/test/run-make/no-duplicate-libs/foo.rs | 2 +- src/test/run-make/no-stack-check/Makefile | 5 + .../run-make/pretty-expanded-hygiene/Makefile | 3 +- .../pretty-expanded-hygiene/input.pp.rs | 1 + .../run-make/pretty-expanded-hygiene/input.rs | 1 + src/test/run-make/pretty-expanded/Makefile | 3 +- .../pretty-print-path-suffix/Makefile | 6 +- .../run-make/pretty-print-to-file/Makefile | 2 +- .../run-make/rustdoc-assoc-types/Makefile | 5 + src/test/run-make/rustdoc-assoc-types/lib.rs | 20 + .../run-make/rustdoc-extern-method/Makefile | 8 + .../run-make/rustdoc-extern-method/bar.rs | 24 + .../run-make/rustdoc-extern-method/foo.rs | 16 + src/test/run-make/rustdoc-ffi/Makefile | 8 + src/test/run-make/rustdoc-ffi/lib.rs | 16 + src/test/run-make/rustdoc-ffi/user.rs | 16 + .../run-make/rustdoc-hidden-line/Makefile | 3 +- src/test/run-make/rustdoc-hidden-line/foo.rs | 3 + .../run-make/rustdoc-hidden-line/verify.sh | 8 - src/test/run-make/rustdoc-json/foo.rs | 2 +- src/test/run-make/rustdoc-must-use/Makefile | 5 + src/test/run-make/rustdoc-must-use/lib.rs | 23 + .../run-make/rustdoc-negative-impl/Makefile | 6 + .../run-make/rustdoc-negative-impl/foo.rs | 22 + .../run-make/rustdoc-search-index/Makefile | 4 +- .../run-make/rustdoc-search-index/index.rs | 11 +- .../run-make/rustdoc-search-index/verify.sh | 33 - src/test/run-make/rustdoc-smoke/Makefile | 3 +- src/test/run-make/rustdoc-smoke/foo.rs | 9 +- src/test/run-make/rustdoc-smoke/verify.sh | 17 - .../run-make/rustdoc-viewpath-self/Makefile | 6 + .../run-make/rustdoc-viewpath-self/foo.rs | 26 + src/test/run-make/rustdoc-where/Makefile | 6 +- src/test/run-make/rustdoc-where/foo.rs | 28 +- src/test/run-make/rustdoc-where/verify.sh | 23 - src/test/run-make/save-analysis/SameDir.rs | 15 + src/test/run-make/save-analysis/SameDir3.rs | 13 + src/test/run-make/save-analysis/SubDir/mod.rs | 40 + src/test/run-make/save-analysis/foo.rs | 337 +- src/test/run-make/simd-ffi/Makefile | 33 + src/test/run-make/simd-ffi/simd.rs | 86 + src/test/run-make/static-unwinding/lib.rs | 2 +- src/test/run-make/static-unwinding/main.rs | 7 +- .../run-make/symbols-are-reasonable/Makefile | 6 +- .../run-make/symbols-are-reasonable/lib.rs | 4 +- src/test/run-make/target-specs/Makefile | 4 +- src/test/run-make/target-specs/foo.rs | 10 +- .../target-specs/my-awesome-platform.json | 2 +- .../target-specs/my-incomplete-platform.json | 2 +- .../x86_64-unknown-linux-gnu.json | 2 +- .../run-make/test-shard-completeness/Makefile | 7 - src/test/run-make/tools.mk | 10 +- .../run-make/unicode-input/multiple_files.rs | 26 +- .../run-make/unicode-input/span_length.rs | 60 +- .../run-make/use-extern-for-plugins/Makefile | 18 + .../run-make/use-extern-for-plugins/bar.rs | 19 + .../run-make/use-extern-for-plugins/baz.rs | 18 + .../run-make/use-extern-for-plugins/foo.rs | 19 + src/test/run-pass-fulldeps/compiler-calls.rs | 81 + src/test/run-pass-fulldeps/issue-16992.rs | 4 +- .../issue_16723_multiple_items_syntax_ext.rs | 4 +- .../run-pass-fulldeps/lint-group-plugin.rs | 4 +- .../lint-plugin-cmdline-allow.rs | 4 +- src/test/run-pass-fulldeps/lint-plugin.rs | 4 +- .../macro-crate-does-hygiene-work.rs | 8 +- .../macro-crate-outlive-expansion-phase.rs | 4 +- src/test/run-pass-fulldeps/macro-crate.rs | 31 +- src/test/run-pass-fulldeps/plugin-args-1.rs | 7 +- src/test/run-pass-fulldeps/plugin-args-2.rs | 7 +- src/test/run-pass-fulldeps/plugin-args-3.rs | 7 +- .../plugin-lib-ok-in-plugin.rs | 26 + ...resolve.rs => plugin-plus-extern-crate.rs} | 5 +- .../quote-unused-sp-no-warning.rs | 2 +- .../run-pass-fulldeps/roman-numerals-macro.rs | 4 +- .../syntax-extension-with-dll-deps.rs | 8 +- .../cleanup-auto-borrow-obj.rs | 2 +- src/test/run-pass-valgrind/cleanup-stdin.rs | 2 +- src/test/run-pass-valgrind/dst-dtor-1.rs | 2 +- src/test/run-pass/alias-uninit-value.rs | 2 +- src/test/run-pass/arr_cycle.rs | 39 + src/test/run-pass/asm-in-out-operand.rs | 4 +- src/test/run-pass/asm-out-assign.rs | 2 +- src/test/run-pass/assert-eq-macro-success.rs | 4 +- src/test/run-pass/assignability-trait.rs | 2 +- src/test/run-pass/associated-types-basic.rs | 4 +- .../associated-types-binding-in-trait.rs | 44 + ...ssociated-types-binding-in-where-clause.rs | 2 +- src/test/run-pass/associated-types-bound.rs | 42 +- src/test/run-pass/associated-types-cc.rs | 2 +- .../associated-types-conditional-dispatch.rs | 9 +- .../associated-types-constant-type.rs | 2 +- ...ted-types-duplicate-binding-in-env-hrtb.rs | 23 + ...sociated-types-duplicate-binding-in-env.rs | 27 + .../associated-types-enum-field-named.rs | 43 + .../associated-types-enum-field-numbered.rs | 43 + .../run-pass/associated-types-issue-20220.rs | 36 + .../run-pass/associated-types-issue-20371.rs | 4 +- .../run-pass/associated-types-issue-21212.rs | 29 + .../associated-types-nested-projections.rs | 9 +- ...iated-types-normalize-in-bounds-binding.rs | 46 + ...sociated-types-normalize-in-bounds-ufcs.rs | 10 +- .../associated-types-normalize-in-bounds.rs | 10 +- ...ociated-types-normalize-unifield-struct.rs | 34 + ...ypes-projection-from-known-type-in-impl.rs | 2 + ...ociated-types-projection-in-object-type.rs | 45 + ...sociated-types-projection-in-supertrait.rs | 2 + ...ciated-types-projection-in-where-clause.rs | 36 + .../associated-types-ref-in-struct-literal.rs | 4 +- .../associated-types-resolve-lifetime.rs | 2 + src/test/run-pass/associated-types-return.rs | 6 +- src/test/run-pass/associated-types-stream.rs | 47 + .../associated-types-struct-field-named.rs | 43 + .../associated-types-struct-field-numbered.rs | 40 + .../run-pass/associated-types-sugar-path.rs | 5 +- .../astconv-cycle-between-trait-and-type.rs | 36 + src/test/run-pass/attr-before-view-item.rs | 2 + src/test/run-pass/attr-before-view-item2.rs | 2 + src/test/run-pass/attr-main-2.rs | 1 + src/test/run-pass/attr-main.rs | 1 + src/test/run-pass/attr-mix-new.rs | 1 + src/test/run-pass/attr-no-drop-flag-size.rs | 1 + src/test/run-pass/attr-start.rs | 1 + src/test/run-pass/attr.rs | 2 + src/test/run-pass/auto-encode.rs | 12 +- src/test/run-pass/auto-instantiate.rs | 6 +- src/test/run-pass/auto-loop.rs | 4 +- src/test/run-pass/auto-ref-sliceable.rs | 2 +- .../run-pass/autoderef-method-on-trait.rs | 6 +- .../run-pass/autoderef-method-priority.rs | 6 +- .../autoderef-method-twice-but-not-thrice.rs | 6 +- src/test/run-pass/autoderef-method-twice.rs | 6 +- src/test/run-pass/autoderef-method.rs | 6 +- .../autoref-intermediate-types-issue-3585.rs | 2 +- src/test/run-pass/backtrace.rs | 48 +- .../run-pass/bare-fn-implements-fn-mut.rs | 8 +- .../run-pass/binary-minus-without-space.rs | 4 +- src/test/run-pass/binops.rs | 8 +- src/test/run-pass/bitv-perf-test.rs | 8 +- src/test/run-pass/bitwise.rs | 16 +- .../blind-item-mixed-crate-use-item.rs | 33 + .../run-pass/blind-item-mixed-use-item.rs | 27 + src/test/run-pass/block-arg-call-as.rs | 4 +- src/test/run-pass/block-arg.rs | 2 +- src/test/run-pass/block-expr-precedence.rs | 10 +- src/test/run-pass/block-fn-coerce.rs | 2 +- src/test/run-pass/block-iter-1.rs | 6 +- src/test/run-pass/block-iter-2.rs | 4 +- src/test/run-pass/bool.rs | 4 +- .../run-pass/borrow-by-val-method-receiver.rs | 2 +- src/test/run-pass/borrow-tuple-fields.rs | 8 +- src/test/run-pass/borrowck-binding-mutbl.rs | 2 +- .../run-pass/borrowck-closures-two-imm.rs | 26 +- .../run-pass/borrowck-fixed-length-vecs.rs | 2 +- .../run-pass/borrowck-freeze-frozen-mut.rs | 2 +- .../borrowck-macro-interaction-issue-6304.rs | 1 + .../run-pass/borrowck-move-by-capture-ok.rs | 2 +- src/test/run-pass/borrowck-mut-uniq.rs | 4 +- .../run-pass/borrowck-mut-vec-as-imm-slice.rs | 4 +- .../borrowck-pat-reassign-no-binding.rs | 2 +- src/test/run-pass/borrowck-trait-lifetime.rs | 5 +- src/test/run-pass/borrowck-univariant-enum.rs | 3 +- src/test/run-pass/borrowed-ptr-pattern-2.rs | 2 +- .../borrowed-ptr-pattern-infallible.rs | 2 +- src/test/run-pass/borrowed-ptr-pattern.rs | 2 +- src/test/run-pass/break.rs | 10 +- src/test/run-pass/bug-7183-generics.rs | 6 +- src/test/run-pass/bug-7295.rs | 6 +- ...ltin-superkinds-capabilities-transitive.rs | 6 +- .../builtin-superkinds-capabilities-xc.rs | 6 +- .../builtin-superkinds-capabilities.rs | 6 +- .../builtin-superkinds-in-metadata.rs | 4 +- .../builtin-superkinds-phantom-typaram.rs | 6 +- .../run-pass/builtin-superkinds-self-type.rs | 8 +- src/test/run-pass/byte-literals.rs | 8 +- src/test/run-pass/c-stack-returning-int64.rs | 4 +- .../capture-clauses-boxed-closures.rs | 6 +- .../capture-clauses-unboxed-closures.rs | 8 +- src/test/run-pass/capturing-logging.rs | 7 +- src/test/run-pass/cci_borrow.rs | 4 +- src/test/run-pass/cci_impl_exe.rs | 2 +- src/test/run-pass/cci_iter_exe.rs | 2 +- src/test/run-pass/cci_no_inline_exe.rs | 2 +- src/test/run-pass/cell-does-not-clone.rs | 3 +- src/test/run-pass/cfg-attr-cfg.rs | 15 + src/test/run-pass/cfg-attr-crate.rs | 15 + src/test/run-pass/cfg_attr.rs | 38 +- .../check-static-recursion-foreign.rs | 3 + src/test/run-pass/class-attributes-1.rs | 1 + src/test/run-pass/class-attributes-2.rs | 1 + .../class-cast-to-trait-cross-crate-2.rs | 2 +- .../class-cast-to-trait-multiple-types.rs | 18 +- src/test/run-pass/class-cast-to-trait.rs | 6 +- src/test/run-pass/class-dtor.rs | 2 +- src/test/run-pass/class-exports.rs | 2 +- .../class-impl-very-parameterized-trait.rs | 8 +- .../class-implement-trait-cross-crate.rs | 8 +- src/test/run-pass/class-implement-traits.rs | 8 +- src/test/run-pass/class-method-cross-crate.rs | 4 +- .../run-pass/class-methods-cross-crate.rs | 6 +- src/test/run-pass/class-methods.rs | 8 +- .../class-poly-methods-cross-crate.rs | 10 +- src/test/run-pass/class-poly-methods.rs | 10 +- src/test/run-pass/class-separate-impl.rs | 6 +- src/test/run-pass/class-typarams.rs | 13 +- src/test/run-pass/classes-cross-crate.rs | 4 +- .../run-pass/classes-simple-cross-crate.rs | 4 +- src/test/run-pass/classes-simple-method.rs | 4 +- src/test/run-pass/classes-simple.rs | 4 +- src/test/run-pass/classes.rs | 8 +- src/test/run-pass/cleanup-rvalue-for-scope.rs | 2 +- src/test/run-pass/cleanup-rvalue-scopes.rs | 5 +- ...nup-rvalue-temp-during-incomplete-alloc.rs | 6 +- src/test/run-pass/cleanup-shortcircuit.rs | 7 +- src/test/run-pass/closure-inference.rs | 4 +- src/test/run-pass/closure-inference2.rs | 6 +- src/test/run-pass/closure-reform.rs | 2 +- src/test/run-pass/coerce-expect-unsized.rs | 18 +- src/test/run-pass/coerce-match-calls.rs | 4 +- src/test/run-pass/coerce-match.rs | 4 +- .../run-pass/coerce-overloaded-autoderef.rs | 69 + .../run-pass/coerce-reborrow-imm-vec-arg.rs | 2 +- .../run-pass/coerce-reborrow-imm-vec-rcvr.rs | 6 +- .../run-pass/coerce-reborrow-mut-vec-arg.rs | 2 +- .../run-pass/coerce-reborrow-mut-vec-rcvr.rs | 2 +- src/test/run-pass/coerce-unify-return.rs | 26 + .../coherence-bigint-int.rs | 2 +- .../coherence-bigint-vecint.rs | 2 +- .../coherence-cow-1.rs} | 18 +- src/test/run-pass/coherence-cow-2.rs | 23 + src/test/run-pass/coherence-impl-in-fn.rs | 2 +- .../run-pass/coherence-negative-impls-safe.rs | 19 + src/test/run-pass/coherence-where-clause.rs | 10 +- src/test/run-pass/colorful-write-macros.rs | 6 +- src/test/run-pass/complex.rs | 4 +- src/test/run-pass/concat.rs | 4 +- src/test/run-pass/const-adt-align-mismatch.rs | 28 + src/test/run-pass/const-binops.rs | 22 +- src/test/run-pass/const-block.rs | 44 +- src/test/run-pass/const-bound.rs | 4 +- src/test/run-pass/const-expr-in-vec-repeat.rs | 2 +- .../run-pass/const-nullary-univariant-enum.rs | 3 +- src/test/run-pass/const-polymorphic-paths.rs | 36 +- src/test/run-pass/const-struct.rs | 2 +- src/test/run-pass/const-vec-of-fns.rs | 4 +- src/test/run-pass/consts-in-patterns.rs | 8 +- src/test/run-pass/copy-out-of-array-1.rs | 28 + src/test/run-pass/core-run-destroy.rs | 6 +- src/test/run-pass/crate-leading-sep.rs | 2 +- src/test/run-pass/crate-name-attr-used.rs | 2 +- src/test/run-pass/deref-lval.rs | 4 +- src/test/run-pass/deref-rc.rs | 2 +- src/test/run-pass/derive-no-std.rs | 41 + .../run-pass/deriving-clone-generic-enum.rs | 2 +- .../run-pass/deriving-clone-generic-struct.rs | 2 +- .../deriving-clone-generic-tuple-struct.rs | 2 +- .../run-pass/deriving-cmp-generic-enum.rs | 8 +- .../deriving-cmp-generic-struct-enum.rs | 12 +- .../run-pass/deriving-cmp-generic-struct.rs | 4 +- .../deriving-cmp-generic-tuple-struct.rs | 4 +- .../deriving-encodable-decodable-box.rs | 4 +- ...riving-encodable-decodable-cell-refcell.rs | 4 +- .../run-pass/deriving-encodable-decodable.rs | 4 +- src/test/run-pass/deriving-global.rs | 6 +- src/test/run-pass/deriving-hash.rs | 2 +- src/test/run-pass/deriving-in-fn.rs | 2 +- src/test/run-pass/deriving-meta-multiple.rs | 2 +- src/test/run-pass/deriving-meta.rs | 2 +- src/test/run-pass/deriving-primitive.rs | 2 +- src/test/run-pass/deriving-rand.rs | 2 +- src/test/run-pass/deriving-show-2.rs | 36 +- src/test/run-pass/deriving-show.rs | 16 +- .../run-pass/deriving-via-extension-c-enum.rs | 2 +- .../run-pass/deriving-via-extension-enum.rs | 2 +- .../deriving-via-extension-struct-empty.rs | 2 +- ...-via-extension-struct-like-enum-variant.rs | 2 +- .../deriving-via-extension-struct-tuple.rs | 2 +- .../run-pass/deriving-via-extension-struct.rs | 2 +- .../deriving-via-extension-type-params.rs | 2 +- src/test/run-pass/destructure-array-1.rs | 35 + src/test/run-pass/double-ref.rs | 42 +- src/test/run-pass/drop-trait-enum.rs | 20 +- src/test/run-pass/drop-trait-generic.rs | 2 +- .../run-pass/drop-with-type-ascription-1.rs | 2 +- .../run-pass/drop-with-type-ascription-2.rs | 2 +- src/test/run-pass/dropck_tarena_sound_drop.rs | 51 + src/test/run-pass/dst-coercions.rs | 2 +- src/test/run-pass/dst-index.rs | 10 +- src/test/run-pass/dst-raw.rs | 12 +- src/test/run-pass/dst-struct-sole.rs | 4 +- src/test/run-pass/dst-struct.rs | 6 +- src/test/run-pass/dst-trait.rs | 8 +- src/test/run-pass/early-ret-binop-add.rs | 2 +- src/test/run-pass/early-vtbl-resolution.rs | 2 +- src/test/run-pass/else-if.rs | 20 +- src/test/run-pass/empty-tag.rs | 6 +- src/test/run-pass/enum-discrim-width-stuff.rs | 3 +- src/test/run-pass/enum-null-pointer-opt.rs | 2 +- .../enum-nullable-simplifycfg-misopt.rs | 4 +- src/test/run-pass/enum-vec-initializer.rs | 8 +- src/test/run-pass/env-home-dir.rs | 49 + src/test/run-pass/env-vars.rs | 22 + src/test/run-pass/exec-env.rs | 4 +- src/test/run-pass/explicit-i-suffix.rs | 8 +- src/test/run-pass/explicit-self-closures.rs | 2 +- src/test/run-pass/explicit-self-generic.rs | 11 +- src/test/run-pass/exponential-notation.rs | 10 +- src/test/run-pass/export-unexported-dep.rs | 3 +- src/test/run-pass/expr-block-unique.rs | 2 +- src/test/run-pass/expr-block.rs | 2 +- src/test/run-pass/expr-copy.rs | 3 +- src/test/run-pass/expr-empty-ret.rs | 2 +- src/test/run-pass/expr-fn.rs | 2 +- src/test/run-pass/expr-if-panic-all.rs | 2 +- src/test/run-pass/expr-if-panic.rs | 10 +- src/test/run-pass/expr-if-struct.rs | 7 +- src/test/run-pass/expr-if-unique.rs | 4 +- src/test/run-pass/expr-match-panic-all.rs | 2 +- src/test/run-pass/expr-match-panic.rs | 4 +- src/test/run-pass/expr-match-struct.rs | 7 +- src/test/run-pass/expr-match-unique.rs | 4 +- src/test/run-pass/exterior.rs | 3 +- src/test/run-pass/extern-pass-TwoU16s.rs | 4 +- src/test/run-pass/extern-pass-TwoU32s.rs | 4 +- src/test/run-pass/extern-pass-TwoU64s.rs | 4 +- src/test/run-pass/extern-pass-TwoU8s.rs | 4 +- src/test/run-pass/extern-rust.rs | 19 + src/test/run-pass/extern-stress.rs | 2 +- src/test/run-pass/extern-yield.rs | 2 +- src/test/run-pass/fat-arrow-match.rs | 6 +- src/test/run-pass/fixed_length_copy.rs | 6 +- .../run-pass/fn-pattern-expected-type-2.rs | 2 +- src/test/run-pass/fn-pattern-expected-type.rs | 2 +- src/test/run-pass/fn-type-infer.rs | 4 +- src/test/run-pass/for-destruct.rs | 2 +- src/test/run-pass/for-loop-goofiness.rs | 4 +- .../for-loop-into-iterator.rs} | 23 +- src/test/run-pass/for-loop-no-std.rs | 25 + src/test/run-pass/for-loop-panic.rs | 2 +- .../foreach-external-iterators-break.rs | 6 +- ...xternal-iterators-hashmap-break-restart.rs | 6 +- .../foreach-external-iterators-hashmap.rs | 10 +- .../foreach-external-iterators-loop.rs | 4 +- .../foreach-external-iterators-nested.rs | 12 +- .../run-pass/foreach-external-iterators.rs | 6 +- src/test/run-pass/foreign-call-no-runtime.rs | 10 +- src/test/run-pass/foreign-fn-linkname.rs | 4 +- src/test/run-pass/foreign-fn-with-byval.rs | 3 +- src/test/run-pass/format-no-std.rs | 36 + src/test/run-pass/func-arg-ref-pattern.rs | 1 + src/test/run-pass/functional-struct-upd.rs | 2 +- src/test/run-pass/generic-alias-unique.rs | 2 +- ...generic-default-type-params-cross-crate.rs | 10 +- .../run-pass/generic-default-type-params.rs | 4 +- src/test/run-pass/generic-fn-unique.rs | 2 +- src/test/run-pass/generic-fn.rs | 3 +- src/test/run-pass/generic-ivec-leak.rs | 2 +- src/test/run-pass/generic-newtype-struct.rs | 2 +- src/test/run-pass/generic-static-methods.rs | 4 +- src/test/run-pass/generic-tag-local.rs | 2 +- src/test/run-pass/generic-tup.rs | 4 +- src/test/run-pass/getopts_ref.rs | 2 +- src/test/run-pass/guards-not-exhaustive.rs | 3 +- src/test/run-pass/guards.rs | 11 +- src/test/run-pass/hashmap-memory.rs | 5 +- src/test/run-pass/hrtb-opt-in-copy.rs | 7 +- src/test/run-pass/hrtb-parse.rs | 16 +- src/test/run-pass/hrtb-precedence-of-plus.rs | 2 +- .../hrtb-trait-object-paren-notation.rs | 2 +- .../run-pass/hrtb-unboxed-closure-trait.rs | 2 +- src/test/run-pass/huge-largest-array.rs | 4 +- src/test/run-pass/hygiene-dodging-1.rs | 2 +- src/test/run-pass/hygienic-labels-in-let.rs | 20 +- src/test/run-pass/hygienic-labels.rs | 10 +- src/test/run-pass/if-check.rs | 6 +- src/test/run-pass/if-let.rs | 20 +- src/test/run-pass/ifmt.rs | 58 +- src/test/run-pass/ignore-all-the-things.rs | 16 +- src/test/run-pass/import-glob-crate.rs | 2 +- src/test/run-pass/import-in-block.rs | 4 +- src/test/run-pass/import4.rs | 2 +- .../inconsistent-lifetime-mismatch.rs | 2 +- .../infer-container-across-object-cast.rs | 59 + .../inferred-suffix-in-pattern-range.rs | 4 +- src/test/run-pass/init-large-type.rs | 30 + src/test/run-pass/init-res-into-things.rs | 12 +- src/test/run-pass/inner-static.rs | 6 +- src/test/run-pass/integer-literal-radix.rs | 12 +- .../into-iterator-type-inference-shift.rs | 41 + src/test/run-pass/intrinsic-alignment.rs | 27 +- src/test/run-pass/intrinsic-atomics.rs | 2 +- src/test/run-pass/intrinsic-move-val.rs | 2 +- src/test/run-pass/issue-10396.rs | 4 +- src/test/run-pass/issue-10456.rs | 4 +- src/test/run-pass/issue-10626.rs | 15 +- src/test/run-pass/issue-10638.rs | 2 +- src/test/run-pass/issue-10683.rs | 2 +- src/test/run-pass/issue-10718.rs | 2 +- src/test/run-pass/issue-10734.rs | 2 + src/test/run-pass/issue-10802.rs | 2 +- src/test/run-pass/issue-10902.rs | 4 +- src/test/run-pass/issue-11205.rs | 46 +- src/test/run-pass/issue-11225-1.rs | 2 +- src/test/run-pass/issue-11225-2.rs | 2 +- src/test/run-pass/issue-11384.rs | 2 +- src/test/run-pass/issue-11552.rs | 1 + src/test/run-pass/issue-11612.rs | 2 +- src/test/run-pass/issue-11677.rs | 9 +- src/test/run-pass/issue-11736.rs | 10 +- src/test/run-pass/issue-11869.rs | 2 +- src/test/run-pass/issue-11881.rs | 4 +- src/test/run-pass/issue-11958.rs | 2 +- src/test/run-pass/issue-1257.rs | 2 +- src/test/run-pass/issue-12582.rs | 8 +- src/test/run-pass/issue-12684.rs | 6 +- src/test/run-pass/issue-12699.rs | 2 +- src/test/run-pass/issue-12744.rs | 2 +- src/test/run-pass/issue-12860.rs | 4 +- src/test/run-pass/issue-12909.rs | 2 +- src/test/run-pass/issue-13027.rs | 86 +- src/test/run-pass/issue-13105.rs | 4 +- src/test/run-pass/issue-13304.rs | 19 +- src/test/run-pass/issue-13323.rs | 2 +- src/test/run-pass/issue-13352.rs | 2 +- src/test/run-pass/issue-13434.rs | 4 +- src/test/run-pass/issue-13494.rs | 4 +- src/test/run-pass/issue-13507-2.rs | 2 +- src/test/run-pass/issue-13655.rs | 3 +- src/test/run-pass/issue-13867.rs | 26 +- src/test/run-pass/issue-14021.rs | 6 +- src/test/run-pass/issue-14308.rs | 8 +- src/test/run-pass/issue-14393.rs | 4 +- src/test/run-pass/issue-14399.rs | 2 +- src/test/run-pass/issue-14456.rs | 23 +- src/test/run-pass/issue-14589.rs | 7 +- src/test/run-pass/issue-1460.rs | 2 +- src/test/run-pass/issue-14865.rs | 4 +- src/test/run-pass/issue-14901.rs | 2 +- src/test/run-pass/issue-14919.rs | 2 +- src/test/run-pass/issue-14936.rs | 2 +- src/test/run-pass/issue-14940.rs | 8 +- src/test/run-pass/issue-14958.rs | 5 +- src/test/run-pass/issue-14959.rs | 10 +- src/test/run-pass/issue-15080.rs | 2 +- src/test/run-pass/issue-15149.rs | 66 +- src/test/run-pass/issue-15189.rs | 4 +- src/test/run-pass/issue-15221.rs | 2 +- src/test/run-pass/issue-15571.rs | 12 +- src/test/run-pass/issue-15673.rs | 2 +- src/test/run-pass/issue-15734.rs | 4 +- src/test/run-pass/issue-15763.rs | 12 +- src/test/run-pass/issue-15858.rs | 12 +- .../issue-15881-model-lexer-dotdotdot.rs | 43 + src/test/run-pass/issue-15924.rs | 2 +- src/test/run-pass/issue-16256.rs | 2 +- src/test/run-pass/issue-16272.rs | 8 +- src/test/run-pass/issue-16530.rs | 18 + src/test/run-pass/issue-16560.rs | 6 +- src/test/run-pass/issue-16596.rs | 2 +- src/test/run-pass/issue-16597-empty.rs | 1 + src/test/run-pass/issue-16643.rs | 2 +- src/test/run-pass/issue-16648.rs | 4 +- src/test/run-pass/issue-16668.rs | 6 +- src/test/run-pass/issue-16671.rs | 7 +- src/test/run-pass/issue-16739.rs | 23 +- src/test/run-pass/issue-16774.rs | 5 +- src/test/run-pass/issue-16783.rs | 2 +- src/test/run-pass/issue-17068.rs | 2 +- src/test/run-pass/issue-17074.rs | 2 +- src/test/run-pass/issue-17121.rs | 8 +- src/test/run-pass/issue-17216.rs | 4 +- src/test/run-pass/issue-17322.rs | 4 +- src/test/run-pass/issue-17503.rs | 2 +- src/test/run-pass/issue-17662.rs | 8 +- src/test/run-pass/issue-17718.rs | 6 +- src/test/run-pass/issue-17732.rs | 3 +- src/test/run-pass/issue-17734.rs | 2 +- src/test/run-pass/issue-17771.rs | 2 +- src/test/run-pass/issue-17816.rs | 8 +- src/test/run-pass/issue-17877.rs | 12 +- src/test/run-pass/issue-17897.rs | 2 +- src/test/run-pass/issue-17904.rs | 4 +- src/test/run-pass/issue-18188.rs | 12 +- src/test/run-pass/issue-18232.rs | 4 +- src/test/run-pass/issue-18352.rs | 2 +- src/test/run-pass/issue-18425.rs | 2 +- src/test/run-pass/issue-18539.rs | 2 +- src/test/run-pass/issue-18619.rs | 2 +- src/test/run-pass/issue-18652.rs | 2 +- src/test/run-pass/issue-18661.rs | 2 +- src/test/run-pass/issue-18685.rs | 2 +- src/test/run-pass/issue-18711.rs | 2 +- src/test/run-pass/issue-18767.rs | 2 +- src/test/run-pass/issue-18906.rs | 2 +- src/test/run-pass/issue-19100.rs | 3 +- src/test/run-pass/issue-19121.rs | 2 + src/test/run-pass/issue-19129-2.rs | 2 +- src/test/run-pass/issue-19135.rs | 10 +- src/test/run-pass/issue-19244.rs | 4 +- src/test/run-pass/issue-19358.rs | 10 +- src/test/run-pass/issue-19367.rs | 2 +- src/test/run-pass/issue-19398.rs | 4 +- src/test/run-pass/issue-19479.rs | 6 +- src/test/run-pass/issue-19499.rs | 20 + src/test/run-pass/issue-19631.rs | 1 + src/test/run-pass/issue-19632.rs | 1 + src/test/run-pass/issue-20055-box-trait.rs | 50 + .../run-pass/issue-20055-box-unsized-array.rs | 38 + src/test/run-pass/issue-20091.rs | 8 +- src/test/run-pass/issue-20343.rs | 38 + src/test/run-pass/issue-20414.rs | 27 + src/test/run-pass/issue-20454.rs | 19 + src/test/run-pass/issue-20575.rs | 19 + src/test/run-pass/issue-20644.rs | 2 +- src/test/run-pass/issue-20676.rs | 20 + src/test/run-pass/issue-2074.rs | 4 +- src/test/run-pass/issue-20763-1.rs | 35 + src/test/run-pass/issue-20763-2.rs | 30 + src/test/run-pass/issue-20797.rs | 94 + src/test/run-pass/issue-20823.rs | 17 + src/test/run-pass/issue-20953.rs | 19 + src/test/run-pass/issue-21033.rs | 53 + src/test/run-pass/issue-21058.rs | 29 + src/test/run-pass/issue-21245.rs | 62 + .../issue-21296.rs} | 10 +- src/test/run-pass/issue-21306.rs | 17 + src/test/run-pass/issue-21350.rs | 17 + src/test/run-pass/issue-21361.rs | 19 + .../issue-21363.rs} | 17 +- src/test/run-pass/issue-21384.rs | 29 + src/test/run-pass/issue-21402.rs | 18 + src/test/run-pass/issue-21520.rs | 29 + src/test/run-pass/issue-21634.rs | 22 + .../issue-21655.rs} | 13 +- src/test/run-pass/issue-21726.rs | 44 + src/test/run-pass/issue-2185.rs | 9 +- src/test/run-pass/issue-21891.rs | 16 + src/test/run-pass/issue-2190-1.rs | 4 +- src/test/run-pass/issue-21909.rs | 22 + src/test/run-pass/issue-22036.rs | 33 + src/test/run-pass/issue-2216.rs | 4 +- src/test/run-pass/issue-2288.rs | 3 +- src/test/run-pass/issue-2311-2.rs | 5 +- src/test/run-pass/issue-2311.rs | 2 +- src/test/run-pass/issue-2312.rs | 2 +- src/test/run-pass/issue-2383.rs | 6 +- src/test/run-pass/issue-2428.rs | 2 +- src/test/run-pass/issue-2550.rs | 2 +- src/test/run-pass/issue-2611-3.rs | 4 +- src/test/run-pass/issue-2633-2.rs | 2 +- src/test/run-pass/issue-2633.rs | 6 +- src/test/run-pass/issue-2718.rs | 2 +- src/test/run-pass/issue-2734.rs | 6 +- src/test/run-pass/issue-2735.rs | 6 +- src/test/run-pass/issue-2904.rs | 12 +- src/test/run-pass/issue-2935.rs | 6 +- src/test/run-pass/issue-2989.rs | 4 +- src/test/run-pass/issue-3026.rs | 3 +- src/test/run-pass/issue-3052.rs | 2 +- src/test/run-pass/issue-3091.rs | 4 +- src/test/run-pass/issue-3121.rs | 7 +- src/test/run-pass/issue-3211.rs | 4 +- src/test/run-pass/issue-3290.rs | 2 +- src/test/run-pass/issue-333.rs | 2 +- src/test/run-pass/issue-3389.rs | 2 +- src/test/run-pass/issue-3424.rs | 7 +- src/test/run-pass/issue-3429.rs | 4 +- src/test/run-pass/issue-3500.rs | 2 +- src/test/run-pass/issue-3556.rs | 2 +- src/test/run-pass/issue-3559.rs | 8 +- src/test/run-pass/issue-3563-2.rs | 2 +- src/test/run-pass/issue-3563-3.rs | 23 +- src/test/run-pass/issue-3609.rs | 2 +- src/test/run-pass/issue-3743.rs | 3 +- src/test/run-pass/issue-3753.rs | 6 +- src/test/run-pass/issue-3794.rs | 2 +- src/test/run-pass/issue-3878.rs | 2 +- src/test/run-pass/issue-4107.rs | 12 +- src/test/run-pass/issue-4241.rs | 4 +- src/test/run-pass/issue-4252.rs | 12 +- src/test/run-pass/issue-4333.rs | 4 +- src/test/run-pass/issue-4387.rs | 2 +- src/test/run-pass/issue-4401.rs | 4 +- src/test/run-pass/issue-4446.rs | 6 +- src/test/run-pass/issue-4448.rs | 4 +- src/test/run-pass/issue-4541.rs | 5 +- src/test/run-pass/issue-4542.rs | 6 +- src/test/run-pass/issue-5192.rs | 1 + src/test/run-pass/issue-5239-2.rs | 2 +- .../issue-5321-immediates-with-bare-self.rs | 2 +- src/test/run-pass/issue-5550.rs | 4 +- src/test/run-pass/issue-5666.rs | 2 +- src/test/run-pass/issue-5688.rs | 5 +- src/test/run-pass/issue-5708.rs | 6 +- src/test/run-pass/issue-5988.rs | 4 +- src/test/run-pass/issue-6117.rs | 2 +- src/test/run-pass/issue-6128.rs | 4 + src/test/run-pass/issue-6130.rs | 6 +- src/test/run-pass/issue-6157.rs | 2 +- src/test/run-pass/issue-6318.rs | 6 +- src/test/run-pass/issue-6557.rs | 1 + src/test/run-pass/issue-6892.rs | 4 +- src/test/run-pass/issue-7178.rs | 2 +- src/test/run-pass/issue-7563.rs | 4 +- src/test/run-pass/issue-7575.rs | 3 +- src/test/run-pass/issue-7660.rs | 2 +- ...7673-cast-generically-implemented-trait.rs | 5 +- src/test/run-pass/issue-7784.rs | 2 +- src/test/run-pass/issue-7911.rs | 4 +- src/test/run-pass/issue-8044.rs | 2 +- src/test/run-pass/issue-8248.rs | 4 +- src/test/run-pass/issue-8249.rs | 4 +- src/test/run-pass/issue-8391.rs | 6 +- src/test/run-pass/issue-8398.rs | 4 +- src/test/run-pass/issue-8460.rs | 48 +- src/test/run-pass/issue-8498.rs | 6 +- src/test/run-pass/issue-868.rs | 4 +- src/test/run-pass/issue-8783.rs | 2 +- src/test/run-pass/issue-8827.rs | 4 +- src/test/run-pass/issue-8860.rs | 6 +- src/test/run-pass/issue-8898.rs | 14 +- src/test/run-pass/issue-9129.rs | 2 +- src/test/run-pass/issue-9259.rs | 2 +- src/test/run-pass/issue-9382.rs | 4 +- src/test/run-pass/issue-9396.rs | 2 +- src/test/run-pass/issue-9719.rs | 14 +- src/test/run-pass/issue-9906.rs | 2 +- src/test/run-pass/issue-9942.rs | 2 +- .../issue22008.rs} | 14 +- src/test/run-pass/issue22346.rs | 17 + src/test/run-pass/istr.rs | 8 +- src/test/run-pass/item-attributes.rs | 4 +- .../run-pass/keyword-changes-2012-07-31.rs | 4 +- .../run-pass/kindck-owned-trait-contains-1.rs | 2 +- src/test/run-pass/labeled-break.rs | 4 +- src/test/run-pass/lambda-infer-unresolved.rs | 4 +- src/test/run-pass/lang-item-public.rs | 8 +- src/test/run-pass/last-use-in-cap-clause.rs | 9 +- src/test/run-pass/last-use-is-capture.rs | 2 +- src/test/run-pass/lazy-and-or.rs | 2 +- src/test/run-pass/lazy-init.rs | 2 +- src/test/run-pass/let-destruct-ref.rs | 2 +- src/test/run-pass/let-var-hygiene.rs | 6 +- src/test/run-pass/linear-for-loop.rs | 8 +- src/test/run-pass/linkage1.rs | 1 - src/test/run-pass/lint-cstack.rs | 2 +- src/test/run-pass/liveness-loop-break.rs | 2 +- .../log-knows-the-names-of-variants-in-std.rs | 8 +- .../log-knows-the-names-of-variants.rs | 8 +- src/test/run-pass/log-poly.rs | 6 +- src/test/run-pass/logging-only-prints-once.rs | 6 +- src/test/run-pass/logging-separate-lines.rs | 14 +- src/test/run-pass/long-while.rs | 2 +- src/test/run-pass/loop-break-cont-1.rs | 2 +- src/test/run-pass/loop-break-cont.rs | 20 +- src/test/run-pass/loop-diverges.rs | 2 +- src/test/run-pass/loop-label-shadowing.rs | 4 +- .../loop-no-reinit-needed-post-bot.rs | 2 +- src/test/run-pass/loop-scope.rs | 6 +- src/test/run-pass/macro-crate-def-only.rs | 2 +- .../run-pass/macro-delimiter-significance.rs | 2 +- .../run-pass/macro-export-inner-module.rs | 2 +- src/test/run-pass/macro-include-items.rs | 2 +- src/test/run-pass/macro-interpolation.rs | 2 +- src/test/run-pass/macro-of-higher-order.rs | 2 +- src/test/run-pass/macro-pat.rs | 30 +- .../macro-reexport-no-intermediate-use.rs | 2 +- src/test/run-pass/macro-reexport.rs | 2 +- src/test/run-pass/macro-stmt.rs | 8 +- src/test/run-pass/macro-with-attrs1.rs | 6 +- src/test/run-pass/macro-with-attrs2.rs | 6 +- src/test/run-pass/macro_with_super_2.rs | 20 + src/test/run-pass/match-arm-statics.rs | 13 +- src/test/run-pass/match-bot-2.rs | 2 +- src/test/run-pass/match-naked-record-expr.rs | 2 +- src/test/run-pass/match-naked-record.rs | 2 +- src/test/run-pass/match-pattern-bindings.rs | 6 +- src/test/run-pass/match-pipe-binding.rs | 10 +- src/test/run-pass/match-range.rs | 16 +- .../run-pass/match-ref-binding-mut-option.rs | 2 +- src/test/run-pass/match-str.rs | 6 +- src/test/run-pass/match-unique-bind.rs | 3 +- src/test/run-pass/match-vec-alternatives.rs | 30 +- src/test/run-pass/match-vec-rvalue.rs | 2 +- src/test/run-pass/match-with-ret-arm.rs | 2 +- src/test/run-pass/method-attributes.rs | 1 + .../method-early-bound-lifetimes-on-self.rs | 8 +- ...thod-mut-self-modifies-mut-slice-lvalue.rs | 4 +- .../run-pass/method-recursive-blanket-impl.rs | 8 +- src/test/run-pass/method-self-arg-trait.rs | 3 +- src/test/run-pass/method-self-arg.rs | 5 +- .../method-two-trait-defer-resolution-1.rs | 18 +- .../method-two-trait-defer-resolution-2.rs | 4 +- src/test/run-pass/method-where-clause.rs | 18 +- src/test/run-pass/monad.rs | 2 +- .../run-pass/monomorphize-abi-alignment.rs | 11 +- ...nomorphized-callees-with-ty-params-3314.rs | 11 +- src/test/run-pass/move-3-unique.rs | 2 +- src/test/run-pass/move-out-of-field.rs | 2 +- src/test/run-pass/multi-let.rs | 2 +- ...ispatch-conditional-impl-not-considered.rs | 2 +- src/test/run-pass/multidispatch1.rs | 7 +- src/test/run-pass/multidispatch2.rs | 9 +- src/test/run-pass/multiple-trait-bounds.rs | 2 +- src/test/run-pass/mut-function-arguments.rs | 2 +- src/test/run-pass/mut-in-ident-patterns.rs | 6 +- ...ility-inherits-through-fixed-length-vec.rs | 8 +- src/test/run-pass/native-print-no-runtime.rs | 1 + src/test/run-pass/negative.rs | 2 +- src/test/run-pass/nested-matchs.rs | 2 +- src/test/run-pass/new-box-syntax.rs | 8 +- src/test/run-pass/new-impl-syntax.rs | 4 +- src/test/run-pass/new-unicode-escapes.rs | 2 +- src/test/run-pass/newtype-polymorphic.rs | 2 +- src/test/run-pass/newtype-temporary.rs | 2 +- src/test/run-pass/newtype.rs | 6 +- src/test/run-pass/no-landing-pads.rs | 6 +- src/test/run-pass/no-std-xcrate2.rs | 1 + src/test/run-pass/nondrop-cycle.rs | 38 + .../run-pass/numeric-method-autoexport.rs | 24 +- ...ject-lifetime-default-default-to-static.rs | 42 + ...object-lifetime-default-from-ref-struct.rs | 47 + .../object-lifetime-default-from-rptr-box.rs | 42 + .../object-lifetime-default-from-rptr-mut.rs | 43 + ...bject-lifetime-default-from-rptr-struct.rs | 46 + .../object-lifetime-default-from-rptr.rs | 43 + src/test/run-pass/object-method-numbering.rs | 36 + .../run-pass/object-one-type-two-traits.rs | 2 +- .../objects-coerce-freeze-borrored.rs | 4 +- ...owned-object-borrowed-method-headerless.rs | 2 +- src/test/run-pass/operator-associativity.rs | 2 +- src/test/run-pass/operator-multidispatch.rs | 2 +- src/test/run-pass/operator-overloading.rs | 2 +- src/test/run-pass/or-pattern.rs | 2 +- src/test/run-pass/order-drop-with-match.rs | 2 +- .../out-of-stack-new-thread-no-split.rs | 17 +- src/test/run-pass/out-of-stack-no-split.rs | 17 +- src/test/run-pass/out-of-stack.rs | 25 +- src/test/run-pass/out-pointer-aliasing.rs | 3 +- src/test/run-pass/over-constrained-vregs.rs | 8 +- .../run-pass/overloaded-autoderef-count.rs | 2 +- .../run-pass/overloaded-autoderef-indexing.rs | 2 +- .../run-pass/overloaded-autoderef-order.rs | 10 +- .../run-pass/overloaded-autoderef-vtable.rs | 6 +- .../run-pass/overloaded-autoderef-xcrate.rs | 2 +- src/test/run-pass/overloaded-autoderef.rs | 17 +- .../overloaded-calls-param-vtables.rs | 11 +- src/test/run-pass/overloaded-calls-simple.rs | 27 +- .../run-pass/overloaded-calls-zero-args.rs | 9 +- src/test/run-pass/overloaded-deref-count.rs | 6 +- src/test/run-pass/overloaded-deref.rs | 16 +- .../run-pass/overloaded-index-assoc-list.rs | 8 +- .../run-pass/overloaded-index-autoderef.rs | 2 - src/test/run-pass/overloaded-index.rs | 2 - src/test/run-pass/owned-implies-static.rs | 2 +- src/test/run-pass/packed-struct-vec.rs | 8 +- .../run-pass/panic-in-dtor-drops-fields.rs | 4 +- .../parameterized-trait-with-bounds.rs | 8 +- src/test/run-pass/paren-free.rs | 2 +- .../run-pass/parse-complex-macro-invoc-op.rs | 22 +- src/test/run-pass/parse-panic.rs | 2 +- src/test/run-pass/path.rs | 2 +- .../run-pass/pattern-bound-var-in-for-each.rs | 6 +- src/test/run-pass/pattern-in-closure.rs | 4 +- src/test/run-pass/placement-new-arena.rs | 4 +- src/test/run-pass/priv-impl-prim-ty.rs | 2 +- src/test/run-pass/privacy-ns.rs | 3 + src/test/run-pass/private-class-field.rs | 4 +- src/test/run-pass/private-method.rs | 6 +- src/test/run-pass/process-remove-from-env.rs | 16 +- .../process-spawn-with-unicode-params.rs | 23 +- src/test/run-pass/ptr-coercion.rs | 14 +- src/test/run-pass/pub-extern-privacy.rs | 2 +- src/test/run-pass/pub-item-inside-macro.rs | 25 + src/test/run-pass/pub-method-inside-macro.rs | 29 + src/test/run-pass/pure-sum.rs | 16 +- src/test/run-pass/range-type-infer.rs | 28 + src/test/run-pass/range.rs | 18 +- src/test/run-pass/ranges-precedence.rs | 11 +- src/test/run-pass/rcvr-borrowed-to-slice.rs | 6 +- src/test/run-pass/realloc-16687.rs | 40 +- src/test/run-pass/rec-align-u32.rs | 14 +- src/test/run-pass/rec-align-u64.rs | 31 +- src/test/run-pass/rec-tup.rs | 3 +- src/test/run-pass/rec.rs | 6 +- src/test/run-pass/record-pat.rs | 4 +- .../reexported-static-methods-cross-crate.rs | 6 +- .../regions-assoc-type-region-bound.rs | 28 + .../regions-assoc-type-static-bound.rs | 25 + src/test/run-pass/regions-borrow-at.rs | 4 +- src/test/run-pass/regions-borrow-evec-uniq.rs | 4 +- src/test/run-pass/regions-borrow-uniq.rs | 4 +- .../regions-bound-lists-feature-gate-2.rs | 4 +- .../regions-bound-lists-feature-gate.rs | 5 +- src/test/run-pass/regions-copy-closure.rs | 4 +- .../run-pass/regions-debruijn-of-object.rs | 25 + .../run-pass/regions-dependent-addr-of.rs | 4 +- .../run-pass/regions-dependent-autoslice.rs | 2 +- ...egions-early-bound-lifetime-in-assoc-fn.rs | 6 +- .../regions-early-bound-trait-param.rs | 10 +- ...egions-early-bound-used-in-bound-method.rs | 3 +- .../regions-early-bound-used-in-bound.rs | 4 +- .../regions-early-bound-used-in-type-param.rs | 7 +- .../run-pass/regions-escape-into-other-fn.rs | 2 +- .../regions-infer-borrow-scope-addr-of.rs | 2 +- .../regions-infer-borrow-scope-view.rs | 6 +- ...gions-infer-borrow-scope-within-loop-ok.rs | 2 +- src/test/run-pass/regions-issue-21422.rs | 25 + src/test/run-pass/regions-issue-22246.rs | 35 + .../regions-lifetime-nonfree-late-bound.rs | 4 +- src/test/run-pass/regions-mock-tcx.rs | 35 +- .../regions-no-bound-in-argument-cleanup.rs | 4 +- .../regions-no-variance-from-fn-generics.rs | 10 +- src/test/run-pass/regions-params.rs | 4 +- src/test/run-pass/regions-refcell.rs | 53 + .../regions-return-interior-of-option.rs | 4 +- .../run-pass/regions-scope-chain-example.rs | 2 +- src/test/run-pass/regions-static-closure.rs | 2 +- src/test/run-pass/regions-trait-object-1.rs | 43 + src/test/run-pass/rename-directory.rs | 26 +- src/test/run-pass/repeated-vector-syntax.rs | 8 +- .../run-pass/resource-assign-is-not-copy.rs | 6 +- src/test/run-pass/ret-bang.rs | 4 +- src/test/run-pass/return-from-closure.rs | 4 +- src/test/run-pass/running-with-no-runtime.rs | 12 +- src/test/run-pass/rust-log-filter.rs | 12 +- src/test/run-pass/segfault-no-out-of-stack.rs | 15 +- src/test/run-pass/self-impl.rs | 1 + .../self-in-mut-slot-immediate-value.rs | 3 +- src/test/run-pass/self-re-assign.rs | 4 +- .../run-pass/send-is-not-static-par-for.rs | 47 + src/test/run-pass/send-type-inference.rs | 2 +- src/test/run-pass/send_str_hashmap.rs | 2 +- src/test/run-pass/send_str_treemap.rs | 2 +- src/test/run-pass/sendfn-is-a-block.rs | 6 +- src/test/run-pass/sendfn-spawn-with-fn-arg.rs | 6 +- src/test/run-pass/sepcomp-lib-lto.rs | 1 - src/test/run-pass/sepcomp-unwind.rs | 4 +- src/test/run-pass/seq-compare.rs | 18 +- src/test/run-pass/shadow.rs | 6 +- src/test/run-pass/shift.rs | 22 +- src/test/run-pass/show-boxed-slice.rs | 2 +- src/test/run-pass/signal-exit-status.rs | 11 +- src/test/run-pass/signed-shift-const-eval.rs | 2 +- .../run-pass/sigpipe-should-be-ignored.rs | 12 +- src/test/run-pass/simd-binop.rs | 26 +- src/test/run-pass/simd-generics.rs | 6 +- src/test/run-pass/simd-issue-10604.rs | 1 - src/test/run-pass/simple-infer.rs | 2 +- src/test/run-pass/simple-match-generic-tag.rs | 9 +- src/test/run-pass/slice-2.rs | 12 +- src/test/run-pass/slice-panic-1.rs | 4 +- src/test/run-pass/slice-panic-2.rs | 4 +- src/test/run-pass/slice.rs | 18 +- src/test/run-pass/small-enum-range-edge.rs | 6 +- src/test/run-pass/small-enums-with-fields.rs | 18 +- src/test/run-pass/smallest-hello-world.rs | 7 +- .../snake-case-no-lowercase-equivalent.rs | 17 + src/test/run-pass/spawn-types.rs | 4 +- src/test/run-pass/spawn.rs | 4 +- src/test/run-pass/spawn2.rs | 4 +- src/test/run-pass/stat.rs | 6 +- src/test/run-pass/static-assert.rs | 6 +- src/test/run-pass/static-fn-inline-xc.rs | 2 +- src/test/run-pass/static-fn-trait-xc.rs | 2 +- src/test/run-pass/static-impl.rs | 24 +- src/test/run-pass/static-methods-in-traits.rs | 2 +- src/test/run-pass/string-self-append.rs | 6 +- .../struct-lit-functional-no-fields.rs | 6 +- src/test/run-pass/struct-partial-move-1.rs | 4 +- src/test/run-pass/struct-partial-move-2.rs | 4 +- src/test/run-pass/struct-return.rs | 6 +- src/test/run-pass/structured-compare.rs | 12 +- .../run-pass/supertrait-default-generics.rs | 2 +- src/test/run-pass/supported-cast.rs | 34 +- src/test/run-pass/swap-1.rs | 2 +- src/test/run-pass/swap-2.rs | 2 +- .../includeme.fragment | 2 +- .../run-pass/syntax-extension-source-utils.rs | 2 +- src/test/run-pass/syntax-trait-polarity.rs | 12 +- src/test/run-pass/tag-align-dyn-u64.rs | 2 +- src/test/run-pass/tag-align-dyn-variants.rs | 42 +- src/test/run-pass/tag-align-shape.rs | 6 +- src/test/run-pass/tag-align-u64.rs | 2 +- src/test/run-pass/tag-disr-val-shape.rs | 2 +- .../tag-variant-disr-type-mismatch.rs | 2 +- src/test/run-pass/tag-variant-disr-val.rs | 3 +- src/test/run-pass/task-comm-12.rs | 2 +- src/test/run-pass/task-comm-16.rs | 2 +- src/test/run-pass/task-comm-3.rs | 4 +- src/test/run-pass/task-stderr.rs | 9 +- src/test/run-pass/tcp-accept-stress.rs | 12 +- src/test/run-pass/tcp-connect-timeouts.rs | 11 +- src/test/run-pass/tcp-stress.rs | 13 +- src/test/run-pass/tempfile.rs | 50 +- src/test/run-pass/terminate-in-initializer.rs | 8 +- ...e-verification-for-explicit-return-type.rs | 20 + src/test/run-pass/trailing-comma.rs | 18 +- src/test/run-pass/trait-bounds-basic.rs | 2 +- src/test/run-pass/trait-bounds-in-arc.rs | 12 +- .../trait-bounds-on-structs-and-enums.rs | 6 +- src/test/run-pass/trait-bounds-recursion.rs | 8 +- src/test/run-pass/trait-coercion-generic.rs | 3 +- src/test/run-pass/trait-coercion.rs | 7 +- .../trait-default-method-bound-subst.rs | 8 +- .../trait-default-method-bound-subst2.rs | 2 +- .../trait-default-method-bound-subst3.rs | 4 +- .../trait-default-method-bound-subst4.rs | 5 +- .../run-pass/trait-default-method-bound.rs | 2 +- .../run-pass/trait-default-method-xc-2.rs | 8 +- src/test/run-pass/trait-default-method-xc.rs | 24 +- ...se-ambiguity-where-clause-builtin-bound.rs | 23 + src/test/run-pass/trait-generic.rs | 4 +- src/test/run-pass/trait-impl.rs | 6 +- src/test/run-pass/trait-inheritance-num.rs | 4 +- src/test/run-pass/trait-inheritance-num0.rs | 2 +- src/test/run-pass/trait-inheritance-num1.rs | 2 +- src/test/run-pass/trait-inheritance-num2.rs | 3 +- src/test/run-pass/trait-inheritance-num3.rs | 2 +- src/test/run-pass/trait-inheritance-num5.rs | 2 +- .../trait-inheritance-overloading-simple.rs | 2 +- .../run-pass/trait-inheritance-overloading.rs | 2 +- .../run-pass/trait-inheritance-static2.rs | 4 +- .../run-pass/trait-inheritance-visibility.rs | 2 +- src/test/run-pass/trait-object-generics.rs | 11 +- .../trait-object-with-lifetime-bound.rs | 42 + .../trait-static-method-overwriting.rs | 10 +- src/test/run-pass/trait-to-str.rs | 6 +- .../run-pass/traits-conditional-dispatch.rs | 2 +- src/test/run-pass/traits-issue-22019.rs | 41 + src/test/run-pass/traits-issue-22110.rs | 34 + src/test/run-pass/traits-negative-impls.rs | 29 + src/test/run-pass/trivial-message.rs | 2 +- src/test/run-pass/tuple-index-fat-types.rs | 4 +- src/test/run-pass/tuple-index.rs | 2 +- src/test/run-pass/tuple-struct-construct.rs | 2 +- .../tuple-struct-constructor-pointer.rs | 4 +- src/test/run-pass/type-id-higher-rank.rs | 6 +- src/test/run-pass/type-param-constraints.rs | 12 +- src/test/run-pass/type-params-in-for-each.rs | 4 +- .../run-pass/typeck_type_placeholder_1.rs | 10 +- .../run-pass/typeclasses-eq-example-static.rs | 4 +- src/test/run-pass/typeclasses-eq-example.rs | 4 +- src/test/run-pass/typeid-intrinsic.rs | 43 +- src/test/run-pass/typestate-cfg-nesting.rs | 6 +- src/test/run-pass/typestate-multi-decl.rs | 2 +- src/test/run-pass/ufcs-explicit-self.rs | 6 +- src/test/run-pass/ufcs-trait-object.rs | 25 + .../run-pass/unboxed-closures-all-traits.rs | 6 +- src/test/run-pass/unboxed-closures-boxed.rs | 6 +- src/test/run-pass/unboxed-closures-by-ref.rs | 10 +- .../unboxed-closures-counter-not-moved.rs | 36 + .../run-pass/unboxed-closures-cross-crate.rs | 4 +- .../unboxed-closures-direct-sugary-call.rs | 2 +- src/test/run-pass/unboxed-closures-drop.rs | 18 +- ...unboxed-closures-fn-as-fnmut-and-fnonce.rs | 11 +- .../unboxed-closures-fnmut-as-fnonce.rs | 10 +- src/test/run-pass/unboxed-closures-generic.rs | 4 +- ...nfer-argument-types-from-expected-bound.rs | 2 +- ...rgument-types-from-expected-object-type.rs | 2 +- ...-with-bound-regions-from-expected-bound.rs | 2 +- ...oxed-closures-infer-fnmut-calling-fnmut.rs | 29 + .../unboxed-closures-infer-fnmut-move.rs | 25 + .../run-pass/unboxed-closures-infer-fnmut.rs | 24 + .../unboxed-closures-infer-fnonce-move.rs | 37 + .../run-pass/unboxed-closures-infer-fnonce.rs | 37 + .../run-pass/unboxed-closures-infer-kind.rs | 4 +- .../unboxed-closures-infer-recursive-fn.rs | 47 + .../run-pass/unboxed-closures-infer-upvar.rs | 22 + .../run-pass/unboxed-closures-manual-impl.rs | 10 +- .../unboxed-closures-monomorphization.rs | 12 +- .../run-pass/unboxed-closures-move-mutable.rs | 16 +- ...ures-move-some-upvars-in-by-ref-closure.rs | 32 + src/test/run-pass/unboxed-closures-prelude.rs | 10 +- src/test/run-pass/unboxed-closures-simple.rs | 2 +- .../unboxed-closures-single-word-env.rs | 6 +- .../unboxed-closures-static-call-fn-once.rs | 4 +- .../run-pass/unboxed-closures-sugar-object.rs | 2 +- .../unboxed-closures-unique-type-id.rs | 8 +- .../run-pass/unboxed-closures-zero-args.rs | 4 +- src/test/run-pass/unify-return-ty.rs | 2 +- src/test/run-pass/unique-assign-copy.rs | 2 +- src/test/run-pass/unique-assign-drop.rs | 4 +- src/test/run-pass/unique-assign-generic.rs | 4 +- src/test/run-pass/unique-assign.rs | 2 +- src/test/run-pass/unique-autoderef-index.rs | 4 +- src/test/run-pass/unique-cmp.rs | 12 +- src/test/run-pass/unique-create.rs | 4 +- src/test/run-pass/unique-decl-init-copy.rs | 10 +- src/test/run-pass/unique-decl-init.rs | 2 +- src/test/run-pass/unique-decl-move.rs | 2 +- src/test/run-pass/unique-deref.rs | 2 +- src/test/run-pass/unique-destructure.rs | 1 + src/test/run-pass/unique-drop-complex.rs | 2 +- src/test/run-pass/unique-fn-arg-move.rs | 2 +- src/test/run-pass/unique-in-vec-copy.rs | 2 +- src/test/run-pass/unique-in-vec.rs | 2 +- src/test/run-pass/unique-init.rs | 2 +- src/test/run-pass/unique-kinds.rs | 24 +- src/test/run-pass/unique-log.rs | 2 +- src/test/run-pass/unique-move-drop.rs | 4 +- src/test/run-pass/unique-move-temp.rs | 2 +- src/test/run-pass/unique-move.rs | 2 +- src/test/run-pass/unique-mutable.rs | 2 +- src/test/run-pass/unique-object-move.rs | 2 +- src/test/run-pass/unique-pat-2.rs | 3 +- src/test/run-pass/unique-pat.rs | 1 + src/test/run-pass/unique-send-2.rs | 14 +- src/test/run-pass/unique-send.rs | 4 +- src/test/run-pass/unique-swap.rs | 8 +- .../run-pass/unit-like-struct-drop-run.rs | 8 +- src/test/run-pass/unreachable-code.rs | 2 +- src/test/run-pass/unsized.rs | 24 +- src/test/run-pass/unsized2.rs | 12 +- src/test/run-pass/unused-move-capture.rs | 4 +- src/test/run-pass/unused-move.rs | 2 +- src/test/run-pass/unwind-resource.rs | 4 +- src/test/run-pass/unwind-unique.rs | 6 +- src/test/run-pass/use-uninit-match.rs | 2 +- src/test/run-pass/use-uninit-match2.rs | 2 +- src/test/run-pass/use.rs | 5 +- src/test/run-pass/utf8.rs | 2 +- src/test/run-pass/utf8_chars.rs | 10 +- src/test/run-pass/utf8_idents.rs | 26 +- src/test/run-pass/variadic-ffi.rs | 12 +- ...ariance-intersection-of-ref-and-opt-ref.rs | 34 + src/test/run-pass/variance-trait-matching.rs | 49 + src/test/run-pass/variance-vec-covariant.rs | 28 + src/test/run-pass/variant-attributes.rs | 1 + src/test/run-pass/vec-concat.rs | 2 +- src/test/run-pass/vec-fixed-length.rs | 4 +- src/test/run-pass/vec-growth.rs | 10 +- src/test/run-pass/vec-macro-no-std.rs | 2 +- src/test/run-pass/vec-macro-repeat.rs | 22 + src/test/run-pass/vec-macro-rvalue-scope.rs | 18 + src/test/run-pass/vec-macro-with-brackets.rs | 2 +- .../run-pass/vec-macro-with-trailing-comma.rs | 4 +- src/test/run-pass/vec-matching-autoslice.rs | 4 +- src/test/run-pass/vec-matching-fixed.rs | 2 +- src/test/run-pass/vec-matching-fold.rs | 6 +- .../vec-matching-legal-tail-element-borrow.rs | 2 +- src/test/run-pass/vec-matching.rs | 16 +- src/test/run-pass/vec-push.rs | 2 +- src/test/run-pass/vec-repeat-with-cast.rs | 2 +- src/test/run-pass/vec-slice.rs | 4 +- src/test/run-pass/vec-tail-matching.rs | 4 +- src/test/run-pass/vec-to_str.rs | 8 +- src/test/run-pass/vec_cycle.rs | 47 + src/test/run-pass/vec_cycle_wrapped.rs | 58 + src/test/run-pass/vector-sort-panic-safe.rs | 54 +- .../visible-private-types-feature-gate.rs | 2 +- .../run-pass/wait-forked-but-failed-child.rs | 12 +- src/test/run-pass/warn-ctypes-inhibit.rs | 4 +- src/test/run-pass/weak-lang-item.rs | 4 +- src/test/run-pass/weird-exprs.rs | 10 +- .../where-clause-bounds-inconsistency.rs | 30 + .../where-clause-early-bound-lifetimes.rs | 2 +- .../where-clause-method-substituion.rs | 4 +- .../run-pass/where-clause-region-outlives.rs | 4 +- .../run-pass/where-clauses-cross-crate.rs | 6 +- src/test/run-pass/where-clauses-lifetimes.rs | 2 +- src/test/run-pass/where-clauses-method.rs | 4 +- .../where-clauses-unboxed-closures.rs | 4 +- src/test/run-pass/where-clauses.rs | 6 +- src/test/run-pass/where-for-self.rs | 65 + src/test/run-pass/while-cont.rs | 2 +- src/test/run-pass/while-flow-graph.rs | 2 +- src/test/run-pass/while-label.rs | 4 +- src/test/run-pass/while-let.rs | 12 +- src/test/run-pass/x86stdcall.rs | 5 +- src/test/run-pass/x86stdcall2.rs | 2 +- src/test/run-pass/yield.rs | 10 +- src/test/run-pass/yield1.rs | 6 +- src/test/run-pass/yield2.rs | 4 +- .../run-pass/zero-size-type-destructors.rs | 2 + .../run-pass/zero_sized_subslice_match.rs | 19 + 5275 files changed, 222436 insertions(+), 115574 deletions(-) delete mode 100644 debian/README.Debian delete mode 100644 debian/README.source delete mode 100644 debian/TODO.Debian delete mode 100644 debian/changelog delete mode 100644 debian/compat delete mode 100644 debian/control delete mode 100644 debian/copyright delete mode 100644 debian/gbp.conf delete mode 100644 debian/kate-syntax-rust.install delete mode 100755 debian/make_orig-dl_tarball.py delete mode 100755 debian/rules delete mode 100644 debian/rust-doc.doc-base.book delete mode 100644 debian/rust-doc.doc-base.intro delete mode 100644 debian/rust-doc.doc-base.reference delete mode 100644 debian/rust-doc.docs delete mode 100644 debian/rust-doc.install delete mode 100644 debian/rust-mode.docs delete mode 100755 debian/rust-mode.emacsen-install delete mode 100755 debian/rust-mode.emacsen-remove delete mode 100644 debian/rust-mode.emacsen-startup delete mode 100644 debian/rust-mode.install delete mode 100644 debian/rust.install delete mode 100644 debian/rust.lintian-overrides delete mode 100644 debian/rust.manpages delete mode 100644 debian/source/format delete mode 100644 debian/source/include-binaries delete mode 100644 debian/source/lintian-overrides delete mode 100644 debian/vim-syntax-rust.install delete mode 100644 debian/vim-syntax-rust.yaml delete mode 100644 debian/watch create mode 100644 mk/cfg/aarch64-apple-ios.mk create mode 100644 mk/cfg/aarch64-linux-android.mk delete mode 100644 mk/cfg/arm-apple-ios.mk create mode 100644 mk/cfg/armv7-apple-ios.mk create mode 100644 mk/cfg/armv7s-apple-ios.mk create mode 100644 mk/cfg/powerpc-unknown-linux-gnu.mk create mode 100644 mk/cfg/x86_64-apple-ios.mk create mode 100644 mk/cfg/x86_64-unknown-openbsd.mk create mode 100644 src/compiler-rt/lib/builtins/aarch64/Makefile.mk delete mode 100644 src/doc/complement-bugreport.md create mode 100644 src/doc/grammar.md create mode 100644 src/doc/guide-crates.md create mode 100644 src/doc/guide-error-handling.md create mode 100644 src/doc/guide-ffi.md create mode 100644 src/doc/guide-macros.md create mode 100644 src/doc/guide-ownership.md create mode 100644 src/doc/guide-plugins.md create mode 100644 src/doc/guide-pointers.md create mode 100644 src/doc/guide-strings.md create mode 100644 src/doc/guide-tasks.md create mode 100644 src/doc/guide-testing.md create mode 100644 src/doc/guide-unsafe.md create mode 100644 src/doc/guide.md create mode 100644 src/doc/style/README.md create mode 100644 src/doc/style/SUMMARY.md create mode 100644 src/doc/style/changing/README.md create mode 100644 src/doc/style/changing/post-1-0.md create mode 100644 src/doc/style/changing/pre-1-0.md create mode 100644 src/doc/style/changing/unclear.md create mode 100644 src/doc/style/errors/README.md create mode 100644 src/doc/style/errors/ergonomics.md create mode 100644 src/doc/style/errors/handling.md create mode 100644 src/doc/style/errors/propagation.md create mode 100644 src/doc/style/errors/signaling.md create mode 100644 src/doc/style/features/README.md create mode 100644 src/doc/style/features/crates.md create mode 100644 src/doc/style/features/functions-and-methods/README.md create mode 100644 src/doc/style/features/functions-and-methods/convenience.md create mode 100644 src/doc/style/features/functions-and-methods/input.md create mode 100644 src/doc/style/features/functions-and-methods/output.md create mode 100644 src/doc/style/features/let.md create mode 100644 src/doc/style/features/loops.md create mode 100644 src/doc/style/features/match.md create mode 100644 src/doc/style/features/modules.md create mode 100644 src/doc/style/features/traits/README.md create mode 100644 src/doc/style/features/traits/common.md create mode 100644 src/doc/style/features/traits/extensions.md create mode 100644 src/doc/style/features/traits/generics.md create mode 100644 src/doc/style/features/traits/objects.md create mode 100644 src/doc/style/features/traits/overloading.md create mode 100644 src/doc/style/features/traits/reuse.md create mode 100644 src/doc/style/features/types/README.md create mode 100644 src/doc/style/features/types/conversions.md create mode 100644 src/doc/style/features/types/newtype.md create mode 100644 src/doc/style/ownership/README.md create mode 100644 src/doc/style/ownership/builders.md create mode 100644 src/doc/style/ownership/cell-smart.md create mode 100644 src/doc/style/ownership/constructors.md create mode 100644 src/doc/style/ownership/destructors.md create mode 100644 src/doc/style/ownership/raii.md create mode 100644 src/doc/style/platform.md create mode 100644 src/doc/style/safety/README.md create mode 100644 src/doc/style/safety/lib-guarantees.md create mode 100644 src/doc/style/safety/unsafe.md create mode 100644 src/doc/style/style/README.md create mode 100644 src/doc/style/style/braces.md create mode 100644 src/doc/style/style/comments.md create mode 100644 src/doc/style/style/features.md create mode 100644 src/doc/style/style/imports.md create mode 100644 src/doc/style/style/naming/README.md create mode 100644 src/doc/style/style/naming/containers.md create mode 100644 src/doc/style/style/naming/conversions.md create mode 100644 src/doc/style/style/naming/iterators.md create mode 100644 src/doc/style/style/naming/ownership.md create mode 100644 src/doc/style/style/optional.md create mode 100644 src/doc/style/style/organization.md create mode 100644 src/doc/style/style/whitespace.md create mode 100644 src/doc/style/testing/README.md create mode 100644 src/doc/style/testing/unit.md create mode 100644 src/doc/style/todo.md create mode 100644 src/doc/trpl/advanced-macros.md create mode 100644 src/doc/trpl/concurrency.md create mode 100644 src/doc/trpl/documentation.md create mode 100644 src/doc/trpl/glossary.md create mode 100644 src/doc/trpl/more-strings.md delete mode 100644 src/doc/trpl/rust-book.css create mode 100644 src/doc/trpl/static-and-dynamic-dispatch.md delete mode 100644 src/doc/trpl/tasks.md create mode 100644 src/etc/CONFIGS.md delete mode 100755 src/etc/check-links.pl delete mode 100644 src/etc/emacs/README.md delete mode 100755 src/etc/emacs/run_rust_emacs_tests.sh delete mode 100644 src/etc/emacs/rust-mode-tests.el delete mode 100644 src/etc/emacs/rust-mode.el create mode 100644 src/etc/errorck.py create mode 100644 src/etc/featureck.py delete mode 100644 src/etc/gedit/readme.txt delete mode 100644 src/etc/gedit/share/gtksourceview-3.0/language-specs/rust.lang delete mode 100644 src/etc/gedit/share/mime/packages/rust.xml create mode 100644 src/etc/htmldocck.py delete mode 100644 src/etc/kate/rust.xml delete mode 100644 src/etc/vim/after/syntax/rust.vim delete mode 100644 src/etc/vim/autoload/rust.vim delete mode 100644 src/etc/vim/compiler/cargo.vim delete mode 100644 src/etc/vim/compiler/rustc.vim delete mode 100644 src/etc/vim/doc/rust.txt delete mode 100644 src/etc/vim/ftdetect/rust.vim delete mode 100644 src/etc/vim/ftplugin/rust.vim delete mode 100644 src/etc/vim/indent/rust.vim delete mode 100644 src/etc/vim/plugin/rust.vim delete mode 100644 src/etc/vim/syntax/rust.vim delete mode 100644 src/etc/vim/syntax_checkers/rust/rustc.vim delete mode 100644 src/etc/zsh/_rust create mode 100644 src/liballoc/boxed_test.rs create mode 100644 src/libcollections/borrow.rs create mode 100644 src/libcollections/borrow_stage0.rs rename src/{libstd => libcollections}/fmt.rs (85%) rename src/libcollections/{dlist.rs => linked_list.rs} (58%) rename src/libcollections/{ring_buf.rs => vec_deque.rs} (67%) delete mode 100644 src/libcore/borrow.rs rename src/{libstd => libcore}/error.rs (73%) rename src/libcore/fmt/{rt.rs => rt/v1.rs} (52%) delete mode 100644 src/libgraphviz/maybe_owned_vec.rs delete mode 100644 src/libregex/compile.rs delete mode 100644 src/libregex/lib.rs delete mode 100644 src/libregex/parse.rs delete mode 100644 src/libregex/re.rs delete mode 100644 src/libregex/test/bench.rs delete mode 100644 src/libregex/test/matches.rs delete mode 100644 src/libregex/test/tests.rs delete mode 100644 src/libregex/testdata/LICENSE delete mode 100644 src/libregex/testdata/README delete mode 100644 src/libregex/testdata/basic.dat delete mode 100644 src/libregex/testdata/nullsubexpr.dat delete mode 100644 src/libregex/testdata/repetition.dat delete mode 100644 src/libregex/vm.rs create mode 100644 src/librustc/metadata/macro_import.rs delete mode 100644 src/librustc/middle/check_static.rs create mode 100644 src/librustc/middle/infer/README.md create mode 100644 src/librustc/middle/infer/bivariate.rs delete mode 100644 src/librustc/middle/infer/doc.rs create mode 100644 src/librustc/middle/infer/higher_ranked/README.md delete mode 100644 src/librustc/middle/infer/higher_ranked/doc.rs create mode 100644 src/librustc/middle/infer/region_inference/README.md delete mode 100644 src/librustc/middle/infer/region_inference/doc.rs rename src/librustc/middle/traits/{doc.rs => README.md} (82%) create mode 100644 src/librustc_back/target/aarch64_apple_ios.rs create mode 100644 src/librustc_back/target/aarch64_linux_android.rs create mode 100644 src/librustc_back/target/apple_ios_base.rs delete mode 100644 src/librustc_back/target/arm_apple_ios.rs create mode 100644 src/librustc_back/target/armv7_apple_ios.rs create mode 100644 src/librustc_back/target/armv7s_apple_ios.rs create mode 100644 src/librustc_back/target/openbsd_base.rs create mode 100644 src/librustc_back/target/powerpc_unknown_linux_gnu.rs create mode 100644 src/librustc_back/target/x86_64_apple_ios.rs create mode 100644 src/librustc_back/target/x86_64_unknown_openbsd.rs rename src/{libstd/bitflags.rs => librustc_bitflags/lib.rs} (95%) create mode 100644 src/librustc_borrowck/borrowck/README.md delete mode 100644 src/librustc_borrowck/borrowck/doc.rs create mode 100644 src/librustc_privacy/lib.rs create mode 100644 src/librustc_resolve/diagnostics.rs create mode 100644 src/librustc_trans/trans/cabi_powerpc.rs delete mode 100644 src/librustc_trans/trans/doc.rs rename src/{librustc/middle/infer => librustc_typeck/check}/coercion.rs (66%) create mode 100644 src/librustc_typeck/check/compare_method.rs create mode 100644 src/librustc_typeck/check/dropck.rs rename src/librustc_typeck/check/{regionmanip.rs => implicator.rs} (52%) create mode 100644 src/librustc_typeck/check/method/README.md delete mode 100644 src/librustc_typeck/check/method/doc.rs create mode 100644 src/librustc_typeck/check/method/suggest.rs create mode 100644 src/librustc_typeck/coherence/impls.rs create mode 100644 src/librustc_typeck/constrained_type_params.rs delete mode 100644 src/libserialize/base64.rs create mode 100644 src/libstd/collections/hash/map_stage0.rs create mode 100644 src/libstd/collections/hash/set_stage0.rs create mode 100644 src/libstd/env.rs create mode 100644 src/libstd/ffi/os_str.rs create mode 100644 src/libstd/fs.rs create mode 100644 src/libstd/io/cursor.rs create mode 100644 src/libstd/io/error.rs create mode 100644 src/libstd/io/impls.rs create mode 100644 src/libstd/io/prelude.rs create mode 100644 src/libstd/net/addr.rs create mode 100644 src/libstd/net/ip.rs create mode 100644 src/libstd/net/mod.rs create mode 100644 src/libstd/net/parser.rs create mode 100644 src/libstd/net/tcp.rs create mode 100644 src/libstd/net/test.rs create mode 100644 src/libstd/net/udp.rs create mode 100644 src/libstd/old_io/buffered.rs rename src/libstd/{io => old_io}/comm_adapters.rs (84%) rename src/libstd/{io => old_io}/extensions.rs (88%) rename src/libstd/{io => old_io}/fs.rs (84%) rename src/libstd/{io => old_io}/mem.rs (86%) create mode 100644 src/libstd/old_io/mod.rs rename src/libstd/{io => old_io}/net/addrinfo.rs (94%) rename src/libstd/{io => old_io}/net/ip.rs (81%) rename src/libstd/{io => old_io}/net/mod.rs (93%) rename src/libstd/{io => old_io}/net/pipe.rs (90%) rename src/libstd/{io => old_io}/net/tcp.rs (90%) rename src/libstd/{io => old_io}/net/udp.rs (91%) rename src/libstd/{io => old_io}/pipe.rs (94%) rename src/libstd/{io => old_io}/process.rs (91%) rename src/libstd/{io => old_io}/result.rs (79%) rename src/libstd/{io => old_io}/stdio.rs (95%) rename src/libstd/{io => old_io}/tempfile.rs (93%) rename src/libstd/{io => old_io}/test.rs (83%) rename src/libstd/{io => old_io}/timer.rs (95%) create mode 100644 src/libstd/old_io/util.rs rename src/libstd/{path => old_path}/mod.rs (97%) rename src/libstd/{path => old_path}/posix.rs (95%) rename src/libstd/{path => old_path}/windows.rs (96%) rename src/libstd/{failure.rs => panicking.rs} (86%) create mode 100755 src/libstd/path.rs create mode 100644 src/libstd/process.rs create mode 100644 src/libstd/sys/common/net2.rs create mode 100644 src/libstd/sys/common/wtf8.rs create mode 100644 src/libstd/sys/unix/fd.rs create mode 100644 src/libstd/sys/unix/fs2.rs create mode 100644 src/libstd/sys/unix/net.rs create mode 100644 src/libstd/sys/unix/os_str.rs create mode 100644 src/libstd/sys/unix/pipe2.rs create mode 100644 src/libstd/sys/unix/process2.rs create mode 100644 src/libstd/sys/unix/time.rs create mode 100644 src/libstd/sys/windows/fs2.rs create mode 100644 src/libstd/sys/windows/handle.rs create mode 100644 src/libstd/sys/windows/net.rs create mode 100644 src/libstd/sys/windows/os_str.rs create mode 100644 src/libstd/sys/windows/pipe2.rs create mode 100644 src/libstd/sys/windows/process2.rs create mode 100644 src/libstd/sys/windows/time.rs delete mode 100644 src/libsyntax/ext/cfg_attr.rs create mode 100644 src/llvm/bindings/go/README.txt create mode 100755 src/llvm/bindings/go/build.sh create mode 100644 src/llvm/bindings/go/conftest.go create mode 100644 src/llvm/bindings/go/llvm/DIBuilderBindings.cpp create mode 100644 src/llvm/bindings/go/llvm/DIBuilderBindings.h create mode 100644 src/llvm/bindings/go/llvm/IRBindings.cpp create mode 100644 src/llvm/bindings/go/llvm/IRBindings.h create mode 100644 src/llvm/bindings/go/llvm/InstrumentationBindings.cpp create mode 100644 src/llvm/bindings/go/llvm/InstrumentationBindings.h create mode 100644 src/llvm/bindings/go/llvm/SupportBindings.cpp create mode 100644 src/llvm/bindings/go/llvm/SupportBindings.h create mode 100644 src/llvm/bindings/go/llvm/analysis.go create mode 100644 src/llvm/bindings/go/llvm/bitreader.go create mode 100644 src/llvm/bindings/go/llvm/bitwriter.go create mode 100644 src/llvm/bindings/go/llvm/dibuilder.go create mode 100644 src/llvm/bindings/go/llvm/executionengine.go create mode 100644 src/llvm/bindings/go/llvm/executionengine_test.go create mode 100644 src/llvm/bindings/go/llvm/ir.go create mode 100644 src/llvm/bindings/go/llvm/ir_test.go create mode 100644 src/llvm/bindings/go/llvm/linker.go create mode 100644 src/llvm/bindings/go/llvm/llvm_config.go.in create mode 100644 src/llvm/bindings/go/llvm/llvm_dep.go create mode 100644 src/llvm/bindings/go/llvm/string.go create mode 100644 src/llvm/bindings/go/llvm/string_test.go create mode 100644 src/llvm/bindings/go/llvm/support.go create mode 100644 src/llvm/bindings/go/llvm/target.go create mode 100644 src/llvm/bindings/go/llvm/transforms_instrumentation.go create mode 100644 src/llvm/bindings/go/llvm/transforms_ipo.go create mode 100644 src/llvm/bindings/go/llvm/transforms_pmbuilder.go create mode 100644 src/llvm/bindings/go/llvm/transforms_scalar.go create mode 100644 src/llvm/bindings/go/llvm/version.go create mode 100644 src/llvm/bindings/ocaml/CMakeLists.txt create mode 100644 src/llvm/bindings/ocaml/all_backends/CMakeLists.txt create mode 100644 src/llvm/bindings/ocaml/analysis/CMakeLists.txt create mode 100644 src/llvm/bindings/ocaml/backends/CMakeLists.txt create mode 100644 src/llvm/bindings/ocaml/bitreader/CMakeLists.txt create mode 100644 src/llvm/bindings/ocaml/bitwriter/CMakeLists.txt create mode 100644 src/llvm/bindings/ocaml/executionengine/CMakeLists.txt create mode 100644 src/llvm/bindings/ocaml/irreader/CMakeLists.txt create mode 100644 src/llvm/bindings/ocaml/linker/CMakeLists.txt create mode 100644 src/llvm/bindings/ocaml/llvm/CMakeLists.txt create mode 100644 src/llvm/bindings/ocaml/target/CMakeLists.txt create mode 100644 src/llvm/bindings/ocaml/transforms/CMakeLists.txt create mode 100644 src/llvm/bindings/ocaml/transforms/ipo/CMakeLists.txt create mode 100644 src/llvm/bindings/ocaml/transforms/passmgr_builder/CMakeLists.txt delete mode 100644 src/llvm/bindings/ocaml/transforms/scalar/llvm_scalar_opts.ml delete mode 100644 src/llvm/bindings/ocaml/transforms/scalar/llvm_scalar_opts.mli create mode 100644 src/llvm/bindings/ocaml/transforms/scalar_opts/CMakeLists.txt rename src/llvm/bindings/ocaml/transforms/{scalar => scalar_opts}/Makefile (89%) create mode 100644 src/llvm/bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.ml create mode 100644 src/llvm/bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.mli rename src/llvm/bindings/ocaml/transforms/{scalar => scalar_opts}/scalar_opts_ocaml.c (79%) create mode 100644 src/llvm/bindings/ocaml/transforms/utils/CMakeLists.txt create mode 100644 src/llvm/bindings/ocaml/transforms/utils/Makefile create mode 100644 src/llvm/bindings/ocaml/transforms/utils/llvm_transform_utils.ml create mode 100644 src/llvm/bindings/ocaml/transforms/utils/llvm_transform_utils.mli create mode 100644 src/llvm/bindings/ocaml/transforms/utils/transform_utils_ocaml.c create mode 100644 src/llvm/bindings/ocaml/transforms/vectorize/CMakeLists.txt create mode 100644 src/llvm/cmake/modules/AddOCaml.cmake create mode 100644 src/llvm/cmake/modules/FindOCaml.cmake create mode 100644 src/llvm/docs/MergeFunctions.rst create mode 100644 src/llvm/docs/R600Usage.rst create mode 100644 src/llvm/docs/Statepoints.rst create mode 100644 src/llvm/docs/tutorial/LangImpl9.rst create mode 100644 src/llvm/examples/Kaleidoscope/Chapter8/CMakeLists.txt rename src/llvm/{unittests/Transforms/DebugIR => examples/Kaleidoscope/Chapter8}/Makefile (57%) create mode 100644 src/llvm/examples/Kaleidoscope/Chapter8/toy.cpp create mode 100644 src/llvm/include/llvm/Analysis/AssumptionCache.h delete mode 100644 src/llvm/include/llvm/Analysis/AssumptionTracker.h delete mode 100644 src/llvm/include/llvm/Analysis/FindUsedTypes.h rename src/llvm/{lib/CodeGen/AsmPrinter => include/llvm/CodeGen}/DIE.h (100%) create mode 100644 src/llvm/include/llvm/CodeGen/ForwardControlFlowIntegrity.h delete mode 100644 src/llvm/include/llvm/CodeGen/PBQP/RegAllocSolver.h create mode 100644 src/llvm/include/llvm/CodeGen/PBQPRAConstraint.h rename src/llvm/{lib => include/llvm}/DebugInfo/DWARFAbbreviationDeclaration.h (100%) create mode 100644 src/llvm/include/llvm/DebugInfo/DWARFAcceleratorTable.h rename src/llvm/{lib => include/llvm}/DebugInfo/DWARFCompileUnit.h (67%) rename src/llvm/{lib => include/llvm}/DebugInfo/DWARFContext.h (80%) rename src/llvm/{lib => include/llvm}/DebugInfo/DWARFDebugAbbrev.h (96%) rename src/llvm/{lib => include/llvm}/DebugInfo/DWARFDebugArangeSet.h (100%) rename src/llvm/{lib => include/llvm}/DebugInfo/DWARFDebugAranges.h (100%) rename src/llvm/{lib => include/llvm}/DebugInfo/DWARFDebugFrame.h (100%) rename src/llvm/{lib => include/llvm}/DebugInfo/DWARFDebugInfoEntry.h (93%) rename src/llvm/{lib => include/llvm}/DebugInfo/DWARFDebugLine.h (99%) rename src/llvm/{lib => include/llvm}/DebugInfo/DWARFDebugLoc.h (98%) rename src/llvm/{lib => include/llvm}/DebugInfo/DWARFDebugRangeList.h (100%) rename src/llvm/{lib => include/llvm}/DebugInfo/DWARFRelocMap.h (100%) create mode 100644 src/llvm/include/llvm/DebugInfo/DWARFSection.h rename src/llvm/{lib => include/llvm}/DebugInfo/DWARFTypeUnit.h (72%) rename src/llvm/{lib => include/llvm}/DebugInfo/DWARFUnit.h (77%) delete mode 100644 src/llvm/include/llvm/ExecutionEngine/ObjectBuffer.h delete mode 100644 src/llvm/include/llvm/ExecutionEngine/ObjectImage.h delete mode 100644 src/llvm/include/llvm/IR/LeakDetector.h create mode 100644 src/llvm/include/llvm/IR/Metadata.def create mode 100644 src/llvm/include/llvm/IR/MetadataTracking.h create mode 100644 src/llvm/include/llvm/IR/PassManagerInternal.h create mode 100644 src/llvm/include/llvm/IR/Statepoint.h create mode 100644 src/llvm/include/llvm/IR/TrackingMDRef.h create mode 100644 src/llvm/include/llvm/ProfileData/SampleProf.h create mode 100644 src/llvm/include/llvm/ProfileData/SampleProfWriter.h create mode 100644 src/llvm/include/llvm/Support/ELFRelocs/AArch64.def create mode 100644 src/llvm/include/llvm/Support/ELFRelocs/ARM.def create mode 100644 src/llvm/include/llvm/Support/ELFRelocs/Hexagon.def create mode 100644 src/llvm/include/llvm/Support/ELFRelocs/Mips.def create mode 100644 src/llvm/include/llvm/Support/ELFRelocs/PowerPC.def create mode 100644 src/llvm/include/llvm/Support/ELFRelocs/PowerPC64.def create mode 100644 src/llvm/include/llvm/Support/ELFRelocs/Sparc.def create mode 100644 src/llvm/include/llvm/Support/ELFRelocs/SystemZ.def create mode 100644 src/llvm/include/llvm/Support/ELFRelocs/i386.def create mode 100644 src/llvm/include/llvm/Support/ELFRelocs/x86_64.def create mode 100644 src/llvm/include/llvm/Support/Options.h delete mode 100644 src/llvm/include/llvm/Support/StreamableMemoryObject.h create mode 100644 src/llvm/include/llvm/Support/StreamingMemoryObject.h delete mode 100644 src/llvm/include/llvm/Support/StringRefMemoryObject.h create mode 100644 src/llvm/include/llvm/Transforms/Utils/SymbolRewriter.h create mode 100644 src/llvm/lib/Analysis/AssumptionCache.cpp delete mode 100644 src/llvm/lib/Analysis/AssumptionTracker.cpp delete mode 100644 src/llvm/lib/Analysis/IPA/FindUsedTypes.cpp create mode 100644 src/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp create mode 100644 src/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h create mode 100644 src/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp create mode 100644 src/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h create mode 100644 src/llvm/lib/CodeGen/ForwardControlFlowIntegrity.cpp create mode 100644 src/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp create mode 100644 src/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.h delete mode 100644 src/llvm/lib/CodeGen/Spiller.cpp create mode 100644 src/llvm/lib/CodeGen/StatepointExampleGC.cpp create mode 100644 src/llvm/lib/DebugInfo/DWARFAcceleratorTable.cpp create mode 100644 src/llvm/lib/DebugInfo/SyntaxHighlighting.cpp create mode 100644 src/llvm/lib/DebugInfo/SyntaxHighlighting.h rename src/llvm/lib/ExecutionEngine/{RuntimeDyld/GDBRegistrar.cpp => GDBRegistrationListener.cpp} (66%) delete mode 100644 src/llvm/lib/ExecutionEngine/JITEventListener.cpp create mode 100644 src/llvm/lib/ExecutionEngine/MCJIT/ObjectBuffer.h delete mode 100644 src/llvm/lib/ExecutionEngine/RuntimeDyld/JITRegistrar.h delete mode 100644 src/llvm/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h delete mode 100644 src/llvm/lib/IR/LeakDetector.cpp create mode 100644 src/llvm/lib/IR/MetadataTracking.cpp create mode 100644 src/llvm/lib/IR/Statepoint.cpp create mode 100644 src/llvm/lib/ProfileData/SampleProf.cpp create mode 100644 src/llvm/lib/ProfileData/SampleProfWriter.cpp create mode 100644 src/llvm/lib/Support/Options.cpp rename src/llvm/lib/Support/{StreamableMemoryObject.cpp => StreamingMemoryObject.cpp} (57%) delete mode 100644 src/llvm/lib/Support/StringRefMemoryObject.cpp create mode 100644 src/llvm/lib/Target/AArch64/AArch64A53Fix835769.cpp create mode 100644 src/llvm/lib/Target/AArch64/AArch64CallingConvention.h create mode 100644 src/llvm/lib/Target/AArch64/AArch64PBQPRegAlloc.h create mode 100644 src/llvm/lib/Target/Hexagon/Disassembler/CMakeLists.txt create mode 100644 src/llvm/lib/Target/Hexagon/Disassembler/HexagonDisassembler.cpp rename src/llvm/lib/Target/Hexagon/{InstPrinter => Disassembler}/LLVMBuild.txt (79%) create mode 100644 src/llvm/lib/Target/Hexagon/Disassembler/Makefile delete mode 100644 src/llvm/lib/Target/Hexagon/InstPrinter/CMakeLists.txt create mode 100644 src/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp create mode 100644 src/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonELFObjectWriter.cpp rename src/llvm/lib/Target/Hexagon/{InstPrinter => MCTargetDesc}/HexagonInstPrinter.cpp (77%) rename src/llvm/lib/Target/Hexagon/{InstPrinter => MCTargetDesc}/HexagonInstPrinter.h (100%) create mode 100644 src/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp create mode 100644 src/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.h create mode 100644 src/llvm/lib/Target/Mips/MCTargetDesc/MipsABIInfo.cpp create mode 100644 src/llvm/lib/Target/Mips/MCTargetDesc/MipsABIInfo.h create mode 100644 src/llvm/lib/Target/Mips/MipsCCState.cpp create mode 100644 src/llvm/lib/Target/Mips/MipsCCState.h create mode 100644 src/llvm/lib/Target/NVPTX/NVPTXLowerStructArgs.cpp create mode 100644 src/llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp create mode 100644 src/llvm/lib/Target/PowerPC/PPCCallingConv.h create mode 100644 src/llvm/lib/Target/PowerPC/PPCScheduleP8.td create mode 100644 src/llvm/lib/Target/R600/AMDGPUAlwaysInlinePass.cpp create mode 100644 src/llvm/lib/Target/R600/AMDKernelCodeT.h create mode 100644 src/llvm/lib/Target/R600/AsmParser/AMDGPUAsmParser.cpp create mode 100644 src/llvm/lib/Target/R600/AsmParser/CMakeLists.txt create mode 100644 src/llvm/lib/Target/R600/AsmParser/LLVMBuild.txt rename src/llvm/lib/Target/{Hexagon/InstPrinter => R600/AsmParser}/Makefile (54%) create mode 100644 src/llvm/lib/Target/R600/CIInstructions.td create mode 100644 src/llvm/lib/Target/R600/SIFoldOperands.cpp create mode 100644 src/llvm/lib/Target/R600/SILoadStoreOptimizer.cpp create mode 100644 src/llvm/lib/Target/R600/SIPrepareScratchRegs.cpp create mode 100644 src/llvm/lib/Target/R600/VIInstrFormats.td create mode 100644 src/llvm/lib/Target/R600/VIInstructions.td delete mode 100644 src/llvm/lib/Transforms/Instrumentation/DebugIR.cpp delete mode 100644 src/llvm/lib/Transforms/Instrumentation/DebugIR.h create mode 100644 src/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp create mode 100644 src/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp create mode 100644 src/llvm/lib/Transforms/ObjCARC/ProvenanceAnalysisEvaluator.cpp create mode 100644 src/llvm/lib/Transforms/Utils/SymbolRewriter.cpp create mode 100644 src/llvm/test/Bindings/Go/go.test create mode 100644 src/llvm/test/Bindings/Go/lit.local.cfg rename src/llvm/test/Bindings/{Ocaml => OCaml}/analysis.ml (84%) rename src/llvm/test/Bindings/{Ocaml => OCaml}/bitreader.ml (85%) rename src/llvm/test/Bindings/{Ocaml => OCaml}/bitwriter.ml (68%) rename src/llvm/test/Bindings/{Ocaml/vmcore.ml => OCaml/core.ml} (92%) create mode 100644 src/llvm/test/Bindings/OCaml/executionengine.ml rename src/llvm/test/Bindings/{Ocaml => OCaml}/ext_exc.ml (68%) rename src/llvm/test/Bindings/{Ocaml/ipo_opts.ml => OCaml/ipo.ml} (86%) rename src/llvm/test/Bindings/{Ocaml => OCaml}/irreader.ml (85%) rename src/llvm/test/Bindings/{Ocaml => OCaml}/linker.ml (81%) create mode 100644 src/llvm/test/Bindings/OCaml/lit.local.cfg rename src/llvm/test/Bindings/{Ocaml => OCaml}/passmgr_builder.ml (87%) rename src/llvm/test/Bindings/{Ocaml => OCaml}/scalar_opts.ml (83%) rename src/llvm/test/Bindings/{Ocaml => OCaml}/target.ml (89%) create mode 100644 src/llvm/test/Bindings/OCaml/transform_utils.ml rename src/llvm/test/Bindings/{Ocaml/vectorize_opts.ml => OCaml/vectorize.ml} (82%) delete mode 100644 src/llvm/test/Bindings/Ocaml/executionengine.ml delete mode 100644 src/llvm/test/Bindings/Ocaml/lit.local.cfg create mode 100644 src/llvm/test/Bindings/llvm-c/Inputs/invalid.ll.bc create mode 100644 src/llvm/test/Bindings/llvm-c/invalid-bitcode.test create mode 100644 src/llvm/test/Bitcode/function-local-metadata.3.5.ll.bc create mode 100644 src/llvm/test/Bitcode/metadata.3.5.ll.bc create mode 100644 src/llvm/test/DebugInfo/Inputs/dwarfdump-objc.m create mode 100644 src/llvm/test/DebugInfo/Inputs/dwarfdump-objc.x86_64.o create mode 100644 src/llvm/test/DebugInfo/dwarfdump-accel.test create mode 100644 src/llvm/test/DebugInfo/dwarfdump-objc.test rename debian/patches/series => src/llvm/test/DebugInfo/member-pointers.o (100%) rename src/llvm/test/{tools/llvm-dwarfdump/AArch64/lit.local.cfg => DebugInfo/missing-abstract-variable.o} (100%) create mode 100644 src/llvm/test/Instrumentation/DataFlowSanitizer/Inputs/debuglist.txt create mode 100644 src/llvm/test/LTO/Inputs/invalid.ll.bc create mode 100644 src/llvm/test/MC/COFF/bigobj.py create mode 100644 src/llvm/test/MC/Disassembler/ARM/d16.txt create mode 100644 src/llvm/test/MC/Disassembler/ARM/invalid-virtexts.arm.txt create mode 100644 src/llvm/test/MC/Disassembler/ARM/thumb2-preloads.txt create mode 100644 src/llvm/test/MC/Disassembler/ARM/virtexts-arm.txt create mode 100644 src/llvm/test/MC/Disassembler/ARM/virtexts-thumb.txt create mode 100644 src/llvm/test/MC/Disassembler/Hexagon/alu32_alu.txt create mode 100644 src/llvm/test/MC/Disassembler/Hexagon/alu32_perm.txt create mode 100644 src/llvm/test/MC/Disassembler/Hexagon/alu32_pred.txt create mode 100644 src/llvm/test/MC/Disassembler/Hexagon/cr.txt create mode 100644 src/llvm/test/MC/Disassembler/Hexagon/j.txt create mode 100644 src/llvm/test/MC/Disassembler/Hexagon/jr.txt create mode 100644 src/llvm/test/MC/Disassembler/Hexagon/ld.txt create mode 100644 src/llvm/test/MC/Disassembler/Hexagon/lit.local.cfg create mode 100644 src/llvm/test/MC/Disassembler/Hexagon/memop.txt create mode 100644 src/llvm/test/MC/Disassembler/Hexagon/nv_j.txt create mode 100644 src/llvm/test/MC/Disassembler/Hexagon/nv_st.txt create mode 100644 src/llvm/test/MC/Disassembler/Hexagon/st.txt create mode 100644 src/llvm/test/MC/Disassembler/Hexagon/system_user.txt create mode 100644 src/llvm/test/MC/Disassembler/Hexagon/xtype_alu.txt create mode 100644 src/llvm/test/MC/Disassembler/Hexagon/xtype_bit.txt create mode 100644 src/llvm/test/MC/Disassembler/Hexagon/xtype_fp.txt create mode 100644 src/llvm/test/MC/Disassembler/Hexagon/xtype_mpy.txt create mode 100644 src/llvm/test/MC/Disassembler/Hexagon/xtype_perm.txt create mode 100644 src/llvm/test/MC/Disassembler/Hexagon/xtype_pred.txt create mode 100644 src/llvm/test/MC/Disassembler/Hexagon/xtype_shift.txt create mode 100644 src/llvm/test/MC/Disassembler/Mips/mips1/valid-mips1-el.txt create mode 100644 src/llvm/test/MC/Disassembler/Mips/mips1/valid-mips1.txt create mode 100644 src/llvm/test/MC/Disassembler/Mips/mips1/valid-xfail.txt create mode 100644 src/llvm/test/MC/Disassembler/Mips/mips2/valid-mips2-el.txt create mode 100644 src/llvm/test/MC/Disassembler/Mips/mips2/valid-mips2.txt create mode 100644 src/llvm/test/MC/Disassembler/Mips/mips3/valid-mips3-el.txt create mode 100644 src/llvm/test/MC/Disassembler/Mips/mips3/valid-mips3.txt create mode 100644 src/llvm/test/MC/Disassembler/Mips/mips32/valid-mips32-el.txt create mode 100644 src/llvm/test/MC/Disassembler/Mips/mips32/valid-mips32.txt create mode 100644 src/llvm/test/MC/Disassembler/Mips/mips32/valid-xfail-mips32.txt create mode 100644 src/llvm/test/MC/Disassembler/Mips/mips32r2/valid-mips32r2-le.txt create mode 100644 src/llvm/test/MC/Disassembler/Mips/mips32r2/valid-mips32r2.txt create mode 100644 src/llvm/test/MC/Disassembler/Mips/mips32r2/valid-xfail-mips32r2.txt create mode 100644 src/llvm/test/MC/Disassembler/Mips/mips4/valid-mips4-el.txt create mode 100644 src/llvm/test/MC/Disassembler/Mips/mips4/valid-mips4.txt create mode 100644 src/llvm/test/MC/Disassembler/Mips/mips4/valid-xfail-mips4.txt delete mode 100644 src/llvm/test/MC/Disassembler/X86/invalid-cmp-imm.txt create mode 100644 src/llvm/test/MC/Hexagon/lit.local.cfg create mode 100644 src/llvm/test/MC/R600/lit.local.cfg create mode 100644 src/llvm/test/Object/AArch64/yaml2obj-elf-aarch64-rel.yaml create mode 100644 src/llvm/test/Object/Inputs/COFF/long-section-name.yaml create mode 100644 src/llvm/test/Object/Inputs/COFF/section-aux-symbol.yaml create mode 100644 src/llvm/test/Object/Inputs/macho-archive-unsorted-x86_64.a create mode 100755 src/llvm/test/Object/Inputs/macho-no-exports.dylib create mode 100755 src/llvm/test/Object/Inputs/macho-rpath-x86_64 create mode 100644 src/llvm/test/Object/Inputs/macho-zero-ncmds create mode 100755 src/llvm/test/Object/Inputs/micro-mips.elf-mipsel create mode 100644 src/llvm/test/Object/Inputs/mri-crlf.mri create mode 100644 src/llvm/test/Object/Inputs/thin.a create mode 100644 src/llvm/test/Object/Mips/objdump-micro-mips.test create mode 100644 src/llvm/test/Object/mri-addlib.test create mode 100644 src/llvm/test/Object/mri-addmod.test create mode 100644 src/llvm/test/Object/mri-crlf.test create mode 100644 src/llvm/test/Object/mri1.test create mode 100644 src/llvm/test/Object/mri2.test create mode 100644 src/llvm/test/Object/mri3.test create mode 100644 src/llvm/test/Object/mri4.test create mode 100644 src/llvm/test/Object/mri5.test create mode 100644 src/llvm/test/Object/obj2yaml-coff-long-section-name.test create mode 100644 src/llvm/test/Object/obj2yaml-coff-section-aux-symbol.test create mode 100644 src/llvm/test/Object/objdump-export-list.test create mode 100644 src/llvm/test/Object/objdump-macho-quirks.test create mode 100644 src/llvm/test/SymbolRewriter/rewrite.map create mode 100644 src/llvm/test/Transforms/IndVarSimplify/NVPTX/lit.local.cfg create mode 100644 src/llvm/test/Transforms/SampleProfile/Inputs/fnptr.binprof create mode 100644 src/llvm/test/Transforms/SampleProfile/Inputs/fnptr.prof create mode 100755 src/llvm/test/tools/dsymutil/Inputs/basic-archive.macho.x86_64 create mode 100755 src/llvm/test/tools/dsymutil/Inputs/basic-lto.macho.x86_64 create mode 100644 src/llvm/test/tools/dsymutil/Inputs/basic-lto.macho.x86_64.o create mode 100755 src/llvm/test/tools/dsymutil/Inputs/basic.macho.x86_64 create mode 100644 src/llvm/test/tools/dsymutil/Inputs/basic1.c create mode 100644 src/llvm/test/tools/dsymutil/Inputs/basic1.macho.x86_64.o create mode 100644 src/llvm/test/tools/dsymutil/Inputs/basic2.c create mode 100644 src/llvm/test/tools/dsymutil/Inputs/basic2.macho.x86_64.o create mode 100644 src/llvm/test/tools/dsymutil/Inputs/basic3.c create mode 100644 src/llvm/test/tools/dsymutil/Inputs/basic3.macho.x86_64.o create mode 100644 src/llvm/test/tools/dsymutil/Inputs/libbasic.a create mode 100644 src/llvm/test/tools/dsymutil/debug-map-parsing.test create mode 100644 src/llvm/test/tools/llvm-mc/line_end_with_space.test create mode 100755 src/llvm/test/tools/llvm-objdump/AArch64/Inputs/ObjC.exe.macho-aarch64 create mode 100644 src/llvm/test/tools/llvm-objdump/AArch64/Inputs/ObjC.obj.macho-aarch64 create mode 100755 src/llvm/test/tools/llvm-objdump/AArch64/Inputs/hello.exe.macho-aarch64 create mode 100644 src/llvm/test/tools/llvm-objdump/AArch64/Inputs/hello.obj.macho-aarch64 create mode 100644 src/llvm/test/tools/llvm-objdump/AArch64/lit.local.cfg create mode 100644 src/llvm/test/tools/llvm-objdump/AArch64/macho-private-headers.test create mode 100644 src/llvm/test/tools/llvm-objdump/AArch64/macho-symbolized-disassembly.test create mode 100755 src/llvm/test/tools/llvm-objdump/ARM/Inputs/hello.exe.macho-arm create mode 100644 src/llvm/test/tools/llvm-objdump/ARM/Inputs/hello.obj.macho-arm create mode 100644 src/llvm/test/tools/llvm-objdump/ARM/macho-private-headers.test create mode 100644 src/llvm/test/tools/llvm-objdump/ARM/macho-symbolized-disassembly.test create mode 100644 src/llvm/test/tools/llvm-objdump/ARM/macho-symbolized-subtractor.test create mode 100755 src/llvm/test/tools/llvm-objdump/Inputs/bad-ordinal.macho-x86_64 create mode 100755 src/llvm/test/tools/llvm-objdump/Inputs/bind2.macho-x86_64 create mode 100755 src/llvm/test/tools/llvm-objdump/X86/Inputs/ObjC.exe.macho-x86_64 create mode 100644 src/llvm/test/tools/llvm-objdump/X86/Inputs/ObjC.obj.macho-x86_64 create mode 100755 src/llvm/test/tools/llvm-objdump/X86/Inputs/dylibLoadKinds.macho-x86_64 create mode 100755 src/llvm/test/tools/llvm-objdump/X86/Inputs/dylibRoutines.macho-x86_64 create mode 100755 src/llvm/test/tools/llvm-objdump/X86/Inputs/dylibSubClient.macho-x86_64 create mode 100755 src/llvm/test/tools/llvm-objdump/X86/Inputs/dylibSubFramework.macho-x86_64 create mode 100755 src/llvm/test/tools/llvm-objdump/X86/Inputs/dylibSubLibrary.macho-x86_64 create mode 100755 src/llvm/test/tools/llvm-objdump/X86/Inputs/dylibSubUmbrella.macho-x86_64 create mode 100755 src/llvm/test/tools/llvm-objdump/X86/Inputs/exeThread.macho-x86_64 create mode 100755 src/llvm/test/tools/llvm-objdump/X86/Inputs/hello.exe.macho-i386 create mode 100644 src/llvm/test/tools/llvm-objdump/X86/Inputs/hello.obj.macho-i386 create mode 100755 src/llvm/test/tools/llvm-objdump/X86/Inputs/hello_cpp.exe.macho-x86_64 create mode 100644 src/llvm/test/tools/llvm-objdump/X86/Inputs/linkerOption.macho-x86_64 create mode 100644 src/llvm/test/tools/llvm-objdump/X86/Inputs/macho-universal-archive.x86_64.i386 create mode 100755 src/llvm/test/tools/llvm-objdump/X86/Inputs/macho-universal.x86_64.i386 create mode 100644 src/llvm/test/tools/llvm-objdump/X86/macho-symbolized-subtractor-i386.test create mode 100644 src/llvm/test/tools/llvm-objdump/X86/macho-universal-x86_64.i386.test create mode 100644 src/llvm/test/tools/llvm-objdump/macho-bad-ordinal.test create mode 100644 src/llvm/test/tools/llvm-objdump/macho-bind2.test create mode 100644 src/llvm/test/tools/llvm-profdata/Inputs/sample-profile.proftext create mode 100644 src/llvm/test/tools/llvm-profdata/sample-profile-basic.test create mode 100644 src/llvm/test/tools/llvm-readobj/Inputs/bad-relocs.obj.coff-i386 create mode 100644 src/llvm/test/tools/llvm-readobj/Inputs/basereloc.obj.coff-i386 create mode 100755 src/llvm/test/tools/llvm-readobj/Inputs/comdat-function-linetables.obj.coff-2012-i386 create mode 100755 src/llvm/test/tools/llvm-readobj/Inputs/comdat-function-linetables.obj.coff-2013-i386 create mode 100644 src/llvm/test/tools/llvm-readobj/Inputs/directives.obj.coff-x86_64 create mode 100755 src/llvm/test/tools/llvm-readobj/Inputs/export-arm.dll create mode 100755 src/llvm/test/tools/llvm-readobj/Inputs/export-x64.dll create mode 100755 src/llvm/test/tools/llvm-readobj/Inputs/export-x86.dll create mode 100644 src/llvm/test/tools/llvm-readobj/Inputs/imports.exe.coff-i386 create mode 100644 src/llvm/test/tools/llvm-readobj/Inputs/imports.exe.coff-x86-64 create mode 100755 src/llvm/test/tools/llvm-readobj/Inputs/multifile-linetables.obj.coff-2012-i368 create mode 100755 src/llvm/test/tools/llvm-readobj/Inputs/multifile-linetables.obj.coff-2012-x86_64 create mode 100755 src/llvm/test/tools/llvm-readobj/Inputs/multifunction-linetables.obj.coff-2012-i368 create mode 100755 src/llvm/test/tools/llvm-readobj/Inputs/multifunction-linetables.obj.coff-2012-x86_64 create mode 100644 src/llvm/test/tools/llvm-readobj/Inputs/relocs-no-symtab.obj.coff-i386 create mode 100644 src/llvm/test/tools/llvm-readobj/coff-basereloc.test create mode 100644 src/llvm/test/tools/llvm-readobj/coff-directives.test create mode 100644 src/llvm/test/tools/llvm-readobj/coff-exports.test create mode 100644 src/llvm/test/tools/llvm-readobj/imports.test create mode 100755 src/llvm/test/tools/llvm-symbolizer/Inputs/dsym-test-exe create mode 100644 src/llvm/test/tools/llvm-symbolizer/Inputs/dsym-test-exe-differentname.dSYM/Contents/Info.plist create mode 100644 src/llvm/test/tools/llvm-symbolizer/Inputs/dsym-test-exe-differentname.dSYM/Contents/Resources/DWARF/dsym-test-exe-second create mode 100755 src/llvm/test/tools/llvm-symbolizer/Inputs/dsym-test-exe-second create mode 100644 src/llvm/test/tools/llvm-symbolizer/Inputs/dsym-test-exe.dSYM/Contents/Info.plist create mode 100644 src/llvm/test/tools/llvm-symbolizer/Inputs/dsym-test-exe.dSYM/Contents/Resources/DWARF/dsym-test-exe create mode 100644 src/llvm/test/tools/llvm-symbolizer/Inputs/dsym-test.c create mode 100755 src/llvm/test/tools/llvm-symbolizer/Inputs/ppc64 create mode 100644 src/llvm/test/tools/llvm-symbolizer/dsym.test create mode 100644 src/llvm/test/tools/llvm-symbolizer/ppc64.test create mode 100644 src/llvm/test/tools/llvm-vtabledump/Inputs/trivial.obj.elf-i386 create mode 100644 src/llvm/tools/dsymutil/BinaryHolder.cpp create mode 100644 src/llvm/tools/dsymutil/BinaryHolder.h create mode 100644 src/llvm/tools/dsymutil/CMakeLists.txt create mode 100644 src/llvm/tools/dsymutil/DebugMap.cpp create mode 100644 src/llvm/tools/dsymutil/DebugMap.h create mode 100644 src/llvm/tools/dsymutil/DwarfLinker.cpp create mode 100644 src/llvm/tools/dsymutil/LLVMBuild.txt create mode 100644 src/llvm/tools/dsymutil/MachODebugMapParser.cpp create mode 100644 src/llvm/tools/dsymutil/Makefile create mode 100644 src/llvm/tools/dsymutil/dsymutil.cpp create mode 100644 src/llvm/tools/dsymutil/dsymutil.h create mode 100644 src/llvm/tools/llvm-ar/install_symlink.cmake create mode 100644 src/llvm/tools/llvm-c-test/metadata.c create mode 100644 src/llvm/tools/llvm-go/CMakeLists.txt create mode 100644 src/llvm/tools/llvm-go/Makefile create mode 100644 src/llvm/tools/llvm-go/llvm-go.go create mode 100644 src/llvm/tools/llvm-shlib/CMakeLists.txt create mode 100644 src/llvm/tools/llvm-shlib/libllvm.cpp create mode 100644 src/llvm/unittests/ADT/FunctionRefTest.cpp create mode 100644 src/llvm/unittests/ADT/PostOrderIteratorTest.cpp create mode 100644 src/llvm/unittests/Analysis/CallGraphTest.cpp create mode 100644 src/llvm/unittests/Bitcode/BitstreamReaderTest.cpp create mode 100644 src/llvm/unittests/IR/DebugInfoTest.cpp delete mode 100644 src/llvm/unittests/IR/LeakDetectorTest.cpp create mode 100644 src/llvm/unittests/MC/Disassembler.cpp create mode 100644 src/llvm/unittests/Support/StreamingMemoryObject.cpp delete mode 100644 src/llvm/unittests/Transforms/DebugIR/CMakeLists.txt delete mode 100644 src/llvm/unittests/Transforms/DebugIR/DebugIR.cpp create mode 100644 src/llvm/utils/lit/tests/xunit-output.py create mode 100755 src/llvm/utils/update_llc_test_checks.py create mode 100644 src/rt/arch/armv7/morestack.S create mode 100644 src/rt/arch/armv7/record_sp.S create mode 100644 src/rt/arch/armv7s/morestack.S create mode 100644 src/rt/arch/armv7s/record_sp.S create mode 100644 src/rt/arch/powerpc/morestack.S create mode 100644 src/rt/arch/powerpc/record_sp.S create mode 100644 src/rustbook/javascript.rs create mode 100644 src/test/auxiliary/blind-item-mixed-crate-use-item-foo.rs create mode 100644 src/test/auxiliary/blind-item-mixed-crate-use-item-foo2.rs create mode 100644 src/test/auxiliary/i8.rs create mode 100644 src/test/auxiliary/issue-21146-inc.rs create mode 100644 src/test/auxiliary/issue-21202.rs create mode 100644 src/test/auxiliary/macro_with_super_1.rs create mode 100644 src/test/auxiliary/no_method_suggested_traits.rs create mode 100644 src/test/auxiliary/orphan_check_diagnostics.rs create mode 100644 src/test/auxiliary/plugin_with_plugin_lib.rs rename src/test/auxiliary/{syntax-extension-with-dll-deps-1.rs => syntax_extension_with_dll_deps_1.rs} (100%) rename src/test/auxiliary/{syntax-extension-with-dll-deps-2.rs => syntax_extension_with_dll_deps_2.rs} (94%) delete mode 100644 src/test/bench/shootout-regex-dna.rs delete mode 100644 src/test/bench/task-perf-one-million.rs rename src/{libregex/test/mod.rs => test/compile-fail-fulldeps/plugin-as-extern-crate.rs} (51%) create mode 100644 src/test/compile-fail-fulldeps/plugin-plus-extern-crate.rs create mode 100644 src/test/compile-fail/asm-gated2.rs create mode 100644 src/test/compile-fail/associated-types-subtyping-1.rs create mode 100644 src/test/compile-fail/blind-item-block-item-shadow.rs create mode 100644 src/test/compile-fail/blind-item-block-middle.rs create mode 100644 src/test/compile-fail/blind-item-item-shadow.rs create mode 100644 src/test/compile-fail/blind-item-local-shadow.rs create mode 100644 src/test/compile-fail/borrowck-let-suggestion-suffixes.rs create mode 100644 src/test/compile-fail/borrowck-partial-reinit-1.rs create mode 100644 src/test/compile-fail/borrowck-partial-reinit-2.rs create mode 100644 src/test/compile-fail/borrowck-partial-reinit-3.rs create mode 100644 src/test/compile-fail/borrowck-partial-reinit-4.rs create mode 100644 src/test/compile-fail/cfg-attr-cfg-2.rs create mode 100644 src/test/compile-fail/cfg-attr-crate-2.rs create mode 100644 src/test/compile-fail/coerce-mut.rs create mode 100644 src/test/compile-fail/coerce-overloaded-autoderef.rs create mode 100644 src/test/compile-fail/coherence-conflicting-negative-trait-impl.rs create mode 100644 src/test/compile-fail/coherence-cow-no-cover.rs create mode 100644 src/test/compile-fail/coherence-impls-builtin.rs create mode 100644 src/test/compile-fail/coherence-negative-impls-safe.rs create mode 100644 src/test/compile-fail/coherence-pair-covered-uncovered-1.rs create mode 100644 src/test/compile-fail/coherence-subtyping.rs create mode 100644 src/test/compile-fail/concat_idents-gate.rs create mode 100644 src/test/compile-fail/concat_idents-gate2.rs rename src/test/{run-make/dep-info-custom/lib.rs => compile-fail/custom_attribute.rs} (90%) create mode 100644 src/test/compile-fail/derive-no-std-not-supported.rs rename src/test/compile-fail/{multi-plugin-attr.rs => deriving-is-deprecated.rs} (85%) create mode 100644 src/test/compile-fail/destructor-restrictions.rs create mode 100644 src/test/compile-fail/dropck_arr_cycle_checked.rs create mode 100644 src/test/compile-fail/dropck_direct_cycle_with_drop.rs create mode 100644 src/test/compile-fail/dropck_tarena_cycle_checked.rs create mode 100644 src/test/compile-fail/dropck_tarena_unsound_drop.rs create mode 100644 src/test/compile-fail/dropck_vec_cycle_checked.rs create mode 100644 src/test/compile-fail/enable-unstable-lib-feature.rs create mode 100644 src/test/compile-fail/feature-gate-main.rs create mode 100644 src/test/compile-fail/feature-gate-simd-ffi.rs create mode 100644 src/test/compile-fail/feature-gate-start.rs rename src/test/compile-fail/{vec-matching-obsolete-syntax.rs => for-loop-hygiene.rs} (66%) create mode 100644 src/test/compile-fail/functional-struct-update-respects-privacy.rs create mode 100644 src/test/compile-fail/gated-no-std.rs rename src/test/compile-fail/{deriving-span-Rand-enum.rs => issue-17904-2.rs} (71%) create mode 100644 src/test/compile-fail/issue-19660.rs create mode 100644 src/test/compile-fail/issue-20427.rs create mode 100644 src/test/compile-fail/issue-20605.rs create mode 100644 src/test/compile-fail/issue-20801.rs create mode 100644 src/test/compile-fail/issue-20831-debruijn.rs create mode 100644 src/test/compile-fail/issue-21045.rs create mode 100644 src/test/compile-fail/issue-21146.rs create mode 100644 src/test/compile-fail/issue-21160.rs create mode 100644 src/test/compile-fail/issue-21202.rs create mode 100644 src/test/compile-fail/issue-21356.rs create mode 100644 src/test/compile-fail/issue-21554.rs create mode 100644 src/test/compile-fail/issue-21600.rs create mode 100644 src/test/compile-fail/issue-21763.rs rename src/{libregex/test/native_static.rs => test/compile-fail/issue-21974.rs} (51%) create mode 100644 src/test/compile-fail/issue-6936.rs create mode 100644 src/test/compile-fail/issue-8460-const.rs delete mode 100644 src/test/compile-fail/kindck-send-region-pointers.rs create mode 100644 src/test/compile-fail/lint-stability2.rs create mode 100644 src/test/compile-fail/lint-stability3.rs create mode 100644 src/test/compile-fail/lint-unconditional-recursion.rs create mode 100644 src/test/compile-fail/lint-unexported-no-mangle.rs rename src/test/compile-fail/{marker-no-send.rs => lint-unknown-feature-default.rs} (75%) rename src/test/compile-fail/{reserved-be.rs => log-syntax-gate2.rs} (86%) rename src/test/{run-pass-fulldeps/plugin-args-4.rs => compile-fail/macro-reexport-undef.rs} (73%) rename src/test/compile-fail/{lint-renaming.rs => macro-use-undef.rs} (63%) create mode 100644 src/test/compile-fail/malformed-plugin-1.rs create mode 100644 src/test/compile-fail/malformed-plugin-2.rs create mode 100644 src/test/compile-fail/malformed-plugin-3.rs delete mode 100644 src/test/compile-fail/method-ambig-one-trait-coerce.rs create mode 100644 src/test/compile-fail/method-suggestion-no-duplication.rs create mode 100644 src/test/compile-fail/missing-stability.rs create mode 100644 src/test/compile-fail/missing_debug_impls.rs create mode 100644 src/test/compile-fail/move-into-dead-array-1.rs create mode 100644 src/test/compile-fail/move-into-dead-array-2.rs create mode 100644 src/test/compile-fail/move-out-of-array-1.rs create mode 100644 src/test/compile-fail/no-method-suggested-traits.rs create mode 100644 src/test/compile-fail/no-type-for-node-ice.rs create mode 100644 src/test/compile-fail/object-lifetime-default-ambiguous.rs create mode 100644 src/test/compile-fail/object-lifetime-default-elision.rs create mode 100644 src/test/compile-fail/object-lifetime-default-from-box-error.rs create mode 100644 src/test/compile-fail/object-lifetime-default-mybox.rs create mode 100644 src/test/compile-fail/object-lifetime-default.rs create mode 100644 src/test/compile-fail/object-safety-issue-22040.rs create mode 100644 src/test/compile-fail/object-safety-phantom-fn.rs create mode 100644 src/test/compile-fail/object-safety-supertrait-mentions-Self.rs delete mode 100644 src/test/compile-fail/obsolete-tilde.rs delete mode 100644 src/test/compile-fail/obsolete-tuple-struct-deref.rs create mode 100644 src/test/compile-fail/on-unimplemented-bad-anno.rs create mode 100644 src/test/compile-fail/on-unimplemented.rs create mode 100644 src/test/compile-fail/orphan-check-diagnostics.rs create mode 100644 src/test/compile-fail/plugin-extern-crate-attr-deprecated.rs create mode 100644 src/test/compile-fail/pub-item-macro.rs create mode 100644 src/test/compile-fail/pub-method-macro.rs create mode 100644 src/test/compile-fail/region-object-lifetime-2.rs create mode 100644 src/test/compile-fail/region-object-lifetime-3.rs create mode 100644 src/test/compile-fail/region-object-lifetime-4.rs create mode 100644 src/test/compile-fail/region-object-lifetime-5.rs create mode 100644 src/test/compile-fail/regions-assoc-type-in-supertrait-outlives-container.rs create mode 100644 src/test/compile-fail/regions-assoc-type-outlives-container-hrtb.rs create mode 100644 src/test/compile-fail/regions-assoc-type-outlives-container-wc.rs create mode 100644 src/test/compile-fail/regions-assoc-type-outlives-container.rs create mode 100644 src/test/compile-fail/regions-assoc-type-region-bound-in-trait-not-met.rs create mode 100644 src/test/compile-fail/regions-assoc-type-static-bound-in-trait-not-met.rs delete mode 100644 src/test/compile-fail/regions-bounded-by-send.rs create mode 100644 src/test/compile-fail/regions-close-object-into-object-1.rs create mode 100644 src/test/compile-fail/regions-close-object-into-object-2.rs create mode 100644 src/test/compile-fail/regions-close-object-into-object-3.rs create mode 100644 src/test/compile-fail/regions-close-object-into-object-4.rs rename src/test/compile-fail/{regions-close-object-into-object.rs => regions-close-object-into-object-5.rs} (65%) create mode 100644 src/test/compile-fail/reserved-become.rs create mode 100644 src/test/compile-fail/rustc-error.rs create mode 100644 src/test/compile-fail/self_type_keyword.rs rename src/test/compile-fail/{borrowck-array-double-move.rs => send-is-not-static-ensures-scoping.rs} (70%) mode change 100644 => 100755 create mode 100644 src/test/compile-fail/stability-attribute-sanity.rs create mode 100644 src/test/compile-fail/stable-features.rs create mode 100644 src/test/compile-fail/staged_api.rs create mode 100644 src/test/compile-fail/struct-fields-hints-no-dupe.rs create mode 100644 src/test/compile-fail/struct-fields-hints.rs create mode 100644 src/test/compile-fail/struct-fields-typo.rs create mode 100644 src/test/compile-fail/trace_macros-gate.rs create mode 100644 src/test/compile-fail/trace_macros-gate2.rs create mode 100644 src/test/compile-fail/trace_macros-gate3.rs create mode 100644 src/test/compile-fail/traits-negative-impls.rs create mode 100644 src/test/compile-fail/type-parameter-defaults-referencing-Self-ppaux.rs create mode 100644 src/test/compile-fail/type-parameter-defaults-referencing-Self.rs rename src/test/compile-fail/{deriving-span-Rand-struct.rs => typeck-negative-impls-builtin.rs} (70%) rename src/test/compile-fail/{issue-9957.rs => ufcs-qpath-missing-params.rs} (76%) create mode 100644 src/test/compile-fail/ufcs-qpath-self-mismatch.rs create mode 100644 src/test/compile-fail/unboxed-closure-sugar-not-used-on-fn.rs create mode 100644 src/test/compile-fail/unboxed-closures-failed-recursive-fn-1.rs create mode 100644 src/test/compile-fail/unboxed-closures-failed-recursive-fn-2.rs create mode 100644 src/test/compile-fail/unboxed-closures-infer-explicit-call-too-early.rs create mode 100644 src/test/compile-fail/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs create mode 100644 src/test/compile-fail/unboxed-closures-infer-fnmut-missing-mut.rs create mode 100644 src/test/compile-fail/unboxed-closures-infer-fnmut-move-missing-mut.rs create mode 100644 src/test/compile-fail/unboxed-closures-infer-fnonce-call-twice.rs create mode 100644 src/test/compile-fail/unboxed-closures-infer-fnonce-move-call-twice.rs create mode 100644 src/test/compile-fail/unboxed-closures-move-upvar-from-non-once-ref-closure.rs create mode 100644 src/test/compile-fail/unboxed-closures-mutate-upvar.rs create mode 100644 src/test/compile-fail/unboxed-closures-mutated-upvar-from-fn-closure.rs create mode 100644 src/test/compile-fail/unboxed-closures-recursive-fn-using-fn-mut.rs create mode 100644 src/test/compile-fail/variance-associated-types.rs create mode 100644 src/test/compile-fail/variance-contravariant-arg-object.rs create mode 100644 src/test/compile-fail/variance-contravariant-arg-trait-match.rs create mode 100644 src/test/compile-fail/variance-contravariant-self-trait-match.rs create mode 100644 src/test/compile-fail/variance-covariant-arg-object.rs create mode 100644 src/test/compile-fail/variance-covariant-arg-trait-match.rs create mode 100644 src/test/compile-fail/variance-covariant-self-trait-match.rs create mode 100644 src/test/compile-fail/variance-deprecated-markers.rs create mode 100644 src/test/compile-fail/variance-invariant-arg-object.rs create mode 100644 src/test/compile-fail/variance-invariant-arg-trait-match.rs create mode 100644 src/test/compile-fail/variance-invariant-self-trait-match.rs create mode 100644 src/test/compile-fail/variance-issue-20533.rs create mode 100644 src/test/compile-fail/variance-object-types.rs rename src/test/{run-pass/regions-infer-bivariance.rs => compile-fail/variance-regions-unused-direct.rs} (55%) create mode 100644 src/test/compile-fail/variance-regions-unused-indirect.rs create mode 100644 src/test/compile-fail/variance-trait-bounds.rs create mode 100644 src/test/compile-fail/variance-types-bounds.rs create mode 100644 src/test/compile-fail/variance-types.rs create mode 100644 src/test/compile-fail/variance-unused-region-param.rs create mode 100644 src/test/compile-fail/variance-unused-type-param.rs create mode 100644 src/test/compile-fail/variance-use-contravariant-struct-1.rs create mode 100644 src/test/compile-fail/variance-use-contravariant-struct-2.rs create mode 100644 src/test/compile-fail/variance-use-covariant-struct-1.rs create mode 100644 src/test/compile-fail/variance-use-covariant-struct-2.rs create mode 100644 src/test/compile-fail/variance-use-invariant-struct-1.rs create mode 100644 src/test/compile-fail/vec-must-not-hide-type-from-dropck.rs create mode 100644 src/test/compile-fail/vec_refs_data_with_early_death.rs create mode 100644 src/test/compile-fail/where-for-self-2.rs create mode 100644 src/test/compile-fail/where-for-self.rs create mode 100644 src/test/debuginfo/associated-types.rs create mode 100644 src/test/debuginfo/constant-in-match-pattern.rs rename src/test/{compile-fail => parse-fail}/array-old-syntax-1.rs (91%) rename src/test/{compile-fail => parse-fail}/ascii-only-character-escape.rs (100%) rename src/test/{compile-fail => parse-fail}/associated-types-project-from-hrtb-explicit.rs (100%) rename src/test/{compile-fail => parse-fail}/attr-bad-meta.rs (100%) rename src/test/{compile-fail => parse-fail}/attr-before-eof.rs (89%) rename src/test/{compile-fail => parse-fail}/attr-before-ext.rs (100%) rename src/test/{compile-fail => parse-fail}/attr-before-let.rs (96%) rename src/test/{compile-fail => parse-fail}/attr-before-stmt.rs (100%) rename src/test/{compile-fail => parse-fail}/attr-dangling-in-fn.rs (100%) rename src/test/{compile-fail => parse-fail}/attr-dangling-in-mod.rs (100%) rename src/test/{compile-fail => parse-fail}/attr.rs (100%) rename src/test/{compile-fail => parse-fail}/attrs-after-extern-mod.rs (100%) rename src/test/{compile-fail => parse-fail}/bad-char-literals.rs (100%) rename src/test/{compile-fail => parse-fail}/bad-lit-suffixes.rs (100%) rename src/test/{compile-fail => parse-fail}/bad-match.rs (100%) rename src/test/{compile-fail => parse-fail}/bad-name.rs (100%) rename src/test/{compile-fail => parse-fail}/bad-value-ident-false.rs (100%) rename src/test/{compile-fail => parse-fail}/bad-value-ident-true.rs (100%) rename src/test/{compile-fail => parse-fail}/better-expected.rs (95%) rename src/test/{compile-fail => parse-fail}/bind-struct-early-modifiers.rs (88%) rename src/test/{compile-fail => parse-fail}/byte-literals.rs (100%) rename src/test/{compile-fail => parse-fail}/byte-string-literals.rs (100%) rename src/test/{compile-fail => parse-fail}/circular_modules_hello.rs (100%) rename src/test/{compile-fail => parse-fail}/circular_modules_main.rs (100%) rename src/test/{compile-fail => parse-fail}/class-implements-bad-trait.rs (100%) rename src/test/{compile-fail => parse-fail}/column-offset-1-based.rs (100%) rename src/test/{compile-fail => parse-fail}/doc-before-attr.rs (89%) rename src/test/{compile-fail => parse-fail}/doc-before-eof.rs (100%) rename src/test/{compile-fail => parse-fail}/doc-before-extern-rbrace.rs (100%) rename src/test/{compile-fail => parse-fail}/doc-before-macro.rs (100%) rename src/test/{compile-fail => parse-fail}/doc-before-rbrace.rs (100%) rename src/test/{compile-fail => parse-fail}/doc-before-semi.rs (100%) rename src/test/{compile-fail => parse-fail}/duplicate-visibility.rs (100%) rename src/test/{compile-fail => parse-fail}/empty-impl-semicolon.rs (83%) rename src/test/{compile-fail => parse-fail}/extern-crate-as-no-string-help.rs (100%) rename src/test/{compile-fail => parse-fail}/extern-expected-fn-or-brace.rs (100%) rename src/test/{compile-fail => parse-fail}/extern-foreign-crate.rs (100%) rename src/test/{compile-fail => parse-fail}/extern-no-fn.rs (85%) rename src/test/{compile-fail => parse-fail}/generic-non-trailing-defaults.rs (100%) rename src/test/{compile-fail => parse-fail}/import-from-path.rs (100%) rename src/test/{compile-fail => parse-fail}/import-from-rename.rs (100%) rename src/test/{compile-fail => parse-fail}/import-glob-path.rs (100%) rename src/test/{compile-fail => parse-fail}/import-glob-rename.rs (100%) rename src/test/{compile-fail => parse-fail}/int-literal-too-large-span.rs (87%) rename src/test/{compile-fail => parse-fail}/issue-10392-2.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-10392.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-10412.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-10636-1.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-10636-2.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-12560-1.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-14182.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-14303-enum.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-14303-fn-def.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-14303-fncall.rs (97%) rename src/test/{compile-fail => parse-fail}/issue-14303-impl.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-14303-path.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-14303-struct.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-14303-trait.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-15914.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-1655.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-17383.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-17718-const-mut.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-17904.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-1802-1.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-1802-2.rs (95%) rename src/test/{compile-fail => parse-fail}/issue-19096.rs (95%) rename src/test/{compile-fail => parse-fail}/issue-19398.rs (100%) create mode 100644 src/test/parse-fail/issue-20711-2.rs create mode 100644 src/test/parse-fail/issue-20711.rs create mode 100644 src/test/parse-fail/issue-21153.rs rename src/test/{compile-fail => parse-fail}/issue-2354-1.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-2354.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-3036.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-5544-a.rs (91%) rename src/test/{compile-fail => parse-fail}/issue-5544-b.rs (91%) rename src/test/{compile-fail => parse-fail}/issue-5806.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-6610.rs (100%) rename src/test/{compile-fail => parse-fail}/issue-8537.rs (92%) rename src/test/{compile-fail => parse-fail}/keyword-abstract.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-as-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-break-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-do-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-else-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-enum-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-extern-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-final.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-fn-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-for-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-if-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-impl-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-let-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-loop-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-match-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-mod-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-mut-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-override.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-priv-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-pub-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-ref-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-return-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-self-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-static-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-struct-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-super-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-super.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-trait-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-type-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-typeof.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-unsafe-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-use-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword-while-as-identifier.rs (100%) rename src/test/{compile-fail => parse-fail}/keyword.rs (100%) rename src/test/{compile-fail => parse-fail}/keywords-followed-by-double-colon.rs (100%) rename src/test/{compile-fail => parse-fail}/lex-bad-char-literals.rs (100%) rename src/test/{compile-fail => parse-fail}/lex-bad-numeric-literals.rs (100%) rename src/test/{compile-fail => parse-fail}/lex-bad-token.rs (100%) rename src/test/{compile-fail => parse-fail}/lex-bare-cr-string-literal-doc-comment.rs (100%) rename src/test/{compile-fail => parse-fail}/lifetime-no-keyword.rs (100%) rename src/test/{compile-fail => parse-fail}/lifetime-obsoleted-self.rs (100%) rename src/test/{compile-fail => parse-fail}/macro-attribute.rs (100%) rename src/test/{compile-fail => parse-fail}/macro-bad-delimiter-ident.rs (100%) rename src/test/{compile-fail => parse-fail}/macro-keyword.rs (100%) rename src/test/{compile-fail => parse-fail}/macro-mismatched-delim-brace-paren.rs (100%) rename src/test/{compile-fail => parse-fail}/macro-mismatched-delim-paren-brace.rs (100%) rename src/test/{compile-fail => parse-fail}/macros-no-semicolon-items.rs (100%) rename src/test/{compile-fail => parse-fail}/macros-no-semicolon.rs (100%) rename src/test/{compile-fail => parse-fail}/match-arrows-block-then-binop.rs (100%) rename src/test/{compile-fail => parse-fail}/match-vec-invalid.rs (100%) rename src/test/{compile-fail => parse-fail}/mod_file_not_exist.rs (100%) rename src/test/{compile-fail => parse-fail}/mod_file_with_path_attr.rs (100%) rename src/test/{compile-fail => parse-fail}/multiline-comment-line-tracking.rs (100%) rename src/test/{compile-fail => parse-fail}/multitrait.rs (83%) rename src/test/{compile-fail => parse-fail}/mut-patterns.rs (100%) rename src/test/{compile-fail => parse-fail}/new-unicode-escapes-1.rs (100%) rename src/test/{compile-fail => parse-fail}/new-unicode-escapes-2.rs (100%) rename src/test/{compile-fail => parse-fail}/new-unicode-escapes-3.rs (100%) rename src/test/{compile-fail => parse-fail}/new-unicode-escapes-4.rs (100%) rename src/test/{compile-fail => parse-fail}/no-binary-float-literal.rs (100%) rename src/test/{compile-fail => parse-fail}/no-hex-float-literal.rs (100%) rename src/test/{compile-fail => parse-fail}/no-unsafe-self.rs (100%) rename src/test/{compile-fail => parse-fail}/non-str-meta.rs (100%) rename src/test/{compile-fail => parse-fail}/not-a-pred.rs (100%) rename src/test/{compile-fail => parse-fail}/obsolete-for-sized.rs (100%) rename src/test/{compile-fail => parse-fail}/obsolete-proc.rs (100%) rename src/test/{compile-fail => parse-fail}/omitted-arg-in-item-fn.rs (100%) rename src/test/{compile-fail => parse-fail}/paamayim-nekudotayim.rs (100%) rename src/test/{compile-fail => parse-fail}/parenthesized-box-expr-message.rs (100%) rename src/test/{compile-fail => parse-fail}/pat-range-bad-dots.rs (83%) rename src/test/{compile-fail => parse-fail}/pat-ref-enum.rs (100%) rename src/test/{compile-fail => parse-fail}/qquote-1.rs (100%) rename src/test/{compile-fail => parse-fail}/qquote-2.rs (100%) create mode 100644 src/test/parse-fail/range-3.rs rename src/test/{compile-fail/issue-6977.rs => parse-fail/range-4.rs} (76%) rename src/test/{compile-fail => parse-fail}/raw-byte-string-eof.rs (100%) rename src/test/{compile-fail => parse-fail}/raw-byte-string-literals.rs (100%) rename src/test/{compile-fail => parse-fail}/raw-str-delim.rs (100%) rename src/test/{compile-fail => parse-fail}/raw-str-unbalanced.rs (100%) rename src/test/{compile-fail => parse-fail}/raw-str-unterminated.rs (100%) rename src/test/{compile-fail => parse-fail}/regions-fn-bound.rs (100%) rename src/test/{compile-fail => parse-fail}/regions-infer-paramd-method.rs (100%) rename src/test/{compile-fail => parse-fail}/regions-out-of-scope-slice.rs (100%) rename src/test/{compile-fail => parse-fail}/regions-trait-2.rs (100%) rename src/test/{compile-fail => parse-fail}/regions-trait-3.rs (100%) rename src/test/{compile-fail => parse-fail}/removed-syntax-closure-lifetime.rs (93%) rename src/test/{compile-fail => parse-fail}/removed-syntax-enum-newtype.rs (86%) rename src/test/{compile-fail => parse-fail}/removed-syntax-extern-const.rs (81%) rename src/test/{compile-fail => parse-fail}/removed-syntax-field-let.rs (100%) rename src/test/{compile-fail => parse-fail}/removed-syntax-field-semicolon.rs (100%) rename src/test/{compile-fail => parse-fail}/removed-syntax-fixed-vec.rs (94%) rename src/test/{compile-fail => parse-fail}/removed-syntax-fn-pure.rs (100%) rename src/test/{compile-fail => parse-fail}/removed-syntax-fn-sigil.rs (100%) rename src/test/{compile-fail => parse-fail}/removed-syntax-larrow-init.rs (100%) rename src/test/{compile-fail => parse-fail}/removed-syntax-larrow-move.rs (100%) rename src/test/{compile-fail => parse-fail}/removed-syntax-mode.rs (100%) rename src/test/{compile-fail => parse-fail}/removed-syntax-mut-vec-expr.rs (100%) rename src/test/{compile-fail => parse-fail}/removed-syntax-mut-vec-ty.rs (87%) rename src/test/{compile-fail => parse-fail}/removed-syntax-ptr-lifetime.rs (94%) rename src/test/{compile-fail => parse-fail}/removed-syntax-record.rs (100%) rename src/test/{compile-fail => parse-fail}/removed-syntax-static-fn.rs (80%) rename src/test/{compile-fail => parse-fail}/removed-syntax-uniq-mut-expr.rs (100%) rename src/test/{compile-fail => parse-fail}/removed-syntax-uniq-mut-ty.rs (87%) rename src/test/{compile-fail => parse-fail}/removed-syntax-with-1.rs (100%) rename src/test/{compile-fail => parse-fail}/removed-syntax-with-2.rs (100%) rename src/test/{compile-fail => parse-fail}/require-parens-for-chained-comparison.rs (67%) rename src/test/{compile-fail => parse-fail}/struct-literal-in-for.rs (100%) rename src/test/{compile-fail => parse-fail}/struct-literal-in-if.rs (100%) rename src/test/{compile-fail => parse-fail}/struct-literal-in-match-discriminant.rs (87%) rename src/test/{compile-fail => parse-fail}/struct-literal-in-while.rs (100%) rename src/test/{compile-fail => parse-fail}/struct-no-fields-2.rs (100%) rename src/test/{compile-fail => parse-fail}/struct-no-fields-3.rs (100%) rename src/test/{compile-fail => parse-fail}/struct-no-fields-4.rs (100%) rename src/test/{compile-fail => parse-fail}/struct-no-fields-5.rs (100%) rename src/test/{compile-fail => parse-fail}/struct-no-fields-enumlike.rs (100%) rename src/test/{compile-fail => parse-fail}/struct-no-fields.rs (100%) rename src/test/{compile-fail => parse-fail}/struct-variant-no-fields.rs (100%) rename src/test/{compile-fail => parse-fail}/struct-variant-no-pub.rs (100%) rename src/test/{compile-fail => parse-fail}/syntax-trait-polarity.rs (100%) rename src/test/{compile-fail => parse-fail}/tag-variant-disr-non-nullary.rs (100%) rename src/test/{compile-fail => parse-fail}/trailing-carriage-return-in-string.rs (100%) rename src/test/{compile-fail => parse-fail}/trailing-plus-in-bounds.rs (93%) rename src/test/{compile-fail => parse-fail}/trait-bounds-not-on-impl.rs (100%) rename src/test/{compile-fail => parse-fail}/trait-keyword.rs (100%) rename src/test/{compile-fail => parse-fail}/type-parameters-in-field-exprs.rs (100%) rename src/test/{compile-fail => parse-fail}/unbalanced-doublequote.rs (100%) rename src/test/{compile-fail => parse-fail}/unboxed-closure-sugar-used-on-struct-3.rs (100%) rename src/test/{compile-fail => parse-fail}/unsized.rs (100%) rename src/test/{compile-fail => parse-fail}/unsized2.rs (81%) create mode 100644 src/test/parse-fail/use-as-where-use-ends-with-mod-sep.rs create mode 100644 src/test/parse-fail/use-ends-with-mod-sep.rs rename src/test/{run-make/dep-info-custom/bar.rs => parse-fail/use-mod-4.rs} (84%) rename src/test/{compile-fail => parse-fail}/variadic-ffi-1.rs (100%) rename src/test/{compile-fail => parse-fail}/variadic-ffi-3.rs (100%) rename src/test/{compile-fail => parse-fail}/variadic-ffi-4.rs (100%) rename src/test/{compile-fail => parse-fail}/virtual-structs.rs (100%) rename src/test/{compile-fail => parse-fail}/where-clauses-no-bounds-or-predicates.rs (100%) create mode 100644 src/test/pretty/fn-return.rs create mode 100644 src/test/run-fail/issue-20971.rs create mode 100644 src/test/run-make/alloc-extern-crates/Makefile create mode 100644 src/test/run-make/alloc-extern-crates/fakealloc.rs rename src/{llvm/test/tools/llvm-dwarfdump/ARM/lit.local.cfg => test/run-make/allow-non-lint-warnings-cmdline/1} (100%) create mode 100644 src/test/run-make/allow-non-lint-warnings-cmdline/Makefile rename src/test/{run-pass/export-non-interference.rs => run-make/allow-non-lint-warnings-cmdline/foo.rs} (78%) create mode 100644 src/test/run-make/allow-warnings-cmdline-stability/1 create mode 100644 src/test/run-make/allow-warnings-cmdline-stability/Makefile create mode 100644 src/test/run-make/allow-warnings-cmdline-stability/bar.rs create mode 100644 src/test/run-make/allow-warnings-cmdline-stability/foo.rs create mode 100644 src/test/run-make/compiler-lookup-paths-2/Makefile rename src/{librustc_driver/mod.rs => test/run-make/compiler-lookup-paths-2/a.rs} (82%) create mode 100644 src/test/run-make/compiler-lookup-paths-2/b.rs rename src/test/run-make/{test-shard-completeness/main.rs => compiler-lookup-paths-2/c.rs} (79%) delete mode 100644 src/test/run-make/dep-info-custom/Makefile delete mode 100644 src/test/run-make/dep-info-custom/Makefile.foo create mode 100644 src/test/run-make/error-found-staticlib-instead-crate/Makefile create mode 100644 src/test/run-make/error-found-staticlib-instead-crate/bar.rs rename src/test/run-make/{dep-info-custom => error-found-staticlib-instead-crate}/foo.rs (86%) create mode 100644 src/test/run-make/extern-overrides-distribution/Makefile create mode 100644 src/test/run-make/extern-overrides-distribution/libc.rs create mode 100644 src/test/run-make/extern-overrides-distribution/main.rs create mode 100644 src/test/run-make/issue-22131/Makefile create mode 100644 src/test/run-make/issue-22131/foo.rs create mode 100644 src/test/run-make/rustdoc-assoc-types/Makefile create mode 100644 src/test/run-make/rustdoc-assoc-types/lib.rs create mode 100644 src/test/run-make/rustdoc-extern-method/Makefile create mode 100644 src/test/run-make/rustdoc-extern-method/bar.rs create mode 100644 src/test/run-make/rustdoc-extern-method/foo.rs create mode 100644 src/test/run-make/rustdoc-ffi/Makefile create mode 100644 src/test/run-make/rustdoc-ffi/lib.rs create mode 100644 src/test/run-make/rustdoc-ffi/user.rs delete mode 100755 src/test/run-make/rustdoc-hidden-line/verify.sh create mode 100644 src/test/run-make/rustdoc-must-use/Makefile create mode 100644 src/test/run-make/rustdoc-must-use/lib.rs create mode 100644 src/test/run-make/rustdoc-negative-impl/Makefile create mode 100644 src/test/run-make/rustdoc-negative-impl/foo.rs delete mode 100755 src/test/run-make/rustdoc-search-index/verify.sh delete mode 100755 src/test/run-make/rustdoc-smoke/verify.sh create mode 100644 src/test/run-make/rustdoc-viewpath-self/Makefile create mode 100644 src/test/run-make/rustdoc-viewpath-self/foo.rs delete mode 100755 src/test/run-make/rustdoc-where/verify.sh create mode 100644 src/test/run-make/save-analysis/SameDir.rs create mode 100644 src/test/run-make/save-analysis/SameDir3.rs create mode 100644 src/test/run-make/save-analysis/SubDir/mod.rs create mode 100644 src/test/run-make/simd-ffi/Makefile create mode 100755 src/test/run-make/simd-ffi/simd.rs delete mode 100644 src/test/run-make/test-shard-completeness/Makefile create mode 100644 src/test/run-make/use-extern-for-plugins/Makefile create mode 100644 src/test/run-make/use-extern-for-plugins/bar.rs create mode 100644 src/test/run-make/use-extern-for-plugins/baz.rs create mode 100644 src/test/run-make/use-extern-for-plugins/foo.rs create mode 100644 src/test/run-pass-fulldeps/compiler-calls.rs create mode 100644 src/test/run-pass-fulldeps/plugin-lib-ok-in-plugin.rs rename src/test/run-pass-fulldeps/{plugin-link-does-resolve.rs => plugin-plus-extern-crate.rs} (85%) create mode 100644 src/test/run-pass/arr_cycle.rs create mode 100644 src/test/run-pass/associated-types-binding-in-trait.rs create mode 100644 src/test/run-pass/associated-types-duplicate-binding-in-env-hrtb.rs create mode 100644 src/test/run-pass/associated-types-duplicate-binding-in-env.rs create mode 100644 src/test/run-pass/associated-types-enum-field-named.rs create mode 100644 src/test/run-pass/associated-types-enum-field-numbered.rs create mode 100644 src/test/run-pass/associated-types-issue-20220.rs create mode 100644 src/test/run-pass/associated-types-issue-21212.rs create mode 100644 src/test/run-pass/associated-types-normalize-in-bounds-binding.rs create mode 100644 src/test/run-pass/associated-types-normalize-unifield-struct.rs create mode 100644 src/test/run-pass/associated-types-projection-in-object-type.rs create mode 100644 src/test/run-pass/associated-types-projection-in-where-clause.rs create mode 100644 src/test/run-pass/associated-types-stream.rs create mode 100644 src/test/run-pass/associated-types-struct-field-named.rs create mode 100644 src/test/run-pass/associated-types-struct-field-numbered.rs create mode 100644 src/test/run-pass/astconv-cycle-between-trait-and-type.rs create mode 100644 src/test/run-pass/blind-item-mixed-crate-use-item.rs create mode 100644 src/test/run-pass/blind-item-mixed-use-item.rs create mode 100644 src/test/run-pass/cfg-attr-cfg.rs create mode 100644 src/test/run-pass/cfg-attr-crate.rs create mode 100644 src/test/run-pass/coerce-overloaded-autoderef.rs create mode 100644 src/test/run-pass/coerce-unify-return.rs rename src/test/{compile-fail => run-pass}/coherence-bigint-int.rs (92%) rename src/test/{compile-fail => run-pass}/coherence-bigint-vecint.rs (91%) rename src/test/{compile-fail/deriving-span-Rand-enum-struct-variant.rs => run-pass/coherence-cow-1.rs} (63%) create mode 100644 src/test/run-pass/coherence-cow-2.rs create mode 100644 src/test/run-pass/coherence-negative-impls-safe.rs create mode 100644 src/test/run-pass/const-adt-align-mismatch.rs create mode 100644 src/test/run-pass/copy-out-of-array-1.rs create mode 100644 src/test/run-pass/derive-no-std.rs create mode 100644 src/test/run-pass/destructure-array-1.rs create mode 100644 src/test/run-pass/dropck_tarena_sound_drop.rs create mode 100644 src/test/run-pass/env-home-dir.rs create mode 100644 src/test/run-pass/env-vars.rs create mode 100644 src/test/run-pass/extern-rust.rs rename src/test/{compile-fail/unboxed-closures-wrong-trait.rs => run-pass/for-loop-into-iterator.rs} (67%) create mode 100644 src/test/run-pass/for-loop-no-std.rs create mode 100644 src/test/run-pass/format-no-std.rs create mode 100644 src/test/run-pass/infer-container-across-object-cast.rs create mode 100644 src/test/run-pass/init-large-type.rs create mode 100644 src/test/run-pass/into-iterator-type-inference-shift.rs create mode 100644 src/test/run-pass/issue-15881-model-lexer-dotdotdot.rs create mode 100644 src/test/run-pass/issue-16530.rs create mode 100644 src/test/run-pass/issue-19499.rs create mode 100644 src/test/run-pass/issue-20055-box-trait.rs create mode 100644 src/test/run-pass/issue-20055-box-unsized-array.rs create mode 100644 src/test/run-pass/issue-20343.rs create mode 100644 src/test/run-pass/issue-20414.rs create mode 100644 src/test/run-pass/issue-20454.rs create mode 100644 src/test/run-pass/issue-20575.rs create mode 100644 src/test/run-pass/issue-20676.rs create mode 100644 src/test/run-pass/issue-20763-1.rs create mode 100644 src/test/run-pass/issue-20763-2.rs create mode 100644 src/test/run-pass/issue-20797.rs create mode 100644 src/test/run-pass/issue-20823.rs create mode 100644 src/test/run-pass/issue-20953.rs create mode 100644 src/test/run-pass/issue-21033.rs create mode 100644 src/test/run-pass/issue-21058.rs create mode 100644 src/test/run-pass/issue-21245.rs rename src/test/{compile-fail/simd-experimental.rs => run-pass/issue-21296.rs} (81%) create mode 100644 src/test/run-pass/issue-21306.rs create mode 100644 src/test/run-pass/issue-21350.rs create mode 100644 src/test/run-pass/issue-21361.rs rename src/test/{compile-fail/deriving-span-Rand-tuple-struct.rs => run-pass/issue-21363.rs} (74%) create mode 100644 src/test/run-pass/issue-21384.rs create mode 100644 src/test/run-pass/issue-21402.rs create mode 100644 src/test/run-pass/issue-21520.rs create mode 100644 src/test/run-pass/issue-21634.rs rename src/test/{compile-fail/view-items-at-top.rs => run-pass/issue-21655.rs} (67%) create mode 100644 src/test/run-pass/issue-21726.rs create mode 100644 src/test/run-pass/issue-21891.rs create mode 100644 src/test/run-pass/issue-21909.rs create mode 100644 src/test/run-pass/issue-22036.rs rename src/test/{compile-fail/marker-no-share.rs => run-pass/issue22008.rs} (66%) create mode 100644 src/test/run-pass/issue22346.rs create mode 100644 src/test/run-pass/macro_with_super_2.rs create mode 100644 src/test/run-pass/nondrop-cycle.rs create mode 100644 src/test/run-pass/object-lifetime-default-default-to-static.rs create mode 100644 src/test/run-pass/object-lifetime-default-from-ref-struct.rs create mode 100644 src/test/run-pass/object-lifetime-default-from-rptr-box.rs create mode 100644 src/test/run-pass/object-lifetime-default-from-rptr-mut.rs create mode 100644 src/test/run-pass/object-lifetime-default-from-rptr-struct.rs create mode 100644 src/test/run-pass/object-lifetime-default-from-rptr.rs create mode 100644 src/test/run-pass/object-method-numbering.rs create mode 100644 src/test/run-pass/pub-item-inside-macro.rs create mode 100644 src/test/run-pass/pub-method-inside-macro.rs create mode 100644 src/test/run-pass/range-type-infer.rs create mode 100644 src/test/run-pass/regions-assoc-type-region-bound.rs create mode 100644 src/test/run-pass/regions-assoc-type-static-bound.rs create mode 100644 src/test/run-pass/regions-debruijn-of-object.rs create mode 100644 src/test/run-pass/regions-issue-21422.rs create mode 100644 src/test/run-pass/regions-issue-22246.rs create mode 100644 src/test/run-pass/regions-refcell.rs create mode 100644 src/test/run-pass/regions-trait-object-1.rs create mode 100755 src/test/run-pass/send-is-not-static-par-for.rs create mode 100644 src/test/run-pass/snake-case-no-lowercase-equivalent.rs create mode 100644 src/test/run-pass/test-fn-signature-verification-for-explicit-return-type.rs create mode 100644 src/test/run-pass/trait-false-ambiguity-where-clause-builtin-bound.rs create mode 100644 src/test/run-pass/trait-object-with-lifetime-bound.rs create mode 100644 src/test/run-pass/traits-issue-22019.rs create mode 100644 src/test/run-pass/traits-issue-22110.rs create mode 100644 src/test/run-pass/traits-negative-impls.rs create mode 100644 src/test/run-pass/ufcs-trait-object.rs create mode 100644 src/test/run-pass/unboxed-closures-counter-not-moved.rs create mode 100644 src/test/run-pass/unboxed-closures-infer-fnmut-calling-fnmut.rs create mode 100644 src/test/run-pass/unboxed-closures-infer-fnmut-move.rs create mode 100644 src/test/run-pass/unboxed-closures-infer-fnmut.rs create mode 100644 src/test/run-pass/unboxed-closures-infer-fnonce-move.rs create mode 100644 src/test/run-pass/unboxed-closures-infer-fnonce.rs create mode 100644 src/test/run-pass/unboxed-closures-infer-recursive-fn.rs create mode 100644 src/test/run-pass/unboxed-closures-infer-upvar.rs create mode 100644 src/test/run-pass/unboxed-closures-move-some-upvars-in-by-ref-closure.rs create mode 100644 src/test/run-pass/variance-intersection-of-ref-and-opt-ref.rs create mode 100644 src/test/run-pass/variance-trait-matching.rs create mode 100644 src/test/run-pass/variance-vec-covariant.rs create mode 100644 src/test/run-pass/vec-macro-repeat.rs create mode 100644 src/test/run-pass/vec-macro-rvalue-scope.rs create mode 100644 src/test/run-pass/vec_cycle.rs create mode 100644 src/test/run-pass/vec_cycle_wrapped.rs create mode 100644 src/test/run-pass/where-clause-bounds-inconsistency.rs create mode 100644 src/test/run-pass/where-for-self.rs create mode 100644 src/test/run-pass/zero_sized_subslice_match.rs diff --git a/AUTHORS.txt b/AUTHORS.txt index bc8dbc878b..f7934b2fa7 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -9,12 +9,15 @@ Aaron Todd Aaron Turon Aaron Weiss Adam Bozanich +Adam Roben Adam Szkoda Adolfo Ochagavía Adrien Brault Adrien Tétar +Ahmed Charles Ahmed Charles Aidan Cully +Aidan Hobson Sayers Akos Kiss Alan Andrade Alan Williams @@ -25,12 +28,15 @@ Alex Gaynor Alex Lyon Alex Rønne Petersen Alex Whitney -Alexander Light +Alexander Bliskovsky +Alexander Korolkov +Alexander Light Alexander Stavonin Alexandre Gagnon Alexandros Tasos Alexei Sholik Alexis Beingessner +Alfie John Alfie John Ali Smesseim Alisdair Owens @@ -45,6 +51,7 @@ Andreas Neuhaus Andreas Ots Andreas Tolfsen Andrei Formiga +Andrew Barchuk Andrew Cann Andrew Chin Andrew Dunham @@ -56,9 +63,10 @@ Angus Lees Anthony Juckel Anton Löfgren Arcterus -Ariel Ben-Yehuda +Ariel Ben-Yehuda Arjan Topolovec Arkaitz Jimenez +Armin Preiml Armin Ronacher Arpad Borsos Artem @@ -77,7 +85,7 @@ Ben Gamari Ben Harris Ben Kelly Ben Noordhuis -Ben S +Ben S Ben Striegel Benjamin Adamson Benjamin Herr @@ -106,18 +114,23 @@ Brian Dawn Brian J Brennan Brian J. Burg Brian Koropoff -Brian Leibig +Brian Leibig Bruno de Oliveira Abinader Bryan Dunsmore Byron Williams Cadence Marseille Caitlin Potter +Cam Jackson Cameron Zwarich +CarVac +Carl Lerche Carl-Anton Ingmarsson Carlos -Carol Nichols +Carol Nichols Carol Willing +Carter Hinsley Carter Tazio Schonwald +Caspar Krieger Chase Southwood Chris Double Chris Morgan @@ -126,12 +139,14 @@ Chris Peterson Chris Pressey Chris Sainty Chris Shea +Chris Thorn Chris Wong Christoph Burgdorf Christopher Bergqvist Christopher Kendell Chuck Ries Clark Gaebel +Clifford Caoile Clinton Ryan Cody P Schafer Cody Schroeder @@ -152,17 +167,22 @@ Dan Albert Dan Burkert Dan Connolly Dan Luu +Dan Yang Daniel Brooks Daniel Fagnan Daniel Farina +Daniel Griffen +Daniel Grunwald Daniel Hofstetter Daniel Luz Daniel MacDougall Daniel Micay Daniel Patterson +Daniel Raloff Daniel Ralston Daniel Rosenwasser Daniel Ursache Dogariu +Daniil Smirnov Dave Herman Dave Hodder David Creswick @@ -180,6 +200,7 @@ Derek Guenther Derek Harland Diego Giagio Diego Ongaro +Diggory Blake Diggory Hardy Dimitri Krassovski Dirk Gadsden @@ -190,9 +211,12 @@ Dmitry Ermolov Dmitry Promsky Dmitry Vasiliev Do Nhat Minh +Dominik Inführ Donovan Preston Douglas Young Drew Willcoxon +Duane Edwards +Duncan Regan Dylan Braithwaite Dzmitry Malyshau Earl St Sauver @@ -202,6 +226,7 @@ Eduardo Bautista Edward Wang Edward Z. Yang Ehsanul Hoque +Elantsev Serj Elliott Slaughter Elly Fong-Jones Emanuel Rylke @@ -212,6 +237,7 @@ Eric Holmes Eric Kidd Eric Martin Eric Reed +Erick Rivas Erick Tryzelaar Erik Lyon Erik Price @@ -219,6 +245,7 @@ Erik Rose Erwan Etienne Millon Eunchong Yu +Eunji Jeong Evan Klitzke Evan McClanahan Evgeny Sologubov @@ -230,6 +257,8 @@ Fedor Indutny Felix Crux Felix Raimundo Felix S. Klock II +Fenhl +Filip Szczepański Flaper Fesp Flavio Percoco Florian Gilcher @@ -241,10 +270,12 @@ Francisco Souza Franklin Chen Gabriel Gareth Daniel Smith +Garrett Heel Gary Linscott Gary M. Josack Gavin Baker Geoff Hill +Geoffrey Thomas Geoffroy Couprie George Papanikolaou Georges Dubus @@ -256,7 +287,9 @@ Gonçalo Cabrita <_@gmcabrita.com> Graham Fawcett Grahame Bowland Graydon Hoare +Greg Chapple Grigoriy +Guillaume Gomez Guillaume Pinot Gyorgy Andrasek Gábor Horváth @@ -265,18 +298,22 @@ Haitao Li Hanno Braun Harry Marr Heather +Henrik Schopmans Herman J. Radtke III HeroesGrave Hong Chulju Honza Strnad Hugo Jobling +Hugo van der Wijst Huon Wilson Ian Connolly Ian D. Bollinger Ian Daniher +Ignacio Corderi Igor Bukanov Ilya Dmitrichenko Ilyong Cho +Ingo Blechschmidt Isaac Aggrey Isaac Dupree Ivan Enderlin @@ -286,6 +323,7 @@ Ivano Coppola J. J. Weber J.C. Moyer JONNALAGADDA Srinivas +JP Sugarbroad Jack Heizer Jack Moffitt Jacob Edelman @@ -320,9 +358,11 @@ Jason Thompson Jason Toffaletti Jauhien Piatlicki Jay Anderson +Jay True Jed Davis Jed Estep Jeff Balogh +Jeff Belgum Jeff Muizelaar Jeff Olson Jeff Parsons @@ -352,8 +392,9 @@ John Barker John Clements John Fresco John Gallagher +John Hodge +John Kåre Alsaker John Kleint -John KÃ¥re Alsaker John Louis Walker John Schmidt John Simon @@ -368,7 +409,9 @@ Jonathan Sternberg Joonas Javanainen Jordi Boggiano Jorge Aparicio +Jorge Israel Peña Joris Rehm +Jormundir Joseph Crail Joseph Martin Joseph Rushton Wakeling @@ -380,6 +423,7 @@ Joshua Wise Joshua Yanovski Julia Evans Julian Orth +Junseok Lee Junyoung Cho JustAPerson Justin Noah @@ -387,9 +431,10 @@ Jyun-Yan You Kang Seonghoon Kang Seonghoon Kasey Carrothers -Keegan McAllister +Keegan McAllister Kelly Wilson Ken Tossell +KernelJ Keshav Kini Kevin Atkinson Kevin Ballard @@ -400,22 +445,30 @@ Kevin Murphy Kevin Walter Kevin Yap Kiet Tran +Kim Røen +Kostas Karachalios Kyeongwoon Lee +Lai Jiangshan Lars Bergstrom Laurence Tratt Laurent Bonnans +Lauri Lehmijoki Lawrence Velázquez Leah Hanson Lee Wondong LemmingAvalanche Lennart Kudling -Léo Testard +Leo Testard Liigo Zhuang Lindsey Kuper Lionel Flandrin +Logan Chien +Loïc Damien Luca Bruno Luis de Bethencourt +Luke Francl Luke Metz +Luke Steensen Luqman Aden Magnus Auvinen Mahmut Bulut @@ -444,6 +497,7 @@ Matt Carberry Matt Coffin Matt McPherrin Matt Murphy +Matt Roche Matt Windsor Matthew Auld Matthew Iselin @@ -461,6 +515,7 @@ Meyer S. Jacobs Micah Chalmer Michael Arntzenius Michael Bebenita +Michael Budde Michael Dagitses Michael Darakananda Michael Fairley @@ -469,37 +524,46 @@ Michael Kainer Michael Letterle Michael Matuzak Michael Neumann +Michael Pankov Michael Pratt Michael Reinhard Michael Sproul Michael Sullivan Michael Williams -Michael Woerister +Michael Woerister Michael Zhou Mick Koch Mickaël Delahaye Mihnea Dobrescu-Balaur Mike Boutin Mike Dilger +Mike English Mike Pedersen Mike Robinson +Mikhail Zabaluev Mikko Perttunen Ms2ger Mukilan Thiagarajan Mukilan Thiyagarajan Murarth +Mátyás Mustoha +NAKASHIMA, Makoto NODA, Kai Nafis Nathan Froyd +Nathan Stoddard Nathan Typanski Nathan Zadoks Nathaniel Herman +Nathaniel Theis Neil Pankey +Nelson Chen NiccosSystem Nicholas Bishop Nick Cameron Nick Desaulniers Nick Howell +Nick Sarten Nicolas Silva Niels Egberts Niels langager Ellegaard @@ -516,7 +580,7 @@ Olivier Saut Olle Jonsson Or Brostovski Oren Hazi -Orphée Lafond-Lummis +Orpheus Lummis P1start Pablo Brasero Palmer Cox @@ -527,6 +591,7 @@ Patrick Walton Patrick Yevsukov Patrik KÃ¥rlin Paul Collier +Paul Crowley Paul Stansifer Paul Woolcock Pavel Panchekha @@ -537,6 +602,7 @@ Peter Atashian Peter Elmers Peter Hull Peter Marheine +Peter Schuller Peter Williams Peter Zotov Petter Remen @@ -545,12 +611,15 @@ Phil Ruffwind Philip Munksgaard Philipp Brüschweiler Philipp Gesang +Pierre Baillet Piotr Czarnecki Piotr Jawniak Piotr Szotkowski Piotr Zolnierek +Potpourri Pradeep Kumar Prudhvi Krishna Surapaneni +Pyfisch Pythoner6 Q.P.Liu Rafael Ávila de Espíndola @@ -560,8 +629,10 @@ Ramkumar Ramachandra Randati Raphael Catolino Raphael Speyer +Raul Gutierrez S Ray Clanan Reilly Watson +Renato Alves Renato Riccieri Santos Zannon Renato Zannon Reuben Morais @@ -581,7 +652,7 @@ Robert Knight Robert Millar Robin Gloster Robin Stocker -Rohit Joshi +Rohit Joshi Roland Tanglao Rolf Timmermans Rolf van de Krol @@ -590,6 +661,7 @@ Roy Crihfield Roy Frostig Russell Ruud van Asseldonk +Ryan Levick Ryan Mulligan Ryan Scheel Ryman @@ -612,14 +684,18 @@ Sean Gillespie Sean Jensen-Grey Sean McArthur Sean Moon +Sean Patrick Santos Sean Stangl Sean T Allen +Sebastian Gesemann Sebastian N. Fernandez +Sebastian Rasmussen Sebastian Zaha Sebastien Martini Seo Sanghyeon Seonghyun Kim Sergio Benitez +Seth Faxon Seth Pink Seth Pollack Shamir Khodzha @@ -636,6 +712,8 @@ Stefan Plantikow Stepan Koltsov Sterling Greene Steve Klabnik +Steven Allen +Steven Crockett Steven De Coeyer Steven Fackler Steven Sheldon @@ -646,41 +724,53 @@ Subhash Bhushan Sylvestre Ledru Sébastien Chauvel Sébastien Crozet +Sébastien Marie Sébastien Paolacci Tamir Duberstein Taras Shpot Taylor Hutchison Ted Horst Thad Guidry +Thiago Carvalho Thomas Backman Thomas Daede Till Hoeppner -Tim Brooks +Tim Brooks Tim Chevalier +Tim Cuthbertson +Tim Dumol Tim Joseph Dumol Tim Kuehn +Tim Parenti Tim Taubert Timon Rapp Timothée Ravier Titouan Vervack Tobba Tobias Bucher +Toby Scrace Tohava +Tom Chittenden Tom Jakubowski Tom Lee Tomas Sedovic Tommy M. McGuire Tomoki Aonuma +Toni Cárdenas Tony Young Torsten Weber +Travis Watkins Trent Ogren Trinick +Tristan Storch Tshepang Lekhonkhobe Tuncer Ayaz TyOverby Tycho Sci Tyler Bindon +Tyler Thrailkill U-NOV2010\eugals +Ulrik Sverdrup Ulysse Carion Utkarsh Kukreti Uwe Dauernheim @@ -690,6 +780,7 @@ Valentin Tsatskin Valerii Hiora Victor Berger Victor van den Elzen +Victory Vijay Korapaty Viktor Dahl Vincent Belliard @@ -700,11 +791,15 @@ Vivek Galatage Vladimir Matveev Vladimir Pouzanov Vladimir Smola +Vojtech Kral Volker Mische Wade Mealing +Wangshan Lu WebeWizard Wendell Smith +Will William Ting +Willson Mock Yasuhiro Fujii YawarRaza7349 Yazhong Liu @@ -728,10 +823,12 @@ arturo auREAX b1nd bachm +blackbeam blake2-ppc bluss bombless bors +caipre chitra chromatic comex @@ -742,6 +839,7 @@ dgoon donkopotamus eliovir elszben +emanueLczirai flo-l fort free-Runner @@ -753,6 +851,7 @@ hansjorg iancormac84 inrustwetrust jamesluke +jatinn jbranchaud jfager jmgrosen @@ -763,6 +862,7 @@ juxiliary jxv klutzy korenchkin +kud1ing kulakowski kvark kwantam @@ -770,6 +870,7 @@ lpy lucy lyuts m-r-r +madmalik maikklein masklinn mchaput @@ -779,12 +880,14 @@ moonglum mr.Shu mrec musitdev +nathan dotz nham noam novalis oli-obk olivren osa1 +posixphreak qwitwa reedlepee rjz @@ -799,9 +902,11 @@ thiagopnts tinaun tshakah ville-h +visualfc we whataloadofwhat wickerwaka +wonyong kim xales zofrex zslayton diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2b3609e28a..a4656dd415 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,60 +1,156 @@ -## How to submit a bug report +# Contributing to Rust -If you're just reporting a bug, please see: +Thank you for your interest in contributing to Rust! There are many ways to +contribute, and we appreciate all of them. This document is a bit long, so here's +links to the major sections: -http://doc.rust-lang.org/complement-bugreport.html +* [Feature Requests](#feature-requests) +* [Bug Reports](#bug-reports) +* [Pull Requests](#pull-requests) +* [Writing Documentation](#writing-documentation) +* [Issue Triage](#issue-triage) +* [Out-of-tree Contributions](#out-of-tree-contributions) -## Submitting an issue +If you have questions, please make a post on [internals.rust-lang.org][internals] or +hop on [#rust-internals][pound-rust-internals]. -Please submit issues here for bug reports or implementation details. For feature -requests, language changes, or major changes to the libraries, please submit an -issue against the [RFCs repository](https://github.com/rust-lang/rfcs). +As a reminder, all contributors are expected to follow our [Code of Conduct](coc). -## Pull request procedure +[pound-rust-internals]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals +[internals]: http://internals.rust-lang.org +[coc]: http://www.rust-lang.org/conduct.html -Pull requests should be targeted at Rust's `master` branch. -Before pushing to your Github repo and issuing the pull request, -please do two things: +## Feature Requests -1. [Rebase](http://git-scm.com/book/en/Git-Branching-Rebasing) your - local changes against the `master` branch. Resolve any conflicts - that arise. +To request a change to the way that the Rust language works, please open an +issue in the [RFCs repository](https://github.com/rust-lang/rfcs/issues/new) +rather than this one. New features and other significant language changes +must go through the RFC process. -2. Run the full Rust test suite with the `make check` command. You're - not off the hook even if you just stick to documentation; code - examples in the docs are tested as well! Although for simple - wording or grammar fixes, this is probably unnecessary. +## Bug Reports -Pull requests will be treated as "review requests", and we will give -feedback we expect to see corrected on -[style](https://github.com/rust-lang/rust/wiki/Note-style-guide) and -substance before pulling. Changes contributed via pull request should -focus on a single issue at a time, like any other. We will not accept -pull-requests that try to "sneak" unrelated changes in. +While bugs are unfortunate, they're a reality in software. We can't fix what we +don't know about, so please report liberally. If you're not sure if something +is a bug or not, feel free to file a bug anyway. -Normally, all pull requests must include regression tests (see -[Note-testsuite](https://github.com/rust-lang/rust/wiki/Note-testsuite)) -that test your change. Occasionally, a change will be very difficult -to test for. In those cases, please include a note in your commit -message explaining why. +If you have the chance, before reporting a bug, please [search existing +issues](https://github.com/rust-lang/rust/search?q=&type=Issues&utf8=%E2%9C%93), +as it's possible that someone else has already reported your error. This doesn't +always work, and sometimes it's hard to know what to search for, so consider this +extra credit. We won't mind if you accidentally file a duplicate report. -In the licensing header at the beginning of any files you change, -please make sure the listed date range includes the current year. For -example, if it's 2014, and you change a Rust file that was created in -2010, it should begin: +Opening an issue is as easy as following [this +link](https://github.com/rust-lang/rust/issues/new) and filling out the fields. +Here's a template that you can use to file a bug, though it's not necessary to +use it exactly: -``` -// Copyright 2010-2014 The Rust Project Developers. + + + I tried this code: + + + + I expected to see this happen: + + Instead, this happened: + + ## Meta + + `rustc --version --verbose`: + + Backtrace: + +All three components are important: what you did, what you expected, what +happened instead. Please include the output of `rustc --version --verbose`, +which includes important information about what platform you're on, what +version of Rust you're using, etc. + +Sometimes, a backtrace is helpful, and so including that is nice. To get +a backtrace, set the `RUST_BACKTRACE` environment variable. The easiest way +to do this is to invoke `rustc` like this: + +```bash +$ RUST_BACKTRACE=1 rustc ... ``` -# Coordination and communication +## Pull Requests -Get feedback from other developers on -[discuss.rust-lang.org][discuss], and -[#rust-internals][pound-rust-internals]. +Pull requests are the primary mechanism we use to change Rust. GitHub itself +has some [great documentation][pull-requests] on using the Pull Request +feature. We use the 'fork and pull' model described there. -[pound-rust-internals]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals -[discuss]: http://discuss.rust-lang.org +[pull-requests]: https://help.github.com/articles/using-pull-requests/ + +Please make pull requests against the `master` branch. + +All pull requests are reviewed by another person. We have a bot, +@rust-highfive, that will automatically assign a random person to review your request. + +If you want to request that a specific person reviews your pull request, +you can add an `r?` to the message. For example, Steve usually reviews +documentation changes. So if you were to make a documentation change, add + + r? @steveklabnik + +to the end of the message, and @rust-highfive will assign @steveklabnik instead +of a random person. This is entirely optional. + +After someone has reviewed your pull request, they will leave an annotation +on the pull request with an `r+`. It will look something like this: + + @bors: r+ 38fe8d2 + +This tells @bors, our lovable integration bot, that your pull request has +been approved. The PR then enters the [merge queue][merge-queue], where @bors +will run all the tests on every platform we support. If it all works out, +@bors will merge your code into `master` and close the pull request. + +[merge-queue]: http://buildbot.rust-lang.org/homu/queue/rust + +## Writing Documentation + +Documentation improvements are very welcome. The source of `doc.rust-lang.org` +is located in `src/doc` in the tree, and standard API documentation is generated +from the source code itself. + +Documentation pull requests function in the same as other pull requests, though +you may see a slightly different form of `r+`: + + @bors: r+ 38fe8d2 rollup + +That additional `rollup` tells @bors that this change is eligible for a 'rollup'. +To save @bors some work, and to get small changes through more quickly, when +@bors attempts to merge a commit that's rollup-eligible, it will also merge +the other rollup-eligible patches too, and they'll get tested and merged at +the same time. + +## Issue Triage + +Sometimes, an issue will stay open, even though the bug has been fixed. And +sometimes, the original bug may go stale because something has changed in the +meantime. + +It can be helpful to go through older bug reports and make sure that they are +still valid. Load up an older issue, double check that it's still true, and +leave a comment letting us know if it is or is not. The [least recently updated sort][lru] is good for finding issues like this. + +[lru]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-asc + +## Out-of-tree Contributions + +There are a number of other ways to contribute to Rust that don't deal with +this repository. + +Answer questions in [#rust][pound-rust], or on [users.rust-lang.org][users], +or on [StackOverflow][so]. + +Participate in the [RFC process](https://github.com/rust-lang/rfcs). + +Find a [requested community library][community-library], build it, and publish +it to [Crates.io](http://crates.io). Easier said than done, but very, very +valuable! -For more details, please refer to -[Note-development-policy](https://github.com/rust-lang/rust/wiki/Note-development-policy). +[pound-rust]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust +[users]: http://users.rust-lang.org/ +[so]: http://stackoverflow.com/questions/tagged/rust +[community-library]: https://github.com/rust-lang/rfcs/labels/A-community-library diff --git a/COPYRIGHT b/COPYRIGHT index 52039ea7e5..d4ad98e6e8 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -6,7 +6,7 @@ terms. Longer version: -The Rust Project is copyright 2014, The Rust Project +The Rust Project is copyright 2015, The Rust Project Developers (given in the file AUTHORS.txt). Licensed under the Apache License, Version 2.0 @@ -23,12 +23,12 @@ The following third party packages are included, and carry their own copyright notices and license terms: * Two header files that are part of the Valgrind - package. These files are found at src/rt/vg/valgrind.h and - src/rt/vg/memcheck.h, within this distribution. These files + package. These files are found at src/rt/valgrind/valgrind.h and + src/rt/valgrind/memcheck.h, within this distribution. These files are redistributed under the following terms, as noted in them: - for src/rt/vg/valgrind.h: + for src/rt/valgrind/valgrind.h: This file is part of Valgrind, a dynamic binary instrumentation framework. @@ -74,7 +74,7 @@ their own copyright notices and license terms: USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - for src/rt/vg/memcheck.h: + for src/rt/valgrind/memcheck.h: This file is part of MemCheck, a heavyweight Valgrind tool for detecting memory errors. @@ -120,18 +120,6 @@ their own copyright notices and license terms: USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* The auxiliary file src/etc/pkg/modpath.iss contains a - library routine compiled, by Inno Setup, into the Windows - installer binary. This file is licensed under the LGPL, - version 3, but, in our legal interpretation, this does not - affect the aggregate "collected work" license of the Rust - distribution (MIT/ASL2) nor any other components of it. We - believe that the terms governing distribution of the - binary Windows installer built from modpath.iss are - therefore LGPL, but not the terms governing distribution - of any of the files installed by such an installer (such - as the Rust compiler or runtime libraries themselves). - * The src/rt/miniz.c file, carrying an implementation of RFC1950/RFC1951 DEFLATE, by Rich Geldreich . All uses of this file are diff --git a/LICENSE-MIT b/LICENSE-MIT index 39d4bdb5ac..e69282e381 100644 --- a/LICENSE-MIT +++ b/LICENSE-MIT @@ -1,4 +1,4 @@ -Copyright (c) 2014 The Rust Project Developers +Copyright (c) 2015 The Rust Project Developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated diff --git a/Makefile.in b/Makefile.in index a2394101f3..a760155bbd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -59,6 +59,9 @@ # * check-stage$(stage)-$(crate) - Test a crate in a specific stage # * check-stage$(stage)-{rpass,rfail,cfail,rmake,...} - Run tests in src/test/ # * check-stage1-T-$(target)-H-$(host) - Run cross-compiled-tests +# * tidy-basic - show file / line stats +# * tidy-errors - show the highest rustc error code +# * tidy-features - show the status of language and lib features # # Then mix in some of these environment variables to harness the # ultimate power of The Rust Build System. @@ -97,10 +100,9 @@ # make check-stage1-std RUST_TEST_TASKS=1 # # This is hardly all there is to know of The Rust Build System's -# mysteries. The tale continues on the wiki[1][2]. +# mysteries. The tale continues on the wiki[1]. # -# [1]: https://github.com/rust-lang/rust/wiki/Note-getting-started-developing-Rust -# [2]: https://github.com/rust-lang/rust/wiki/Note-testsuite +# [1]: https://github.com/rust-lang/rust/wiki/Note-testsuite # # If you really feel like getting your hands dirty, then: # diff --git a/README.md b/README.md index e858e91773..b6a73730d3 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,34 @@ # The Rust Programming Language This is a compiler for Rust, including standard libraries, tools and -documentation. +documentation. Rust is a systems programming language that is fast, +memory safe and multithreaded, but does not employ a garbage collector +or otherwise impose significant runtime overhead. ## Quick Start -1. Download a [binary installer][installer] for your platform. -2. Read [The Rust Programming Language][trpl]. -3. Enjoy! +Read ["Installing Rust"] from [The Book]. -> ***Note:*** Windows users can read the detailed -> [using Rust on Windows][win-wiki] notes on the wiki. - -[installer]: http://www.rust-lang.org/install.html -[trpl]: http://doc.rust-lang.org/book/index.html -[win-wiki]: https://github.com/rust-lang/rust/wiki/Using-Rust-on-Windows +["Installing Rust"]: http://doc.rust-lang.org/book/installing-rust.html +[The Book]: http://doc.rust-lang.org/book/index.html ## Building from Source 1. Make sure you have installed the dependencies: * `g++` 4.7 or `clang++` 3.x * `python` 2.6 or later (but not 3.x) - * `perl` 5.0 or later * GNU `make` 3.81 or later * `curl` * `git` -2. Download and build Rust: - - You can either download a [tarball] or build directly from the [repo]. - - To build from the [tarball] do: - $ curl -O https://static.rust-lang.org/dist/rust-nightly.tar.gz - $ tar -xzf rust-nightly.tar.gz - $ cd rust-nightly - - Or to build from the [repo] do: +2. Clone the [source] with `git`: $ git clone https://github.com/rust-lang/rust.git $ cd rust - Now that you have Rust's source code, you can configure and build it: +[source]: https://github.com/rust-lang/rust + +3. Build and install: $ ./configure $ make && make install @@ -52,31 +40,35 @@ documentation. When complete, `make install` will place several programs into `/usr/local/bin`: `rustc`, the Rust compiler, and `rustdoc`, the - API-documentation tool. -3. Read [The Rust Programming Language][trpl]. -4. Enjoy! + API-documentation tool. This install does not include [Cargo], + Rust's package manager, which you may also want to build. + +[Cargo]: https://github.com/rust-lang/cargo ### Building on Windows -To easily build on windows we can use [MSYS2](http://sourceforge.net/projects/msys2/): +To easily build on windows we can use [MSYS2](http://msys2.github.io/): 1. Grab the latest MSYS2 installer and go through the installer. 2. Now from the MSYS2 terminal we want to install the mingw64 toolchain and the other tools we need. - $ pacman -S mingw-w64-i686-toolchain - $ pacman -S base-devel +```bash +# choose one based on platform +$ pacman -S mingw-w64-i686-toolchain +$ pacman -S mingw-w64-x86_64-toolchain -3. With that now start `mingw32_shell.bat` from where you installed MSYS2 (i.e. `C:\msys`). +$ pacman -S base-devel +``` + +3. With that now start `mingw32_shell.bat` or `mingw64_shell.bat` + from where you installed MSYS2 (i.e. `C:\msys`). Which one you + choose depends on if you want 32 or 64 bit Rust. 4. From there just navigate to where you have Rust's source code, configure and build it: $ ./configure $ make && make install -[repo]: https://github.com/rust-lang/rust -[tarball]: https://static.rust-lang.org/dist/rust-nightly.tar.gz -[trpl]: http://doc.rust-lang.org/book/index.html - ## Notes Since the Rust compiler is written in Rust, it must be built by a @@ -96,21 +88,33 @@ supported build environments that are most likely to work. Rust currently needs about 1.5 GiB of RAM to build without swapping; if it hits swap, it will take a very long time to build. -There is a lot more documentation in the [wiki]. +There is more advice about hacking on Rust in [CONTRIBUTING.md]. -[wiki]: https://github.com/rust-lang/rust/wiki +[CONTRIBUTING.md]: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md -## Getting help and getting involved +## Getting help The Rust community congregates in a few places: -* [StackOverflow] - Get help here. -* [/r/rust] - General discussion. -* [discuss.rust-lang.org] - For development of the Rust language itself. +* [StackOverflow] - Direct questions about using the language here. +* [users.rust-lang.org] - General discussion, broader questions. +* [/r/rust] - News and general discussion. [StackOverflow]: http://stackoverflow.com/questions/tagged/rust [/r/rust]: http://reddit.com/r/rust -[discuss.rust-lang.org]: http://discuss.rust-lang.org/ +[users.rust-lang.org]: http://users.rust-lang.org/ + +## Contributing + +To contribute to Rust, please see [CONTRIBUTING.md](CONTRIBUTING.md). + +Rust has an [IRC] culture and most real-time collaboration happens in a +variety of channels on Mozilla's IRC network, irc.mozilla.org. The +most popular channel is [#rust], a venue for general discussion about +Rust, and a good place to ask for help, + +[IRC]: https://en.wikipedia.org/wiki/Internet_Relay_Chat +[#rust]: irc://irc.mozilla.org/rust ## License diff --git a/RELEASES.md b/RELEASES.md index b75fde6fd3..09929eee92 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,102 @@ +Version 1.0.0-alpha.2 (February 2015) +------------------------------------- + +* ~1300 changes, numerous bugfixes + +* Highlights + + * The various I/O modules were [overhauled][io-rfc] to reduce + unncessary abstractions and provide better interoperation with + the underlying platform. The old `io` module remains temporarily + at `std::old_io`. + * The standard library now [partipates in feature gating][feat], + so use of unstable libraries now requires a `#![feature(...)]` + attribute. The impact of this change is [described on the + forum][feat-forum]. [RFC][feat-rfc]. + +* Language + + * `for` loops [now operate on the `IntoIterator` trait][into], + which eliminates the need to call `.iter()`, etc. to iterate + over collections. There are some new subtleties to remember + though regarding what sort of iterators various types yield, in + particular that `for foo in bar { }` yields values from a move + iterator, destroying the original collection. [RFC][into-rfc]. + * Objects now have [default lifetime bounds][obj], so you don't + have to write `Box` when you don't care about + storing references. [RFC][obj-rfc]. + * In types that implement `Drop`, [lifetimes must outlive the + value][drop]. This will soon make it possible to safely + implement `Drop` for types where `#[unsafe_destructor]` is now + required. Read the [gorgeous RFC][drop-rfc] for details. + * The fully qualified ::X syntax lets you set the Self + type for a trait method or associated type. [RFC][ufcs-rfc]. + * References to types that implement `Deref` now [automatically + coerce to references][deref] to the dereferenced type `U`, + e.g. `&T where T: Deref` automatically coerces to `&U`. This + should eliminate many unsightly uses of `&*`, as when converting + from references to vectors into references to + slices. [RFC][deref-rfc]. + * The explicit [closure kind syntax][close] (`|&:|`, `|&mut:|`, + `|:|`) is obsolete and closure kind is inferred from context. + * [`Self` is a keyword][Self]. + +* Libraries + + * The `Show` and `String` formatting traits [have been + renamed][fmt] to `Debug` and `Display` to more clearly reflect + their related purposes. Automatically getting a string + conversion to use with `format!("{:?}", something_to_debug)` is + now written `#[derive(Debug)]`. + * Abstract [OS-specific string types][osstr], `std::ff::{OsString, + OsStr}`, provide strings in platform-specific encodings for easier + interop with system APIs. [RFC][osstr-rfc]. + * The `boxed::into_raw` and `Box::frow_raw` functions [convert + between `Box` and `*mut T`][boxraw], a common pattern for + creating raw pointers. + +* Tooling + + * Certain long error messages of the form 'expected foo found bar' + are now [split neatly across multiple + lines][multiline]. Examples in the PR. + * On Unix Rust can be [uninstalled][un] by running + `/usr/local/lib/rustlib/uninstall.sh`. + * The `#[rustc_on_unimplemented]` attribute, requiring the + 'on_unimplemented' feature, lets rustc [display custom error + messages when a trait is expected to be implemented for a type + but is not][onun]. + +* Misc + + * Rust is tested against a [LALR grammar][lalr], which parses + almost all the Rust files that rustc does. + +[boxraw]: https://github.com/rust-lang/rust/pull/21318 +[close]: https://github.com/rust-lang/rust/pull/21843 +[deref]: https://github.com/rust-lang/rust/pull/21351 +[deref-rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0241-deref-conversions.md +[drop]: https://github.com/rust-lang/rust/pull/21972 +[drop-rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0769-sound-generic-drop.md +[feat]: https://github.com/rust-lang/rust/pull/21248 +[feat-forum]: http://users.rust-lang.org/t/psa-important-info-about-rustcs-new-feature-staging/82/5 +[feat-rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0507-release-channels.md +[fmt]: https://github.com/rust-lang/rust/pull/21457 +[into]: https://github.com/rust-lang/rust/pull/20790 +[into-rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0235-collections-conventions.md#intoiterator-and-iterable +[io-rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0517-io-os-reform.md +[lalr]: https://github.com/rust-lang/rust/pull/21452 +[multiline]: https://github.com/rust-lang/rust/pull/19870 +[obj]: https://github.com/rust-lang/rust/pull/22230 +[obj-rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0599-default-object-bound.md +[onun]: https://github.com/rust-lang/rust/pull/20889 +[osstr]: https://github.com/rust-lang/rust/pull/21488 +[osstr-rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0517-io-os-reform.md +[Self]: https://github.com/rust-lang/rust/pull/22158 +[ufcs]: https://github.com/rust-lang/rust/pull/21077 +[ufcs-rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0132-ufcs.md +[un]: https://github.com/rust-lang/rust/pull/22256 + Version 1.0.0-alpha (January 2015) ---------------------------------- @@ -22,7 +121,7 @@ Version 1.0.0-alpha (January 2015) * Documentation continues to be expanded with more API coverage, more examples, and more in-depth explanations. The guides have been consolidated into [The Rust Programming Language][trpl]. - * "Rust By Example" is now maintained by the Rust team. + * "[Rust By Example][rbe]" is now maintained by the Rust team. * All official Rust binary installers now come with [Cargo], the Rust package manager. @@ -182,6 +281,7 @@ Version 1.0.0-alpha (January 2015) [assoc]: https://github.com/rust-lang/rfcs/blob/master/text/0195-associated-items.md [ints]: https://github.com/rust-lang/rfcs/pull/544#issuecomment-68760871 [trpl]: http://doc.rust-lang.org/book/index.html +[rbe]: http://rustbyexample.com/ Version 0.12.0 (October 2014) ----------------------------- diff --git a/configure b/configure index d0b99b12fd..d1b27a96f9 100755 --- a/configure +++ b/configure @@ -28,8 +28,8 @@ need_ok() { need_cmd() { if command -v $1 >/dev/null 2>&1 - then msg "found $1" - else err "need $1" + then msg "found program $1" + else err "need program $1" fi } @@ -340,6 +340,7 @@ need_cmd date need_cmd tr need_cmd sed need_cmd file +need_cmd make msg "inspecting environment" @@ -373,6 +374,10 @@ case $CFG_OSTYPE in CFG_OSTYPE=unknown-dragonfly ;; + OpenBSD) + CFG_OSTYPE=unknown-openbsd + ;; + Darwin) CFG_OSTYPE=apple-darwin ;; @@ -448,6 +453,10 @@ case $CFG_CPUTYPE in CFG_CPUTYPE=aarch64 ;; + powerpc) + CFG_CPUTYPE=powerpc + ;; + x86_64 | x86-64 | x64 | amd64) CFG_CPUTYPE=x86_64 ;; @@ -505,7 +514,6 @@ opt optimize-tests 1 "build tests with optimizations" opt libcpp 1 "build with llvm with libc++ instead of libstdc++ when using clang" opt llvm-assertions 1 "build LLVM with assertions" opt debug 1 "build with extra debug fun" -opt ratchet-bench 0 "ratchet benchmarks" opt fast-make 0 "use .gitmodules as timestamp for submodule deps" opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds" opt local-rust 0 "use an installed rustc rather than downloading a snapshot" @@ -517,6 +525,7 @@ opt verify-install 1 "verify installed binaries work" opt dist-host-only 0 "only install bins for the host architecture" opt inject-std-version 1 "inject the current compiler version of libstd into programs" opt jemalloc 1 "build liballoc with jemalloc" +opt llvm-version-check 1 "don't check if the LLVM version is supported, build anyway" valopt localstatedir "/var/lib" "local state directory" valopt sysconfdir "/etc" "install system configuration files" @@ -608,12 +617,11 @@ putvar CFG_RELEASE_CHANNEL # channel. # Basing CFG_BOOTSTRAP_KEY on CFG_BOOTSTRAP_KEY lets it get picked up # during a Makefile reconfig. -CFG_BOOTSTRAP_KEY="${CFG_BOOTSTRAP_KEY-`date +%N`}" +CFG_BOOTSTRAP_KEY="${CFG_BOOTSTRAP_KEY-`date +%H:%M:%S`}" putvar CFG_BOOTSTRAP_KEY step_msg "looking for build programs" -probe_need CFG_PERL perl probe_need CFG_CURLORWGET curl wget probe_need CFG_PYTHON python2.7 python2.6 python2 python @@ -643,10 +651,10 @@ probe CFG_ISCC iscc probe CFG_JAVAC javac probe CFG_ANTLR4 antlr4 probe CFG_GRUN grun +probe CFG_FLEX flex +probe CFG_BISON bison probe CFG_PANDOC pandoc -probe CFG_PDFLATEX pdflatex probe CFG_XELATEX xelatex -probe CFG_LUALATEX lualatex probe CFG_GDB gdb probe CFG_LLDB lldb @@ -789,7 +797,7 @@ then putvar CFG_ENABLE_CLANG fi -if [ ! -z "$CFG_LLVM_ROOT" -a -e "$CFG_LLVM_ROOT/bin/llvm-config" ] +if [ ! -z "$CFG_LLVM_ROOT" -a -z "$CFG_DISABLE_LLVM_VERSION_CHECK" -a -e "$CFG_LLVM_ROOT/bin/llvm-config" ] then step_msg "using custom LLVM at $CFG_LLVM_ROOT" @@ -1004,7 +1012,7 @@ do make_dir $t/rt/jemalloc for i in \ isaac sync test \ - arch/i386 arch/x86_64 arch/arm arch/aarch64 arch/mips + arch/i386 arch/x86_64 arch/arm arch/aarch64 arch/mips arch/powerpc do make_dir $t/rt/stage$s/$i done @@ -1048,6 +1056,7 @@ do make_dir $h/test/run-pass-fulldeps make_dir $h/test/run-fail make_dir $h/test/compile-fail + make_dir $h/test/parse-fail make_dir $h/test/compile-fail-fulldeps make_dir $h/test/bench make_dir $h/test/perf @@ -1169,7 +1178,7 @@ do msg "configuring LLVM for $gnu_t" - LLVM_TARGETS="--enable-targets=x86,x86_64,arm,aarch64,mips" + LLVM_TARGETS="--enable-targets=x86,x86_64,arm,aarch64,mips,powerpc" LLVM_BUILD="--build=$gnu_t" LLVM_HOST="--host=$gnu_t" LLVM_TARGET="--target=$gnu_t" @@ -1371,7 +1380,8 @@ do done # Munge any paths that appear in config.mk back to posix-y -perl -i.bak -p -e 's@ ([a-zA-Z]):[/\\]@ /\1/@go;' config.tmp +cp config.tmp config.tmp.bak +sed -e 's@ \([a-zA-Z]\):[/\\]@ /\1/@g;' config.tmp rm -f config.tmp.bak msg diff --git a/debian/README.Debian b/debian/README.Debian deleted file mode 100644 index 8e5e33f769..0000000000 --- a/debian/README.Debian +++ /dev/null @@ -1,53 +0,0 @@ -For now, the shared libraries of Rust are private. -The rational is the following: - * Upstream prefers static linking for now - - https://github.com/rust-lang/rust/issues/10209 - * rust is still under heavy development. As far as we know, there is - no commitement from upstream to provide a stable ABI for now. - Until we know more, we cannot take the chance to have Rust-built packages - failing at each release of the compiler. - * Static builds are working out of the box just fine - * However, LD_LIBRARY_PATH has to be updated when -C prefer-dynamic is used - - -- Sylvestre Ledru , Fri, 13 Feb 2015 15:08:43 +0100 - -Bootstrapping from nothing --------------------------- - -You need a "stage0" rust compiler from somewhere. You can download a -pre-built minimal stage0 from http://www.rust-lang.org/ at build time, -or use a rustc that was already in /usr/bin via whatever black magic -(or some other path if you modify debian/rules). - - apt-get source --compile --build-profiles=dlstage0,nodocs rustc - -"dlstage0" downloads a stage0 from rust-lang.org during the build. -"nodocs" disables building rust-doc package and skips the long list of -build-deps usually required. - - dpkg -i rustc*.deb - apt-get source --compile rustc - -This produces the full rust compiler built using your now obsolete -"dlstage0" rustc compiler. - -Bootstrapping a new architecture --------------------------------- - -0. Start with rust installed on an existing platform - -1. Build a rust cross-compiler targeting new architecture - - sudo apt-get build-dep --build-profile=nodocs rustc - dpkg-buildpackage -t $new_arch - -2. Use cross-compiler to build a compiler that runs on new architecture - - dpkg --add-architecture $new_arch - sudo apt-get build-dep --host-architecture=$new_arch rustc - dpkg-buildpackage -a $new_arch - - # Perhaps this is sufficient ?? - #apt-get source --compile --host-architecture=$new_arch rustc - - -- Angus Lees , Sun, 1 Feb 2015 16:16:44 +1100 \ No newline at end of file diff --git a/debian/README.source b/debian/README.source deleted file mode 100644 index 141ed4c06e..0000000000 --- a/debian/README.source +++ /dev/null @@ -1,89 +0,0 @@ -This source package is unfortunately quite tricky and with -several cutting edges, due to the complexity of rust-lang -bootstrapping system and the high rate of language changes -still ongoing. - -We try to describe here inner packaging details and the -reasons behind them. - - -Bootstrapping -============= - -This package is composed of two upstream tarballs: - * the rust-lang source - * a minimal stage0 to start bootstrapping the system - -This is an interim solution, in the long term we plan to have -rust bootstrap itself from an installed copy. However, we are -currently forced to ship a stage0. - -We have to that way, because: - * upstream periodically snapshots stage0. This happens multiple times - between releases, so it is not currently possible to bootstrap using - (only) released versions - * requirements are pretty tight, and when a language feature change - rustc cannot self-bootstrap (you need a stage0 before the change, - which support the old set of features) - * stage0 are in strictly-chained linear series. This means we cannot - miss even a single snapshot, otherwise next bootstrap could fail. - Moreover, also due to first point above, bootstrapping across - non-adjacent snapshots/packages won't work - -On the other hand: - * stage0 is directly generated by the same infrastructure that - packages the source tarball - * Mozilla upstream directly provides it, and at least has some point - you have to trust it in order to break the boostrap cycle - * builds are automated, and public build logs can be inspected at - http://buildbot.rust-lang.org/builders/snap3-linux - * snapshot artifacts have to be manually approved by upstream, and - are identified by the SHA1 of the resulting content - -Things should improve as the language is being stabilized. -We will re-evaluate this choice after 1.0. - - -Embedded libraries -================== - -This source package embeds several external libraries (foeked and managed -by rust upstream as git submodules). -In early stages, many more libraries were forked/emebedded but we are steadily -progressing in splitting them out. - -Here below the remaining ones, with the technical reasons. - - * jemalloc from https://github.com/rust-lang/jemalloc - -> system-wide one can't be used due to rust using a "je_" prefix. - - This is intentional upstream design and won't change soon, see: - - https://github.com/rust-lang/rust/pull/18678 - - http://smallcultfollowing.com/babysteps/blog/2014/11/14/allocators-in-rust/ - - * compiler-rt from https://github.com/rust-lang/compiler-rt - -> system-wide compiler-rt fails during linkage - - Bug reported upstream, still to be fixed, see: - - https://github.com/rust-lang/rust/issues/15054 - - https://github.com/rust-lang/rust/issues/15708 - - * LLVM from https://github.com/rust-lang/llvm - -> minimum required LLVM is now 3.6, not yet released - Moreover, the code does not seem to build against 3.6 rc1 - - https://github.com/rust-lang/rust/issues/21512 - - Rust fork delta is minimal and mostly performance/optimizations only. - Declared goal is to get in synch with vanilla LLVM. - However, rust depends on some features not available in LLVM-3.5, - while LLVM-3.6 is still pending release. See: - - https://github.com/rust-lang/rust/issues/20010 - - http://discuss.rust-lang.org/t/targeted-llvm-for-1-0/1371 - -As a summary, we plan to: - * keep embedding jemalloc (probably forever) - * wait for a stable LLVM-3.6 to try the switch - * work with upstream to fix compiler-rt linkage soon. - - -- Luca Bruno Wed, 21 Jan 2015 14:24:35 +0100 - diff --git a/debian/TODO.Debian b/debian/TODO.Debian deleted file mode 100644 index 9527370d2f..0000000000 --- a/debian/TODO.Debian +++ /dev/null @@ -1,10 +0,0 @@ - * Use LLVM package - * Use Compiler-rt package - * Improve the bootstrap (do the local build first on our systems, upload - to Debian and use the packages) - * Port on other archs - * Create a runtime package (rust-runtime) - * Move the runtime library into a public directory - * Fix the parallel build (failing on tests) - - -- Sylvestre Ledru Tue, 20 Jan 2015 08:50:28 +0100 diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index a1a619559d..0000000000 --- a/debian/changelog +++ /dev/null @@ -1,21 +0,0 @@ -rust (1.0.0~alpha-0~exp2) experimental; urgency=medium - - * Introduce some changes by Angus Lees - - Introduction of build stages - - Disable the parallel execution of tests - - Improving of the parallel syntax - - Use override_dh_auto_build-arch - - Use override_dh_auto_build-indep - - Introduction of rust-mode, vim-syntax-rust & kate-syntax-rust packages - - Better declarations of the doc - - Update of the description - - Watch file updated (with key check) - - -- Sylvestre Ledru Fri, 13 Feb 2015 15:00:45 +0100 - -rust (1.0.0~alpha-0~exp1) experimental; urgency=low - - * Initial package (Closes: #689207) - Work done by Luca Bruno, Jordan Justen and Sylvestre Ledru - - -- Sylvestre Ledru Fri, 23 Jan 2015 15:47:37 +0100 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index ec635144f6..0000000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/debian/control b/debian/control deleted file mode 100644 index 41e4ca845c..0000000000 --- a/debian/control +++ /dev/null @@ -1,92 +0,0 @@ -Source: rust -Section: devel -Priority: extra -Maintainer: Rust Maintainers -Uploaders: Jordan Justen , - Luca Bruno , - Sylvestre Ledru , - Angus Lees -Build-Depends: debhelper (>= 9), -# rust , - autotools-dev, - curl, - python, - nodejs, - zlib1g-dev, - libedit-dev, - valgrind, - git, - ca-certificates -Build-Depends-Indep: pandoc (>=1.9) , - po4a , - texlive-luatex , - texlive-xetex , - texlive-latex-base , - texlive-generic-recommended , - lmodern -# git is necessary for 'make check' -Standards-Version: 3.9.6 -Homepage: http://www.rust-lang.org/ -Vcs-Git: git://git.debian.org/pkg-rust/rust.git -Vcs-Browser: http://git.debian.org/?p=pkg-rust/rust.git;a=summary - -Package: rust -Architecture: amd64 i386 -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: Rust systems programming language - Rust is a curly-brace, block-structured expression language. It - visually resembles the C language family, but differs significantly - in syntactic and semantic details. Its design is oriented toward - concerns of "programming in the large", that is, of creating and - maintaining boundaries - both abstract and operational - that - preserve large-system integrity, availability and concurrency. - . - It supports a mixture of imperative procedural, concurrent actor, - object-oriented and pure functional styles. Rust also supports - generic programming and meta-programming, in both static and dynamic - styles. - -Package: rust-doc -Section: doc -Architecture: all -Build-Profiles: -Depends: ${misc:Depends} -Description: Rust systems programming language - Documentation - Rust is a curly-brace, block-structured expression language. It - visually resembles the C language family, but differs significantly - in syntactic and semantic details. Its design is oriented toward - concerns of "programming in the large", that is, of creating and - maintaining boundaries - both abstract and operational - that - preserve large-system integrity, availability and concurrency. - . - It supports a mixture of imperative procedural, concurrent actor, - object-oriented and pure functional styles. Rust also supports - generic programming and meta-programming, in both static and dynamic - styles. - . - This package contains the documentation. - -Package: rust-mode -Architecture: all -Depends: emacs24 | emacsen, ${misc:Depends} -Suggests: rustc -Description: Rust mode for emacs - This package provides a GNU Emacs major mode for editing code in the - Rust programming language. - -Package: vim-syntax-rust -Architecture: all -Depends: vim, ${misc:Depends} -Recommends: vim-addon-manager -Suggests: rustc, vim-syntastic -Description: Vim highlighting syntax files for Rust - This package provides syntax files for the Vim editor for editing code - in the Rust programming language. - -Package: kate-syntax-rust -Architecture: all -Depends: kate, ${misc:Depends} -Suggests: rustc -Description: Kate highlighting syntax files for Rust - This package provides syntax files for the Kate editor for editing - code in the Rust programming language. diff --git a/debian/copyright b/debian/copyright deleted file mode 100644 index b5d7a61e58..0000000000 --- a/debian/copyright +++ /dev/null @@ -1,417 +0,0 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: rust -Source: http://www.rust-lang.org - -Files: * -Copyright: 2006-2009 Graydon Hoare - 2009-2012 Mozilla Foundation - 2012-2015 The Rust Project Developers (see AUTHORS.txt) -License: Expat or Apache-2.0 - Licensed under the Apache License, Version 2.0 or the MIT - license , - at your option. All files in the project carrying such - notice may not be copied, modified, or distributed except - according to those terms. - -Files: src/librustc_trans/trans/cabi_x86_64.rs -Copyright: 2008-2010 Tachyon Technologies -License: BSD-2-clause - -Files: src/rt/miniz.c -Copyright: 1996-2012 Rich Geldreich -License: unlicense - This is free and unencumbered software released into the public domain. - . - Anyone is free to copy, modify, publish, use, compile, sell, or - distribute this software, either in source code form or as a compiled - binary, for any purpose, commercial or non-commercial, and by any - means. - . - In jurisdictions that recognize copyright laws, the author or authors - of this software dedicate any and all copyright interest in the - software to the public domain. We make this dedication for the - benefit of the public at large and to the detriment of our heirs and - successors. We intend this dedication to be an overt act of - relinquishment in perpetuity of all present and future rights to this - software under copyright law. - . - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - . - For more information, please refer to - -Files: src/rt/valgrind/*.h -Copyright: 2000-2013 Julian Seward -License: Valgrind-BSD-style - -Files: src/jemalloc/* -Copyright: 2002-2014 Jason Evans - 2007-2012 Mozilla Foundation - 2009-2014 Facebook, Inc. -License: BSD-2-clause - -Files: src/jemalloc/bin/pprof -Copyright: 1998-2007, Google Inc. -License: BSD-3-Clause - -Files: src/compiler-rt/* -Copyright: 2009-2015 Howard Hinnant - 2009-2015 The CompileRT Developers (see src/compiler-rt/CREDITS.TXT) -License: U-OF-I-BSD-LIKE or Expat - The compiler_rt library is dual licensed under both the University of Illinois - "BSD-Like" license and the MIT license. As a user of this code you may choose - to use it under either license. As a contributor, you agree to allow your code - to be used under both. - -Files: src/compiler-rt/BlocksRuntime/* -Copyright: 2008-2010 Apple, Inc. -License: Expat - -Files: src/rt/hoedown/* -Copyright: 2008 Natacha Porté - 2011 Vicent Martí - 2013 Devin Torres and the Hoedown authors -License: ISC - -Files: src/libbacktrace/* -Copyright: 2012-2014 Free Software Foundation, Inc. - (written by Ian Lance Taylor, Google.) -License: BSD-3-Clause - -Files: src/llvm/* -Copyright: 2003-2013 University of Illinois at Urbana-Champaign. -License: U-OF-I-BSD-LIKE - -Files: src/llvm/install-sh -Copyright: 1994 X Consortium -License: LLVM-MIT - This script is licensed under the LLVM license, with the following - additional copyrights and restrictions: - . - Copyright 1991 by the Massachusetts Institute of Technology - . - Permission to use, copy, modify, distribute, and sell this software and its - documentation for any purpose is hereby granted without fee, provided that - the above copyright notice appear in all copies and that both that - copyright notice and this permission notice appear in supporting - documentation, and that the name of M.I.T. not be used in advertising or - publicity pertaining to distribution of the software without specific, - written prior permission. M.I.T. makes no representations about the - suitability of this software for any purpose. It is provided "as is" - without express or implied warranty. - . - ============================================================================== - LLVM Release License - ============================================================================== - University of Illinois/NCSA - Open Source License - . - Copyright (c) 2003-2013 University of Illinois at Urbana-Champaign. - All rights reserved. - . - Developed by: - . - LLVM Team - . - University of Illinois at Urbana-Champaign - . - http://llvm.org - . - Permission is hereby granted, free of charge, to any person obtaining a copy of - this software and associated documentation files (the "Software"), to deal with - the Software without restriction, including without limitation the rights to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is furnished to do - so, subject to the following conditions: - . - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - . - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - . - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without specific - prior written permission. - . - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE - SOFTWARE. - -Files: src/llvm/include/llvm/Support/* -Copyright: 2003-2013 University of Illinois at Urbana-Champaign. - Copyright (C) 2004 eXtensible Systems, Inc. -License: U-OF-I-BSD-LIKE - -Files: src/llvm/lib/Support/reg* -Copyright: 1992, 1993, 1994 Henry Spencer - 1992, 1993, 1994 The Regents of the University of California -License: BSD-3-clause - -Files: src/llvm/lib/Target/ARM/* -Copyright: ARM Limited -License: ARM-LLVM - ARM Limited - . - Software Grant License Agreement ("Agreement") - . - Except for the license granted herein to you, ARM Limited ("ARM") reserves all - right, title, and interest in and to the Software (defined below). - . - Definition - . - "Software" means the code and documentation as well as any original work of - authorship, including any modifications or additions to an existing work, that - is intentionally submitted by ARM to llvm.org (http://llvm.org) ("LLVM") for - inclusion in, or documentation of, any of the products owned or managed by LLVM - (the "Work"). For the purposes of this definition, "submitted" means any form of - electronic, verbal, or written communication sent to LLVM or its - representatives, including but not limited to communication on electronic - mailing lists, source code control systems, and issue tracking systems that are - managed by, or on behalf of, LLVM for the purpose of discussing and improving - the Work, but excluding communication that is conspicuously marked otherwise. - . - 1. Grant of Copyright License. Subject to the terms and conditions of this - Agreement, ARM hereby grants to you and to recipients of the Software - distributed by LLVM a perpetual, worldwide, non-exclusive, no-charge, - royalty-free, irrevocable copyright license to reproduce, prepare derivative - works of, publicly display, publicly perform, sublicense, and distribute the - Software and such derivative works. - . - 2. Grant of Patent License. Subject to the terms and conditions of this - Agreement, ARM hereby grants you and to recipients of the Software - distributed by LLVM a perpetual, worldwide, non-exclusive, no-charge, - royalty-free, irrevocable (except as stated in this section) patent license - to make, have made, use, offer to sell, sell, import, and otherwise transfer - the Work, where such license applies only to those patent claims licensable - by ARM that are necessarily infringed by ARM's Software alone or by - combination of the Software with the Work to which such Software was - submitted. If any entity institutes patent litigation against ARM or any - other entity (including a cross-claim or counterclaim in a lawsuit) alleging - that ARM's Software, or the Work to which ARM has contributed constitutes - direct or contributory patent infringement, then any patent licenses granted - to that entity under this Agreement for the Software or Work shall terminate - as of the date such litigation is filed. - . - Unless required by applicable law or agreed to in writing, the software is - provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - either express or implied, including, without limitation, any warranties or - conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. - -Files: src/llvm/test/YAMLParser/* -Copyright: 2006 Kirill Simonov -License: Expat - -Files: src/llvm/utils/unittest/googletest/* -Copyright: 2006-2008, Google Inc. -License: BSD-3-Clause - -License: BSD-1-clause - Redistribution and use in source and binary forms, with - or without modification, are permitted provided that the - following conditions are met: - . - 1. Redistributions of source code must retain the - above copyright notice, this list of conditions - and the following disclaimer. - . - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY - OF SUCH DAMAGE. - -License: BSD-2-clause - Redistribution and use in source and binary forms, with - or without modification, are permitted provided that the - following conditions are met: - . - 1. Redistributions of source code must retain the above - copyright notice, this list of conditions and the - following disclaimer. - 2. Redistributions in binary form must reproduce the - above copyright notice, this list of conditions and - the following disclaimer in the documentation and/or - other materials provided with the distribution. - . - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -License: Expat - Permission is hereby granted, free of charge, to any - person obtaining a copy of this software and associated - documentation files (the "Software"), to deal in the - Software without restriction, including without - limitation the rights to use, copy, modify, merge, - publish, distribute, sublicense, and/or sell copies of - the Software, and to permit persons to whom the Software - is furnished to do so, subject to the following - conditions: - . - The above copyright notice and this permission notice - shall be included in all copies or substantial portions - of the Software. - . - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF - ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED - TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A - PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT - SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR - IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - -License: BSD-3-clause - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. Neither the name of the organization nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - . - THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE. - -License: Apache-2.0 - The full text of the Apache license can be found in - `/usr/share/common-licenses/Apache-2.0'. - -License: Valgrind-BSD-style - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - . - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - . - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - . - 3. Altered source versions must be plainly marked as such, and must - not be misrepresented as being the original software. - . - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - . - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -License: U-OF-I-BSD-LIKE - ============================================================================== - LLVM Release License - ============================================================================== - University of Illinois/NCSA - Open Source License - . - Copyright (c) 2003-2013 University of Illinois at Urbana-Champaign. - All rights reserved. - . - Developed by: - . - LLVM Team - . - University of Illinois at Urbana-Champaign - . - http://llvm.org - . - Permission is hereby granted, free of charge, to any person obtaining a copy of - this software and associated documentation files (the "Software"), to deal with - the Software without restriction, including without limitation the rights to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is furnished to do - so, subject to the following conditions: - . - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - . - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - . - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without specific - prior written permission. - . - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE - SOFTWARE. - -License: ISC - Permission to use, copy, modify, and distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - . - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/debian/gbp.conf b/debian/gbp.conf deleted file mode 100644 index 52b23265e2..0000000000 --- a/debian/gbp.conf +++ /dev/null @@ -1,9 +0,0 @@ -[DEFAULT] -upstream-tag = upstream-tar/%(version)s -debian-tag = debian/%(version)s -pristine-tar = True - -[git-import-orig] -upstream-branch = upstream/tar -debian-branch = master - diff --git a/debian/kate-syntax-rust.install b/debian/kate-syntax-rust.install deleted file mode 100644 index 9141089bac..0000000000 --- a/debian/kate-syntax-rust.install +++ /dev/null @@ -1 +0,0 @@ -src/etc/kate/ usr/share/kde4/apps/katepart/syntax/ diff --git a/debian/make_orig-dl_tarball.py b/debian/make_orig-dl_tarball.py deleted file mode 100755 index 9dc1bfdabd..0000000000 --- a/debian/make_orig-dl_tarball.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/python - -import os -import re -import StringIO -import subprocess -import sys -import tarfile -import urllib3 - -deb_dir = os.path.dirname(os.path.realpath(sys.argv[0])) -src_root_dir = os.path.realpath(os.path.join(deb_dir, '..')) -src_root_parent_dir = os.path.realpath(os.path.join(src_root_dir, '..')) -snapshot_dir = os.path.join(src_root_dir, 'src', 'etc') - -os.environ['CFG_SRC_DIR'] = src_root_dir - -os.chdir(src_root_dir) -ps = subprocess.Popen('dpkg-parsechangelog', stdout=subprocess.PIPE) -version = ps.stdout.read() -regex = re.compile('^Version:\s*(\S+)\s*$', re.MULTILINE) -mo = regex.search(version) -assert mo is not None -version = mo.group(1) -upstream_version = version.split('-')[0] - -sys.path.append(snapshot_dir) -from snapshot import determine_curr_snapshot - -snapshots = {} -for arch in ('i386', 'x86_64'): - snapshots[arch] = determine_curr_snapshot(arch + '-unknown-linux') - -http = urllib3.PoolManager() - -def create_dl_tarball(): - dl_tarfile = 'rust_' + upstream_version + '.orig-dl.tar.gz' - dl_tarfile = os.path.join(src_root_parent_dir, dl_tarfile) - tar = tarfile.open(dl_tarfile, 'w:gz') - url_base = 'https://static.rust-lang.org/stage0-snapshots/' - for arch in snapshots.iterkeys(): - snapshot = snapshots[arch] - url = url_base + snapshot - print 'Downloading', snapshot, '...', - sys.stdout.flush() - r = http.request('GET', url) - print - assert(r.status == 200) - filelike = StringIO.StringIO(r.data) - tarinfo = tarfile.TarInfo(snapshot) - tarinfo.size = len(filelike.buf) - print 'Writing to', dl_tarfile, '...', - tar.addfile(tarinfo, filelike) - filelike.close() - print - tar.close() - -create_dl_tarball() diff --git a/debian/rules b/debian/rules deleted file mode 100755 index 3a71505f55..0000000000 --- a/debian/rules +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- - -include /usr/share/dpkg/pkg-info.mk - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -# When using sudo pbuilder, this will cause mk/install.mk to run sudo, -# but we don't need sudo as a build-dep for the package if we unexport -# the SUDO_USER variable. -unexport SUDO_USER - -# Debhelper clears MAKEFLAGS, so we have to do this again for any -# target where we call $(MAKE) directly. Boo. -DEB_PARALLEL_JOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) -DEB_MAKE_PARALLEL = $(if $(DEB_PARALLEL_JOBS),-j$(DEB_PARALLEL_JOBS)) - - -# $DEB_VERSION_UPSTREAM is the full upstream version (eg. 1.0.0~alpha) - -# This is original/unmangled upstream version (eg. 1.0.0-alpha) -UPSTREAM_RUST_VERSION := $(subst ~,-,$(DEB_VERSION_UPSTREAM)) - -# Main (major.minor) upstream version (eg. 1.0) -MAIN_RUST_VERSION := $(shell echo $(DEB_VERSION_UPSTREAM) | egrep -o '^[^\.]+\.[^\.]+') - -# Upstream version suffix, if any (eg. alpha) -UPSTREAM_RUST_SUFFIX := $(shell echo $(DEB_VERSION_UPSTREAM) | egrep -o '[^\~]+$$') - -# Private dir for rust .so and .rlib -RUST_PREFIX := usr/lib/$(DEB_HOST_MULTIARCH)/rust/$(MAIN_RUST_VERSION) - -# Release type (one of beta, stable or nightly) -RELEASE_CHANNEL := beta - -DEB_DESTDIR := $(CURDIR)/debian/tmp -RUST_TMP_PREFIX := $(DEB_DESTDIR)/$(RUST_PREFIX) - -# These are the normal build flags -COMMON_FLAGS = \ - --disable-manage-submodules \ - --release-channel=$(RELEASE_CHANNEL) \ - --mandir=/usr/share/man \ - --enable-rpath \ - --prefix=/$(RUST_PREFIX) - -# TODO -# These flags will be used to avoid external -# stage0 bootstrap binaries -SELF_BOOTSTRAP = \ - --enable-local-rust \ - --local-rust-root=/usr - -# TODO -# These flags will enable the system-wide LLVM -SYSTEM_LLVM = --llvm-root=/usr - - -ifeq (,$(findstring dlstage0,$(DEB_BUILD_PROFILES))) -# Without these options, a pre-built stage0 will be downloaded from -# rust-lang.org at build time. - DEB_CONFIGURE_EXTRA_FLAGS += --enable-local-rust --local-rust-root=/usr -endif - -BUILD_DOCS = 1 -ifneq (,$(findstring nodocs,$(DEB_BUILD_PROFILES))) - DEB_CONFIGURE_EXTRA_FLAGS += --disable-docs - BUILD_DOCS = 0 -endif - -ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) - DEB_CONFIGURE_EXTRA_FLAGS += --disable-optimize --disable-optimize-cxx --disable-optimize-llvm -endif - - -%: - dh $@ --parallel - -# Note: SHELL is not set by dash, but the configure script wants to use it -override_dh_auto_configure: - SHELL=/bin/sh \ - ./configure \ - $(COMMON_FLAGS) \ - $(DEB_CONFIGURE_EXTRA_FLAGS) \ - # TODO - # $(SELF_BOOTSTRAP) - # $(SYSTEM_LLVM) - - -override_dh_auto_build-arch: - dh_auto_build -- all VERBOSE=1 - -override_dh_auto_build-indep: - $(if $(BUILD_DOCS),dh_auto_build -- docs) - -LD_TMP1 := $(RUST_TMP_PREFIX)/lib -# TODO improve this stuff to make it dynamic -LD_TMP_i386 := $(LD_TMP1)/rustlib/i686-unknown-linux-gnu/lib -LD_TMP_AMD64 := $(LD_TMP1)/rustlib/x86_64-unknown-linux-gnu/lib -RUST_TMP_LD_PATH := $(LD_TMP1):$(LD_TMP_i386):$(LD_TMP_AMD64) - -override_dh_shlibdeps: - LD_LIBRARY_PATH=$(RUST_TMP_LD_PATH):$(LD_LIBRARY_PATH) \ - dh_shlibdeps -l$(RUST_TMP_LD_PATH) - -override_dh_auto_install: - dh_auto_install - dh_link $(RUST_PREFIX)/bin/rustc usr/bin/rustc-$(MAIN_RUST_VERSION) - dh_link usr/bin/rustc-$(MAIN_RUST_VERSION) usr/bin/rustc - dh_link $(RUST_PREFIX)/bin/rustdoc usr/bin/rustdoc-$(MAIN_RUST_VERSION) - dh_link usr/bin/rustdoc-$(MAIN_RUST_VERSION) usr/bin/rustdoc - dh_link $(RUST_PREFIX)/bin/rust-gdb usr/bin/rust-gdb-$(MAIN_RUST_VERSION) - dh_link usr/bin/rust-gdb-$(MAIN_RUST_VERSION) usr/bin/rust-gdb - -override_dh_install: - # Brute force to remove privacy-breach-logo lintian warning. - # We could have updated the upstream sources but it would complexify - # the rebase - if test "$(BUILD)" = "1"; then \ - sed -i '/rel="shortcut icon" href="http:\/\/www.rust-lang.org\/favicon.ico"/d' `find $(DEB_DESTDIR) -iname '*.html'`; \ - rm -f `find $(DEB_DESTDIR) -iname '*.html' -empty` $(DEB_DESTDIR)/usr/share/doc/rust/html/.lock; \ - fi - dh_install - -override_dh_auto_test: - # NB: not parallel - there is some race that leads to failures like: - # note: cc: error: x86_64-unknown-linux-gnu/test/run-pass/generic-default-type-params-cross-crate.stage2-x86_64-unknown-linux-gnulibaux/default_type_params_xc.o: No such file or directory - $(MAKE) check-notidy diff --git a/debian/rust-doc.doc-base.book b/debian/rust-doc.doc-base.book deleted file mode 100644 index b722104e87..0000000000 --- a/debian/rust-doc.doc-base.book +++ /dev/null @@ -1,12 +0,0 @@ -Document: rust-book -Title: The Rust Programming Language -Section: Programming/Rust -Abstract: - This book will teach you about the Rust Programming Language. Rust is - a modern systems programming language focusing on safety and speed. It - accomplishes these goals by being memory safe without using garbage - collection. - - -Format: HTML -Index: /usr/share/doc/rust/book.html diff --git a/debian/rust-doc.doc-base.intro b/debian/rust-doc.doc-base.intro deleted file mode 100644 index 4781b379c1..0000000000 --- a/debian/rust-doc.doc-base.intro +++ /dev/null @@ -1,11 +0,0 @@ -Document: rust-intro -Title: The Rust Guide -Section: Programming/Rust -Abstract: This introduction will give you a rough idea of what Rust is - like, eliding many details. - -Format: HTML -Index: /usr/share/doc/rust/intro.html - -Format: EPUB -Files: /usr/share/doc/rust/intro.epub diff --git a/debian/rust-doc.doc-base.reference b/debian/rust-doc.doc-base.reference deleted file mode 100644 index e3a232cc9b..0000000000 --- a/debian/rust-doc.doc-base.reference +++ /dev/null @@ -1,14 +0,0 @@ -Document: rust-reference -Title: The Rust Reference -Section: Programming/Rust -Abstract: This document is the primary reference for the Rust - programming language. - -Format: HTML -Index: /usr/share/doc/rust/reference.html - -Format: PDF -Files: /usr/share/doc/rust/reference.pdf - -Format: EPUB -Files: /usr/share/doc/rust/reference.epub diff --git a/debian/rust-doc.docs b/debian/rust-doc.docs deleted file mode 100644 index 30d29dea9b..0000000000 --- a/debian/rust-doc.docs +++ /dev/null @@ -1 +0,0 @@ -doc/* diff --git a/debian/rust-doc.install b/debian/rust-doc.install deleted file mode 100644 index 36b87119d0..0000000000 --- a/debian/rust-doc.install +++ /dev/null @@ -1 +0,0 @@ -usr/lib/*/rust/*/share/doc/rust/ usr/share/doc diff --git a/debian/rust-mode.docs b/debian/rust-mode.docs deleted file mode 100644 index 44a4e52b62..0000000000 --- a/debian/rust-mode.docs +++ /dev/null @@ -1 +0,0 @@ -src/etc/emacs/README.md diff --git a/debian/rust-mode.emacsen-install b/debian/rust-mode.emacsen-install deleted file mode 100755 index 3d774f2f07..0000000000 --- a/debian/rust-mode.emacsen-install +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -e - -FLAVOR=$1 -PACKAGE=rust-mode -ELDIR=/usr/share/emacs/site-lisp/ -ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE} -ELFILE="rust-mode.el" -FLAGS="-batch -no-site-file -f batch-byte-compile" - -if [ ${FLAVOR} != emacs ]; then - echo install/${PACKAGE}: Byte-compiling for ${FLAVOR} - - install -m 755 -d ${ELCDIR} - - # Source file symlink (emacsen policy 5C) - ln -s "${ELDIR}/${ELFILE}" "${ELCDIR}/${ELFILE}" - - # Compile - (cd ${ELCDIR}; ${FLAVOR} ${FLAGS} ${ELFILE}) -fi diff --git a/debian/rust-mode.emacsen-remove b/debian/rust-mode.emacsen-remove deleted file mode 100755 index acd07a0912..0000000000 --- a/debian/rust-mode.emacsen-remove +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -set -e - -FLAVOR=$1 -PACKAGE=rust-mode -ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE} - -if [ ${FLAVOR} != emacs ]; then - echo remove/${PACKAGE}: Purging byte-compiled files for ${FLAVOR} - rm -rf "${ELCDIR}" -fi diff --git a/debian/rust-mode.emacsen-startup b/debian/rust-mode.emacsen-startup deleted file mode 100644 index 11c9671d7a..0000000000 --- a/debian/rust-mode.emacsen-startup +++ /dev/null @@ -1,22 +0,0 @@ -;; -*- emacs-lisp -*- -;; -;; Emacs startup file for the Debian GNU/Linux rust-mode package - -(cond - ((not (file-exists-p "/usr/share/emacs/site-lisp/rust-mode")) - (message "Package rust-mode removed but not purged. Skipping setup.")) - ((not (file-exists-p (concat "/usr/share/" - (symbol-name debian-emacs-flavor) - "/site-lisp/rust-mode/rust-mode.elc"))) - (message "Package rust-mode not fully installed. Skipping setup.")) - (t - - (debian-pkg-add-load-path-item - (concat "/usr/share/" - (symbol-name debian-emacs-flavor) - "/site-lisp/rust-mode")) - - ;; autoloads for rust-mode - (autoload 'rust-mode "rust-mode" "Major mode for Rust code." t) - - (add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode)))) diff --git a/debian/rust-mode.install b/debian/rust-mode.install deleted file mode 100644 index 1ca245a386..0000000000 --- a/debian/rust-mode.install +++ /dev/null @@ -1,2 +0,0 @@ -src/etc/emacs/rust-mode.el usr/share/emacs/site-lisp/rust-mode/ -src/etc/emacs/rust-mode-tests.el usr/share/emacs/site-lisp/rust-mode/ diff --git a/debian/rust.install b/debian/rust.install deleted file mode 100644 index 13bc2aa7d8..0000000000 --- a/debian/rust.install +++ /dev/null @@ -1,2 +0,0 @@ -usr/lib/*/rust/*/bin/ -usr/lib/*/rust/*/lib/ diff --git a/debian/rust.lintian-overrides b/debian/rust.lintian-overrides deleted file mode 100644 index 6bfd0544c3..0000000000 --- a/debian/rust.lintian-overrides +++ /dev/null @@ -1,4 +0,0 @@ -# Rust uses libraries that are not directly linked to libc -rust binary: library-not-linked-against-libc - -rust binary: description-starts-with-package-name diff --git a/debian/rust.manpages b/debian/rust.manpages deleted file mode 100644 index f153792b9d..0000000000 --- a/debian/rust.manpages +++ /dev/null @@ -1,3 +0,0 @@ -debian/tmp/usr/share/man/man1/rustc.1 -debian/tmp/usr/share/man/man1/rustdoc.1 - diff --git a/debian/source/format b/debian/source/format deleted file mode 100644 index 163aaf8d82..0000000000 --- a/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (quilt) diff --git a/debian/source/include-binaries b/debian/source/include-binaries deleted file mode 100644 index 8a7caabace..0000000000 --- a/debian/source/include-binaries +++ /dev/null @@ -1,2 +0,0 @@ -debian/dl/rust-stage0-2015-01-07-9e4e524-linux-i386-d8b73fc9aa3ad72ce1408a41e35d78dba10eb4d4.tar.bz2 -debian/dl/rust-stage0-2015-01-07-9e4e524-linux-x86_64-697880d3640e981bbbf23284363e8e9a158b588d.tar.bz2 diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides deleted file mode 100644 index 28333c08e9..0000000000 --- a/debian/source/lintian-overrides +++ /dev/null @@ -1,5 +0,0 @@ -# Rust source tree contains minified javascript code: -# source-is-missing src/librustdoc/html/static/jquery-2.1.0.min.js -rust source: source-is-missing - -rust source: description-starts-with-package-name diff --git a/debian/vim-syntax-rust.install b/debian/vim-syntax-rust.install deleted file mode 100644 index e2ea46a501..0000000000 --- a/debian/vim-syntax-rust.install +++ /dev/null @@ -1,2 +0,0 @@ -debian/vim-syntax-rust.yaml usr/share/vim/registry/ -src/etc/vim usr/share/vim/addons/ diff --git a/debian/vim-syntax-rust.yaml b/debian/vim-syntax-rust.yaml deleted file mode 100644 index 6de3b68581..0000000000 --- a/debian/vim-syntax-rust.yaml +++ /dev/null @@ -1,14 +0,0 @@ -addon: rust-syntax -description: "Addon support for the Rust language" -files: - - after/syntax/rust.vim - - syntax/rust.vim - - compiler/rustc.vim - - compiler/cargo.vim - - ftdetect/rust.vim - - plugin/rust.vim - - autoload/rust.vim - - doc/rust.txt - - indent/rust.vim - - ftplugin/rust.vim - - syntax_checkers/rust/rustc.vim diff --git a/debian/watch b/debian/watch deleted file mode 100644 index 094e7fed32..0000000000 --- a/debian/watch +++ /dev/null @@ -1,5 +0,0 @@ -version=3 - -opts="pgpsigurlmangle=s/$/.asc/" \ - http://www.rust-lang.org/install.html \ - (?:.*/)rustc?-(\d[\d\.]*(?:-\w+)?)-src\.tar\.gz diff --git a/man/rustc.1 b/man/rustc.1 index 3d8b27a408..49056afa04 100644 --- a/man/rustc.1 +++ b/man/rustc.1 @@ -18,10 +18,15 @@ Display the help message \fB\-\-cfg\fR SPEC Configure the compilation environment .TP -\fB\-L\fR PATH -Add a directory to the library search path -.TP -\fB\-l\fR NAME[:KIND] +\fB\-L\fR [KIND=]PATH +Add a directory to the library search path. The optional KIND can be one of: + dependency = only lookup transitive dependencies here + crate = only lookup local `extern crate` directives here + native = only lookup native libraries here + framework = only look for OSX frameworks here + all = look for anything here (the default) +.TP +\fB\-l\fR [KIND=]NAME Link the generated crate(s) to the specified native library NAME. The optional KIND can be one of, static, dylib, or framework. If omitted, dylib is assumed. .TP diff --git a/man/rustdoc.1 b/man/rustdoc.1 index 4c6557f0f6..830884b19b 100644 --- a/man/rustdoc.1 +++ b/man/rustdoc.1 @@ -35,9 +35,27 @@ space-separated list of plugins to run (default: '') --plugin-path directory to load plugins from (default: /tmp/rustdoc_ng/plugins) .TP +--target +target triple to document +.TP +--crate-name +specify the name of this crate +.TP -L --library-path directory to add to crate search path .TP +--cfg +pass a --cfg to rustc +.TP +--extern +pass an --extern to rustc +.TP +--test +run code examples as tests +.TP +--test-args +pass arguments to the test runner +.TP --html-in-header file to add to .TP @@ -47,8 +65,20 @@ file to add in , before content --html-after-content file to add in , after content .TP +--markdown-css +CSS files to include via in a rendered Markdown file +.TP +--markdown-playground-url +URL to send code snippets to +.TP +--markdown-no-toc +don't include table of contents +.TP -h, --help Print help +.TP +-V, --version +Print rustdoc's version .SH "OUTPUT FORMATS" diff --git a/mk/cfg/aarch64-apple-ios.mk b/mk/cfg/aarch64-apple-ios.mk new file mode 100644 index 0000000000..0219ab9605 --- /dev/null +++ b/mk/cfg/aarch64-apple-ios.mk @@ -0,0 +1,36 @@ +# aarch64-apple-ios configuration +CFG_SDK_NAME_aarch64-apple-ios := iphoneos +CFG_SDK_ARCHS_aarch64-apple-ios := arm64 +ifneq ($(findstring darwin,$(CFG_OSTYPE)),) +CFG_IOS_SDK_aarch64-apple-ios := $(shell xcrun --show-sdk-path -sdk iphoneos 2>/dev/null) +CFG_IOS_SDK_FLAGS_aarch64-apple-ios := -target aarch64-apple-darwin -isysroot $(CFG_IOS_SDK_aarch64-apple-ios) -mios-version-min=7.0 -arch arm64 +CC_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos clang) +CXX_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos clang++) +CPP_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos clang++) +AR_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos ar) +endif +CFG_LIB_NAME_aarch64-apple-ios = lib$(1).a +CFG_LIB_GLOB_aarch64-apple-ios = lib$(1)-*.a +CFG_INSTALL_ONLY_RLIB_aarch64-apple-ios = 1 +CFG_STATIC_LIB_NAME_aarch64-apple-ios=lib$(1).a +CFG_LIB_DSYM_GLOB_aarch64-apple-ios = lib$(1)-*.a.dSYM +CFG_CFLAGS_aarch64-apple-ios := $(CFG_IOS_SDK_FLAGS_aarch64-apple-ios) +CFG_JEMALLOC_CFLAGS_aarch64-apple-ios := $(CFG_IOS_SDK_FLAGS_aarch64-apple-ios) +CFG_GCCISH_CFLAGS_aarch64-apple-ios := -Wall -Werror -fPIC $(CFG_IOS_SDK_FLAGS_aarch64-apple-ios) +CFG_GCCISH_CXXFLAGS_aarch64-apple-ios := -fno-rtti $(CFG_IOS_SDK_FLAGS_aarch64-apple-ios) -I$(CFG_IOS_SDK_aarch64-apple-ios)/usr/include/c++/4.2.1 +CFG_GCCISH_LINK_FLAGS_aarch64-apple-ios := -lpthread -syslibroot $(CFG_IOS_SDK_aarch64-apple-ios) -Wl,-no_compact_unwind +CFG_GCCISH_DEF_FLAG_aarch64-apple-ios := -Wl,-exported_symbols_list, +CFG_GCCISH_PRE_LIB_FLAGS_aarch64-apple-ios := +CFG_GCCISH_POST_LIB_FLAGS_aarch64-apple-ios := +CFG_DEF_SUFFIX_aarch64-apple-ios := .darwin.def +CFG_LLC_FLAGS_aarch64-apple-ios := -mattr=+neon,+cyclone,+fp-armv8 +CFG_INSTALL_NAME_aarch64-apple-ios = -Wl,-install_name,@rpath/$(1) +CFG_LIBUV_LINK_FLAGS_aarch64-apple-ios = +CFG_EXE_SUFFIX_aarch64-apple-ios := +CFG_WINDOWSY_aarch64-apple-ios := +CFG_UNIXY_aarch64-apple-ios := 1 +CFG_PATH_MUNGE_aarch64-apple-ios := true +CFG_LDPATH_aarch64-apple-ios := +CFG_RUN_aarch64-apple-ios = $(2) +CFG_RUN_TARG_aarch64-apple-ios = $(call CFG_RUN_aarch64-apple-ios,,$(2)) +CFG_GNU_TRIPLE_aarch64-apple-ios := aarch64-apple-ios diff --git a/mk/cfg/aarch64-linux-android.mk b/mk/cfg/aarch64-linux-android.mk new file mode 100644 index 0000000000..a6f7f2ba1d --- /dev/null +++ b/mk/cfg/aarch64-linux-android.mk @@ -0,0 +1,30 @@ +# aarch64-linux-android configuration +# CROSS_PREFIX_aarch64-linux-android- +CC_aarch64-linux-android=$(CFG_ANDROID_CROSS_PATH)/bin/aarch64-linux-android-gcc +CXX_aarch64-linux-android=$(CFG_ANDROID_CROSS_PATH)/bin/aarch64-linux-android-g++ +CPP_aarch64-linux-android=$(CFG_ANDROID_CROSS_PATH)/bin/aarch64-linux-android-gcc -E +AR_aarch64-linux-android=$(CFG_ANDROID_CROSS_PATH)/bin/aarch64-linux-android-ar +CFG_LIB_NAME_aarch64-linux-android=lib$(1).so +CFG_STATIC_LIB_NAME_aarch64-linux-android=lib$(1).a +CFG_LIB_GLOB_aarch64-linux-android=lib$(1)-*.so +CFG_LIB_DSYM_GLOB_aarch64-linux-android=lib$(1)-*.dylib.dSYM +CFG_JEMALLOC_CFLAGS_aarch64-linux-android := -D__aarch64__ -DANDROID -D__ANDROID__ $(CFLAGS) +CFG_GCCISH_CFLAGS_aarch64-linux-android := -Wall -g -fPIC -D__aarch64__ -DANDROID -D__ANDROID__ $(CFLAGS) +CFG_GCCISH_CXXFLAGS_aarch64-linux-android := -fno-rtti $(CXXFLAGS) +CFG_GCCISH_LINK_FLAGS_aarch64-linux-android := -shared -fPIC -ldl -g -lm -lsupc++ +CFG_GCCISH_DEF_FLAG_aarch64-linux-android := -Wl,--export-dynamic,--dynamic-list= +CFG_GCCISH_PRE_LIB_FLAGS_aarch64-linux-android := -Wl,-whole-archive +CFG_GCCISH_POST_LIB_FLAGS_aarch64-linux-android := -Wl,-no-whole-archive +CFG_DEF_SUFFIX_aarch64-linux-android := .android.def +CFG_LLC_FLAGS_aarch64-linux-android := +CFG_INSTALL_NAME_aarch64-linux-android = +CFG_EXE_SUFFIX_aarch64-linux-android := +CFG_WINDOWSY_aarch64-linux-android := +CFG_UNIXY_aarch64-linux-android := 1 +CFG_PATH_MUNGE_aarch64-linux-android := true +CFG_LDPATH_aarch64-linux-android := +CFG_RUN_aarch64-linux-android= +CFG_RUN_TARG_aarch64-linux-android= +RUSTC_FLAGS_aarch64-linux-android := +RUSTC_CROSS_FLAGS_aarch64-linux-android := +CFG_GNU_TRIPLE_aarch64-linux-android := aarch64-linux-android diff --git a/mk/cfg/arm-apple-ios.mk b/mk/cfg/arm-apple-ios.mk deleted file mode 100644 index d1f1ee6f3b..0000000000 --- a/mk/cfg/arm-apple-ios.mk +++ /dev/null @@ -1,35 +0,0 @@ -# arm-apple-ios configuration -CFG_SDK_NAME_arm-apple-ios = iphoneos -CFG_SDK_ARCHS_arm-apple-ios = armv7 -ifneq ($(findstring darwin,$(CFG_OSTYPE)),) -CFG_IOS_SDK = $(shell xcrun --show-sdk-path -sdk iphoneos 2>/dev/null) -CFG_IOS_FLAGS = -target armv7-apple-ios -isysroot $(CFG_IOS_SDK) -mios-version-min=7.0 -CC_arm-apple-ios = $(shell xcrun -find -sdk iphoneos clang) -CXX_arm-apple-ios = $(shell xcrun -find -sdk iphoneos clang++) -CPP_arm-apple-ios = $(shell xcrun -find -sdk iphoneos clang++) -AR_arm-apple-ios = $(shell xcrun -find -sdk iphoneos ar) -endif -CFG_LIB_NAME_arm-apple-ios = lib$(1).a -CFG_LIB_GLOB_arm-apple-ios = lib$(1)-*.a -CFG_STATIC_LIB_NAME_arm-apple-ios=lib$(1).a -CFG_LIB_DSYM_GLOB_arm-apple-ios = lib$(1)-*.a.dSYM -CFG_JEMALLOC_CFLAGS_arm-apple-ios := -arch armv7 -mfpu=vfp3 $(CFG_IOS_FLAGS) -CFG_GCCISH_CFLAGS_arm-apple-ios := -Wall -Werror -g -fPIC $(CFG_IOS_FLAGS) -mfpu=vfp3 -arch armv7 -CFG_GCCISH_CXXFLAGS_arm-apple-ios := -fno-rtti $(CFG_IOS_FLAGS) -I$(CFG_IOS_SDK)/usr/include/c++/4.2.1 -CFG_GCCISH_LINK_FLAGS_arm-apple-ios := -lpthread -syslibroot $(CFG_IOS_SDK) -Wl,-no_compact_unwind -CFG_GCCISH_DEF_FLAG_arm-apple-ios := -Wl,-exported_symbols_list, -CFG_GCCISH_PRE_LIB_FLAGS_arm-apple-ios := -CFG_GCCISH_POST_LIB_FLAGS_arm-apple-ios := -CFG_DEF_SUFFIX_arm-apple-ios := .darwin.def -CFG_LLC_FLAGS_arm-apple-ios := -mattr=+vfp3,+v7,+thumb2,+neon -march=arm -CFG_INSTALL_NAME_arm-apple-ios = -Wl,-install_name,@rpath/$(1) -CFG_EXE_SUFFIX_arm-apple-ios := -CFG_WINDOWSY_arm-apple-ios := -CFG_UNIXY_arm-apple-ios := 1 -CFG_PATH_MUNGE_arm-apple-ios := true -CFG_LDPATH_arm-apple-ios := -CFG_RUN_arm-apple-ios = $(2) -CFG_RUN_TARG_arm-apple-ios = $(call CFG_RUN_arm-apple-ios,,$(2)) -RUSTC_FLAGS_arm-apple-ios := -C relocation_model=pic -RUSTC_CROSS_FLAGS_arm-apple-ios :=-C relocation_model=pic -CFG_GNU_TRIPLE_arm-apple-ios := arm-apple-ios diff --git a/mk/cfg/armv7-apple-ios.mk b/mk/cfg/armv7-apple-ios.mk new file mode 100644 index 0000000000..aee4e64add --- /dev/null +++ b/mk/cfg/armv7-apple-ios.mk @@ -0,0 +1,34 @@ +# armv7-apple-ios configuration +CFG_SDK_NAME_armv7-apple-ios := iphoneos +CFG_SDK_ARCHS_armv7-apple-ios := armv7 +ifneq ($(findstring darwin,$(CFG_OSTYPE)),) +CFG_IOS_SDK_armv7-apple-ios := $(shell xcrun --show-sdk-path -sdk iphoneos 2>/dev/null) +CFG_IOS_SDK_FLAGS_armv7-apple-ios := -target armv7-apple-ios -isysroot $(CFG_IOS_SDK_armv7-apple-ios) -mios-version-min=7.0 +CC_armv7-apple-ios = $(shell xcrun -find -sdk iphoneos clang) +CXX_armv7-apple-ios = $(shell xcrun -find -sdk iphoneos clang++) +CPP_armv7-apple-ios = $(shell xcrun -find -sdk iphoneos clang++) +AR_armv7-apple-ios = $(shell xcrun -find -sdk iphoneos ar) +endif +CFG_LIB_NAME_armv7-apple-ios = lib$(1).a +CFG_LIB_GLOB_armv7-apple-ios = lib$(1)-*.a +CFG_INSTALL_ONLY_RLIB_armv7-apple-ios = 1 +CFG_STATIC_LIB_NAME_armv7-apple-ios=lib$(1).a +CFG_LIB_DSYM_GLOB_armv7-apple-ios = lib$(1)-*.a.dSYM +CFG_JEMALLOC_CFLAGS_armv7-apple-ios := -arch armv7 -mfpu=vfp3 $(CFG_IOS_SDK_FLAGS_armv7-apple-ios) +CFG_GCCISH_CFLAGS_armv7-apple-ios := -Wall -Werror -g -fPIC $(CFG_IOS_SDK_FLAGS_armv7-apple-ios) -mfpu=vfp3 -arch armv7 +CFG_GCCISH_CXXFLAGS_armv7-apple-ios := -fno-rtti $(CFG_IOS_SDK_FLAGS_armv7-apple-ios) -I$(CFG_IOS_SDK_armv7-apple-ios)/usr/include/c++/4.2.1 +CFG_GCCISH_LINK_FLAGS_armv7-apple-ios := -lpthread -syslibroot $(CFG_IOS_SDK_armv7-apple-ios) -Wl,-no_compact_unwind +CFG_GCCISH_DEF_FLAG_armv7-apple-ios := -Wl,-exported_symbols_list, +CFG_GCCISH_PRE_LIB_FLAGS_armv7-apple-ios := +CFG_GCCISH_POST_LIB_FLAGS_armv7-apple-ios := +CFG_DEF_SUFFIX_armv7-apple-ios := .darwin.def +CFG_LLC_FLAGS_armv7-apple-ios := -mattr=+vfp3,+v7,+neon -march=arm +CFG_INSTALL_NAME_armv7-apple-ios = -Wl,-install_name,@rpath/$(1) +CFG_EXE_SUFFIX_armv7-apple-ios := +CFG_WINDOWSY_armv7-apple-ios := +CFG_UNIXY_armv7-apple-ios := 1 +CFG_PATH_MUNGE_armv7-apple-ios := true +CFG_LDPATH_armv7-apple-ios := +CFG_RUN_armv7-apple-ios = $(2) +CFG_RUN_TARG_armv7-apple-ios = $(call CFG_RUN_armv7-apple-ios,,$(2)) +CFG_GNU_TRIPLE_armv7-apple-ios := armv7-apple-ios diff --git a/mk/cfg/armv7s-apple-ios.mk b/mk/cfg/armv7s-apple-ios.mk new file mode 100644 index 0000000000..7540bd44de --- /dev/null +++ b/mk/cfg/armv7s-apple-ios.mk @@ -0,0 +1,34 @@ +# armv7s-apple-ios configuration +CFG_SDK_NAME_armv7s-apple-ios := iphoneos +CFG_SDK_ARCHS_armv7s-apple-ios := armv7s +ifneq ($(findstring darwin,$(CFG_OSTYPE)),) +CFG_IOS_SDK_armv7s-apple-ios := $(shell xcrun --show-sdk-path -sdk iphoneos 2>/dev/null) +CFG_IOS_SDK_FLAGS_armv7s-apple-ios := -target armv7s-apple-ios -isysroot $(CFG_IOS_SDK_armv7s-apple-ios) -mios-version-min=7.0 +CC_armv7s-apple-ios = $(shell xcrun -find -sdk iphoneos clang) +CXX_armv7s-apple-ios = $(shell xcrun -find -sdk iphoneos clang++) +CPP_armv7s-apple-ios = $(shell xcrun -find -sdk iphoneos clang++) +AR_armv7s-apple-ios = $(shell xcrun -find -sdk iphoneos ar) +endif +CFG_LIB_NAME_armv7s-apple-ios = lib$(1).a +CFG_LIB_GLOB_armv7s-apple-ios = lib$(1)-*.a +CFG_INSTALL_ONLY_RLIB_armv7s-apple-ios = 1 +CFG_STATIC_LIB_NAME_armv7s-apple-ios=lib$(1).a +CFG_LIB_DSYM_GLOB_armv7s-apple-ios = lib$(1)-*.a.dSYM +CFG_JEMALLOC_CFLAGS_armv7s-apple-ios := -arch armv7s -mfpu=vfp4 $(CFG_IOS_SDK_FLAGS_armv7s-apple-ios) +CFG_GCCISH_CFLAGS_armv7s-apple-ios := -Wall -Werror -g -fPIC $(CFG_IOS_SDK_FLAGS_armv7s-apple-ios) -mfpu=vfp4 -arch armv7s +CFG_GCCISH_CXXFLAGS_armv7s-apple-ios := -fno-rtti $(CFG_IOS_SDK_FLAGS_armv7s-apple-ios) -I$(CFG_IOS_SDK_armv7s-apple-ios)/usr/include/c++/4.2.1 +CFG_GCCISH_LINK_FLAGS_armv7s-apple-ios := -lpthread -syslibroot $(CFG_IOS_SDK_armv7s-apple-ios) -Wl,-no_compact_unwind +CFG_GCCISH_DEF_FLAG_armv7s-apple-ios := -Wl,-exported_symbols_list, +CFG_GCCISH_PRE_LIB_FLAGS_armv7s-apple-ios := +CFG_GCCISH_POST_LIB_FLAGS_armv7s-apple-ios := +CFG_DEF_SUFFIX_armv7s-apple-ios := .darwin.def +CFG_LLC_FLAGS_armv7s-apple-ios := -mattr=+vfp4,+v7,+neon +CFG_INSTALL_NAME_armv7s-apple-ios = -Wl,-install_name,@rpath/$(1) +CFG_EXE_SUFFIX_armv7s-apple-ios := +CFG_WINDOWSY_armv7s-apple-ios := +CFG_UNIXY_armv7s-apple-ios := 1 +CFG_PATH_MUNGE_armv7s-apple-ios := true +CFG_LDPATH_armv7s-apple-ios := +CFG_RUN_armv7s-apple-ios = $(2) +CFG_RUN_TARG_armv7s-apple-ios = $(call CFG_RUN_armv7s-apple-ios,,$(2)) +CFG_GNU_TRIPLE_armv7s-apple-ios := armv7s-apple-ios diff --git a/mk/cfg/i386-apple-ios.mk b/mk/cfg/i386-apple-ios.mk index 63eb590c6e..e84bf49d40 100644 --- a/mk/cfg/i386-apple-ios.mk +++ b/mk/cfg/i386-apple-ios.mk @@ -1,9 +1,9 @@ # i386-apple-ios configuration -CFG_SDK_NAME_i386-apple-ios = iphonesimulator -CFG_SDK_ARCHS_i386-apple-ios = i386 +CFG_SDK_NAME_i386-apple-ios := iphonesimulator +CFG_SDK_ARCHS_i386-apple-ios := i386 ifneq ($(findstring darwin,$(CFG_OSTYPE)),) -CFG_IOSSIM_SDK = $(shell xcrun --show-sdk-path -sdk iphonesimulator 2>/dev/null) -CFG_IOSSIM_FLAGS = -target i386-apple-ios -isysroot $(CFG_IOSSIM_SDK) -mios-simulator-version-min=7.0 +CFG_IOSSIM_SDK_i386-apple-ios := $(shell xcrun --show-sdk-path -sdk iphonesimulator 2>/dev/null) +CFG_IOSSIM_FLAGS_i386-apple-ios := -m32 -target i386-apple-ios -isysroot $(CFG_IOSSIM_SDK_i386-apple-ios) -mios-simulator-version-min=7.0 CC_i386-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang) CXX_i386-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang++) CPP_i386-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang++) @@ -11,23 +11,24 @@ AR_i386-apple-ios = $(shell xcrun -find -sdk iphonesimulator ar) endif CFG_LIB_NAME_i386-apple-ios = lib$(1).a CFG_LIB_GLOB_i386-apple-ios = lib$(1)-*.dylib +CFG_INSTALL_ONLY_RLIB_i386-apple-ios = 1 CFG_STATIC_LIB_NAME_i386-apple-ios=lib$(1).a CFG_LIB_DSYM_GLOB_i386-apple-ios = lib$(1)-*.dylib.dSYM -CFG_GCCISH_CFLAGS_i386-apple-ios = -Wall -Werror -g -fPIC -m32 $(CFG_IOSSIM_FLAGS) -CFG_GCCISH_CXXFLAGS_i386-apple-ios = -fno-rtti $(CFG_IOSSIM_FLAGS) -I$(CFG_IOSSIM_SDK)/usr/include/c++/4.2.1 -CFG_GCCISH_LINK_FLAGS_i386-apple-ios = -lpthread -Wl,-no_compact_unwind -m32 -Wl,-syslibroot $(CFG_IOSSIM_SDK) -CFG_GCCISH_DEF_FLAG_i386-apple-ios = -Wl,-exported_symbols_list, -CFG_GCCISH_PRE_LIB_FLAGS_i386-apple-ios = -CFG_GCCISH_POST_LIB_FLAGS_i386-apple-ios = -CFG_DEF_SUFFIX_i386-apple-ios = .darwin.def +CFG_GCCISH_CFLAGS_i386-apple-ios := -Wall -Werror -g -fPIC -m32 $(CFG_IOSSIM_FLAGS_i386-apple-ios) +CFG_GCCISH_CXXFLAGS_i386-apple-ios := -fno-rtti $(CFG_IOSSIM_FLAGS_i386-apple-ios) -I$(CFG_IOSSIM_SDK_i386-apple-ios)/usr/include/c++/4.2.1 +CFG_GCCISH_LINK_FLAGS_i386-apple-ios := -lpthread -m32 -Wl,-no_compact_unwind -m32 -Wl,-syslibroot $(CFG_IOSSIM_SDK_i386-apple-ios) +CFG_GCCISH_DEF_FLAG_i386-apple-ios := -Wl,-exported_symbols_list, +CFG_GCCISH_PRE_LIB_FLAGS_i386-apple-ios := +CFG_GCCISH_POST_LIB_FLAGS_i386-apple-ios := +CFG_DEF_SUFFIX_i386-apple-ios := .darwin.def CFG_LLC_FLAGS_i386-apple-ios = CFG_INSTALL_NAME_i386-apple-ios = -Wl,-install_name,@rpath/$(1) -CFG_EXE_SUFFIX_i386-apple-ios = -CFG_WINDOWSY_i386-apple-ios = -CFG_UNIXY_i386-apple-ios = 1 -CFG_PATH_MUNGE_i386-apple-ios = true +CFG_EXE_SUFFIX_i386-apple-ios := +CFG_WINDOWSY_i386-apple-ios := +CFG_UNIXY_i386-apple-ios := 1 +CFG_PATH_MUNGE_i386-apple-ios = :true CFG_LDPATH_i386-apple-ios = CFG_RUN_i386-apple-ios = $(2) CFG_RUN_TARG_i386-apple-ios = $(call CFG_RUN_i386-apple-ios,,$(2)) -CFG_JEMALLOC_CFLAGS_i386-apple-ios = $(CFG_IOSSIM_FLAGS) -target i386-apple-ios -Wl,-syslibroot $(CFG_IOSSIM_SDK) -Wl,-no_compact_unwind +CFG_JEMALLOC_CFLAGS_i386-apple-ios = $(CFG_IOSSIM_FLAGS_i386-apple-ios) -target i386-apple-ios #-Wl,-syslibroot $(CFG_IOSSIM_SDK_i386-apple-ios) -Wl,-no_compact_unwind CFG_GNU_TRIPLE_i386-apple-ios := i386-apple-ios diff --git a/mk/cfg/i686-pc-windows-gnu.mk b/mk/cfg/i686-pc-windows-gnu.mk index ecb405b76f..357a321688 100644 --- a/mk/cfg/i686-pc-windows-gnu.mk +++ b/mk/cfg/i686-pc-windows-gnu.mk @@ -8,8 +8,8 @@ CFG_LIB_NAME_i686-pc-windows-gnu=$(1).dll CFG_STATIC_LIB_NAME_i686-pc-windows-gnu=$(1).lib CFG_LIB_GLOB_i686-pc-windows-gnu=$(1)-*.dll CFG_LIB_DSYM_GLOB_i686-pc-windows-gnu=$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_i686-pc-windows-gnu := -march=i686 -m32 -D_WIN32_WINNT=0x0600 $(CFLAGS) -CFG_GCCISH_CFLAGS_i686-pc-windows-gnu := -Wall -Werror -g -m32 -D_WIN32_WINNT=0x0600 $(CFLAGS) +CFG_JEMALLOC_CFLAGS_i686-pc-windows-gnu := -march=i686 -m32 -D_WIN32_WINNT=0x0600 -D__USE_MINGW_ANSI_STDIO=1 $(CFLAGS) +CFG_GCCISH_CFLAGS_i686-pc-windows-gnu := -Wall -Werror -g -m32 -D_WIN32_WINNT=0x0600 -D__USE_MINGW_ANSI_STDIO=1 $(CFLAGS) CFG_GCCISH_CXXFLAGS_i686-pc-windows-gnu := -fno-rtti $(CXXFLAGS) CFG_GCCISH_LINK_FLAGS_i686-pc-windows-gnu := -shared -g -m32 CFG_GCCISH_DEF_FLAG_i686-pc-windows-gnu := @@ -22,7 +22,7 @@ CFG_EXE_SUFFIX_i686-pc-windows-gnu := .exe CFG_WINDOWSY_i686-pc-windows-gnu := 1 CFG_UNIXY_i686-pc-windows-gnu := CFG_PATH_MUNGE_i686-pc-windows-gnu := -CFG_LDPATH_i686-pc-windows-gnu :=$(CFG_LDPATH_i686-pc-windows-gnu):$(PATH) -CFG_RUN_i686-pc-windows-gnu=PATH="$(CFG_LDPATH_i686-pc-windows-gnu):$(1)" $(2) -CFG_RUN_TARG_i686-pc-windows-gnu=$(call CFG_RUN_i686-pc-windows-gnu,$(HLIB$(1)_H_$(CFG_BUILD)),$(2)) +CFG_LDPATH_i686-pc-windows-gnu := +CFG_RUN_i686-pc-windows-gnu=$(2) +CFG_RUN_TARG_i686-pc-windows-gnu=$(call CFG_RUN_i686-pc-windows-gnu,,$(2)) CFG_GNU_TRIPLE_i686-pc-windows-gnu := i686-w64-mingw32 diff --git a/mk/cfg/powerpc-unknown-linux-gnu.mk b/mk/cfg/powerpc-unknown-linux-gnu.mk new file mode 100644 index 0000000000..fd37bd663f --- /dev/null +++ b/mk/cfg/powerpc-unknown-linux-gnu.mk @@ -0,0 +1,28 @@ +# powerpc-unknown-linux-gnu configuration +CROSS_PREFIX_powerpc-unknown-linux-gnu=powerpc-linux-gnu- +CC_powerpc-unknown-linux-gnu=$(CC) +CXX_powerpc-unknown-linux-gnu=$(CXX) +CPP_powerpc-unknown-linux-gnu=$(CPP) +AR_powerpc-unknown-linux-gnu=$(AR) +CFG_LIB_NAME_powerpc-unknown-linux-gnu=lib$(1).so +CFG_STATIC_LIB_NAME_powerpc-unknown-linux-gnu=lib$(1).a +CFG_LIB_GLOB_powerpc-unknown-linux-gnu=lib$(1)-*.so +CFG_LIB_DSYM_GLOB_powerpc-unknown-linux-gnu=lib$(1)-*.dylib.dSYM +CFG_CFLAGS_powerpc-unknown-linux-gnu := -m32 $(CFLAGS) +CFG_GCCISH_CFLAGS_powerpc-unknown-linux-gnu := -Wall -Werror -g -fPIC -m32 $(CFLAGS) +CFG_GCCISH_CXXFLAGS_powerpc-unknown-linux-gnu := -fno-rtti $(CXXFLAGS) +CFG_GCCISH_LINK_FLAGS_powerpc-unknown-linux-gnu := -shared -fPIC -ldl -pthread -lrt -g -m32 +CFG_GCCISH_DEF_FLAG_powerpc-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list= +CFG_GCCISH_PRE_LIB_FLAGS_powerpc-unknown-linux-gnu := -Wl,-whole-archive +CFG_GCCISH_POST_LIB_FLAGS_powerpc-unknown-linux-gnu := -Wl,-no-whole-archive +CFG_DEF_SUFFIX_powerpc-unknown-linux-gnu := .linux.def +CFG_LLC_FLAGS_powerpc-unknown-linux-gnu := +CFG_INSTALL_NAME_powerpc-unknown-linux-gnu = +CFG_EXE_SUFFIX_powerpc-unknown-linux-gnu = +CFG_WINDOWSY_powerpc-unknown-linux-gnu := +CFG_UNIXY_powerpc-unknown-linux-gnu := 1 +CFG_PATH_MUNGE_powerpc-unknown-linux-gnu := true +CFG_LDPATH_powerpc-unknown-linux-gnu := +CFG_RUN_powerpc-unknown-linux-gnu=$(2) +CFG_RUN_TARG_powerpc-unknown-linux-gnu=$(call CFG_RUN_powerpc-unknown-linux-gnu,,$(2)) +CFG_GNU_TRIPLE_powerpc-unknown-linux-gnu := powerpc-unknown-linux-gnu diff --git a/mk/cfg/x86_64-apple-ios.mk b/mk/cfg/x86_64-apple-ios.mk new file mode 100644 index 0000000000..b3f05a895a --- /dev/null +++ b/mk/cfg/x86_64-apple-ios.mk @@ -0,0 +1,36 @@ +# x86_64-apple-ios configuration +CFG_SDK_NAME_x86_64-apple-ios := iphonesimulator +CFG_SDK_ARCHS_x86_64-apple-ios := x86_64 +ifneq ($(findstring darwin,$(CFG_OSTYPE)),) +CFG_IOSSIM_SDK_x86_64-apple-ios := $(shell xcrun --show-sdk-path -sdk iphonesimulator 2>/dev/null) +CFG_IOSSIM_FLAGS_x86_64-apple-ios := -m64 -target x86_64-apple-ios -isysroot $(CFG_IOSSIM_SDK_x86_64-apple-ios) -mios-simulator-version-min=7.0 +CC_x86_64-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang) +CXX_x86_64-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang++) +CPP_x86_64-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang++) +AR_x86_64-apple-ios = $(shell xcrun -find -sdk iphonesimulator ar) +endif +CFG_LIB_NAME_x86_64-apple-ios = lib$(1).a +CFG_LIB_GLOB_x86_64-apple-ios = lib$(1)-*.a +CFG_INSTALL_ONLY_RLIB_x86_64-apple-ios = 1 +CFG_STATIC_LIB_NAME_x86_64-apple-ios=lib$(1).a +CFG_LIB_DSYM_GLOB_x86_64-apple-ios = lib$(1)-*.a.dSYM +CFG_CFLAGS_x86_64-apple-ios := $(CFG_IOSSIM_FLAGS_x86_64-apple-ios) +CFG_JEMALLOC_CFLAGS_x86_64-apple-ios := $(CFG_IOSSIM_FLAGS_x86_64-apple-ios) +CFG_GCCISH_CFLAGS_x86_64-apple-ios := -Wall -Werror -fPIC $(CFG_IOSSIM_FLAGS_x86_64-apple-ios) +CFG_GCCISH_CXXFLAGS_x86_64-apple-ios := -fno-rtti $(CFG_IOSSIM_FLAGS_x86_64-apple-ios) -I$(CFG_IOSSIM_SDK_x86_64-apple-ios)/usr/include/c++/4.2.1 +CFG_GCCISH_LINK_FLAGS_x86_64-apple-ios := -lpthread -Wl,-no_compact_unwind -m64 -Wl,-syslibroot $(CFG_IOSSIM_SDK_x86_64-apple-ios) +CFG_GCCISH_DEF_FLAG_x86_64-apple-ios := -Wl,-exported_symbols_list, +CFG_GCCISH_PRE_LIB_FLAGS_x86_64-apple-ios := +CFG_GCCISH_POST_LIB_FLAGS_x86_64-apple-ios := +CFG_DEF_SUFFIX_x86_64-apple-ios := .darwin.def +CFG_LLC_FLAGS_x86_64-apple-ios := +CFG_INSTALL_NAME_x86_64-apple-ios = -Wl,-install_name,@rpath/$(1) +CFG_LIBUV_LINK_FLAGS_x86_64-apple-ios := +CFG_EXE_SUFFIX_x86_64-apple-ios := +CFG_WINDOWSY_x86_64-apple-ios := +CFG_UNIXY_x86_64-apple-ios := 1 +CFG_PATH_MUNGE_x86_64-apple-ios := true +CFG_LDPATH_x86_64-apple-ios := +CFG_RUN_x86_64-apple-ios = $(2) +CFG_RUN_TARG_x86_64-apple-ios = $(call CFG_RUN_x86_64-apple-ios,,$(2)) +CFG_GNU_TRIPLE_i386-apple-ios := x86_64-apple-ios diff --git a/mk/cfg/x86_64-pc-windows-gnu.mk b/mk/cfg/x86_64-pc-windows-gnu.mk index a23e292c7b..e9e5f04ea5 100644 --- a/mk/cfg/x86_64-pc-windows-gnu.mk +++ b/mk/cfg/x86_64-pc-windows-gnu.mk @@ -8,8 +8,8 @@ CFG_LIB_NAME_x86_64-pc-windows-gnu=$(1).dll CFG_STATIC_LIB_NAME_x86_64-pc-windows-gnu=$(1).lib CFG_LIB_GLOB_x86_64-pc-windows-gnu=$(1)-*.dll CFG_LIB_DSYM_GLOB_x86_64-pc-windows-gnu=$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_x86_64-pc-windows-gnu := -m64 -D_WIN32_WINNT=0x0600 $(CFLAGS) -CFG_GCCISH_CFLAGS_x86_64-pc-windows-gnu := -Wall -Werror -g -m64 -D_WIN32_WINNT=0x0600 $(CFLAGS) +CFG_JEMALLOC_CFLAGS_x86_64-pc-windows-gnu := -m64 -D_WIN32_WINNT=0x0600 -D__USE_MINGW_ANSI_STDIO=1 $(CFLAGS) +CFG_GCCISH_CFLAGS_x86_64-pc-windows-gnu := -Wall -Werror -g -m64 -D_WIN32_WINNT=0x0600 -D__USE_MINGW_ANSI_STDIO=1 $(CFLAGS) CFG_GCCISH_CXXFLAGS_x86_64-pc-windows-gnu := -fno-rtti $(CXXFLAGS) CFG_GCCISH_LINK_FLAGS_x86_64-pc-windows-gnu := -shared -g -m64 CFG_GCCISH_DEF_FLAG_x86_64-pc-windows-gnu := @@ -22,7 +22,7 @@ CFG_EXE_SUFFIX_x86_64-pc-windows-gnu := .exe CFG_WINDOWSY_x86_64-pc-windows-gnu := 1 CFG_UNIXY_x86_64-pc-windows-gnu := CFG_PATH_MUNGE_x86_64-pc-windows-gnu := -CFG_LDPATH_x86_64-pc-windows-gnu :=$(CFG_LDPATH_x86_64-pc-windows-gnu):$(PATH) -CFG_RUN_x86_64-pc-windows-gnu=PATH="$(CFG_LDPATH_x86_64-pc-windows-gnu):$(1)" $(2) -CFG_RUN_TARG_x86_64-pc-windows-gnu=$(call CFG_RUN_x86_64-pc-windows-gnu,$(HLIB$(1)_H_$(CFG_BUILD)),$(2)) +CFG_LDPATH_x86_64-pc-windows-gnu := +CFG_RUN_x86_64-pc-windows-gnu=$(2) +CFG_RUN_TARG_x86_64-pc-windows-gnu=$(call CFG_RUN_x86_64-pc-windows-gnu,,$(2)) CFG_GNU_TRIPLE_x86_64-pc-windows-gnu := x86_64-w64-mingw32 diff --git a/mk/cfg/x86_64-unknown-openbsd.mk b/mk/cfg/x86_64-unknown-openbsd.mk new file mode 100644 index 0000000000..582d75c3ea --- /dev/null +++ b/mk/cfg/x86_64-unknown-openbsd.mk @@ -0,0 +1,26 @@ +# x86_64-pc-openbsd-elf configuration +CC_x86_64-unknown-openbsd=$(CC) +CXX_x86_64-unknown-openbsd=$(CXX) +CPP_x86_64-unknown-openbsd=$(CPP) +AR_x86_64-unknown-openbsd=$(AR) +CFG_LIB_NAME_x86_64-unknown-openbsd=lib$(1).so +CFG_STATIC_LIB_NAME_x86_64-unknown-openbsd=lib$(1).a +CFG_LIB_GLOB_x86_64-unknown-openbsd=lib$(1)-*.so +CFG_LIB_DSYM_GLOB_x86_64-unknown-openbsd=$(1)-*.dylib.dSYM +CFG_JEMALLOC_CFLAGS_x86_64-unknown-openbsd := -m64 -I/usr/include $(CFLAGS) +CFG_GCCISH_CFLAGS_x86_64-unknown-openbsd := -Wall -Werror -g -fPIC -m64 -I/usr/include $(CFLAGS) +CFG_GCCISH_LINK_FLAGS_x86_64-unknown-openbsd := -shared -fPIC -g -pthread -m64 +CFG_GCCISH_DEF_FLAG_x86_64-unknown-openbsd := -Wl,--export-dynamic,--dynamic-list= +CFG_GCCISH_PRE_LIB_FLAGS_x86_64-unknown-openbsd := -Wl,-whole-archive +CFG_GCCISH_POST_LIB_FLAGS_x86_64-unknown-openbsd := -Wl,-no-whole-archive +CFG_DEF_SUFFIX_x86_64-unknown-openbsd := .bsd.def +CFG_LLC_FLAGS_x86_64-unknown-openbsd := +CFG_INSTALL_NAME_x86_64-unknown-openbsd = +CFG_EXE_SUFFIX_x86_64-unknown-openbsd := +CFG_WINDOWSY_x86_64-unknown-openbsd := +CFG_UNIXY_x86_64-unknown-openbsd := 1 +CFG_PATH_MUNGE_x86_64-unknown-openbsd := +CFG_LDPATH_x86_64-unknown-openbsd := +CFG_RUN_x86_64-unknown-openbsd=$(2) +CFG_RUN_TARG_x86_64-unknown-openbsd=$(call CFG_RUN_x86_64-unknown-openbsd,,$(2)) +CFG_GNU_TRIPLE_x86_64-unknown-openbsd := x86_64-unknown-openbsd diff --git a/mk/crates.mk b/mk/crates.mk index 5b8772c4e0..be1965b7ed 100644 --- a/mk/crates.mk +++ b/mk/crates.mk @@ -51,10 +51,10 @@ TARGET_CRATES := libc std flate arena term \ serialize getopts collections test rand \ - log regex graphviz core rbml alloc \ - unicode + log graphviz core rbml alloc \ + unicode rustc_bitflags RUSTC_CRATES := rustc rustc_typeck rustc_borrowck rustc_resolve rustc_driver \ - rustc_trans rustc_back rustc_llvm + rustc_trans rustc_back rustc_llvm rustc_privacy HOST_CRATES := syntax $(RUSTC_CRATES) rustdoc fmt_macros CRATES := $(TARGET_CRATES) $(HOST_CRATES) TOOLS := compiletest rustdoc rustc rustbook @@ -64,22 +64,27 @@ DEPS_libc := core DEPS_unicode := core DEPS_alloc := core libc native:jemalloc DEPS_std := core libc rand alloc collections unicode \ - native:rust_builtin native:backtrace native:rustrt_native + native:rust_builtin native:backtrace native:rustrt_native \ + rustc_bitflags DEPS_graphviz := std DEPS_syntax := std term serialize log fmt_macros arena libc DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_borrowck \ - rustc_typeck rustc_resolve log syntax serialize rustc_llvm rustc_trans + rustc_typeck rustc_resolve log syntax serialize rustc_llvm \ + rustc_trans rustc_privacy + DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back \ log syntax serialize rustc_llvm DEPS_rustc_typeck := rustc syntax DEPS_rustc_borrowck := rustc log graphviz syntax DEPS_rustc_resolve := rustc log syntax +DEPS_rustc_privacy := rustc log syntax DEPS_rustc := syntax flate arena serialize getopts rbml \ log graphviz rustc_llvm rustc_back DEPS_rustc_llvm := native:rustllvm libc std DEPS_rustc_back := std syntax rustc_llvm flate log libc DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts \ test +DEPS_rustc_bitflags := core DEPS_flate := std native:miniz DEPS_arena := std DEPS_graphviz := std @@ -90,16 +95,15 @@ DEPS_term := std log DEPS_getopts := std DEPS_collections := core alloc unicode DEPS_num := std -DEPS_test := std getopts serialize rbml term regex native:rust_test_helpers +DEPS_test := std getopts serialize rbml term native:rust_test_helpers DEPS_rand := core -DEPS_log := std regex -DEPS_regex := std +DEPS_log := std DEPS_fmt_macros = std TOOL_DEPS_compiletest := test getopts TOOL_DEPS_rustdoc := rustdoc TOOL_DEPS_rustc := rustc_driver -TOOL_DEPS_rustbook := std regex rustdoc +TOOL_DEPS_rustbook := std rustdoc TOOL_SOURCE_compiletest := $(S)src/compiletest/compiletest.rs TOOL_SOURCE_rustdoc := $(S)src/driver/driver.rs TOOL_SOURCE_rustc := $(S)src/driver/driver.rs @@ -111,6 +115,7 @@ ONLY_RLIB_alloc := 1 ONLY_RLIB_rand := 1 ONLY_RLIB_collections := 1 ONLY_RLIB_unicode := 1 +ONLY_RLIB_rustc_bitflags := 1 ################################################################################ # You should not need to edit below this line @@ -122,12 +127,12 @@ DOC_CRATES := $(filter-out rustc, \ $(filter-out rustc_borrowck, \ $(filter-out rustc_resolve, \ $(filter-out rustc_driver, \ + $(filter-out rustc_privacy, \ $(filter-out log, \ - $(filter-out regex, \ $(filter-out getopts, \ $(filter-out syntax, $(CRATES))))))))))) COMPILER_DOC_CRATES := rustc rustc_trans rustc_borrowck rustc_resolve \ - rustc_typeck rustc_driver syntax + rustc_typeck rustc_driver syntax rustc_privacy # This macro creates some simple definitions for each crate being built, just # some munging of all of the parameters above. diff --git a/mk/dist.mk b/mk/dist.mk index 05af3f2123..831225556f 100644 --- a/mk/dist.mk +++ b/mk/dist.mk @@ -109,8 +109,6 @@ distcheck-tar-src: dist-tar-src # Unix binary installer tarballs ###################################################################### -NON_INSTALLED_PREFIXES=COPYRIGHT,LICENSE-APACHE,LICENSE-MIT,README.md,version - define DEF_INSTALLER $$(eval $$(call DEF_PREPARE,dir-$(1))) @@ -124,19 +122,23 @@ dist-install-dir-$(1): PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD) dist-install-dir-$(1): PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD) dist-install-dir-$(1): PREPARE_CLEAN=true dist-install-dir-$(1): prepare-base-dir-$(1) docs compiler-docs - $$(Q)$$(PREPARE_MAN_CMD) $$(S)COPYRIGHT $$(PREPARE_DEST_DIR) - $$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-APACHE $$(PREPARE_DEST_DIR) - $$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-MIT $$(PREPARE_DEST_DIR) - $$(Q)$$(PREPARE_MAN_CMD) $$(S)README.md $$(PREPARE_DEST_DIR) $$(Q)mkdir -p $$(PREPARE_DEST_DIR)/share/doc/rust $$(Q)$$(PREPARE_MAN_CMD) $$(S)COPYRIGHT $$(PREPARE_DEST_DIR)/share/doc/rust $$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-APACHE $$(PREPARE_DEST_DIR)/share/doc/rust $$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-MIT $$(PREPARE_DEST_DIR)/share/doc/rust $$(Q)$$(PREPARE_MAN_CMD) $$(S)README.md $$(PREPARE_DEST_DIR)/share/doc/rust + +prepare-overlay-$(1): + $$(Q)rm -Rf tmp/dist/$$(PKG_NAME)-$(1)-overlay + $$(Q)mkdir -p tmp/dist/$$(PKG_NAME)-$(1)-overlay + $$(Q)cp $$(S)COPYRIGHT tmp/dist/$$(PKG_NAME)-$(1)-overlay/ + $$(Q)cp $$(S)LICENSE-APACHE tmp/dist/$$(PKG_NAME)-$(1)-overlay/ + $$(Q)cp $$(S)LICENSE-MIT tmp/dist/$$(PKG_NAME)-$(1)-overlay/ + $$(Q)cp $$(S)README.md tmp/dist/$$(PKG_NAME)-$(1)-overlay/ # This tiny morsel of metadata is used by rust-packaging - $$(Q)echo "$(CFG_VERSION)" > $$(PREPARE_DEST_DIR)/version + $$(Q)echo "$(CFG_VERSION)" > tmp/dist/$$(PKG_NAME)-$(1)-overlay/version -dist/$$(PKG_NAME)-$(1).tar.gz: dist-install-dir-$(1) +dist/$$(PKG_NAME)-$(1).tar.gz: dist-install-dir-$(1) prepare-overlay-$(1) @$(call E, build: $$@) # Copy essential gcc components into installer ifdef CFG_WINDOWSY_$(1) @@ -146,13 +148,12 @@ ifdef CFG_WINDOWSY_$(1) endif $$(Q)$$(S)src/rust-installer/gen-installer.sh \ --product-name=Rust \ - --verify-bin=rustc \ --rel-manifest-dir=rustlib \ --success-message=Rust-is-ready-to-roll. \ --image-dir=tmp/dist/$$(PKG_NAME)-$(1)-image \ --work-dir=tmp/dist \ --output-dir=dist \ - --non-installed-prefixes=$$(NON_INSTALLED_PREFIXES) \ + --non-installed-overlay=tmp/dist/$$(PKG_NAME)-$(1)-overlay \ --package-name=$$(PKG_NAME)-$(1) \ --component-name=rustc \ --legacy-manifest-dirs=rustlib,cargo diff --git a/mk/docs.mk b/mk/docs.mk index 1104c3eb6d..743032f676 100644 --- a/mk/docs.mk +++ b/mk/docs.mk @@ -25,9 +25,15 @@ # L10N_LANGS are the languages for which the docs have been # translated. ###################################################################### -DOCS := index intro tutorial complement-bugreport \ +DOCS := index intro tutorial \ complement-lang-faq complement-design-faq complement-project-faq \ - rustdoc reference + rustdoc reference grammar + +# Legacy guides, preserved for a while to reduce the number of 404s +DOCS += guide-crates guide-error-handling guide-ffi guide-macros guide \ + guide-ownership guide-plugins guide-pointers guide-strings guide-tasks \ + guide-testing + PDF_DOCS := reference @@ -67,7 +73,7 @@ RUSTBOOK = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(RUSTBOOK_EXE) D := $(S)src/doc -DOC_TARGETS := trpl +DOC_TARGETS := trpl style COMPILER_DOC_TARGETS := DOC_L10N_TARGETS := @@ -79,27 +85,16 @@ else HTML_DEPS := endif -# Check for the various external utilities for the EPUB/PDF docs: - -ifeq ($(CFG_LUALATEX),) - $(info cfg: no lualatex found, deferring to xelatex) - ifeq ($(CFG_XELATEX),) - $(info cfg: no xelatex found, deferring to pdflatex) - ifeq ($(CFG_PDFLATEX),) - $(info cfg: no pdflatex found, disabling LaTeX docs) - NO_PDF_DOCS = 1 - else - CFG_LATEX := $(CFG_PDFLATEX) - endif - else +# Check for xelatex + +ifneq ($(CFG_XELATEX),) CFG_LATEX := $(CFG_XELATEX) XELATEX = 1 - endif -else - CFG_LATEX := $(CFG_LUALATEX) + else + $(info cfg: no xelatex found, disabling LaTeX docs) + NO_PDF_DOCS = 1 endif - ifeq ($(CFG_PANDOC),) $(info cfg: no pandoc found, omitting PDF and EPUB docs) ONLY_HTML_DOCS = 1 @@ -134,21 +129,21 @@ doc/: HTML_DEPS += doc/rust.css doc/rust.css: $(D)/rust.css | doc/ @$(call E, cp: $@) - $(Q)cp -a $< $@ 2> /dev/null + $(Q)cp -PRp $< $@ 2> /dev/null HTML_DEPS += doc/favicon.inc doc/favicon.inc: $(D)/favicon.inc | doc/ @$(call E, cp: $@) - $(Q)cp -a $< $@ 2> /dev/null + $(Q)cp -PRp $< $@ 2> /dev/null doc/full-toc.inc: $(D)/full-toc.inc | doc/ @$(call E, cp: $@) - $(Q)cp -a $< $@ 2> /dev/null + $(Q)cp -PRp $< $@ 2> /dev/null HTML_DEPS += doc/footer.inc doc/footer.inc: $(D)/footer.inc | doc/ @$(call E, cp: $@) - $(Q)cp -a $< $@ 2> /dev/null + $(Q)cp -PRp $< $@ 2> /dev/null # The (english) documentation for each doc item. @@ -277,6 +272,12 @@ compiler-docs: $(COMPILER_DOC_TARGETS) trpl: doc/book/index.html -doc/book/index.html: $(RUSTBOOK_EXE) $(wildcard $(S)/src/doc/trpl/*.md) +doc/book/index.html: $(RUSTBOOK_EXE) $(wildcard $(S)/src/doc/trpl/*.md) | doc/ $(Q)rm -rf doc/book $(Q)$(RUSTBOOK) build $(S)src/doc/trpl doc/book + +style: doc/style/index.html + +doc/style/index.html: $(RUSTBOOK_EXE) $(wildcard $(S)/src/doc/style/*.md) | doc/ + $(Q)rm -rf doc/style + $(Q)$(RUSTBOOK) build $(S)src/doc/style doc/style diff --git a/mk/grammar.mk b/mk/grammar.mk index 93e40302f5..d9c66e282b 100644 --- a/mk/grammar.mk +++ b/mk/grammar.mk @@ -14,6 +14,11 @@ B = $(CFG_BUILD_DIR)/$(CFG_BUILD)/stage2/ L = $(B)lib/rustlib/$(CFG_BUILD)/lib LD = $(CFG_BUILD)/stage2/lib/rustlib/$(CFG_BUILD)/lib/ RUSTC = $(STAGE2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) +ifeq ($(CFG_OSTYPE),apple-darwin) + FLEX_LDFLAGS=-ll +else + FLEX_LDFLAGS=-lfl +endif # Run the reference lexer against libsyntax and compare the tokens and spans. # If "// ignore-lexer-test" is present in the file, it will be ignored. @@ -67,3 +72,46 @@ $(info cfg: javac not available, skipping lexer test...) check-lexer: endif + +$(BG)lex.yy.c: $(SG)lexer.l $(BG) + @$(call E, flex: $@) + $(Q)$(CFG_FLEX) -o $@ $< + +$(BG)lexer-lalr.o: $(BG)lex.yy.c $(BG)parser-lalr.tab.h + @$(call E, cc: $@) + $(Q)$(CFG_CC) -include $(BG)parser-lalr.tab.h -c -o $@ $< + +$(BG)parser-lalr.tab.c $(BG)parser-lalr.tab.h: $(SG)parser-lalr.y + @$(call E, bison: $@) + $(Q)$(CFG_BISON) $< --output=$(BG)parser-lalr.tab.c --defines=$(BG)parser-lalr.tab.h \ + --name-prefix=rs --warnings=error=all + +$(BG)parser-lalr.o: $(BG)parser-lalr.tab.c + @$(call E, cc: $@) + $(Q)$(CFG_CC) -c -o $@ $< + +$(BG)parser-lalr-main.o: $(SG)parser-lalr-main.c + @$(call E, cc: $@) + $(Q)$(CFG_CC) -std=c99 -c -o $@ $< + +$(BG)parser-lalr: $(BG)parser-lalr.o $(BG)parser-lalr-main.o $(BG)lexer-lalr.o + @$(call E, cc: $@) + $(Q)$(CFG_CC) -o $@ $^ $(FLEX_LDFLAGS) + + +ifdef CFG_FLEX +ifdef CFG_BISON +check-grammar: $(BG) $(BG)parser-lalr + $(info Verifying grammar ...) + $(SG)testparser.py -p $(BG)parser-lalr -s $(S)src + +else +$(info cfg: bison not available, skipping parser test...) +check-grammar: + +endif +else +$(info cfg: flex not available, skipping parser test...) +check-grammar: + +endif diff --git a/mk/install.mk b/mk/install.mk index 60c0a6bb4c..8850cd7780 100644 --- a/mk/install.mk +++ b/mk/install.mk @@ -58,14 +58,13 @@ tmp/empty_dir: # Android runtime setup # FIXME: This probably belongs somewhere else -# target platform specific variables -# for arm-linux-androidabi +# target platform specific variables for android define DEF_ADB_DEVICE_STATUS CFG_ADB_DEVICE_STATUS=$(1) endef $(foreach target,$(CFG_TARGET), \ - $(if $(findstring $(target),"arm-linux-androideabi"), \ + $(if $(findstring android, $(target)), \ $(if $(findstring adb,$(CFG_ADB)), \ $(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[_A-Za-z0-9-]+[[:blank:]]+device')), \ $(info install: install-runtime-target for $(target) enabled \ @@ -117,8 +116,11 @@ install-runtime-target-$(1)-cleanup: $$(call ADB_SHELL,rm,$$(CFG_RUNTIME_PUSH_DIR)/$$(call CFG_LIB_GLOB_$(1),$$(crate)));) endef -$(eval $(call INSTALL_RUNTIME_TARGET_N,arm-linux-androideabi,$(CFG_BUILD))) -$(eval $(call INSTALL_RUNTIME_TARGET_CLEANUP_N,arm-linux-androideabi)) +$(foreach target,$(CFG_TARGET), \ + $(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \ + $(eval $(call INSTALL_RUNTIME_TARGET_N,$(taget),$(CFG_BUILD))) \ + $(eval $(call INSTALL_RUNTIME_TARGET_CLEANUP_N,$(target))) \ + )) install-runtime-target: \ install-runtime-target-arm-linux-androideabi-cleanup \ diff --git a/mk/main.mk b/mk/main.mk index 99aecc34be..9752ee233b 100644 --- a/mk/main.mk +++ b/mk/main.mk @@ -15,8 +15,10 @@ # The version number CFG_RELEASE_NUM=1.0.0 -# An optional number to put after the label, e.g. '2' -> '-beta2' -CFG_BETA_CYCLE= +# An optional number to put after the label, e.g. '.2' -> '-beta.2' +# NB Make sure it starts with a dot to conform to semver pre-release +# versions (section 9) +CFG_PRERELEASE_VERSION=.2 CFG_FILENAME_EXTRA=4e7c5e5c @@ -28,9 +30,8 @@ CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM) CFG_DISABLE_UNSTABLE_FEATURES=1 endif ifeq ($(CFG_RELEASE_CHANNEL),beta) -# The beta channel is temporarily called 'alpha' -CFG_RELEASE=$(CFG_RELEASE_NUM)-alpha$(CFG_BETA_CYCLE) -CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)-alpha$(CFG_BETA_CYCLE) +CFG_RELEASE=$(CFG_RELEASE_NUM)-alpha$(CFG_PRERELEASE_VERSION) +CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)-alpha$(CFG_PRERELEASE_VERSION) CFG_DISABLE_UNSTABLE_FEATURES=1 endif ifeq ($(CFG_RELEASE_CHANNEL),nightly) @@ -60,17 +61,21 @@ SPACE := SPACE += ifneq ($(CFG_GIT),) ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT_DIR))),) - CFG_VER_DATE = $(shell git --git-dir='$(CFG_GIT_DIR)' log -1 --pretty=format:'%ci') + CFG_VER_DATE = $(shell git --git-dir='$(CFG_GIT_DIR)' log -1 --date=short --pretty=format:'%cd') CFG_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse HEAD) CFG_SHORT_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse --short=9 HEAD) CFG_VERSION += ($(CFG_SHORT_VER_HASH) $(CFG_VER_DATE)) endif endif +CFG_BUILD_DATE = $(shell date +%F) +CFG_VERSION += (built $(CFG_BUILD_DATE)) + # Windows exe's need numeric versions - don't use anything but # numbers and dots here CFG_VERSION_WIN = $(CFG_RELEASE_NUM) +CFG_INFO := $(info cfg: version $(CFG_VERSION)) ###################################################################### # More configuration @@ -178,6 +183,7 @@ endif ifndef CFG_DISABLE_VALGRIND_RPASS $(info cfg: enabling valgrind run-pass tests (CFG_ENABLE_VALGRIND_RPASS)) + $(info cfg: valgrind-rpass command set to $(CFG_VALGRIND)) CFG_VALGRIND_RPASS :=$(CFG_VALGRIND) else CFG_VALGRIND_RPASS := @@ -261,7 +267,7 @@ endif ###################################################################### # FIXME: x86-ism -LLVM_COMPONENTS=x86 arm aarch64 mips ipo bitreader bitwriter linker asmparser mcjit \ +LLVM_COMPONENTS=x86 arm aarch64 mips powerpc ipo bitreader bitwriter linker asmparser mcjit \ interpreter instrumentation # Only build these LLVM tools @@ -314,6 +320,7 @@ endif ifdef CFG_VER_HASH export CFG_VER_HASH endif +export CFG_BUILD_DATE export CFG_VERSION export CFG_VERSION_WIN export CFG_RELEASE @@ -329,10 +336,10 @@ ifdef CFG_DISABLE_UNSTABLE_FEATURES CFG_INFO := $(info cfg: disabling unstable features (CFG_DISABLE_UNSTABLE_FEATURES)) # Turn on feature-staging export CFG_DISABLE_UNSTABLE_FEATURES -endif # Subvert unstable feature lints to do the self-build -export CFG_BOOTSTRAP_KEY export RUSTC_BOOTSTRAP_KEY:=$(CFG_BOOTSTRAP_KEY) +endif +export CFG_BOOTSTRAP_KEY ###################################################################### # Per-stage targets and runner diff --git a/mk/platform.mk b/mk/platform.mk index 50bf51b20d..78c1057c2f 100644 --- a/mk/platform.mk +++ b/mk/platform.mk @@ -177,7 +177,7 @@ define CFG_MAKE_TOOLCHAIN $$(CFG_GCCISH_DEF_FLAG_$(1))$$(3) $$(2) \ $$(call CFG_INSTALL_NAME_$(1),$$(4)) - ifeq ($$(findstring $(HOST_$(1)),arm aarch64 mips mipsel),) + ifeq ($$(findstring $(HOST_$(1)),arm aarch64 mips mipsel powerpc),) # We're using llvm-mc as our assembler because it supports # .cfi pseudo-ops on mac @@ -189,7 +189,7 @@ define CFG_MAKE_TOOLCHAIN -o=$$(1) else - # For the ARM, AARCH64 and MIPS crosses, use the toolchain assembler + # For the ARM, AARCH64, MIPS and POWER crosses, use the toolchain assembler # FIXME: We should be able to use the LLVM assembler CFG_ASSEMBLE_$(1)=$$(CC_$(1)) $$(CFG_GCCISH_CFLAGS_$(1)) \ $$(CFG_DEPEND_FLAGS) $$(2) -c -o $$(1) diff --git a/mk/prepare.mk b/mk/prepare.mk index 6a5daeb690..f1c4aa65f5 100644 --- a/mk/prepare.mk +++ b/mk/prepare.mk @@ -134,7 +134,7 @@ prepare-target-$(2)-host-$(3)-$(1)-$(4): prepare-maybe-clean-$(4) \ $$(if $$(findstring $(3), $$(PREPARE_HOST)), \ $$(call PREPARE_DIR,$$(PREPARE_WORKING_DEST_LIB_DIR)) \ $$(foreach crate,$$(TARGET_CRATES), \ - $$(if $$(findstring 1, $$(ONLY_RLIB_$$(crate))),, \ + $$(if $$(or $$(findstring 1, $$(ONLY_RLIB_$$(crate))),$$(findstring 1,$$(CFG_INSTALL_ONLY_RLIB_$(2)))),, \ $$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$(2),$$(crate)))) \ $$(call PREPARE_LIB,$$(call CFG_RLIB_GLOB,$$(crate)))) \ $$(if $$(findstring $(2),$$(CFG_HOST)), \ diff --git a/mk/rt.mk b/mk/rt.mk index 6a7be26c7a..527485c502 100644 --- a/mk/rt.mk +++ b/mk/rt.mk @@ -139,7 +139,7 @@ ifeq ($$(CFG_WINDOWSY_$(1)), 1) JEMALLOC_ARGS_$(1) := --enable-lazy-lock else ifeq ($(OSTYPE_$(1)), apple-ios) JEMALLOC_ARGS_$(1) := --disable-tls -else ifeq ($(OSTYPE_$(1)), linux-androideabi) +else ifeq ($(findstring android, $(OSTYPE_$(1))), android) JEMALLOC_ARGS_$(1) := --disable-tls endif diff --git a/mk/tests.mk b/mk/tests.mk index c8c4beb115..692d28bfad 100644 --- a/mk/tests.mk +++ b/mk/tests.mk @@ -38,16 +38,9 @@ ifdef CHECK_IGNORED TESTARGS += --ignored endif -TEST_BENCH = - # Arguments to the cfail/rfail/rpass/bench tests ifdef CFG_VALGRIND CTEST_RUNTOOL = --runtool "$(CFG_VALGRIND)" - TEST_BENCH = -endif - -ifdef PLEASE_BENCH - TEST_BENCH = --bench endif # Arguments to the perf tests @@ -57,6 +50,11 @@ endif CTEST_TESTARGS := $(TESTARGS) +# --bench is only relevant for crate tests, not for the compile tests +ifdef PLEASE_BENCH + TESTARGS += --bench +endif + ifdef VERBOSE CTEST_TESTARGS += --verbose endif @@ -109,14 +107,13 @@ endef $(foreach target,$(CFG_TARGET), \ $(eval $(call DEF_TARGET_COMMANDS,$(target)))) -# Target platform specific variables -# for arm-linux-androidabi +# Target platform specific variables for android define DEF_ADB_DEVICE_STATUS CFG_ADB_DEVICE_STATUS=$(1) endef $(foreach target,$(CFG_TARGET), \ - $(if $(findstring $(target),"arm-linux-androideabi"), \ + $(if $(findstring android, $(target)), \ $(if $(findstring adb,$(CFG_ADB)), \ $(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[:_A-Za-z0-9-]+[[:blank:]]+device')), \ $(info check: android device attached) \ @@ -137,12 +134,14 @@ $(info check: android device test dir $(CFG_ADB_TEST_DIR) ready \ $(shell $(CFG_ADB) remount 1>/dev/null) \ $(shell $(CFG_ADB) shell rm -r $(CFG_ADB_TEST_DIR) >/dev/null) \ $(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)) \ - $(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)/tmp) \ $(shell $(CFG_ADB) push $(S)src/etc/adb_run_wrapper.sh $(CFG_ADB_TEST_DIR) 1>/dev/null) \ - $(foreach crate,$(TARGET_CRATES), \ - $(shell $(CFG_ADB) push $(TLIB2_T_arm-linux-androideabi_H_$(CFG_BUILD))/$(call CFG_LIB_GLOB_arm-linux-androideabi,$(crate)) \ - $(CFG_ADB_TEST_DIR))) \ - ) + $(foreach target,$(CFG_TARGET), \ + $(if $(findstring android, $(target)), \ + $(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)/$(target)) \ + $(foreach crate,$(TARGET_CRATES), \ + $(shell $(CFG_ADB) push $(TLIB2_T_$(target)_H_$(CFG_BUILD))/$(call CFG_LIB_GLOB_$(target),$(crate)) \ + $(CFG_ADB_TEST_DIR)/$(target))), \ + ))) else CFG_ADB_TEST_DIR= endif @@ -164,7 +163,8 @@ $(foreach file,$(wildcard $(S)src/doc/trpl/*.md), \ ###################################################################### # The main testing target. Tests lots of stuff. -check: cleantmptestlogs cleantestlibs check-notidy tidy +check: cleantmptestlogs cleantestlibs all check-stage2 tidy + $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log # As above but don't bother running tidy. check-notidy: cleantmptestlogs cleantestlibs all check-stage2 @@ -174,12 +174,12 @@ check-notidy: cleantmptestlogs cleantestlibs all check-stage2 check-lite: cleantestlibs cleantmptestlogs \ $(foreach crate,$(TEST_TARGET_CRATES),check-stage2-$(crate)) \ check-stage2-rpass check-stage2-rpass-valgrind \ - check-stage2-rfail check-stage2-cfail check-stage2-rmake + check-stage2-rfail check-stage2-cfail check-stage2-pfail check-stage2-rmake $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log # Only check the 'reference' tests: rpass/cfail/rfail/rmake. check-ref: cleantestlibs cleantmptestlogs check-stage2-rpass check-stage2-rpass-valgrind \ - check-stage2-rfail check-stage2-cfail check-stage2-rmake + check-stage2-rfail check-stage2-cfail check-stage2-pfail check-stage2-rmake $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log # Only check the docs. @@ -237,57 +237,24 @@ cleantestlibs: ###################################################################### ifdef CFG_NOTIDY +.PHONY: tidy tidy: else -ALL_CS := $(wildcard $(S)src/rt/*.cpp \ - $(S)src/rt/*/*.cpp \ - $(S)src/rt/*/*/*.cpp \ - $(S)src/rustllvm/*.cpp) -ALL_CS := $(filter-out $(S)src/rt/miniz.cpp \ - $(wildcard $(S)src/rt/hoedown/src/*.c) \ - $(wildcard $(S)src/rt/hoedown/bin/*.c) \ - ,$(ALL_CS)) -ALL_HS := $(wildcard $(S)src/rt/*.h \ - $(S)src/rt/*/*.h \ - $(S)src/rt/*/*/*.h \ - $(S)src/rustllvm/*.h) -ALL_HS := $(filter-out $(S)src/rt/valgrind/valgrind.h \ - $(S)src/rt/valgrind/memcheck.h \ - $(S)src/rt/msvc/typeof.h \ - $(S)src/rt/msvc/stdint.h \ - $(S)src/rt/msvc/inttypes.h \ - $(wildcard $(S)src/rt/hoedown/src/*.h) \ - $(wildcard $(S)src/rt/hoedown/bin/*.h) \ - ,$(ALL_HS)) - # Run the tidy script in multiple parts to avoid huge 'echo' commands -tidy: +.PHONY: tidy +tidy: tidy-basic tidy-binaries tidy-errors tidy-features + +endif + +.PHONY: tidy-basic +tidy-basic: @$(call E, check: formatting) - $(Q)find $(S)src -name '*.r[sc]' \ - -and -not -regex '^$(S)src/jemalloc.*' \ - -and -not -regex '^$(S)src/libuv.*' \ - -and -not -regex '^$(S)src/llvm.*' \ - -and -not -regex '^$(S)src/gyp.*' \ - -and -not -regex '^$(S)src/libbacktrace.*' \ - -print0 \ - | xargs -0 -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py - $(Q)find $(S)src/etc -name '*.py' \ - | xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py - $(Q)find $(S)src/doc -name '*.js' \ - | xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py - $(Q)find $(S)src/etc -name '*.sh' \ - | xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py - $(Q)find $(S)src/etc -name '*.pl' \ - | xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py - $(Q)find $(S)src/etc -name '*.c' \ - | xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py - $(Q)find $(S)src/etc -name '*.h' \ - | xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py - $(Q)echo $(ALL_CS) \ - | xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py - $(Q)echo $(ALL_HS) \ - | xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py + $(Q) $(CFG_PYTHON) $(S)src/etc/tidy.py $(S)src/ + +.PHONY: tidy-binaries +tidy-binaries: + @$(call E, check: binaries) $(Q)find $(S)src -type f -perm +a+x \ -not -name '*.rs' -and -not -name '*.py' \ -and -not -name '*.sh' \ @@ -303,8 +270,15 @@ tidy: | grep '^$(S)src/rust-installer' -v \ | xargs $(CFG_PYTHON) $(S)src/etc/check-binaries.py +.PHONY: tidy-errors +tidy-errors: + @$(call E, check: extended errors) + $(Q) $(CFG_PYTHON) $(S)src/etc/errorck.py $(S)src/ -endif +.PHONY: tidy-features +tidy-features: + @$(call E, check: feature sanity) + $(Q) $(CFG_PYTHON) $(S)src/etc/featureck.py $(S)src/ ###################################################################### @@ -317,6 +291,7 @@ check-stage$(1)-T-$(2)-H-$(3)-exec: \ check-stage$(1)-T-$(2)-H-$(3)-rpass-exec \ check-stage$(1)-T-$(2)-H-$(3)-rfail-exec \ check-stage$(1)-T-$(2)-H-$(3)-cfail-exec \ + check-stage$(1)-T-$(2)-H-$(3)-pfail-exec \ check-stage$(1)-T-$(2)-H-$(3)-rpass-valgrind-exec \ check-stage$(1)-T-$(2)-H-$(3)-rpass-full-exec \ check-stage$(1)-T-$(2)-H-$(3)-cfail-full-exec \ @@ -420,14 +395,14 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \ && touch $$@ endef -define DEF_TEST_CRATE_RULES_arm-linux-androideabi +define DEF_TEST_CRATE_RULES_android check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)) $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \ $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)) @$$(call E, run: $$< via adb) $$(Q)$(CFG_ADB) push $$< $(CFG_ADB_TEST_DIR) - $$(Q)$(CFG_ADB) shell '(cd $(CFG_ADB_TEST_DIR); LD_LIBRARY_PATH=. \ + $$(Q)$(CFG_ADB) shell '(cd $(CFG_ADB_TEST_DIR); LD_LIBRARY_PATH=./$(2) \ ./$$(notdir $$<) \ --logfile $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log \ $$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) $(TESTARGS))' \ @@ -461,9 +436,9 @@ $(foreach host,$(CFG_HOST), \ $(foreach crate, $(TEST_CRATES), \ $(if $(findstring $(target),$(CFG_BUILD)), \ $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))), \ - $(if $(findstring $(target),"arm-linux-androideabi"), \ + $(if $(findstring android, $(target)), \ $(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \ - $(eval $(call DEF_TEST_CRATE_RULES_arm-linux-androideabi,$(stage),$(target),$(host),$(crate))), \ + $(eval $(call DEF_TEST_CRATE_RULES_android,$(stage),$(target),$(host),$(crate))), \ $(eval $(call DEF_TEST_CRATE_RULES_null,$(stage),$(target),$(host),$(crate))) \ ), \ $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))) \ @@ -479,6 +454,7 @@ RPASS_FULL_RS := $(wildcard $(S)src/test/run-pass-fulldeps/*.rs) CFAIL_FULL_RS := $(wildcard $(S)src/test/compile-fail-fulldeps/*.rs) RFAIL_RS := $(wildcard $(S)src/test/run-fail/*.rs) CFAIL_RS := $(wildcard $(S)src/test/compile-fail/*.rs) +PFAIL_RS := $(wildcard $(S)src/test/parse-fail/*.rs) BENCH_RS := $(wildcard $(S)src/test/bench/*.rs) PRETTY_RS := $(wildcard $(S)src/test/pretty/*.rs) DEBUGINFO_GDB_RS := $(wildcard $(S)src/test/debuginfo/*.rs) @@ -496,6 +472,7 @@ RPASS_FULL_TESTS := $(RPASS_FULL_RS) CFAIL_FULL_TESTS := $(CFAIL_FULL_RS) RFAIL_TESTS := $(RFAIL_RS) CFAIL_TESTS := $(CFAIL_RS) +PFAIL_TESTS := $(PFAIL_RS) BENCH_TESTS := $(BENCH_RS) PERF_TESTS := $(PERF_RS) PRETTY_TESTS := $(PRETTY_RS) @@ -533,6 +510,11 @@ CTEST_BUILD_BASE_cfail = compile-fail CTEST_MODE_cfail = compile-fail CTEST_RUNTOOL_cfail = $(CTEST_RUNTOOL) +CTEST_SRC_BASE_pfail = parse-fail +CTEST_BUILD_BASE_pfail = parse-fail +CTEST_MODE_pfail = parse-fail +CTEST_RUNTOOL_pfail = $(CTEST_RUNTOOL) + CTEST_SRC_BASE_bench = bench CTEST_BUILD_BASE_bench = bench CTEST_MODE_bench = run-pass @@ -639,7 +621,6 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \ ifdef CFG_VALGRIND_RPASS ifdef GOOD_VALGRIND_$(2) -$(info cfg: valgrind-path set to $(CFG_VALGRIND_RPASS)) CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) += --valgrind-path "$(CFG_VALGRIND_RPASS)" endif endif @@ -656,6 +637,7 @@ CTEST_DEPS_rpass-full_$(1)-T-$(2)-H-$(3) = $$(RPASS_FULL_TESTS) $$(CSREQ$(1)_T_$ CTEST_DEPS_cfail-full_$(1)-T-$(2)-H-$(3) = $$(CFAIL_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3)) CTEST_DEPS_rfail_$(1)-T-$(2)-H-$(3) = $$(RFAIL_TESTS) CTEST_DEPS_cfail_$(1)-T-$(2)-H-$(3) = $$(CFAIL_TESTS) +CTEST_DEPS_pfail_$(1)-T-$(2)-H-$(3) = $$(PFAIL_TESTS) CTEST_DEPS_bench_$(1)-T-$(2)-H-$(3) = $$(BENCH_TESTS) CTEST_DEPS_perf_$(1)-T-$(2)-H-$(3) = $$(PERF_TESTS) CTEST_DEPS_debuginfo-gdb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_GDB_TESTS) @@ -724,7 +706,7 @@ endif endef -CTEST_NAMES = rpass rpass-valgrind rpass-full cfail-full rfail cfail bench perf debuginfo-gdb debuginfo-lldb codegen +CTEST_NAMES = rpass rpass-valgrind rpass-full cfail-full rfail cfail pfail bench perf debuginfo-gdb debuginfo-lldb codegen $(foreach host,$(CFG_HOST), \ $(eval $(foreach target,$(CFG_TARGET), \ @@ -883,6 +865,7 @@ TEST_GROUPS = \ cfail-full \ rfail \ cfail \ + pfail \ bench \ perf \ rmake \ @@ -1011,7 +994,8 @@ $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \ $$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3)) \ "$$(LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3))" \ "$$(LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3))" \ - $(1) + $(1) \ + $$(S) @touch $$@ else # FIXME #11094 - The above rule doesn't work right for multiple targets diff --git a/src/compiler-rt/Makefile b/src/compiler-rt/Makefile index ac3daac5fc..49dc71bd3a 100644 --- a/src/compiler-rt/Makefile +++ b/src/compiler-rt/Makefile @@ -247,12 +247,12 @@ $(call Set,Tmp.CFLAGS,$(strip \ -mkernel -DKERNEL_USE,)\ $(call GetCNAVar,CFLAGS,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch)))) -$(Tmp.ObjPath)/%.o: $(Tmp.SrcPath)/%.s $(Tmp.Dependencies) $(Tmp.ObjPath)/.dir - $(Summary) " ASSEMBLE: $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$<" - $(Verb) $(Tmp.CC) $(COMMON_ASMFLAGS) $(Tmp.CFLAGS) -c -o $$@ $$< $(Tmp.ObjPath)/%.o: $(Tmp.SrcPath)/%.S $(Tmp.Dependencies) $(Tmp.ObjPath)/.dir $(Summary) " ASSEMBLE: $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$<" $(Verb) $(Tmp.CC) $(COMMON_ASMFLAGS) $(Tmp.CFLAGS) -c -o $$@ $$< +$(Tmp.ObjPath)/%.o: $(Tmp.SrcPath)/%.s $(Tmp.Dependencies) $(Tmp.ObjPath)/.dir + $(Summary) " ASSEMBLE: $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$<" + $(Verb) $(Tmp.CC) $(COMMON_ASMFLAGS) $(Tmp.CFLAGS) -c -o $$@ $$< $(Tmp.ObjPath)/%.o: $(Tmp.SrcPath)/%.c $(Tmp.Dependencies) $(Tmp.ObjPath)/.dir $(Summary) " COMPILE: $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$<" $(Verb) $(Tmp.CC) $(COMMON_CFLAGS) $(Tmp.CFLAGS) -c -o $$@ $$< diff --git a/src/compiler-rt/lib/builtins/CMakeLists.txt b/src/compiler-rt/lib/builtins/CMakeLists.txt index 0c88893e1a..21272b97ce 100644 --- a/src/compiler-rt/lib/builtins/CMakeLists.txt +++ b/src/compiler-rt/lib/builtins/CMakeLists.txt @@ -242,10 +242,13 @@ set(arm_SOURCES arm/unordsf2vfp.S ${GENERIC_SOURCES}) +set(aarch64_SOURCES + ${GENERIC_SOURCES}) + add_custom_target(builtins) if (NOT WIN32) - foreach(arch x86_64 i386 arm) + foreach(arch x86_64 i386 arm aarch64) if(CAN_TARGET_${arch}) add_compiler_rt_runtime(clang_rt.${arch} ${arch} STATIC SOURCES ${${arch}_SOURCES} diff --git a/src/compiler-rt/lib/builtins/Makefile.mk b/src/compiler-rt/lib/builtins/Makefile.mk index 3143d91f07..18debba00f 100644 --- a/src/compiler-rt/lib/builtins/Makefile.mk +++ b/src/compiler-rt/lib/builtins/Makefile.mk @@ -11,7 +11,7 @@ ModuleName := builtins SubDirs := # Add arch specific optimized implementations. -SubDirs += i386 ppc x86_64 arm +SubDirs += i386 ppc x86_64 arm aarch64 # Define the variables for this specific directory. Sources := $(foreach file,$(wildcard $(Dir)/*.c),$(notdir $(file))) diff --git a/src/compiler-rt/lib/builtins/aarch64/Makefile.mk b/src/compiler-rt/lib/builtins/aarch64/Makefile.mk new file mode 100644 index 0000000000..4855941ff0 --- /dev/null +++ b/src/compiler-rt/lib/builtins/aarch64/Makefile.mk @@ -0,0 +1,22 @@ +#===- lib/builtins/aarch64/Makefile.mk ---------------------*- Makefile -*--===# +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +#===------------------------------------------------------------------------===# + +ModuleName := builtins +SubDirs := +OnlyArchs := aarch64 + +AsmSources := $(foreach file,$(wildcard $(Dir)/*.S),$(notdir $(file))) +Sources := $(foreach file,$(wildcard $(Dir)/*.c),$(notdir $(file))) +ObjNames := $(Sources:%.c=%.o) $(AsmSources:%.S=%.o) +Implementation := Optimized + +# FIXME: use automatic dependencies? +Dependencies := $(wildcard lib/*.h $(Dir)/*.h) + +CFLAGS.builtins := $(CFLAGS) -std=c99 diff --git a/src/compiler-rt/lib/builtins/clear_cache.c b/src/compiler-rt/lib/builtins/clear_cache.c index a5cfac070f..37d6c61489 100644 --- a/src/compiler-rt/lib/builtins/clear_cache.c +++ b/src/compiler-rt/lib/builtins/clear_cache.c @@ -25,6 +25,10 @@ #include #endif +#if defined(__aarch64__) && !defined(__APPLE__) + #include +#endif + /* * The compiler generates calls to __clear_cache() when creating * trampoline functions on the stack for use with nested functions. diff --git a/src/compiler-rt/make/platform/triple.mk b/src/compiler-rt/make/platform/triple.mk index c894a78188..792e806200 100644 --- a/src/compiler-rt/make/platform/triple.mk +++ b/src/compiler-rt/make/platform/triple.mk @@ -54,7 +54,13 @@ ifeq ($(TargetTriple),arm-linux-androideabi) sync_fetch_and_umin_8 endif -ArchEnabledFunctions := $(filter-out $(ArchDisabledFunctions),$(value ArchFunctions.$(Arch))) +# Clear cache is builtin on aarch64-apple-ios +# arm64 and aarch64 are synonims, but iOS targets usually use arm64 (history reasons) +ifeq (aarch64-apple-ios,$(subst arm64,aarch64,$(TargetTriple))) +CommonDisabledFunctions := clear_cache +endif -FUNCTIONS.builtins := $(CommonFunctions_gcc) $(ArchEnabledFunctions) +ArchEnabledFunctions := $(filter-out $(ArchDisabledFunctions),$(value ArchFunctions.$(Arch))) +CommonEnabledFunctions := $(filter-out $(CommonDisabledFunctions),$(CommonFunctions_gcc)) +FUNCTIONS.builtins := $(CommonEnabledFunctions) $(ArchEnabledFunctions) diff --git a/src/compiletest/common.rs b/src/compiletest/common.rs index c29f74d741..2c046d2527 100644 --- a/src/compiletest/common.rs +++ b/src/compiletest/common.rs @@ -11,11 +11,11 @@ pub use self::Mode::*; use std::fmt; use std::str::FromStr; -use regex::Regex; -#[derive(Clone, PartialEq)] +#[derive(Clone, Copy, PartialEq, Debug)] pub enum Mode { CompileFail, + ParseFail, RunFail, RunPass, RunPassValgrind, @@ -25,28 +25,29 @@ pub enum Mode { Codegen } -impl Copy for Mode {} - impl FromStr for Mode { - fn from_str(s: &str) -> Option { + type Err = (); + fn from_str(s: &str) -> Result { match s { - "compile-fail" => Some(CompileFail), - "run-fail" => Some(RunFail), - "run-pass" => Some(RunPass), - "run-pass-valgrind" => Some(RunPassValgrind), - "pretty" => Some(Pretty), - "debuginfo-lldb" => Some(DebugInfoLldb), - "debuginfo-gdb" => Some(DebugInfoGdb), - "codegen" => Some(Codegen), - _ => None, + "compile-fail" => Ok(CompileFail), + "parse-fail" => Ok(ParseFail), + "run-fail" => Ok(RunFail), + "run-pass" => Ok(RunPass), + "run-pass-valgrind" => Ok(RunPassValgrind), + "pretty" => Ok(Pretty), + "debuginfo-lldb" => Ok(DebugInfoLldb), + "debuginfo-gdb" => Ok(DebugInfoGdb), + "codegen" => Ok(Codegen), + _ => Err(()), } } } -impl fmt::String for Mode { +impl fmt::Display for Mode { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - fmt::String::fmt(match *self { + fmt::Display::fmt(match *self { CompileFail => "compile-fail", + ParseFail => "parse-fail", RunFail => "run-fail", RunPass => "run-pass", RunPassValgrind => "run-pass-valgrind", @@ -58,12 +59,6 @@ impl fmt::String for Mode { } } -impl fmt::Show for Mode { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - fmt::String::fmt(self, f) - } -} - #[derive(Clone)] pub struct Config { // The library paths required for running the compiler @@ -107,28 +102,11 @@ pub struct Config { pub run_ignored: bool, // Only run tests that match this filter - pub filter: Option, - - // Precompiled regex for finding expected errors in cfail - pub cfail_regex: Regex, + pub filter: Option, // Write out a parseable log of tests that were run pub logfile: Option, - // Write out a json file containing any metrics of the run - pub save_metrics: Option, - - // Write and ratchet a metrics file - pub ratchet_metrics: Option, - - // Percent change in metrics to consider noise - pub ratchet_noise_percent: Option, - - // "Shard" of the testsuite to pub run: this has the form of - // two numbers (a,b), and causes only those tests with - // positional order equal to a mod b to run. - pub test_shard: Option<(uint,uint)>, - // A command line to prefix program execution with, // for running under valgrind pub runtool: Option, diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index 802fb05796..278ce5565d 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -9,10 +9,19 @@ // except according to those terms. #![crate_type = "bin"] -#![allow(unknown_features)] -#![feature(slicing_syntax, unboxed_closures)] + #![feature(box_syntax)] +#![feature(collections)] #![feature(int_uint)] +#![feature(old_io)] +#![feature(old_path)] +#![feature(rustc_private)] +#![feature(unboxed_closures)] +#![feature(std_misc)] +#![feature(test)] +#![feature(unicode)] +#![feature(env)] +#![feature(core)] #![deny(warnings)] @@ -21,18 +30,15 @@ extern crate getopts; #[macro_use] extern crate log; -extern crate regex; -use std::os; -use std::io; -use std::io::fs; -use std::str::FromStr; +use std::env; +use std::old_io; +use std::old_io::fs; use std::thunk::Thunk; use getopts::{optopt, optflag, reqopt}; use common::Config; use common::{Pretty, DebugInfoGdb, DebugInfoLldb, Codegen}; use util::logv; -use regex::Regex; pub mod procsrv; pub mod util; @@ -42,8 +48,7 @@ pub mod common; pub mod errors; pub fn main() { - let args = os::args(); - let config = parse_config(args); + let config = parse_config(env::args().collect()); if config.valgrind_path.is_none() && config.force_valgrind { panic!("Can't find Valgrind to run Valgrind tests"); @@ -68,7 +73,7 @@ pub fn parse_config(args: Vec ) -> Config { reqopt("", "aux-base", "directory to find auxiliary test files", "PATH"), reqopt("", "stage-id", "the target-stage identifier", "stageN-TARGET"), reqopt("", "mode", "which sort of compile tests to run", - "(compile-fail|run-fail|run-pass|run-pass-valgrind|pretty|debug-info)"), + "(compile-fail|parse-fail|run-fail|run-pass|run-pass-valgrind|pretty|debug-info)"), optflag("", "ignored", "run tests marked as ignored"), optopt("", "runtool", "supervisor program to run tests under \ (eg. emulator, valgrind)", "PROGRAM"), @@ -76,10 +81,6 @@ pub fn parse_config(args: Vec ) -> Config { optopt("", "target-rustcflags", "flags to pass to rustc for target", "FLAGS"), optflag("", "verbose", "run tests verbosely, showing all output"), optopt("", "logfile", "file to log test execution to", "FILE"), - optopt("", "save-metrics", "file to save metrics to", "FILE"), - optopt("", "ratchet-metrics", "file to ratchet metrics against", "FILE"), - optopt("", "ratchet-noise-percent", - "percent change in metrics to consider noise", "N"), optflag("", "jit", "run tests under the JIT"), optopt("", "target", "the target to build for", "TARGET"), optopt("", "host", "the host to build for", "HOST"), @@ -89,45 +90,40 @@ pub fn parse_config(args: Vec ) -> Config { optopt("", "adb-path", "path to the android debugger", "PATH"), optopt("", "adb-test-dir", "path to tests for the android debugger", "PATH"), optopt("", "lldb-python-dir", "directory containing LLDB's python module", "PATH"), - optopt("", "test-shard", "run shard A, of B shards, worth of the testsuite", "A.B"), optflag("h", "help", "show this message")); assert!(!args.is_empty()); let argv0 = args[0].clone(); let args_ = args.tail(); - if args[1].as_slice() == "-h" || args[1].as_slice() == "--help" { + if args[1] == "-h" || args[1] == "--help" { let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0); - println!("{}", getopts::usage(message.as_slice(), groups.as_slice())); + println!("{}", getopts::usage(&message, &groups)); println!(""); panic!() } let matches = - &match getopts::getopts(args_.as_slice(), groups.as_slice()) { + &match getopts::getopts(args_, &groups) { Ok(m) => m, Err(f) => panic!("{:?}", f) }; if matches.opt_present("h") || matches.opt_present("help") { let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0); - println!("{}", getopts::usage(message.as_slice(), groups.as_slice())); + println!("{}", getopts::usage(&message, &groups)); println!(""); panic!() } fn opt_path(m: &getopts::Matches, nm: &str) -> Path { - Path::new(m.opt_str(nm).unwrap()) + match m.opt_str(nm) { + Some(s) => Path::new(s), + None => panic!("no option (=path) found for {}", nm), + } } let filter = if !matches.free.is_empty() { - let s = matches.free[0].as_slice(); - match regex::Regex::new(s) { - Ok(re) => Some(re), - Err(e) => { - println!("failed to parse filter /{}/: {:?}", s, e); - panic!() - } - } + Some(matches.free[0].clone()) } else { None }; @@ -144,19 +140,10 @@ pub fn parse_config(args: Vec ) -> Config { build_base: opt_path(matches, "build-base"), aux_base: opt_path(matches, "aux-base"), stage_id: matches.opt_str("stage-id").unwrap(), - mode: FromStr::from_str(matches.opt_str("mode") - .unwrap() - .as_slice()).expect("invalid mode"), + mode: matches.opt_str("mode").unwrap().parse().ok().expect("invalid mode"), run_ignored: matches.opt_present("ignored"), filter: filter, - cfail_regex: Regex::new(errors::EXPECTED_PATTERN).unwrap(), logfile: matches.opt_str("logfile").map(|s| Path::new(s)), - save_metrics: matches.opt_str("save-metrics").map(|s| Path::new(s)), - ratchet_metrics: - matches.opt_str("ratchet-metrics").map(|s| Path::new(s)), - ratchet_noise_percent: - matches.opt_str("ratchet-noise-percent") - .and_then(|s| s.as_slice().parse::()), runtool: matches.opt_str("runtool"), host_rustcflags: matches.opt_str("host-rustcflags"), target_rustcflags: matches.opt_str("target-rustcflags"), @@ -167,15 +154,14 @@ pub fn parse_config(args: Vec ) -> Config { lldb_version: extract_lldb_version(matches.opt_str("lldb-version")), android_cross_path: opt_path(matches, "android-cross-path"), adb_path: opt_str2(matches.opt_str("adb-path")), - adb_test_dir: opt_str2(matches.opt_str("adb-test-dir")), + adb_test_dir: format!("{}/{}", + opt_str2(matches.opt_str("adb-test-dir")), + opt_str2(matches.opt_str("target"))), adb_device_status: - "arm-linux-androideabi" == - opt_str2(matches.opt_str("target")).as_slice() && - "(none)" != - opt_str2(matches.opt_str("adb-test-dir")).as_slice() && + opt_str2(matches.opt_str("target")).contains("android") && + "(none)" != opt_str2(matches.opt_str("adb-test-dir")) && !opt_str2(matches.opt_str("adb-test-dir")).is_empty(), lldb_python_dir: matches.opt_str("lldb-python-dir"), - test_shard: test::opt_shard(matches.opt_str("test-shard")), verbose: matches.opt_present("verbose"), } } @@ -209,10 +195,6 @@ pub fn log_config(config: &Config) { logv(c, format!("adb_test_dir: {:?}", config.adb_test_dir)); logv(c, format!("adb_device_status: {}", config.adb_device_status)); - match config.test_shard { - None => logv(c, "test_shard: (all)".to_string()), - Some((a,b)) => logv(c, format!("test_shard: {}.{}", a, b)) - } logv(c, format!("verbose: {}", config.verbose)); logv(c, format!("\n")); } @@ -220,7 +202,7 @@ pub fn log_config(config: &Config) { pub fn opt_str<'a>(maybestr: &'a Option) -> &'a str { match *maybestr { None => "(none)", - Some(ref s) => s.as_slice(), + Some(ref s) => s, } } @@ -232,19 +214,19 @@ pub fn opt_str2(maybestr: Option) -> String { } pub fn run_tests(config: &Config) { - if config.target.as_slice() == "arm-linux-androideabi" { + if config.target.contains("android") { match config.mode { DebugInfoGdb => { - println!("arm-linux-androideabi debug-info \ - test uses tcp 5039 port. please reserve it"); + println!("{} debug-info test uses tcp 5039 port.\ + please reserve it", config.target); } _ =>{} } - //arm-linux-androideabi debug-info test uses remote debugger - //so, we test 1 task at once. + // android debug-info test uses remote debugger + // so, we test 1 task at once. // also trying to isolate problems with adb_run_wrapper.sh ilooping - os::setenv("RUST_TEST_TASKS","1"); + env::set_var("RUST_TEST_TASKS","1"); } match config.mode { @@ -252,7 +234,7 @@ pub fn run_tests(config: &Config) { // Some older versions of LLDB seem to have problems with multiple // instances running in parallel, so only run one test task at a // time. - os::setenv("RUST_TEST_TASKS", "1"); + env::set_var("RUST_TEST_TASKS", "1"); } _ => { /* proceed */ } } @@ -262,7 +244,10 @@ pub fn run_tests(config: &Config) { // sadly osx needs some file descriptor limits raised for running tests in // parallel (especially when we have lots and lots of child processes). // For context, see #8904 - io::test::raise_fd_limit(); + old_io::test::raise_fd_limit(); + // Prevent issue #21352 UAC blocking .exe containing 'patch' etc. on Windows + // If #11207 is resolved (adding manifest to .exe) this becomes unnecessary + env::set_var("__COMPAT_LAYER", "RunAsInvoker"); let res = test::run_tests_console(&opts, tests.into_iter().collect()); match res { Ok(true) => {} @@ -283,15 +268,8 @@ pub fn test_opts(config: &Config) -> test::TestOpts { logfile: config.logfile.clone(), run_tests: true, run_benchmarks: true, - ratchet_metrics: config.ratchet_metrics.clone(), - ratchet_noise_percent: config.ratchet_noise_percent.clone(), - save_metrics: config.save_metrics.clone(), - test_shard: config.test_shard.clone(), nocapture: false, color: test::AutoColor, - show_boxplot: false, - boxplot_width: 50, - show_all_stats: false, } } @@ -300,7 +278,7 @@ pub fn make_tests(config: &Config) -> Vec { config.src_base.display()); let mut tests = Vec::new(); let dirs = fs::readdir(&config.src_base).unwrap(); - for file in dirs.iter() { + for file in &dirs { let file = file.clone(); debug!("inspecting file {:?}", file.display()); if is_test(config, &file) { @@ -328,14 +306,14 @@ pub fn is_test(config: &Config, testfile: &Path) -> bool { let mut valid = false; - for ext in valid_extensions.iter() { - if name.ends_with(ext.as_slice()) { + for ext in &valid_extensions { + if name.ends_with(ext) { valid = true; } } - for pre in invalid_prefixes.iter() { - if name.starts_with(pre.as_slice()) { + for pre in &invalid_prefixes { + if name.starts_with(pre) { valid = false; } } @@ -382,7 +360,7 @@ pub fn make_metrics_test_closure(config: &Config, testfile: &Path) -> test::Test let config = (*config).clone(); // FIXME (#9639): This needs to handle non-utf8 paths let testfile = testfile.as_str().unwrap().to_string(); - test::DynMetricFn(box move |: mm: &mut test::MetricMap| { + test::DynMetricFn(box move |mm: &mut test::MetricMap| { runtest::run_metrics(config, testfile, mm) }) } @@ -390,21 +368,27 @@ pub fn make_metrics_test_closure(config: &Config, testfile: &Path) -> test::Test fn extract_gdb_version(full_version_line: Option) -> Option { match full_version_line { Some(ref full_version_line) - if full_version_line.as_slice().trim().len() > 0 => { - let full_version_line = full_version_line.as_slice().trim(); - - let re = Regex::new(r"(^|[^0-9])([0-9]\.[0-9])([^0-9]|$)").unwrap(); - - match re.captures(full_version_line) { - Some(captures) => { - Some(captures.at(2).unwrap_or("").to_string()) + if full_version_line.trim().len() > 0 => { + let full_version_line = full_version_line.trim(); + + // used to be a regex "(^|[^0-9])([0-9]\.[0-9])([^0-9]|$)" + for (pos, c) in full_version_line.char_indices() { + if !c.is_digit(10) { continue } + if pos + 2 >= full_version_line.len() { continue } + if full_version_line.char_at(pos + 1) != '.' { continue } + if !full_version_line.char_at(pos + 2).is_digit(10) { continue } + if pos > 0 && full_version_line.char_at_reverse(pos).is_digit(10) { + continue } - None => { - println!("Could not extract GDB version from line '{}'", - full_version_line); - None + if pos + 3 < full_version_line.len() && + full_version_line.char_at(pos + 3).is_digit(10) { + continue } + return Some(full_version_line[pos..pos+3].to_string()); } + println!("Could not extract GDB version from line '{}'", + full_version_line); + None }, _ => None } @@ -424,21 +408,29 @@ fn extract_lldb_version(full_version_line: Option) -> Option { match full_version_line { Some(ref full_version_line) - if full_version_line.as_slice().trim().len() > 0 => { - let full_version_line = full_version_line.as_slice().trim(); - - let re = Regex::new(r"[Ll][Ll][Dd][Bb]-([0-9]+)").unwrap(); - - match re.captures(full_version_line) { - Some(captures) => { - Some(captures.at(1).unwrap_or("").to_string()) - } - None => { - println!("Could not extract LLDB version from line '{}'", - full_version_line); - None - } + if full_version_line.trim().len() > 0 => { + let full_version_line = full_version_line.trim(); + + for (pos, l) in full_version_line.char_indices() { + if l != 'l' && l != 'L' { continue } + if pos + 5 >= full_version_line.len() { continue } + let l = full_version_line.char_at(pos + 1); + if l != 'l' && l != 'L' { continue } + let d = full_version_line.char_at(pos + 2); + if d != 'd' && d != 'D' { continue } + let b = full_version_line.char_at(pos + 3); + if b != 'b' && b != 'B' { continue } + let dash = full_version_line.char_at(pos + 4); + if dash != '-' { continue } + + let vers = full_version_line[pos + 5..].chars().take_while(|c| { + c.is_digit(10) + }).collect::(); + if vers.len() > 0 { return Some(vers) } } + println!("Could not extract LLDB version from line '{}'", + full_version_line); + None }, _ => None } diff --git a/src/compiletest/errors.rs b/src/compiletest/errors.rs index dcfac688c7..d8faa53a2d 100644 --- a/src/compiletest/errors.rs +++ b/src/compiletest/errors.rs @@ -9,9 +9,7 @@ // except according to those terms. use self::WhichLine::*; -use std::ascii::AsciiExt; -use std::io::{BufferedReader, File}; -use regex::Regex; +use std::old_io::{BufferedReader, File}; pub struct ExpectedError { pub line: uint, @@ -19,6 +17,9 @@ pub struct ExpectedError { pub msg: String, } +#[derive(PartialEq, Debug)] +enum WhichLine { ThisLine, FollowPrevious(uint), AdjustBackward(uint) } + /// Looks for either "//~| KIND MESSAGE" or "//~^^... KIND MESSAGE" /// The former is a "follow" that inherits its target from the preceding line; /// the latter is an "adjusts" that goes that many lines up. @@ -26,15 +27,8 @@ pub struct ExpectedError { /// Goal is to enable tests both like: //~^^^ ERROR go up three /// and also //~^ ERROR message one for the preceding line, and /// //~| ERROR message two for that same line. - -pub static EXPECTED_PATTERN : &'static str = - r"//~(?P\|)?(?P\^*)\s*(?P\S*)\s*(?P.*)"; - -#[derive(PartialEq, Show)] -enum WhichLine { ThisLine, FollowPrevious(uint), AdjustBackward(uint) } - // Load any test directives embedded in the file -pub fn load_errors(re: &Regex, testfile: &Path) -> Vec { +pub fn load_errors(testfile: &Path) -> Vec { let mut rdr = BufferedReader::new(File::open(testfile).unwrap()); // `last_nonfollow_error` tracks the most recently seen @@ -50,7 +44,7 @@ pub fn load_errors(re: &Regex, testfile: &Path) -> Vec { rdr.lines().enumerate().filter_map(|(line_no, ln)| { parse_expected(last_nonfollow_error, line_no + 1, - ln.unwrap().as_slice(), re) + &ln.unwrap()) .map(|(which, error)| { match which { FollowPrevious(_) => {} @@ -63,30 +57,39 @@ pub fn load_errors(re: &Regex, testfile: &Path) -> Vec { fn parse_expected(last_nonfollow_error: Option, line_num: uint, - line: &str, - re: &Regex) -> Option<(WhichLine, ExpectedError)> { - re.captures(line).and_then(|caps| { - let adjusts = caps.name("adjusts").unwrap_or("").len(); - let kind = caps.name("kind").unwrap_or("").to_ascii_lowercase(); - let msg = caps.name("msg").unwrap_or("").trim().to_string(); - let follow = caps.name("follow").unwrap_or("").len() > 0; + line: &str) -> Option<(WhichLine, ExpectedError)> { + let start = match line.find_str("//~") { Some(i) => i, None => return None }; + let (follow, adjusts) = if line.char_at(start + 3) == '|' { + (true, 0) + } else { + (false, line[start + 3..].chars().take_while(|c| *c == '^').count()) + }; + let kind_start = start + 3 + adjusts + (follow as usize); + let letters = line[kind_start..].chars(); + let kind = letters.skip_while(|c| c.is_whitespace()) + .take_while(|c| !c.is_whitespace()) + .map(|c| c.to_lowercase()) + .collect::(); + let letters = line[kind_start..].chars(); + let msg = letters.skip_while(|c| c.is_whitespace()) + .skip_while(|c| !c.is_whitespace()) + .collect::().trim().to_string(); - let (which, line) = if follow { - assert!(adjusts == 0, "use either //~| or //~^, not both."); - let line = last_nonfollow_error.unwrap_or_else(|| { - panic!("encountered //~| without preceding //~^ line.") - }); - (FollowPrevious(line), line) - } else { - let which = - if adjusts > 0 { AdjustBackward(adjusts) } else { ThisLine }; - let line = line_num - adjusts; - (which, line) - }; + let (which, line) = if follow { + assert!(adjusts == 0, "use either //~| or //~^, not both."); + let line = last_nonfollow_error.unwrap_or_else(|| { + panic!("encountered //~| without preceding //~^ line.") + }); + (FollowPrevious(line), line) + } else { + let which = + if adjusts > 0 { AdjustBackward(adjusts) } else { ThisLine }; + let line = line_num - adjusts; + (which, line) + }; - debug!("line={} which={:?} kind={:?} msg={:?}", line_num, which, kind, msg); - Some((which, ExpectedError { line: line, - kind: kind, - msg: msg, })) - }) + debug!("line={} which={:?} kind={:?} msg={:?}", line_num, which, kind, msg); + Some((which, ExpectedError { line: line, + kind: kind, + msg: msg, })) } diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index 374fd2e3ef..c253967964 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -42,8 +42,6 @@ pub struct TestProps { pub pretty_compare_only: bool, // Patterns which must not appear in the output of a cfail test. pub forbid_output: Vec, - // Ignore errors which originate from a command line span - pub ignore_command_line: bool, } // Load any test directives embedded in the file @@ -62,8 +60,6 @@ pub fn load_props(testfile: &Path) -> TestProps { let mut pretty_mode = None; let mut pretty_compare_only = false; let mut forbid_output = Vec::new(); - let mut ignore_command_line = false; - iter_header(testfile, |ln| { match parse_error_pattern(ln) { Some(ep) => error_patterns.push(ep), @@ -106,10 +102,6 @@ pub fn load_props(testfile: &Path) -> TestProps { pretty_compare_only = parse_pretty_compare_only(ln); } - if !ignore_command_line { - ignore_command_line = parse_ignore_command_line(ln); - } - match parse_aux_build(ln) { Some(ab) => { aux_builds.push(ab); } None => {} @@ -148,17 +140,16 @@ pub fn load_props(testfile: &Path) -> TestProps { pretty_mode: pretty_mode.unwrap_or("normal".to_string()), pretty_compare_only: pretty_compare_only, forbid_output: forbid_output, - ignore_command_line: ignore_command_line, } } pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool { fn ignore_target(config: &Config) -> String { - format!("ignore-{}", util::get_os(config.target.as_slice())) + format!("ignore-{}", util::get_os(&config.target)) } fn ignore_stage(config: &Config) -> String { format!("ignore-{}", - config.stage_id.as_slice().split('-').next().unwrap()) + config.stage_id.split('-').next().unwrap()) } fn ignore_gdb(config: &Config, line: &str) -> bool { if config.mode != common::DebugInfoGdb { @@ -178,8 +169,8 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool { .expect("Malformed GDB version directive"); // Ignore if actual version is smaller the minimum required // version - gdb_version_to_int(actual_version.as_slice()) < - gdb_version_to_int(min_version.as_slice()) + gdb_version_to_int(actual_version) < + gdb_version_to_int(min_version) } else { false } @@ -206,8 +197,8 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool { .expect("Malformed lldb version directive"); // Ignore if actual version is smaller the minimum required // version - lldb_version_to_int(actual_version.as_slice()) < - lldb_version_to_int(min_version.as_slice()) + lldb_version_to_int(actual_version) < + lldb_version_to_int(min_version) } else { false } @@ -218,8 +209,8 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool { let val = iter_header(testfile, |ln| { !parse_name_directive(ln, "ignore-test") && - !parse_name_directive(ln, ignore_target(config).as_slice()) && - !parse_name_directive(ln, ignore_stage(config).as_slice()) && + !parse_name_directive(ln, &ignore_target(config)) && + !parse_name_directive(ln, &ignore_stage(config)) && !(config.mode == common::Pretty && parse_name_directive(ln, "ignore-pretty")) && !(config.target != config.host && parse_name_directive(ln, "ignore-cross-compile")) && !ignore_gdb(config, ln) && @@ -232,7 +223,7 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool { fn iter_header(testfile: &Path, mut it: F) -> bool where F: FnMut(&str) -> bool, { - use std::io::{BufferedReader, File}; + use std::old_io::{BufferedReader, File}; let mut rdr = BufferedReader::new(File::open(testfile).unwrap()); for ln in rdr.lines() { @@ -240,11 +231,11 @@ fn iter_header(testfile: &Path, mut it: F) -> bool where // module or function. This doesn't seem to be an optimization // with a warm page cache. Maybe with a cold one. let ln = ln.unwrap(); - if ln.as_slice().starts_with("fn") || - ln.as_slice().starts_with("mod") { + if ln.starts_with("fn") || + ln.starts_with("mod") { return true; } else { - if !(it(ln.as_slice().trim())) { + if !(it(ln.trim())) { return false; } } @@ -300,21 +291,17 @@ fn parse_pretty_compare_only(line: &str) -> bool { parse_name_directive(line, "pretty-compare-only") } -fn parse_ignore_command_line(line: &str) -> bool { - parse_name_directive(line, "ignore-command-line") -} - fn parse_exec_env(line: &str) -> Option<(String, String)> { parse_name_value_directive(line, "exec-env").map(|nv| { // nv is either FOO or FOO=BAR - let mut strs: Vec = nv.as_slice() + let mut strs: Vec = nv .splitn(1, '=') .map(|s| s.to_string()) .collect(); match strs.len() { - 1u => (strs.pop().unwrap(), "".to_string()), - 2u => { + 1 => (strs.pop().unwrap(), "".to_string()), + 2 => { let end = strs.pop().unwrap(); (strs.pop().unwrap(), end) } @@ -343,10 +330,9 @@ fn parse_name_directive(line: &str, directive: &str) -> bool { pub fn parse_name_value_directive(line: &str, directive: &str) -> Option { let keycolon = format!("{}:", directive); - match line.find_str(keycolon.as_slice()) { + match line.find_str(&keycolon) { Some(colon) => { - let value = line.slice(colon + keycolon.len(), - line.len()).to_string(); + let value = line[(colon + keycolon.len()) .. line.len()].to_string(); debug!("{}: {}", directive, value); Some(value) } @@ -358,7 +344,7 @@ pub fn gdb_version_to_int(version_string: &str) -> int { let error_string = format!( "Encountered GDB version string with unexpected format: {}", version_string); - let error_string = error_string.as_slice(); + let error_string = error_string; let components: Vec<&str> = version_string.trim().split('.').collect(); @@ -366,8 +352,8 @@ pub fn gdb_version_to_int(version_string: &str) -> int { panic!("{}", error_string); } - let major: int = components[0].parse().expect(error_string); - let minor: int = components[1].parse().expect(error_string); + let major: int = components[0].parse().ok().expect(&error_string); + let minor: int = components[1].parse().ok().expect(&error_string); return major * 1000 + minor; } @@ -376,7 +362,7 @@ pub fn lldb_version_to_int(version_string: &str) -> int { let error_string = format!( "Encountered LLDB version string with unexpected format: {}", version_string); - let error_string = error_string.as_slice(); - let major: int = version_string.parse().expect(error_string); + let error_string = error_string; + let major: int = version_string.parse().ok().expect(&error_string); return major; } diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs index f3f860d470..148a43e6c7 100644 --- a/src/compiletest/procsrv.rs +++ b/src/compiletest/procsrv.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::io::process::{ProcessExit, Command, Process, ProcessOutput}; +use std::old_io::process::{ProcessExit, Command, Process, ProcessOutput}; use std::dynamic_lib::DynamicLibrary; fn add_target_env(cmd: &mut Command, lib_path: &str, aux_path: Option<&str>) { @@ -23,7 +23,7 @@ fn add_target_env(cmd: &mut Command, lib_path: &str, aux_path: Option<&str>) { // Add the new dylib search path var let var = DynamicLibrary::envvar(); - let newpath = DynamicLibrary::create_path(path.as_slice()); + let newpath = DynamicLibrary::create_path(&path); let newpath = String::from_utf8(newpath).unwrap(); cmd.env(var.to_string(), newpath); } @@ -40,14 +40,14 @@ pub fn run(lib_path: &str, let mut cmd = Command::new(prog); cmd.args(args); add_target_env(&mut cmd, lib_path, aux_path); - for (key, val) in env.into_iter() { + for (key, val) in env { cmd.env(key, val); } match cmd.spawn() { Ok(mut process) => { - for input in input.iter() { - process.stdin.as_mut().unwrap().write(input.as_bytes()).unwrap(); + if let Some(input) = input { + process.stdin.as_mut().unwrap().write_all(input.as_bytes()).unwrap(); } let ProcessOutput { status, output, error } = process.wait_with_output().unwrap(); @@ -72,14 +72,14 @@ pub fn run_background(lib_path: &str, let mut cmd = Command::new(prog); cmd.args(args); add_target_env(&mut cmd, lib_path, aux_path); - for (key, val) in env.into_iter() { + for (key, val) in env { cmd.env(key, val); } match cmd.spawn() { Ok(mut process) => { - for input in input.iter() { - process.stdin.as_mut().unwrap().write(input.as_bytes()).unwrap(); + if let Some(input) = input { + process.stdin.as_mut().unwrap().write_all(input.as_bytes()).unwrap(); } Some(process) diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index a97d491344..1cbb8742bb 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -11,7 +11,7 @@ use self::TargetLocation::*; use common::Config; -use common::{CompileFail, Pretty, RunFail, RunPass, RunPassValgrind, DebugInfoGdb}; +use common::{CompileFail, ParseFail, Pretty, RunFail, RunPass, RunPassValgrind, DebugInfoGdb}; use common::{Codegen, DebugInfoLldb}; use errors; use header::TestProps; @@ -23,26 +23,26 @@ use util; #[cfg(target_os = "windows")] use std::ascii::AsciiExt; -use std::io::File; -use std::io::fs::PathExtensions; -use std::io::fs; -use std::io::net::tcp; -use std::io::process::ProcessExit; -use std::io::process; -use std::io::timer; -use std::io; -use std::os; +use std::old_io::File; +use std::old_io::fs::PathExtensions; +use std::old_io::fs; +use std::old_io::net::tcp; +use std::old_io::process::ProcessExit; +use std::old_io::process; +use std::old_io::timer; +use std::old_io; +use std::env; use std::iter::repeat; use std::str; use std::string::String; -use std::thread::Thread; +use std::thread; use std::time::Duration; use test::MetricMap; pub fn run(config: Config, testfile: String) { - match config.target.as_slice() { + match &*config.target { - "arm-linux-androideabi" => { + "arm-linux-androideabi" | "aarch64-linux-android" => { if !config.adb_device_status { panic!("android device not available"); } @@ -66,6 +66,7 @@ pub fn run_metrics(config: Config, testfile: String, mm: &mut MetricMap) { debug!("loaded props"); match config.mode { CompileFail => run_cfail_test(&config, &props, &testfile), + ParseFail => run_cfail_test(&config, &props, &testfile), RunFail => run_rfail_test(&config, &props, &testfile), RunPass => run_rpass_test(&config, &props, &testfile), RunPassValgrind => run_valgrind_test(&config, &props, &testfile), @@ -88,7 +89,7 @@ fn run_cfail_test(config: &Config, props: &TestProps, testfile: &Path) { let proc_res = compile_test(config, props, testfile); if proc_res.status.success() { - fatal_proc_rec("compile-fail test compiled successfully!", + fatal_proc_rec(&format!("{} test compiled successfully!", config.mode)[], &proc_res); } @@ -99,17 +100,17 @@ fn run_cfail_test(config: &Config, props: &TestProps, testfile: &Path) { } let output_to_check = get_output(props, &proc_res); - let expected_errors = errors::load_errors(&config.cfail_regex, testfile); + let expected_errors = errors::load_errors(testfile); if !expected_errors.is_empty() { if !props.error_patterns.is_empty() { fatal("both error pattern and expected errors specified"); } - check_expected_errors(props, expected_errors, testfile, &proc_res); + check_expected_errors(expected_errors, testfile, &proc_res); } else { - check_error_patterns(props, testfile, output_to_check.as_slice(), &proc_res); + check_error_patterns(props, testfile, &output_to_check, &proc_res); } check_no_compiler_crash(&proc_res); - check_forbid_output(props, output_to_check.as_slice(), &proc_res); + check_forbid_output(props, &output_to_check, &proc_res); } fn run_rfail_test(config: &Config, props: &TestProps, testfile: &Path) { @@ -133,7 +134,7 @@ fn run_rfail_test(config: &Config, props: &TestProps, testfile: &Path) { let output_to_check = get_output(props, &proc_res); check_correct_failure_status(&proc_res); - check_error_patterns(props, testfile, output_to_check.as_slice(), &proc_res); + check_error_patterns(props, testfile, &output_to_check, &proc_res); } fn check_correct_failure_status(proc_res: &ProcRes) { @@ -141,8 +142,8 @@ fn check_correct_failure_status(proc_res: &ProcRes) { static RUST_ERR: int = 101; if !proc_res.status.matches_exit_status(RUST_ERR) { fatal_proc_rec( - format!("failure produced the wrong error: {:?}", - proc_res.status).as_slice(), + &format!("failure produced the wrong error: {:?}", + proc_res.status), proc_res); } } @@ -211,11 +212,10 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) { props, testfile, srcs[round].to_string(), - props.pretty_mode.as_slice()); + &props.pretty_mode); if !proc_res.status.success() { - fatal_proc_rec(format!("pretty-printing failed in round {}", - round).as_slice(), + fatal_proc_rec(&format!("pretty-printing failed in round {}", round), &proc_res); } @@ -230,18 +230,18 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) { let s = File::open(&filepath).read_to_end().unwrap(); String::from_utf8(s).unwrap() } - None => { srcs[srcs.len() - 2u].clone() } + None => { srcs[srcs.len() - 2].clone() } }; - let mut actual = srcs[srcs.len() - 1u].clone(); + let mut actual = srcs[srcs.len() - 1].clone(); if props.pp_exact.is_some() { // Now we have to care about line endings let cr = "\r".to_string(); - actual = actual.replace(cr.as_slice(), "").to_string(); - expected = expected.replace(cr.as_slice(), "").to_string(); + actual = actual.replace(&cr, "").to_string(); + expected = expected.replace(&cr, "").to_string(); } - compare_source(expected.as_slice(), actual.as_slice()); + compare_source(&expected, &actual); // If we're only making sure that the output matches then just stop here if props.pretty_compare_only { return; } @@ -282,7 +282,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) { testfile, pretty_type.to_string()), props.exec_env.clone(), - config.compile_lib_path.as_slice(), + &config.compile_lib_path, Some(aux_dir.as_str().unwrap()), Some(src)) } @@ -294,6 +294,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) { let aux_dir = aux_output_dir_name(config, testfile); // FIXME (#9639): This needs to handle non-utf8 paths let mut args = vec!("-".to_string(), + "-Zunstable-options".to_string(), "--pretty".to_string(), pretty_type, format!("--target={}", config.target), @@ -334,13 +335,13 @@ actual:\n\ fn make_typecheck_args(config: &Config, props: &TestProps, testfile: &Path) -> ProcArgs { let aux_dir = aux_output_dir_name(config, testfile); let target = if props.force_host { - config.host.as_slice() + &*config.host } else { - config.target.as_slice() + &*config.target }; // FIXME (#9639): This needs to handle non-utf8 paths let mut args = vec!("-".to_string(), - "--no-trans".to_string(), + "-Zno-trans".to_string(), "--crate-type=lib".to_string(), format!("--target={}", target), "-L".to_string(), @@ -381,27 +382,36 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { let exe_file = make_exe_name(config, testfile); let debugger_run_result; - match config.target.as_slice() { - "arm-linux-androideabi" => { + match &*config.target { + "arm-linux-androideabi" | "aarch64-linux-android" => { - cmds = cmds.replace("run", "continue").to_string(); + cmds = cmds.replace("run", "continue"); // write debugger script - let script_str = ["set charset UTF-8".to_string(), - format!("file {}", exe_file.as_str().unwrap() - .to_string()), - "target remote :5039".to_string(), - cmds, - "quit".to_string()].connect("\n"); + let mut script_str = String::with_capacity(2048); + script_str.push_str("set charset UTF-8\n"); + script_str.push_str(&format!("file {}\n", exe_file.as_str().unwrap())); + script_str.push_str("target remote :5039\n"); + script_str.push_str(&format!("set solib-search-path \ + ./{}/stage2/lib/rustlib/{}/lib/\n", + config.host, config.target)); + for line in breakpoint_lines.iter() { + script_str.push_str(&format!("break {:?}:{}\n", + testfile.filename_display(), + *line)[]); + } + script_str.push_str(&cmds); + script_str.push_str("quit\n"); + debug!("script_str = {}", script_str); dump_output_file(config, testfile, - script_str.as_slice(), + &script_str, "debugger.script"); procsrv::run("", - config.adb_path.as_slice(), + &config.adb_path, None, &[ "push".to_string(), @@ -410,10 +420,10 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { ], vec!(("".to_string(), "".to_string())), Some("".to_string())) - .expect(format!("failed to exec `{:?}`", config.adb_path).as_slice()); + .expect(&format!("failed to exec `{:?}`", config.adb_path)); procsrv::run("", - config.adb_path.as_slice(), + &config.adb_path, None, &[ "forward".to_string(), @@ -422,19 +432,21 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { ], vec!(("".to_string(), "".to_string())), Some("".to_string())) - .expect(format!("failed to exec `{:?}`", config.adb_path).as_slice()); + .expect(&format!("failed to exec `{:?}`", config.adb_path)); let adb_arg = format!("export LD_LIBRARY_PATH={}; \ - gdbserver :5039 {}/{}", + gdbserver{} :5039 {}/{}", config.adb_test_dir.clone(), + if config.target.contains("aarch64") + {"64"} else {""}, config.adb_test_dir.clone(), str::from_utf8( exe_file.filename() .unwrap()).unwrap()); let mut process = procsrv::run_background("", - config.adb_path - .as_slice(), + &config.adb_path + , None, &[ "shell".to_string(), @@ -443,11 +455,11 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { vec!(("".to_string(), "".to_string())), Some("".to_string())) - .expect(format!("failed to exec `{:?}`", config.adb_path).as_slice()); + .expect(&format!("failed to exec `{:?}`", config.adb_path)); loop { //waiting 1 second for gdbserver start timer::sleep(Duration::milliseconds(1000)); - let result = Thread::scoped(move || { + let result = thread::spawn(move || { tcp::TcpStream::connect("127.0.0.1:5039").unwrap(); }).join(); if result.is_err() { @@ -470,22 +482,22 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { format!("-command={}", debugger_script.as_str().unwrap())); let mut gdb_path = tool_path; - gdb_path.push_str("/bin/arm-linux-androideabi-gdb"); + gdb_path.push_str(&format!("/bin/{}-gdb", config.target)); let procsrv::Result { out, err, status } = procsrv::run("", - gdb_path.as_slice(), + &gdb_path, None, - debugger_opts.as_slice(), + &debugger_opts, vec!(("".to_string(), "".to_string())), None) - .expect(format!("failed to exec `{:?}`", gdb_path).as_slice()); + .expect(&format!("failed to exec `{:?}`", gdb_path)); let cmdline = { let cmdline = make_cmdline("", - "arm-linux-androideabi-gdb", - debugger_opts.as_slice()); + &format!("{}-gdb", config.target), + &debugger_opts); logv(config, format!("executing {}", cmdline)); cmdline }; @@ -496,7 +508,9 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { stderr: err, cmdline: cmdline }; - process.signal_kill().unwrap(); + if process.signal_kill().is_err() { + println!("Adb process is already finished."); + } } _=> { @@ -516,16 +530,16 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { match config.gdb_version { Some(ref version) => { println!("NOTE: compiletest thinks it is using GDB version {}", - version.as_slice()); + version); - if header::gdb_version_to_int(version.as_slice()) > + if header::gdb_version_to_int(version) > header::gdb_version_to_int("7.4") { // Add the directory containing the pretty printers to // GDB's script auto loading safe path script_str.push_str( - format!("add-auto-load-safe-path {}\n", - rust_pp_module_abs_path.replace("\\", "\\\\").as_slice()) - .as_slice()); + &format!("add-auto-load-safe-path {}\n", + rust_pp_module_abs_path.replace("\\", "\\\\")) + ); } } _ => { @@ -546,19 +560,19 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { exe_file.as_str().unwrap().replace("\\", "\\\\"))[]); // Add line breakpoints - for line in breakpoint_lines.iter() { - script_str.push_str(&format!("break '{:?}':{}\n", + for line in &breakpoint_lines { + script_str.push_str(&format!("break '{}':{}\n", testfile.filename_display(), *line)[]); } - script_str.push_str(cmds.as_slice()); + script_str.push_str(&cmds); script_str.push_str("quit\n"); debug!("script_str = {}", script_str); dump_output_file(config, testfile, - script_str.as_slice(), + &script_str, "debugger.script"); // run debugger script with gdb @@ -591,7 +605,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { testfile, proc_args, environment, - config.run_lib_path.as_slice(), + &config.run_lib_path, None, None); } @@ -601,7 +615,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { fatal("gdb failed to execute"); } - check_debugger_output(&debugger_run_result, check_lines.as_slice()); + check_debugger_output(&debugger_run_result, &check_lines); } fn find_rust_src_root(config: &Config) -> Option { @@ -618,7 +632,7 @@ fn find_rust_src_root(config: &Config) -> Option { } fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path) { - use std::io::process::{Command, ProcessOutput}; + use std::old_io::process::{Command, ProcessOutput}; if config.lldb_python_dir.is_none() { fatal("Can't run LLDB test because LLDB's python path is not set."); @@ -643,7 +657,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path) match config.lldb_version { Some(ref version) => { println!("NOTE: compiletest thinks it is using LLDB version {}", - version.as_slice()); + version); } _ => { println!("NOTE: compiletest does not know which version of \ @@ -675,21 +689,20 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path) .unwrap() .to_string(); - script_str.push_str(&format!("command script import {}\n", &rust_pp_module_abs_path[])[]); + script_str.push_str(&format!("command script import {}\n", &rust_pp_module_abs_path[..])[]); script_str.push_str("type summary add --no-value "); script_str.push_str("--python-function lldb_rust_formatters.print_val "); script_str.push_str("-x \".*\" --category Rust\n"); script_str.push_str("type category enable Rust\n"); // Set breakpoints on every line that contains the string "#break" - for line in breakpoint_lines.iter() { - script_str.push_str(format!("breakpoint set --line {}\n", - line).as_slice()); + for line in &breakpoint_lines { + script_str.push_str(&format!("breakpoint set --line {}\n", line)); } // Append the other commands - for line in commands.iter() { - script_str.push_str(line.as_slice()); + for line in &commands { + script_str.push_str(line); script_str.push_str("\n"); } @@ -700,7 +713,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path) debug!("script_str = {}", script_str); dump_output_file(config, testfile, - script_str.as_slice(), + &script_str, "debugger.script"); let debugger_script = make_out_name(config, testfile, "debugger.script"); @@ -714,7 +727,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path) fatal_proc_rec("Error while running LLDB", &debugger_run_result); } - check_debugger_output(&debugger_run_result, check_lines.as_slice()); + check_debugger_output(&debugger_run_result, &check_lines); fn run_lldb(config: &Config, test_executable: &Path, @@ -728,7 +741,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path) cmd.arg(lldb_script_path) .arg(test_executable) .arg(debugger_script) - .env_set_all(&[("PYTHONPATH", config.lldb_python_dir.clone().unwrap().as_slice())]); + .env_set_all(&[("PYTHONPATH", config.lldb_python_dir.clone().unwrap())]); let (status, out, err) = match cmd.spawn() { Ok(process) => { @@ -740,17 +753,17 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path) String::from_utf8(error).unwrap()) }, Err(e) => { - fatal(format!("Failed to setup Python process for \ - LLDB script: {}", e).as_slice()) + fatal(&format!("Failed to setup Python process for \ + LLDB script: {}", e)) } }; - dump_output(config, test_executable, out.as_slice(), err.as_slice()); + dump_output(config, test_executable, &out, &err); return ProcRes { status: status, stdout: out, stderr: err, - cmdline: format!("{}", cmd) + cmdline: format!("{:?}", cmd) }; } } @@ -763,7 +776,7 @@ struct DebuggerCommands { fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str) -> DebuggerCommands { - use std::io::{BufferedReader, File}; + use std::old_io::{BufferedReader, File}; let command_directive = format!("{}-command", debugger_prefix); let check_directive = format!("{}-check", debugger_prefix); @@ -776,25 +789,24 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str) for line in reader.lines() { match line { Ok(line) => { - if line.as_slice().contains("#break") { + if line.contains("#break") { breakpoint_lines.push(counter); } header::parse_name_value_directive( - line.as_slice(), - command_directive.as_slice()).map(|cmd| { + &line, + &command_directive).map(|cmd| { commands.push(cmd) }); header::parse_name_value_directive( - line.as_slice(), - check_directive.as_slice()).map(|cmd| { + &line, + &check_directive).map(|cmd| { check_lines.push(cmd) }); } Err(e) => { - fatal(format!("Error while parsing debugger commands: {}", - e).as_slice()) + fatal(&format!("Error while parsing debugger commands: {}", e)) } } counter += 1; @@ -833,7 +845,7 @@ fn check_debugger_output(debugger_run_result: &ProcRes, check_lines: &[String]) // bits in the wrong case of an enum) with the notation "[...]". let check_fragments: Vec> = check_lines.iter().map(|s| { - s.as_slice() + s .trim() .split_str("[...]") .map(|x| x.to_string()) @@ -841,20 +853,20 @@ fn check_debugger_output(debugger_run_result: &ProcRes, check_lines: &[String]) }).collect(); // check if each line in props.check_lines appears in the // output (in order) - let mut i = 0u; - for line in debugger_run_result.stdout.as_slice().lines() { + let mut i = 0; + for line in debugger_run_result.stdout.lines() { let mut rest = line.trim(); let mut first = true; let mut failed = false; - for frag in check_fragments[i].iter() { + for frag in &check_fragments[i] { let found = if first { - if rest.starts_with(frag.as_slice()) { + if rest.starts_with(frag) { Some(0) } else { None } } else { - rest.find_str(frag.as_slice()) + rest.find_str(frag) }; match found { None => { @@ -862,13 +874,13 @@ fn check_debugger_output(debugger_run_result: &ProcRes, check_lines: &[String]) break; } Some(i) => { - rest = rest.slice_from(i + frag.len()); + rest = &rest[(i + frag.len())..]; } } first = false; } if !failed && rest.len() == 0 { - i += 1u; + i += 1; } if i == num_check_lines { // all lines checked @@ -876,8 +888,8 @@ fn check_debugger_output(debugger_run_result: &ProcRes, check_lines: &[String]) } } if i != num_check_lines { - fatal_proc_rec(format!("line not found in debugger output: {}", - check_lines.get(i).unwrap()).as_slice(), + fatal_proc_rec(&format!("line not found in debugger output: {}", + check_lines.get(i).unwrap()), debugger_run_result); } } @@ -888,16 +900,15 @@ fn check_error_patterns(props: &TestProps, output_to_check: &str, proc_res: &ProcRes) { if props.error_patterns.is_empty() { - fatal(format!("no error pattern specified in {:?}", - testfile.display()).as_slice()); + fatal(&format!("no error pattern specified in {:?}", testfile.display())); } - let mut next_err_idx = 0u; + let mut next_err_idx = 0; let mut next_err_pat = &props.error_patterns[next_err_idx]; let mut done = false; - for line in output_to_check.as_slice().lines() { - if line.contains(next_err_pat.as_slice()) { + for line in output_to_check.lines() { + if line.contains(next_err_pat) { debug!("found error pattern {}", next_err_pat); - next_err_idx += 1u; + next_err_idx += 1; if next_err_idx == props.error_patterns.len() { debug!("found all error patterns"); done = true; @@ -909,21 +920,19 @@ fn check_error_patterns(props: &TestProps, if done { return; } let missing_patterns = &props.error_patterns[next_err_idx..]; - if missing_patterns.len() == 1u { - fatal_proc_rec(format!("error pattern '{}' not found!", - missing_patterns[0]).as_slice(), + if missing_patterns.len() == 1 { + fatal_proc_rec(&format!("error pattern '{}' not found!", missing_patterns[0]), proc_res); } else { - for pattern in missing_patterns.iter() { - error(format!("error pattern '{}' not found!", - *pattern).as_slice()); + for pattern in missing_patterns { + error(&format!("error pattern '{}' not found!", *pattern)); } fatal_proc_rec("multiple error patterns not found", proc_res); } } fn check_no_compiler_crash(proc_res: &ProcRes) { - for line in proc_res.stderr.as_slice().lines() { + for line in proc_res.stderr.lines() { if line.starts_with("error: internal compiler error:") { fatal_proc_rec("compiler encountered internal error", proc_res); @@ -934,15 +943,14 @@ fn check_no_compiler_crash(proc_res: &ProcRes) { fn check_forbid_output(props: &TestProps, output_to_check: &str, proc_res: &ProcRes) { - for pat in props.forbid_output.iter() { - if output_to_check.contains(pat.as_slice()) { + for pat in &props.forbid_output { + if output_to_check.contains(pat) { fatal_proc_rec("forbidden pattern found in compiler output", proc_res); } } } -fn check_expected_errors(props: &TestProps, - expected_errors: Vec , +fn check_expected_errors(expected_errors: Vec , testfile: &Path, proc_res: &ProcRes) { @@ -954,12 +962,12 @@ fn check_expected_errors(props: &TestProps, } let prefixes = expected_errors.iter().map(|ee| { - format!("{:?}:{}:", testfile.display(), ee.line) + format!("{}:{}:", testfile.display(), ee.line) }).collect:: >(); #[cfg(windows)] fn prefix_matches( line : &str, prefix : &str ) -> bool { - line.to_ascii_lowercase().starts_with(prefix.to_ascii_lowercase().as_slice()) + line.to_ascii_lowercase().starts_with(&prefix.to_ascii_lowercase()) } #[cfg(unix)] @@ -967,24 +975,34 @@ fn check_expected_errors(props: &TestProps, line.starts_with( prefix ) } + // A multi-line error will have followup lines which will always + // start with one of these strings. + fn continuation( line: &str) -> bool { + line.starts_with(" expected") || + line.starts_with(" found") || + // 1234 + // Should have 4 spaces: see issue 18946 + line.starts_with("(") + } + // Scan and extract our error/warning messages, // which look like: // filename:line1:col1: line2:col2: *error:* msg // filename:line1:col1: line2:col2: *warning:* msg // where line1:col1: is the starting point, line2:col2: // is the ending point, and * represents ANSI color codes. - for line in proc_res.stderr.as_slice().lines() { + for line in proc_res.stderr.lines() { let mut was_expected = false; for (i, ee) in expected_errors.iter().enumerate() { if !found_flags[i] { debug!("prefix={} ee.kind={} ee.msg={} line={}", - prefixes[i].as_slice(), + prefixes[i], ee.kind, ee.msg, line); - if prefix_matches(line, prefixes[i].as_slice()) && - line.contains(ee.kind.as_slice()) && - line.contains(ee.msg.as_slice()) { + if (prefix_matches(line, &prefixes[i]) || continuation(line)) && + line.contains(&ee.kind) && + line.contains(&ee.msg) { found_flags[i] = true; was_expected = true; break; @@ -997,14 +1015,9 @@ fn check_expected_errors(props: &TestProps, was_expected = true; } - if line.starts_with("") && - props.ignore_command_line { - was_expected = true; - } - if !was_expected && is_compiler_error_or_warning(line) { - fatal_proc_rec(format!("unexpected compiler error or warning: '{}'", - line).as_slice(), + fatal_proc_rec(&format!("unexpected compiler error or warning: '{}'", + line), proc_res); } } @@ -1012,15 +1025,15 @@ fn check_expected_errors(props: &TestProps, for (i, &flag) in found_flags.iter().enumerate() { if !flag { let ee = &expected_errors[i]; - fatal_proc_rec(format!("expected {} on line {} not found: {}", - ee.kind, ee.line, ee.msg).as_slice(), + fatal_proc_rec(&format!("expected {} on line {} not found: {}", + ee.kind, ee.line, ee.msg), proc_res); } } } fn is_compiler_error_or_warning(line: &str) -> bool { - let mut i = 0u; + let mut i = 0; return scan_until_char(line, ':', &mut i) && scan_char(line, ':', &mut i) && @@ -1041,7 +1054,7 @@ fn scan_until_char(haystack: &str, needle: char, idx: &mut uint) -> bool { if *idx >= haystack.len() { return false; } - let opt = haystack.slice_from(*idx).find(needle); + let opt = haystack[(*idx)..].find(needle); if opt.is_none() { return false; } @@ -1079,7 +1092,7 @@ fn scan_integer(haystack: &str, idx: &mut uint) -> bool { fn scan_string(haystack: &str, needle: &str, idx: &mut uint) -> bool { let mut haystack_i = *idx; - let mut needle_i = 0u; + let mut needle_i = 0; while needle_i < needle.len() { if haystack_i >= haystack.len() { return false; @@ -1121,7 +1134,7 @@ fn compile_test_(config: &Config, props: &TestProps, // FIXME (#9639): This needs to handle non-utf8 paths let mut link_args = vec!("-L".to_string(), aux_dir.as_str().unwrap().to_string()); - link_args.extend(extra_args.iter().map(|s| s.clone())); + link_args.extend(extra_args.iter().cloned()); let args = make_compile_args(config, props, link_args, @@ -1134,9 +1147,9 @@ fn exec_compiled_test(config: &Config, props: &TestProps, let env = props.exec_env.clone(); - match config.target.as_slice() { + match &*config.target { - "arm-linux-androideabi" => { + "arm-linux-androideabi" | "aarch64-linux-android" => { _arm_exec_compiled_test(config, props, testfile, env) } @@ -1146,7 +1159,7 @@ fn exec_compiled_test(config: &Config, props: &TestProps, testfile, make_run_args(config, props, testfile), env, - config.run_lib_path.as_slice(), + &config.run_lib_path, Some(aux_dir.as_str().unwrap()), None) } @@ -1168,8 +1181,8 @@ fn compose_and_run_compiler( // FIXME (#9639): This needs to handle non-utf8 paths let extra_link_args = vec!("-L".to_string(), aux_dir.as_str().unwrap().to_string()); - for rel_ab in props.aux_builds.iter() { - let abs_ab = config.aux_base.join(rel_ab.as_slice()); + for rel_ab in &props.aux_builds { + let abs_ab = config.aux_base.join(rel_ab); let aux_props = header::load_props(&abs_ab); let mut crate_type = if aux_props.no_prefer_dynamic { Vec::new() @@ -1190,18 +1203,18 @@ fn compose_and_run_compiler( &abs_ab, aux_args, Vec::new(), - config.compile_lib_path.as_slice(), + &config.compile_lib_path, Some(aux_dir.as_str().unwrap()), None); if !auxres.status.success() { fatal_proc_rec( - format!("auxiliary build of {:?} failed to compile: ", - abs_ab.display()).as_slice(), + &format!("auxiliary build of {:?} failed to compile: ", + abs_ab.display()), &auxres); } - match config.target.as_slice() { - "arm-linux-androideabi" => { + match &*config.target { + "arm-linux-androideabi" | "aarch64-linux-android" => { _arm_push_aux_shared_library(config, testfile); } _ => {} @@ -1212,14 +1225,14 @@ fn compose_and_run_compiler( testfile, args, Vec::new(), - config.compile_lib_path.as_slice(), + &config.compile_lib_path, Some(aux_dir.as_str().unwrap()), input) } fn ensure_dir(path: &Path) { if path.is_dir() { return; } - fs::mkdir(path, io::USER_RWX).unwrap(); + fs::mkdir(path, old_io::USER_RWX).unwrap(); } fn compose_and_run(config: &Config, testfile: &Path, @@ -1247,16 +1260,16 @@ fn make_compile_args(config: &Config, { let xform_file = xform(config, testfile); let target = if props.force_host { - config.host.as_slice() + &*config.host } else { - config.target.as_slice() + &*config.target }; // FIXME (#9639): This needs to handle non-utf8 paths let mut args = vec!(testfile.as_str().unwrap().to_string(), "-L".to_string(), config.build_base.as_str().unwrap().to_string(), format!("--target={}", target)); - args.push_all(extras.as_slice()); + args.push_all(&extras); if !props.no_prefer_dynamic { args.push("-C".to_string()); args.push("prefer-dynamic".to_string()); @@ -1293,9 +1306,9 @@ fn make_lib_name(config: &Config, auxfile: &Path, testfile: &Path) -> Path { fn make_exe_name(config: &Config, testfile: &Path) -> Path { let mut f = output_base_name(config, testfile); - if !os::consts::EXE_SUFFIX.is_empty() { + if !env::consts::EXE_SUFFIX.is_empty() { let mut fname = f.filename().unwrap().to_vec(); - fname.extend(os::consts::EXE_SUFFIX.bytes()); + fname.extend(env::consts::EXE_SUFFIX.bytes()); f.set_filename(fname); } f @@ -1324,7 +1337,7 @@ fn make_run_args(config: &Config, props: &TestProps, testfile: &Path) -> fn split_maybe_args(argstr: &Option) -> Vec { match *argstr { Some(ref s) => { - s.as_slice() + s .split(' ') .filter_map(|s| { if s.chars().all(|c| c.is_whitespace()) { @@ -1345,8 +1358,8 @@ fn program_output(config: &Config, testfile: &Path, lib_path: &str, prog: String let cmdline = { let cmdline = make_cmdline(lib_path, - prog.as_slice(), - args.as_slice()); + &prog, + &args); logv(config, format!("executing {}", cmdline)); cmdline }; @@ -1355,12 +1368,12 @@ fn program_output(config: &Config, testfile: &Path, lib_path: &str, prog: String err, status } = procsrv::run(lib_path, - prog.as_slice(), + &prog, aux_path, - args.as_slice(), + &args, env, - input).expect(format!("failed to exec `{}`", prog).as_slice()); - dump_output(config, testfile, out.as_slice(), err.as_slice()); + input).expect(&format!("failed to exec `{}`", prog)); + dump_output(config, testfile, &out, &err); return ProcRes { status: status, stdout: out, @@ -1396,7 +1409,7 @@ fn dump_output(config: &Config, testfile: &Path, out: &str, err: &str) { fn dump_output_file(config: &Config, testfile: &Path, out: &str, extension: &str) { let outfile = make_out_name(config, testfile, extension); - File::create(&outfile).write(out.as_bytes()).unwrap(); + File::create(&outfile).write_all(out.as_bytes()).unwrap(); } fn make_out_name(config: &Config, testfile: &Path, extension: &str) -> Path { @@ -1417,7 +1430,7 @@ fn output_testname(testfile: &Path) -> Path { fn output_base_name(config: &Config, testfile: &Path) -> Path { config.build_base .join(&output_testname(testfile)) - .with_extension(config.stage_id.as_slice()) + .with_extension(&config.stage_id) } fn maybe_dump_to_stdout(config: &Config, out: &str, err: &str) { @@ -1460,12 +1473,11 @@ fn _arm_exec_compiled_test(config: &Config, -> ProcRes { let args = make_run_args(config, props, testfile); let cmdline = make_cmdline("", - args.prog.as_slice(), - args.args.as_slice()); + &args.prog, + &args.args); // get bare program string let mut tvec: Vec = args.prog - .as_slice() .split('/') .map(|ts| ts.to_string()) .collect(); @@ -1473,7 +1485,7 @@ fn _arm_exec_compiled_test(config: &Config, // copy to target let copy_result = procsrv::run("", - config.adb_path.as_slice(), + &config.adb_path, None, &[ "push".to_string(), @@ -1482,7 +1494,7 @@ fn _arm_exec_compiled_test(config: &Config, ], vec!(("".to_string(), "".to_string())), Some("".to_string())) - .expect(format!("failed to exec `{}`", config.adb_path).as_slice()); + .expect(&format!("failed to exec `{}`", config.adb_path)); if config.verbose { println!("push ({}) {} {} {}", @@ -1498,22 +1510,22 @@ fn _arm_exec_compiled_test(config: &Config, // run test via adb_run_wrapper runargs.push("shell".to_string()); - for (key, val) in env.into_iter() { + for (key, val) in env { runargs.push(format!("{}={}", key, val)); } - runargs.push(format!("{}/adb_run_wrapper.sh", config.adb_test_dir)); + runargs.push(format!("{}/../adb_run_wrapper.sh", config.adb_test_dir)); runargs.push(format!("{}", config.adb_test_dir)); runargs.push(format!("{}", prog_short)); - for tv in args.args.iter() { + for tv in &args.args { runargs.push(tv.to_string()); } procsrv::run("", - config.adb_path.as_slice(), + &config.adb_path, None, - runargs.as_slice(), + &runargs, vec!(("".to_string(), "".to_string())), Some("".to_string())) - .expect(format!("failed to exec `{}`", config.adb_path).as_slice()); + .expect(&format!("failed to exec `{}`", config.adb_path)); // get exitcode of result runargs = Vec::new(); @@ -1523,15 +1535,15 @@ fn _arm_exec_compiled_test(config: &Config, let procsrv::Result{ out: exitcode_out, err: _, status: _ } = procsrv::run("", - config.adb_path.as_slice(), + &config.adb_path, None, - runargs.as_slice(), + &runargs, vec!(("".to_string(), "".to_string())), Some("".to_string())) - .expect(format!("failed to exec `{}`", config.adb_path).as_slice()); + .expect(&format!("failed to exec `{}`", config.adb_path)); let mut exitcode: int = 0; - for c in exitcode_out.as_slice().chars() { + for c in exitcode_out.chars() { if !c.is_numeric() { break; } exitcode = exitcode * 10 + match c { '0' ... '9' => c as int - ('0' as int), @@ -1547,12 +1559,12 @@ fn _arm_exec_compiled_test(config: &Config, let procsrv::Result{ out: stdout_out, err: _, status: _ } = procsrv::run("", - config.adb_path.as_slice(), + &config.adb_path, None, - runargs.as_slice(), + &runargs, vec!(("".to_string(), "".to_string())), Some("".to_string())) - .expect(format!("failed to exec `{}`", config.adb_path).as_slice()); + .expect(&format!("failed to exec `{}`", config.adb_path)); // get stderr of result runargs = Vec::new(); @@ -1562,17 +1574,17 @@ fn _arm_exec_compiled_test(config: &Config, let procsrv::Result{ out: stderr_out, err: _, status: _ } = procsrv::run("", - config.adb_path.as_slice(), + &config.adb_path, None, - runargs.as_slice(), + &runargs, vec!(("".to_string(), "".to_string())), Some("".to_string())) - .expect(format!("failed to exec `{}`", config.adb_path).as_slice()); + .expect(&format!("failed to exec `{}`", config.adb_path)); dump_output(config, testfile, - stdout_out.as_slice(), - stderr_out.as_slice()); + &stdout_out, + &stderr_out); ProcRes { status: process::ProcessExit::ExitStatus(exitcode), @@ -1586,23 +1598,23 @@ fn _arm_push_aux_shared_library(config: &Config, testfile: &Path) { let tdir = aux_output_dir_name(config, testfile); let dirs = fs::readdir(&tdir).unwrap(); - for file in dirs.iter() { + for file in &dirs { if file.extension_str() == Some("so") { // FIXME (#9639): This needs to handle non-utf8 paths let copy_result = procsrv::run("", - config.adb_path.as_slice(), + &config.adb_path, None, &[ "push".to_string(), file.as_str() .unwrap() .to_string(), - config.adb_test_dir.to_string() + config.adb_test_dir.to_string(), ], vec!(("".to_string(), "".to_string())), Some("".to_string())) - .expect(format!("failed to exec `{}`", config.adb_path).as_slice()); + .expect(&format!("failed to exec `{}`", config.adb_path)); if config.verbose { println!("push ({}) {:?} {} {}", @@ -1697,7 +1709,7 @@ fn disassemble_extract(config: &Config, _props: &TestProps, fn count_extracted_lines(p: &Path) -> uint { let x = File::open(&p.with_extension("ll")).read_to_end().unwrap(); - let x = str::from_utf8(x.as_slice()).unwrap(); + let x = str::from_utf8(&x).unwrap(); x.lines().count() } diff --git a/src/compiletest/util.rs b/src/compiletest/util.rs index a116cc3369..c046a89cba 100644 --- a/src/compiletest/util.rs +++ b/src/compiletest/util.rs @@ -1,4 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -11,7 +11,7 @@ use common::Config; #[cfg(target_os = "windows")] -use std::os::getenv; +use std::env; /// Conversion table from triple OS name to Rust SYSNAME static OS_TABLE: &'static [(&'static str, &'static str)] = &[ @@ -23,10 +23,11 @@ static OS_TABLE: &'static [(&'static str, &'static str)] = &[ ("linux", "linux"), ("freebsd", "freebsd"), ("dragonfly", "dragonfly"), + ("openbsd", "openbsd"), ]; pub fn get_os(triple: &str) -> &'static str { - for &(triple_os, os) in OS_TABLE.iter() { + for &(triple_os, os) in OS_TABLE { if triple.contains(triple_os) { return os } @@ -39,11 +40,11 @@ pub fn make_new_path(path: &str) -> String { // Windows just uses PATH as the library search path, so we have to // maintain the current value while adding our own - match getenv(lib_path_env_var()) { - Some(curr) => { + match env::var(lib_path_env_var()) { + Ok(curr) => { format!("{}{}{}", path, path_div(), curr) } - None => path.to_string() + Err(..) => path.to_string() } } diff --git a/src/doc/complement-bugreport.md b/src/doc/complement-bugreport.md deleted file mode 100644 index 848c56ee54..0000000000 --- a/src/doc/complement-bugreport.md +++ /dev/null @@ -1,63 +0,0 @@ -% How to submit a Rust bug report - -# I think I found a bug in the compiler! - -If you see this message: `error: internal compiler error: unexpected panic`, -then you have definitely found a bug in the compiler. It's also possible that -your code is not well-typed, but if you saw this message, it's still a bug in -error reporting. - -If you see a message about an LLVM assertion failure, then you have also -definitely found a bug in the compiler. In both of these cases, it's not your -fault and you should report a bug! - -If you see a compiler error message that you think is meant for users to see, -but it confuses you, *that's a bug too*. If it wasn't clear to you, then it's -an error message we want to improve, so please report it so that we can try -to make it better. - -# How do I know the bug I found isn't a bug that already exists in the issue tracker? - -If you don't have enough time for a search, then don't worry about that. Just submit -the bug. If it's a duplicate, somebody will notice that and close it during triage. - -If you have the time for it, it would be useful to type the text of the error -message you got [into the issue tracker search box](https://github.com/rust-lang/rust/issues) -to see if there's an existing bug that resembles your problem. If there is, -and it's an open bug, you can comment on that issue and say you are also affected. -This will encourage the devs to fix it. But again, don't let this stop you from -submitting a bug. We'd rather have to do the work of closing duplicates than -miss out on valid bug reports. - -# What information should I include in a bug report? - -It generally helps our diagnosis to include your specific OS (for example: Mac OS X 10.8.3, -Windows 7, Ubuntu 12.04) and your hardware architecture (for example: i686, x86_64). -It's also helpful to provide the exact version and host by copying the output of -re-running the erroneous rustc command with the `--version --verbose` flags, which will -produce something like this: - -```text -rustc 0.12.0 (ba4081a5a 2014-10-07 13:44:41 -0700) -binary: rustc -commit-hash: ba4081a5a8573875fed17545846f6f6902c8ba8d -commit-date: 2014-10-07 13:44:41 -0700 -host: i686-apple-darwin -release: 0.12.0 -``` - -Finally, if you can also provide a backtrace, that'd be great. You can get a -backtrace by setting the `RUST_BACKTRACE` environment variable to `1`, like -this: - -```bash -$ RUST_BACKTRACE=1 rustc ... -``` - -# I submitted a bug, but nobody has commented on it! - -This is sad, but does happen sometimes, since we're short-staffed. If you -submit a bug and you haven't received a comment on it within 3 business days, -it's entirely reasonable to either ask on the #rust IRC channel, -or post on the [rust-dev mailing list](https://mail.mozilla.org/listinfo/rust-dev) -to ask what the status of the bug is. diff --git a/src/doc/complement-lang-faq.md b/src/doc/complement-lang-faq.md index a9a9e0858e..8238dd3a5b 100644 --- a/src/doc/complement-lang-faq.md +++ b/src/doc/complement-lang-faq.md @@ -10,7 +10,7 @@ There aren't many large programs yet. The Rust [compiler][rustc], 60,000+ lines A research browser engine called [Servo][servo], currently 30,000+ lines across more than a dozen crates, will be exercising a lot of Rust's distinctive type-system and concurrency features, and integrating many native libraries. -[servo]: https://github.com/mozilla/servo +[servo]: https://github.com/servo/servo Some examples that demonstrate different aspects of the language: diff --git a/src/doc/complement-project-faq.md b/src/doc/complement-project-faq.md index 1b463d7769..bb1805d694 100644 --- a/src/doc/complement-project-faq.md +++ b/src/doc/complement-project-faq.md @@ -30,7 +30,7 @@ No. It started as a Graydon Hoare's part-time side project in 2006 and remained # What will Mozilla use Rust for? -Mozilla intends to use Rust as a platform for prototyping experimental browser architectures. Specifically, the hope is to develop a browser that is more amenable to parallelization than existing ones, while also being less prone to common C++ coding errors that result in security exploits. The name of that project is _[Servo](http://github.com/mozilla/servo)_. +Mozilla intends to use Rust as a platform for prototyping experimental browser architectures. Specifically, the hope is to develop a browser that is more amenable to parallelization than existing ones, while also being less prone to common C++ coding errors that result in security exploits. The name of that project is _[Servo](http://github.com/servo/servo)_. # Why a BSD-style permissive license rather than MPL or tri-license? diff --git a/src/doc/grammar.md b/src/doc/grammar.md new file mode 100644 index 0000000000..d7a29ea530 --- /dev/null +++ b/src/doc/grammar.md @@ -0,0 +1,774 @@ +% Grammar + +# Introduction + +This document is the primary reference for the Rust programming language grammar. It +provides only one kind of material: + + - Chapters that formally define the language grammar and, for each + construct. + +This document does not serve as an introduction to the language. Background +familiarity with the language is assumed. A separate [guide] is available to +help acquire such background familiarity. + +This document also does not serve as a reference to the [standard] library +included in the language distribution. Those libraries are documented +separately by extracting documentation attributes from their source code. Many +of the features that one might expect to be language features are library +features in Rust, so what you're looking for may be there, not here. + +[guide]: guide.html +[standard]: std/index.html + +# Notation + +Rust's grammar is defined over Unicode codepoints, each conventionally denoted +`U+XXXX`, for 4 or more hexadecimal digits `X`. _Most_ of Rust's grammar is +confined to the ASCII range of Unicode, and is described in this document by a +dialect of Extended Backus-Naur Form (EBNF), specifically a dialect of EBNF +supported by common automated LL(k) parsing tools such as `llgen`, rather than +the dialect given in ISO 14977. The dialect can be defined self-referentially +as follows: + +```antlr +grammar : rule + ; +rule : nonterminal ':' productionrule ';' ; +productionrule : production [ '|' production ] * ; +production : term * ; +term : element repeats ; +element : LITERAL | IDENTIFIER | '[' productionrule ']' ; +repeats : [ '*' | '+' ] NUMBER ? | NUMBER ? | '?' ; +``` + +Where: + +- Whitespace in the grammar is ignored. +- Square brackets are used to group rules. +- `LITERAL` is a single printable ASCII character, or an escaped hexadecimal + ASCII code of the form `\xQQ`, in single quotes, denoting the corresponding + Unicode codepoint `U+00QQ`. +- `IDENTIFIER` is a nonempty string of ASCII letters and underscores. +- The `repeat` forms apply to the adjacent `element`, and are as follows: + - `?` means zero or one repetition + - `*` means zero or more repetitions + - `+` means one or more repetitions + - NUMBER trailing a repeat symbol gives a maximum repetition count + - NUMBER on its own gives an exact repetition count + +This EBNF dialect should hopefully be familiar to many readers. + +## Unicode productions + +A few productions in Rust's grammar permit Unicode codepoints outside the ASCII +range. We define these productions in terms of character properties specified +in the Unicode standard, rather than in terms of ASCII-range codepoints. The +section [Special Unicode Productions](#special-unicode-productions) lists these +productions. + +## String table productions + +Some rules in the grammar — notably [unary +operators](#unary-operator-expressions), [binary +operators](#binary-operator-expressions), and [keywords](#keywords) — are +given in a simplified form: as a listing of a table of unquoted, printable +whitespace-separated strings. These cases form a subset of the rules regarding +the [token](#tokens) rule, and are assumed to be the result of a +lexical-analysis phase feeding the parser, driven by a DFA, operating over the +disjunction of all such string table entries. + +When such a string enclosed in double-quotes (`"`) occurs inside the grammar, +it is an implicit reference to a single member of such a string table +production. See [tokens](#tokens) for more information. + +# Lexical structure + +## Input format + +Rust input is interpreted as a sequence of Unicode codepoints encoded in UTF-8. +Most Rust grammar rules are defined in terms of printable ASCII-range +codepoints, but a small number are defined in terms of Unicode properties or +explicit codepoint lists. [^inputformat] + +[^inputformat]: Substitute definitions for the special Unicode productions are + provided to the grammar verifier, restricted to ASCII range, when verifying the + grammar in this document. + +## Special Unicode Productions + +The following productions in the Rust grammar are defined in terms of Unicode +properties: `ident`, `non_null`, `non_star`, `non_eol`, `non_slash_or_star`, +`non_single_quote` and `non_double_quote`. + +### Identifiers + +The `ident` production is any nonempty Unicode string of the following form: + +- The first character has property `XID_start` +- The remaining characters have property `XID_continue` + +that does _not_ occur in the set of [keywords](#keywords). + +> **Note**: `XID_start` and `XID_continue` as character properties cover the +> character ranges used to form the more familiar C and Java language-family +> identifiers. + +### Delimiter-restricted productions + +Some productions are defined by exclusion of particular Unicode characters: + +- `non_null` is any single Unicode character aside from `U+0000` (null) +- `non_eol` is `non_null` restricted to exclude `U+000A` (`'\n'`) +- `non_star` is `non_null` restricted to exclude `U+002A` (`*`) +- `non_slash_or_star` is `non_null` restricted to exclude `U+002F` (`/`) and `U+002A` (`*`) +- `non_single_quote` is `non_null` restricted to exclude `U+0027` (`'`) +- `non_double_quote` is `non_null` restricted to exclude `U+0022` (`"`) + +## Comments + +```antlr +comment : block_comment | line_comment ; +block_comment : "/*" block_comment_body * "*/" ; +block_comment_body : [block_comment | character] * ; +line_comment : "//" non_eol * ; +``` + +**FIXME:** add doc grammar? + +## Whitespace + +```antlr +whitespace_char : '\x20' | '\x09' | '\x0a' | '\x0d' ; +whitespace : [ whitespace_char | comment ] + ; +``` + +## Tokens + +```antlr +simple_token : keyword | unop | binop ; +token : simple_token | ident | literal | symbol | whitespace token ; +``` + +### Keywords + +

+ +| | | | | | +|----------|----------|----------|----------|--------| +| abstract | alignof | as | become | box | +| break | const | continue | crate | do | +| else | enum | extern | false | final | +| fn | for | if | impl | in | +| let | loop | match | mod | move | +| mut | offsetof | once | override | priv | +| proc | pub | pure | ref | return | +| sizeof | static | self | struct | super | +| true | trait | type | typeof | unsafe | +| unsized | use | virtual | where | while | +| yield | | | | | + + +Each of these keywords has special meaning in its grammar, and all of them are +excluded from the `ident` rule. + +### Literals + +```antlr +lit_suffix : ident; +literal : [ string_lit | char_lit | byte_string_lit | byte_lit | num_lit ] lit_suffix ?; +``` + +#### Character and string literals + +```antlr +char_lit : '\x27' char_body '\x27' ; +string_lit : '"' string_body * '"' | 'r' raw_string ; + +char_body : non_single_quote + | '\x5c' [ '\x27' | common_escape | unicode_escape ] ; + +string_body : non_double_quote + | '\x5c' [ '\x22' | common_escape | unicode_escape ] ; +raw_string : '"' raw_string_body '"' | '#' raw_string '#' ; + +common_escape : '\x5c' + | 'n' | 'r' | 't' | '0' + | 'x' hex_digit 2 +unicode_escape : 'u' '{' hex_digit+ 6 '}'; + +hex_digit : 'a' | 'b' | 'c' | 'd' | 'e' | 'f' + | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' + | dec_digit ; +oct_digit : '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' ; +dec_digit : '0' | nonzero_dec ; +nonzero_dec: '1' | '2' | '3' | '4' + | '5' | '6' | '7' | '8' | '9' ; +``` + +#### Byte and byte string literals + +```antlr +byte_lit : "b\x27" byte_body '\x27' ; +byte_string_lit : "b\x22" string_body * '\x22' | "br" raw_byte_string ; + +byte_body : ascii_non_single_quote + | '\x5c' [ '\x27' | common_escape ] ; + +byte_string_body : ascii_non_double_quote + | '\x5c' [ '\x22' | common_escape ] ; +raw_byte_string : '"' raw_byte_string_body '"' | '#' raw_byte_string '#' ; + +``` + +#### Number literals + +```antlr +num_lit : nonzero_dec [ dec_digit | '_' ] * float_suffix ? + | '0' [ [ dec_digit | '_' ] * float_suffix ? + | 'b' [ '1' | '0' | '_' ] + + | 'o' [ oct_digit | '_' ] + + | 'x' [ hex_digit | '_' ] + ] ; + +float_suffix : [ exponent | '.' dec_lit exponent ? ] ? ; + +exponent : ['E' | 'e'] ['-' | '+' ] ? dec_lit ; +dec_lit : [ dec_digit | '_' ] + ; +``` + +#### Boolean literals + +**FIXME:** write grammar + +The two values of the boolean type are written `true` and `false`. + +### Symbols + +```antlr +symbol : "::" "->" + | '#' | '[' | ']' | '(' | ')' | '{' | '}' + | ',' | ';' ; +``` + +Symbols are a general class of printable [token](#tokens) that play structural +roles in a variety of grammar productions. They are catalogued here for +completeness as the set of remaining miscellaneous printable tokens that do not +otherwise appear as [unary operators](#unary-operator-expressions), [binary +operators](#binary-operator-expressions), or [keywords](#keywords). + +## Paths + +```antlr +expr_path : [ "::" ] ident [ "::" expr_path_tail ] + ; +expr_path_tail : '<' type_expr [ ',' type_expr ] + '>' + | expr_path ; + +type_path : ident [ type_path_tail ] + ; +type_path_tail : '<' type_expr [ ',' type_expr ] + '>' + | "::" type_path ; +``` + +# Syntax extensions + +## Macros + +```antlr +expr_macro_rules : "macro_rules" '!' ident '(' macro_rule * ')' ; +macro_rule : '(' matcher * ')' "=>" '(' transcriber * ')' ';' ; +matcher : '(' matcher * ')' | '[' matcher * ']' + | '{' matcher * '}' | '$' ident ':' ident + | '$' '(' matcher * ')' sep_token? [ '*' | '+' ] + | non_special_token ; +transcriber : '(' transcriber * ')' | '[' transcriber * ']' + | '{' transcriber * '}' | '$' ident + | '$' '(' transcriber * ')' sep_token? [ '*' | '+' ] + | non_special_token ; +``` + +# Crates and source files + +**FIXME:** grammar? What production covers #![crate_id = "foo"] ? + +# Items and attributes + +**FIXME:** grammar? + +## Items + +```antlr +item : mod_item | fn_item | type_item | struct_item | enum_item + | static_item | trait_item | impl_item | extern_block ; +``` + +### Type Parameters + +**FIXME:** grammar? + +### Modules + +```antlr +mod_item : "mod" ident ( ';' | '{' mod '}' ); +mod : [ view_item | item ] * ; +``` + +#### View items + +```antlr +view_item : extern_crate_decl | use_decl ; +``` + +##### Extern crate declarations + +```antlr +extern_crate_decl : "extern" "crate" crate_name +crate_name: ident | ( string_lit as ident ) +``` + +##### Use declarations + +```antlr +use_decl : "pub" ? "use" [ path "as" ident + | path_glob ] ; + +path_glob : ident [ "::" [ path_glob + | '*' ] ] ? + | '{' path_item [ ',' path_item ] * '}' ; + +path_item : ident | "mod" ; +``` + +### Functions + +**FIXME:** grammar? + +#### Generic functions + +**FIXME:** grammar? + +#### Unsafety + +**FIXME:** grammar? + +##### Unsafe functions + +**FIXME:** grammar? + +##### Unsafe blocks + +**FIXME:** grammar? + +#### Diverging functions + +**FIXME:** grammar? + +### Type definitions + +**FIXME:** grammar? + +### Structures + +**FIXME:** grammar? + +### Constant items + +```antlr +const_item : "const" ident ':' type '=' expr ';' ; +``` + +### Static items + +```antlr +static_item : "static" ident ':' type '=' expr ';' ; +``` + +#### Mutable statics + +**FIXME:** grammar? + +### Traits + +**FIXME:** grammar? + +### Implementations + +**FIXME:** grammar? + +### External blocks + +```antlr +extern_block_item : "extern" '{' extern_block '}' ; +extern_block : [ foreign_fn ] * ; +``` + +## Visibility and Privacy + +**FIXME:** grammar? + +### Re-exporting and Visibility + +**FIXME:** grammar? + +## Attributes + +```antlr +attribute : "#!" ? '[' meta_item ']' ; +meta_item : ident [ '=' literal + | '(' meta_seq ')' ] ? ; +meta_seq : meta_item [ ',' meta_seq ] ? ; +``` + +# Statements and expressions + +## Statements + +**FIXME:** grammar? + +### Declaration statements + +**FIXME:** grammar? + +A _declaration statement_ is one that introduces one or more *names* into the +enclosing statement block. The declared names may denote new slots or new +items. + +#### Item declarations + +**FIXME:** grammar? + +An _item declaration statement_ has a syntactic form identical to an +[item](#items) declaration within a module. Declaring an item — a +function, enumeration, structure, type, static, trait, implementation or module +— locally within a statement block is simply a way of restricting its +scope to a narrow region containing all of its uses; it is otherwise identical +in meaning to declaring the item outside the statement block. + +#### Slot declarations + +```antlr +let_decl : "let" pat [':' type ] ? [ init ] ? ';' ; +init : [ '=' ] expr ; +``` + +### Expression statements + +**FIXME:** grammar? + +## Expressions + +**FIXME:** grammar? + +#### Lvalues, rvalues and temporaries + +**FIXME:** grammar? + +#### Moved and copied types + +**FIXME:** Do we want to capture this in the grammar as different productions? + +### Literal expressions + +**FIXME:** grammar? + +### Path expressions + +**FIXME:** grammar? + +### Tuple expressions + +**FIXME:** grammar? + +### Unit expressions + +**FIXME:** grammar? + +### Structure expressions + +```antlr +struct_expr : expr_path '{' ident ':' expr + [ ',' ident ':' expr ] * + [ ".." expr ] '}' | + expr_path '(' expr + [ ',' expr ] * ')' | + expr_path ; +``` + +### Block expressions + +```antlr +block_expr : '{' [ view_item ] * + [ stmt ';' | item ] * + [ expr ] '}' ; +``` + +### Method-call expressions + +```antlr +method_call_expr : expr '.' ident paren_expr_list ; +``` + +### Field expressions + +```antlr +field_expr : expr '.' ident ; +``` + +### Array expressions + +```antlr +array_expr : '[' "mut" ? vec_elems? ']' ; + +array_elems : [expr [',' expr]*] | [expr ',' ".." expr] ; +``` + +### Index expressions + +```antlr +idx_expr : expr '[' expr ']' ; +``` + +### Unary operator expressions + +**FIXME:** grammar? + +### Binary operator expressions + +```antlr +binop_expr : expr binop expr ; +``` + +#### Arithmetic operators + +**FIXME:** grammar? + +#### Bitwise operators + +**FIXME:** grammar? + +#### Lazy boolean operators + +**FIXME:** grammar? + +#### Comparison operators + +**FIXME:** grammar? + +#### Type cast expressions + +**FIXME:** grammar? + +#### Assignment expressions + +**FIXME:** grammar? + +#### Compound assignment expressions + +**FIXME:** grammar? + +#### Operator precedence + +The precedence of Rust binary operators is ordered as follows, going from +strong to weak: + +```text +* / % +as ++ - +<< >> +& +^ +| +< > <= >= +== != +&& +|| += +``` + +Operators at the same precedence level are evaluated left-to-right. [Unary +operators](#unary-operator-expressions) have the same precedence level and it +is stronger than any of the binary operators'. + +### Grouped expressions + +```antlr +paren_expr : '(' expr ')' ; +``` + +### Call expressions + +```antlr +expr_list : [ expr [ ',' expr ]* ] ? ; +paren_expr_list : '(' expr_list ')' ; +call_expr : expr paren_expr_list ; +``` + +### Lambda expressions + +```antlr +ident_list : [ ident [ ',' ident ]* ] ? ; +lambda_expr : '|' ident_list '|' expr ; +``` + +### While loops + +```antlr +while_expr : "while" no_struct_literal_expr '{' block '}' ; +``` + +### Infinite loops + +```antlr +loop_expr : [ lifetime ':' ] "loop" '{' block '}'; +``` + +### Break expressions + +```antlr +break_expr : "break" [ lifetime ]; +``` + +### Continue expressions + +```antlr +continue_expr : "continue" [ lifetime ]; +``` + +### For expressions + +```antlr +for_expr : "for" pat "in" no_struct_literal_expr '{' block '}' ; +``` + +### If expressions + +```antlr +if_expr : "if" no_struct_literal_expr '{' block '}' + else_tail ? ; + +else_tail : "else" [ if_expr | if_let_expr + | '{' block '}' ] ; +``` + +### Match expressions + +```antlr +match_expr : "match" no_struct_literal_expr '{' match_arm * '}' ; + +match_arm : attribute * match_pat "=>" [ expr "," | '{' block '}' ] ; + +match_pat : pat [ '|' pat ] * [ "if" expr ] ? ; +``` + +### If let expressions + +```antlr +if_let_expr : "if" "let" pat '=' expr '{' block '}' + else_tail ? ; +else_tail : "else" [ if_expr | if_let_expr | '{' block '}' ] ; +``` + +### While let loops + +```antlr +while_let_expr : "while" "let" pat '=' expr '{' block '}' ; +``` + +### Return expressions + +```antlr +return_expr : "return" expr ? ; +``` + +# Type system + +**FIXME:** is this entire chapter relevant here? Or should it all have been covered by some production already? + +## Types + +### Primitive types + +**FIXME:** grammar? + +#### Machine types + +**FIXME:** grammar? + +#### Machine-dependent integer types + +**FIXME:** grammar? + +### Textual types + +**FIXME:** grammar? + +### Tuple types + +**FIXME:** grammar? + +### Array, and Slice types + +**FIXME:** grammar? + +### Structure types + +**FIXME:** grammar? + +### Enumerated types + +**FIXME:** grammar? + +### Pointer types + +**FIXME:** grammar? + +### Function types + +**FIXME:** grammar? + +### Closure types + +```antlr +closure_type := [ 'unsafe' ] [ '<' lifetime-list '>' ] '|' arg-list '|' + [ ':' bound-list ] [ '->' type ] +procedure_type := 'proc' [ '<' lifetime-list '>' ] '(' arg-list ')' + [ ':' bound-list ] [ '->' type ] +lifetime-list := lifetime | lifetime ',' lifetime-list +arg-list := ident ':' type | ident ':' type ',' arg-list +bound-list := bound | bound '+' bound-list +bound := path | lifetime +``` + +### Object types + +**FIXME:** grammar? + +### Type parameters + +**FIXME:** grammar? + +### Self types + +**FIXME:** grammar? + +## Type kinds + +**FIXME:** this this probably not relevant to the grammar... + +# Memory and concurrency models + +**FIXME:** is this entire chapter relevant here? Or should it all have been covered by some production already? + +## Memory model + +### Memory allocation and lifetime + +### Memory ownership + +### Memory slots + +### Boxes + +## Tasks + +### Communication between tasks + +### Task lifecycle diff --git a/src/doc/guide-crates.md b/src/doc/guide-crates.md new file mode 100644 index 0000000000..85badc11d6 --- /dev/null +++ b/src/doc/guide-crates.md @@ -0,0 +1,4 @@ +% The (old) Rust Crates and Modules Guide + +This content has moved into +[the Rust Programming Language book](book/crates-and-modules.html). diff --git a/src/doc/guide-error-handling.md b/src/doc/guide-error-handling.md new file mode 100644 index 0000000000..54fa529f3a --- /dev/null +++ b/src/doc/guide-error-handling.md @@ -0,0 +1,4 @@ +% Error Handling in Rust + +This content has moved into +[the Rust Programming Language book](book/error-handling.html). diff --git a/src/doc/guide-ffi.md b/src/doc/guide-ffi.md new file mode 100644 index 0000000000..1130a10bd1 --- /dev/null +++ b/src/doc/guide-ffi.md @@ -0,0 +1,4 @@ +% The (old) Rust Foreign Function Interface Guide + +This content has moved into +[the Rust Programming Language book](book/ffi.html). diff --git a/src/doc/guide-macros.md b/src/doc/guide-macros.md new file mode 100644 index 0000000000..228cb3c624 --- /dev/null +++ b/src/doc/guide-macros.md @@ -0,0 +1,4 @@ +% The (old) Rust Macros Guide + +This content has moved into +[the Rust Programming Language book](book/macros.html). diff --git a/src/doc/guide-ownership.md b/src/doc/guide-ownership.md new file mode 100644 index 0000000000..884f14726c --- /dev/null +++ b/src/doc/guide-ownership.md @@ -0,0 +1,4 @@ +% The (old) Rust Ownership Guide + +This content has moved into +[the Rust Programming Language book](book/ownership.html). diff --git a/src/doc/guide-plugins.md b/src/doc/guide-plugins.md new file mode 100644 index 0000000000..d6495d02e1 --- /dev/null +++ b/src/doc/guide-plugins.md @@ -0,0 +1,4 @@ +% The (old) Rust Compiler Plugins Guide + +This content has moved into +[the Rust Programming Language book](book/plugins.html). diff --git a/src/doc/guide-pointers.md b/src/doc/guide-pointers.md new file mode 100644 index 0000000000..0374166405 --- /dev/null +++ b/src/doc/guide-pointers.md @@ -0,0 +1,4 @@ +% The (old) Rust Pointer Guide + +This content has moved into +[the Rust Programming Language book](book/pointers.html). diff --git a/src/doc/guide-strings.md b/src/doc/guide-strings.md new file mode 100644 index 0000000000..d030614489 --- /dev/null +++ b/src/doc/guide-strings.md @@ -0,0 +1,4 @@ +% The (old) Guide to Rust Strings + +This content has moved into +[the Rust Programming Language book](book/strings.html). diff --git a/src/doc/guide-tasks.md b/src/doc/guide-tasks.md new file mode 100644 index 0000000000..197559bef0 --- /dev/null +++ b/src/doc/guide-tasks.md @@ -0,0 +1,4 @@ +% The (old) Rust Threads and Communication Guide + +This content has moved into +[the Rust Programming Language book](book/tasks.html). diff --git a/src/doc/guide-testing.md b/src/doc/guide-testing.md new file mode 100644 index 0000000000..67bcb0a5e5 --- /dev/null +++ b/src/doc/guide-testing.md @@ -0,0 +1,4 @@ +% The (old) Rust Testing Guide + +This content has moved into +[the Rust Programming Language book](book/testing.html). diff --git a/src/doc/guide-unsafe.md b/src/doc/guide-unsafe.md new file mode 100644 index 0000000000..3c1a82d017 --- /dev/null +++ b/src/doc/guide-unsafe.md @@ -0,0 +1,4 @@ +% Writing Safe Low-level and Unsafe Code in Rust + +This content has moved into +[the Rust Programming Language book](book/unsafe.html). diff --git a/src/doc/guide.md b/src/doc/guide.md new file mode 100644 index 0000000000..b9e70e7cfd --- /dev/null +++ b/src/doc/guide.md @@ -0,0 +1,4 @@ +% The (old) Rust Guide + +This content has moved into +[the Rust Programming Language book](book/README.html). diff --git a/src/doc/index.md b/src/doc/index.md index 25dcc10d89..a4f7941222 100644 --- a/src/doc/index.md +++ b/src/doc/index.md @@ -39,10 +39,12 @@ Overflow](http://stackoverflow.com/questions/tagged/rust). Searching for your problem might reveal someone who has asked it before! There is an active [subreddit](http://reddit.com/r/rust) with lots of -discussion about Rust. +discussion and news about Rust. -There is also a [developer forum](http://discuss.rust-lang.org/), where the -development of Rust itself is discussed. +There is also a [user forum](http://users.rust-lang.org), for all +user-oriented discussion, and a [developer +forum](http://internals.rust-lang.org/), where the development of Rust +itself is discussed. # Specification @@ -57,8 +59,7 @@ tools we have are really nice. [Cargo](http://crates.io) is Rust's package manager, and its website contains lots of good documentation. -[The `rustdoc` manual](rustdoc.html) contains information about Rust's -documentation tool. +[`rustdoc`](book/documentation.html) is used to generate documentation for Rust code. # FAQs diff --git a/src/doc/intro.md b/src/doc/intro.md index cb28586d10..d9bfe71e2e 100644 --- a/src/doc/intro.md +++ b/src/doc/intro.md @@ -5,7 +5,7 @@ accomplishes these goals by being memory safe without using garbage collection. This introduction will give you a rough idea of what Rust is like, eliding many details. It does not require prior experience with systems programming, but you -may find the syntax easier if you've used a 'curly brace' programming language +may find the syntax easier if you've used a "curly brace" programming language before, like C or JavaScript. The concepts are more important than the syntax, so don't worry if you don't get every last detail: you can read [The Rust Programming Language](book/index.html) to get a more complete explanation. @@ -15,7 +15,7 @@ Rust to follow along. If you'd like to anyway, check out [the homepage](http://rust-lang.org) for explanation. To show off Rust, let's talk about how easy it is to get started with Rust. -Then, we'll talk about Rust's most interesting feature, **ownership**, and +Then, we'll talk about Rust's most interesting feature, *ownership*, and then discuss how it makes concurrency easier to reason about. Finally, we'll talk about how Rust breaks down the perceived dichotomy between speed and safety. @@ -57,7 +57,7 @@ version = "0.0.1" authors = ["Your Name "] ``` -This is called a **manifest**, and it contains all of the metadata that Cargo +This is called a *manifest*, and it contains all of the metadata that Cargo needs to compile your project. Here's what's in `src/main.rs`: @@ -68,7 +68,7 @@ fn main() { } ``` -Cargo generated a 'hello world' for us. We'll talk more about the syntax here +Cargo generated a "Hello World" for us. We'll talk more about the syntax here later, but that's what Rust code looks like! Let's compile and run it: ```{bash} @@ -106,9 +106,9 @@ use semver::Version; fn main() { assert!(Version::parse("1.2.3") == Ok(Version { - major: 1u, - minor: 2u, - patch: 3u, + major: 1u64, + minor: 2u64, + patch: 3u64, pre: vec!(), build: vec!(), })); @@ -146,8 +146,8 @@ Enough about tools, let's talk code! # Ownership -Rust's defining feature is 'memory safety without garbage collection.' Let's -take a moment to talk about what that means. **Memory safety** means that the +Rust's defining feature is "memory safety without garbage collection". Let's +take a moment to talk about what that means. *Memory safety* means that the programming language eliminates certain kinds of bugs, such as [buffer overflows](http://en.wikipedia.org/wiki/Buffer_overflow) and [dangling pointers](http://en.wikipedia.org/wiki/Dangling_pointer). These problems occur @@ -170,7 +170,7 @@ We make an array, `v`, and then call `push` on it. `push` is a method which adds an element to the end of an array. Next, we make a new variable, `x`, that's equal to the first element of -the array. Simple, but this is where the 'bug' will appear. +the array. Simple, but this is where the "bug" will appear. Let's keep going. We then call `push` again, pushing "world" onto the end of the array. `v` now is `["Hello", "world"]`. @@ -222,9 +222,9 @@ its length changes, we may need to allocate more memory. In Ruby, this happens as well, we just don't think about it very often. So why does the C++ version segfault when we allocate more memory? -The answer is that in the C++ version, `x` is a **reference** to the memory +The answer is that in the C++ version, `x` is a *reference* to the memory location where the first element of the array is stored. But in Ruby, `x` is a -standalone value, not connected to the underyling array at all. Let's dig into +standalone value, not connected to the underlying array at all. Let's dig into the details for a moment. Your program has access to memory, provided to it by the operating system. Each location in memory has an address. So when we make our vector, `v`, it's stored in a memory location somewhere: @@ -332,11 +332,11 @@ error: aborting due to previous error When we try to mutate the array by `push`ing it the second time, Rust throws an error. It says that we "cannot borrow v as mutable because it is also -borrowed as immutable." What's up with "borrowed"? +borrowed as immutable." What does it mean by "borrowed"? -In Rust, the type system encodes the notion of **ownership**. The variable `v` -is an "owner" of the vector. When we make a reference to `v`, we let that -variable (in this case, `x`) 'borrow' it for a while. Just like if you own a +In Rust, the type system encodes the notion of *ownership*. The variable `v` +is an *owner* of the vector. When we make a reference to `v`, we let that +variable (in this case, `x`) *borrow* it for a while. Just like if you own a book, and you lend it to me, I'm borrowing the book. So, when I try to modify the vector with the second call to `push`, I need @@ -392,22 +392,23 @@ Here's an example of a concurrent Rust program: use std::thread::Thread; fn main() { - for _ in range(0u, 10u) { - Thread::spawn(move || { + let guards: Vec<_> = (0..10).map(|_| { + Thread::scoped(|| { println!("Hello, world!"); - }); - } + }) + }).collect(); } ``` -This program creates ten threads, who all print `Hello, world!`. The -`spawn` function takes one argument, a closure, indicated by the -double bars `||`. (The `move` keyword indicates that the closure takes -ownership of any data it uses; we'll have more on the significance of -this shortly.) This closure is executed in a new thread created by -`spawn`. +This program creates ten threads, which all print `Hello, world!`. The `scoped` +function takes one argument, a closure, indicated by the double bars `||`. This +closure is executed in a new thread created by `scoped`. The method is called +`scoped` because it returns a 'join guard', which will automatically join the +child thread when it goes out of scope. Because we `collect` these guards into +a `Vec`, and that vector goes out of scope at the end of our program, our +program will wait for every thread to finish before finishing. -One common form of problem in concurrent programs is a 'data race.' +One common form of problem in concurrent programs is a *data race*. This occurs when two different threads attempt to access the same location in memory in a non-synchronized way, where at least one of them is a write. If one thread is attempting to read, and one thread @@ -423,11 +424,11 @@ Let's see an example. This Rust code will not compile: use std::thread::Thread; fn main() { - let mut numbers = vec![1i, 2i, 3i]; + let mut numbers = vec![1, 2, 3]; - for i in range(0u, 3u) { + for i in 0..3 { Thread::spawn(move || { - for j in range(0, 3) { numbers[j] += 1 } + for j in 0..3 { numbers[j] += 1 } }); } } @@ -437,15 +438,15 @@ It gives us this error: ```text 6:71 error: capture of moved value: `numbers` - for j in range(0, 3) { numbers[j] += 1 } - ^~~~~~~ + for j in 0..3 { numbers[j] += 1 } + ^~~~~~~ 7:50 note: `numbers` moved into closure environment here spawn(move || { - for j in range(0, 3) { numbers[j] += 1 } + for j in 0..3 { numbers[j] += 1 } }); 6:79 error: cannot assign to immutable dereference (dereference is implicit, due to indexing) - for j in range(0, 3) { numbers[j] += 1 } - ^~~~~~~~~~~~~~~ + for j in 0..3 { numbers[j] += 1 } + ^~~~~~~~~~~~~~~ ``` It mentions that "numbers moved into closure environment". Because we @@ -460,9 +461,9 @@ code tries to make three owners. This may cause a safety problem, so Rust disallows it. What to do here? Rust has two types that helps us: `Arc` and `Mutex`. -"Arc" stands for "atomically reference counted." In other words, an Arc will +*Arc* stands for "atomically reference counted". In other words, an Arc will keep track of the number of references to something, and not free the -associated resource until the count is zero. The 'atomic' portion refers to an +associated resource until the count is zero. The *atomic* portion refers to an Arc's usage of concurrency primitives to atomically update the count, making it safe across threads. If we use an Arc, we can have our three references. But, an Arc does not allow mutable borrows of the data it holds, and we want to @@ -477,16 +478,14 @@ use std::thread::Thread; use std::sync::{Arc,Mutex}; fn main() { - let numbers = Arc::new(Mutex::new(vec![1i, 2i, 3i])); + let numbers = Arc::new(Mutex::new(vec![1, 2, 3])); - for i in range(0u, 3u) { + for i in 0..3 { let number = numbers.clone(); Thread::spawn(move || { let mut array = number.lock().unwrap(); - - (*array)[i] += 1; - - println!("numbers[{}] is {}", i, (*array)[i]); + array[i] += 1; + println!("numbers[{}] is {}", i, array[i]); }); } } @@ -525,13 +524,13 @@ give us assurance _at compile time_ that we weren't doing something incorrect with regards to concurrency. In order to share ownership, we were forced to be explicit and use a mechanism to ensure that it would be properly handled. -# Safety _and_ speed +# Safety _and_ Speed -Safety and speed are always presented as a continuum. On one hand, you have -maximum speed, but no safety. On the other, you have absolute safety, with no -speed. Rust seeks to break out of this mode by introducing safety at compile -time, ensuring that you haven't done anything wrong, while compiling to the -same low-level code you'd expect without the safety. +Safety and speed are always presented as a continuum. At one end of the spectrum, +you have maximum speed, but no safety. On the other end, you have absolute safety +with no speed. Rust seeks to break out of this paradigm by introducing safety at +compile time, ensuring that you haven't done anything wrong, while compiling to +the same low-level code you'd expect without the safety. As an example, Rust's ownership system is _entirely_ at compile time. The safety check that makes this an error about moved values: @@ -540,12 +539,12 @@ safety check that makes this an error about moved values: use std::thread::Thread; fn main() { - let vec = vec![1i, 2, 3]; + let vec = vec![1, 2, 3]; - for i in range(0u, 3) { + for i in 0..3 { Thread::spawn(move || { println!("{}", vec[i]); - }).detach(); + }); } } ``` @@ -556,9 +555,9 @@ you can remove it. As an example, this is a poor way to iterate through a vector: ```{rust} -let vec = vec![1i, 2, 3]; +let vec = vec![1, 2, 3]; -for i in range(0u, vec.len()) { +for i in 0..vec.len() { println!("{}", vec[i]); } ``` @@ -568,7 +567,7 @@ that we don't try to access an invalid index. However, we can remove this while retaining safety. The answer is iterators: ```{rust} -let vec = vec![1i, 2, 3]; +let vec = vec![1, 2, 3]; for x in vec.iter() { println!("{}", x); diff --git a/src/doc/not_found.md b/src/doc/not_found.md index bd4d959109..c746c5773d 100644 --- a/src/doc/not_found.md +++ b/src/doc/not_found.md @@ -12,6 +12,7 @@ Looks like you've taken a wrong turn. Some things that might be helpful to you though: ## Search + *
@@ -19,10 +20,12 @@ Some things that might be helpful to you though: * Rust doc search: ## Reference + * [The Rust official site](http://rust-lang.org) -* [The Rust reference](http://doc.rust-lang.org/reference.html) (* [PDF](http://doc.rust-lang.org/reference.pdf)) +* [The Rust reference](http://doc.rust-lang.org/reference.html) ## Docs + * [The standard library](http://doc.rust-lang.org/std/) +"#; diff --git a/src/rustbook/main.rs b/src/rustbook/main.rs index acb4edb7a4..ace57f0ac2 100644 --- a/src/rustbook/main.rs +++ b/src/rustbook/main.rs @@ -8,13 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(slicing_syntax, box_syntax)] - -extern crate regex; +#![feature(box_syntax)] +#![feature(collections)] +#![feature(core)] +#![feature(old_io)] +#![feature(os)] +#![feature(env)] +#![feature(old_path)] +#![feature(rustdoc)] extern crate rustdoc; -use std::os; +use std::env; use subcommand::Subcommand; use term::Term; @@ -39,13 +44,14 @@ mod serve; mod test; mod css; +mod javascript; #[cfg(not(test))] // thanks #12327 fn main() { let mut term = Term::new(); - let cmd = os::args(); + let cmd: Vec<_> = env::args().collect(); - if cmd.len() < 1 { + if cmd.len() <= 1 { help::usage() } else { match subcommand::parse_name(&cmd[1][]) { @@ -54,7 +60,12 @@ fn main() { Ok(_) => { match subcmd.execute(&mut term) { Ok(_) => (), - Err(_) => os::set_exit_status(-1), + Err(err) => { + term.err(&format!("error: {}", err.description())[]); + err.detail().map(|detail| { + term.err(&format!("detail: {}", detail)[]); + }); + } } } Err(err) => { diff --git a/src/rustbook/term.rs b/src/rustbook/term.rs index 471e22ce7c..98aa3fca18 100644 --- a/src/rustbook/term.rs +++ b/src/rustbook/term.rs @@ -11,8 +11,8 @@ //! An abstraction of the terminal. Eventually, provide color and //! verbosity support. For now, just a wrapper around stdout/stderr. -use std::os; -use std::io::stdio; +use std::env; +use std::old_io::stdio; pub struct Term { err: Box @@ -28,6 +28,6 @@ impl Term { pub fn err(&mut self, msg: &str) { // swallow any errors let _ = self.err.write_line(msg); - os::set_exit_status(101); + env::set_exit_status(101); } } diff --git a/src/rustbook/test.rs b/src/rustbook/test.rs index f2bf92585f..c5d4875423 100644 --- a/src/rustbook/test.rs +++ b/src/rustbook/test.rs @@ -16,7 +16,7 @@ use error::CommandResult; use error::Error; use term::Term; use book; -use std::io::{Command, File}; +use std::old_io::{Command, File}; use std::os; struct Test; @@ -64,8 +64,8 @@ impl Subcommand for Test { } } Err(errors) => { - for err in errors.into_iter() { - term.err(&err[]); + for err in errors { + term.err(&err[..]); } return Err(box "There was an error." as Box); } diff --git a/src/rustllvm/ExecutionEngineWrapper.cpp b/src/rustllvm/ExecutionEngineWrapper.cpp index d37cf9d12a..8ca81ab3d6 100644 --- a/src/rustllvm/ExecutionEngineWrapper.cpp +++ b/src/rustllvm/ExecutionEngineWrapper.cpp @@ -82,21 +82,24 @@ extern "C" LLVMExecutionEngineRef LLVMBuildExecutionEngine( InitializeNativeTargetAsmPrinter(); InitializeNativeTargetAsmParser(); - std::unique_ptr m(unwrap(mod)); - RustJITMemoryManager *mm = unwrap(mref); - std::string error_str; TargetOptions options; options.JITEmitDebugInfo = true; options.NoFramePointerElim = true; - ExecutionEngine *ee = EngineBuilder(std::move(m)) - .setEngineKind(EngineKind::JIT) - .setErrorStr(&error_str) - .setMCJITMemoryManager(mm) - .setTargetOptions(options) - .create(); + ExecutionEngine *ee = + #if LLVM_VERSION_MINOR <= 5 + EngineBuilder(unwrap(mod)) + .setMCJITMemoryManager(unwrap(mref)) + #else + EngineBuilder(std::unique_ptr(unwrap(mod))) + .setMCJITMemoryManager(std::unique_ptr(unwrap(mref))) + #endif + .setEngineKind(EngineKind::JIT) + .setErrorStr(&error_str) + .setTargetOptions(options) + .create(); if (!ee) LLVMRustSetLastError(error_str.c_str()); diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index bce73a2769..aaf6d8df29 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -228,8 +228,22 @@ extern "C" LLVMValueRef LLVMInlineAsm(LLVMTypeRef Ty, typedef DIBuilder* DIBuilderRef; +#if LLVM_VERSION_MINOR >= 6 +typedef struct LLVMOpaqueMetadata *LLVMMetadataRef; + +namespace llvm { +DEFINE_ISA_CONVERSION_FUNCTIONS(Metadata, LLVMMetadataRef) + +inline Metadata **unwrap(LLVMMetadataRef *Vals) { + return reinterpret_cast(Vals); +} +} +#else +typedef LLVMValueRef LLVMMetadataRef; +#endif + template -DIT unwrapDI(LLVMValueRef ref) { +DIT unwrapDI(LLVMMetadataRef ref) { return DIT(ref ? unwrap(ref) : NULL); } @@ -257,7 +271,7 @@ extern "C" void LLVMDIBuilderFinalize(DIBuilderRef Builder) { Builder->finalize(); } -extern "C" LLVMValueRef LLVMDIBuilderCreateCompileUnit( +extern "C" LLVMMetadataRef LLVMDIBuilderCreateCompileUnit( DIBuilderRef Builder, unsigned Lang, const char* File, @@ -277,17 +291,17 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateCompileUnit( SplitName)); } -extern "C" LLVMValueRef LLVMDIBuilderCreateFile( +extern "C" LLVMMetadataRef LLVMDIBuilderCreateFile( DIBuilderRef Builder, const char* Filename, const char* Directory) { return wrap(Builder->createFile(Filename, Directory)); } -extern "C" LLVMValueRef LLVMDIBuilderCreateSubroutineType( +extern "C" LLVMMetadataRef LLVMDIBuilderCreateSubroutineType( DIBuilderRef Builder, - LLVMValueRef File, - LLVMValueRef ParameterTypes) { + LLVMMetadataRef File, + LLVMMetadataRef ParameterTypes) { return wrap(Builder->createSubroutineType( unwrapDI(File), #if LLVM_VERSION_MINOR >= 6 @@ -297,22 +311,22 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateSubroutineType( #endif } -extern "C" LLVMValueRef LLVMDIBuilderCreateFunction( +extern "C" LLVMMetadataRef LLVMDIBuilderCreateFunction( DIBuilderRef Builder, - LLVMValueRef Scope, + LLVMMetadataRef Scope, const char* Name, const char* LinkageName, - LLVMValueRef File, + LLVMMetadataRef File, unsigned LineNo, - LLVMValueRef Ty, + LLVMMetadataRef Ty, bool isLocalToUnit, bool isDefinition, unsigned ScopeLine, unsigned Flags, bool isOptimized, LLVMValueRef Fn, - LLVMValueRef TParam, - LLVMValueRef Decl) { + LLVMMetadataRef TParam, + LLVMMetadataRef Decl) { return wrap(Builder->createFunction( unwrapDI(Scope), Name, LinkageName, unwrapDI(File), LineNo, @@ -323,7 +337,7 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateFunction( unwrapDI(Decl))); } -extern "C" LLVMValueRef LLVMDIBuilderCreateBasicType( +extern "C" LLVMMetadataRef LLVMDIBuilderCreateBasicType( DIBuilderRef Builder, const char* Name, uint64_t SizeInBits, @@ -334,9 +348,9 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateBasicType( AlignInBits, Encoding)); } -extern "C" LLVMValueRef LLVMDIBuilderCreatePointerType( +extern "C" LLVMMetadataRef LLVMDIBuilderCreatePointerType( DIBuilderRef Builder, - LLVMValueRef PointeeTy, + LLVMMetadataRef PointeeTy, uint64_t SizeInBits, uint64_t AlignInBits, const char* Name) { @@ -344,19 +358,19 @@ extern "C" LLVMValueRef LLVMDIBuilderCreatePointerType( unwrapDI(PointeeTy), SizeInBits, AlignInBits, Name)); } -extern "C" LLVMValueRef LLVMDIBuilderCreateStructType( +extern "C" LLVMMetadataRef LLVMDIBuilderCreateStructType( DIBuilderRef Builder, - LLVMValueRef Scope, + LLVMMetadataRef Scope, const char* Name, - LLVMValueRef File, + LLVMMetadataRef File, unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags, - LLVMValueRef DerivedFrom, - LLVMValueRef Elements, + LLVMMetadataRef DerivedFrom, + LLVMMetadataRef Elements, unsigned RunTimeLang, - LLVMValueRef VTableHolder, + LLVMMetadataRef VTableHolder, const char *UniqueId) { return wrap(Builder->createStructType( unwrapDI(Scope), @@ -376,17 +390,17 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateStructType( )); } -extern "C" LLVMValueRef LLVMDIBuilderCreateMemberType( +extern "C" LLVMMetadataRef LLVMDIBuilderCreateMemberType( DIBuilderRef Builder, - LLVMValueRef Scope, + LLVMMetadataRef Scope, const char* Name, - LLVMValueRef File, + LLVMMetadataRef File, unsigned LineNo, uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags, - LLVMValueRef Ty) { + LLVMMetadataRef Ty) { return wrap(Builder->createMemberType( unwrapDI(Scope), Name, unwrapDI(File), LineNo, @@ -394,10 +408,10 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateMemberType( unwrapDI(Ty))); } -extern "C" LLVMValueRef LLVMDIBuilderCreateLexicalBlock( +extern "C" LLVMMetadataRef LLVMDIBuilderCreateLexicalBlock( DIBuilderRef Builder, - LLVMValueRef Scope, - LLVMValueRef File, + LLVMMetadataRef Scope, + LLVMMetadataRef File, unsigned Line, unsigned Col) { return wrap(Builder->createLexicalBlock( @@ -409,17 +423,17 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateLexicalBlock( )); } -extern "C" LLVMValueRef LLVMDIBuilderCreateStaticVariable( +extern "C" LLVMMetadataRef LLVMDIBuilderCreateStaticVariable( DIBuilderRef Builder, - LLVMValueRef Context, + LLVMMetadataRef Context, const char* Name, const char* LinkageName, - LLVMValueRef File, + LLVMMetadataRef File, unsigned LineNo, - LLVMValueRef Ty, + LLVMMetadataRef Ty, bool isLocalToUnit, LLVMValueRef Val, - LLVMValueRef Decl = NULL) { + LLVMMetadataRef Decl = NULL) { #if LLVM_VERSION_MINOR == 6 return wrap(Builder->createGlobalVariable(unwrapDI(Context), #else @@ -431,21 +445,42 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateStaticVariable( LineNo, unwrapDI(Ty), isLocalToUnit, - unwrap(Val), + cast(unwrap(Val)), unwrapDI(Decl))); } -extern "C" LLVMValueRef LLVMDIBuilderCreateLocalVariable( +extern "C" LLVMMetadataRef LLVMDIBuilderCreateVariable( DIBuilderRef Builder, unsigned Tag, - LLVMValueRef Scope, + LLVMMetadataRef Scope, const char* Name, - LLVMValueRef File, + LLVMMetadataRef File, unsigned LineNo, - LLVMValueRef Ty, + LLVMMetadataRef Ty, bool AlwaysPreserve, unsigned Flags, + int64_t* AddrOps, + unsigned AddrOpsCount, unsigned ArgNo) { +#if LLVM_VERSION_MINOR < 6 + if (AddrOpsCount > 0) { + SmallVector addr_ops; + llvm::Type *Int64Ty = Type::getInt64Ty(VMContext); + for (int i = 0; i < AddrOpsCount; ++i) + addr_ops.push_back(ConstantInt::get(Int64Ty, AddrOps[i])); + + return wrap(Builder->createComplexVariable( + Tag, + unwrapDI(Scope), + Name, + unwrapDI(File), + LineNo, + unwrapDI(Ty), + addr_ops, + ArgNo + )); + } +#endif return wrap(Builder->createLocalVariable(Tag, unwrapDI(Scope), Name, unwrapDI(File), @@ -453,66 +488,94 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateLocalVariable( unwrapDI(Ty), AlwaysPreserve, Flags, ArgNo)); } -extern "C" LLVMValueRef LLVMDIBuilderCreateArrayType( +extern "C" LLVMMetadataRef LLVMDIBuilderCreateArrayType( DIBuilderRef Builder, uint64_t Size, uint64_t AlignInBits, - LLVMValueRef Ty, - LLVMValueRef Subscripts) { + LLVMMetadataRef Ty, + LLVMMetadataRef Subscripts) { return wrap(Builder->createArrayType(Size, AlignInBits, unwrapDI(Ty), unwrapDI(Subscripts))); } -extern "C" LLVMValueRef LLVMDIBuilderCreateVectorType( +extern "C" LLVMMetadataRef LLVMDIBuilderCreateVectorType( DIBuilderRef Builder, uint64_t Size, uint64_t AlignInBits, - LLVMValueRef Ty, - LLVMValueRef Subscripts) { + LLVMMetadataRef Ty, + LLVMMetadataRef Subscripts) { return wrap(Builder->createVectorType(Size, AlignInBits, unwrapDI(Ty), unwrapDI(Subscripts))); } -extern "C" LLVMValueRef LLVMDIBuilderGetOrCreateSubrange( +extern "C" LLVMMetadataRef LLVMDIBuilderGetOrCreateSubrange( DIBuilderRef Builder, int64_t Lo, int64_t Count) { return wrap(Builder->getOrCreateSubrange(Lo, Count)); } -extern "C" LLVMValueRef LLVMDIBuilderGetOrCreateArray( +extern "C" LLVMMetadataRef LLVMDIBuilderGetOrCreateArray( DIBuilderRef Builder, - LLVMValueRef* Ptr, + LLVMMetadataRef* Ptr, unsigned Count) { return wrap(Builder->getOrCreateArray( - ArrayRef(reinterpret_cast(Ptr), Count))); + ArrayRef(unwrap(Ptr), Count))); } extern "C" LLVMValueRef LLVMDIBuilderInsertDeclareAtEnd( DIBuilderRef Builder, LLVMValueRef Val, - LLVMValueRef VarInfo, + LLVMMetadataRef VarInfo, + int64_t* AddrOps, + unsigned AddrOpsCount, LLVMBasicBlockRef InsertAtEnd) { +#if LLVM_VERSION_MINOR >= 6 + DIExpression Expr; + if (AddrOpsCount == 0) { + Expr = Builder->createExpression(); + } else { + llvm::ArrayRef addr_ops(AddrOps, AddrOpsCount); + Expr = Builder->createExpression(addr_ops); + } +#endif return wrap(Builder->insertDeclare( unwrap(Val), unwrapDI(VarInfo), +#if LLVM_VERSION_MINOR >= 6 + Expr, +#endif unwrap(InsertAtEnd))); } extern "C" LLVMValueRef LLVMDIBuilderInsertDeclareBefore( DIBuilderRef Builder, LLVMValueRef Val, - LLVMValueRef VarInfo, + LLVMMetadataRef VarInfo, + int64_t* AddrOps, + unsigned AddrOpsCount, LLVMValueRef InsertBefore) { +#if LLVM_VERSION_MINOR >= 6 + DIExpression Expr; + if (AddrOpsCount == 0) { + Expr = Builder->createExpression(); + } else { + llvm::ArrayRef addr_ops(AddrOps, AddrOpsCount); + Expr = Builder->createExpression(addr_ops); + } +#endif return wrap(Builder->insertDeclare( unwrap(Val), unwrapDI(VarInfo), +#if LLVM_VERSION_MINOR >= 6 + Expr, +#endif unwrap(InsertBefore))); } -extern "C" LLVMValueRef LLVMDIBuilderCreateEnumerator( +extern "C" LLVMMetadataRef LLVMDIBuilderCreateEnumerator( DIBuilderRef Builder, const char* Name, uint64_t Val) @@ -520,16 +583,16 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateEnumerator( return wrap(Builder->createEnumerator(Name, Val)); } -extern "C" LLVMValueRef LLVMDIBuilderCreateEnumerationType( +extern "C" LLVMMetadataRef LLVMDIBuilderCreateEnumerationType( DIBuilderRef Builder, - LLVMValueRef Scope, + LLVMMetadataRef Scope, const char* Name, - LLVMValueRef File, + LLVMMetadataRef File, unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits, - LLVMValueRef Elements, - LLVMValueRef ClassType) + LLVMMetadataRef Elements, + LLVMMetadataRef ClassType) { return wrap(Builder->createEnumerationType( unwrapDI(Scope), @@ -542,16 +605,16 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateEnumerationType( unwrapDI(ClassType))); } -extern "C" LLVMValueRef LLVMDIBuilderCreateUnionType( +extern "C" LLVMMetadataRef LLVMDIBuilderCreateUnionType( DIBuilderRef Builder, - LLVMValueRef Scope, + LLVMMetadataRef Scope, const char* Name, - LLVMValueRef File, + LLVMMetadataRef File, unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags, - LLVMValueRef Elements, + LLVMMetadataRef Elements, unsigned RunTimeLang, const char* UniqueId) { @@ -577,12 +640,12 @@ extern "C" void LLVMSetUnnamedAddr(LLVMValueRef Value, LLVMBool Unnamed) { } #endif -extern "C" LLVMValueRef LLVMDIBuilderCreateTemplateTypeParameter( +extern "C" LLVMMetadataRef LLVMDIBuilderCreateTemplateTypeParameter( DIBuilderRef Builder, - LLVMValueRef Scope, + LLVMMetadataRef Scope, const char* Name, - LLVMValueRef Ty, - LLVMValueRef File, + LLVMMetadataRef Ty, + LLVMMetadataRef File, unsigned LineNo, unsigned ColumnNo) { @@ -595,47 +658,21 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateTemplateTypeParameter( ColumnNo)); } -extern "C" LLVMValueRef LLVMDIBuilderCreateOpDeref(LLVMTypeRef IntTy) +extern "C" int64_t LLVMDIBuilderCreateOpDeref() { - return LLVMConstInt(IntTy, DIBuilder::OpDeref, true); + return dwarf::DW_OP_deref; } -extern "C" LLVMValueRef LLVMDIBuilderCreateOpPlus(LLVMTypeRef IntTy) +extern "C" int64_t LLVMDIBuilderCreateOpPlus() { - return LLVMConstInt(IntTy, DIBuilder::OpPlus, true); + return dwarf::DW_OP_plus; } -extern "C" LLVMValueRef LLVMDIBuilderCreateComplexVariable( +extern "C" LLVMMetadataRef LLVMDIBuilderCreateNameSpace( DIBuilderRef Builder, - unsigned Tag, - LLVMValueRef Scope, - const char *Name, - LLVMValueRef File, - unsigned LineNo, - LLVMValueRef Ty, - LLVMValueRef* AddrOps, - unsigned AddrOpsCount, - unsigned ArgNo) -{ - llvm::ArrayRef addr_ops((llvm::Value**)AddrOps, AddrOpsCount); - - return wrap(Builder->createComplexVariable( - Tag, - unwrapDI(Scope), - Name, - unwrapDI(File), - LineNo, - unwrapDI(Ty), - addr_ops, - ArgNo - )); -} - -extern "C" LLVMValueRef LLVMDIBuilderCreateNameSpace( - DIBuilderRef Builder, - LLVMValueRef Scope, + LLVMMetadataRef Scope, const char* Name, - LLVMValueRef File, + LLVMMetadataRef File, unsigned LineNo) { return wrap(Builder->createNameSpace( @@ -646,16 +683,39 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateNameSpace( } extern "C" void LLVMDICompositeTypeSetTypeArray( - LLVMValueRef CompositeType, - LLVMValueRef TypeArray) + DIBuilderRef Builder, + LLVMMetadataRef CompositeType, + LLVMMetadataRef TypeArray) { #if LLVM_VERSION_MINOR >= 6 - unwrapDI(CompositeType).setArrays(unwrapDI(TypeArray)); + DICompositeType tmp = unwrapDI(CompositeType); + Builder->replaceArrays(tmp, unwrapDI(TypeArray)); #else unwrapDI(CompositeType).setTypeArray(unwrapDI(TypeArray)); #endif } +extern "C" LLVMValueRef LLVMDIBuilderCreateDebugLocation( + LLVMContextRef Context, + unsigned Line, + unsigned Column, + LLVMMetadataRef Scope, + LLVMMetadataRef InlinedAt) { + + LLVMContext& context = *unwrap(Context); + + DebugLoc debug_loc = DebugLoc::get(Line, + Column, + unwrapDI(Scope), + unwrapDI(InlinedAt)); + +#if LLVM_VERSION_MINOR >= 6 + return wrap(MetadataAsValue::get(context, debug_loc.getAsMDNode(context))); +#else + return wrap(debug_loc.getAsMDNode(context)); +#endif +} + extern "C" void LLVMWriteTypeToString(LLVMTypeRef Type, RustStringRef str) { raw_rust_string_ostream os(str); unwrap(Type)->print(os); @@ -690,7 +750,14 @@ LLVMRustLinkInExternalBitcode(LLVMModuleRef dst, char *bc, size_t len) { } std::string Err; + +#if LLVM_VERSION_MINOR >= 6 + raw_string_ostream Stream(Err); + DiagnosticPrinterRawOStream DP(Stream); + if (Linker::LinkModules(Dst, *Src, [&](const DiagnosticInfo &DI) { DI.print(DP); })) { +#else if (Linker::LinkModules(Dst, *Src, Linker::DestroySource, &Err)) { +#endif LLVMRustSetLastError(Err.c_str()); return false; } @@ -772,7 +839,7 @@ extern "C" const char* #if LLVM_VERSION_MINOR >= 6 LLVMRustArchiveReadSection(OwningBinary *ob, char *name, size_t *size) { - std::unique_ptr &ar = ob->getBinary(); + Archive *ar = ob->getBinary(); #else LLVMRustArchiveReadSection(Archive *ar, char *name, size_t *size) { #endif @@ -894,6 +961,22 @@ LLVMUnpackOptimizationDiagnostic( *message_out = wrap(&opt->getMsg()); } +extern "C" void +LLVMUnpackInlineAsmDiagnostic( + LLVMDiagnosticInfoRef di, + unsigned *cookie_out, + LLVMTwineRef *message_out, + LLVMValueRef *instruction_out) +{ + // Undefined to call this not on an inline assembly diagnostic! + llvm::DiagnosticInfoInlineAsm *ia + = static_cast(unwrap(di)); + + *cookie_out = ia->getLocCookie(); + *message_out = wrap(&ia->getMsgStr()); + *instruction_out = wrap(ia->getInstruction()); +} + extern "C" void LLVMWriteDiagnosticInfoToString(LLVMDiagnosticInfoRef di, RustStringRef str) { raw_rust_string_ostream os(str); DiagnosticPrinterRawOStream dp(os); diff --git a/src/rustllvm/llvm-auto-clean-trigger b/src/rustllvm/llvm-auto-clean-trigger index 2ac855681f..1317343712 100644 --- a/src/rustllvm/llvm-auto-clean-trigger +++ b/src/rustllvm/llvm-auto-clean-trigger @@ -1,4 +1,4 @@ # If this file is modified, then llvm will be forcibly cleaned and then rebuilt. # The actual contents of this file do not matter, but to trigger a change on the # build bots then the contents should be changed so git updates the mtime. -2015-01-05 +2015-02-13 diff --git a/src/snapshots.txt b/src/snapshots.txt index aa31974c67..4759c44259 100644 --- a/src/snapshots.txt +++ b/src/snapshots.txt @@ -1,3 +1,66 @@ +S 2015-02-17 f1bb6c2 + freebsd-x86_64 59f3a2c6350c170804fb65838e1b504eeab89105 + linux-i386 191ed5ec4f17e32d36abeade55a1c6085e51245c + linux-x86_64 acec86045632f4f3f085c072ba696f889906dffe + macos-i386 9d9e622584bfa318f32bcb5b9ce6a365febff595 + macos-x86_64 e96c1e9860b186507cc75c186d1b96d44df12292 + winnt-i386 3f43e0e71311636f9143ad6f2ee7a514e9fa3f8e + winnt-x86_64 26ef3d9098ea346e5ff8945d5b224bb10c24341d + +S 2015-02-04 ac134f7 + freebsd-x86_64 483e37a02a7ebc12a872e3146145e342ba4a5c04 + linux-i386 8af64e5df839cc945399484380a8b2ebe05a6751 + linux-x86_64 9f485d79c1f0d273ed864eddadb1707f3e2df489 + macos-i386 800f86abd589a1d46c37a8700211c7ba6b05decb + macos-x86_64 b9961faccf79dcfdc0b7a6909bef8b6769798d08 + winnt-i386 2c56a7573f8d0f78271dab1c8e29d3ced7a44ed8 + winnt-x86_64 f1736f47de2a6fad1ff881e51c176f71db5dc2a5 + +S 2015-01-31 474b324 + freebsd-x86_64 c5b55eb488790ff8425d74afa3b37c49517bc55f + linux-i386 319f2f3573c058cb2c4dfc75faaf8ea3ae86ef11 + linux-x86_64 7e71108be890adfecc7644ab6ad183e8a657dc97 + macos-i386 b0b2676681c6d8ec8cb85700428555761c7bdbb8 + macos-x86_64 381dd1587920388e2f71e120a1eabac2648d9672 + winnt-i386 5f99509f88355437824a746f7f90fc22233edb9b + winnt-x86_64 382aa20518b1a19d374f06a038025619ba00b77d + +S 2015-01-28 a45e117 + freebsd-x86_64 08a3ce7331fd1a52466acc0598cf745a009f86f6 + linux-i386 66e36a3461c12e2102a7f7f241d1b0e242c704d0 + linux-x86_64 0ae2f5da9913cfa211a367de77d5faa2ff798918 + macos-i386 d1a6776f00bf5091d73816d46c7fca8617575bd8 + macos-x86_64 cd4d7659b93e2341316cef4b7c5c9b50d23c6bbf + winnt-i386 14859dde2eb57f8c54989852ae6f807e66576338 + winnt-x86_64 693c0d1068debe5781e89e0d9efee85825eeae6c + +S 2015-01-27 7774359 + freebsd-x86_64 63623b632d4f9c33ad3b3cfaeebf8e2dd8395c96 + linux-i386 937b0b126aade54dc2c7198cad67f40d711b64ba + linux-x86_64 3a0ed2a90e1e8b3ee7d81ac7d2feddda0b359c9c + macos-i386 3dbed5c058661cab4ece146fb76acd35cc4d333b + macos-x86_64 fc776bc6b9b60cbd25f07fad43e0f01c76663542 + winnt-i386 77ed0484b6ceb53e5ffa50028d986af8b09a0441 + winnt-x86_64 db1ee5b7939197958e59fe37ce7e123285be64fb + +S 2015-01-20 9006c3c + freebsd-x86_64 240b30b33263d175e30f925ed1e1e1a4e553a513 + linux-i386 544c2063b8d5035342c705b881b8868244c1e9a1 + linux-x86_64 eb41db80978210a013a8dcf8f4fe804969197337 + macos-i386 3ed08c5ae66367e85b8f2b207615d45bfd9cf89d + macos-x86_64 d102760316b90b17d54b0bef02ca6dc35f82e6bd + winnt-i386 6940fef6caa2f64d158b8f5eb00afd5c8e0c71a5 + winnt-x86_64 36b6f239fe1264bceb4b8202e692b7d49947eebe + +S 2015-01-15 9ade482 + freebsd-x86_64 eb8f52c6e8dc24a293456d5e4dc5d1072442e758 + linux-i386 0197ad7179d74eba06a8b46432548caf226aa03d + linux-x86_64 03459f8b216e96ed8b9abe25a42a75859195103d + macos-i386 b5c004883ddff84159f11a3329cde682e0b7f75b + macos-x86_64 b69ea42e1c995682adf0390ed4ef8a762c001a4e + winnt-i386 7fa6e35d26bbffa3888d440a0d5f116414ef8c0a + winnt-x86_64 ac04a4f1f26e0219d91e7eae6f580ca3cfee4231 + S 2015-01-07 9e4e524 freebsd-x86_64 2563d33151bce1bbe08a85d712564bddc7503fc6 linux-i386 d8b73fc9aa3ad72ce1408a41e35d78dba10eb4d4 diff --git a/src/test/auxiliary/blind-item-mixed-crate-use-item-foo.rs b/src/test/auxiliary/blind-item-mixed-crate-use-item-foo.rs new file mode 100644 index 0000000000..f129b4b77b --- /dev/null +++ b/src/test/auxiliary/blind-item-mixed-crate-use-item-foo.rs @@ -0,0 +1,13 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] + +pub const X: () = (); diff --git a/src/test/auxiliary/blind-item-mixed-crate-use-item-foo2.rs b/src/test/auxiliary/blind-item-mixed-crate-use-item-foo2.rs new file mode 100644 index 0000000000..91fa912455 --- /dev/null +++ b/src/test/auxiliary/blind-item-mixed-crate-use-item-foo2.rs @@ -0,0 +1,13 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] + +pub const Y: () = (); diff --git a/src/test/auxiliary/cci_capture_clause.rs b/src/test/auxiliary/cci_capture_clause.rs index 673c38697b..b38e955231 100644 --- a/src/test/auxiliary/cci_capture_clause.rs +++ b/src/test/auxiliary/cci_capture_clause.rs @@ -8,12 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::thread::Thread; +use std::thread; use std::sync::mpsc::{Receiver, channel}; -pub fn foo(x: T) -> Receiver { +pub fn foo(x: T) -> Receiver { let (tx, rx) = channel(); - Thread::spawn(move|| { + thread::spawn(move|| { tx.send(x.clone()); }); rx diff --git a/src/test/auxiliary/cci_class_3.rs b/src/test/auxiliary/cci_class_3.rs index 6a57bb3666..98881eb09b 100644 --- a/src/test/auxiliary/cci_class_3.rs +++ b/src/test/auxiliary/cci_class_3.rs @@ -16,7 +16,7 @@ pub mod kitties { } impl cat { - pub fn speak(&mut self) { self.meows += 1u; } + pub fn speak(&mut self) { self.meows += 1_usize; } pub fn meow_count(&mut self) -> uint { self.meows } } diff --git a/src/test/auxiliary/cci_class_4.rs b/src/test/auxiliary/cci_class_4.rs index 78d667fc5a..9d7905cdeb 100644 --- a/src/test/auxiliary/cci_class_4.rs +++ b/src/test/auxiliary/cci_class_4.rs @@ -34,8 +34,8 @@ pub mod kitties { impl cat { pub fn meow(&mut self) { println!("Meow"); - self.meows += 1u; - if self.meows % 5u == 0u { + self.meows += 1_usize; + if self.meows % 5_usize == 0_usize { self.how_hungry += 1; } } diff --git a/src/test/auxiliary/cci_class_cast.rs b/src/test/auxiliary/cci_class_cast.rs index 0a888d2bd1..dd272bf639 100644 --- a/src/test/auxiliary/cci_class_cast.rs +++ b/src/test/auxiliary/cci_class_cast.rs @@ -26,8 +26,8 @@ pub mod kitty { impl cat { fn meow(&mut self) { println!("Meow"); - self.meows += 1u; - if self.meows % 5u == 0u { + self.meows += 1_usize; + if self.meows % 5_usize == 0_usize { self.how_hungry += 1; } } diff --git a/src/test/auxiliary/cci_impl_lib.rs b/src/test/auxiliary/cci_impl_lib.rs index 3b1857f9cc..6ee497370e 100644 --- a/src/test/auxiliary/cci_impl_lib.rs +++ b/src/test/auxiliary/cci_impl_lib.rs @@ -20,7 +20,7 @@ impl uint_helpers for uint { let mut i = *self; while i < v { f(i); - i += 1u; + i += 1_usize; } } } diff --git a/src/test/auxiliary/cci_iter_lib.rs b/src/test/auxiliary/cci_iter_lib.rs index 3ba068df05..8e00b0dc7b 100644 --- a/src/test/auxiliary/cci_iter_lib.rs +++ b/src/test/auxiliary/cci_iter_lib.rs @@ -12,10 +12,10 @@ #[inline] pub fn iter(v: &[T], mut f: F) where F: FnMut(&T) { - let mut i = 0u; + let mut i = 0_usize; let n = v.len(); while i < n { f(&v[i]); - i += 1u; + i += 1_usize; } } diff --git a/src/test/auxiliary/cci_nested_lib.rs b/src/test/auxiliary/cci_nested_lib.rs index 8494917c61..587af956c7 100644 --- a/src/test/auxiliary/cci_nested_lib.rs +++ b/src/test/auxiliary/cci_nested_lib.rs @@ -35,7 +35,7 @@ pub fn alist_get B { let eq_fn = lst.eq_fn; let data = lst.data.borrow(); - for entry in (*data).iter() { + for entry in &(*data) { if eq_fn(entry.key.clone(), k.clone()) { return entry.value.clone(); } diff --git a/src/test/auxiliary/cci_no_inline_lib.rs b/src/test/auxiliary/cci_no_inline_lib.rs index 474925d883..ce04111890 100644 --- a/src/test/auxiliary/cci_no_inline_lib.rs +++ b/src/test/auxiliary/cci_no_inline_lib.rs @@ -13,10 +13,10 @@ // same as cci_iter_lib, more-or-less, but not marked inline pub fn iter(v: Vec , mut f: F) where F: FnMut(uint) { - let mut i = 0u; + let mut i = 0_usize; let n = v.len(); while i < n { f(v[i]); - i += 1u; + i += 1_usize; } } diff --git a/src/test/auxiliary/coherence-orphan-lib.rs b/src/test/auxiliary/coherence-orphan-lib.rs index 2e5d18b58f..cc42b288e6 100644 --- a/src/test/auxiliary/coherence-orphan-lib.rs +++ b/src/test/auxiliary/coherence-orphan-lib.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub trait TheTrait { +pub trait TheTrait : ::std::marker::PhantomFn { fn the_fn(&self); } diff --git a/src/test/auxiliary/default_type_params_xc.rs b/src/test/auxiliary/default_type_params_xc.rs index d12f716dec..0a65174911 100644 --- a/src/test/auxiliary/default_type_params_xc.rs +++ b/src/test/auxiliary/default_type_params_xc.rs @@ -12,4 +12,5 @@ pub struct Heap; pub struct FakeHeap; -pub struct FakeVec; +pub struct FakeVec { pub f: Option<(T,A)> } + diff --git a/src/test/auxiliary/i8.rs b/src/test/auxiliary/i8.rs new file mode 100644 index 0000000000..44e62b99a9 --- /dev/null +++ b/src/test/auxiliary/i8.rs @@ -0,0 +1,13 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// A crate named after a built-in type. + +pub struct Test; diff --git a/src/test/auxiliary/inherited_stability.rs b/src/test/auxiliary/inherited_stability.rs index 7a01ce3de0..77eb82f802 100644 --- a/src/test/auxiliary/inherited_stability.rs +++ b/src/test/auxiliary/inherited_stability.rs @@ -9,52 +9,47 @@ // except according to those terms. #![crate_name="inherited_stability"] #![crate_type = "lib"] -#![unstable] +#![unstable(feature = "test_feature")] +#![feature(staged_api)] #![staged_api] -pub fn experimental() {} +pub fn unstable() {} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub fn stable() {} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub mod stable_mod { - pub fn experimental() {} + pub fn unstable() {} - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn stable() {} } -#[unstable] +#[unstable(feature = "test_feature")] pub mod unstable_mod { - #[unstable] - pub fn experimental() {} + #[stable(feature = "test_feature", since = "1.0.0")] + #[deprecated(since = "1.0.0")] + pub fn deprecated() {} pub fn unstable() {} } -pub mod experimental_mod { - pub fn experimental() {} - - #[stable] - pub fn stable() {} -} - -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Stable { - fn experimental(&self); + fn unstable(&self); - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn stable(&self); } impl Stable for uint { - fn experimental(&self) {} + fn unstable(&self) {} fn stable(&self) {} } -pub enum Experimental { - ExperimentalVariant, - #[stable] +pub enum Unstable { + UnstableVariant, + #[stable(feature = "rust1", since = "1.0.0")] StableVariant } diff --git a/src/test/auxiliary/inner_static.rs b/src/test/auxiliary/inner_static.rs index 94acea0661..ca5c6072cb 100644 --- a/src/test/auxiliary/inner_static.rs +++ b/src/test/auxiliary/inner_static.rs @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub struct A; -pub struct B; +pub struct A { pub v: T } +pub struct B { pub v: T } pub mod test { - pub struct A; + pub struct A { pub v: T } impl A { pub fn foo(&self) -> int { @@ -52,9 +52,9 @@ impl B { } pub fn foo() -> int { - let a = A::<()>; - let b = B::<()>; - let c = test::A::<()>; + let a = A { v: () }; + let b = B { v: () }; + let c = test::A { v: () }; return a.foo() + a.bar() + b.foo() + b.bar() + c.foo() + c.bar(); diff --git a/src/test/auxiliary/issue-10028.rs b/src/test/auxiliary/issue-10028.rs index 00fdb3e40b..a21deb44fc 100644 --- a/src/test/auxiliary/issue-10028.rs +++ b/src/test/auxiliary/issue-10028.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(unsafe_no_drop_flag)] + #[unsafe_no_drop_flag] pub struct ZeroLengthThingWithDestructor; impl Drop for ZeroLengthThingWithDestructor { diff --git a/src/test/auxiliary/issue-11224.rs b/src/test/auxiliary/issue-11224.rs index d66cfe9bf6..560844332a 100644 --- a/src/test/auxiliary/issue-11224.rs +++ b/src/test/auxiliary/issue-11224.rs @@ -21,6 +21,6 @@ mod inner { } pub fn foo() { - let a = &1i as &inner::Trait; + let a = &1 as &inner::Trait; a.f(); } diff --git a/src/test/auxiliary/issue-14421.rs b/src/test/auxiliary/issue-14421.rs index 7c69cba179..a48088609f 100644 --- a/src/test/auxiliary/issue-14421.rs +++ b/src/test/auxiliary/issue-14421.rs @@ -10,6 +10,7 @@ #![crate_type="lib"] #![deny(warnings)] +#![allow(dead_code)] pub use src::aliases::B; pub use src::hidden_core::make; @@ -23,9 +24,9 @@ mod src { pub mod hidden_core { use super::aliases::B; - pub struct A; + pub struct A { t: T } - pub fn make() -> B { A } + pub fn make() -> B { A { t: 1.0 } } impl A { pub fn foo(&mut self) { println!("called foo"); } diff --git a/src/test/auxiliary/issue-14422.rs b/src/test/auxiliary/issue-14422.rs index 9ecb1195de..3e23698397 100644 --- a/src/test/auxiliary/issue-14422.rs +++ b/src/test/auxiliary/issue-14422.rs @@ -23,10 +23,9 @@ mod src { pub mod hidden_core { use super::aliases::B; + #[derive(Copy)] pub struct A; - impl Copy for A {} - pub fn make() -> B { A } impl A { diff --git a/src/test/auxiliary/issue-16643.rs b/src/test/auxiliary/issue-16643.rs index c3f7f2d1aa..b590160a0c 100644 --- a/src/test/auxiliary/issue-16643.rs +++ b/src/test/auxiliary/issue-16643.rs @@ -10,12 +10,12 @@ #![crate_type = "lib"] -pub struct TreeBuilder; +pub struct TreeBuilder { pub h: H } impl TreeBuilder { pub fn process_token(&mut self) { match self { - _ => for _y in *self {} + _ => for _y in self.by_ref() {} } } } diff --git a/src/test/auxiliary/issue-17662.rs b/src/test/auxiliary/issue-17662.rs index be10ca1dd8..fb55a07700 100644 --- a/src/test/auxiliary/issue-17662.rs +++ b/src/test/auxiliary/issue-17662.rs @@ -11,7 +11,7 @@ #![crate_type = "lib"] pub trait Foo<'a, T> { - fn foo(&self) -> T; + fn foo(&'a self) -> T; } pub fn foo<'a, T>(x: &'a Foo<'a, T>) -> T { diff --git a/src/test/auxiliary/issue-17718.rs b/src/test/auxiliary/issue-17718.rs index 689610d799..cbe56b00c1 100644 --- a/src/test/auxiliary/issue-17718.rs +++ b/src/test/auxiliary/issue-17718.rs @@ -11,12 +11,12 @@ use std::sync::atomic; pub const C1: uint = 1; -pub const C2: atomic::AtomicUint = atomic::ATOMIC_UINT_INIT; +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 static S1: uint = 3; -pub static S2: atomic::AtomicUint = atomic::ATOMIC_UINT_INIT; +pub static S2: atomic::AtomicUsize = atomic::ATOMIC_USIZE_INIT; fn foo() {} diff --git a/src/test/auxiliary/issue-18711.rs b/src/test/auxiliary/issue-18711.rs index 54f1595780..a29dcc00cd 100644 --- a/src/test/auxiliary/issue-18711.rs +++ b/src/test/auxiliary/issue-18711.rs @@ -12,5 +12,5 @@ #![crate_type = "rlib"] pub fn inner(f: F) -> F { - (move |:| f)() + (move || f)() } diff --git a/src/test/auxiliary/issue-21146-inc.rs b/src/test/auxiliary/issue-21146-inc.rs new file mode 100644 index 0000000000..1b740d112e --- /dev/null +++ b/src/test/auxiliary/issue-21146-inc.rs @@ -0,0 +1,13 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// include file for issue-21146.rs + +parse_error diff --git a/src/test/auxiliary/issue-21202.rs b/src/test/auxiliary/issue-21202.rs new file mode 100644 index 0000000000..afdbf78aa8 --- /dev/null +++ b/src/test/auxiliary/issue-21202.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod A { + pub struct Foo; + impl Foo { + fn foo(&self) { } + } +} diff --git a/src/test/auxiliary/issue-2380.rs b/src/test/auxiliary/issue-2380.rs index 8eb6cd6e26..96f33f97a6 100644 --- a/src/test/auxiliary/issue-2380.rs +++ b/src/test/auxiliary/issue-2380.rs @@ -14,7 +14,10 @@ #![allow(unknown_features)] #![feature(box_syntax)] -pub trait i { } +pub trait i +{ + fn dummy(&self, t: T) -> T { panic!() } +} pub fn f() -> Box+'static> { impl i for () { } diff --git a/src/test/auxiliary/issue-2526.rs b/src/test/auxiliary/issue-2526.rs index e3ce4e8f65..89b3b56121 100644 --- a/src/test/auxiliary/issue-2526.rs +++ b/src/test/auxiliary/issue-2526.rs @@ -13,8 +13,11 @@ #![feature(unsafe_destructor)] +use std::marker; + struct arc_destruct { - _data: int, + _data: int, + _marker: marker::PhantomData } #[unsafe_destructor] @@ -24,7 +27,8 @@ impl Drop for arc_destruct { fn arc_destruct(data: int) -> arc_destruct { arc_destruct { - _data: data + _data: data, + _marker: marker::PhantomData } } diff --git a/src/test/auxiliary/issue-2631-a.rs b/src/test/auxiliary/issue-2631-a.rs index e340331dbf..dd1ad413a3 100644 --- a/src/test/auxiliary/issue-2631-a.rs +++ b/src/test/auxiliary/issue-2631-a.rs @@ -19,5 +19,6 @@ pub type header_map = HashMap>>>>; // the unused ty param is necessary so this gets monomorphized pub fn request(req: &header_map) { - let _x = req["METHOD".to_string()].clone().borrow().clone()[0].clone(); + let data = req["METHOD".to_string()].clone(); + let _x = data.borrow().clone()[0].clone(); } diff --git a/src/test/auxiliary/issue-8044.rs b/src/test/auxiliary/issue-8044.rs index 7096146a43..7bfd2e7964 100644 --- a/src/test/auxiliary/issue-8044.rs +++ b/src/test/auxiliary/issue-8044.rs @@ -21,5 +21,5 @@ pub fn leaf(value: V) -> TreeItem { } fn main() { - BTree:: { node: leaf(1i) }; + BTree:: { node: leaf(1) }; } diff --git a/src/test/auxiliary/issue-9906.rs b/src/test/auxiliary/issue-9906.rs index c0cb501735..1e746bf39d 100644 --- a/src/test/auxiliary/issue-9906.rs +++ b/src/test/auxiliary/issue-9906.rs @@ -22,6 +22,6 @@ mod other { } pub fn foo(){ - 1i+1; + 1+1; } } diff --git a/src/test/auxiliary/issue13213aux.rs b/src/test/auxiliary/issue13213aux.rs index cf8d0c167a..227fab7304 100644 --- a/src/test/auxiliary/issue13213aux.rs +++ b/src/test/auxiliary/issue13213aux.rs @@ -13,19 +13,18 @@ pub use private::P; +#[derive(Copy)] pub struct S { p: P, } mod private { + #[derive(Copy)] pub struct P { p: i32, } pub const THREE: P = P { p: 3 }; - impl Copy for P {} } pub static A: S = S { p: private::THREE }; -impl Copy for S {} - diff --git a/src/test/auxiliary/issue13507.rs b/src/test/auxiliary/issue13507.rs index c2820a8d4a..f24721adb5 100644 --- a/src/test/auxiliary/issue13507.rs +++ b/src/test/auxiliary/issue13507.rs @@ -9,7 +9,7 @@ // except according to those terms. pub mod testtypes { - use std::intrinsics::TypeId; + use std::any::TypeId; pub fn type_ids() -> Vec { let mut ids = vec!(); diff --git a/src/test/auxiliary/issue_20389.rs b/src/test/auxiliary/issue_20389.rs index 7a378b06df..4ce7e3079e 100644 --- a/src/test/auxiliary/issue_20389.rs +++ b/src/test/auxiliary/issue_20389.rs @@ -10,4 +10,5 @@ pub trait T { type C; + fn dummy(&self) { } } diff --git a/src/test/auxiliary/issue_3907.rs b/src/test/auxiliary/issue_3907.rs index 2e254e5431..545e15fe16 100644 --- a/src/test/auxiliary/issue_3907.rs +++ b/src/test/auxiliary/issue_3907.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub trait Foo { +use std::marker::MarkerTrait; + +pub trait Foo : MarkerTrait { fn bar(); } diff --git a/src/test/auxiliary/issue_8401.rs b/src/test/auxiliary/issue_8401.rs index 0831993119..9006a5d177 100644 --- a/src/test/auxiliary/issue_8401.rs +++ b/src/test/auxiliary/issue_8401.rs @@ -12,7 +12,9 @@ use std::mem; -trait A {} +trait A { + fn dummy(&self) { } +} struct B; impl A for B {} diff --git a/src/test/auxiliary/issue_9123.rs b/src/test/auxiliary/issue_9123.rs index 000cc100a1..4f2792aebc 100644 --- a/src/test/auxiliary/issue_9123.rs +++ b/src/test/auxiliary/issue_9123.rs @@ -15,5 +15,6 @@ pub trait X { fn f() { } f(); } + fn dummy(&self) { } } diff --git a/src/test/auxiliary/lang-item-public.rs b/src/test/auxiliary/lang-item-public.rs index e99a8f0b87..b9cc20b63c 100644 --- a/src/test/auxiliary/lang-item-public.rs +++ b/src/test/auxiliary/lang-item-public.rs @@ -8,11 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(no_std)] #![no_std] #![feature(lang_items)] +#[lang="phantom_fn"] +pub trait PhantomFn { } +impl PhantomFn for U { } + #[lang="sized"] -pub trait Sized {} +pub trait Sized : PhantomFn {} #[lang="panic"] fn panic(_: &(&'static str, &'static str, uint)) -> ! { loop {} } @@ -24,6 +29,8 @@ extern fn stack_exhausted() {} extern fn eh_personality() {} #[lang="copy"] -pub trait Copy {} +pub trait Copy : PhantomFn { + // Empty. +} diff --git a/src/test/auxiliary/lint_group_plugin_test.rs b/src/test/auxiliary/lint_group_plugin_test.rs index ae9804423b..e9d98889ff 100644 --- a/src/test/auxiliary/lint_group_plugin_test.rs +++ b/src/test/auxiliary/lint_group_plugin_test.rs @@ -37,9 +37,9 @@ impl LintPass for Pass { fn check_item(&mut self, cx: &Context, it: &ast::Item) { let name = token::get_ident(it.ident); - if name.get() == "lintme" { + if &name[..] == "lintme" { cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"); - } else if name.get() == "pleaselintme" { + } else if &name[..] == "pleaselintme" { cx.span_lint(PLEASE_LINT, it.span, "item is named 'pleaselintme'"); } } diff --git a/src/test/auxiliary/lint_output_format.rs b/src/test/auxiliary/lint_output_format.rs index adbb90fe6c..1977e2aad2 100755 --- a/src/test/auxiliary/lint_output_format.rs +++ b/src/test/auxiliary/lint_output_format.rs @@ -10,19 +10,22 @@ #![crate_name="lint_output_format"] #![crate_type = "lib"] +#![feature(staged_api)] #![staged_api] +#![unstable(feature = "test_feature")] -#[deprecated] +#[stable(feature = "test_feature", since = "1.0.0")] +#[deprecated(since = "1.0.0")] pub fn foo() -> uint { 20 } -#[unstable] +#[unstable(feature = "test_feature")] pub fn bar() -> uint { 40 } -#[unstable] +#[unstable(feature = "test_feature")] pub fn baz() -> uint { 30 } diff --git a/src/test/auxiliary/lint_plugin_test.rs b/src/test/auxiliary/lint_plugin_test.rs index 06051b8749..ffb234f70c 100644 --- a/src/test/auxiliary/lint_plugin_test.rs +++ b/src/test/auxiliary/lint_plugin_test.rs @@ -35,7 +35,7 @@ impl LintPass for Pass { fn check_item(&mut self, cx: &Context, it: &ast::Item) { let name = token::get_ident(it.ident); - if name.get() == "lintme" { + if &name[..] == "lintme" { cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"); } } diff --git a/src/test/auxiliary/lint_stability.rs b/src/test/auxiliary/lint_stability.rs index 73724713b2..fb535eb833 100644 --- a/src/test/auxiliary/lint_stability.rs +++ b/src/test/auxiliary/lint_stability.rs @@ -9,174 +9,142 @@ // except according to those terms. #![crate_name="lint_stability"] #![crate_type = "lib"] +#![feature(staged_api)] #![staged_api] +#![stable(feature = "lint_stability", since = "1.0.0")] -#[deprecated] +#[stable(feature = "test_feature", since = "1.0.0")] +#[deprecated(since = "1.0.0")] pub fn deprecated() {} -#[deprecated="text"] +#[stable(feature = "test_feature", since = "1.0.0")] +#[deprecated(since = "1.0.0", reason = "text")] pub fn deprecated_text() {} -#[unstable] -pub fn experimental() {} -#[unstable="text"] -pub fn experimental_text() {} +#[unstable(feature = "test_feature")] +#[deprecated(since = "1.0.0")] +pub fn deprecated_unstable() {} +#[unstable(feature = "test_feature")] +#[deprecated(since = "1.0.0", reason = "text")] +pub fn deprecated_unstable_text() {} -#[unstable] +#[unstable(feature = "test_feature")] pub fn unstable() {} -#[unstable="text"] +#[unstable(feature = "test_feature", reason = "text")] pub fn unstable_text() {} -pub fn unmarked() {} - -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub fn stable() {} -#[stable="text"] +#[stable(feature = "rust1", since = "1.0.0", reason = "text")] pub fn stable_text() {} -#[locked] -pub fn locked() {} -#[locked="text"] -pub fn locked_text() {} - -#[frozen] -pub fn frozen() {} -#[frozen="text"] -pub fn frozen_text() {} - -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct MethodTester; impl MethodTester { - #[deprecated] + #[stable(feature = "test_feature", since = "1.0.0")] + #[deprecated(since = "1.0.0")] pub fn method_deprecated(&self) {} - #[deprecated="text"] + #[stable(feature = "test_feature", since = "1.0.0")] + #[deprecated(since = "1.0.0", reason = "text")] pub fn method_deprecated_text(&self) {} - #[unstable] - pub fn method_experimental(&self) {} - #[unstable="text"] - pub fn method_experimental_text(&self) {} + #[unstable(feature = "test_feature")] + #[deprecated(since = "1.0.0")] + pub fn method_deprecated_unstable(&self) {} + #[unstable(feature = "test_feature")] + #[deprecated(since = "1.0.0", reason = "text")] + pub fn method_deprecated_unstable_text(&self) {} - #[unstable] + #[unstable(feature = "test_feature")] pub fn method_unstable(&self) {} - #[unstable="text"] + #[unstable(feature = "test_feature", reason = "text")] pub fn method_unstable_text(&self) {} - pub fn method_unmarked(&self) {} - - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn method_stable(&self) {} - #[stable="text"] + #[stable(feature = "rust1", since = "1.0.0", reason = "text")] pub fn method_stable_text(&self) {} - - #[locked] - pub fn method_locked(&self) {} - #[locked="text"] - pub fn method_locked_text(&self) {} - - #[frozen] - pub fn method_frozen(&self) {} - #[frozen="text"] - pub fn method_frozen_text(&self) {} } +#[stable(feature = "test_feature", since = "1.0.0")] pub trait Trait { - #[deprecated] + #[stable(feature = "test_feature", since = "1.0.0")] + #[deprecated(since = "1.0.0")] fn trait_deprecated(&self) {} - #[deprecated="text"] + #[stable(feature = "test_feature", since = "1.0.0")] + #[deprecated(since = "1.0.0", reason = "text")] fn trait_deprecated_text(&self) {} - #[unstable] - fn trait_experimental(&self) {} - #[unstable="text"] - fn trait_experimental_text(&self) {} + #[unstable(feature = "test_feature")] + #[deprecated(since = "1.0.0")] + fn trait_deprecated_unstable(&self) {} + #[unstable(feature = "test_feature")] + #[deprecated(since = "1.0.0", reason = "text")] + fn trait_deprecated_unstable_text(&self) {} - #[unstable] + #[unstable(feature = "test_feature")] fn trait_unstable(&self) {} - #[unstable="text"] + #[unstable(feature = "test_feature", reason = "text")] fn trait_unstable_text(&self) {} - fn trait_unmarked(&self) {} - - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn trait_stable(&self) {} - #[stable="text"] + #[stable(feature = "rust1", since = "1.0.0", reason = "text")] fn trait_stable_text(&self) {} - - #[locked] - fn trait_locked(&self) {} - #[locked="text"] - fn trait_locked_text(&self) {} - - #[frozen] - fn trait_frozen(&self) {} - #[frozen="text"] - fn trait_frozen_text(&self) {} } impl Trait for MethodTester {} -#[unstable] -pub trait ExperimentalTrait {} +#[unstable(feature = "test_feature")] +pub trait UnstableTrait { fn dummy(&self) { } } -#[deprecated] +#[stable(feature = "test_feature", since = "1.0.0")] +#[deprecated(since = "1.0.0")] pub struct DeprecatedStruct { pub i: int } -#[unstable] -pub struct ExperimentalStruct { pub i: int } -#[unstable] +#[unstable(feature = "test_feature")] +#[deprecated(since = "1.0.0")] +pub struct DeprecatedUnstableStruct { pub i: int } +#[unstable(feature = "test_feature")] pub struct UnstableStruct { pub i: int } -pub struct UnmarkedStruct { pub i: int } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct StableStruct { pub i: int } -#[frozen] -pub struct FrozenStruct { pub i: int } -#[locked] -pub struct LockedStruct { pub i: int } -#[deprecated] +#[stable(feature = "test_feature", since = "1.0.0")] +#[deprecated(since = "1.0.0")] pub struct DeprecatedUnitStruct; -#[unstable] -pub struct ExperimentalUnitStruct; -#[unstable] +#[unstable(feature = "test_feature")] +#[deprecated(since = "1.0.0")] +pub struct DeprecatedUnstableUnitStruct; +#[unstable(feature = "test_feature")] pub struct UnstableUnitStruct; -pub struct UnmarkedUnitStruct; -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct StableUnitStruct; -#[frozen] -pub struct FrozenUnitStruct; -#[locked] -pub struct LockedUnitStruct; +#[stable(feature = "test_feature", since = "1.0.0")] pub enum Enum { - #[deprecated] + #[stable(feature = "test_feature", since = "1.0.0")] + #[deprecated(since = "1.0.0")] DeprecatedVariant, - #[unstable] - ExperimentalVariant, - #[unstable] + #[unstable(feature = "test_feature")] + #[deprecated(since = "1.0.0")] + DeprecatedUnstableVariant, + #[unstable(feature = "test_feature")] UnstableVariant, - UnmarkedVariant, - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] StableVariant, - #[frozen] - FrozenVariant, - #[locked] - LockedVariant, } -#[deprecated] +#[stable(feature = "test_feature", since = "1.0.0")] +#[deprecated(since = "1.0.0")] pub struct DeprecatedTupleStruct(pub int); -#[unstable] -pub struct ExperimentalTupleStruct(pub int); -#[unstable] +#[unstable(feature = "test_feature")] +#[deprecated(since = "1.0.0")] +pub struct DeprecatedUnstableTupleStruct(pub int); +#[unstable(feature = "test_feature")] pub struct UnstableTupleStruct(pub int); -pub struct UnmarkedTupleStruct(pub int); -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct StableTupleStruct(pub int); -#[frozen] -pub struct FrozenTupleStruct(pub int); -#[locked] -pub struct LockedTupleStruct(pub int); #[macro_export] macro_rules! macro_test { diff --git a/src/test/auxiliary/logging_right_crate.rs b/src/test/auxiliary/logging_right_crate.rs index 67037a3ac9..bf4ab975ce 100644 --- a/src/test/auxiliary/logging_right_crate.rs +++ b/src/test/auxiliary/logging_right_crate.rs @@ -12,5 +12,5 @@ pub fn foo() { fn death() -> int { panic!() } - debug!("{}", (|&:|{ death() })()); + debug!("{}", (||{ death() })()); } diff --git a/src/test/auxiliary/macro_crate_test.rs b/src/test/auxiliary/macro_crate_test.rs index 9eeb7ee885..d545a42ae1 100644 --- a/src/test/auxiliary/macro_crate_test.rs +++ b/src/test/auxiliary/macro_crate_test.rs @@ -1,4 +1,4 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -16,7 +16,7 @@ extern crate syntax; extern crate rustc; -use syntax::ast::{TokenTree, Item, MetaItem}; +use syntax::ast::{TokenTree, Item, MetaItem, ImplItem, TraitItem, Method}; use syntax::codemap::Span; use syntax::ext::base::*; use syntax::parse::token; @@ -25,9 +25,9 @@ use syntax::ptr::P; use rustc::plugin::Registry; #[macro_export] -macro_rules! exported_macro { () => (2i) } +macro_rules! exported_macro { () => (2) } -macro_rules! unexported_macro { () => (3i) } +macro_rules! unexported_macro { () => (3) } #[plugin_registrar] pub fn plugin_registrar(reg: &mut Registry) { @@ -37,6 +37,9 @@ pub fn plugin_registrar(reg: &mut Registry) { reg.register_syntax_extension( token::intern("into_foo"), Modifier(box expand_into_foo)); + reg.register_syntax_extension( + token::intern("into_multi_foo"), + MultiModifier(box expand_into_foo_multi)); } fn expand_make_a_1(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) @@ -44,7 +47,7 @@ fn expand_make_a_1(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) if !tts.is_empty() { cx.span_fatal(sp, "make_a_1 takes no arguments"); } - MacExpr::new(quote_expr!(cx, 1i)) + MacExpr::new(quote_expr!(cx, 1)) } // See Issue #15750 @@ -65,6 +68,30 @@ fn expand_into_foo(cx: &mut ExtCtxt, sp: Span, attr: &MetaItem, it: P) }) } +fn expand_into_foo_multi(cx: &mut ExtCtxt, + sp: Span, + attr: &MetaItem, + it: Annotatable) -> Annotatable { + match it { + Annotatable::Item(it) => { + Annotatable::Item(P(Item { + attrs: it.attrs.clone(), + ..(*quote_item!(cx, enum Foo2 { Bar2, Baz2 }).unwrap()).clone() + })) + } + Annotatable::ImplItem(it) => { + Annotatable::ImplItem(ImplItem::MethodImplItem( + quote_method!(cx, fn foo(&self) -> i32 { 42 }) + )) + } + Annotatable::TraitItem(it) => { + Annotatable::TraitItem(TraitItem::ProvidedMethod( + quote_method!(cx, fn foo(&self) -> i32 { 0 }) + )) + } + } +} + fn expand_forged_ident(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box { use syntax::ext::quote::rt::*; diff --git a/src/test/auxiliary/macro_reexport_1.rs b/src/test/auxiliary/macro_reexport_1.rs index a913749bc6..9c72cb1a68 100644 --- a/src/test/auxiliary/macro_reexport_1.rs +++ b/src/test/auxiliary/macro_reexport_1.rs @@ -11,5 +11,5 @@ #![crate_type = "dylib"] #[macro_export] macro_rules! reexported { - () => ( 3u ) + () => ( 3_usize ) } diff --git a/src/test/auxiliary/macro_reexport_2.rs b/src/test/auxiliary/macro_reexport_2.rs index 15d9f9cc91..3918be88d8 100644 --- a/src/test/auxiliary/macro_reexport_2.rs +++ b/src/test/auxiliary/macro_reexport_2.rs @@ -9,6 +9,7 @@ // except according to those terms. #![crate_type = "dylib"] +#![feature(macro_reexport)] #[macro_reexport(reexported)] #[macro_use] #[no_link] diff --git a/src/test/auxiliary/macro_reexport_2_no_use.rs b/src/test/auxiliary/macro_reexport_2_no_use.rs index 63142b0a69..1d3dc26b0b 100644 --- a/src/test/auxiliary/macro_reexport_2_no_use.rs +++ b/src/test/auxiliary/macro_reexport_2_no_use.rs @@ -9,6 +9,7 @@ // except according to those terms. #![crate_type = "dylib"] +#![feature(macro_reexport)] #[macro_reexport(reexported)] #[no_link] diff --git a/src/test/auxiliary/macro_with_super_1.rs b/src/test/auxiliary/macro_with_super_1.rs new file mode 100644 index 0000000000..fd2e52bb35 --- /dev/null +++ b/src/test/auxiliary/macro_with_super_1.rs @@ -0,0 +1,26 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "lib"] + +#[macro_export] +macro_rules! declare { + () => ( + pub fn aaa() {} + + pub mod bbb { + use super::aaa; + + pub fn ccc() { + aaa(); + } + } + ) +} diff --git a/src/test/auxiliary/method_self_arg1.rs b/src/test/auxiliary/method_self_arg1.rs index 5865a8f467..643442363a 100644 --- a/src/test/auxiliary/method_self_arg1.rs +++ b/src/test/auxiliary/method_self_arg1.rs @@ -17,10 +17,9 @@ static mut COUNT: u64 = 1; pub fn get_count() -> u64 { unsafe { COUNT } } +#[derive(Copy)] pub struct Foo; -impl Copy for Foo {} - impl Foo { pub fn foo(self, x: &Foo) { unsafe { COUNT *= 2; } diff --git a/src/test/auxiliary/method_self_arg2.rs b/src/test/auxiliary/method_self_arg2.rs index a28a877a37..fd99da87e6 100644 --- a/src/test/auxiliary/method_self_arg2.rs +++ b/src/test/auxiliary/method_self_arg2.rs @@ -17,10 +17,9 @@ static mut COUNT: u64 = 1; pub fn get_count() -> u64 { unsafe { COUNT } } +#[derive(Copy)] pub struct Foo; -impl Copy for Foo {} - impl Foo { pub fn run_trait(self) { unsafe { COUNT *= 17; } diff --git a/src/test/auxiliary/nested_item.rs b/src/test/auxiliary/nested_item.rs index 21784bda27..fc1bea5a9f 100644 --- a/src/test/auxiliary/nested_item.rs +++ b/src/test/auxiliary/nested_item.rs @@ -25,7 +25,7 @@ impl Foo { } // issue 8134 -pub struct Parser; +pub struct Parser(T); impl> Parser { fn in_doctype(&mut self) { static DOCTYPEPattern: [char; 6] = ['O', 'C', 'T', 'Y', 'P', 'E']; diff --git a/src/test/auxiliary/no_method_suggested_traits.rs b/src/test/auxiliary/no_method_suggested_traits.rs new file mode 100644 index 0000000000..20cebb9be1 --- /dev/null +++ b/src/test/auxiliary/no_method_suggested_traits.rs @@ -0,0 +1,46 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub use reexport::Reexported; + +pub struct Foo; +pub enum Bar { X } + +pub mod foo { + pub trait PubPub { + fn method(&self) {} + + fn method3(&self) {} + } + + impl PubPub for u32 {} + impl PubPub for i32 {} +} +pub mod bar { + trait PubPriv { + fn method(&self); + } +} +mod qux { + pub trait PrivPub { + fn method(&self); + } +} +mod quz { + trait PrivPriv { + fn method(&self); + } +} + +mod reexport { + pub trait Reexported { + fn method(&self); + } +} diff --git a/src/test/auxiliary/no_std_crate.rs b/src/test/auxiliary/no_std_crate.rs index 7cfae6d121..d830aef54f 100644 --- a/src/test/auxiliary/no_std_crate.rs +++ b/src/test/auxiliary/no_std_crate.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(no_std)] #![no_std] pub fn foo() {} diff --git a/src/test/auxiliary/orphan_check_diagnostics.rs b/src/test/auxiliary/orphan_check_diagnostics.rs new file mode 100644 index 0000000000..cf3e9903b5 --- /dev/null +++ b/src/test/auxiliary/orphan_check_diagnostics.rs @@ -0,0 +1,11 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub trait RemoteTrait { fn dummy(&self) { } } diff --git a/src/test/auxiliary/overloaded_autoderef_xc.rs b/src/test/auxiliary/overloaded_autoderef_xc.rs index caa9bbe573..3c8cba13ae 100644 --- a/src/test/auxiliary/overloaded_autoderef_xc.rs +++ b/src/test/auxiliary/overloaded_autoderef_xc.rs @@ -11,7 +11,8 @@ use std::ops::Deref; struct DerefWithHelper { - pub helper: H + pub helper: H, + pub value: Option } trait Helper { @@ -34,6 +35,6 @@ impl> Deref for DerefWithHelper { // Test cross-crate autoderef + vtable. pub fn check(x: T, y: T) -> bool { - let d: DerefWithHelper, T> = DerefWithHelper { helper: Some(x) }; + let d: DerefWithHelper, T> = DerefWithHelper { helper: Some(x), value: None }; d.eq(&y) } diff --git a/src/test/auxiliary/plugin_args.rs b/src/test/auxiliary/plugin_args.rs index e01a95d461..d0ab944813 100644 --- a/src/test/auxiliary/plugin_args.rs +++ b/src/test/auxiliary/plugin_args.rs @@ -27,7 +27,7 @@ use syntax::ptr::P; use rustc::plugin::Registry; struct Expander { - args: P, + args: Vec>, } impl TTMacroExpander for Expander { @@ -35,10 +35,9 @@ impl TTMacroExpander for Expander { ecx: &'cx mut ExtCtxt, sp: Span, _: &[ast::TokenTree]) -> Box { - - let attr = ecx.attribute(sp, self.args.clone()); - let src = pprust::attribute_to_string(&attr); - let interned = token::intern_and_get_ident(src.as_slice()); + let args = self.args.iter().map(|i| pprust::meta_item_to_string(&*i)) + .collect::>().connect(", "); + let interned = token::intern_and_get_ident(&args[..]); MacExpr::new(ecx.expr_str(sp, interned)) } } diff --git a/src/test/auxiliary/plugin_with_plugin_lib.rs b/src/test/auxiliary/plugin_with_plugin_lib.rs new file mode 100644 index 0000000000..cfc8c01532 --- /dev/null +++ b/src/test/auxiliary/plugin_with_plugin_lib.rs @@ -0,0 +1,22 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// force-host + +#![feature(plugin_registrar)] +#![deny(plugin_as_library)] // should have no effect in a plugin crate + +extern crate macro_crate_test; +extern crate rustc; + +use rustc::plugin::Registry; + +#[plugin_registrar] +pub fn plugin_registrar(_: &mut Registry) { } diff --git a/src/test/auxiliary/private_trait_xc.rs b/src/test/auxiliary/private_trait_xc.rs index 37ee10c8d3..4269157949 100644 --- a/src/test/auxiliary/private_trait_xc.rs +++ b/src/test/auxiliary/private_trait_xc.rs @@ -8,4 +8,4 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Foo {} +trait Foo : ::std::marker::MarkerTrait {} diff --git a/src/test/auxiliary/roman_numerals.rs b/src/test/auxiliary/roman_numerals.rs index 519f32fc24..e05aa16ba5 100644 --- a/src/test/auxiliary/roman_numerals.rs +++ b/src/test/auxiliary/roman_numerals.rs @@ -20,7 +20,7 @@ use syntax::codemap::Span; use syntax::parse::token; use syntax::ast::{TokenTree, TtToken}; use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacExpr}; -use syntax::ext::build::AstBuilder; // trait for expr_uint +use syntax::ext::build::AstBuilder; // trait for expr_usize use rustc::plugin::Registry; // WARNING WARNING WARNING WARNING WARNING @@ -46,13 +46,13 @@ fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree]) } }; - let mut text = text.as_slice(); - let mut total = 0u; + let mut text = &*text; + let mut total = 0_usize; while !text.is_empty() { match NUMERALS.iter().find(|&&(rn, _)| text.starts_with(rn)) { Some(&(rn, val)) => { total += val; - text = text.slice_from(rn.len()); + text = &text[rn.len()..]; } None => { cx.span_err(sp, "invalid Roman numeral"); @@ -61,7 +61,7 @@ fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree]) } } - MacExpr::new(cx.expr_uint(sp, total)) + MacExpr::new(cx.expr_usize(sp, total)) } #[plugin_registrar] diff --git a/src/test/auxiliary/stability_cfg1.rs b/src/test/auxiliary/stability_cfg1.rs index de806c65be..3a92cf5961 100644 --- a/src/test/auxiliary/stability_cfg1.rs +++ b/src/test/auxiliary/stability_cfg1.rs @@ -9,5 +9,6 @@ // except according to those terms. #![cfg_attr(foo, experimental)] -#![cfg_attr(not(foo), stable)] +#![cfg_attr(not(foo), stable(feature = "test_feature", since = "1.0.0"))] +#![feature(staged_api)] #![staged_api] diff --git a/src/test/auxiliary/stability_cfg2.rs b/src/test/auxiliary/stability_cfg2.rs index 842f35b08a..d9ed76e5c5 100644 --- a/src/test/auxiliary/stability_cfg2.rs +++ b/src/test/auxiliary/stability_cfg2.rs @@ -10,6 +10,7 @@ // compile-flags:--cfg foo -#![cfg_attr(foo, unstable)] -#![cfg_attr(not(foo), stable)] +#![cfg_attr(foo, unstable(feature = "test_feature"))] +#![cfg_attr(not(foo), stable(feature = "test_feature", since = "1.0.0"))] +#![feature(staged_api)] #![staged_api] diff --git a/src/test/auxiliary/static-methods-crate.rs b/src/test/auxiliary/static-methods-crate.rs index 1b18571cf8..d84ded2570 100644 --- a/src/test/auxiliary/static-methods-crate.rs +++ b/src/test/auxiliary/static-methods-crate.rs @@ -19,13 +19,13 @@ pub trait read { impl read for int { fn readMaybe(s: String) -> Option { - s.parse() + s.parse().ok() } } impl read for bool { fn readMaybe(s: String) -> Option { - match s.as_slice() { + match &*s { "true" => Some(true), "false" => Some(false), _ => None diff --git a/src/test/auxiliary/svh-a-base.rs b/src/test/auxiliary/svh-a-base.rs index 12833daf60..04f1062c16 100644 --- a/src/test/auxiliary/svh-a-base.rs +++ b/src/test/auxiliary/svh-a-base.rs @@ -15,12 +15,14 @@ #![crate_name = "a"] +use std::marker::MarkerTrait; + macro_rules! three { () => { 3 } } -pub trait U {} -pub trait V {} +pub trait U : MarkerTrait {} +pub trait V : MarkerTrait {} impl U for () {} impl V for () {} diff --git a/src/test/auxiliary/svh-a-change-lit.rs b/src/test/auxiliary/svh-a-change-lit.rs index 9e74bf2813..fabd2289e9 100644 --- a/src/test/auxiliary/svh-a-change-lit.rs +++ b/src/test/auxiliary/svh-a-change-lit.rs @@ -15,12 +15,14 @@ #![crate_name = "a"] +use std::marker::MarkerTrait; + macro_rules! three { () => { 3 } } -pub trait U {} -pub trait V {} +pub trait U : MarkerTrait {} +pub trait V : MarkerTrait {} impl U for () {} impl V for () {} diff --git a/src/test/auxiliary/svh-a-change-significant-cfg.rs b/src/test/auxiliary/svh-a-change-significant-cfg.rs index c900550041..3fdb861bd4 100644 --- a/src/test/auxiliary/svh-a-change-significant-cfg.rs +++ b/src/test/auxiliary/svh-a-change-significant-cfg.rs @@ -15,12 +15,14 @@ #![crate_name = "a"] +use std::marker::MarkerTrait; + macro_rules! three { () => { 3 } } -pub trait U {} -pub trait V {} +pub trait U : MarkerTrait {} +pub trait V : MarkerTrait {} impl U for () {} impl V for () {} diff --git a/src/test/auxiliary/svh-a-change-trait-bound.rs b/src/test/auxiliary/svh-a-change-trait-bound.rs index 04f8eb3cf9..3116d24673 100644 --- a/src/test/auxiliary/svh-a-change-trait-bound.rs +++ b/src/test/auxiliary/svh-a-change-trait-bound.rs @@ -15,12 +15,14 @@ #![crate_name = "a"] +use std::marker::MarkerTrait; + macro_rules! three { () => { 3 } } -pub trait U {} -pub trait V {} +pub trait U : MarkerTrait {} +pub trait V : MarkerTrait {} impl U for () {} impl V for () {} diff --git a/src/test/auxiliary/svh-a-change-type-arg.rs b/src/test/auxiliary/svh-a-change-type-arg.rs index c7e0a18768..b49a153362 100644 --- a/src/test/auxiliary/svh-a-change-type-arg.rs +++ b/src/test/auxiliary/svh-a-change-type-arg.rs @@ -15,12 +15,14 @@ #![crate_name = "a"] +use std::marker::MarkerTrait; + macro_rules! three { () => { 3 } } -pub trait U {} -pub trait V {} +pub trait U : MarkerTrait {} +pub trait V : MarkerTrait {} impl U for () {} impl V for () {} diff --git a/src/test/auxiliary/svh-a-change-type-ret.rs b/src/test/auxiliary/svh-a-change-type-ret.rs index 5100af3231..6562a93135 100644 --- a/src/test/auxiliary/svh-a-change-type-ret.rs +++ b/src/test/auxiliary/svh-a-change-type-ret.rs @@ -15,12 +15,14 @@ #![crate_name = "a"] +use std::marker::MarkerTrait; + macro_rules! three { () => { 3 } } -pub trait U {} -pub trait V {} +pub trait U : MarkerTrait {} +pub trait V : MarkerTrait {} impl U for () {} impl V for () {} diff --git a/src/test/auxiliary/svh-a-change-type-static.rs b/src/test/auxiliary/svh-a-change-type-static.rs index 077c33cb90..c7b392c6ee 100644 --- a/src/test/auxiliary/svh-a-change-type-static.rs +++ b/src/test/auxiliary/svh-a-change-type-static.rs @@ -15,12 +15,14 @@ #![crate_name = "a"] +use std::marker::MarkerTrait; + macro_rules! three { () => { 3 } } -pub trait U {} -pub trait V {} +pub trait U : MarkerTrait {} +pub trait V : MarkerTrait {} impl U for () {} impl V for () {} diff --git a/src/test/auxiliary/svh-a-comment.rs b/src/test/auxiliary/svh-a-comment.rs index d481fa5a1f..450f610202 100644 --- a/src/test/auxiliary/svh-a-comment.rs +++ b/src/test/auxiliary/svh-a-comment.rs @@ -15,12 +15,14 @@ #![crate_name = "a"] +use std::marker::MarkerTrait; + macro_rules! three { () => { 3 } } -pub trait U {} -pub trait V {} +pub trait U : MarkerTrait {} +pub trait V : MarkerTrait {} impl U for () {} impl V for () {} diff --git a/src/test/auxiliary/svh-a-doc.rs b/src/test/auxiliary/svh-a-doc.rs index 9e99a355ac..c000737c85 100644 --- a/src/test/auxiliary/svh-a-doc.rs +++ b/src/test/auxiliary/svh-a-doc.rs @@ -15,12 +15,14 @@ #![crate_name = "a"] +use std::marker::MarkerTrait; + macro_rules! three { () => { 3 } } -pub trait U {} -pub trait V {} +pub trait U : MarkerTrait {} +pub trait V : MarkerTrait {} impl U for () {} impl V for () {} diff --git a/src/test/auxiliary/svh-a-macro.rs b/src/test/auxiliary/svh-a-macro.rs index b8dd497ac9..1e12659dc4 100644 --- a/src/test/auxiliary/svh-a-macro.rs +++ b/src/test/auxiliary/svh-a-macro.rs @@ -15,12 +15,14 @@ #![crate_name = "a"] +use std::marker::MarkerTrait; + macro_rules! three { () => { 3 } } -pub trait U {} -pub trait V {} +pub trait U : MarkerTrait {} +pub trait V : MarkerTrait {} impl U for () {} impl V for () {} diff --git a/src/test/auxiliary/svh-a-no-change.rs b/src/test/auxiliary/svh-a-no-change.rs index 12833daf60..04f1062c16 100644 --- a/src/test/auxiliary/svh-a-no-change.rs +++ b/src/test/auxiliary/svh-a-no-change.rs @@ -15,12 +15,14 @@ #![crate_name = "a"] +use std::marker::MarkerTrait; + macro_rules! three { () => { 3 } } -pub trait U {} -pub trait V {} +pub trait U : MarkerTrait {} +pub trait V : MarkerTrait {} impl U for () {} impl V for () {} diff --git a/src/test/auxiliary/svh-a-redundant-cfg.rs b/src/test/auxiliary/svh-a-redundant-cfg.rs index 690ddc670f..1e82b74f1e 100644 --- a/src/test/auxiliary/svh-a-redundant-cfg.rs +++ b/src/test/auxiliary/svh-a-redundant-cfg.rs @@ -15,12 +15,14 @@ #![crate_name = "a"] +use std::marker::MarkerTrait; + macro_rules! three { () => { 3 } } -pub trait U {} -pub trait V {} +pub trait U : MarkerTrait {} +pub trait V : MarkerTrait {} impl U for () {} impl V for () {} diff --git a/src/test/auxiliary/svh-a-whitespace.rs b/src/test/auxiliary/svh-a-whitespace.rs index 216e8e997f..3c3dac9cda 100644 --- a/src/test/auxiliary/svh-a-whitespace.rs +++ b/src/test/auxiliary/svh-a-whitespace.rs @@ -15,12 +15,14 @@ #![crate_name = "a"] +use std::marker::MarkerTrait; + macro_rules! three { () => { 3 } } -pub trait U {} -pub trait V {} +pub trait U : MarkerTrait {} +pub trait V : MarkerTrait {} impl U for () {} impl V for () {} diff --git a/src/test/auxiliary/syntax-extension-with-dll-deps-1.rs b/src/test/auxiliary/syntax_extension_with_dll_deps_1.rs similarity index 100% rename from src/test/auxiliary/syntax-extension-with-dll-deps-1.rs rename to src/test/auxiliary/syntax_extension_with_dll_deps_1.rs diff --git a/src/test/auxiliary/syntax-extension-with-dll-deps-2.rs b/src/test/auxiliary/syntax_extension_with_dll_deps_2.rs similarity index 94% rename from src/test/auxiliary/syntax-extension-with-dll-deps-2.rs rename to src/test/auxiliary/syntax_extension_with_dll_deps_2.rs index 5ad1d244c9..7a24dd76f3 100644 --- a/src/test/auxiliary/syntax-extension-with-dll-deps-2.rs +++ b/src/test/auxiliary/syntax_extension_with_dll_deps_2.rs @@ -13,7 +13,7 @@ #![crate_type = "dylib"] #![feature(plugin_registrar, quote)] -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; diff --git a/src/test/auxiliary/trait_bounds_on_structs_and_enums_xc.rs b/src/test/auxiliary/trait_bounds_on_structs_and_enums_xc.rs index 1695e474de..a7c469fcca 100644 --- a/src/test/auxiliary/trait_bounds_on_structs_and_enums_xc.rs +++ b/src/test/auxiliary/trait_bounds_on_structs_and_enums_xc.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub trait Trait {} +pub trait Trait { + fn dummy(&self) { } +} pub struct Foo { pub x: T, diff --git a/src/test/auxiliary/trait_impl_conflict.rs b/src/test/auxiliary/trait_impl_conflict.rs index 990bc21604..0982efbdbf 100644 --- a/src/test/auxiliary/trait_impl_conflict.rs +++ b/src/test/auxiliary/trait_impl_conflict.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub trait Foo { +pub trait Foo : ::std::marker::MarkerTrait { } impl Foo for int { diff --git a/src/test/auxiliary/trait_inheritance_overloading_xc.rs b/src/test/auxiliary/trait_inheritance_overloading_xc.rs index cbd2ac69c7..36442ed6c1 100644 --- a/src/test/auxiliary/trait_inheritance_overloading_xc.rs +++ b/src/test/auxiliary/trait_inheritance_overloading_xc.rs @@ -14,7 +14,7 @@ use std::ops::{Add, Sub, Mul}; pub trait MyNum : Add + Sub + Mul + PartialEq + Clone { } -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub struct MyInt { pub val: int } diff --git a/src/test/auxiliary/typeid-intrinsic.rs b/src/test/auxiliary/typeid-intrinsic.rs index b6c35f4801..82f613ee11 100644 --- a/src/test/auxiliary/typeid-intrinsic.rs +++ b/src/test/auxiliary/typeid-intrinsic.rs @@ -8,8 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::intrinsics; -use std::intrinsics::TypeId; +use std::any::TypeId; pub struct A; pub struct B(Option); @@ -21,13 +20,13 @@ pub type F = Option; pub type G = uint; pub type H = &'static str; -pub unsafe fn id_A() -> TypeId { intrinsics::type_id::() } -pub unsafe fn id_B() -> TypeId { intrinsics::type_id::() } -pub unsafe fn id_C() -> TypeId { intrinsics::type_id::() } -pub unsafe fn id_D() -> TypeId { intrinsics::type_id::() } -pub unsafe fn id_E() -> TypeId { intrinsics::type_id::() } -pub unsafe fn id_F() -> TypeId { intrinsics::type_id::() } -pub unsafe fn id_G() -> TypeId { intrinsics::type_id::() } -pub unsafe fn id_H() -> TypeId { intrinsics::type_id::() } +pub unsafe fn id_A() -> TypeId { TypeId::of::() } +pub unsafe fn id_B() -> TypeId { TypeId::of::() } +pub unsafe fn id_C() -> TypeId { TypeId::of::() } +pub unsafe fn id_D() -> TypeId { TypeId::of::() } +pub unsafe fn id_E() -> TypeId { TypeId::of::() } +pub unsafe fn id_F() -> TypeId { TypeId::of::() } +pub unsafe fn id_G() -> TypeId { TypeId::of::() } +pub unsafe fn id_H() -> TypeId { TypeId::of::() } -pub unsafe fn foo() -> TypeId { intrinsics::type_id::() } +pub unsafe fn foo() -> TypeId { TypeId::of::() } diff --git a/src/test/auxiliary/typeid-intrinsic2.rs b/src/test/auxiliary/typeid-intrinsic2.rs index b6c35f4801..82f613ee11 100644 --- a/src/test/auxiliary/typeid-intrinsic2.rs +++ b/src/test/auxiliary/typeid-intrinsic2.rs @@ -8,8 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::intrinsics; -use std::intrinsics::TypeId; +use std::any::TypeId; pub struct A; pub struct B(Option); @@ -21,13 +20,13 @@ pub type F = Option; pub type G = uint; pub type H = &'static str; -pub unsafe fn id_A() -> TypeId { intrinsics::type_id::() } -pub unsafe fn id_B() -> TypeId { intrinsics::type_id::() } -pub unsafe fn id_C() -> TypeId { intrinsics::type_id::() } -pub unsafe fn id_D() -> TypeId { intrinsics::type_id::() } -pub unsafe fn id_E() -> TypeId { intrinsics::type_id::() } -pub unsafe fn id_F() -> TypeId { intrinsics::type_id::() } -pub unsafe fn id_G() -> TypeId { intrinsics::type_id::() } -pub unsafe fn id_H() -> TypeId { intrinsics::type_id::() } +pub unsafe fn id_A() -> TypeId { TypeId::of::() } +pub unsafe fn id_B() -> TypeId { TypeId::of::() } +pub unsafe fn id_C() -> TypeId { TypeId::of::() } +pub unsafe fn id_D() -> TypeId { TypeId::of::() } +pub unsafe fn id_E() -> TypeId { TypeId::of::() } +pub unsafe fn id_F() -> TypeId { TypeId::of::() } +pub unsafe fn id_G() -> TypeId { TypeId::of::() } +pub unsafe fn id_H() -> TypeId { TypeId::of::() } -pub unsafe fn foo() -> TypeId { intrinsics::type_id::() } +pub unsafe fn foo() -> TypeId { TypeId::of::() } diff --git a/src/test/auxiliary/unboxed-closures-cross-crate.rs b/src/test/auxiliary/unboxed-closures-cross-crate.rs index 4bc45caa17..a5178c0344 100644 --- a/src/test/auxiliary/unboxed-closures-cross-crate.rs +++ b/src/test/auxiliary/unboxed-closures-cross-crate.rs @@ -14,15 +14,15 @@ use std::ops::Add; #[inline] pub fn has_closures() -> uint { - let x = 1u; - let mut f = move |&mut:| x; - let y = 1u; - let g = |:| y; + let x = 1_usize; + let mut f = move || x; + let y = 1_usize; + let g = || y; f() + g() } pub fn has_generic_closures + Copy>(x: T, y: T) -> T { - let mut f = move |&mut:| x; - let g = |:| y; + let mut f = move || x; + let g = || y; f() + g() } diff --git a/src/test/auxiliary/use_from_trait_xc.rs b/src/test/auxiliary/use_from_trait_xc.rs index 22e0d3168c..56fb40bc0a 100644 --- a/src/test/auxiliary/use_from_trait_xc.rs +++ b/src/test/auxiliary/use_from_trait_xc.rs @@ -11,7 +11,7 @@ pub use self::sub::{Bar, Baz}; pub trait Trait { - fn foo(); + fn foo(&self); } struct Foo; diff --git a/src/test/auxiliary/weak-lang-items.rs b/src/test/auxiliary/weak-lang-items.rs index 39462fdc1e..fa254cb91a 100644 --- a/src/test/auxiliary/weak-lang-items.rs +++ b/src/test/auxiliary/weak-lang-items.rs @@ -13,6 +13,7 @@ // This aux-file will require the eh_personality function to be codegen'd, but // it hasn't been defined just yet. Make sure we don't explode. +#![feature(no_std)] #![no_std] #![crate_type = "rlib"] diff --git a/src/test/auxiliary/xcrate_unit_struct.rs b/src/test/auxiliary/xcrate_unit_struct.rs index 5a918db1cf..7ae3655407 100644 --- a/src/test/auxiliary/xcrate_unit_struct.rs +++ b/src/test/auxiliary/xcrate_unit_struct.rs @@ -12,33 +12,28 @@ // used by the rpass test +#[derive(Copy)] pub struct Struct; -impl Copy for Struct {} - +#[derive(Copy)] pub enum Unit { UnitVariant, Argument(Struct) } -impl Copy for Unit {} - +#[derive(Copy)] pub struct TupleStruct(pub uint, pub &'static str); -impl Copy for TupleStruct {} - // used by the cfail test +#[derive(Copy)] pub struct StructWithFields { foo: int, } -impl Copy for StructWithFields {} - +#[derive(Copy)] pub enum EnumWithVariants { EnumVariant, EnumVariantArg(int) } -impl Copy for EnumWithVariants {} - diff --git a/src/test/bench/core-map.rs b/src/test/bench/core-map.rs index c978046e39..4909d84a34 100644 --- a/src/test/bench/core-map.rs +++ b/src/test/bench/core-map.rs @@ -11,102 +11,100 @@ #![feature(unboxed_closures)] use std::collections::{BTreeMap, HashMap, HashSet}; -use std::os; +use std::env; use std::rand::{Rng, IsaacRng, SeedableRng}; use std::time::Duration; -use std::uint; fn timed(label: &str, f: F) where F: FnMut() { println!(" {}: {}", label, Duration::span(f)); } trait MutableMap { - fn insert(&mut self, k: uint, v: uint); - fn remove(&mut self, k: &uint) -> bool; - fn find(&self, k: &uint) -> Option<&uint>; + fn insert(&mut self, k: usize, v: usize); + fn remove(&mut self, k: &usize) -> bool; + fn find(&self, k: &usize) -> Option<&usize>; } -impl MutableMap for BTreeMap { - fn insert(&mut self, k: uint, v: uint) { self.insert(k, v); } - fn remove(&mut self, k: &uint) -> bool { self.remove(k).is_some() } - fn find(&self, k: &uint) -> Option<&uint> { self.get(k) } +impl MutableMap for BTreeMap { + fn insert(&mut self, k: usize, v: usize) { self.insert(k, v); } + fn remove(&mut self, k: &usize) -> bool { self.remove(k).is_some() } + fn find(&self, k: &usize) -> Option<&usize> { self.get(k) } } -impl MutableMap for HashMap { - fn insert(&mut self, k: uint, v: uint) { self.insert(k, v); } - fn remove(&mut self, k: &uint) -> bool { self.remove(k).is_some() } - fn find(&self, k: &uint) -> Option<&uint> { self.get(k) } +impl MutableMap for HashMap { + fn insert(&mut self, k: usize, v: usize) { self.insert(k, v); } + fn remove(&mut self, k: &usize) -> bool { self.remove(k).is_some() } + fn find(&self, k: &usize) -> Option<&usize> { self.get(k) } } -fn ascending(map: &mut M, n_keys: uint) { +fn ascending(map: &mut M, n_keys: usize) { println!(" Ascending integers:"); timed("insert", || { - for i in range(0u, n_keys) { + for i in 0..n_keys { map.insert(i, i + 1); } }); timed("search", || { - for i in range(0u, n_keys) { + for i in 0..n_keys { assert_eq!(map.find(&i).unwrap(), &(i + 1)); } }); timed("remove", || { - for i in range(0, n_keys) { + for i in 0..n_keys { assert!(map.remove(&i)); } }); } -fn descending(map: &mut M, n_keys: uint) { +fn descending(map: &mut M, n_keys: usize) { println!(" Descending integers:"); timed("insert", || { - for i in range(0, n_keys).rev() { + for i in (0..n_keys).rev() { map.insert(i, i + 1); } }); timed("search", || { - for i in range(0, n_keys).rev() { + for i in (0..n_keys).rev() { assert_eq!(map.find(&i).unwrap(), &(i + 1)); } }); timed("remove", || { - for i in range(0, n_keys) { + for i in 0..n_keys { assert!(map.remove(&i)); } }); } -fn vector(map: &mut M, n_keys: uint, dist: &[uint]) { +fn vector(map: &mut M, n_keys: usize, dist: &[usize]) { timed("insert", || { - for i in range(0u, n_keys) { + for i in 0..n_keys { map.insert(dist[i], i + 1); } }); timed("search", || { - for i in range(0u, n_keys) { + for i in 0..n_keys { assert_eq!(map.find(&dist[i]).unwrap(), &(i + 1)); } }); timed("remove", || { - for i in range(0u, n_keys) { + for i in 0..n_keys { assert!(map.remove(&dist[i])); } }); } fn main() { - let args = os::args(); - let args = args.as_slice(); + let mut args = env::args(); let n_keys = { if args.len() == 2 { - args[1].parse::().unwrap() + args.nth(1).unwrap().parse::().unwrap() } else { 1000000 } @@ -132,37 +130,37 @@ fn main() { println!("{}", "\nBTreeMap:"); { - let mut map: BTreeMap = BTreeMap::new(); + let mut map: BTreeMap = BTreeMap::new(); ascending(&mut map, n_keys); } { - let mut map: BTreeMap = BTreeMap::new(); + let mut map: BTreeMap = BTreeMap::new(); descending(&mut map, n_keys); } { println!(" Random integers:"); - let mut map: BTreeMap = BTreeMap::new(); - vector(&mut map, n_keys, rand.as_slice()); + let mut map: BTreeMap = BTreeMap::new(); + vector(&mut map, n_keys, &rand); } // FIXME: #9970 println!("{}", "\nHashMap:"); { - let mut map: HashMap = HashMap::new(); + let mut map: HashMap = HashMap::new(); ascending(&mut map, n_keys); } { - let mut map: HashMap = HashMap::new(); + let mut map: HashMap = HashMap::new(); descending(&mut map, n_keys); } { println!(" Random integers:"); - let mut map: HashMap = HashMap::new(); - vector(&mut map, n_keys, rand.as_slice()); + let mut map: HashMap = HashMap::new(); + vector(&mut map, n_keys, &rand); } } diff --git a/src/test/bench/core-set.rs b/src/test/bench/core-set.rs index edeb07c960..994c9605fc 100644 --- a/src/test/bench/core-set.rs +++ b/src/test/bench/core-set.rs @@ -16,13 +16,11 @@ extern crate collections; extern crate rand; use std::collections::BTreeSet; -use std::collections::BitvSet; +use std::collections::BitSet; use std::collections::HashSet; -use std::collections::hash_map::Hasher; use std::hash::Hash; -use std::os; +use std::env; use std::time::Duration; -use std::uint; struct Results { sequential_ints: Duration, @@ -44,7 +42,7 @@ trait MutableSet { fn contains(&self, k: &T) -> bool; } -impl + Eq> MutableSet for HashSet { +impl MutableSet for HashSet { fn insert(&mut self, k: T) { self.insert(k); } fn remove(&mut self, k: &T) -> bool { self.remove(k) } fn contains(&self, k: &T) -> bool { self.contains(k) } @@ -54,29 +52,29 @@ impl MutableSet for BTreeSet { fn remove(&mut self, k: &T) -> bool { self.remove(k) } fn contains(&self, k: &T) -> bool { self.contains(k) } } -impl MutableSet for BitvSet { - fn insert(&mut self, k: uint) { self.insert(k); } - fn remove(&mut self, k: &uint) -> bool { self.remove(k) } - fn contains(&self, k: &uint) -> bool { self.contains(k) } +impl MutableSet for BitSet { + fn insert(&mut self, k: usize) { self.insert(k); } + fn remove(&mut self, k: &usize) -> bool { self.remove(k) } + fn contains(&self, k: &usize) -> bool { self.contains(k) } } impl Results { - pub fn bench_int, + pub fn bench_int, R:rand::Rng, F:FnMut() -> T>( &mut self, rng: &mut R, - num_keys: uint, - rand_cap: uint, + num_keys: usize, + rand_cap: usize, mut f: F) { { let mut set = f(); timed(&mut self.sequential_ints, || { - for i in range(0u, num_keys) { + for i in 0..num_keys { set.insert(i); } - for i in range(0u, num_keys) { + for i in 0..num_keys { assert!(set.contains(&i)); } }) @@ -85,20 +83,20 @@ impl Results { { let mut set = f(); timed(&mut self.random_ints, || { - for _ in range(0, num_keys) { - set.insert(rng.gen::() % rand_cap); + for _ in 0..num_keys { + set.insert(rng.gen::() % rand_cap); } }) } { let mut set = f(); - for i in range(0u, num_keys) { + for i in 0..num_keys { set.insert(i); } timed(&mut self.delete_ints, || { - for i in range(0u, num_keys) { + for i in 0..num_keys { assert!(set.remove(&i)); } }) @@ -110,16 +108,16 @@ impl Results { F:FnMut() -> T>( &mut self, rng: &mut R, - num_keys: uint, + num_keys: usize, mut f: F) { { let mut set = f(); timed(&mut self.sequential_strings, || { - for i in range(0u, num_keys) { + for i in 0..num_keys { set.insert(i.to_string()); } - for i in range(0u, num_keys) { + for i in 0..num_keys { assert!(set.contains(&i.to_string())); } }) @@ -128,8 +126,8 @@ impl Results { { let mut set = f(); timed(&mut self.random_strings, || { - for _ in range(0, num_keys) { - let s = rng.gen::().to_string(); + for _ in 0..num_keys { + let s = rng.gen::().to_string(); set.insert(s); } }) @@ -137,11 +135,11 @@ impl Results { { let mut set = f(); - for i in range(0u, num_keys) { + for i in 0..num_keys { set.insert(i.to_string()); } timed(&mut self.delete_strings, || { - for i in range(0u, num_keys) { + for i in 0..num_keys { assert!(set.remove(&i.to_string())); } }) @@ -180,11 +178,10 @@ fn empty_results() -> Results { } fn main() { - let args = os::args(); - let args = args.as_slice(); + let mut args = env::args(); let num_keys = { if args.len() == 2 { - args[1].parse::().unwrap() + args.nth(1).unwrap().parse::().unwrap() } else { 100 // woefully inadequate for any real measurement } @@ -197,7 +194,7 @@ fn main() { let mut rng: rand::IsaacRng = rand::SeedableRng::from_seed(seed); let mut results = empty_results(); results.bench_int(&mut rng, num_keys, max, || { - let s: HashSet = HashSet::new(); + let s: HashSet = HashSet::new(); s }); results.bench_str(&mut rng, num_keys, || { @@ -211,7 +208,7 @@ fn main() { let mut rng: rand::IsaacRng = rand::SeedableRng::from_seed(seed); let mut results = empty_results(); results.bench_int(&mut rng, num_keys, max, || { - let s: BTreeSet = BTreeSet::new(); + let s: BTreeSet = BTreeSet::new(); s }); results.bench_str(&mut rng, num_keys, || { @@ -224,7 +221,7 @@ fn main() { { let mut rng: rand::IsaacRng = rand::SeedableRng::from_seed(seed); let mut results = empty_results(); - results.bench_int(&mut rng, num_keys, max, || BitvSet::new()); - write_results("collections::bitv::BitvSet", &results); + results.bench_int(&mut rng, num_keys, max, || BitSet::new()); + write_results("collections::bit_vec::BitSet", &results); } } diff --git a/src/test/bench/core-std.rs b/src/test/bench/core-std.rs index 9007b4fd64..4c3b3f42ac 100644 --- a/src/test/bench/core-std.rs +++ b/src/test/bench/core-std.rs @@ -13,10 +13,10 @@ #![feature(unboxed_closures)] -use std::io::File; +use std::old_io::File; use std::iter::repeat; use std::mem::swap; -use std::os; +use std::env; use std::rand::Rng; use std::rand; use std::str; @@ -24,12 +24,11 @@ use std::time::Duration; use std::vec; fn main() { - let argv = os::args(); - let _tests = argv.slice(1, argv.len()); + let argv: Vec = env::args().collect(); macro_rules! bench { ($id:ident) => - (maybe_run_test(argv.as_slice(), + (maybe_run_test(&argv, stringify!($id).to_string(), $id)) } @@ -46,7 +45,7 @@ fn main() { fn maybe_run_test(argv: &[String], name: String, test: F) where F: FnOnce() { let mut run_test = false; - if os::getenv("RUST_BENCH").is_some() { + if env::var_os("RUST_BENCH").is_some() { run_test = true } else if argv.len() > 0 { run_test = argv.iter().any(|x| x == &"all".to_string()) || argv.iter().any(|x| x == &name) @@ -62,7 +61,7 @@ fn maybe_run_test(argv: &[String], name: String, test: F) where F: FnOnce() { } fn shift_push() { - let mut v1 = repeat(1i).take(30000).collect::>(); + let mut v1 = repeat(1).take(30000).collect::>(); let mut v2 = Vec::new(); while v1.len() > 0 { @@ -71,12 +70,12 @@ fn shift_push() { } fn read_line() { - use std::io::BufferedReader; + use std::old_io::BufferedReader; let mut path = Path::new(env!("CFG_SRC_DIR")); path.push("src/test/bench/shootout-k-nucleotide.data"); - for _ in range(0u, 3) { + for _ in 0..3 { let mut reader = BufferedReader::new(File::open(&path).unwrap()); for _line in reader.lines() { } @@ -89,12 +88,12 @@ fn vec_plus() { let mut v = Vec::new(); let mut i = 0; while i < 1500 { - let rv = repeat(i).take(r.gen_range(0u, i + 1)).collect::>(); + let rv = repeat(i).take(r.gen_range(0, i + 1)).collect::>(); if r.gen() { v.extend(rv.into_iter()); } else { let mut rv = rv.clone(); - rv.push_all(v.as_slice()); + rv.push_all(&v); v = rv; } i += 1; @@ -107,15 +106,15 @@ fn vec_append() { let mut v = Vec::new(); let mut i = 0; while i < 1500 { - let rv = repeat(i).take(r.gen_range(0u, i + 1)).collect::>(); + let rv = repeat(i).take(r.gen_range(0, i + 1)).collect::>(); if r.gen() { let mut t = v.clone(); - t.push_all(rv.as_slice()); + t.push_all(&rv); v = t; } else { let mut t = rv.clone(); - t.push_all(v.as_slice()); + t.push_all(&v); v = t; } i += 1; @@ -126,23 +125,23 @@ fn vec_push_all() { let mut r = rand::thread_rng(); let mut v = Vec::new(); - for i in range(0u, 1500) { - let mut rv = repeat(i).take(r.gen_range(0u, i + 1)).collect::>(); + for i in 0..1500 { + let mut rv = repeat(i).take(r.gen_range(0, i + 1)).collect::>(); if r.gen() { - v.push_all(rv.as_slice()); + v.push_all(&rv); } else { swap(&mut v, &mut rv); - v.push_all(rv.as_slice()); + v.push_all(&rv); } } } fn is_utf8_ascii() { let mut v : Vec = Vec::new(); - for _ in range(0u, 20000) { + for _ in 0..20000 { v.push('b' as u8); - if str::from_utf8(v.as_slice()).is_err() { + if str::from_utf8(&v).is_err() { panic!("from_utf8 panicked"); } } @@ -151,9 +150,9 @@ fn is_utf8_ascii() { fn is_utf8_multibyte() { let s = "b¢€𤭢"; let mut v : Vec = Vec::new(); - for _ in range(0u, 5000) { + for _ in 0..5000 { v.push_all(s.as_bytes()); - if str::from_utf8(v.as_slice()).is_err() { + if str::from_utf8(&v).is_err() { panic!("from_utf8 panicked"); } } diff --git a/src/test/bench/core-uint-to-str.rs b/src/test/bench/core-uint-to-str.rs index 0235482ca2..287958f43f 100644 --- a/src/test/bench/core-uint-to-str.rs +++ b/src/test/bench/core-uint-to-str.rs @@ -8,22 +8,21 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::os; -use std::uint; +use std::env; fn main() { - let args = os::args(); - let args = if os::getenv("RUST_BENCH").is_some() { + let args = env::args(); + let args = if env::var_os("RUST_BENCH").is_some() { vec!("".to_string(), "10000000".to_string()) - } else if args.len() <= 1u { + } else if args.len() <= 1 { vec!("".to_string(), "100000".to_string()) } else { - args.into_iter().collect() + args.collect() }; let n = args[1].parse().unwrap(); - for i in range(0u, n) { + for i in 0..n { let x = i.to_string(); println!("{}", x); } diff --git a/src/test/bench/msgsend-pipes-shared.rs b/src/test/bench/msgsend-pipes-shared.rs index a091e0853f..b8d8f0cc9e 100644 --- a/src/test/bench/msgsend-pipes-shared.rs +++ b/src/test/bench/msgsend-pipes-shared.rs @@ -19,10 +19,9 @@ // version. use std::sync::mpsc::{channel, Sender, Receiver}; -use std::os; -use std::thread::Thread; +use std::env; +use std::thread; use std::time::Duration; -use std::uint; fn move_out(_x: T) {} @@ -33,7 +32,7 @@ enum request { } fn server(requests: &Receiver, responses: &Sender) { - let mut count = 0u; + let mut count = 0; let mut done = false; while !done { match requests.recv() { @@ -62,21 +61,21 @@ fn run(args: &[String]) { let dur = Duration::span(|| { let (to_child, to_parent, from_parent) = p.take().unwrap(); let mut worker_results = Vec::new(); - for _ in range(0u, workers) { + for _ in 0..workers { let to_child = to_child.clone(); - worker_results.push(Thread::scoped(move|| { - for _ in range(0u, size / workers) { + worker_results.push(thread::spawn(move|| { + for _ in 0..size / workers { //println!("worker {}: sending {} bytes", i, num_bytes); to_child.send(request::bytes(num_bytes)).unwrap(); } //println!("worker {} exiting", i); })); } - Thread::spawn(move|| { + thread::spawn(move|| { server(&from_parent, &to_parent); }); - for r in worker_results.into_iter() { + for r in worker_results { let _ = r.join(); } @@ -94,15 +93,15 @@ fn run(args: &[String]) { } fn main() { - let args = os::args(); - let args = if os::getenv("RUST_BENCH").is_some() { + let args = env::args(); + let args = if env::var_os("RUST_BENCH").is_some() { vec!("".to_string(), "1000000".to_string(), "10000".to_string()) - } else if args.len() <= 1u { + } else if args.len() <= 1 { vec!("".to_string(), "10000".to_string(), "4".to_string()) } else { - args.into_iter().map(|x| x.to_string()).collect() + args.map(|x| x.to_string()).collect() }; println!("{:?}", args); - run(args.as_slice()); + run(&args); } diff --git a/src/test/bench/msgsend-pipes.rs b/src/test/bench/msgsend-pipes.rs index a9e6cef38a..3642eb82fd 100644 --- a/src/test/bench/msgsend-pipes.rs +++ b/src/test/bench/msgsend-pipes.rs @@ -15,12 +15,9 @@ // I *think* it's the same, more or less. use std::sync::mpsc::{channel, Sender, Receiver}; -use std::os; -use std::thread::Thread; +use std::env; +use std::thread; use std::time::Duration; -use std::uint; - -fn move_out(_x: T) {} enum request { get_count, @@ -42,7 +39,7 @@ fn server(requests: &Receiver, responses: &Sender) { _ => { } } } - responses.send(count); + responses.send(count).unwrap(); //println!("server exiting"); } @@ -59,8 +56,8 @@ fn run(args: &[String]) { let mut worker_results = Vec::new(); let from_parent = if workers == 1 { let (to_child, from_parent) = channel(); - worker_results.push(Thread::scoped(move|| { - for _ in range(0u, size / workers) { + worker_results.push(thread::spawn(move|| { + for _ in 0..size / workers { //println!("worker {}: sending {} bytes", i, num_bytes); to_child.send(request::bytes(num_bytes)); } @@ -69,10 +66,10 @@ fn run(args: &[String]) { from_parent } else { let (to_child, from_parent) = channel(); - for _ in range(0u, workers) { + for _ in 0..workers { let to_child = to_child.clone(); - worker_results.push(Thread::scoped(move|| { - for _ in range(0u, size / workers) { + worker_results.push(thread::spawn(move|| { + for _ in 0..size / workers { //println!("worker {}: sending {} bytes", i, num_bytes); to_child.send(request::bytes(num_bytes)); } @@ -81,11 +78,11 @@ fn run(args: &[String]) { } from_parent }; - Thread::spawn(move|| { + thread::spawn(move|| { server(&from_parent, &to_parent); }); - for r in worker_results.into_iter() { + for r in worker_results { let _ = r.join(); } @@ -103,15 +100,15 @@ fn run(args: &[String]) { } fn main() { - let args = os::args(); - let args = if os::getenv("RUST_BENCH").is_some() { + let args = env::args(); + let args = if env::var_os("RUST_BENCH").is_some() { vec!("".to_string(), "1000000".to_string(), "8".to_string()) - } else if args.len() <= 1u { + } else if args.len() <= 1 { vec!("".to_string(), "10000".to_string(), "4".to_string()) } else { - args.clone().into_iter().map(|x| x.to_string()).collect() + args.map(|x| x.to_string()).collect() }; println!("{:?}", args); - run(args.as_slice()); + run(&args); } diff --git a/src/test/bench/msgsend-ring-mutex-arcs.rs b/src/test/bench/msgsend-ring-mutex-arcs.rs index ef5e8f3f4b..a980b7ed9e 100644 --- a/src/test/bench/msgsend-ring-mutex-arcs.rs +++ b/src/test/bench/msgsend-ring-mutex-arcs.rs @@ -18,10 +18,9 @@ // no-pretty-expanded FIXME #15189 // ignore-lexer-test FIXME #15679 -use std::os; +use std::env; use std::sync::{Arc, Future, Mutex, Condvar}; use std::time::Duration; -use std::uint; // A poor man's pipe. type pipe = Arc<(Mutex>, Condvar)>; @@ -51,7 +50,7 @@ fn thread_ring(i: uint, count: uint, 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. - for j in range(0u, count) { + for j in 0..count { //println!("task %?, iter %?", i, j); let num_chan2 = num_chan.take().unwrap(); let num_port2 = num_port.take().unwrap(); @@ -64,19 +63,19 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) { } fn main() { - let args = os::args(); - let args = if os::getenv("RUST_BENCH").is_some() { + let args = env::args(); + let args = if env::var_os("RUST_BENCH").is_some() { vec!("".to_string(), "100".to_string(), "10000".to_string()) - } else if args.len() <= 1u { + } else if args.len() <= 1 { vec!("".to_string(), "10".to_string(), "100".to_string()) } else { - args.clone().into_iter().collect() + args.collect() }; let num_tasks = args[1].parse::().unwrap(); let msg_per_task = args[2].parse::().unwrap(); - let (mut num_chan, num_port) = init(); + let (num_chan, num_port) = init(); let mut p = Some((num_chan, num_port)); let dur = Duration::span(|| { @@ -85,7 +84,7 @@ fn main() { // create the ring let mut futures = Vec::new(); - for i in range(1u, num_tasks) { + for i in 1..num_tasks { //println!("spawning %?", i); let (new_chan, num_port) = init(); let num_chan_2 = num_chan.clone(); @@ -100,7 +99,7 @@ fn main() { thread_ring(0, msg_per_task, num_chan, num_port); // synchronize - for f in futures.iter_mut() { + for f in &mut futures { f.get() } }); diff --git a/src/test/bench/noise.rs b/src/test/bench/noise.rs index 3c7efb0336..53c52ae301 100644 --- a/src/test/bench/noise.rs +++ b/src/test/bench/noise.rs @@ -16,13 +16,12 @@ use std::f32::consts::PI; use std::num::Float; use std::rand::{Rng, StdRng}; +#[derive(Copy)] struct Vec2 { x: f32, y: f32, } -impl Copy for Vec2 {} - 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) } @@ -46,7 +45,7 @@ impl Noise2DContext { let mut rng = StdRng::new().unwrap(); let mut rgradients = [Vec2 { x: 0.0, y: 0.0 }; 256]; - for x in rgradients.iter_mut() { + for x in &mut rgradients[] { *x = random_gradient(&mut rng); } @@ -105,17 +104,17 @@ fn main() { let mut pixels = [0f32; 256*256]; let n2d = Noise2DContext::new(); - for _ in range(0u, 100) { - for y in range(0u, 256) { - for x in range(0u, 256) { + for _ in 0..100 { + for y in 0..256 { + for x in 0..256 { let v = n2d.get(x as f32 * 0.1, y as f32 * 0.1); pixels[y*256+x] = v * 0.5 + 0.5; } } } - for y in range(0u, 256) { - for x in range(0u, 256) { + for y in 0..256 { + for x in 0..256 { let idx = (pixels[y*256+x] / 0.2) as uint; print!("{}", symbols[idx]); } diff --git a/src/test/bench/rt-messaging-ping-pong.rs b/src/test/bench/rt-messaging-ping-pong.rs index b854dc11b9..b9512324e4 100644 --- a/src/test/bench/rt-messaging-ping-pong.rs +++ b/src/test/bench/rt-messaging-ping-pong.rs @@ -18,34 +18,34 @@ // except according to those terms. use std::sync::mpsc::channel; -use std::os; -use std::thread::Thread; +use std::env; +use std::thread; // This is a simple bench that creates M pairs of tasks. These // tasks ping-pong back and forth over a pair of streams. This is a // canonical message-passing benchmark as it heavily strains message // passing and almost nothing else. -fn ping_pong_bench(n: uint, m: uint) { +fn ping_pong_bench(n: usize, m: usize) { // Create pairs of tasks that pingpong back and forth. - fn run_pair(n: uint) { + fn run_pair(n: usize) { // Create a channel: A->B let (atx, arx) = channel(); // Create a channel: B->A let (btx, brx) = channel(); - let guard_a = Thread::scoped(move|| { + let guard_a = thread::spawn(move|| { let (tx, rx) = (atx, brx); - for _ in range(0, n) { + for _ in 0..n { tx.send(()).unwrap(); rx.recv().unwrap(); } }); - let guard_b = Thread::scoped(move|| { + let guard_b = thread::spawn(move|| { let (tx, rx) = (btx, arx); - for _ in range(0, n) { + for _ in 0..n { rx.recv().unwrap(); tx.send(()).unwrap(); } @@ -55,7 +55,7 @@ fn ping_pong_bench(n: uint, m: uint) { guard_b.join().ok(); } - for _ in range(0, m) { + for _ in 0..m { run_pair(n) } } @@ -63,19 +63,13 @@ fn ping_pong_bench(n: uint, m: uint) { fn main() { - - let args = os::args(); - let args = args.as_slice(); - let n = if args.len() == 3 { - args[1].parse::().unwrap() - } else { - 10000 - }; - - let m = if args.len() == 3 { - args[2].parse::().unwrap() + let mut args = env::args(); + let (n, m) = if args.len() == 3 { + let n = args.nth(1).unwrap().parse::().unwrap(); + let m = args.next().unwrap().parse::().unwrap(); + (n, m) } else { - 4 + (10000, 4) }; ping_pong_bench(n, m); diff --git a/src/test/bench/rt-parfib.rs b/src/test/bench/rt-parfib.rs index 37210cd93f..d420023cf0 100644 --- a/src/test/bench/rt-parfib.rs +++ b/src/test/bench/rt-parfib.rs @@ -9,33 +9,30 @@ // except according to those terms. use std::sync::mpsc::channel; -use std::os; -use std::thread::Thread; -use std::uint; +use std::env; +use std::thread; // A simple implementation of parfib. One subtree is found in a new // task and communicated over a oneshot pipe, the other is found // locally. There is no sequential-mode threshold. -fn parfib(n: uint) -> uint { - if(n == 0 || n == 1) { +fn parfib(n: u64) -> u64 { + if n == 0 || n == 1 { return 1; } let (tx, rx) = channel(); - Thread::spawn(move|| { - tx.send(parfib(n-1)); + thread::spawn(move|| { + tx.send(parfib(n-1)).unwrap(); }); let m2 = parfib(n-2); - return (rx.recv().unwrap() + m2); + return rx.recv().unwrap() + m2; } fn main() { - - let args = os::args(); - let args = args.as_slice(); + let mut args = env::args(); let n = if args.len() == 2 { - args[1].parse::().unwrap() + args.nth(1).unwrap().parse::().unwrap() } else { 10 }; diff --git a/src/test/bench/shootout-ackermann.rs b/src/test/bench/shootout-ackermann.rs index e66fffd04e..d07aa8850a 100644 --- a/src/test/bench/shootout-ackermann.rs +++ b/src/test/bench/shootout-ackermann.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::os; +use std::env; -fn ack(m: int, n: int) -> int { +fn ack(m: i64, n: i64) -> i64 { if m == 0 { return n + 1 } else { @@ -23,13 +23,13 @@ fn ack(m: int, n: int) -> int { } fn main() { - let args = os::args(); - let args = if os::getenv("RUST_BENCH").is_some() { + let mut args = env::args(); + let args = if env::var_os("RUST_BENCH").is_some() { vec!("".to_string(), "12".to_string()) - } else if args.len() <= 1u { + } else if args.len() <= 1 { vec!("".to_string(), "8".to_string()) } else { - args.into_iter().collect() + args.collect() }; let n = args[1].parse().unwrap(); println!("Ack(3,{}): {}\n", n, ack(3, n)); diff --git a/src/test/bench/shootout-binarytrees.rs b/src/test/bench/shootout-binarytrees.rs index 737776368d..1e23da3020 100644 --- a/src/test/bench/shootout-binarytrees.rs +++ b/src/test/bench/shootout-binarytrees.rs @@ -41,41 +41,56 @@ extern crate arena; use std::iter::range_step; -use std::thread::Thread; +use std::thread; use arena::TypedArena; -enum Tree<'a> { - Nil, - Node(&'a Tree<'a>, &'a Tree<'a>, int) +struct Tree<'a> { + l: Option<&'a Tree<'a>>, + r: Option<&'a Tree<'a>>, + i: i32 } -fn item_check(t: &Tree) -> int { +fn item_check(t: &Option<&Tree>) -> i32 { match *t { - Tree::Nil => 0, - Tree::Node(l, r, i) => i + item_check(l) - item_check(r) + None => 0, + Some(&Tree { ref l, ref r, i }) => i + item_check(l) - item_check(r) } } -fn bottom_up_tree<'r>(arena: &'r TypedArena>, item: int, depth: int) - -> &'r Tree<'r> { +fn bottom_up_tree<'r>(arena: &'r TypedArena>, item: i32, depth: i32) + -> Option<&'r Tree<'r>> { if depth > 0 { - arena.alloc(Tree::Node(bottom_up_tree(arena, 2 * item - 1, depth - 1), - bottom_up_tree(arena, 2 * item, depth - 1), - item)) + let t: &Tree<'r> = arena.alloc(Tree { + l: bottom_up_tree(arena, 2 * item - 1, depth - 1), + r: bottom_up_tree(arena, 2 * item, depth - 1), + i: item + }); + Some(t) } else { - arena.alloc(Tree::Nil) + None } } +fn inner(depth: i32, iterations: i32) -> String { + let mut chk = 0; + for i in 1 .. iterations + 1 { + let arena = TypedArena::new(); + let a = bottom_up_tree(&arena, i, depth); + let b = bottom_up_tree(&arena, -i, depth); + chk += item_check(&a) + item_check(&b); + } + format!("{}\t trees of depth {}\t check: {}", + iterations * 2, depth, chk) +} + fn main() { - let args = std::os::args(); - let args = args.as_slice(); - let n = if std::os::getenv("RUST_BENCH").is_some() { + let mut args = std::env::args(); + let n = if std::env::var_os("RUST_BENCH").is_some() { 17 - } else if args.len() <= 1u { + } else if args.len() <= 1 { 8 } else { - args[1].parse().unwrap() + args.nth(1).unwrap().parse().unwrap() }; let min_depth = 4; let max_depth = if min_depth + 2 > n {min_depth + 2} else {n}; @@ -86,32 +101,22 @@ fn main() { let tree = bottom_up_tree(&arena, 0, depth); println!("stretch tree of depth {}\t check: {}", - depth, item_check(tree)); + depth, item_check(&tree)); } let long_lived_arena = TypedArena::new(); let long_lived_tree = bottom_up_tree(&long_lived_arena, 0, max_depth); - let mut messages = range_step(min_depth, max_depth + 1, 2).map(|depth| { - use std::num::Int; - let iterations = 2i.pow((max_depth - depth + min_depth) as uint); - Thread::scoped(move|| { - let mut chk = 0; - for i in range(1, iterations + 1) { - let arena = TypedArena::new(); - let a = bottom_up_tree(&arena, i, depth); - let b = bottom_up_tree(&arena, -i, depth); - chk += item_check(a) + item_check(b); - } - format!("{}\t trees of depth {}\t check: {}", - iterations * 2, depth, chk) - }) - }).collect::>(); + let messages = range_step(min_depth, max_depth + 1, 2).map(|depth| { + use std::num::Int; + let iterations = 2.pow((max_depth - depth + min_depth) as usize); + thread::scoped(move || inner(depth, iterations)) + }).collect::>(); - for message in messages.into_iter() { - println!("{}", message.join().ok().unwrap()); + for message in messages { + println!("{}", message.join()); } println!("long lived tree of depth {}\t check: {}", - max_depth, item_check(long_lived_tree)); + max_depth, item_check(&long_lived_tree)); } diff --git a/src/test/bench/shootout-chameneos-redux.rs b/src/test/bench/shootout-chameneos-redux.rs index c58c6ef621..73e7c8eb07 100644 --- a/src/test/bench/shootout-chameneos-redux.rs +++ b/src/test/bench/shootout-chameneos-redux.rs @@ -43,26 +43,25 @@ use self::Color::{Red, Yellow, Blue}; use std::sync::mpsc::{channel, Sender, Receiver}; use std::fmt; -use std::thread::Thread; +use std::thread; fn print_complements() { let all = [Blue, Red, Yellow]; - for aa in all.iter() { - for bb in all.iter() { + for aa in &all { + for bb in &all { println!("{:?} + {:?} -> {:?}", *aa, *bb, transform(*aa, *bb)); } } } +#[derive(Copy)] enum Color { Red, Yellow, Blue, } -impl Copy for Color {} - -impl fmt::Show for Color { +impl fmt::Debug for Color { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let str = match *self { Red => "red", @@ -73,18 +72,17 @@ impl fmt::Show for Color { } } +#[derive(Copy)] struct CreatureInfo { name: uint, color: Color } -impl Copy for CreatureInfo {} - fn show_color_list(set: Vec) -> String { let mut out = String::new(); - for col in set.iter() { + for col in &set { out.push(' '); - out.push_str(format!("{:?}", col).as_slice()); + out.push_str(&format!("{:?}", col)); } out } @@ -106,7 +104,7 @@ fn show_digit(nn: uint) -> &'static str { } struct Number(uint); -impl fmt::Show for Number { +impl fmt::Debug for Number { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let mut out = vec![]; let Number(mut num) = *self; @@ -182,14 +180,14 @@ fn rendezvous(nn: uint, set: Vec) { let (to_rendezvous_log, from_creatures_log) = channel::(); // these channels will allow us to talk to each creature by 'name'/index - let mut to_creature: Vec> = + let to_creature: Vec> = set.iter().enumerate().map(|(ii, &col)| { // create each creature as a listener with a port, and // give us a channel to talk to each let to_rendezvous = to_rendezvous.clone(); let to_rendezvous_log = to_rendezvous_log.clone(); let (to_creature, from_rendezvous) = channel(); - Thread::spawn(move|| { + thread::spawn(move|| { creature(ii, col, from_rendezvous, @@ -202,7 +200,7 @@ fn rendezvous(nn: uint, set: Vec) { let mut creatures_met = 0; // set up meetings... - for _ in range(0, nn) { + for _ in 0..nn { let fst_creature = from_creatures.recv().unwrap(); let snd_creature = from_creatures.recv().unwrap(); @@ -229,13 +227,13 @@ fn rendezvous(nn: uint, set: Vec) { } fn main() { - let nn = if std::os::getenv("RUST_BENCH").is_some() { + let nn = if std::env::var_os("RUST_BENCH").is_some() { 200000 } else { - std::os::args().as_slice() - .get(1) - .and_then(|arg| arg.parse()) - .unwrap_or(600u) + std::env::args() + .nth(1) + .and_then(|arg| arg.parse().ok()) + .unwrap_or(600) }; print_complements(); diff --git a/src/test/bench/shootout-fannkuch-redux.rs b/src/test/bench/shootout-fannkuch-redux.rs index bd4b8e5e97..f7de935d08 100644 --- a/src/test/bench/shootout-fannkuch-redux.rs +++ b/src/test/bench/shootout-fannkuch-redux.rs @@ -39,7 +39,7 @@ // OF THE POSSIBILITY OF SUCH DAMAGE. use std::{cmp, iter, mem}; -use std::thread::Thread; +use std::thread; fn rotate(x: &mut [i32]) { let mut prev = x[0]; @@ -49,8 +49,8 @@ fn rotate(x: &mut [i32]) { } fn next_permutation(perm: &mut [i32], count: &mut [i32]) { - for i in range(1, perm.len()) { - rotate(perm.slice_to_mut(i + 1)); + for i in 1..perm.len() { + rotate(&mut perm[..i + 1]); let count_i = &mut count[i]; if *count_i >= i as i32 { *count_i = 0; @@ -61,12 +61,12 @@ fn next_permutation(perm: &mut [i32], count: &mut [i32]) { } } +#[derive(Copy)] struct P { p: [i32; 16], } -impl Copy for P {} - +#[derive(Copy)] struct Perm { cnt: [i32; 16], fact: [u32; 16], @@ -75,12 +75,10 @@ struct Perm { perm: P, } -impl Copy for Perm {} - impl Perm { fn new(n: u32) -> Perm { let mut fact = [1; 16]; - for i in range(1, n as uint + 1) { + for i in 1..n as uint + 1 { fact[i] = fact[i - 1] * i as u32; } Perm { @@ -99,16 +97,16 @@ impl Perm { *place = i as i32 + 1; } - for i in range(1, self.n as uint).rev() { + for i in (1..self.n as uint).rev() { let d = idx / self.fact[i] as i32; self.cnt[i] = d; idx %= self.fact[i] as i32; - for (place, val) in pp.iter_mut().zip(self.perm.p[..(i+1)].iter()) { + for (place, val) in pp.iter_mut().zip(self.perm.p[..i+1].iter()) { *place = (*val) as u8 } let d = d as uint; - for j in range(0, i + 1) { + 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; } } @@ -128,8 +126,8 @@ impl Perm { } -fn reverse(tperm: &mut [i32], mut k: uint) { - tperm.slice_to_mut(k).reverse() +fn reverse(tperm: &mut [i32], k: uint) { + tperm[..k].reverse() } fn work(mut perm: Perm, n: uint, max: uint) -> (i32, i32) { @@ -163,18 +161,18 @@ fn fannkuch(n: i32) -> (i32, i32) { let mut futures = vec![]; let k = perm.max() / N; - for (i, j) in range(0, N).zip(iter::count(0, k)) { + for (_, j) in (0..N).zip(iter::count(0, k)) { let max = cmp::min(j+k, perm.max()); - futures.push(Thread::scoped(move|| { + futures.push(thread::scoped(move|| { work(perm, j as uint, max as uint) })) } let mut checksum = 0; let mut maxflips = 0; - for fut in futures.into_iter() { - let (cs, mf) = fut.join().ok().unwrap(); + for fut in futures { + let (cs, mf) = fut.join(); checksum += cs; maxflips = cmp::max(maxflips, mf); } @@ -182,9 +180,9 @@ fn fannkuch(n: i32) -> (i32, i32) { } fn main() { - let n = std::os::args().as_slice() - .get(1) - .and_then(|arg| arg.parse()) + let n = std::env::args() + .nth(1) + .and_then(|arg| arg.parse().ok()) .unwrap_or(2i32); let (checksum, maxflips) = fannkuch(n); diff --git a/src/test/bench/shootout-fasta-redux.rs b/src/test/bench/shootout-fasta-redux.rs index 5a47f9fbc5..277c3ee73d 100644 --- a/src/test/bench/shootout-fasta-redux.rs +++ b/src/test/bench/shootout-fasta-redux.rs @@ -39,13 +39,13 @@ // OF THE POSSIBILITY OF SUCH DAMAGE. use std::cmp::min; -use std::io::{stdout, IoResult}; +use std::old_io::{stdout, IoResult}; use std::iter::repeat; -use std::os; +use std::env; use std::slice::bytes::copy_memory; -const LINE_LEN: uint = 60; -const LOOKUP_SIZE: uint = 4 * 1024; +const LINE_LEN: usize = 60; +const LOOKUP_SIZE: usize = 4 * 1024; const LOOKUP_SCALE: f32 = (LOOKUP_SIZE - 1) as f32; // Random number generator constants @@ -92,7 +92,7 @@ static HOMO_SAPIENS: [AminoAcid;4] = [ fn sum_and_scale(a: &'static [AminoAcid]) -> Vec { let mut result = Vec::new(); let mut p = 0f32; - for a_i in a.iter() { + for a_i in a { let mut a_i = *a_i; p += a_i.p; a_i.p = p * LOOKUP_SCALE; @@ -103,13 +103,12 @@ fn sum_and_scale(a: &'static [AminoAcid]) -> Vec { result } +#[derive(Copy)] struct AminoAcid { c: u8, p: f32, } -impl Copy for AminoAcid {} - struct RepeatFasta<'a, W:'a> { alu: &'static str, out: &'a mut W @@ -120,22 +119,22 @@ impl<'a, W: Writer> RepeatFasta<'a, W> { RepeatFasta { alu: alu, out: w } } - fn make(&mut self, n: uint) -> IoResult<()> { + fn make(&mut self, n: usize) -> IoResult<()> { let alu_len = self.alu.len(); let mut buf = repeat(0u8).take(alu_len + LINE_LEN).collect::>(); let alu: &[u8] = self.alu.as_bytes(); - copy_memory(buf.as_mut_slice(), alu); + copy_memory(&mut buf, alu); let buf_len = buf.len(); - copy_memory(buf.slice_mut(alu_len, buf_len), - &alu[0..LINE_LEN]); + copy_memory(&mut buf[alu_len..buf_len], + &alu[..LINE_LEN]); let mut pos = 0; let mut bytes; let mut n = n; while n > 0 { bytes = min(LINE_LEN, n); - try!(self.out.write(buf.slice(pos, pos + bytes))); + try!(self.out.write(&buf[pos..pos + bytes])); try!(self.out.write_u8('\n' as u8)); pos += bytes; if pos > alu_len { @@ -181,7 +180,7 @@ impl<'a, W: Writer> RandomFasta<'a, W> { fn nextc(&mut self) -> u8 { let r = self.rng(1.0); - for a in self.lookup.iter() { + for a in &self.lookup[..] { if a.p >= r { return a.c; } @@ -189,30 +188,29 @@ impl<'a, W: Writer> RandomFasta<'a, W> { 0 } - fn make(&mut self, n: uint) -> IoResult<()> { + fn make(&mut self, n: usize) -> IoResult<()> { let lines = n / LINE_LEN; let chars_left = n % LINE_LEN; let mut buf = [0;LINE_LEN + 1]; - for _ in range(0, lines) { - for i in range(0u, LINE_LEN) { + for _ in 0..lines { + for i in 0..LINE_LEN { buf[i] = self.nextc(); } buf[LINE_LEN] = '\n' as u8; try!(self.out.write(&buf)); } - for i in range(0u, chars_left) { + for i in 0..chars_left { buf[i] = self.nextc(); } - self.out.write(&buf[0..chars_left]) + self.out.write(&buf[..chars_left]) } } fn main() { - let args = os::args(); - let args = args.as_slice(); + let mut args = env::args(); let n = if args.len() > 1 { - args[1].parse::().unwrap() + args.nth(1).unwrap().parse::().unwrap() } else { 5 }; @@ -227,12 +225,12 @@ fn main() { out.write_line(">TWO IUB ambiguity codes").unwrap(); let iub = sum_and_scale(&IUB); - let mut random = RandomFasta::new(&mut out, iub.as_slice()); + let mut random = RandomFasta::new(&mut out, &iub); random.make(n * 3).unwrap(); random.out.write_line(">THREE Homo sapiens frequency").unwrap(); let homo_sapiens = sum_and_scale(&HOMO_SAPIENS); - random.lookup = make_lookup(homo_sapiens.as_slice()); + random.lookup = make_lookup(&homo_sapiens); random.make(n * 5).unwrap(); random.out.write_str("\n").unwrap(); diff --git a/src/test/bench/shootout-fasta.rs b/src/test/bench/shootout-fasta.rs index e9da34615c..2c640c4b09 100644 --- a/src/test/bench/shootout-fasta.rs +++ b/src/test/bench/shootout-fasta.rs @@ -39,12 +39,12 @@ // OF THE POSSIBILITY OF SUCH DAMAGE. use std::cmp::min; -use std::io::{BufferedWriter, File}; -use std::io; +use std::old_io::{BufferedWriter, File}; +use std::old_io; use std::num::Float; -use std::os; +use std::env; -const LINE_LENGTH: uint = 60; +const LINE_LENGTH: usize = 60; const IM: u32 = 139968; struct MyRandom { @@ -85,32 +85,31 @@ impl<'a> Iterator for AAGen<'a> { } fn make_fasta>( - wr: &mut W, header: &str, mut it: I, mut n: uint) - -> std::io::IoResult<()> + wr: &mut W, header: &str, mut it: I, mut n: usize) + -> std::old_io::IoResult<()> { try!(wr.write(header.as_bytes())); let mut line = [0u8; LINE_LENGTH + 1]; while n > 0 { let nb = min(LINE_LENGTH, n); - for i in range(0, nb) { + for i in 0..nb { line[i] = it.next().unwrap(); } n -= nb; line[nb] = '\n' as u8; - try!(wr.write(&line[..(nb+1)])); + try!(wr.write(&line[..nb+1])); } Ok(()) } -fn run(writer: &mut W) -> std::io::IoResult<()> { - let args = os::args(); - let args = args.as_slice(); - let n = if os::getenv("RUST_BENCH").is_some() { +fn run(writer: &mut W) -> std::old_io::IoResult<()> { + let mut args = env::args(); + let n = if env::var_os("RUST_BENCH").is_some() { 25000000 - } else if args.len() <= 1u { + } else if args.len() <= 1 { 1000 } else { - args[1].parse().unwrap() + args.nth(1).unwrap().parse().unwrap() }; let rng = &mut MyRandom::new(); @@ -133,7 +132,7 @@ fn run(writer: &mut W) -> std::io::IoResult<()> { ('t', 0.3015094502008)]; try!(make_fasta(writer, ">ONE Homo sapiens alu\n", - alu.as_bytes().iter().cycle().map(|c| *c), n * 2)); + alu.as_bytes().iter().cycle().cloned(), n * 2)); try!(make_fasta(writer, ">TWO IUB ambiguity codes\n", AAGen::new(rng, iub), n * 3)); try!(make_fasta(writer, ">THREE Homo sapiens frequency\n", @@ -143,11 +142,11 @@ fn run(writer: &mut W) -> std::io::IoResult<()> { } fn main() { - let res = if os::getenv("RUST_BENCH").is_some() { + let res = if env::var_os("RUST_BENCH").is_some() { let mut file = BufferedWriter::new(File::create(&Path::new("./shootout-fasta.data"))); run(&mut file) } else { - run(&mut io::stdout()) + run(&mut old_io::stdout()) }; res.unwrap() } diff --git a/src/test/bench/shootout-fibo.rs b/src/test/bench/shootout-fibo.rs index 36854728eb..6f9c775609 100644 --- a/src/test/bench/shootout-fibo.rs +++ b/src/test/bench/shootout-fibo.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::os; +use std::env; -fn fib(n: int) -> int { +fn fib(n: i64) -> i64 { if n < 2 { return 1; } else { @@ -19,13 +19,13 @@ fn fib(n: int) -> int { } fn main() { - let args = os::args(); - let args = if os::getenv("RUST_BENCH").is_some() { + let args = env::args(); + let args = if env::var_os("RUST_BENCH").is_some() { vec!("".to_string(), "40".to_string()) - } else if args.len() <= 1u { + } else if args.len() <= 1 { vec!("".to_string(), "30".to_string()) } else { - args.into_iter().collect() + args.collect() }; let n = args[1].parse().unwrap(); println!("{}\n", fib(n)); diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index 03268b4019..3ea4a10ea8 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -22,8 +22,9 @@ use std::mem::replace; use std::num::Float; use std::option; use std::os; +use std::env; use std::sync::mpsc::{channel, Sender, Receiver}; -use std::thread::Thread; +use std::thread; fn f64_cmp(x: f64, y: f64) -> Ordering { // arbitrarily decide that NaNs are larger than everything. @@ -56,17 +57,17 @@ fn sort_and_fmt(mm: &HashMap , uint>, total: uint) -> String { let mut pairs = Vec::new(); // map -> [(k,%)] - for (key, &val) in mm.iter() { + for (key, &val) in mm { pairs.push(((*key).clone(), pct(val, total))); } let pairs_sorted = sortKV(pairs); let mut buffer = String::new(); - for &(ref k, v) in pairs_sorted.iter() { - buffer.push_str(format!("{:?} {:0.3}\n", - k.to_ascii_uppercase(), - v).as_slice()); + for &(ref k, v) in &pairs_sorted { + buffer.push_str(&format!("{:?} {:0.3}\n", + k.to_ascii_uppercase(), + v)); } return buffer @@ -76,7 +77,7 @@ fn sort_and_fmt(mm: &HashMap , uint>, total: uint) -> String { fn find(mm: &HashMap , uint>, key: String) -> uint { let key = key.into_ascii_lowercase(); match mm.get(key.as_bytes()) { - option::Option::None => { return 0u; } + option::Option::None => { return 0; } option::Option::Some(&num) => { return num; } } } @@ -97,15 +98,15 @@ fn update_freq(mm: &mut HashMap , uint>, key: &[u8]) { fn windows_with_carry(bb: &[u8], nn: uint, mut it: F) -> Vec where F: FnMut(&[u8]), { - let mut ii = 0u; + let mut ii = 0; let len = bb.len(); - while ii < len - (nn - 1u) { - it(&bb[ii..(ii+nn)]); - ii += 1u; + while ii < len - (nn - 1) { + it(&bb[ii..ii+nn]); + ii += 1; } - return bb[(len - (nn - 1u))..len].to_vec(); + return bb[len - (nn - 1)..len].to_vec(); } fn make_sequence_processor(sz: uint, @@ -113,7 +114,7 @@ fn make_sequence_processor(sz: uint, to_parent: &Sender) { let mut freqs: HashMap, uint> = HashMap::new(); let mut carry = Vec::new(); - let mut total: uint = 0u; + let mut total: uint = 0; let mut line: Vec; @@ -122,23 +123,23 @@ fn make_sequence_processor(sz: uint, line = from_parent.recv().unwrap(); if line == Vec::new() { break; } - carry.push_all(line.as_slice()); - carry = windows_with_carry(carry.as_slice(), sz, |window| { + carry.push_all(&line); + carry = windows_with_carry(&carry, sz, |window| { update_freq(&mut freqs, window); - total += 1u; + total += 1; }); } let buffer = match sz { - 1u => { sort_and_fmt(&freqs, total) } - 2u => { sort_and_fmt(&freqs, total) } - 3u => { format!("{}\t{}", find(&freqs, "GGT".to_string()), "GGT") } - 4u => { format!("{}\t{}", find(&freqs, "GGTA".to_string()), "GGTA") } - 6u => { format!("{}\t{}", find(&freqs, "GGTATT".to_string()), "GGTATT") } - 12u => { format!("{}\t{}", find(&freqs, "GGTATTTTAATT".to_string()), "GGTATTTTAATT") } - 18u => { format!("{}\t{}", find(&freqs, "GGTATTTTAATTTATAGT".to_string()), + 1 => { sort_and_fmt(&freqs, total) } + 2 => { sort_and_fmt(&freqs, total) } + 3 => { format!("{}\t{}", find(&freqs, "GGT".to_string()), "GGT") } + 4 => { format!("{}\t{}", find(&freqs, "GGTA".to_string()), "GGTA") } + 6 => { format!("{}\t{}", find(&freqs, "GGTATT".to_string()), "GGTATT") } + 12 => { format!("{}\t{}", find(&freqs, "GGTATTTTAATT".to_string()), "GGTATTTTAATT") } + 18 => { format!("{}\t{}", find(&freqs, "GGTATTTTAATTTATAGT".to_string()), "GGTATTTTAATTTATAGT") } - _ => { "".to_string() } + _ => { "".to_string() } }; to_parent.send(buffer).unwrap(); @@ -146,9 +147,9 @@ fn make_sequence_processor(sz: uint, // given a FASTA file on stdin, process sequence THREE fn main() { - use std::io::{stdio, MemReader, BufferedReader}; + use std::old_io::{stdio, MemReader, BufferedReader}; - let rdr = if os::getenv("RUST_BENCH").is_some() { + let rdr = if env::var_os("RUST_BENCH").is_some() { let foo = include_bytes!("shootout-k-nucleotide.data"); box MemReader::new(foo.to_vec()) as Box } else { @@ -157,8 +158,8 @@ fn main() { let mut rdr = BufferedReader::new(rdr); // initialize each sequence sorter - let sizes = vec!(1u,2,3,4,6,12,18); - let mut streams = range(0, sizes.len()).map(|_| { + let sizes: Vec = vec!(1,2,3,4,6,12,18); + let mut streams = (0..sizes.len()).map(|_| { Some(channel::()) }).collect::>(); let mut from_child = Vec::new(); @@ -171,12 +172,12 @@ fn main() { let (to_child, from_parent) = channel(); - Thread::spawn(move|| { + thread::spawn(move|| { make_sequence_processor(sz, &from_parent, &to_parent_); }); to_child - }).collect:: >> >(); + }).collect::>>>(); // latch stores true after we've started @@ -184,15 +185,15 @@ fn main() { let mut proc_mode = false; for line in rdr.lines() { - let line = line.unwrap().as_slice().trim().to_string(); + let line = line.unwrap().trim().to_string(); - if line.len() == 0u { continue; } + if line.len() == 0 { continue; } match (line.as_bytes()[0] as char, proc_mode) { // start processing if this is the one ('>', false) => { - match line.as_slice().slice_from(1).find_str("THREE") { + match line[1..].find_str("THREE") { Some(_) => { proc_mode = true; } None => { } } diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs index 9057372d2c..fb75c67253 100644 --- a/src/test/bench/shootout-k-nucleotide.rs +++ b/src/test/bench/shootout-k-nucleotide.rs @@ -43,10 +43,9 @@ #![feature(box_syntax)] use std::ascii::OwnedAsciiExt; -use std::iter::repeat; use std::slice; use std::sync::Arc; -use std::thread::Thread; +use std::thread; static TABLE: [u8;4] = [ 'A' as u8, 'C' as u8, 'G' as u8, 'T' as u8 ]; static TABLE_SIZE: uint = 2 << 16; @@ -61,11 +60,9 @@ static OCCURRENCES: [&'static str;5] = [ // Code implementation -#[derive(PartialEq, PartialOrd, Ord, Eq)] +#[derive(Copy, PartialEq, PartialOrd, Ord, Eq)] struct Code(u64); -impl Copy for Code {} - impl Code { fn hash(&self) -> u64 { let Code(ret) = *self; @@ -87,7 +84,7 @@ impl Code { fn unpack(&self, frame: uint) -> String { let mut key = self.hash(); let mut result = Vec::new(); - for _ in range(0, frame) { + for _ in 0..frame { result.push(unpack_symbol((key as u8) & 3)); key >>= 2; } @@ -138,7 +135,7 @@ struct Items<'a> { impl Table { fn new() -> Table { Table { - items: range(0, TABLE_SIZE).map(|_| None).collect() + items: (0..TABLE_SIZE).map(|_| None).collect() } } @@ -245,7 +242,7 @@ fn generate_frequencies(mut input: &[u8], frame: uint) -> Table { let mut code = Code(0); // Pull first frame. - for _ in range(0, frame) { + for _ in 0..frame { code = code.push_char(input[0]); input = &input[1..]; } @@ -264,16 +261,16 @@ fn print_frequencies(frequencies: &Table, frame: uint) { for entry in frequencies.iter() { vector.push((entry.count, entry.code)); } - vector.as_mut_slice().sort(); + vector.sort(); let mut total_count = 0; - for &(count, _) in vector.iter() { + for &(count, _) in &vector { total_count += count; } for &(count, key) in vector.iter().rev() { println!("{} {:.3}", - key.unpack(frame).as_slice(), + key.unpack(frame), (count as f32 * 100.0) / (total_count as f32)); } println!(""); @@ -286,35 +283,37 @@ fn print_occurrences(frequencies: &mut Table, occurrence: &'static str) { fn get_sequence(r: &mut R, key: &str) -> Vec { let mut res = Vec::new(); for l in r.lines().map(|l| l.ok().unwrap()) - .skip_while(|l| key != l.as_slice().slice_to(key.len())).skip(1) + .skip_while(|l| key != &l[..key.len()]).skip(1) { - res.push_all(l.as_slice().trim().as_bytes()); + res.push_all(l.trim().as_bytes()); } res.into_ascii_uppercase() } fn main() { - let input = if std::os::getenv("RUST_BENCH").is_some() { - let fd = std::io::File::open(&Path::new("shootout-k-nucleotide.data")); - get_sequence(&mut std::io::BufferedReader::new(fd), ">THREE") + let input = if std::env::var_os("RUST_BENCH").is_some() { + let fd = std::old_io::File::open(&Path::new("shootout-k-nucleotide.data")); + get_sequence(&mut std::old_io::BufferedReader::new(fd), ">THREE") } else { - get_sequence(&mut *std::io::stdin().lock(), ">THREE") + let mut stdin = std::old_io::stdin(); + let mut stdin = stdin.lock(); + get_sequence(&mut *stdin, ">THREE") }; let input = Arc::new(input); - let nb_freqs: Vec<_> = range(1u, 3).map(|i| { + let nb_freqs: Vec<_> = (1..3).map(|i| { let input = input.clone(); - (i, Thread::scoped(move|| generate_frequencies(input.as_slice(), i))) + (i, thread::scoped(move|| generate_frequencies(&input, i))) }).collect(); let occ_freqs: Vec<_> = OCCURRENCES.iter().map(|&occ| { let input = input.clone(); - Thread::scoped(move|| generate_frequencies(input.as_slice(), occ.len())) + thread::scoped(move|| generate_frequencies(&input, occ.len())) }).collect(); - for (i, freq) in nb_freqs.into_iter() { - print_frequencies(&freq.join().ok().unwrap(), i); + for (i, freq) in nb_freqs { + print_frequencies(&freq.join(), i); } for (&occ, freq) in OCCURRENCES.iter().zip(occ_freqs.into_iter()) { - print_occurrences(&mut freq.join().ok().unwrap(), occ); + print_occurrences(&mut freq.join(), occ); } } diff --git a/src/test/bench/shootout-mandelbrot.rs b/src/test/bench/shootout-mandelbrot.rs index cf1264ff5d..bddf615322 100644 --- a/src/test/bench/shootout-mandelbrot.rs +++ b/src/test/bench/shootout-mandelbrot.rs @@ -39,22 +39,21 @@ // OF THE POSSIBILITY OF SUCH DAMAGE. #![feature(simd)] -#![allow(unstable)] // ignore-pretty very bad with line comments -use std::io; -use std::os; +use std::old_io; +use std::env; use std::simd::f64x2; use std::sync::Arc; -use std::thread::Thread; +use std::thread; -const ITER: int = 50; +const ITER: usize = 50; const LIMIT: f64 = 2.0; -const WORKERS: uint = 16; +const WORKERS: usize = 16; #[inline(always)] -fn mandelbrot(w: uint, mut out: W) -> io::IoResult<()> { +fn mandelbrot(w: usize, mut out: W) -> old_io::IoResult<()> { assert!(WORKERS % 2 == 0); // Ensure w and h are multiples of 8. @@ -81,8 +80,8 @@ fn mandelbrot(w: uint, mut out: W) -> io::IoResult<()> { let mut precalc_r = Vec::with_capacity(w); let mut precalc_i = Vec::with_capacity(h); - let precalc_futures = range(0, WORKERS).map(|i| { - Thread::scoped(move|| { + let precalc_futures = (0..WORKERS).map(|i| { + thread::scoped(move|| { let mut rs = Vec::with_capacity(w / WORKERS); let mut is = Vec::with_capacity(w / WORKERS); @@ -94,7 +93,7 @@ fn mandelbrot(w: uint, mut out: W) -> io::IoResult<()> { }; // This assumes w == h - for x in range(start, end) { + for x in start..end { let xf = x as f64; let xy = f64x2(xf, xf); @@ -107,8 +106,8 @@ fn mandelbrot(w: uint, mut out: W) -> io::IoResult<()> { }) }).collect::>(); - for res in precalc_futures.into_iter() { - let (rs, is) = res.join().ok().unwrap(); + for res in precalc_futures { + let (rs, is) = res.join(); precalc_r.extend(rs.into_iter()); precalc_i.extend(is.into_iter()); } @@ -119,13 +118,13 @@ fn mandelbrot(w: uint, mut out: W) -> io::IoResult<()> { let arc_init_r = Arc::new(precalc_r); let arc_init_i = Arc::new(precalc_i); - let data = range(0, WORKERS).map(|i| { + let data = (0..WORKERS).map(|i| { let vec_init_r = arc_init_r.clone(); let vec_init_i = arc_init_i.clone(); - Thread::scoped(move|| { + thread::scoped(move|| { let mut res: Vec = Vec::with_capacity((chunk_size * w) / 8); - let init_r_slice = vec_init_r.as_slice(); + let init_r_slice = vec_init_r; let start = i * chunk_size; let end = if i == (WORKERS - 1) { @@ -134,8 +133,8 @@ fn mandelbrot(w: uint, mut out: W) -> io::IoResult<()> { (i + 1) * chunk_size }; - for &init_i in vec_init_i.slice(start, end).iter() { - write_line(init_i, init_r_slice, &mut res); + for &init_i in &vec_init_i[start..end] { + write_line(init_i, &init_r_slice, &mut res); } res @@ -143,8 +142,8 @@ fn mandelbrot(w: uint, mut out: W) -> io::IoResult<()> { }).collect::>(); try!(writeln!(&mut out as &mut Writer, "P4\n{} {}", w, h)); - for res in data.into_iter() { - try!(out.write(res.join().ok().unwrap().as_slice())); + for res in data { + try!(out.write(&res.join())); } out.flush() } @@ -166,7 +165,7 @@ fn write_line(init_i: f64, vec_init_r: &[f64], res: &mut Vec) { let mut i_sq = v_init_i * v_init_i; let mut b = 0; - for _ in range(0, ITER) { + for _ in 0..ITER { let r = cur_r; let i = cur_i; @@ -198,14 +197,13 @@ fn write_line(init_i: f64, vec_init_r: &[f64], res: &mut Vec) { } fn main() { - let args = os::args(); - let args = args.as_slice(); + let mut args = env::args(); let res = if args.len() < 2 { println!("Test mode: do not dump the image because it's not utf8, \ which interferes with the test runner."); - mandelbrot(1000, io::util::NullWriter) + mandelbrot(1000, old_io::util::NullWriter) } else { - mandelbrot(args[1].parse().unwrap(), io::stdout()) + mandelbrot(args.nth(1).unwrap().parse().unwrap(), old_io::stdout()) }; res.unwrap(); } diff --git a/src/test/bench/shootout-meteor.rs b/src/test/bench/shootout-meteor.rs index 0480c9d884..a94fe0ccd9 100644 --- a/src/test/bench/shootout-meteor.rs +++ b/src/test/bench/shootout-meteor.rs @@ -43,7 +43,7 @@ use std::iter::repeat; use std::sync::Arc; use std::sync::mpsc::channel; -use std::thread::Thread; +use std::thread; // // Utilities. @@ -104,8 +104,8 @@ impl<'a, T> Iterator for ListIterator<'a, T> { // corresponding mirrored piece), with, as minimum coordinates, (0, // 0). If all is false, only generate half of the possibilities (used // to break the symmetry of the board). -fn transform(piece: Vec<(int, int)> , all: bool) -> Vec> { - let mut res: Vec> = +fn transform(piece: Vec<(i32, i32)> , all: bool) -> Vec> { + let mut res: Vec> = // rotations iterate(piece, |rot| rot.iter().map(|&(y, x)| (x + y, -y)).collect()) .take(if all {6} else {3}) @@ -116,9 +116,9 @@ fn transform(piece: Vec<(int, int)> , all: bool) -> Vec> { }).collect(); // translating to (0, 0) as minimum coordinates. - for cur_piece in res.iter_mut() { + for cur_piece in &mut res { let (dy, dx) = *cur_piece.iter().min_by(|e| *e).unwrap(); - for &mut (ref mut y, ref mut x) in cur_piece.iter_mut() { + for &mut (ref mut y, ref mut x) in cur_piece { *y -= dy; *x -= dx; } } @@ -133,14 +133,14 @@ fn transform(piece: Vec<(int, int)> , all: bool) -> Vec> { // Takes a piece with minimum coordinate (0, 0) (as generated by // transform). Returns the corresponding mask if p translated by (dy, // dx) is on the board. -fn mask(dy: int, dx: int, id: uint, p: &Vec<(int, int)>) -> Option { +fn mask(dy: i32, dx: i32, id: usize, p: &Vec<(i32, i32)>) -> Option { let mut m = 1 << (50 + id); - for &(y, x) in p.iter() { + for &(y, x) in p { let x = x + dx + (y + (dy % 2)) / 2; if x < 0 || x > 4 {return None;} let y = y + dy; if y < 0 || y > 9 {return None;} - m |= 1 << (y * 5 + x) as uint; + m |= 1 << (y * 5 + x) as usize; } Some(m) } @@ -150,26 +150,26 @@ fn mask(dy: int, dx: int, id: uint, p: &Vec<(int, int)>) -> Option { // (i/5, i%5). fn make_masks() -> Vec > > { let pieces = vec!( - vec!((0i,0i),(0,1),(0,2),(0,3),(1,3)), - vec!((0i,0i),(0,2),(0,3),(1,0),(1,1)), - vec!((0i,0i),(0,1),(0,2),(1,2),(2,1)), - vec!((0i,0i),(0,1),(0,2),(1,1),(2,1)), - vec!((0i,0i),(0,2),(1,0),(1,1),(2,1)), - vec!((0i,0i),(0,1),(0,2),(1,1),(1,2)), - vec!((0i,0i),(0,1),(1,1),(1,2),(2,1)), - vec!((0i,0i),(0,1),(0,2),(1,0),(1,2)), - vec!((0i,0i),(0,1),(0,2),(1,2),(1,3)), - vec!((0i,0i),(0,1),(0,2),(0,3),(1,2))); + vec!((0,0),(0,1),(0,2),(0,3),(1,3)), + vec!((0,0),(0,2),(0,3),(1,0),(1,1)), + vec!((0,0),(0,1),(0,2),(1,2),(2,1)), + vec!((0,0),(0,1),(0,2),(1,1),(2,1)), + vec!((0,0),(0,2),(1,0),(1,1),(2,1)), + vec!((0,0),(0,1),(0,2),(1,1),(1,2)), + vec!((0,0),(0,1),(1,1),(1,2),(2,1)), + vec!((0,0),(0,1),(0,2),(1,0),(1,2)), + vec!((0,0),(0,1),(0,2),(1,2),(1,3)), + vec!((0,0),(0,1),(0,2),(0,3),(1,2))); // To break the central symmetry of the problem, every // transformation must be taken except for one piece (piece 3 // here). - let transforms: Vec>> = + let transforms: Vec>> = pieces.into_iter().enumerate() .map(|(id, p)| transform(p, id != 3)) .collect(); - range(0i, 50).map(|yx| { + (0i32..50).map(|yx| { transforms.iter().enumerate().map(|(id, t)| { t.iter().filter_map(|p| mask(yx / 5, yx % 5, id, p)).collect() }).collect() @@ -184,7 +184,7 @@ fn is_board_unfeasible(board: u64, masks: &Vec>>) -> bool { if board & 1 << i != 0 { continue; } for (cur_id, pos_masks) in masks_at.iter().enumerate() { if board & 1 << (50 + cur_id) != 0 { continue; } - for &cur_m in pos_masks.iter() { + for &cur_m in pos_masks { if cur_m & board != 0 { continue; } coverable |= cur_m; // if every coordinates can be covered and every @@ -199,10 +199,10 @@ fn is_board_unfeasible(board: u64, masks: &Vec>>) -> bool { // Filter the masks that we can prove to result to unfeasible board. fn filter_masks(masks: &mut Vec>>) { - for i in range(0, masks.len()) { - for j in range(0, (*masks)[i].len()) { + for i in 0..masks.len() { + for j in 0..(*masks)[i].len() { masks[i][j] = - (*masks)[i][j].iter().map(|&m| m) + (*masks)[i][j].iter().cloned() .filter(|&m| !is_board_unfeasible(m, masks)) .collect(); } @@ -211,8 +211,8 @@ fn filter_masks(masks: &mut Vec>>) { // Gets the identifier of a mask. fn get_id(m: u64) -> u8 { - for id in range(0u8, 10) { - if m & (1 << (id + 50) as uint) != 0 {return id;} + for id in 0u8..10 { + if m & (1 << (id + 50) as usize) != 0 {return id;} } panic!("{:016x} does not have a valid identifier", m); } @@ -222,7 +222,7 @@ fn to_vec(raw_sol: &List) -> Vec { let mut sol = repeat('.' as u8).take(50).collect::>(); for &m in raw_sol.iter() { let id = '0' as u8 + get_id(m); - for i in range(0u, 50) { + for i in 0..50 { if m & 1 << i != 0 { sol[i] = id; } @@ -244,7 +244,7 @@ fn print_sol(sol: &Vec) { // The data managed during the search struct Data { // Number of solution found. - nb: int, + nb: isize, // Lexicographically minimal solution found. min: Vec, // Lexicographically maximal solution found. @@ -270,7 +270,7 @@ fn handle_sol(raw_sol: &List, data: &mut Data) { // reverse order, i.e. the board rotated by half a turn. data.nb += 2; let sol1 = to_vec(raw_sol); - let sol2: Vec = sol1.iter().rev().map(|x| *x).collect(); + let sol2: Vec = sol1.iter().rev().cloned().collect(); if data.nb == 2 { data.min = sol1.clone(); @@ -286,7 +286,7 @@ fn handle_sol(raw_sol: &List, data: &mut Data) { fn search( masks: &Vec>>, board: u64, - mut i: uint, + mut i: usize, cur: List, data: &mut Data) { @@ -297,7 +297,7 @@ fn search( let masks_at = &masks[i]; // for every unused piece - for id in range(0u, 10).filter(|&id| board & (1 << (id + 50)) == 0) { + for id in (0..10).filter(|&id| board & (1 << (id + 50)) == 0) { // for each mask that fits on the board for m in masks_at[id].iter().filter(|&m| board & *m == 0) { // This check is too costly. @@ -317,7 +317,7 @@ fn par_search(masks: Vec>>) -> Data { let masks = masks.clone(); let tx = tx.clone(); let m = *m; - Thread::spawn(move|| { + thread::spawn(move|| { let mut data = Data::new(); search(&*masks, m, 1, List::Cons(m, &List::Nil), &mut data); tx.send(data).unwrap(); diff --git a/src/test/bench/shootout-nbody.rs b/src/test/bench/shootout-nbody.rs index 7973af3722..534dfe9548 100644 --- a/src/test/bench/shootout-nbody.rs +++ b/src/test/bench/shootout-nbody.rs @@ -94,23 +94,22 @@ static BODIES: [Planet;N_BODIES] = [ }, ]; +#[derive(Copy)] struct Planet { x: f64, y: f64, z: f64, vx: f64, vy: f64, vz: f64, mass: f64, } -impl Copy for Planet {} - fn advance(bodies: &mut [Planet;N_BODIES], dt: f64, steps: int) { - for _ in range(0, steps) { - let mut b_slice = bodies.as_mut_slice(); + for _ in 0..steps { + let mut b_slice: &mut [_] = bodies; loop { let bi = match shift_mut_ref(&mut b_slice) { Some(bi) => bi, None => break }; - for bj in b_slice.iter_mut() { + for bj in &mut *b_slice { let dx = bi.x - bj.x; let dy = bi.y - bj.y; let dz = bi.z - bj.z; @@ -159,7 +158,7 @@ fn offset_momentum(bodies: &mut [Planet;N_BODIES]) { let mut px = 0.0; let mut py = 0.0; let mut pz = 0.0; - for bi in bodies.iter() { + for bi in &*bodies { px += bi.vx * bi.mass; py += bi.vy * bi.mass; pz += bi.vz * bi.mass; @@ -171,11 +170,11 @@ fn offset_momentum(bodies: &mut [Planet;N_BODIES]) { } fn main() { - let n = if std::os::getenv("RUST_BENCH").is_some() { + let n = if std::env::var_os("RUST_BENCH").is_some() { 5000000 } else { - std::os::args().as_slice().get(1) - .and_then(|arg| arg.parse()) + std::env::args().nth(1) + .and_then(|arg| arg.parse().ok()) .unwrap_or(1000) }; let mut bodies = BODIES; @@ -202,6 +201,6 @@ fn shift_mut_ref<'a, T>(r: &mut &'a mut [T]) -> Option<&'a mut T> { raw.data = raw.data.offset(1); raw.len -= 1; *r = mem::transmute(raw); - Some(unsafe { &mut *ret }) + Some({ &mut *ret }) } } diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs index 3953d3f9cd..a542c81f23 100644 --- a/src/test/bench/shootout-pfib.rs +++ b/src/test/bench/shootout-pfib.rs @@ -21,13 +21,13 @@ extern crate getopts; use std::sync::mpsc::{channel, Sender}; -use std::os; +use std::env; use std::result::Result::{Ok, Err}; -use std::thread::Thread; +use std::thread; use std::time::Duration; -fn fib(n: int) -> int { - fn pfib(tx: &Sender, n: int) { +fn fib(n: isize) -> isize { + fn pfib(tx: &Sender, n: isize) { if n == 0 { tx.send(0).unwrap(); } else if n <= 2 { @@ -35,15 +35,15 @@ fn fib(n: int) -> int { } else { let (tx1, rx) = channel(); let tx2 = tx1.clone(); - Thread::spawn(move|| pfib(&tx2, n - 1)); + thread::spawn(move|| pfib(&tx2, n - 1)); let tx2 = tx1.clone(); - Thread::spawn(move|| pfib(&tx2, n - 2)); + thread::spawn(move|| pfib(&tx2, n - 2)); tx.send(rx.recv().unwrap() + rx.recv().unwrap()); } } let (tx, rx) = channel(); - Thread::spawn(move|| pfib(&tx, n) ); + thread::spawn(move|| pfib(&tx, n) ); rx.recv().unwrap() } @@ -55,9 +55,9 @@ fn parse_opts(argv: Vec ) -> Config { let opts = vec!(getopts::optflag("", "stress", "")); let argv = argv.iter().map(|x| x.to_string()).collect::>(); - let opt_args = argv.slice(1, argv.len()); + let opt_args = &argv[1..argv.len()]; - match getopts::getopts(opt_args, opts.as_slice()) { + match getopts::getopts(opt_args, &opts) { Ok(ref m) => { return Config {stress: m.opt_present("stress")} } @@ -65,10 +65,10 @@ fn parse_opts(argv: Vec ) -> Config { } } -fn stress_task(id: int) { - let mut i = 0i; +fn stress_task(id: isize) { + let mut i = 0; loop { - let n = 15i; + let n = 15; assert_eq!(fib(n), fib(n)); i += 1; println!("{}: Completed {} iterations", id, i); @@ -77,24 +77,24 @@ fn stress_task(id: int) { fn stress(num_tasks: int) { let mut results = Vec::new(); - for i in range(0, num_tasks) { - results.push(Thread::scoped(move|| { + for i in 0..num_tasks { + results.push(thread::spawn(move|| { stress_task(i); })); } - for r in results.into_iter() { + for r in results { let _ = r.join(); } } fn main() { - let args = os::args(); - let args = if os::getenv("RUST_BENCH").is_some() { + let args = env::args(); + let args = if env::var_os("RUST_BENCH").is_some() { vec!("".to_string(), "20".to_string()) - } else if args.len() <= 1u { + } else if args.len() <= 1 { vec!("".to_string(), "8".to_string()) } else { - args.into_iter().map(|x| x.to_string()).collect() + args.map(|x| x.to_string()).collect() }; let opts = parse_opts(args.clone()); @@ -102,12 +102,12 @@ fn main() { if opts.stress { stress(2); } else { - let max = args[1].parse::().unwrap(); + let max = args[1].parse::().unwrap(); let num_trials = 10; - for n in range(1, max + 1) { - for _ in range(0u, num_trials) { + for n in 1..max + 1 { + for _ in 0..num_trials { let mut fibn = None; let dur = Duration::span(|| fibn = Some(fib(n))); let fibn = fibn.unwrap(); diff --git a/src/test/bench/shootout-regex-dna.rs b/src/test/bench/shootout-regex-dna.rs deleted file mode 100644 index 074c059231..0000000000 --- a/src/test/bench/shootout-regex-dna.rs +++ /dev/null @@ -1,126 +0,0 @@ -// The Computer Language Benchmarks Game -// http://benchmarksgame.alioth.debian.org/ -// -// contributed by the Rust Project Developers - -// Copyright (c) 2014 The Rust Project Developers -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// - Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in -// the documentation and/or other materials provided with the -// distribution. -// -// - Neither the name of "The Computer Language Benchmarks Game" nor -// the name of "The Computer Language Shootout Benchmarks" nor the -// names of its contributors may be used to endorse or promote -// products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -// OF THE POSSIBILITY OF SUCH DAMAGE. - -// ignore-stage1 -// ignore-cross-compile #12102 - -#![feature(box_syntax)] - -extern crate regex; - -use std::io; -use regex::{NoExpand, Regex}; -use std::sync::{Arc, Future}; - -macro_rules! regex { - ($e:expr) => (Regex::new($e).unwrap()) -} - -fn count_matches(seq: &str, variant: &Regex) -> int { - let mut n = 0; - for _ in variant.find_iter(seq) { - n += 1; - } - n -} - -fn main() { - let mut rdr = if std::os::getenv("RUST_BENCH").is_some() { - let fd = io::File::open(&Path::new("shootout-k-nucleotide.data")); - box io::BufferedReader::new(fd) as Box - } else { - box io::stdin() as Box - }; - let mut seq = rdr.read_to_string().unwrap(); - let ilen = seq.len(); - - seq = regex!(">[^\n]*\n|\n").replace_all(seq.as_slice(), NoExpand("")); - let seq_arc = Arc::new(seq.clone()); // copy before it moves - let clen = seq.len(); - - let mut seqlen = Future::spawn(move|| { - let substs = vec![ - (regex!("B"), "(c|g|t)"), - (regex!("D"), "(a|g|t)"), - (regex!("H"), "(a|c|t)"), - (regex!("K"), "(g|t)"), - (regex!("M"), "(a|c)"), - (regex!("N"), "(a|c|g|t)"), - (regex!("R"), "(a|g)"), - (regex!("S"), "(c|g)"), - (regex!("V"), "(a|c|g)"), - (regex!("W"), "(a|t)"), - (regex!("Y"), "(c|t)"), - ]; - let mut seq = seq; - for (re, replacement) in substs.into_iter() { - seq = re.replace_all(seq.as_slice(), NoExpand(replacement)); - } - seq.len() - }); - - let variants = vec![ - regex!("agggtaaa|tttaccct"), - regex!("[cgt]gggtaaa|tttaccc[acg]"), - regex!("a[act]ggtaaa|tttacc[agt]t"), - regex!("ag[act]gtaaa|tttac[agt]ct"), - regex!("agg[act]taaa|ttta[agt]cct"), - regex!("aggg[acg]aaa|ttt[cgt]ccct"), - regex!("agggt[cgt]aa|tt[acg]accct"), - regex!("agggta[cgt]a|t[acg]taccct"), - regex!("agggtaa[cgt]|[acg]ttaccct"), - ]; - let (mut variant_strs, mut counts) = (vec!(), vec!()); - for variant in variants.into_iter() { - let seq_arc_copy = seq_arc.clone(); - variant_strs.push(variant.to_string()); - counts.push(Future::spawn(move|| { - count_matches(seq_arc_copy.as_slice(), &variant) - })); - } - - for (i, variant) in variant_strs.iter().enumerate() { - println!("{} {}", variant, counts[i].get()); - } - println!(""); - println!("{}", ilen); - println!("{}", clen); - println!("{}", seqlen.get()); -} diff --git a/src/test/bench/shootout-reverse-complement.rs b/src/test/bench/shootout-reverse-complement.rs index 841f70e13c..33d959dfe9 100644 --- a/src/test/bench/shootout-reverse-complement.rs +++ b/src/test/bench/shootout-reverse-complement.rs @@ -44,10 +44,10 @@ extern crate libc; -use std::io::stdio::{stdin_raw, stdout_raw}; -use std::io::{IoResult, EndOfFile}; +use std::old_io::stdio::{stdin_raw, stdout_raw}; +use std::old_io::{IoResult, EndOfFile}; use std::ptr::{copy_memory, Unique}; -use std::thread::Thread; +use std::thread; struct Tables { table8: [u8;1 << 8], @@ -90,12 +90,12 @@ impl Tables { } } - /// Retreives the complement for `i`. + /// Retrieves the complement for `i`. fn cpl8(&self, i: u8) -> u8 { self.table8[i as uint] } - /// Retreives the complement for `i`. + /// Retrieves the complement for `i`. fn cpl16(&self, i: u16) -> u16 { self.table16[i as uint] } @@ -155,7 +155,7 @@ impl<'a> Iterator for MutDnaSeqs<'a> { fn next(&mut self) -> Option<&'a mut [u8]> { let tmp = std::mem::replace(&mut self.s, &mut []); let tmp = match memchr(tmp, b'\n') { - Some(i) => tmp.slice_from_mut(i + 1), + Some(i) => &mut tmp[i + 1..], None => return None, }; let (seq, tmp) = match memchr(tmp, b'>') { @@ -229,21 +229,12 @@ unsafe impl Send for Racy {} /// Executes a closure in parallel over the given iterator over mutable slice. /// The closure `f` is run in parallel with an element of `iter`. -fn parallel<'a, I, T, F>(mut iter: I, f: F) - where T: 'a+Send + Sync, - I: Iterator, - F: Fn(&mut [T]) + Sync { - use std::mem; - use std::raw::Repr; - - iter.map(|chunk| { - // Need to convert `f` and `chunk` to something that can cross the task - // boundary. - let f = Racy(&f as *const F as *const uint); - let raw = Racy(chunk.repr()); - Thread::scoped(move|| { - let f = f.0 as *const F; - unsafe { (*f)(mem::transmute(raw.0)) } +fn parallel<'a, I: Iterator, F>(iter: I, ref f: F) + where I::Item: Send + 'a, + F: Fn(I::Item) + Sync + 'a { + iter.map(|x| { + thread::scoped(move|| { + f(x) }) }).collect::>(); } @@ -251,6 +242,6 @@ fn parallel<'a, I, T, F>(mut iter: I, f: F) fn main() { let mut data = read_to_end(&mut stdin_raw()).unwrap(); let tables = &Tables::new(); - parallel(mut_dna_seqs(data.as_mut_slice()), |&: seq| reverse_complement(seq, tables)); - stdout_raw().write(data.as_mut_slice()).unwrap(); + parallel(mut_dna_seqs(&mut data), |seq| reverse_complement(seq, tables)); + stdout_raw().write(&data).unwrap(); } diff --git a/src/test/bench/shootout-spectralnorm.rs b/src/test/bench/shootout-spectralnorm.rs index f332a40164..f7514a3e88 100644 --- a/src/test/bench/shootout-spectralnorm.rs +++ b/src/test/bench/shootout-spectralnorm.rs @@ -44,21 +44,22 @@ #![feature(unboxed_closures)] use std::iter::{repeat, AdditiveIterator}; -use std::thread::Thread; +use std::thread; use std::mem; use std::num::Float; use std::os; +use std::env; use std::raw::Repr; use std::simd::f64x2; fn main() { - let args = os::args(); - let answer = spectralnorm(if os::getenv("RUST_BENCH").is_some() { + let mut args = env::args(); + let answer = spectralnorm(if env::var_os("RUST_BENCH").is_some() { 5500 } else if args.len() < 2 { 2000 } else { - args[1].parse().unwrap() + args.nth(1).unwrap().parse().unwrap() }); println!("{:.9}", answer); } @@ -68,11 +69,11 @@ fn spectralnorm(n: uint) -> f64 { let mut u = repeat(1.0).take(n).collect::>(); let mut v = u.clone(); let mut tmp = v.clone(); - for _ in range(0u, 10) { - mult_AtAv(u.as_slice(), v.as_mut_slice(), tmp.as_mut_slice()); - mult_AtAv(v.as_slice(), u.as_mut_slice(), tmp.as_mut_slice()); + for _ in 0..10 { + mult_AtAv(&u, &mut v, &mut tmp); + mult_AtAv(&v, &mut u, &mut tmp); } - (dot(u.as_slice(), v.as_slice()) / dot(v.as_slice(), v.as_slice())).sqrt() + (dot(&u, &v) / dot(&v, &v)).sqrt() } fn mult_AtAv(v: &[f64], out: &mut [f64], tmp: &mut [f64]) { @@ -111,26 +112,16 @@ fn dot(v: &[f64], u: &[f64]) -> f64 { } -struct Racy(T); - -unsafe impl Send for Racy {} - // Executes a closure in parallel over the given mutable slice. The closure `f` // is run in parallel and yielded the starting index within `v` as well as a // sub-slice of `v`. -fn parallel(v: &mut [T], f: F) - where T: Send + Sync, - F: Fn(uint, &mut [T]) + Sync { +fn parallel<'a,T, F>(v: &mut [T], ref f: F) + where T: Send + Sync + 'a, + F: Fn(uint, &mut [T]) + Sync + 'a { let size = v.len() / os::num_cpus() + 1; - v.chunks_mut(size).enumerate().map(|(i, chunk)| { - // Need to convert `f` and `chunk` to something that can cross the task - // boundary. - let f = Racy(&f as *const _ as *const uint); - let raw = Racy(chunk.repr()); - Thread::scoped(move|| { - let f = f.0 as *const F; - unsafe { (*f)(i * size, mem::transmute(raw.0)) } + thread::scoped(move|| { + f(i * size, chunk) }) }).collect::>(); } diff --git a/src/test/bench/shootout-threadring.rs b/src/test/bench/shootout-threadring.rs index da427b36e8..2653e758a4 100644 --- a/src/test/bench/shootout-threadring.rs +++ b/src/test/bench/shootout-threadring.rs @@ -39,39 +39,39 @@ // OF THE POSSIBILITY OF SUCH DAMAGE. use std::sync::mpsc::{channel, Sender, Receiver}; -use std::thread::Thread; +use std::thread; -fn start(n_tasks: int, token: int) { +fn start(n_tasks: i32, token: i32) { let (tx, mut rx) = channel(); - tx.send(token); - for i in range(2, n_tasks + 1) { + tx.send(token).unwrap(); + let mut guards = Vec::with_capacity(n_tasks as usize); + for i in 2 .. n_tasks + 1 { let (tx, next_rx) = channel(); - Thread::spawn(move|| roundtrip(i, tx, rx)); - rx = next_rx; + let cur_rx = std::mem::replace(&mut rx, next_rx); + guards.push(thread::spawn(move|| roundtrip(i, tx, cur_rx))); } - Thread::spawn(move|| roundtrip(1, tx, rx)); + let guard = thread::spawn(move|| roundtrip(1, tx, rx)); } -fn roundtrip(id: int, tx: Sender, rx: Receiver) { +fn roundtrip(id: i32, tx: Sender, rx: Receiver) { for token in rx.iter() { if token == 1 { println!("{}", id); break; } - tx.send(token - 1); + tx.send(token - 1).unwrap(); } } fn main() { - let args = std::os::args(); - let args = args.as_slice(); - let token = if std::os::getenv("RUST_BENCH").is_some() { + let mut args = std::env::args(); + let token = if std::env::var_os("RUST_BENCH").is_some() { 2000000 } else { - args.get(1).and_then(|arg| arg.parse()).unwrap_or(1000) + args.nth(1).and_then(|arg| arg.parse().ok()).unwrap_or(1000) }; - let n_tasks = args.get(2) - .and_then(|arg| arg.parse()) + let n_tasks = args.next() + .and_then(|arg| arg.parse().ok()) .unwrap_or(503); start(n_tasks, token); diff --git a/src/test/bench/std-smallintmap.rs b/src/test/bench/std-smallintmap.rs index c2e657151f..a54a869412 100644 --- a/src/test/bench/std-smallintmap.rs +++ b/src/test/bench/std-smallintmap.rs @@ -11,41 +11,40 @@ // Microbenchmark for the smallintmap library use std::collections::VecMap; -use std::os; +use std::env; use std::time::Duration; -use std::uint; -fn append_sequential(min: uint, max: uint, map: &mut VecMap) { - for i in range(min, max) { - map.insert(i, i + 22u); +fn append_sequential(min: usize, max: usize, map: &mut VecMap) { + for i in min..max { + map.insert(i, i + 22); } } -fn check_sequential(min: uint, max: uint, map: &VecMap) { - for i in range(min, max) { - assert_eq!(map[i], i + 22u); +fn check_sequential(min: usize, max: usize, map: &VecMap) { + for i in min..max { + assert_eq!(map[i], i + 22); } } fn main() { - let args = os::args(); - let args = if os::getenv("RUST_BENCH").is_some() { + let args = env::args(); + let args = if env::var_os("RUST_BENCH").is_some() { vec!("".to_string(), "100000".to_string(), "100".to_string()) - } else if args.len() <= 1u { + } else if args.len() <= 1 { vec!("".to_string(), "10000".to_string(), "50".to_string()) } else { - args.into_iter().collect() + args.collect() }; - let max = args[1].parse::().unwrap(); - let rep = args[2].parse::().unwrap(); + let max = args[1].parse::().unwrap(); + let rep = args[2].parse::().unwrap(); let mut checkf = Duration::seconds(0); let mut appendf = Duration::seconds(0); - for _ in range(0u, rep) { + for _ in 0..rep { let mut map = VecMap::new(); - let d1 = Duration::span(|| append_sequential(0u, max, &mut map)); - let d2 = Duration::span(|| check_sequential(0u, max, &map)); + let d1 = Duration::span(|| append_sequential(0, max, &mut map)); + let d2 = Duration::span(|| check_sequential(0, max, &map)); checkf = checkf + d2; appendf = appendf + d1; diff --git a/src/test/bench/sudoku.rs b/src/test/bench/sudoku.rs index 786bbdfc80..b45f241e8e 100644 --- a/src/test/bench/sudoku.rs +++ b/src/test/bench/sudoku.rs @@ -13,12 +13,12 @@ #![feature(box_syntax)] #![allow(non_snake_case)] -use std::io::BufferedReader; -use std::io::stdio::StdReader; -use std::io; +use std::old_io::BufferedReader; +use std::old_io::stdio::StdReader; +use std::old_io; use std::iter::repeat; use std::num::Int; -use std::os; +use std::env; // Computes a single solution to a given 9x9 sudoku // @@ -49,24 +49,12 @@ impl Sudoku { } pub fn from_vec(vec: &[[u8;9];9]) -> Sudoku { - let g = range(0, 9u).map(|i| { - range(0, 9u).map(|j| { vec[i][j] }).collect() + let g = (0..9).map(|i| { + (0..9).map(|j| { vec[i][j] }).collect() }).collect(); return Sudoku::new(g) } - pub fn equal(&self, other: &Sudoku) -> bool { - for row in range(0u8, 9u8) { - for col in range(0u8, 9u8) { - if self.grid[row as uint][col as uint] != - other.grid[row as uint][col as uint] { - return false; - } - } - } - return true; - } - pub fn read(mut reader: &mut BufferedReader) -> Sudoku { /* assert first line is exactly "9,9" */ assert!(reader.read_line().unwrap() == "9,9".to_string()); @@ -75,12 +63,12 @@ impl Sudoku { .take(10).collect::>(); for line in reader.lines() { let line = line.unwrap(); - let comps: Vec<&str> = line.as_slice() + let comps: Vec<&str> = line .trim() .split(',') .collect(); - if comps.len() == 3u { + if comps.len() == 3 { let row = comps[0].parse::().unwrap(); let col = comps[1].parse::().unwrap(); g[row as uint][col as uint] = comps[2].parse().unwrap(); @@ -92,10 +80,10 @@ impl Sudoku { return Sudoku::new(g) } - pub fn write(&self, writer: &mut io::Writer) { - for row in range(0u8, 9u8) { + pub fn write(&self, writer: &mut old_io::Writer) { + for row in 0u8..9u8 { write!(writer, "{}", self.grid[row as uint][0]); - for col in range(1u8, 9u8) { + for col in 1u8..9u8 { write!(writer, " {}", self.grid[row as uint][col as uint]); } write!(writer, "\n"); @@ -105,8 +93,8 @@ impl Sudoku { // solve sudoku grid pub fn solve(&mut self) { let mut work: Vec<(u8, u8)> = Vec::new(); /* queue of uncolored fields */ - for row in range(0u8, 9u8) { - for col in range(0u8, 9u8) { + for row in 0u8..9u8 { + for col in 0u8..9u8 { let color = self.grid[row as uint][col as uint]; if color == 0u8 { work.push((row, col)); @@ -114,7 +102,7 @@ impl Sudoku { } } - let mut ptr = 0u; + let mut ptr = 0; let end = work.len(); while ptr < end { let (row, col) = work[ptr]; @@ -123,11 +111,11 @@ impl Sudoku { (1 as u8); if self.next_color(row, col, the_color) { // yes: advance work list - ptr = ptr + 1u; + ptr = ptr + 1; } else { // no: redo this field aft recoloring pred; unless there is none - if ptr == 0u { panic!("No solution found for this sudoku"); } - ptr = ptr - 1u; + if ptr == 0 { panic!("No solution found for this sudoku"); } + ptr = ptr - 1; } } } @@ -151,7 +139,7 @@ impl Sudoku { // find colors available in neighbourhood of (row, col) fn drop_colors(&mut self, avail: &mut Colors, row: u8, col: u8) { - for idx in range(0u8, 9u8) { + for idx in 0u8..9u8 { /* check same column fields */ avail.remove(self.grid[idx as uint][col as uint]); /* check same row fields */ @@ -161,8 +149,8 @@ impl Sudoku { // check same block fields let row0 = (row / 3u8) * 3u8; let col0 = (col / 3u8) * 3u8; - for alt_row in range(row0, row0 + 3u8) { - for alt_col in range(col0, col0 + 3u8) { + for alt_row in row0..row0 + 3u8 { + for alt_col in col0..col0 + 3u8 { avail.remove(self.grid[alt_row as uint][alt_col as uint]); } } @@ -184,7 +172,7 @@ impl Colors { fn next(&self) -> u8 { let Colors(c) = *self; let val = c & HEADS; - if (0u16 == val) { + if 0u16 == val { return 0u8; } else { return val.trailing_zeros() as u8 @@ -281,13 +269,15 @@ fn check_DEFAULT_SUDOKU_solution() { } fn main() { - let args = os::args(); - let use_default = args.len() == 1u; + let args = env::args(); + let use_default = args.len() == 1; let mut sudoku = if use_default { Sudoku::from_vec(&DEFAULT_SUDOKU) } else { - Sudoku::read(&mut *io::stdin().lock()) + let mut stdin = old_io::stdin(); + let mut stdin = stdin.lock(); + Sudoku::read(&mut *stdin) }; sudoku.solve(); - sudoku.write(&mut io::stdout()); + sudoku.write(&mut old_io::stdout()); } diff --git a/src/test/bench/task-perf-alloc-unwind.rs b/src/test/bench/task-perf-alloc-unwind.rs index dc536102d5..6b412c47cd 100644 --- a/src/test/bench/task-perf-alloc-unwind.rs +++ b/src/test/bench/task-perf-alloc-unwind.rs @@ -10,8 +10,8 @@ #![feature(unsafe_destructor, box_syntax)] -use std::os; -use std::thread::Thread; +use std::env; +use std::thread; use std::time::Duration; #[derive(Clone)] @@ -19,12 +19,8 @@ enum List { Nil, Cons(T, Box>) } -enum UniqueList { - ULNil, ULCons(Box) -} - fn main() { - let (repeat, depth) = if os::getenv("RUST_BENCH").is_some() { + let (repeat, depth) = if env::var_os("RUST_BENCH").is_some() { (50, 1000) } else { (10, 10) @@ -34,9 +30,9 @@ fn main() { } fn run(repeat: int, depth: int) { - for _ in range(0, repeat) { + for _ in 0..repeat { let dur = Duration::span(|| { - let _ = Thread::scoped(move|| { + let _ = thread::spawn(move|| { recurse_or_panic(depth, None) }).join(); }); @@ -44,7 +40,9 @@ fn run(repeat: int, depth: int) { } } -type nillist = List<()>; +// FIXME(#21721) used to be `List<()>` but that can cause +// certain LLVM versions to abort during optimizations. +type nillist = List<[u8; 0]>; // Filled with things that have to be unwound @@ -85,11 +83,11 @@ fn recurse_or_panic(depth: int, st: Option) { } Some(st) => { let mut v = st.vec.clone(); - v.push_all(&[box List::Cons((), st.vec.last().unwrap().clone())]); + v.push_all(&[box List::Cons([], st.vec.last().unwrap().clone())]); State { - unique: box List::Cons((), box *st.unique), + unique: box List::Cons([], box *st.unique), vec: v, - res: r(box List::Cons((), st.res._l.clone())), + res: r(box List::Cons([], st.res._l.clone())), } } }; diff --git a/src/test/bench/task-perf-jargon-metal-smoke.rs b/src/test/bench/task-perf-jargon-metal-smoke.rs index a2a380279f..e36d685d7c 100644 --- a/src/test/bench/task-perf-jargon-metal-smoke.rs +++ b/src/test/bench/task-perf-jargon-metal-smoke.rs @@ -18,17 +18,16 @@ // ignore-pretty very bad with line comments use std::sync::mpsc::{channel, Sender}; -use std::os; -use std::thread::Thread; -use std::uint; +use std::env; +use std::thread; fn child_generation(gens_left: uint, 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, - Thread::spawn(move|| { + thread::spawn(move|| { if gens_left & 1 == 1 { - Thread::yield_now(); // shake things up a bit + thread::yield_now(); // shake things up a bit } if gens_left > 0 { child_generation(gens_left - 1, tx); // recurse @@ -39,13 +38,13 @@ fn child_generation(gens_left: uint, tx: Sender<()>) { } fn main() { - let args = os::args(); - let args = if os::getenv("RUST_BENCH").is_some() { + let args = env::args(); + let args = if env::var_os("RUST_BENCH").is_some() { vec!("".to_string(), "100000".to_string()) } else if args.len() <= 1 { vec!("".to_string(), "100".to_string()) } else { - args.clone().into_iter().collect() + args.collect() }; let (tx, rx) = channel(); diff --git a/src/test/bench/task-perf-one-million.rs b/src/test/bench/task-perf-one-million.rs deleted file mode 100644 index e3b51cb6b5..0000000000 --- a/src/test/bench/task-perf-one-million.rs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test for concurrent tasks - -// ignore-test OOM on linux-32 without opts - -use std::os; -use std::task; -use std::uint; -use std::slice; - -fn calc(children: uint, parent_wait_chan: &Sender>>) { - - let wait_ports: Vec>>> = vec::from_fn(children, |_| { - let (wait_port, wait_chan) = stream::>>(); - task::spawn(move|| { - calc(children / 2, &wait_chan); - }); - wait_port - }); - - let child_start_chans: Vec>> = - wait_ports.into_iter().map(|port| port.recv()).collect(); - - let (start_port, start_chan) = stream::>(); - parent_wait_chan.send(start_chan); - let parent_result_chan: Sender = start_port.recv(); - - let child_sum_ports: Vec> = - child_start_chans.into_iter().map(|child_start_chan| { - let (child_sum_port, child_sum_chan) = stream::(); - child_start_chan.send(child_sum_chan); - child_sum_port - }).collect(); - - let sum = child_sum_ports.into_iter().fold(0, |sum, sum_port| sum + sum_port.recv() ); - - parent_result_chan.send(sum + 1); -} - -fn main() { - let args = os::args(); - let args = if os::getenv("RUST_BENCH").is_some() { - vec!("".to_string(), "30".to_string()) - } else if args.len() <= 1u { - vec!("".to_string(), "10".to_string()) - } else { - args - }; - - let children = from_str::(args[1]).unwrap(); - let (wait_port, wait_chan) = stream(); - task::spawn(move|| { - calc(children, &wait_chan); - }); - - let start_chan = wait_port.recv(); - let (sum_port, sum_chan) = stream::(); - start_chan.send(sum_chan); - let sum = sum_port.recv(); - println!("How many tasks? {} tasks.", sum); -} diff --git a/src/test/bench/task-perf-spawnalot.rs b/src/test/bench/task-perf-spawnalot.rs index eb1e30e284..b5aa8e8d79 100644 --- a/src/test/bench/task-perf-spawnalot.rs +++ b/src/test/bench/task-perf-spawnalot.rs @@ -8,30 +8,29 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::os; -use std::uint; -use std::thread::Thread; +use std::env; +use std::thread; -fn f(n: uint) { - let mut i = 0u; +fn f(n: usize) { + let mut i = 0; while i < n { - let _ = Thread::scoped(move|| g()).join(); - i += 1u; + let _ = thread::spawn(move|| g()).join(); + i += 1; } } fn g() { } fn main() { - let args = os::args(); - let args = if os::getenv("RUST_BENCH").is_some() { + let args = env::args(); + let args = if env::var_os("RUST_BENCH").is_some() { vec!("".to_string(), "400".to_string()) - } else if args.len() <= 1u { + } else if args.len() <= 1 { vec!("".to_string(), "10".to_string()) } else { - args.into_iter().collect() + args.collect() }; let n = args[1].parse().unwrap(); - let mut i = 0u; - while i < n { Thread::spawn(move|| f(n) ); i += 1u; } + let mut i = 0; + while i < n { thread::spawn(move|| f(n) ); i += 1; } } diff --git a/src/test/compile-fail-fulldeps/gated-plugin.rs b/src/test/compile-fail-fulldeps/gated-plugin.rs index 89090d5f38..9fa93063ea 100644 --- a/src/test/compile-fail-fulldeps/gated-plugin.rs +++ b/src/test/compile-fail-fulldeps/gated-plugin.rs @@ -11,8 +11,7 @@ // aux-build:macro_crate_test.rs // ignore-stage1 -#[plugin] #[no_link] +#![plugin(macro_crate_test)] //~^ ERROR compiler plugins are experimental and possibly buggy -extern crate macro_crate_test; fn main() {} diff --git a/src/test/compile-fail-fulldeps/issue-18986.rs b/src/test/compile-fail-fulldeps/issue-18986.rs index 6845116e4a..9b696e05c5 100644 --- a/src/test/compile-fail-fulldeps/issue-18986.rs +++ b/src/test/compile-fail-fulldeps/issue-18986.rs @@ -15,6 +15,6 @@ pub use use_from_trait_xc::Trait; fn main() { match () { - Trait { x: 42us } => () //~ ERROR use of trait `Trait` in a struct pattern + Trait { x: 42_usize } => () //~ ERROR use of trait `Trait` in a struct pattern } } diff --git a/src/test/compile-fail-fulldeps/lint-group-plugin-deny-cmdline.rs b/src/test/compile-fail-fulldeps/lint-group-plugin-deny-cmdline.rs index 11ae556395..a523799278 100644 --- a/src/test/compile-fail-fulldeps/lint-group-plugin-deny-cmdline.rs +++ b/src/test/compile-fail-fulldeps/lint-group-plugin-deny-cmdline.rs @@ -13,9 +13,7 @@ // compile-flags: -D lint-me #![feature(plugin)] - -#[plugin] #[no_link] -extern crate lint_group_plugin_test; +#![plugin(lint_group_plugin_test)] fn lintme() { } //~ ERROR item is named 'lintme' diff --git a/src/test/compile-fail-fulldeps/lint-plugin-deny-attr.rs b/src/test/compile-fail-fulldeps/lint-plugin-deny-attr.rs index 62007d6575..e3dbdc331a 100644 --- a/src/test/compile-fail-fulldeps/lint-plugin-deny-attr.rs +++ b/src/test/compile-fail-fulldeps/lint-plugin-deny-attr.rs @@ -12,11 +12,9 @@ // ignore-stage1 #![feature(plugin)] +#![plugin(lint_plugin_test)] #![deny(test_lint)] -#[plugin] #[no_link] -extern crate lint_plugin_test; - fn lintme() { } //~ ERROR item is named 'lintme' pub fn main() { diff --git a/src/test/compile-fail-fulldeps/lint-plugin-deny-cmdline.rs b/src/test/compile-fail-fulldeps/lint-plugin-deny-cmdline.rs index da51c047f5..41d25becd8 100644 --- a/src/test/compile-fail-fulldeps/lint-plugin-deny-cmdline.rs +++ b/src/test/compile-fail-fulldeps/lint-plugin-deny-cmdline.rs @@ -13,9 +13,7 @@ // compile-flags: -D test-lint #![feature(plugin)] - -#[plugin] #[no_link] -extern crate lint_plugin_test; +#![plugin(lint_plugin_test)] fn lintme() { } //~ ERROR item is named 'lintme' diff --git a/src/test/compile-fail-fulldeps/lint-plugin-forbid-attrs.rs b/src/test/compile-fail-fulldeps/lint-plugin-forbid-attrs.rs index cf51958b53..83c845bfdf 100644 --- a/src/test/compile-fail-fulldeps/lint-plugin-forbid-attrs.rs +++ b/src/test/compile-fail-fulldeps/lint-plugin-forbid-attrs.rs @@ -12,11 +12,9 @@ // ignore-stage1 #![feature(plugin)] +#![plugin(lint_plugin_test)] #![forbid(test_lint)] -#[plugin] #[no_link] -extern crate lint_plugin_test; - fn lintme() { } //~ ERROR item is named 'lintme' #[allow(test_lint)] //~ ERROR allow(test_lint) overruled by outer forbid(test_lint) diff --git a/src/test/compile-fail-fulldeps/lint-plugin-forbid-cmdline.rs b/src/test/compile-fail-fulldeps/lint-plugin-forbid-cmdline.rs index 9a36143f65..155294f802 100644 --- a/src/test/compile-fail-fulldeps/lint-plugin-forbid-cmdline.rs +++ b/src/test/compile-fail-fulldeps/lint-plugin-forbid-cmdline.rs @@ -13,9 +13,7 @@ // compile-flags: -F test-lint #![feature(plugin)] - -#[plugin] #[no_link] -extern crate lint_plugin_test; +#![plugin(lint_plugin_test)] fn lintme() { } //~ ERROR item is named 'lintme' diff --git a/src/test/compile-fail-fulldeps/macro-crate-cannot-read-embedded-ident.rs b/src/test/compile-fail-fulldeps/macro-crate-cannot-read-embedded-ident.rs index 2e727f1963..fd1deffb59 100644 --- a/src/test/compile-fail-fulldeps/macro-crate-cannot-read-embedded-ident.rs +++ b/src/test/compile-fail-fulldeps/macro-crate-cannot-read-embedded-ident.rs @@ -10,7 +10,6 @@ // aux-build:macro_crate_test.rs // ignore-stage1 -// ignore-android // error-pattern: unknown start of token: \u{0} // Issue #15750 and #15962 : this test is checking that the standard @@ -21,9 +20,7 @@ // ident form. #![feature(plugin)] - -#[plugin] #[no_link] -extern crate macro_crate_test; +#![plugin(macro_crate_test)] fn main() { let x = 0; diff --git a/src/test/compile-fail-fulldeps/macro-crate-doesnt-resolve.rs b/src/test/compile-fail-fulldeps/macro-crate-doesnt-resolve.rs index adcdba04cc..361840a161 100644 --- a/src/test/compile-fail-fulldeps/macro-crate-doesnt-resolve.rs +++ b/src/test/compile-fail-fulldeps/macro-crate-doesnt-resolve.rs @@ -10,7 +10,6 @@ // aux-build:macro_crate_test.rs // ignore-stage1 -// ignore-android #[macro_use] #[no_link] extern crate macro_crate_test; diff --git a/src/test/compile-fail-fulldeps/macro-crate-rlib.rs b/src/test/compile-fail-fulldeps/macro-crate-rlib.rs index 1f44ac7cf9..7a362994b8 100644 --- a/src/test/compile-fail-fulldeps/macro-crate-rlib.rs +++ b/src/test/compile-fail-fulldeps/macro-crate-rlib.rs @@ -15,7 +15,7 @@ // ignore-cross-compile gives a different error message #![feature(plugin)] -#[plugin] #[no_link] extern crate rlib_crate_test; -//~^ ERROR: plugin crate `rlib_crate_test` only found in rlib format, but must be available in dylib format +#![plugin(rlib_crate_test)] +//~^ ERROR: plugin `rlib_crate_test` only found in rlib format, but must be available in dylib format fn main() {} diff --git a/src/test/compile-fail-fulldeps/macro-crate-unexported-macro.rs b/src/test/compile-fail-fulldeps/macro-crate-unexported-macro.rs index b5ff8b7155..ba8e20069c 100644 --- a/src/test/compile-fail-fulldeps/macro-crate-unexported-macro.rs +++ b/src/test/compile-fail-fulldeps/macro-crate-unexported-macro.rs @@ -10,7 +10,6 @@ // aux-build:macro_crate_test.rs // ignore-stage1 -// ignore-android #[macro_use] #[no_link] extern crate macro_crate_test; diff --git a/src/test/compile-fail-fulldeps/plugin-MacroRulesTT.rs b/src/test/compile-fail-fulldeps/plugin-MacroRulesTT.rs index cff2e5eaf8..e13ddd13f5 100644 --- a/src/test/compile-fail-fulldeps/plugin-MacroRulesTT.rs +++ b/src/test/compile-fail-fulldeps/plugin-MacroRulesTT.rs @@ -10,12 +10,9 @@ // aux-build:macro_crate_MacroRulesTT.rs // ignore-stage1 -// ignore-android // error-pattern: plugin tried to register a new MacroRulesTT #![feature(plugin)] - -#[plugin] #[no_link] -extern crate macro_crate_MacroRulesTT; +#![plugin(macro_crate_MacroRulesTT)] fn main() { } diff --git a/src/libregex/test/mod.rs b/src/test/compile-fail-fulldeps/plugin-as-extern-crate.rs similarity index 51% rename from src/libregex/test/mod.rs rename to src/test/compile-fail-fulldeps/plugin-as-extern-crate.rs index e11094b117..c5169b61a2 100644 --- a/src/libregex/test/mod.rs +++ b/src/test/compile-fail-fulldeps/plugin-as-extern-crate.rs @@ -1,4 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -8,17 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -macro_rules! regex { - ($re:expr) => ( - match ::regex::Regex::new($re) { - Ok(re) => re, - Err(err) => panic!("{:?}", err), - } - ); -} +// aux-build:macro_crate_test.rs +// ignore-stage1 +// ignore-cross-compile +// +// macro_crate_test will not compile on a cross-compiled target because +// libsyntax is not compiled for it. + +#![deny(plugin_as_library)] -#[path = "bench.rs"] -mod dynamic_bench; -#[path = "tests.rs"] -mod dynamic_tests; +extern crate macro_crate_test; //~ ERROR compiler plugin used as an ordinary library +fn main() { } diff --git a/src/test/compile-fail-fulldeps/plugin-plus-extern-crate.rs b/src/test/compile-fail-fulldeps/plugin-plus-extern-crate.rs new file mode 100644 index 0000000000..3dfd8838eb --- /dev/null +++ b/src/test/compile-fail-fulldeps/plugin-plus-extern-crate.rs @@ -0,0 +1,27 @@ +// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:macro_crate_test.rs +// ignore-stage1 +// ignore-cross-compile +// +// macro_crate_test will not compile on a cross-compiled target because +// libsyntax is not compiled for it. + +#![deny(plugin_as_library)] +#![feature(plugin)] +#![plugin(macro_crate_test)] + +extern crate macro_crate_test; //~ ERROR compiler plugin used as an ordinary library + +fn main() { + assert_eq!(1, make_a_1!()); + macro_crate_test::foo(); +} diff --git a/src/test/compile-fail/array-not-vector.rs b/src/test/compile-fail/array-not-vector.rs index 6581019fdd..7111c00d12 100644 --- a/src/test/compile-fail/array-not-vector.rs +++ b/src/test/compile-fail/array-not-vector.rs @@ -9,8 +9,18 @@ // except according to those terms. fn main() { - let _x: isize = [1is, 2, 3]; //~ ERROR expected isize, found array of 3 elements + let _x: i32 = [1i32, 2, 3]; + //~^ ERROR mismatched types + //~| expected `i32` + //~| found `[i32; 3]` + //~| expected i32 + //~| found array of 3 elements - let x: &[isize] = &[1, 2, 3]; - let _y: &isize = x; //~ ERROR expected isize, found slice + let x: &[i32] = &[1i32, 2, 3]; + let _y: &i32 = x; + //~^ ERROR mismatched types + //~| expected `&i32` + //~| found `&[i32]` + //~| expected i32 + //~| found slice } diff --git a/src/test/compile-fail/array-old-syntax-2.rs b/src/test/compile-fail/array-old-syntax-2.rs index c1b88290bc..99ff3ae29f 100644 --- a/src/test/compile-fail/array-old-syntax-2.rs +++ b/src/test/compile-fail/array-old-syntax-2.rs @@ -11,5 +11,5 @@ // Test that the old repeating array syntax gives an error. fn main() { - let _ = [0is, ..3]; //~ ERROR + let _ = [0, ..3]; //~ ERROR } diff --git a/src/test/compile-fail/asm-gated2.rs b/src/test/compile-fail/asm-gated2.rs new file mode 100644 index 0000000000..d2ee01109f --- /dev/null +++ b/src/test/compile-fail/asm-gated2.rs @@ -0,0 +1,15 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + unsafe { + println!("{}", asm!("")); //~ ERROR inline assembly is not stable + } +} diff --git a/src/test/compile-fail/asm-in-bad-modifier.rs b/src/test/compile-fail/asm-in-bad-modifier.rs index ffbb25e266..01481af817 100644 --- a/src/test/compile-fail/asm-in-bad-modifier.rs +++ b/src/test/compile-fail/asm-in-bad-modifier.rs @@ -20,8 +20,8 @@ pub fn main() { let x: isize; let y: isize; unsafe { - asm!("mov $1, $0" : "=r"(x) : "=r"(5us)); //~ ERROR input operand constraint contains '=' - asm!("mov $1, $0" : "=r"(y) : "+r"(5us)); //~ ERROR input operand constraint contains '+' + asm!("mov $1, $0" : "=r"(x) : "=r"(5_usize)); //~ ERROR operand constraint contains '=' + asm!("mov $1, $0" : "=r"(y) : "+r"(5_usize)); //~ ERROR operand constraint contains '+' } foo(x); foo(y); diff --git a/src/test/compile-fail/asm-misplaced-option.rs b/src/test/compile-fail/asm-misplaced-option.rs index 8bc6f206de..02d06c4e1b 100644 --- a/src/test/compile-fail/asm-misplaced-option.rs +++ b/src/test/compile-fail/asm-misplaced-option.rs @@ -21,14 +21,14 @@ pub fn main() { let mut x: isize = 0; unsafe { // extra colon - asm!("mov $1, $0" : "=r"(x) : "r"(5us), "0"(x) : : "cc"); + asm!("mov $1, $0" : "=r"(x) : "r"(5_usize), "0"(x) : : "cc"); //~^ WARNING unrecognized option } assert_eq!(x, 5); unsafe { // comma in place of a colon - asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8us) : "cc", "volatile"); + asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8_usize) : "cc", "volatile"); //~^ WARNING expected a clobber, found an option } assert_eq!(x, 13); diff --git a/src/test/compile-fail/asm-out-assign-imm.rs b/src/test/compile-fail/asm-out-assign-imm.rs index 9ad5d7e9f0..ff56fb14f7 100644 --- a/src/test/compile-fail/asm-out-assign-imm.rs +++ b/src/test/compile-fail/asm-out-assign-imm.rs @@ -21,7 +21,8 @@ pub fn main() { x = 1; //~ NOTE prior assignment occurs here foo(x); unsafe { - asm!("mov $1, $0" : "=r"(x) : "r"(5us)); //~ ERROR re-assignment of immutable variable `x` + asm!("mov $1, $0" : "=r"(x) : "r"(5_usize)); + //~^ ERROR re-assignment of immutable variable `x` } foo(x); } diff --git a/src/test/compile-fail/asm-out-no-modifier.rs b/src/test/compile-fail/asm-out-no-modifier.rs index b58d41e1d8..17c19c77ab 100644 --- a/src/test/compile-fail/asm-out-no-modifier.rs +++ b/src/test/compile-fail/asm-out-no-modifier.rs @@ -19,7 +19,7 @@ fn foo(x: isize) { println!("{}", x); } pub fn main() { let x: isize; unsafe { - asm!("mov $1, $0" : "r"(x) : "r"(5us)); //~ ERROR output operand constraint lacks '=' + asm!("mov $1, $0" : "r"(x) : "r"(5_usize)); //~ ERROR output operand constraint lacks '=' } foo(x); } diff --git a/src/test/compile-fail/assign-to-method.rs b/src/test/compile-fail/assign-to-method.rs index 0694420e76..d32ea327d0 100644 --- a/src/test/compile-fail/assign-to-method.rs +++ b/src/test/compile-fail/assign-to-method.rs @@ -15,7 +15,7 @@ struct cat { } impl cat { - pub fn speak(&self) { self.meows += 1us; } + pub fn speak(&self) { self.meows += 1_usize; } } fn cat(in_x : usize, in_y : isize) -> cat { @@ -26,6 +26,6 @@ fn cat(in_x : usize, in_y : isize) -> cat { } fn main() { - let nyan : cat = cat(52us, 99); - nyan.speak = |&:| println!("meow"); //~ ERROR attempted to take value of method + let nyan : cat = cat(52_usize, 99); + nyan.speak = || println!("meow"); //~ ERROR attempted to take value of method } diff --git a/src/test/compile-fail/assoc-inherent.rs b/src/test/compile-fail/assoc-inherent.rs index ba8e4a652d..e68c3e30b9 100644 --- a/src/test/compile-fail/assoc-inherent.rs +++ b/src/test/compile-fail/assoc-inherent.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Test associated types are forbidden in inherant impls. +// Test associated types are forbidden in inherent impls. struct Foo; diff --git a/src/test/compile-fail/associated-type-projection-from-supertrait.rs b/src/test/compile-fail/associated-type-projection-from-supertrait.rs index abaf79fb4c..b388b6a28e 100644 --- a/src/test/compile-fail/associated-type-projection-from-supertrait.rs +++ b/src/test/compile-fail/associated-type-projection-from-supertrait.rs @@ -40,8 +40,8 @@ impl Car for ModelU { } fn dent(c: C, color: C::Color) { c.chip_paint(color) } fn a() { dent(ModelT, Black); } -fn b() { dent(ModelT, Blue); } //~ ERROR type mismatch -fn c() { dent(ModelU, Black); } //~ ERROR type mismatch +fn b() { dent(ModelT, Blue); } //~ ERROR mismatched types +fn c() { dent(ModelU, Black); } //~ ERROR mismatched types fn d() { dent(ModelU, Blue); } /////////////////////////////////////////////////////////////////////////// diff --git a/src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs b/src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs index 183781e9e2..edd1b8255c 100644 --- a/src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs +++ b/src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs @@ -13,10 +13,15 @@ #![crate_type = "lib"] #![feature(lang_items)] +#![feature(no_std)] #![no_std] +#[lang="phantom_fn"] +pub trait PhantomFn { } +impl PhantomFn for U { } + #[lang="sized"] -pub trait Sized { +pub trait Sized : PhantomFn { // Empty. } @@ -29,6 +34,6 @@ trait Add { fn ice(a: A) { let r = loop {}; - r = r + a; // here the type `r` is not yet inferred, hence `r+a` generates an error. - //~^ ERROR type of this value must be known + r = r + a; + //~^ ERROR binary operation `+` cannot be applied to type `A` } diff --git a/src/test/compile-fail/associated-types-coherence-failure.rs b/src/test/compile-fail/associated-types-coherence-failure.rs index 95a68dd669..b7a16c68a3 100644 --- a/src/test/compile-fail/associated-types-coherence-failure.rs +++ b/src/test/compile-fail/associated-types-coherence-failure.rs @@ -11,9 +11,10 @@ // Test that coherence detects overlap when some of the types in the // impls are projections of associated type. Issue #20624. +use std::marker::PhantomData; use std::ops::Deref; -pub struct Cow<'a, B: ?Sized>; +pub struct Cow<'a, B: ?Sized>(PhantomData<(&'a (),B)>); /// Trait for moving into a `Cow` pub trait IntoCow<'a, B: ?Sized> { diff --git a/src/test/compile-fail/associated-types-eq-3.rs b/src/test/compile-fail/associated-types-eq-3.rs index ed81c0fccb..f01f2b111c 100644 --- a/src/test/compile-fail/associated-types-eq-3.rs +++ b/src/test/compile-fail/associated-types-eq-3.rs @@ -30,7 +30,12 @@ fn foo1>(x: I) { } fn foo2(x: I) { - let _: Bar = x.boo(); //~ERROR mismatched types + let _: Bar = x.boo(); + //~^ ERROR mismatched types + //~| expected `Bar` + //~| found `::A` + //~| expected struct `Bar` + //~| found associated type } @@ -40,7 +45,13 @@ pub fn baz(x: &Foo) { pub fn main() { - let a = 42is; - foo1(a); //~ERROR expected usize, found struct Bar - baz(&a); //~ERROR expected usize, found struct Bar + let a = 42; + foo1(a); + //~^ ERROR type mismatch resolving + //~| expected usize + //~| found struct `Bar` + baz(&a); + //~^ ERROR type mismatch resolving + //~| expected usize + //~| found struct `Bar` } diff --git a/src/test/compile-fail/associated-types-eq-expr-path.rs b/src/test/compile-fail/associated-types-eq-expr-path.rs index 9baa7f1ad5..c48f9972eb 100644 --- a/src/test/compile-fail/associated-types-eq-expr-path.rs +++ b/src/test/compile-fail/associated-types-eq-expr-path.rs @@ -10,7 +10,7 @@ // Check that an associated type cannot be bound in an expression path. -trait Foo { +trait Foo : ::std::marker::MarkerTrait { type A; fn bar() -> isize; } diff --git a/src/test/compile-fail/associated-types-incomplete-object.rs b/src/test/compile-fail/associated-types-incomplete-object.rs index 31492406fe..1c708da30a 100644 --- a/src/test/compile-fail/associated-types-incomplete-object.rs +++ b/src/test/compile-fail/associated-types-incomplete-object.rs @@ -28,15 +28,15 @@ impl Foo for isize { } pub fn main() { - let a = &42is as &Foo; + let a = &42 as &Foo; - let b = &42is as &Foo; + let b = &42 as &Foo; //~^ ERROR the value of the associated type `B` (from the trait `Foo`) must be specified - let c = &42is as &Foo; + let c = &42 as &Foo; //~^ ERROR the value of the associated type `A` (from the trait `Foo`) must be specified - let d = &42is as &Foo; + let d = &42 as &Foo; //~^ ERROR the value of the associated type `A` (from the trait `Foo`) must be specified //~| ERROR the value of the associated type `B` (from the trait `Foo`) must be specified } diff --git a/src/test/compile-fail/associated-types-issue-17359.rs b/src/test/compile-fail/associated-types-issue-17359.rs index fa09ae793b..625f4cdb8e 100644 --- a/src/test/compile-fail/associated-types-issue-17359.rs +++ b/src/test/compile-fail/associated-types-issue-17359.rs @@ -11,7 +11,7 @@ // Test that we do not ICE when an impl is missing an associated type (and that we report // a useful error, of course). -trait Trait { +trait Trait : ::std::marker::MarkerTrait { type Type; } diff --git a/src/test/compile-fail/associated-types-multiple-types-one-trait.rs b/src/test/compile-fail/associated-types-multiple-types-one-trait.rs index 9436f825de..5632f148da 100644 --- a/src/test/compile-fail/associated-types-multiple-types-one-trait.rs +++ b/src/test/compile-fail/associated-types-multiple-types-one-trait.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Foo { +trait Foo : ::std::marker::MarkerTrait { type X; type Y; } diff --git a/src/test/compile-fail/associated-types-no-suitable-supertrait.rs b/src/test/compile-fail/associated-types-no-suitable-supertrait.rs index a3f2850b29..2b84c38f80 100644 --- a/src/test/compile-fail/associated-types-no-suitable-supertrait.rs +++ b/src/test/compile-fail/associated-types-no-suitable-supertrait.rs @@ -11,7 +11,7 @@ // Check that we get an error when you use `::Value` in // the trait definition but `Self` does not, in fact, implement `Get`. -trait Get { +trait Get : ::std::marker::MarkerTrait { type Value; } diff --git a/src/test/compile-fail/associated-types-path-2.rs b/src/test/compile-fail/associated-types-path-2.rs index 74c8dffced..b9a62ff4e4 100644 --- a/src/test/compile-fail/associated-types-path-2.rs +++ b/src/test/compile-fail/associated-types-path-2.rs @@ -12,10 +12,12 @@ pub trait Foo { type A; + + fn dummy(&self) { } } -impl Foo for isize { - type A = usize; +impl Foo for i32 { + type A = u32; } pub fn f1(a: T, x: T::A) {} @@ -24,29 +26,33 @@ pub fn f2(a: T) -> T::A { } pub fn f1_int_int() { - f1(2is, 4is); - //~^ ERROR expected usize, found isize + f1(2i32, 4i32); + //~^ ERROR mismatched types + //~| expected u32 + //~| found i32 } pub fn f1_int_uint() { - f1(2is, 4us); + f1(2i32, 4u32); } pub fn f1_uint_uint() { - f1(2us, 4us); + f1(2u32, 4u32); //~^ ERROR the trait `Foo` is not implemented //~| ERROR the trait `Foo` is not implemented } pub fn f1_uint_int() { - f1(2us, 4is); + f1(2u32, 4i32); //~^ ERROR the trait `Foo` is not implemented //~| ERROR the trait `Foo` is not implemented } pub fn f2_int() { - let _: isize = f2(2is); - //~^ ERROR expected `isize`, found `usize` + let _: i32 = f2(2i32); + //~^ ERROR mismatched types + //~| expected `i32` + //~| found `u32` } pub fn main() { } diff --git a/src/test/compile-fail/associated-types-subtyping-1.rs b/src/test/compile-fail/associated-types-subtyping-1.rs new file mode 100644 index 0000000000..f9106ba396 --- /dev/null +++ b/src/test/compile-fail/associated-types-subtyping-1.rs @@ -0,0 +1,55 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(unused_variables)] + +trait Trait<'a> { + type Type; + + fn method(&'a self) { } +} + +fn method1<'a,'b,T>(x: &'a T, y: &'b T) + where T : for<'z> Trait<'z>, 'a : 'b +{ + // Note that &'static T <: &'a T. + let a: >::Type = loop { }; + let b: >::Type = loop { }; + let _: >::Type = a; +} + +fn method2<'a,'b,T>(x: &'a T, y: &'b T) + where T : for<'z> Trait<'z>, 'a : 'b +{ + // Note that &'static T <: &'a T. + let a: >::Type = loop { }; + let b: >::Type = loop { }; + let _: >::Type = a; //~ ERROR mismatched types +} + +fn method3<'a,'b,T>(x: &'a T, y: &'b T) + where T : for<'z> Trait<'z>, 'a : 'b +{ + // Note that &'static T <: &'a T. + let a: >::Type = loop { }; + let b: >::Type = loop { }; + let _: >::Type = b; //~ ERROR mismatched types +} + +fn method4<'a,'b,T>(x: &'a T, y: &'b T) + where T : for<'z> Trait<'z>, 'a : 'b +{ + // Note that &'static T <: &'a T. + let a: >::Type = loop { }; + let b: >::Type = loop { }; + let _: >::Type = b; +} + +fn main() { } diff --git a/src/test/compile-fail/associated-types-unconstrained.rs b/src/test/compile-fail/associated-types-unconstrained.rs index aecbf217a5..8832028f9a 100644 --- a/src/test/compile-fail/associated-types-unconstrained.rs +++ b/src/test/compile-fail/associated-types-unconstrained.rs @@ -10,7 +10,7 @@ // Check that an associated type cannot be bound in an expression path. -trait Foo { +trait Foo : ::std::marker::MarkerTrait { type A; fn bar() -> isize; } diff --git a/src/test/compile-fail/bad-bang-ann-3.rs b/src/test/compile-fail/bad-bang-ann-3.rs index e5dbdbd237..58a8314af2 100644 --- a/src/test/compile-fail/bad-bang-ann-3.rs +++ b/src/test/compile-fail/bad-bang-ann-3.rs @@ -11,7 +11,7 @@ // Tests that a function with a ! annotation always actually fails fn bad_bang(i: usize) -> ! { - return 7us; //~ ERROR `return` in a function declared as diverging [E0166] + return 7_usize; //~ ERROR `return` in a function declared as diverging [E0166] } -fn main() { bad_bang(5us); } +fn main() { bad_bang(5); } diff --git a/src/test/compile-fail/bad-bang-ann.rs b/src/test/compile-fail/bad-bang-ann.rs index 414421c8b7..03c24c2fa3 100644 --- a/src/test/compile-fail/bad-bang-ann.rs +++ b/src/test/compile-fail/bad-bang-ann.rs @@ -11,7 +11,7 @@ // Tests that a function with a ! annotation always actually fails fn bad_bang(i: usize) -> ! { //~ ERROR computation may converge in a function marked as diverging - if i < 0us { } else { panic!(); } + if i < 0_usize { } else { panic!(); } } -fn main() { bad_bang(5us); } +fn main() { bad_bang(5); } diff --git a/src/test/compile-fail/bad-const-type.rs b/src/test/compile-fail/bad-const-type.rs index 2450f22669..7e3c356b87 100644 --- a/src/test/compile-fail/bad-const-type.rs +++ b/src/test/compile-fail/bad-const-type.rs @@ -8,7 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:expected `collections::string::String`, found `isize` - -static i: String = 10is; +static i: String = 10i32; +//~^ ERROR mismatched types +//~| expected `collections::string::String` +//~| found `i32` +//~| expected struct `collections::string::String` +//~| found i32 fn main() { println!("{}", i); } diff --git a/src/test/compile-fail/bad-method-typaram-kind.rs b/src/test/compile-fail/bad-method-typaram-kind.rs index 8e5a6054b8..a97cf5d41e 100644 --- a/src/test/compile-fail/bad-method-typaram-kind.rs +++ b/src/test/compile-fail/bad-method-typaram-kind.rs @@ -9,7 +9,7 @@ // except according to those terms. fn foo() { - 1us.bar::(); //~ ERROR `core::marker::Send` is not implemented + 1_usize.bar::(); //~ ERROR `core::marker::Send` is not implemented } trait bar { diff --git a/src/test/compile-fail/bad-mid-path-type-params.rs b/src/test/compile-fail/bad-mid-path-type-params.rs index 79fe4e7165..3e02a11c37 100644 --- a/src/test/compile-fail/bad-mid-path-type-params.rs +++ b/src/test/compile-fail/bad-mid-path-type-params.rs @@ -10,12 +10,6 @@ // ignore-tidy-linelength -#![no_std] -#![feature(lang_items)] - -#[lang="sized"] -pub trait Sized {} - struct S { contents: T, } diff --git a/src/test/compile-fail/bad-sized.rs b/src/test/compile-fail/bad-sized.rs index 69be6414e4..1944acbe1f 100644 --- a/src/test/compile-fail/bad-sized.rs +++ b/src/test/compile-fail/bad-sized.rs @@ -12,7 +12,7 @@ use std::cell::RefCell; -trait Trait {} +trait Trait : ::std::marker::MarkerTrait {} pub fn main() { let x: Vec = Vec::new(); diff --git a/src/test/compile-fail/bang-tailexpr.rs b/src/test/compile-fail/bang-tailexpr.rs index d17fa68b47..7d79ea03c0 100644 --- a/src/test/compile-fail/bang-tailexpr.rs +++ b/src/test/compile-fail/bang-tailexpr.rs @@ -9,6 +9,6 @@ // except according to those terms. fn f() -> ! { //~ ERROR computation may converge in a function marked as diverging - 3is + 3 } fn main() { } diff --git a/src/test/compile-fail/binop-logic-int.rs b/src/test/compile-fail/binop-logic-int.rs index 0067121e61..2217cf5e4d 100644 --- a/src/test/compile-fail/binop-logic-int.rs +++ b/src/test/compile-fail/binop-logic-int.rs @@ -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 `isize` +// error-pattern:`&&` cannot be applied to type `i32` -fn main() { let x = 1is && 2is; } +fn main() { let x = 1i32 && 2i32; } diff --git a/src/test/compile-fail/blind-item-block-item-shadow.rs b/src/test/compile-fail/blind-item-block-item-shadow.rs new file mode 100644 index 0000000000..d4adaa042b --- /dev/null +++ b/src/test/compile-fail/blind-item-block-item-shadow.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +mod foo { pub struct Bar; } + +fn main() { + { + struct Bar; + use foo::Bar; + //~^ ERROR import `Bar` conflicts with type in this module + //~^^ ERROR import `Bar` conflicts with value in this module + } +} diff --git a/src/test/compile-fail/blind-item-block-middle.rs b/src/test/compile-fail/blind-item-block-middle.rs new file mode 100644 index 0000000000..fbb0730f01 --- /dev/null +++ b/src/test/compile-fail/blind-item-block-middle.rs @@ -0,0 +1,18 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +mod foo { struct bar; } + +fn main() { + let bar = 5; + //~^ ERROR declaration of `bar` shadows an enum variant or unit-like struct in scope + use foo::bar; + //~^ ERROR imports are not allowed after non-item statements +} diff --git a/src/test/compile-fail/blind-item-item-shadow.rs b/src/test/compile-fail/blind-item-item-shadow.rs new file mode 100644 index 0000000000..9f21d6a923 --- /dev/null +++ b/src/test/compile-fail/blind-item-item-shadow.rs @@ -0,0 +1,15 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +mod foo { pub mod foo { } } + +use foo::foo; //~ ERROR import `foo` conflicts with existing submodule + +fn main() {} diff --git a/src/test/compile-fail/blind-item-local-shadow.rs b/src/test/compile-fail/blind-item-local-shadow.rs new file mode 100644 index 0000000000..5cc087cb66 --- /dev/null +++ b/src/test/compile-fail/blind-item-local-shadow.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +mod bar { + pub fn foo() -> bool { true } +} + +fn main() { + let foo = || false; + use bar::foo; + //~^ ERROR imports are not allowed after non-item statements + assert_eq!(foo(), false); +} diff --git a/src/test/compile-fail/block-must-not-have-result-do.rs b/src/test/compile-fail/block-must-not-have-result-do.rs index 687171f8c1..30039a1c54 100644 --- a/src/test/compile-fail/block-must-not-have-result-do.rs +++ b/src/test/compile-fail/block-must-not-have-result-do.rs @@ -8,10 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:mismatched types: expected `()`, found `bool` - fn main() { loop { - true + true //~ ERROR mismatched types + //~| expected () + //~| found bool + //~| expected () + //~| found bool } } diff --git a/src/test/compile-fail/block-must-not-have-result-res.rs b/src/test/compile-fail/block-must-not-have-result-res.rs index 328c032325..6161660ddf 100644 --- a/src/test/compile-fail/block-must-not-have-result-res.rs +++ b/src/test/compile-fail/block-must-not-have-result-res.rs @@ -8,13 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:mismatched types: expected `()`, found `bool` - struct r; impl Drop for r { fn drop(&mut self) { - true + true //~ ERROR mismatched types + //~| expected () + //~| found bool + //~| expected () + //~| found bool } } diff --git a/src/test/compile-fail/block-must-not-have-result-while.rs b/src/test/compile-fail/block-must-not-have-result-while.rs index ed903f3fd6..ba6340ed39 100644 --- a/src/test/compile-fail/block-must-not-have-result-while.rs +++ b/src/test/compile-fail/block-must-not-have-result-while.rs @@ -8,10 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:mismatched types: expected `()`, found `bool` - fn main() { while true { - true + true //~ ERROR mismatched types + //~| expected `()` + //~| found `bool` + //~| expected () + //~| found bool } } diff --git a/src/test/compile-fail/borrow-immutable-upvar-mutation.rs b/src/test/compile-fail/borrow-immutable-upvar-mutation.rs index 12555c5507..a82aa12dc8 100644 --- a/src/test/compile-fail/borrow-immutable-upvar-mutation.rs +++ b/src/test/compile-fail/borrow-immutable-upvar-mutation.rs @@ -8,34 +8,38 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(unboxed_closures, overloaded_calls)] +#![feature(unboxed_closures)] // Tests that we can't assign to or mutably borrow upvars from `Fn` // closures (issue #17780) fn set(x: &mut usize) { *x = 5; } +fn to_fn>(f: F) -> F { f } +fn to_fn_mut>(f: F) -> F { f } + fn main() { // By-ref captures { - let mut x = 0us; - let _f = |&:| x = 42; //~ ERROR cannot assign + let mut x = 0_usize; + let _f = to_fn(|| x = 42); //~ ERROR cannot assign - let mut y = 0us; - let _g = |&:| set(&mut y); //~ ERROR cannot borrow + let mut y = 0_usize; + let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow - let mut z = 0us; - let _h = |&mut:| { set(&mut z); |&:| z = 42; }; //~ ERROR cannot assign + let mut z = 0_usize; + let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign } + // By-value captures { - let mut x = 0us; - let _f = move |&:| x = 42; //~ ERROR cannot assign + let mut x = 0_usize; + let _f = to_fn(move || x = 42); //~ ERROR cannot assign - let mut y = 0us; - let _g = move |&:| set(&mut y); //~ ERROR cannot borrow + let mut y = 0_usize; + let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow - let mut z = 0us; - let _h = move |&mut:| { set(&mut z); move |&:| z = 42; }; //~ ERROR cannot assign + let mut z = 0_usize; + let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign } } diff --git a/src/test/compile-fail/borrow-tuple-fields.rs b/src/test/compile-fail/borrow-tuple-fields.rs index e6fe60a900..40e077bd1b 100644 --- a/src/test/compile-fail/borrow-tuple-fields.rs +++ b/src/test/compile-fail/borrow-tuple-fields.rs @@ -16,28 +16,28 @@ struct Foo(Box, isize); struct Bar(isize, isize); fn main() { - let x = (box 1is, 2is); + let x = (box 1, 2); let r = &x.0; let y = x; //~ ERROR cannot move out of `x` because it is borrowed - let mut x = (1is, 2is); + let mut x = (1, 2); let a = &x.0; let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as - let mut x = (1is, 2is); + let mut x = (1, 2); let a = &mut x.0; let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time - let x = Foo(box 1is, 2is); + let x = Foo(box 1, 2); let r = &x.0; let y = x; //~ ERROR cannot move out of `x` because it is borrowed - let mut x = Bar(1is, 2is); + let mut x = Bar(1, 2); let a = &x.0; let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as - let mut x = Bar(1is, 2is); + let mut x = Bar(1, 2); let a = &mut x.0; let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time } diff --git a/src/test/compile-fail/borrowck-anon-fields-tuple.rs b/src/test/compile-fail/borrowck-anon-fields-tuple.rs index 88486756b6..ebaed01756 100644 --- a/src/test/compile-fail/borrowck-anon-fields-tuple.rs +++ b/src/test/compile-fail/borrowck-anon-fields-tuple.rs @@ -12,7 +12,7 @@ // anonymous fields of a tuple vs the same anonymous field. fn distinct_variant() { - let mut y = (1is, 2is); + let mut y = (1, 2); let a = match y { (ref mut a, _) => a @@ -27,7 +27,7 @@ fn distinct_variant() { } fn same_variant() { - let mut y = (1is, 2is); + let mut y = (1, 2); let a = match y { (ref mut a, _) => a diff --git a/src/test/compile-fail/borrowck-assign-comp-idx.rs b/src/test/compile-fail/borrowck-assign-comp-idx.rs index 3a2c6f0385..b18df7f3db 100644 --- a/src/test/compile-fail/borrowck-assign-comp-idx.rs +++ b/src/test/compile-fail/borrowck-assign-comp-idx.rs @@ -33,7 +33,7 @@ fn b() { let mut p = vec!(1); borrow( - p.as_slice(), + &p, || p[0] = 5); //~ ERROR cannot borrow `p` as mutable } @@ -41,7 +41,7 @@ fn c() { // Legal because the scope of the borrow does not include the // modification: let mut p = vec!(1); - borrow(p.as_slice(), ||{}); + borrow(&p, ||{}); p[0] = 5; } diff --git a/src/test/compile-fail/borrowck-borrow-from-owned-ptr.rs b/src/test/compile-fail/borrowck-borrow-from-owned-ptr.rs index 397c55a502..99618c6bf5 100644 --- a/src/test/compile-fail/borrowck-borrow-from-owned-ptr.rs +++ b/src/test/compile-fail/borrowck-borrow-from-owned-ptr.rs @@ -9,20 +9,18 @@ // except according to those terms. +#[derive(Copy)] struct Foo { bar1: Bar, bar2: Bar } -impl Copy for Foo {} - +#[derive(Copy)] struct Bar { int1: isize, int2: isize, } -impl Copy for Bar {} - fn make_foo() -> Box { panic!() } fn borrow_same_field_twice_mut_mut() { diff --git a/src/test/compile-fail/borrowck-borrow-from-stack-variable.rs b/src/test/compile-fail/borrowck-borrow-from-stack-variable.rs index ae4c09c59d..849c98e122 100644 --- a/src/test/compile-fail/borrowck-borrow-from-stack-variable.rs +++ b/src/test/compile-fail/borrowck-borrow-from-stack-variable.rs @@ -8,20 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[derive(Copy)] struct Foo { bar1: Bar, bar2: Bar } -impl Copy for Foo {} - +#[derive(Copy)] struct Bar { int1: isize, int2: isize, } -impl Copy for Bar {} - fn make_foo() -> Foo { panic!() } fn borrow_same_field_twice_mut_mut() { diff --git a/src/test/compile-fail/borrowck-borrow-overloaded-auto-deref-mut.rs b/src/test/compile-fail/borrowck-borrow-overloaded-auto-deref-mut.rs index 5db9ad2e3a..dd278faa0d 100644 --- a/src/test/compile-fail/borrowck-borrow-overloaded-auto-deref-mut.rs +++ b/src/test/compile-fail/borrowck-borrow-overloaded-auto-deref-mut.rs @@ -56,15 +56,15 @@ impl Point { } fn deref_imm_field(x: Own) { - let _i = &x.y; + let __isize = &x.y; } fn deref_mut_field1(x: Own) { - let _i = &mut x.y; //~ ERROR cannot borrow + let __isize = &mut x.y; //~ ERROR cannot borrow } fn deref_mut_field2(mut x: Own) { - let _i = &mut x.y; + let __isize = &mut x.y; } fn deref_extend_field(x: &Own) -> &isize { @@ -114,7 +114,7 @@ fn assign_field4<'a>(x: &'a mut Own) { // FIXME(eddyb) #12825 This shouldn't attempt to call deref_mut. /* fn deref_imm_method(x: Own) { - let _i = x.get(); + let __isize = x.get(); } */ diff --git a/src/test/compile-fail/borrowck-borrow-overloaded-auto-deref.rs b/src/test/compile-fail/borrowck-borrow-overloaded-auto-deref.rs index 75680de9c9..693ed29bd0 100644 --- a/src/test/compile-fail/borrowck-borrow-overloaded-auto-deref.rs +++ b/src/test/compile-fail/borrowck-borrow-overloaded-auto-deref.rs @@ -50,15 +50,15 @@ impl Point { } fn deref_imm_field(x: Rc) { - let _i = &x.y; + let __isize = &x.y; } fn deref_mut_field1(x: Rc) { - let _i = &mut x.y; //~ ERROR cannot borrow + let __isize = &mut x.y; //~ ERROR cannot borrow } fn deref_mut_field2(mut x: Rc) { - let _i = &mut x.y; //~ ERROR cannot borrow + let __isize = &mut x.y; //~ ERROR cannot borrow } fn deref_extend_field(x: &Rc) -> &isize { @@ -86,7 +86,7 @@ fn assign_field3<'a>(x: &'a mut Rc) { } fn deref_imm_method(x: Rc) { - let _i = x.get(); + let __isize = x.get(); } fn deref_mut_method1(x: Rc) { diff --git a/src/test/compile-fail/borrowck-borrow-overloaded-deref-mut.rs b/src/test/compile-fail/borrowck-borrow-overloaded-deref-mut.rs index bfe53b739f..34b926aab1 100644 --- a/src/test/compile-fail/borrowck-borrow-overloaded-deref-mut.rs +++ b/src/test/compile-fail/borrowck-borrow-overloaded-deref-mut.rs @@ -32,15 +32,15 @@ impl DerefMut for Own { } fn deref_imm(x: Own) { - let _i = &*x; + let __isize = &*x; } fn deref_mut1(x: Own) { - let _i = &mut *x; //~ ERROR cannot borrow + let __isize = &mut *x; //~ ERROR cannot borrow } fn deref_mut2(mut x: Own) { - let _i = &mut *x; + let __isize = &mut *x; } fn deref_extend<'a>(x: &'a Own) -> &'a isize { diff --git a/src/test/compile-fail/borrowck-borrow-overloaded-deref.rs b/src/test/compile-fail/borrowck-borrow-overloaded-deref.rs index 153368f489..5b916243b9 100644 --- a/src/test/compile-fail/borrowck-borrow-overloaded-deref.rs +++ b/src/test/compile-fail/borrowck-borrow-overloaded-deref.rs @@ -26,15 +26,15 @@ impl Deref for Rc { } fn deref_imm(x: Rc) { - let _i = &*x; + let __isize = &*x; } fn deref_mut1(x: Rc) { - let _i = &mut *x; //~ ERROR cannot borrow + let __isize = &mut *x; //~ ERROR cannot borrow } fn deref_mut2(mut x: Rc) { - let _i = &mut *x; //~ ERROR cannot borrow + let __isize = &mut *x; //~ ERROR cannot borrow } fn deref_extend<'a>(x: &'a Rc) -> &'a isize { diff --git a/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs b/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs index d983c5d508..99ac867226 100644 --- a/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs +++ b/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs @@ -30,7 +30,7 @@ fn defer<'r>(x: &'r [&'r str]) -> defer<'r> { } fn main() { - let x = defer(vec!("Goodbye", "world!").as_slice()); + let x = defer(&vec!("Goodbye", "world!")); //~^ ERROR borrowed value does not live long enough x.x[0]; } diff --git a/src/test/compile-fail/borrowck-borrowed-uniq-rvalue.rs b/src/test/compile-fail/borrowck-borrowed-uniq-rvalue.rs index 98d1905ed9..9c10f01e02 100644 --- a/src/test/compile-fail/borrowck-borrowed-uniq-rvalue.rs +++ b/src/test/compile-fail/borrowck-borrowed-uniq-rvalue.rs @@ -16,10 +16,11 @@ extern crate collections; use std::collections::HashMap; fn main() { + let tmp; let mut buggy_map: HashMap = HashMap::new(); buggy_map.insert(42, &*box 1); //~ ERROR borrowed value does not live long enough // but it is ok if we use a temporary - let tmp = box 2; + tmp = box 2; buggy_map.insert(43, &*tmp); } diff --git a/src/test/compile-fail/borrowck-break-uninit-2.rs b/src/test/compile-fail/borrowck-break-uninit-2.rs index a52eaeeb9c..82a6c92aba 100644 --- a/src/test/compile-fail/borrowck-break-uninit-2.rs +++ b/src/test/compile-fail/borrowck-break-uninit-2.rs @@ -11,14 +11,14 @@ fn foo() -> isize { let x: isize; - while 1is != 2 { + while 1 != 2 { break; x = 0; } println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` - return 17is; + return 17; } fn main() { println!("{}", foo()); } diff --git a/src/test/compile-fail/borrowck-call-is-borrow-issue-12224.rs b/src/test/compile-fail/borrowck-call-is-borrow-issue-12224.rs index 010ddb792c..9ea5fbbdb1 100644 --- a/src/test/compile-fail/borrowck-call-is-borrow-issue-12224.rs +++ b/src/test/compile-fail/borrowck-call-is-borrow-issue-12224.rs @@ -49,17 +49,19 @@ fn test5(f: &mut Test) { } fn test6() { - let mut f = |&mut:| {}; - (|&mut:| { + let mut f = || {}; + (|| { f(); })(); } fn test7() { fn foo(_: F) where F: FnMut(Box, isize) {} - let mut f = |&mut: g: Box, b: isize| {}; - f(box |a| { //~ ERROR: cannot borrow `f` as immutable because it is also borrowed as mutable - foo(f); //~ ERROR: cannot move out of captured outer variable + let mut f = |g: Box, b: isize| {}; + f(box |a| { + foo(f); + //~^ ERROR cannot move `f` into closure because it is borrowed + //~| ERROR cannot move out of captured outer variable in an `FnMut` closure }, 3); } diff --git a/src/test/compile-fail/borrowck-closures-mut-and-imm.rs b/src/test/compile-fail/borrowck-closures-mut-and-imm.rs index 29c7d6920b..851b11fac2 100644 --- a/src/test/compile-fail/borrowck-closures-mut-and-imm.rs +++ b/src/test/compile-fail/borrowck-closures-mut-and-imm.rs @@ -22,38 +22,38 @@ fn set(x: &mut isize) { } fn a() { - let mut x = 3is; - let c1 = |&mut:| x = 4; - let c2 = |&mut:| x * 5; //~ ERROR cannot borrow `x` + let mut x = 3; + let c1 = || x = 4; + let c2 = || x * 5; //~ ERROR cannot borrow `x` } fn b() { - let mut x = 3is; - let c1 = |&mut:| set(&mut x); - let c2 = |&mut:| get(&x); //~ ERROR cannot borrow `x` + let mut x = 3; + let c1 = || set(&mut x); + let c2 = || get(&x); //~ ERROR cannot borrow `x` } fn c() { - let mut x = 3is; - let c1 = |&mut:| set(&mut x); - let c2 = |&mut:| x * 5; //~ ERROR cannot borrow `x` + let mut x = 3; + let c1 = || set(&mut x); + let c2 = || x * 5; //~ ERROR cannot borrow `x` } fn d() { - let mut x = 3is; - let c2 = |&mut:| x * 5; + let mut x = 3; + let c2 = || x * 5; x = 5; //~ ERROR cannot assign } fn e() { - let mut x = 3is; - let c1 = |&mut:| get(&x); + let mut x = 3; + let c1 = || get(&x); x = 5; //~ ERROR cannot assign } fn f() { - let mut x = box 3is; - let c1 = |&mut:| get(&*x); + let mut x = box 3; + let c1 = || get(&*x); *x = 5; //~ ERROR cannot assign } @@ -63,7 +63,7 @@ fn g() { } let mut x = box Foo { f: box 3 }; - let c1 = |&mut:| get(&*x.f); + let c1 = || get(&*x.f); *x.f = 5; //~ ERROR cannot assign to `*x.f` } @@ -73,8 +73,8 @@ fn h() { } let mut x = box Foo { f: box 3 }; - let c1 = |&mut:| get(&*x.f); - let c2 = |&mut:| *x.f = 5; //~ ERROR cannot borrow `x` as mutable + let c1 = || get(&*x.f); + let c2 = || *x.f = 5; //~ ERROR cannot borrow `x` as mutable } fn main() { diff --git a/src/test/compile-fail/borrowck-closures-mut-of-imm.rs b/src/test/compile-fail/borrowck-closures-mut-of-imm.rs index 8260774190..40f9be2dd8 100644 --- a/src/test/compile-fail/borrowck-closures-mut-of-imm.rs +++ b/src/test/compile-fail/borrowck-closures-mut-of-imm.rs @@ -20,9 +20,9 @@ fn set(x: &mut isize) { } fn a(x: &isize) { - let c1 = |&mut:| set(&mut *x); + let c1 = || set(&mut *x); //~^ ERROR cannot borrow - let c2 = |&mut:| set(&mut *x); + let c2 = || set(&mut *x); //~^ ERROR cannot borrow //~| ERROR closure requires unique access } diff --git a/src/test/compile-fail/borrowck-closures-two-mut.rs b/src/test/compile-fail/borrowck-closures-two-mut.rs index 5cb49ab771..8ab4e257b0 100644 --- a/src/test/compile-fail/borrowck-closures-two-mut.rs +++ b/src/test/compile-fail/borrowck-closures-two-mut.rs @@ -14,10 +14,12 @@ #![feature(box_syntax)] +fn to_fn_mut(f: F) -> F { f } + fn a() { - let mut x = 3is; - let c1 = |&mut:| x = 4; - let c2 = |&mut:| x = 5; //~ ERROR cannot borrow `x` as mutable more than once + let mut x = 3; + let c1 = to_fn_mut(|| x = 4); + let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once } fn set(x: &mut isize) { @@ -25,21 +27,21 @@ fn set(x: &mut isize) { } fn b() { - let mut x = 3is; - let c1 = |&mut:| set(&mut x); - let c2 = |&mut:| set(&mut x); //~ ERROR cannot borrow `x` as mutable more than once + let mut x = 3; + let c1 = to_fn_mut(|| set(&mut x)); + let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once } fn c() { - let mut x = 3is; - let c1 = |&mut:| x = 5; - let c2 = |&mut:| set(&mut x); //~ ERROR cannot borrow `x` as mutable more than once + let mut x = 3; + let c1 = to_fn_mut(|| x = 5); + let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once } fn d() { - let mut x = 3is; - let c1 = |&mut:| x = 5; - let c2 = |&mut:| { let _y = |&mut:| set(&mut x); }; // (nested closure) + let mut x = 3; + let c1 = to_fn_mut(|| x = 5); + let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure) //~^ ERROR cannot borrow `x` as mutable more than once } @@ -49,8 +51,8 @@ fn g() { } let mut x = box Foo { f: box 3 }; - let c1 = |&mut:| set(&mut *x.f); - let c2 = |&mut:| set(&mut *x.f); + let c1 = to_fn_mut(|| set(&mut *x.f)); + let c2 = to_fn_mut(|| set(&mut *x.f)); //~^ ERROR cannot borrow `x` as mutable more than once } diff --git a/src/test/compile-fail/borrowck-closures-unique-imm.rs b/src/test/compile-fail/borrowck-closures-unique-imm.rs index cf86602af0..dcf43c01e1 100644 --- a/src/test/compile-fail/borrowck-closures-unique-imm.rs +++ b/src/test/compile-fail/borrowck-closures-unique-imm.rs @@ -16,7 +16,7 @@ pub fn main() { let mut this = &mut Foo { x: 1, }; - let mut r = |&mut:| { + let mut r = || { let p = &this.x; &mut this.x; //~ ERROR cannot borrow }; diff --git a/src/test/compile-fail/borrowck-closures-unique.rs b/src/test/compile-fail/borrowck-closures-unique.rs index f9a6d5ac84..9410181659 100644 --- a/src/test/compile-fail/borrowck-closures-unique.rs +++ b/src/test/compile-fail/borrowck-closures-unique.rs @@ -23,27 +23,27 @@ fn set(x: &mut isize) -> isize { } fn a(x: &mut isize) { - let c1 = |&mut:| get(x); - let c2 = |&mut:| get(x); + let c1 = || get(x); + let c2 = || get(x); } fn b(x: &mut isize) { - let c1 = |&mut:| get(x); - let c2 = |&mut:| set(x); //~ ERROR closure requires unique access to `x` + let c1 = || get(x); + let c2 = || set(x); //~ ERROR closure requires unique access to `x` } fn c(x: &mut isize) { - let c1 = |&mut:| get(x); - let c2 = |&mut:| { get(x); set(x); }; //~ ERROR closure requires unique access to `x` + let c1 = || get(x); + let c2 = || { get(x); set(x); }; //~ ERROR closure requires unique access to `x` } fn d(x: &mut isize) { - let c1 = |&mut:| set(x); - let c2 = |&mut:| set(x); //~ ERROR closure requires unique access to `x` + let c1 = || set(x); + let c2 = || set(x); //~ ERROR closure requires unique access to `x` } fn e(x: &mut isize) { - let c1 = |&mut:| x = panic!(); //~ ERROR closure cannot assign to immutable local variable + let c1 = || x = panic!(); //~ ERROR closure cannot assign to immutable local variable } fn main() { diff --git a/src/test/compile-fail/borrowck-closures-use-after-free.rs b/src/test/compile-fail/borrowck-closures-use-after-free.rs index b6529da188..32cd364d1f 100644 --- a/src/test/compile-fail/borrowck-closures-use-after-free.rs +++ b/src/test/compile-fail/borrowck-closures-use-after-free.rs @@ -26,7 +26,7 @@ impl Drop for Foo { fn main() { let mut ptr = box Foo { x: 0 }; - let mut test = |&mut: foo: &Foo| { + let mut test = |foo: &Foo| { ptr = box Foo { x: ptr.x + 1 }; }; test(&*ptr); //~ ERROR cannot borrow `*ptr` diff --git a/src/test/compile-fail/borrowck-for-loop-correct-cmt-for-pattern.rs b/src/test/compile-fail/borrowck-for-loop-correct-cmt-for-pattern.rs index 6884ac153a..492fd4a2c8 100644 --- a/src/test/compile-fail/borrowck-for-loop-correct-cmt-for-pattern.rs +++ b/src/test/compile-fail/borrowck-for-loop-correct-cmt-for-pattern.rs @@ -17,7 +17,7 @@ struct Foo { } fn main() { - let mut y = 1is; + let mut y = 1; let x = Some(&mut y); for &a in x.iter() { //~ ERROR cannot move out } @@ -25,10 +25,10 @@ fn main() { let f = Foo { a: [box 3, box 4, box 5], }; - for &a in f.a.iter() { //~ ERROR cannot move out + for &a in &f.a { //~ ERROR cannot move out } - let x = Some(box 1is); + let x = Some(box 1); for &a in x.iter() { //~ ERROR cannot move out } } diff --git a/src/test/compile-fail/borrowck-for-loop-head-linkage.rs b/src/test/compile-fail/borrowck-for-loop-head-linkage.rs index d2f99ea696..01a649ae24 100644 --- a/src/test/compile-fail/borrowck-for-loop-head-linkage.rs +++ b/src/test/compile-fail/borrowck-for-loop-head-linkage.rs @@ -11,11 +11,11 @@ use std::iter::repeat; fn main() { - let mut vector = vec![1us, 2]; - for &x in vector.iter() { + let mut vector = vec![1, 2]; + for &x in &vector { let cap = vector.capacity(); vector.extend(repeat(0)); //~ ERROR cannot borrow - vector[1us] = 5us; //~ ERROR cannot borrow + vector[1] = 5; //~ ERROR cannot borrow } } diff --git a/src/test/compile-fail/borrowck-if-no-else.rs b/src/test/compile-fail/borrowck-if-no-else.rs index b98833776f..74b542800b 100644 --- a/src/test/compile-fail/borrowck-if-no-else.rs +++ b/src/test/compile-fail/borrowck-if-no-else.rs @@ -11,6 +11,6 @@ fn foo(x: isize) { println!("{}", x); } fn main() { - let x: isize; if 1is > 2 { x = 10; } + let x: isize; if 1 > 2 { x = 10; } foo(x); //~ ERROR use of possibly uninitialized variable: `x` } diff --git a/src/test/compile-fail/borrowck-if-with-else.rs b/src/test/compile-fail/borrowck-if-with-else.rs index c74edfd8d0..f3b02d1285 100644 --- a/src/test/compile-fail/borrowck-if-with-else.rs +++ b/src/test/compile-fail/borrowck-if-with-else.rs @@ -12,7 +12,7 @@ fn foo(x: isize) { println!("{}", x); } fn main() { let x: isize; - if 1is > 2 { + if 1 > 2 { println!("whoops"); } else { x = 10; diff --git a/src/test/compile-fail/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs b/src/test/compile-fail/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs index fabfce6ffb..8af1023192 100644 --- a/src/test/compile-fail/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs +++ b/src/test/compile-fail/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - let mut _a = 3is; + let mut _a = 3; let _b = &mut _a; { let _c = &*_b; diff --git a/src/test/compile-fail/borrowck-init-in-called-fn-expr.rs b/src/test/compile-fail/borrowck-init-in-called-fn-expr.rs index 3c20abab8b..5b32fd2d19 100644 --- a/src/test/compile-fail/borrowck-init-in-called-fn-expr.rs +++ b/src/test/compile-fail/borrowck-init-in-called-fn-expr.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - let j = |&:| -> isize { + let j = || -> isize { let i: isize; i //~ ERROR use of possibly uninitialized variable: `i` }; diff --git a/src/test/compile-fail/borrowck-init-in-fn-expr.rs b/src/test/compile-fail/borrowck-init-in-fn-expr.rs index 31ca39c3f9..65f1a1fa09 100644 --- a/src/test/compile-fail/borrowck-init-in-fn-expr.rs +++ b/src/test/compile-fail/borrowck-init-in-fn-expr.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - let f = |&:| -> isize { + let f = || -> isize { let i: isize; i //~ ERROR use of possibly uninitialized variable: `i` }; diff --git a/src/test/compile-fail/borrowck-insert-during-each.rs b/src/test/compile-fail/borrowck-insert-during-each.rs index d729af844c..2c63486598 100644 --- a/src/test/compile-fail/borrowck-insert-during-each.rs +++ b/src/test/compile-fail/borrowck-insert-during-each.rs @@ -17,7 +17,7 @@ struct Foo { impl Foo { pub fn foo(&mut self, mut fun: F) where F: FnMut(&isize) { - for f in self.n.iter() { + for f in &self.n { fun(f); } } diff --git a/src/test/compile-fail/borrowck-issue-2657-1.rs b/src/test/compile-fail/borrowck-issue-2657-1.rs index dc1c73efc4..0c717d2ee5 100644 --- a/src/test/compile-fail/borrowck-issue-2657-1.rs +++ b/src/test/compile-fail/borrowck-issue-2657-1.rs @@ -11,7 +11,7 @@ #![feature(box_syntax)] fn main() { - let x = Some(box 1is); + let x = Some(box 1); match x { Some(ref _y) => { let _a = x; //~ ERROR cannot move diff --git a/src/test/compile-fail/borrowck-issue-2657-2.rs b/src/test/compile-fail/borrowck-issue-2657-2.rs index 0b76044f8d..b4e5ae1c25 100644 --- a/src/test/compile-fail/borrowck-issue-2657-2.rs +++ b/src/test/compile-fail/borrowck-issue-2657-2.rs @@ -11,7 +11,7 @@ #![feature(box_syntax)] fn main() { - let x = Some(box 1is); + let x = Some(box 1); match x { Some(ref y) => { let _b = *y; //~ ERROR cannot move out diff --git a/src/test/compile-fail/borrowck-lend-flow-loop.rs b/src/test/compile-fail/borrowck-lend-flow-loop.rs index 491a0d40be..5418a531fe 100644 --- a/src/test/compile-fail/borrowck-lend-flow-loop.rs +++ b/src/test/compile-fail/borrowck-lend-flow-loop.rs @@ -41,7 +41,7 @@ fn block_overarching_alias_mut() { let mut v = box 3; let mut x = &mut v; - for _ in range(0is, 3) { + for _ in 0..3 { borrow(&*v); //~ ERROR cannot borrow } *x = box 5; diff --git a/src/test/compile-fail/borrowck-lend-flow-match.rs b/src/test/compile-fail/borrowck-lend-flow-match.rs index f501682847..f24e82d11c 100644 --- a/src/test/compile-fail/borrowck-lend-flow-match.rs +++ b/src/test/compile-fail/borrowck-lend-flow-match.rs @@ -19,10 +19,10 @@ fn separate_arms() { None => { // It is ok to reassign x here, because there is in // fact no outstanding loan of x! - x = Some(0is); + x = Some(0); } - Some(ref _i) => { - x = Some(1is); //~ ERROR cannot assign + Some(ref __isize) => { + x = Some(1); //~ ERROR cannot assign } } x.clone(); // just to prevent liveness warnings diff --git a/src/test/compile-fail/borrowck-let-suggestion-suffixes.rs b/src/test/compile-fail/borrowck-let-suggestion-suffixes.rs new file mode 100644 index 0000000000..f551a2aa81 --- /dev/null +++ b/src/test/compile-fail/borrowck-let-suggestion-suffixes.rs @@ -0,0 +1,57 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn f() { + let old = ['o']; // statement 0 + let mut v1 = Vec::new(); // statement 1 + + let mut v2 = Vec::new(); // statement 2 + //~^ NOTE reference must be valid for the block suffix following statement 2 + + let young = ['y']; // statement 3 + //~^ NOTE ...but borrowed value is only valid for the block suffix following statement 3 + + v2.push(&young[0]); // statement 4 + //~^ ERROR `young[..]` does not live long enough + + let mut v3 = Vec::new(); // statement 5 + //~^ NOTE reference must be valid for the block suffix following statement 5 + + v3.push(&'x'); // statement 6 + //~^ ERROR borrowed value does not live long enough + //~| NOTE ...but borrowed value is only valid for the statement + //~| HELP consider using a `let` binding to increase its lifetime + + { + + let mut v4 = Vec::new(); // (sub) statement 0 + //~^ NOTE reference must be valid for the block suffix following statement 0 + + v4.push(&'y'); + //~^ ERROR borrowed value does not live long enough + //~| NOTE ...but borrowed value is only valid for the statement + //~| HELP consider using a `let` binding to increase its lifetime + + } // (statement 7) + + let mut v5 = Vec::new(); // statement 8 + //~^ NOTE reference must be valid for the block suffix following statement 8 + + v5.push(&'z'); + //~^ ERROR borrowed value does not live long enough + //~| NOTE ...but borrowed value is only valid for the statement + //~| HELP consider using a `let` binding to increase its lifetime + + v1.push(&old[0]); +} + +fn main() { + f(); +} diff --git a/src/test/compile-fail/borrowck-let-suggestion.rs b/src/test/compile-fail/borrowck-let-suggestion.rs index 5f5ff4014e..5729f8c561 100644 --- a/src/test/compile-fail/borrowck-let-suggestion.rs +++ b/src/test/compile-fail/borrowck-let-suggestion.rs @@ -9,8 +9,8 @@ // except according to those terms. fn f() { - let x = [1is].iter(); //~ ERROR borrowed value does not live long enough - //~^^ NOTE reference must be valid for the block + let x = [1].iter(); //~ ERROR borrowed value does not live long enough + //~^ NOTE reference must be valid for the block suffix following statement //~^^ HELP consider using a `let` binding to increase its lifetime } diff --git a/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs b/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs index bff2225776..7f676f5166 100644 --- a/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs +++ b/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs @@ -10,25 +10,25 @@ #![feature(box_syntax)] -use std::thread::Thread; +use std::thread; fn borrow(v: &isize, f: F) where F: FnOnce(&isize) { f(v); } fn box_imm() { - let v = box 3is; + let v = box 3; let _w = &v; - Thread::spawn(move|| { + thread::spawn(move|| { println!("v={}", *v); //~^ ERROR cannot move `v` into closure }); } fn box_imm_explicit() { - let v = box 3is; + let v = box 3; let _w = &v; - Thread::spawn(move|| { + thread::spawn(move|| { println!("v={}", *v); //~^ ERROR cannot move }); diff --git a/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs b/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs index 902762f687..8fb527b324 100644 --- a/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs +++ b/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(box_patterns)] #![feature(box_syntax)] use std::ops::Add; diff --git a/src/test/compile-fail/borrowck-match-binding-is-assignment.rs b/src/test/compile-fail/borrowck-match-binding-is-assignment.rs index 575d67c0b8..38593d3184 100644 --- a/src/test/compile-fail/borrowck-match-binding-is-assignment.rs +++ b/src/test/compile-fail/borrowck-match-binding-is-assignment.rs @@ -19,7 +19,7 @@ struct S { } pub fn main() { - match 1is { + match 1 { x => { x += 1; //~ ERROR re-assignment of immutable variable `x` } @@ -37,13 +37,13 @@ pub fn main() { } } - match (1is,) { + match (1,) { (x,) => { x += 1; //~ ERROR re-assignment of immutable variable `x` } } - match [1is,2,3] { + match [1,2,3] { [x,_,_] => { x += 1; //~ ERROR re-assignment of immutable variable `x` } diff --git a/src/test/compile-fail/borrowck-move-by-capture.rs b/src/test/compile-fail/borrowck-move-by-capture.rs index b0d546cd5c..a1708e7f49 100644 --- a/src/test/compile-fail/borrowck-move-by-capture.rs +++ b/src/test/compile-fail/borrowck-move-by-capture.rs @@ -8,11 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(box_syntax)] +#![feature(box_syntax,unboxed_closures)] + +fn to_fn_mut>(f: F) -> F { f } +fn to_fn_once>(f: F) -> F { f } pub fn main() { let bar = box 3; - let _g = |&mut:| { - let _h = move |:| -> isize { *bar }; //~ ERROR cannot move out of captured outer variable - }; + let _g = to_fn_mut(|| { + let _h = to_fn_once(move || -> isize { *bar }); //~ ERROR cannot move out of + }); } diff --git a/src/test/compile-fail/borrowck-move-from-subpath-of-borrowed-path.rs b/src/test/compile-fail/borrowck-move-from-subpath-of-borrowed-path.rs index 0d1a51bbf3..3d8d599970 100644 --- a/src/test/compile-fail/borrowck-move-from-subpath-of-borrowed-path.rs +++ b/src/test/compile-fail/borrowck-move-from-subpath-of-borrowed-path.rs @@ -14,7 +14,7 @@ #![feature(box_syntax)] fn main() { - let a = box box 2is; + let a = box box 2; let b = &a; let z = *a; //~ ERROR: cannot move out of `*a` because it is borrowed diff --git a/src/test/compile-fail/borrowck-move-out-of-overloaded-auto-deref.rs b/src/test/compile-fail/borrowck-move-out-of-overloaded-auto-deref.rs index 507f073adb..27cef1f3c6 100644 --- a/src/test/compile-fail/borrowck-move-out-of-overloaded-auto-deref.rs +++ b/src/test/compile-fail/borrowck-move-out-of-overloaded-auto-deref.rs @@ -11,6 +11,6 @@ use std::rc::Rc; pub fn main() { - let _x = Rc::new(vec!(1is, 2)).into_iter(); + let _x = Rc::new(vec!(1, 2)).into_iter(); //~^ ERROR cannot move out of borrowed content } diff --git a/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs b/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs index 75596af10d..f9d24130e4 100644 --- a/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs +++ b/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs @@ -10,7 +10,7 @@ // Test that we do not permit moves from &[] matched by a vec pattern. -#[derive(Clone, Show)] +#[derive(Clone, Debug)] struct Foo { string: String } @@ -21,7 +21,7 @@ pub fn main() { Foo { string: "bar".to_string() }, Foo { string: "baz".to_string() } ); - let x: &[Foo] = x.as_slice(); + let x: &[Foo] = &x; match x { [_, tail..] => { match tail { diff --git a/src/test/compile-fail/borrowck-multiple-captures.rs b/src/test/compile-fail/borrowck-multiple-captures.rs index 33ac5d7fce..9db05d7628 100644 --- a/src/test/compile-fail/borrowck-multiple-captures.rs +++ b/src/test/compile-fail/borrowck-multiple-captures.rs @@ -10,16 +10,16 @@ #![feature(box_syntax)] -use std::thread::Thread; +use std::thread; fn borrow(_: &T) { } fn different_vars_after_borrows() { - let x1 = box 1is; + let x1 = box 1; let p1 = &x1; - let x2 = box 2is; + let x2 = box 2; let p2 = &x2; - Thread::spawn(move|| { + thread::spawn(move|| { drop(x1); //~ ERROR cannot move `x1` into closure because it is borrowed drop(x2); //~ ERROR cannot move `x2` into closure because it is borrowed }); @@ -28,20 +28,20 @@ fn different_vars_after_borrows() { } fn different_vars_after_moves() { - let x1 = box 1is; + let x1 = box 1; drop(x1); - let x2 = box 2is; + let x2 = box 2; drop(x2); - Thread::spawn(move|| { + thread::spawn(move|| { drop(x1); //~ ERROR capture of moved value: `x1` drop(x2); //~ ERROR capture of moved value: `x2` }); } fn same_var_after_borrow() { - let x = box 1is; + let x = box 1; let p = &x; - Thread::spawn(move|| { + thread::spawn(move|| { drop(x); //~ ERROR cannot move `x` into closure because it is borrowed drop(x); //~ ERROR use of moved value: `x` }); @@ -49,9 +49,9 @@ fn same_var_after_borrow() { } fn same_var_after_move() { - let x = box 1is; + let x = box 1; drop(x); - Thread::spawn(move|| { + thread::spawn(move|| { drop(x); //~ ERROR capture of moved value: `x` drop(x); //~ ERROR use of moved value: `x` }); diff --git a/src/test/compile-fail/borrowck-mut-slice-of-imm-vec.rs b/src/test/compile-fail/borrowck-mut-slice-of-imm-vec.rs index b8a92db4e4..9341758afd 100644 --- a/src/test/compile-fail/borrowck-mut-slice-of-imm-vec.rs +++ b/src/test/compile-fail/borrowck-mut-slice-of-imm-vec.rs @@ -14,5 +14,5 @@ fn write(v: &mut [isize]) { fn main() { let v = vec!(1, 2, 3); - write(v.as_mut_slice()); //~ ERROR cannot borrow + write(&mut v); //~ ERROR cannot borrow } diff --git a/src/test/compile-fail/borrowck-overloaded-call.rs b/src/test/compile-fail/borrowck-overloaded-call.rs index 7d35a27c0a..04d73cc36f 100644 --- a/src/test/compile-fail/borrowck-overloaded-call.rs +++ b/src/test/compile-fail/borrowck-overloaded-call.rs @@ -17,7 +17,9 @@ struct SFn { y: isize, } -impl Fn<(isize,),isize> for SFn { +impl Fn<(isize,)> for SFn { + type Output = isize; + extern "rust-call" fn call(&self, (z,): (isize,)) -> isize { self.x * self.y * z } @@ -28,7 +30,9 @@ struct SFnMut { y: isize, } -impl FnMut<(isize,),isize> for SFnMut { +impl FnMut<(isize,)> for SFnMut { + type Output = isize; + extern "rust-call" fn call_mut(&mut self, (z,): (isize,)) -> isize { self.x * self.y * z } @@ -38,7 +42,9 @@ struct SFnOnce { x: String, } -impl FnOnce<(String,),usize> for SFnOnce { +impl FnOnce<(String,)> for SFnOnce { + type Output = usize; + extern "rust-call" fn call_once(self, (z,): (String,)) -> usize { self.x.len() + z.len() } diff --git a/src/test/compile-fail/borrowck-overloaded-index-2.rs b/src/test/compile-fail/borrowck-overloaded-index-2.rs index da3da47fa9..e9d8544a06 100644 --- a/src/test/compile-fail/borrowck-overloaded-index-2.rs +++ b/src/test/compile-fail/borrowck-overloaded-index-2.rs @@ -25,7 +25,7 @@ impl Index for MyVec { } fn main() { - let v = MyVec { data: vec!(box 1is, box 2, box 3) }; + let v = MyVec { data: vec!(box 1, box 2, box 3) }; let good = &v[0]; // Shouldn't fail here let bad = v[0]; //~^ ERROR cannot move out of indexed content diff --git a/src/test/compile-fail/borrowck-overloaded-index-autoderef.rs b/src/test/compile-fail/borrowck-overloaded-index-autoderef.rs index 9193a28511..99f396ef81 100644 --- a/src/test/compile-fail/borrowck-overloaded-index-autoderef.rs +++ b/src/test/compile-fail/borrowck-overloaded-index-autoderef.rs @@ -22,7 +22,7 @@ impl Index for Foo { type Output = isize; fn index<'a>(&'a self, z: &String) -> &'a isize { - if z.as_slice() == "x" { + if *z == "x" { &self.x } else { &self.y @@ -31,10 +31,8 @@ impl Index for Foo { } impl IndexMut for Foo { - type Output = isize; - fn index_mut<'a>(&'a mut self, z: &String) -> &'a mut isize { - if z.as_slice() == "x" { + if *z == "x" { &mut self.x } else { &mut self.y diff --git a/src/test/compile-fail/borrowck-overloaded-index.rs b/src/test/compile-fail/borrowck-overloaded-index.rs index 7259ca8971..2d752abe7e 100644 --- a/src/test/compile-fail/borrowck-overloaded-index.rs +++ b/src/test/compile-fail/borrowck-overloaded-index.rs @@ -19,7 +19,7 @@ impl Index for Foo { type Output = isize; fn index<'a>(&'a self, z: &String) -> &'a isize { - if z.as_slice() == "x" { + if *z == "x" { &self.x } else { &self.y @@ -28,10 +28,8 @@ impl Index for Foo { } impl IndexMut for Foo { - type Output = isize; - fn index_mut<'a>(&'a mut self, z: &String) -> &'a mut isize { - if z.as_slice() == "x" { + if *z == "x" { &mut self.x } else { &mut self.y diff --git a/src/test/compile-fail/borrowck-partial-reinit-1.rs b/src/test/compile-fail/borrowck-partial-reinit-1.rs new file mode 100644 index 0000000000..1ee040a070 --- /dev/null +++ b/src/test/compile-fail/borrowck-partial-reinit-1.rs @@ -0,0 +1,49 @@ +// Copyright 2014-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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Test; + +struct Test2 { + b: Option, +} + +struct Test3(Option); + +impl Drop for Test { + fn drop(&mut self) { + println!("dropping!"); + } +} + +impl Drop for Test2 { + fn drop(&mut self) {} +} + +impl Drop for Test3 { + fn drop(&mut self) {} +} + +fn stuff() { + let mut t = Test2 { b: None }; + let u = Test; + drop(t); + t.b = Some(u); + //~^ ERROR partial reinitialization of uninitialized structure `t` + + let mut t = Test3(None); + let u = Test; + drop(t); + t.0 = Some(u); + //~^ ERROR partial reinitialization of uninitialized structure `t` +} + +fn main() { + stuff() +} diff --git a/src/test/compile-fail/borrowck-partial-reinit-2.rs b/src/test/compile-fail/borrowck-partial-reinit-2.rs new file mode 100644 index 0000000000..0926ba6e43 --- /dev/null +++ b/src/test/compile-fail/borrowck-partial-reinit-2.rs @@ -0,0 +1,34 @@ +// Copyright 2014-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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Test { + a: isize, + b: Option>, +} + +impl Drop for Test { + fn drop(&mut self) { + println!("Dropping {}", self.a); + } +} + +fn stuff() { + let mut t = Test { a: 1, b: None}; + let mut u = Test { a: 2, b: Some(Box::new(t))}; + t.b = Some(Box::new(u)); + //~^ ERROR partial reinitialization of uninitialized structure `t` + println!("done"); +} + +fn main() { + stuff(); + println!("Hello, world!") +} + diff --git a/src/test/compile-fail/borrowck-partial-reinit-3.rs b/src/test/compile-fail/borrowck-partial-reinit-3.rs new file mode 100644 index 0000000000..0aa73892b8 --- /dev/null +++ b/src/test/compile-fail/borrowck-partial-reinit-3.rs @@ -0,0 +1,22 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +use std::mem; + +struct Test { f: usize } +impl Drop for Test { + fn drop(&mut self) {} +} + +fn main() { + let mut x = (Test { f: 2 }, Test { f: 4 }); + mem::drop(x.0); + x.0.f = 3; + //~^ ERROR partial reinitialization of uninitialized structure `x.0` +} diff --git a/src/test/compile-fail/borrowck-partial-reinit-4.rs b/src/test/compile-fail/borrowck-partial-reinit-4.rs new file mode 100644 index 0000000000..774e04ecb2 --- /dev/null +++ b/src/test/compile-fail/borrowck-partial-reinit-4.rs @@ -0,0 +1,33 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Test; + +struct Test2(Option); + +impl Drop for Test { + fn drop(&mut self) { + println!("dropping!"); + } +} + +impl Drop for Test2 { + fn drop(&mut self) {} +} + +fn stuff() { + let mut x : (Test2, Test2); + (x.0).0 = Some(Test); + //~^ ERROR partial reinitialization of uninitialized structure `x.0` +} + +fn main() { + stuff() +} diff --git a/src/test/compile-fail/borrowck-report-with-custom-diagnostic.rs b/src/test/compile-fail/borrowck-report-with-custom-diagnostic.rs index c3a1e808e3..2163737072 100644 --- a/src/test/compile-fail/borrowck-report-with-custom-diagnostic.rs +++ b/src/test/compile-fail/borrowck-report-with-custom-diagnostic.rs @@ -11,7 +11,7 @@ #![allow(dead_code)] fn main() { // Original borrow ends at end of function - let mut x = 1us; + let mut x = 1_usize; let y = &mut x; let z = &x; //~ ERROR cannot borrow } @@ -21,7 +21,7 @@ fn foo() { match true { true => { // Original borrow ends at end of match arm - let mut x = 1us; + let mut x = 1_usize; let y = &x; let z = &mut x; //~ ERROR cannot borrow } @@ -32,8 +32,8 @@ fn foo() { fn bar() { // Original borrow ends at end of closure - |&:| { - let mut x = 1us; + || { + let mut x = 1_usize; let y = &mut x; let z = &mut x; //~ ERROR cannot borrow }; diff --git a/src/test/compile-fail/borrowck-uniq-via-lend.rs b/src/test/compile-fail/borrowck-uniq-via-lend.rs index 7fadf6d466..49a1b782a3 100644 --- a/src/test/compile-fail/borrowck-uniq-via-lend.rs +++ b/src/test/compile-fail/borrowck-uniq-via-lend.rs @@ -13,7 +13,7 @@ fn borrow(_v: &isize) {} fn local() { - let mut v = box 3is; + let mut v = box 3; borrow(&*v); } @@ -32,27 +32,27 @@ fn local_recs() { } fn aliased_imm() { - let mut v = box 3is; + let mut v = box 3; let _w = &v; borrow(&*v); } fn aliased_mut() { - let mut v = box 3is; + let mut v = box 3; let _w = &mut v; borrow(&*v); //~ ERROR cannot borrow `*v` } fn aliased_other() { - let mut v = box 3is; - let mut w = box 4is; + let mut v = box 3; + let mut w = box 4; let _x = &mut w; borrow(&*v); } fn aliased_other_reassign() { - let mut v = box 3is; - let mut w = box 4is; + let mut v = box 3; + let mut w = box 4; let mut _x = &mut w; _x = &mut v; borrow(&*v); //~ ERROR cannot borrow `*v` diff --git a/src/test/compile-fail/borrowck-use-in-index-lvalue.rs b/src/test/compile-fail/borrowck-use-in-index-lvalue.rs index 94c1d3a6a4..7291bcd2ce 100644 --- a/src/test/compile-fail/borrowck-use-in-index-lvalue.rs +++ b/src/test/compile-fail/borrowck-use-in-index-lvalue.rs @@ -10,10 +10,10 @@ fn test() { let w: &mut [isize]; - w[5] = 0; //~ ERROR use of possibly uninitialized variable: `w` + w[5] = 0; //~ ERROR use of possibly uninitialized variable: `*w` let mut w: &mut [isize]; - w[5] = 0; //~ ERROR use of possibly uninitialized variable: `w` + w[5] = 0; //~ ERROR use of possibly uninitialized variable: `*w` } fn main() { test(); } diff --git a/src/test/compile-fail/borrowck-use-mut-borrow.rs b/src/test/compile-fail/borrowck-use-mut-borrow.rs index 42e12622b6..52f89da10b 100644 --- a/src/test/compile-fail/borrowck-use-mut-borrow.rs +++ b/src/test/compile-fail/borrowck-use-mut-borrow.rs @@ -10,10 +10,9 @@ #![feature(box_syntax)] +#[derive(Copy)] struct A { a: isize, b: isize } -impl Copy for A {} - struct B { a: isize, b: Box } fn var_copy_after_var_borrow() { diff --git a/src/test/compile-fail/borrowck-vec-pattern-element-loan.rs b/src/test/compile-fail/borrowck-vec-pattern-element-loan.rs index 577334cce9..2d6a4b7d2c 100644 --- a/src/test/compile-fail/borrowck-vec-pattern-element-loan.rs +++ b/src/test/compile-fail/borrowck-vec-pattern-element-loan.rs @@ -12,7 +12,7 @@ fn a<'a>() -> &'a [isize] { let vec = vec!(1, 2, 3, 4); - let vec: &[isize] = vec.as_slice(); //~ ERROR does not live long enough + let vec: &[isize] = &vec; //~ ERROR does not live long enough let tail = match vec { [_, tail..] => tail, _ => panic!("a") @@ -22,7 +22,7 @@ fn a<'a>() -> &'a [isize] { fn b<'a>() -> &'a [isize] { let vec = vec!(1, 2, 3, 4); - let vec: &[isize] = vec.as_slice(); //~ ERROR does not live long enough + let vec: &[isize] = &vec; //~ ERROR does not live long enough let init = match vec { [init.., _] => init, _ => panic!("b") @@ -32,7 +32,7 @@ fn b<'a>() -> &'a [isize] { fn c<'a>() -> &'a [isize] { let vec = vec!(1, 2, 3, 4); - let vec: &[isize] = vec.as_slice(); //~ ERROR does not live long enough + let vec: &[isize] = &vec; //~ ERROR does not live long enough let slice = match vec { [_, slice.., _] => slice, _ => panic!("c") diff --git a/src/test/compile-fail/borrowck-vec-pattern-loan-from-mut.rs b/src/test/compile-fail/borrowck-vec-pattern-loan-from-mut.rs index 565b8ca2f6..c1906758a5 100644 --- a/src/test/compile-fail/borrowck-vec-pattern-loan-from-mut.rs +++ b/src/test/compile-fail/borrowck-vec-pattern-loan-from-mut.rs @@ -10,7 +10,7 @@ fn a() { let mut v = vec!(1, 2, 3); - let vb: &mut [isize] = v.as_mut_slice(); + let vb: &mut [isize] = &mut v; match vb { [_a, tail..] => { v.push(tail[0] + tail[1]); //~ ERROR cannot borrow diff --git a/src/test/compile-fail/borrowck-vec-pattern-move-tail.rs b/src/test/compile-fail/borrowck-vec-pattern-move-tail.rs index 8869e99efd..242a384400 100644 --- a/src/test/compile-fail/borrowck-vec-pattern-move-tail.rs +++ b/src/test/compile-fail/borrowck-vec-pattern-move-tail.rs @@ -9,11 +9,13 @@ // except according to those terms. fn main() { - let mut a = [1is, 2, 3, 4]; + let mut a = [1, 2, 3, 4]; let t = match a { [1, 2, tail..] => tail, _ => unreachable!() }; - a[0] = 0; //~ ERROR cannot assign to `a[..]` because it is borrowed + println!("t[0]: {}", t[0]); + a[2] = 0; //~ ERROR cannot assign to `a[..]` because it is borrowed + println!("t[0]: {}", t[0]); t[0]; } diff --git a/src/test/compile-fail/borrowck-vec-pattern-nesting.rs b/src/test/compile-fail/borrowck-vec-pattern-nesting.rs index 49994ebdbb..b471439f75 100644 --- a/src/test/compile-fail/borrowck-vec-pattern-nesting.rs +++ b/src/test/compile-fail/borrowck-vec-pattern-nesting.rs @@ -9,10 +9,11 @@ // except according to those terms. #![feature(advanced_slice_patterns)] +#![feature(box_patterns)] #![feature(box_syntax)] fn a() { - let mut vec = [box 1is, box 2, box 3]; + let mut vec = [box 1, box 2, box 3]; match vec { [box ref _a, _, _] => { vec[0] = box 4; //~ ERROR cannot assign @@ -21,8 +22,8 @@ fn a() { } fn b() { - let mut vec = vec!(box 1is, box 2, box 3); - let vec: &mut [Box] = vec.as_mut_slice(); + let mut vec = vec!(box 1, box 2, box 3); + let vec: &mut [Box] = &mut vec; match vec { [_b..] => { vec[0] = box 4; //~ ERROR cannot assign @@ -31,8 +32,8 @@ fn b() { } fn c() { - let mut vec = vec!(box 1is, box 2, box 3); - let vec: &mut [Box] = vec.as_mut_slice(); + let mut vec = vec!(box 1, box 2, box 3); + let vec: &mut [Box] = &mut vec; match vec { [_a, //~ ERROR cannot move out _b..] => { //~^ NOTE attempting to move value to here @@ -49,8 +50,8 @@ fn c() { } fn d() { - let mut vec = vec!(box 1is, box 2, box 3); - let vec: &mut [Box] = vec.as_mut_slice(); + let mut vec = vec!(box 1, box 2, box 3); + let vec: &mut [Box] = &mut vec; match vec { [_a.., //~ ERROR cannot move out _b] => {} //~ NOTE attempting to move value to here @@ -60,8 +61,8 @@ fn d() { } fn e() { - let mut vec = vec!(box 1is, box 2, box 3); - let vec: &mut [Box] = vec.as_mut_slice(); + let mut vec = vec!(box 1, box 2, box 3); + let vec: &mut [Box] = &mut vec; match vec { [_a, _b, _c] => {} //~ ERROR cannot move out //~^ NOTE attempting to move value to here diff --git a/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs b/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs index bcd1aa81d4..df0fee437b 100644 --- a/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs +++ b/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs @@ -10,7 +10,7 @@ fn a<'a>() -> &'a isize { let vec = vec!(1, 2, 3, 4); - let vec: &[isize] = vec.as_slice(); //~ ERROR `vec` does not live long enough + let vec: &[isize] = &vec; //~ ERROR `vec` does not live long enough let tail = match vec { [_a, tail..] => &tail[0], _ => panic!("foo") diff --git a/src/test/compile-fail/borrowck-while-break.rs b/src/test/compile-fail/borrowck-while-break.rs index 4752120d69..8cdf1da5c9 100644 --- a/src/test/compile-fail/borrowck-while-break.rs +++ b/src/test/compile-fail/borrowck-while-break.rs @@ -11,7 +11,7 @@ fn test(cond: bool) { let v; while cond { - v = 3is; + v = 3; break; } println!("{}", v); //~ ERROR use of possibly uninitialized variable: `v` diff --git a/src/test/compile-fail/borrowck-while.rs b/src/test/compile-fail/borrowck-while.rs index f163cf602b..e3566e9bb9 100644 --- a/src/test/compile-fail/borrowck-while.rs +++ b/src/test/compile-fail/borrowck-while.rs @@ -10,7 +10,7 @@ fn f() -> isize { let mut x: isize; - while 1is == 1 { x = 10; } + while 1 == 1 { x = 10; } return x; //~ ERROR use of possibly uninitialized variable: `x` } diff --git a/src/test/compile-fail/builtin-superkinds-self-type.rs b/src/test/compile-fail/builtin-superkinds-self-type.rs index 0ec4f3dce1..a6d55ad399 100644 --- a/src/test/compile-fail/builtin-superkinds-self-type.rs +++ b/src/test/compile-fail/builtin-superkinds-self-type.rs @@ -22,6 +22,6 @@ impl Foo for T { } fn main() { let (tx, rx) = channel(); - 1193182is.foo(tx); - assert!(rx.recv() == 1193182is); + 1193182.foo(tx); + assert!(rx.recv() == 1193182); } diff --git a/src/test/compile-fail/builtin-superkinds-simple.rs b/src/test/compile-fail/builtin-superkinds-simple.rs index 2c689f6909..c3fb6a1be8 100644 --- a/src/test/compile-fail/builtin-superkinds-simple.rs +++ b/src/test/compile-fail/builtin-superkinds-simple.rs @@ -13,7 +13,7 @@ trait Foo : Send { } -impl <'a> Foo for &'a mut () { } -//~^ ERROR declared lifetime bound not satisfied +impl Foo for std::rc::Rc { } +//~^ ERROR the trait `core::marker::Send` is not implemented fn main() { } diff --git a/src/test/compile-fail/cannot-mutate-captured-non-mut-var.rs b/src/test/compile-fail/cannot-mutate-captured-non-mut-var.rs index 9148f13c4d..e59bd62d17 100644 --- a/src/test/compile-fail/cannot-mutate-captured-non-mut-var.rs +++ b/src/test/compile-fail/cannot-mutate-captured-non-mut-var.rs @@ -8,12 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(unboxed_closures)] + +fn to_fn_once>(f: F) -> F { f } + fn main() { - let x = 1is; - move|:| { x = 2; }; + let x = 1; + to_fn_once(move|| { x = 2; }); //~^ ERROR: cannot assign to immutable captured outer variable - let s = std::io::stdin(); - move|:| { s.read_to_end(); }; + let s = std::old_io::stdin(); + to_fn_once(move|| { s.read_to_end(); }); //~^ ERROR: cannot borrow immutable captured outer variable } diff --git a/src/test/compile-fail/cast-from-nil.rs b/src/test/compile-fail/cast-from-nil.rs index 558a547871..4c6dcaccc9 100644 --- a/src/test/compile-fail/cast-from-nil.rs +++ b/src/test/compile-fail/cast-from-nil.rs @@ -8,5 +8,5 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: cast from nil: `()` as `u32` +// error-pattern: non-scalar cast: `()` as `u32` fn main() { let u = (assert!(true) as u32); } diff --git a/src/test/compile-fail/cast-to-nil.rs b/src/test/compile-fail/cast-to-nil.rs index 1a5c0744f7..e5fd5bb33e 100644 --- a/src/test/compile-fail/cast-to-nil.rs +++ b/src/test/compile-fail/cast-to-nil.rs @@ -8,5 +8,5 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: cast to nil: `u32` as `()` +// error-pattern: non-scalar cast: `u32` as `()` fn main() { let u = 0u32 as (); } diff --git a/src/test/compile-fail/cfg-attr-cfg-2.rs b/src/test/compile-fail/cfg-attr-cfg-2.rs new file mode 100644 index 0000000000..b71a3be5dc --- /dev/null +++ b/src/test/compile-fail/cfg-attr-cfg-2.rs @@ -0,0 +1,18 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// +// error-pattern: main function not found +// compile-flags: --cfg foo + +// main is conditionally compiled, but the conditional compilation +// is conditional too! + +#[cfg_attr(foo, cfg(bar))] +fn main() { } diff --git a/src/test/compile-fail/cfg-attr-crate-2.rs b/src/test/compile-fail/cfg-attr-crate-2.rs new file mode 100644 index 0000000000..4867dd8d0b --- /dev/null +++ b/src/test/compile-fail/cfg-attr-crate-2.rs @@ -0,0 +1,17 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// +// compile-flags: --cfg broken + +// https://github.com/rust-lang/rust/issues/21833#issuecomment-72353044 + +#![cfg_attr(broken, no_std)] //~ ERROR no_std is experimental + +fn main() { } diff --git a/src/test/compile-fail/check-static-immutable-mut-slices.rs b/src/test/compile-fail/check-static-immutable-mut-slices.rs index d1e3fe2525..1804b9e04c 100644 --- a/src/test/compile-fail/check-static-immutable-mut-slices.rs +++ b/src/test/compile-fail/check-static-immutable-mut-slices.rs @@ -11,6 +11,6 @@ // Checks that immutable static items can't have mutable slices static TEST: &'static mut [isize] = &mut []; -//~^ ERROR statics are not allowed to have mutable references +//~^ ERROR references in statics may only refer to immutable values pub fn main() { } diff --git a/src/test/compile-fail/check-static-values-constraints.rs b/src/test/compile-fail/check-static-values-constraints.rs index 7c4f9ada2d..0180bccbca 100644 --- a/src/test/compile-fail/check-static-values-constraints.rs +++ b/src/test/compile-fail/check-static-values-constraints.rs @@ -99,7 +99,7 @@ static STATIC10: UnsafeStruct = UnsafeStruct; struct MyOwned; static STATIC11: Box = box MyOwned; -//~^ ERROR statics are not allowed to have custom pointers +//~^ ERROR allocations are not allowed in statics // The following examples test that mutable structs are just forbidden // to have types with destructors @@ -117,16 +117,17 @@ static mut STATIC14: SafeStruct = SafeStruct { //~^ ERROR mutable statics are not allowed to have destructors field1: SafeEnum::Variant1, field2: SafeEnum::Variant4("str".to_string()) +//~^ ERROR static contains unimplemented expression type }; static STATIC15: &'static [Box] = &[ - box MyOwned, //~ ERROR statics are not allowed to have custom pointers - box MyOwned, //~ ERROR statics are not allowed to have custom pointers + box MyOwned, //~ ERROR allocations are not allowed in statics + box MyOwned, //~ ERROR allocations are not allowed in statics ]; static STATIC16: (&'static Box, &'static Box) = ( - &box MyOwned, //~ ERROR statics are not allowed to have custom pointers - &box MyOwned, //~ ERROR statics are not allowed to have custom pointers + &box MyOwned, //~ ERROR allocations are not allowed in statics + &box MyOwned, //~ ERROR allocations are not allowed in statics ); static mut STATIC17: SafeEnum = SafeEnum::Variant1; @@ -134,9 +135,9 @@ static mut STATIC17: SafeEnum = SafeEnum::Variant1; static STATIC19: Box = box 3; -//~^ ERROR statics are not allowed to have custom pointers +//~^ ERROR allocations are not allowed in statics pub fn main() { let y = { static x: Box = box 3; x }; - //~^ ERROR statics are not allowed to have custom pointers + //~^ ERROR allocations are not allowed in statics } diff --git a/src/test/compile-fail/class-method-missing.rs b/src/test/compile-fail/class-method-missing.rs index 3b921e0727..ada45e8c1f 100644 --- a/src/test/compile-fail/class-method-missing.rs +++ b/src/test/compile-fail/class-method-missing.rs @@ -27,5 +27,5 @@ fn cat(in_x : usize) -> cat { } fn main() { - let nyan = cat(0us); + let nyan = cat(0_usize); } diff --git a/src/test/compile-fail/class-missing-self.rs b/src/test/compile-fail/class-missing-self.rs index 4d8e4bca78..f25b2e6538 100644 --- a/src/test/compile-fail/class-missing-self.rs +++ b/src/test/compile-fail/class-missing-self.rs @@ -16,7 +16,7 @@ impl cat { fn sleep(&self) { loop{} } fn meow(&self) { println!("Meow"); - meows += 1us; //~ ERROR unresolved name + meows += 1_usize; //~ ERROR unresolved name sleep(); //~ ERROR unresolved name } diff --git a/src/test/compile-fail/closure-reform-bad.rs b/src/test/compile-fail/closure-reform-bad.rs index ef01c96add..d2295eba6d 100644 --- a/src/test/compile-fail/closure-reform-bad.rs +++ b/src/test/compile-fail/closure-reform-bad.rs @@ -17,7 +17,7 @@ fn call_bare(f: fn(&str)) { fn main() { let string = "world!"; - let f = |&: s: &str| println!("{}{}", s, string); + let f = |s: &str| println!("{}{}", s, string); call_bare(f) //~ ERROR mismatched types } diff --git a/src/test/compile-fail/coerce-mut.rs b/src/test/compile-fail/coerce-mut.rs new file mode 100644 index 0000000000..30c1b66a7b --- /dev/null +++ b/src/test/compile-fail/coerce-mut.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn f(x: &mut i32) {} + +fn main() { + let x = 0; + f(&x); + //~^ ERROR mismatched types + //~| expected `&mut i32` + //~| found `&_` + //~| values differ in mutability +} diff --git a/src/test/compile-fail/coerce-overloaded-autoderef.rs b/src/test/compile-fail/coerce-overloaded-autoderef.rs new file mode 100644 index 0000000000..14fbc34c43 --- /dev/null +++ b/src/test/compile-fail/coerce-overloaded-autoderef.rs @@ -0,0 +1,40 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn borrow_mut(x: &mut T) -> &mut T { x } +fn borrow(x: &T) -> &T { x } + +fn borrow_mut2(_: &mut T, _: &mut T) {} +fn borrow2(_: &mut T, _: &T) {} + +fn double_mut_borrow(x: &mut Box) { + let y = borrow_mut(x); + let z = borrow_mut(x); + //~^ ERROR cannot borrow `*x` as mutable more than once at a time +} + +fn double_imm_borrow(x: &mut Box) { + let y = borrow(x); + let z = borrow(x); + **x += 1; + //~^ ERROR cannot assign to `**x` because it is borrowed +} + +fn double_mut_borrow2(x: &mut Box) { + borrow_mut2(x, x); + //~^ ERROR cannot borrow `*x` as mutable more than once at a time +} + +fn double_borrow2(x: &mut Box) { + borrow2(x, x); + //~^ ERROR cannot borrow `*x` as immutable because it is also borrowed as mutable +} + +pub fn main() {} diff --git a/src/test/compile-fail/coercion-slice.rs b/src/test/compile-fail/coercion-slice.rs index 8d48ede0e1..aac180f9ad 100644 --- a/src/test/compile-fail/coercion-slice.rs +++ b/src/test/compile-fail/coercion-slice.rs @@ -11,5 +11,10 @@ // Tests that we forbid coercion from `[T; n]` to `&[T]` fn main() { - let _: &[isize] = [0is]; //~ERROR: mismatched types: expected `&[isize]`, found `[isize; 1]` + let _: &[i32] = [0i32]; + //~^ ERROR mismatched types + //~| expected `&[i32]` + //~| found `[i32; 1]` + //~| expected &-ptr + //~| found array of 1 elements } diff --git a/src/test/compile-fail/coherence-all-remote.rs b/src/test/compile-fail/coherence-all-remote.rs index f8ddf83c9c..1e3b7f6dbd 100644 --- a/src/test/compile-fail/coherence-all-remote.rs +++ b/src/test/compile-fail/coherence-all-remote.rs @@ -14,6 +14,6 @@ extern crate "coherence-lib" as lib; use lib::Remote1; impl Remote1 for isize { } -//~^ ERROR E0117 +//~^ ERROR E0210 fn main() { } diff --git a/src/test/compile-fail/coherence-bigint-param.rs b/src/test/compile-fail/coherence-bigint-param.rs index b8e48436a4..b7ca499be7 100644 --- a/src/test/compile-fail/coherence-bigint-param.rs +++ b/src/test/compile-fail/coherence-bigint-param.rs @@ -16,6 +16,6 @@ use lib::Remote1; pub struct BigInt; impl Remote1 for T { } -//~^ ERROR type parameter `T` is not constrained +//~^ ERROR type parameter `T` must be used as the type parameter for some local type fn main() { } diff --git a/src/test/compile-fail/coherence-blanket-conflicts-with-blanket-implemented.rs b/src/test/compile-fail/coherence-blanket-conflicts-with-blanket-implemented.rs index 27d97d18c9..d4decb7134 100644 --- a/src/test/compile-fail/coherence-blanket-conflicts-with-blanket-implemented.rs +++ b/src/test/compile-fail/coherence-blanket-conflicts-with-blanket-implemented.rs @@ -10,6 +10,7 @@ use std::fmt::Show; use std::default::Default; +use std::marker::MarkerTrait; // Test that two blanket impls conflict (at least without negative // bounds). After all, some other crate could implement Even or Odd @@ -19,9 +20,9 @@ trait MyTrait { fn get(&self) -> usize; } -trait Even { } +trait Even : MarkerTrait { } -trait Odd { } +trait Odd : MarkerTrait { } impl Even for isize { } diff --git a/src/test/compile-fail/coherence-blanket-conflicts-with-blanket-unimplemented.rs b/src/test/compile-fail/coherence-blanket-conflicts-with-blanket-unimplemented.rs index 0f233b78c7..b1ee1762b6 100644 --- a/src/test/compile-fail/coherence-blanket-conflicts-with-blanket-unimplemented.rs +++ b/src/test/compile-fail/coherence-blanket-conflicts-with-blanket-unimplemented.rs @@ -19,9 +19,9 @@ trait MyTrait { fn get(&self) -> usize; } -trait Even { } +trait Even : ::std::marker::MarkerTrait { } -trait Odd { } +trait Odd : ::std::marker::MarkerTrait { } impl MyTrait for T { //~ ERROR E0119 fn get(&self) -> usize { 0 } diff --git a/src/test/compile-fail/coherence-conflicting-negative-trait-impl.rs b/src/test/compile-fail/coherence-conflicting-negative-trait-impl.rs new file mode 100644 index 0000000000..a225f6cf47 --- /dev/null +++ b/src/test/compile-fail/coherence-conflicting-negative-trait-impl.rs @@ -0,0 +1,29 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(optin_builtin_traits)] + +trait MyTrait : ::std::marker::MarkerTrait {} + +struct TestType(::std::marker::PhantomData); + +unsafe impl Send for TestType {} +//~^ ERROR conflicting implementations for trait `core::marker::Send` +//~^^ ERROR conflicting implementations for trait `core::marker::Send` + +impl !Send for TestType {} +//~^ ERROR conflicting implementations for trait `core::marker::Send` + +unsafe impl Send for TestType {} +//~^ ERROR error: conflicting implementations for trait `core::marker::Send` + +impl !Send for TestType {} + +fn main() {} diff --git a/src/test/compile-fail/coherence-cow-no-cover.rs b/src/test/compile-fail/coherence-cow-no-cover.rs new file mode 100644 index 0000000000..1bec97de53 --- /dev/null +++ b/src/test/compile-fail/coherence-cow-no-cover.rs @@ -0,0 +1,23 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:coherence-lib.rs + +// Test that it's not ok for U to appear uncovered + +extern crate "coherence-lib" as lib; +use lib::{Remote,Pair}; + +pub struct Cover(T); + +impl Remote for Pair,U> { } +//~^ ERROR type parameter `U` must be used as the type parameter for some local type + +fn main() { } diff --git a/src/test/compile-fail/coherence-cross-crate-conflict.rs b/src/test/compile-fail/coherence-cross-crate-conflict.rs index 8bdd5c58f3..a020b518d8 100644 --- a/src/test/compile-fail/coherence-cross-crate-conflict.rs +++ b/src/test/compile-fail/coherence-cross-crate-conflict.rs @@ -16,7 +16,7 @@ extern crate trait_impl_conflict; use trait_impl_conflict::Foo; impl Foo for A { - //~^ ERROR type parameter `A` is not constrained + //~^ ERROR type parameter `A` must be used as the type parameter for some local type //~^^ ERROR E0119 } diff --git a/src/test/compile-fail/coherence-impls-builtin.rs b/src/test/compile-fail/coherence-impls-builtin.rs new file mode 100644 index 0000000000..38730d241f --- /dev/null +++ b/src/test/compile-fail/coherence-impls-builtin.rs @@ -0,0 +1,42 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(optin_builtin_traits)] + +use std::marker::Send; + +enum TestE { + A +} + +struct MyType; + +struct NotSync; +impl !Sync for NotSync {} + +unsafe impl Send for TestE {} +unsafe impl Send for MyType {} +unsafe impl Send for (MyType, MyType) {} +//~^ ERROR builtin traits can only be implemented on structs or enums + +unsafe impl Send for &'static NotSync {} +//~^ ERROR builtin traits can only be implemented on structs or enums + +unsafe impl Send for [MyType] {} +//~^ ERROR builtin traits can only be implemented on structs or enums + +unsafe impl Send for &'static [NotSync] {} +//~^ ERROR builtin traits can only be implemented on structs or enums + +fn is_send() {} + +fn main() { + is_send::<(MyType, TestE)>(); +} diff --git a/src/test/compile-fail/coherence-lone-type-parameter.rs b/src/test/compile-fail/coherence-lone-type-parameter.rs index 917438722d..9f7481f12f 100644 --- a/src/test/compile-fail/coherence-lone-type-parameter.rs +++ b/src/test/compile-fail/coherence-lone-type-parameter.rs @@ -13,6 +13,7 @@ extern crate "coherence-lib" as lib; use lib::Remote; -impl Remote for T { } //~ ERROR type parameter `T` is not constrained +impl Remote for T { } +//~^ ERROR type parameter `T` must be used as the type parameter for some local type fn main() { } diff --git a/src/test/compile-fail/coherence-negative-impls-safe.rs b/src/test/compile-fail/coherence-negative-impls-safe.rs new file mode 100644 index 0000000000..3b335d586f --- /dev/null +++ b/src/test/compile-fail/coherence-negative-impls-safe.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(optin_builtin_traits)] + +use std::marker::Send; + +struct TestType; + +unsafe impl !Send for TestType {} +//~^ ERROR negative implementations are not unsafe + +fn main() {} diff --git a/src/test/compile-fail/coherence-orphan.rs b/src/test/compile-fail/coherence-orphan.rs index 0bd0224b24..d7cd68e73c 100644 --- a/src/test/compile-fail/coherence-orphan.rs +++ b/src/test/compile-fail/coherence-orphan.rs @@ -8,8 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-tidy-linelength // aux-build:coherence-orphan-lib.rs +#![feature(optin_builtin_traits)] + extern crate "coherence-orphan-lib" as lib; use lib::TheTrait; @@ -18,8 +21,11 @@ struct TheType; impl TheTrait for isize { } //~ ERROR E0117 -impl TheTrait for isize { } //~ ERROR E0117 +impl TheTrait for isize { } impl TheTrait for TheType { } +impl !Send for Vec { } //~ ERROR E0117 +//~^ ERROR conflicting + fn main() { } diff --git a/src/test/compile-fail/coherence-overlapping-pairs.rs b/src/test/compile-fail/coherence-overlapping-pairs.rs index 9354e66af0..9878bdec2c 100644 --- a/src/test/compile-fail/coherence-overlapping-pairs.rs +++ b/src/test/compile-fail/coherence-overlapping-pairs.rs @@ -16,6 +16,6 @@ use lib::Remote; struct Foo; impl Remote for lib::Pair { } -//~^ ERROR type parameter `T` is not constrained +//~^ ERROR type parameter `T` must be used as the type parameter for some local type fn main() { } diff --git a/src/test/compile-fail/coherence-pair-covered-uncovered-1.rs b/src/test/compile-fail/coherence-pair-covered-uncovered-1.rs new file mode 100644 index 0000000000..2bdcc346f7 --- /dev/null +++ b/src/test/compile-fail/coherence-pair-covered-uncovered-1.rs @@ -0,0 +1,24 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that the same coverage rules apply even if the local type appears in the +// list of type parameters, not the self type. + +// aux-build:coherence-lib.rs + +extern crate "coherence-lib" as lib; +use lib::{Remote1, Pair}; + +pub struct Local(T); + +impl Remote1>> for i32 { } +//~^ ERROR type parameter `T` must be used as the type parameter for some local type + +fn main() { } diff --git a/src/test/compile-fail/coherence-pair-covered-uncovered.rs b/src/test/compile-fail/coherence-pair-covered-uncovered.rs index 92a07b3585..881494f009 100644 --- a/src/test/compile-fail/coherence-pair-covered-uncovered.rs +++ b/src/test/compile-fail/coherence-pair-covered-uncovered.rs @@ -16,6 +16,6 @@ use lib::{Remote, Pair}; struct Local(T); impl Remote for Pair> { } -//~^ ERROR type parameter `T` is not constrained +//~^ ERROR type parameter `T` must be used as the type parameter for some local type fn main() { } diff --git a/src/test/compile-fail/coherence-subtyping.rs b/src/test/compile-fail/coherence-subtyping.rs new file mode 100644 index 0000000000..897cb083f8 --- /dev/null +++ b/src/test/compile-fail/coherence-subtyping.rs @@ -0,0 +1,50 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that two distinct impls which match subtypes of one another +// yield coherence errors (or not) depending on the variance. + +trait Contravariant { + fn foo(&self) { } +} + +impl Contravariant for for<'a,'b> fn(&'a u8, &'b u8) { + //~^ ERROR E0119 +} + +impl Contravariant for for<'a> fn(&'a u8, &'a u8) { +} + +/////////////////////////////////////////////////////////////////////////// + +trait Covariant { + fn foo(&self) { } +} + +impl Covariant for for<'a,'b> fn(&'a u8, &'b u8) { + //~^ ERROR E0119 +} + +impl Covariant for for<'a> fn(&'a u8, &'a u8) { +} + +/////////////////////////////////////////////////////////////////////////// + +trait Invariant { + fn foo(&self) -> Self { } +} + +impl Invariant for for<'a,'b> fn(&'a u8, &'b u8) { +} + +impl Invariant for for<'a> fn(&'a u8, &'a u8) { +} + +fn main() { } diff --git a/src/test/compile-fail/concat_idents-gate.rs b/src/test/compile-fail/concat_idents-gate.rs new file mode 100644 index 0000000000..f4d9744572 --- /dev/null +++ b/src/test/compile-fail/concat_idents-gate.rs @@ -0,0 +1,19 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +const XY_1: i32 = 10; + +fn main() { + const XY_2: i32 = 20; + let a = concat_idents!(X, Y_1); //~ ERROR `concat_idents` is not stable + let b = concat_idents!(X, Y_2); //~ ERROR `concat_idents` is not stable + assert_eq!(a, 10); + assert_eq!(b, 20); +} diff --git a/src/test/compile-fail/concat_idents-gate2.rs b/src/test/compile-fail/concat_idents-gate2.rs new file mode 100644 index 0000000000..d8f8f803ed --- /dev/null +++ b/src/test/compile-fail/concat_idents-gate2.rs @@ -0,0 +1,17 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +const XY_1: i32 = 10; + +fn main() { + const XY_2: i32 = 20; + assert_eq!(10, concat_idents!(X, Y_1)); //~ ERROR `concat_idents` is not stable + assert_eq!(20, concat_idents!(X, Y_2)); //~ ERROR `concat_idents` is not stable +} diff --git a/src/test/compile-fail/const-block-non-item-statement.rs b/src/test/compile-fail/const-block-non-item-statement.rs index 62e8fccbda..fa63b16afa 100644 --- a/src/test/compile-fail/const-block-non-item-statement.rs +++ b/src/test/compile-fail/const-block-non-item-statement.rs @@ -8,18 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -static A: usize = { 1us; 2 }; +const A: usize = { 1_usize; 2 }; //~^ ERROR: blocks in constants are limited to items and tail expressions -static B: usize = { { } 2 }; +const B: usize = { { } 2 }; //~^ ERROR: blocks in constants are limited to items and tail expressions macro_rules! foo { () => (()) //~ ERROR: blocks in constants are limited to items and tail expressions } -static C: usize = { foo!(); 2 }; +const C: usize = { foo!(); 2 }; -static D: usize = { let x = 4us; 2 }; +const D: usize = { let x = 4_usize; 2 }; //~^ ERROR: blocks in constants are limited to items and tail expressions pub fn main() { diff --git a/src/test/compile-fail/const-cast-different-types.rs b/src/test/compile-fail/const-cast-different-types.rs index 6b8e126db7..6e3732908a 100644 --- a/src/test/compile-fail/const-cast-different-types.rs +++ b/src/test/compile-fail/const-cast-different-types.rs @@ -10,9 +10,17 @@ static a: &'static str = "foo"; static b: *const u8 = a as *const u8; -//~^ ERROR mismatched types: expected `*const u8`, found `&'static str` +//~^ ERROR mismatched types +//~| expected *const u8 +//~| found &'static str +//~| expected u8 +//~| found str static c: *const u8 = &a as *const u8; -//~^ ERROR mismatched types: expected `*const u8`, found `&&'static str` +//~^ ERROR mismatched types +//~| expected *const u8 +//~| found &&'static str +//~| expected u8 +//~| found &-ptr fn main() { } diff --git a/src/test/compile-fail/copy-a-resource.rs b/src/test/compile-fail/copy-a-resource.rs index 1201db437b..98402591e7 100644 --- a/src/test/compile-fail/copy-a-resource.rs +++ b/src/test/compile-fail/copy-a-resource.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(Show)] +#[derive(Debug)] struct foo { i: isize, } diff --git a/src/test/compile-fail/cross-borrow-trait.rs b/src/test/compile-fail/cross-borrow-trait.rs index ff96ea9318..6bd21101a6 100644 --- a/src/test/compile-fail/cross-borrow-trait.rs +++ b/src/test/compile-fail/cross-borrow-trait.rs @@ -14,11 +14,15 @@ #![feature(box_syntax)] struct Foo; -trait Trait {} +trait Trait { fn foo(&self) {} } impl Trait for Foo {} pub fn main() { let x: Box = box Foo; - let _y: &Trait = x; //~ ERROR mismatched types: expected `&Trait`, found `Box` + let _y: &Trait = x; //~ ERROR mismatched types + //~| expected `&Trait` + //~| found `Box` + //~| expected &-ptr + //~| found box } diff --git a/src/test/run-make/dep-info-custom/lib.rs b/src/test/compile-fail/custom_attribute.rs similarity index 90% rename from src/test/run-make/dep-info-custom/lib.rs rename to src/test/compile-fail/custom_attribute.rs index 14baa8ca55..193063a98c 100644 --- a/src/test/run-make/dep-info-custom/lib.rs +++ b/src/test/compile-fail/custom_attribute.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![crate_name="foo"] +#[foo] //~ ERROR The attribute `foo` +fn main() { -pub mod foo; -pub mod bar; +} \ No newline at end of file diff --git a/src/test/compile-fail/dead-code-closure-bang.rs b/src/test/compile-fail/dead-code-closure-bang.rs index 46f5f41d72..280e2ed095 100644 --- a/src/test/compile-fail/dead-code-closure-bang.rs +++ b/src/test/compile-fail/dead-code-closure-bang.rs @@ -13,7 +13,7 @@ #![deny(unreachable_code)] fn main() { - let x = |:| panic!(); + let x = || panic!(); x(); std::io::println("Foo bar"); //~ ERROR: unreachable statement } diff --git a/src/test/compile-fail/derive-no-std-not-supported.rs b/src/test/compile-fail/derive-no-std-not-supported.rs new file mode 100644 index 0000000000..f82e7f3e36 --- /dev/null +++ b/src/test/compile-fail/derive-no-std-not-supported.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(no_std)] +#![no_std] + +extern crate core; +extern crate rand; +extern crate "serialize" as rustc_serialize; + +#[derive(Rand)] //~ ERROR this trait cannot be derived +//~^ WARNING `#[derive(Rand)]` is deprecated +struct Foo { + x: u32, +} + +#[derive(RustcEncodable)] //~ ERROR this trait cannot be derived +struct Bar { + x: u32, +} + +#[derive(RustcDecodable)] //~ ERROR this trait cannot be derived +struct Baz { + x: u32, +} + +fn main() { + Foo { x: 0 }; + Bar { x: 0 }; + Baz { x: 0 }; +} diff --git a/src/test/compile-fail/multi-plugin-attr.rs b/src/test/compile-fail/deriving-is-deprecated.rs similarity index 85% rename from src/test/compile-fail/multi-plugin-attr.rs rename to src/test/compile-fail/deriving-is-deprecated.rs index 1d98cd26a3..060e178eef 100644 --- a/src/test/compile-fail/multi-plugin-attr.rs +++ b/src/test/compile-fail/deriving-is-deprecated.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[plugin] -#[plugin] //~ ERROR #[plugin] specified multiple times -extern crate std; + +#[deriving(Clone)] //~ ERROR `deriving` has been renamed to `derive` +struct Foo; fn main() {} diff --git a/src/test/compile-fail/deriving-non-type.rs b/src/test/compile-fail/deriving-non-type.rs index 6015652668..966e28a789 100644 --- a/src/test/compile-fail/deriving-non-type.rs +++ b/src/test/compile-fail/deriving-non-type.rs @@ -22,10 +22,10 @@ impl S { } impl T for S { } #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums -static s: usize = 0us; +static s: usize = 0_usize; #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums -const c: usize = 0us; +const c: usize = 0_usize; #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums mod m { } diff --git a/src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs index aefc990c18..1d9099e8ed 100644 --- a/src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs +++ b/src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs @@ -15,7 +15,7 @@ extern crate rand; struct Error; -#[derive(Show)] +#[derive(Debug)] enum Enum { A { x: Error //~ ERROR diff --git a/src/test/compile-fail/deriving-span-Show-enum.rs b/src/test/compile-fail/deriving-span-Show-enum.rs index bdd2c21a1b..ab31ca95bd 100644 --- a/src/test/compile-fail/deriving-span-Show-enum.rs +++ b/src/test/compile-fail/deriving-span-Show-enum.rs @@ -15,7 +15,7 @@ extern crate rand; struct Error; -#[derive(Show)] +#[derive(Debug)] enum Enum { A( Error //~ ERROR diff --git a/src/test/compile-fail/deriving-span-Show-struct.rs b/src/test/compile-fail/deriving-span-Show-struct.rs index f76317e62b..eb8ac4649f 100644 --- a/src/test/compile-fail/deriving-span-Show-struct.rs +++ b/src/test/compile-fail/deriving-span-Show-struct.rs @@ -15,7 +15,7 @@ extern crate rand; struct Error; -#[derive(Show)] +#[derive(Debug)] struct Struct { x: Error //~ ERROR } diff --git a/src/test/compile-fail/deriving-span-Show-tuple-struct.rs b/src/test/compile-fail/deriving-span-Show-tuple-struct.rs index cb64a438e0..b93db4ab53 100644 --- a/src/test/compile-fail/deriving-span-Show-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-Show-tuple-struct.rs @@ -15,7 +15,7 @@ extern crate rand; struct Error; -#[derive(Show)] +#[derive(Debug)] struct Struct( Error //~ ERROR ); diff --git a/src/test/compile-fail/destructor-restrictions.rs b/src/test/compile-fail/destructor-restrictions.rs new file mode 100644 index 0000000000..0836cd1695 --- /dev/null +++ b/src/test/compile-fail/destructor-restrictions.rs @@ -0,0 +1,21 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Tests the new destructor semantics. + +use std::cell::RefCell; + +fn main() { + let b = { + let a = Box::new(RefCell::new(4i8)); + *a.borrow() + 1i8 //~ ERROR `*a` does not live long enough + }; + println!("{}", b); +} diff --git a/src/test/compile-fail/destructure-trait-ref.rs b/src/test/compile-fail/destructure-trait-ref.rs index 5166ef8f72..4161cce284 100644 --- a/src/test/compile-fail/destructure-trait-ref.rs +++ b/src/test/compile-fail/destructure-trait-ref.rs @@ -11,9 +11,10 @@ // The regression test for #15031 to make sure destructuring trait // reference work properly. +#![feature(box_patterns)] #![feature(box_syntax)] -trait T {} +trait T { fn foo(&self) {} } impl T for isize {} fn main() { @@ -27,17 +28,32 @@ fn main() { // if n > m, it's a type mismatch error. // n < m - let &x = &(&1is as &T); - let &x = &&(&1is as &T); - let &&x = &&(&1is as &T); + let &x = &(&1 as &T); + let &x = &&(&1 as &T); + let &&x = &&(&1 as &T); // n == m - let &x = &1is as &T; //~ ERROR type `&T` cannot be dereferenced - let &&x = &(&1is as &T); //~ ERROR type `&T` cannot be dereferenced - let box x = box 1is as Box; //~ ERROR type `Box` cannot be dereferenced + let &x = &1 as &T; //~ ERROR type `&T` cannot be dereferenced + let &&x = &(&1 as &T); //~ ERROR type `&T` cannot be dereferenced + let box x = box 1 as Box; //~ ERROR type `Box` cannot be dereferenced // n > m - let &&x = &1is as &T; //~ ERROR found &-ptr - let &&&x = &(&1is as &T); //~ ERROR found &-ptr - let box box x = box 1is as Box; //~ ERROR found box + let &&x = &1 as &T; + //~^ ERROR mismatched types + //~| expected `T` + //~| found `&_` + //~| expected trait T + //~| found &-ptr + let &&&x = &(&1 as &T); + //~^ ERROR mismatched types + //~| expected `T` + //~| found `&_` + //~| expected trait T + //~| found &-ptr + let box box x = box 1 as Box; + //~^ ERROR mismatched types + //~| expected `T` + //~| found `Box<_>` + //~| expected trait T + //~| found box } diff --git a/src/test/compile-fail/drop-with-active-borrows-1.rs b/src/test/compile-fail/drop-with-active-borrows-1.rs index 9d5020eaee..dc8deb0483 100644 --- a/src/test/compile-fail/drop-with-active-borrows-1.rs +++ b/src/test/compile-fail/drop-with-active-borrows-1.rs @@ -10,9 +10,9 @@ fn main() { let a = "".to_string(); - let b: Vec<&str> = a.as_slice().lines().collect(); + let b: Vec<&str> = a.lines().collect(); drop(a); //~ ERROR cannot move out of `a` because it is borrowed - for s in b.iter() { + for s in &b { println!("{}", *s); } } diff --git a/src/test/compile-fail/drop-with-active-borrows-2.rs b/src/test/compile-fail/drop-with-active-borrows-2.rs index d9d3d79b5a..e6e1364dd2 100644 --- a/src/test/compile-fail/drop-with-active-borrows-2.rs +++ b/src/test/compile-fail/drop-with-active-borrows-2.rs @@ -10,7 +10,7 @@ fn read_lines_borrowed<'a>() -> Vec<&'a str> { let raw_lines: Vec = vec!("foo ".to_string(), " bar".to_string()); - raw_lines.iter().map(|l| l.as_slice().trim()).collect() + raw_lines.iter().map(|l| l.trim()).collect() //~^ ERROR `raw_lines` does not live long enough } diff --git a/src/test/compile-fail/dropck_arr_cycle_checked.rs b/src/test/compile-fail/dropck_arr_cycle_checked.rs new file mode 100644 index 0000000000..3aa2fae282 --- /dev/null +++ b/src/test/compile-fail/dropck_arr_cycle_checked.rs @@ -0,0 +1,115 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Reject mixing cyclic structure and Drop when using fixed length +// arrays. +// +// (Compare against compile-fail/dropck_vec_cycle_checked.rs) + +#![feature(unsafe_destructor)] + +use std::cell::Cell; +use id::Id; + +mod s { + #![allow(unstable)] + use std::sync::atomic::{AtomicUint, ATOMIC_UINT_INIT, Ordering}; + + static S_COUNT: AtomicUint = ATOMIC_UINT_INIT; + + pub fn next_count() -> usize { + S_COUNT.fetch_add(1, Ordering::SeqCst) + 1 + } +} + +mod id { + use s; + #[derive(Debug)] + pub struct Id { + orig_count: usize, + count: usize, + } + + impl Id { + pub fn new() -> Id { + let c = s::next_count(); + println!("building Id {}", c); + Id { orig_count: c, count: c } + } + pub fn count(&self) -> usize { + println!("Id::count on {} returns {}", self.orig_count, self.count); + self.count + } + } + + impl Drop for Id { + fn drop(&mut self) { + println!("dropping Id {}", self.count); + self.count = 0; + } + } +} + +trait HasId { + fn count(&self) -> usize; +} + +#[derive(Debug)] +struct CheckId { + v: T +} + +#[allow(non_snake_case)] +fn CheckId(t: T) -> CheckId { CheckId{ v: t } } + +#[unsafe_destructor] +impl Drop for CheckId { + fn drop(&mut self) { + assert!(self.v.count() > 0); + } +} + +#[derive(Debug)] +struct B<'a> { + id: Id, + a: [CheckId>>>; 2] +} + +impl<'a> HasId for Cell>> { + fn count(&self) -> usize { + match self.get() { + None => 1, + Some(b) => b.id.count(), + } + } +} + +impl<'a> B<'a> { + fn new() -> B<'a> { + B { id: Id::new(), a: [CheckId(Cell::new(None)), CheckId(Cell::new(None))] } + } +} + +fn f() { + let (b1, b2, b3); + b1 = B::new(); + b2 = B::new(); + b3 = B::new(); + b1.a[0].v.set(Some(&b2)); //~ ERROR `b2` does not live long enough + b1.a[1].v.set(Some(&b3)); //~ ERROR `b3` does not live long enough + b2.a[0].v.set(Some(&b2)); //~ ERROR `b2` does not live long enough + b2.a[1].v.set(Some(&b3)); //~ ERROR `b3` does not live long enough + b3.a[0].v.set(Some(&b1)); //~ ERROR `b1` does not live long enough + b3.a[1].v.set(Some(&b2)); //~ ERROR `b2` does not live long enough +} + +fn main() { + f(); +} diff --git a/src/test/compile-fail/dropck_direct_cycle_with_drop.rs b/src/test/compile-fail/dropck_direct_cycle_with_drop.rs new file mode 100644 index 0000000000..b9df71322a --- /dev/null +++ b/src/test/compile-fail/dropck_direct_cycle_with_drop.rs @@ -0,0 +1,55 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// A simple example of an unsound mixing of cyclic structure and Drop. +// +// Each `D` has a name and an optional reference to another `D` +// sibling, but also implements a drop method that prints out its own +// name as well as the name of its sibling. +// +// By setting up a cyclic structure, the drop code cannot possibly +// work. Therefore this code must be rejected. +// +// (As it turns out, essentially any attempt to install a sibling here +// will be rejected, regardless of whether it forms a cyclic +// structure or not. This is because the use of the same lifetime +// `'a` in `&'a D<'a>` cannot be satisfied when `D<'a>` implements +// `Drop`.) + +#![feature(unsafe_destructor)] + +use std::cell::Cell; + +struct D<'a> { + name: String, + p: Cell>>, +} + +impl<'a> D<'a> { + fn new(name: String) -> D<'a> { D { name: name, p: Cell::new(None) } } +} + +#[unsafe_destructor] +impl<'a> Drop for D<'a> { + fn drop(&mut self) { + println!("dropping {} whose sibling is {:?}", + self.name, self.p.get().map(|d| &d.name)); + } +} + +fn g() { + let (d1, d2) = (D::new(format!("d1")), D::new(format!("d2"))); + d1.p.set(Some(&d2)); //~ ERROR `d2` does not live long enough + d2.p.set(Some(&d1)); //~ ERROR `d1` does not live long enough +} + +fn main() { + g(); +} diff --git a/src/test/compile-fail/dropck_tarena_cycle_checked.rs b/src/test/compile-fail/dropck_tarena_cycle_checked.rs new file mode 100644 index 0000000000..74e3c724b6 --- /dev/null +++ b/src/test/compile-fail/dropck_tarena_cycle_checked.rs @@ -0,0 +1,130 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Reject mixing cyclic structure and Drop when using TypedArena. +// +// (Compare against compile-fail/dropck_vec_cycle_checked.rs) +// +// (Also compare against compile-fail/dropck_tarena_unsound_drop.rs, +// which is a reduction of this code to more directly show the reason +// for the error message we see here.) + +#![allow(unstable)] +#![feature(unsafe_destructor)] + +extern crate arena; + +use arena::TypedArena; +use std::cell::Cell; +use id::Id; + +mod s { + #![allow(unstable)] + use std::sync::atomic::{AtomicUint, ATOMIC_UINT_INIT, Ordering}; + + static S_COUNT: AtomicUint = ATOMIC_UINT_INIT; + + pub fn next_count() -> usize { + S_COUNT.fetch_add(1, Ordering::SeqCst) + 1 + } +} + +mod id { + use s; + #[derive(Debug)] + pub struct Id { + orig_count: usize, + count: usize, + } + + impl Id { + pub fn new() -> Id { + let c = s::next_count(); + println!("building Id {}", c); + Id { orig_count: c, count: c } + } + pub fn count(&self) -> usize { + println!("Id::count on {} returns {}", self.orig_count, self.count); + self.count + } + } + + impl Drop for Id { + fn drop(&mut self) { + println!("dropping Id {}", self.count); + self.count = 0; + } + } +} + +trait HasId { + fn count(&self) -> usize; +} + +#[derive(Debug)] +struct CheckId { + v: T +} + +#[allow(non_snake_case)] +fn CheckId(t: T) -> CheckId { CheckId{ v: t } } + +#[unsafe_destructor] +impl Drop for CheckId { + fn drop(&mut self) { + assert!(self.v.count() > 0); + } +} + +#[derive(Debug)] +struct C<'a> { + id: Id, + v: Vec>>>>, +} + +impl<'a> HasId for Cell>> { + fn count(&self) -> usize { + match self.get() { + None => 1, + Some(c) => c.id.count(), + } + } +} + +impl<'a> C<'a> { + fn new() -> C<'a> { + C { id: Id::new(), v: Vec::new() } + } +} + +fn f<'a>(arena: &'a TypedArena>) { + let c1 = arena.alloc(C::new()); + let c2 = arena.alloc(C::new()); + let c3 = arena.alloc(C::new()); + + c1.v.push(CheckId(Cell::new(None))); + c1.v.push(CheckId(Cell::new(None))); + c2.v.push(CheckId(Cell::new(None))); + c2.v.push(CheckId(Cell::new(None))); + c3.v.push(CheckId(Cell::new(None))); + c3.v.push(CheckId(Cell::new(None))); + + c1.v[0].v.set(Some(c2)); + c1.v[1].v.set(Some(c3)); + c2.v[0].v.set(Some(c2)); + c2.v[1].v.set(Some(c3)); + c3.v[0].v.set(Some(c1)); + c3.v[1].v.set(Some(c2)); +} + +fn main() { + let arena = TypedArena::new(); + f(&arena); //~ ERROR `arena` does not live long enough +} diff --git a/src/test/compile-fail/dropck_tarena_unsound_drop.rs b/src/test/compile-fail/dropck_tarena_unsound_drop.rs new file mode 100644 index 0000000000..64d77e97fa --- /dev/null +++ b/src/test/compile-fail/dropck_tarena_unsound_drop.rs @@ -0,0 +1,54 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Check that a arena (TypedArena) cannot carry elements whose drop +// methods might access borrowed data of lifetime that does not +// strictly outlive the arena itself. +// +// Compare against run-pass/dropck_tarena_sound_drop.rs, which shows a +// similar setup, but loosens `f` so that the struct `C<'a>` can be +// fed a lifetime longer than that of the arena. +// +// (Also compare against dropck_tarena_cycle_checked.rs, from which +// this was reduced to better understand its error message.) + +#![allow(unstable)] +#![feature(unsafe_destructor)] + +extern crate arena; + +use arena::TypedArena; + +trait HasId { fn count(&self) -> usize; } + +struct CheckId { v: T } + +// In the code below, the impl of HasId for `&'a usize` does not +// actually access the borrowed data, but the point is that the +// interface to CheckId does not (and cannot) know that, and therefore +// when encountering the a value V of type CheckId, we must +// conservatively force the type S to strictly outlive V. +#[unsafe_destructor] +impl Drop for CheckId { + fn drop(&mut self) { + assert!(self.v.count() > 0); + } +} + +struct C<'a> { v: CheckId<&'a usize>, } + +impl<'a> HasId for &'a usize { fn count(&self) -> usize { 1 } } + +fn f<'a>(_arena: &'a TypedArena>) {} + +fn main() { + let arena: TypedArena = TypedArena::new(); + f(&arena); //~ ERROR `arena` does not live long enough +} diff --git a/src/test/compile-fail/dropck_vec_cycle_checked.rs b/src/test/compile-fail/dropck_vec_cycle_checked.rs new file mode 100644 index 0000000000..3f69c7d1a9 --- /dev/null +++ b/src/test/compile-fail/dropck_vec_cycle_checked.rs @@ -0,0 +1,122 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Reject mixing cyclic structure and Drop when using Vec. +// +// (Compare against compile-fail/dropck_arr_cycle_checked.rs) + +#![feature(unsafe_destructor)] + +use std::cell::Cell; +use id::Id; + +mod s { + #![allow(unstable)] + use std::sync::atomic::{AtomicUint, ATOMIC_UINT_INIT, Ordering}; + + static S_COUNT: AtomicUint = ATOMIC_UINT_INIT; + + pub fn next_count() -> usize { + S_COUNT.fetch_add(1, Ordering::SeqCst) + 1 + } +} + +mod id { + use s; + #[derive(Debug)] + pub struct Id { + orig_count: usize, + count: usize, + } + + impl Id { + pub fn new() -> Id { + let c = s::next_count(); + println!("building Id {}", c); + Id { orig_count: c, count: c } + } + pub fn count(&self) -> usize { + println!("Id::count on {} returns {}", self.orig_count, self.count); + self.count + } + } + + impl Drop for Id { + fn drop(&mut self) { + println!("dropping Id {}", self.count); + self.count = 0; + } + } +} + +trait HasId { + fn count(&self) -> usize; +} + +#[derive(Debug)] +struct CheckId { + v: T +} + +#[allow(non_snake_case)] +fn CheckId(t: T) -> CheckId { CheckId{ v: t } } + +#[unsafe_destructor] +impl Drop for CheckId { + fn drop(&mut self) { + assert!(self.v.count() > 0); + } +} + +#[derive(Debug)] +struct C<'a> { + id: Id, + v: Vec>>>>, +} + +impl<'a> HasId for Cell>> { + fn count(&self) -> usize { + match self.get() { + None => 1, + Some(c) => c.id.count(), + } + } +} + +impl<'a> C<'a> { + fn new() -> C<'a> { + C { id: Id::new(), v: Vec::new() } + } +} + +fn f() { + let (mut c1, mut c2, mut c3); + c1 = C::new(); + c2 = C::new(); + c3 = C::new(); + + c1.v.push(CheckId(Cell::new(None))); + c1.v.push(CheckId(Cell::new(None))); + c2.v.push(CheckId(Cell::new(None))); + c2.v.push(CheckId(Cell::new(None))); + c3.v.push(CheckId(Cell::new(None))); + c3.v.push(CheckId(Cell::new(None))); + + c1.v[0].v.set(Some(&c2)); //~ ERROR `c2` does not live long enough + c1.v[1].v.set(Some(&c3)); //~ ERROR `c3` does not live long enough + c2.v[0].v.set(Some(&c2)); //~ ERROR `c2` does not live long enough + c2.v[1].v.set(Some(&c3)); //~ ERROR `c3` does not live long enough + c3.v[0].v.set(Some(&c1)); //~ ERROR `c1` does not live long enough + c3.v[1].v.set(Some(&c2)); //~ ERROR `c2` does not live long enough +} + +fn main() { + f(); +} diff --git a/src/test/compile-fail/dst-bad-assign.rs b/src/test/compile-fail/dst-bad-assign.rs index 634b5999e9..152864b601 100644 --- a/src/test/compile-fail/dst-bad-assign.rs +++ b/src/test/compile-fail/dst-bad-assign.rs @@ -44,6 +44,11 @@ pub fn main() { // Assignment. let f5: &mut Fat = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; let z: Box = box Bar1 {f: 36}; - f5.ptr = Bar1 {f: 36}; //~ ERROR mismatched types: expected `ToBar`, found `Bar1` - //~^ ERROR the trait `core::marker::Sized` is not implemented for the type `ToBar` + f5.ptr = Bar1 {f: 36}; + //~^ ERROR mismatched types + //~| expected `ToBar` + //~| found `Bar1` + //~| expected trait ToBar + //~| found struct `Bar1` + //~| ERROR the trait `core::marker::Sized` is not implemented for the type `ToBar` } diff --git a/src/test/compile-fail/dst-bad-coerce1.rs b/src/test/compile-fail/dst-bad-coerce1.rs index e70db87a39..ddc9290177 100644 --- a/src/test/compile-fail/dst-bad-coerce1.rs +++ b/src/test/compile-fail/dst-bad-coerce1.rs @@ -15,14 +15,18 @@ struct Fat { } struct Foo; -trait Bar {} +trait Bar { fn bar(&self) {} } pub fn main() { // With a vec of isize. let f1 = Fat { ptr: [1, 2, 3] }; let f2: &Fat<[isize; 3]> = &f1; let f3: &Fat<[usize]> = f2; - //~^ ERROR mismatched types: expected `&Fat<[usize]>`, found `&Fat<[isize; 3]>` + //~^ ERROR mismatched types + //~| expected `&Fat<[usize]>` + //~| found `&Fat<[isize; 3]>` + //~| expected usize + //~| found isize // With a trait. let f1 = Fat { ptr: Foo }; diff --git a/src/test/compile-fail/dst-bad-coerce2.rs b/src/test/compile-fail/dst-bad-coerce2.rs index 160197368d..aa687266ac 100644 --- a/src/test/compile-fail/dst-bad-coerce2.rs +++ b/src/test/compile-fail/dst-bad-coerce2.rs @@ -15,7 +15,7 @@ struct Fat { } struct Foo; -trait Bar {} +trait Bar : ::std::marker::MarkerTrait {} impl Bar for Foo {} pub fn main() { diff --git a/src/test/compile-fail/dst-bad-coerce3.rs b/src/test/compile-fail/dst-bad-coerce3.rs index 347a2d2ecb..7bad3bd69d 100644 --- a/src/test/compile-fail/dst-bad-coerce3.rs +++ b/src/test/compile-fail/dst-bad-coerce3.rs @@ -15,7 +15,7 @@ struct Fat { } struct Foo; -trait Bar {} +trait Bar { fn bar(&self) {} } impl Bar for Foo {} fn baz<'a>() { diff --git a/src/test/compile-fail/dst-bad-coerce4.rs b/src/test/compile-fail/dst-bad-coerce4.rs index 8e81eacae9..c1443bdbb3 100644 --- a/src/test/compile-fail/dst-bad-coerce4.rs +++ b/src/test/compile-fail/dst-bad-coerce4.rs @@ -18,5 +18,9 @@ pub fn main() { // With a vec of isizes. let f1: &Fat<[isize]> = &Fat { ptr: [1, 2, 3] }; let f2: &Fat<[isize; 3]> = f1; - //~^ ERROR mismatched types: expected `&Fat<[isize; 3]>`, found `&Fat<[isize]>` + //~^ ERROR mismatched types + //~| expected `&Fat<[isize; 3]>` + //~| found `&Fat<[isize]>` + //~| expected array of 3 elements + //~| found slice } diff --git a/src/test/compile-fail/dst-bad-coercions.rs b/src/test/compile-fail/dst-bad-coercions.rs index b30eada162..8ec1034bc4 100644 --- a/src/test/compile-fail/dst-bad-coercions.rs +++ b/src/test/compile-fail/dst-bad-coercions.rs @@ -10,8 +10,10 @@ // Test implicit coercions involving DSTs and raw pointers. +use std::marker::MarkerTrait; + struct S; -trait T {} +trait T : MarkerTrait {} impl T for S {} struct Foo { diff --git a/src/test/compile-fail/dst-bad-deep.rs b/src/test/compile-fail/dst-bad-deep.rs index 032835d946..f90baafef3 100644 --- a/src/test/compile-fail/dst-bad-deep.rs +++ b/src/test/compile-fail/dst-bad-deep.rs @@ -18,7 +18,7 @@ struct Fat { } pub fn main() { - let f: Fat<[isize; 3]> = Fat { ptr: [5is, 6, 7] }; + let f: Fat<[isize; 3]> = Fat { ptr: [5, 6, 7] }; let g: &Fat<[isize]> = &f; let h: &Fat> = &Fat { ptr: *g }; //~^ ERROR the trait `core::marker::Sized` is not implemented diff --git a/src/test/compile-fail/dst-index.rs b/src/test/compile-fail/dst-index.rs index 2a66b87fec..91f3432048 100644 --- a/src/test/compile-fail/dst-index.rs +++ b/src/test/compile-fail/dst-index.rs @@ -12,12 +12,11 @@ // can't be used as rvalues use std::ops::Index; -use std::fmt::Show; +use std::fmt::Debug; +#[derive(Copy)] struct S; -impl Copy for S {} - impl Index for S { type Output = str; @@ -26,14 +25,13 @@ impl Index for S { } } +#[derive(Copy)] struct T; -impl Copy for T {} - impl Index for T { - type Output = Show + 'static; + type Output = Debug + 'static; - fn index<'a>(&'a self, idx: &usize) -> &'a (Show + 'static) { + fn index<'a>(&'a self, idx: &usize) -> &'a (Debug + 'static) { static x: usize = 42; &x } diff --git a/src/test/compile-fail/dst-object-from-unsized-type.rs b/src/test/compile-fail/dst-object-from-unsized-type.rs index 87ff4291f5..b4fd45845f 100644 --- a/src/test/compile-fail/dst-object-from-unsized-type.rs +++ b/src/test/compile-fail/dst-object-from-unsized-type.rs @@ -10,7 +10,7 @@ // Test that we cannot create objects from unsized types. -trait Foo {} +trait Foo { fn foo(&self) {} } impl Foo for str {} fn test1(t: &T) { diff --git a/src/test/compile-fail/enable-unstable-lib-feature.rs b/src/test/compile-fail/enable-unstable-lib-feature.rs new file mode 100644 index 0000000000..c65b2366bf --- /dev/null +++ b/src/test/compile-fail/enable-unstable-lib-feature.rs @@ -0,0 +1,23 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that enabling an unstable feature disables warnings + +// aux-build:stability_cfg2.rs + +#![feature(test_feature)] +#![deny(non_snake_case)] // To trigger a hard error + +// Shouldn't generate a warning about unstable features +extern crate stability_cfg2; + +pub fn BOGUS() { } //~ ERROR + +pub fn main() { } diff --git a/src/test/compile-fail/estr-subtyping.rs b/src/test/compile-fail/estr-subtyping.rs index 5335fa1206..6e64e01d74 100644 --- a/src/test/compile-fail/estr-subtyping.rs +++ b/src/test/compile-fail/estr-subtyping.rs @@ -13,12 +13,12 @@ fn wants_slice(x: &str) { } fn has_uniq(x: String) { wants_uniq(x); - wants_slice(x.as_slice()); + wants_slice(&*x); } fn has_slice(x: &str) { wants_uniq(x); //~ ERROR mismatched types - wants_slice(x); + wants_slice(x.as_slice()); } fn main() { diff --git a/src/test/compile-fail/exclusive-drop-and-copy.rs b/src/test/compile-fail/exclusive-drop-and-copy.rs index 17453bc677..f47f14d587 100644 --- a/src/test/compile-fail/exclusive-drop-and-copy.rs +++ b/src/test/compile-fail/exclusive-drop-and-copy.rs @@ -20,7 +20,7 @@ impl Drop for Foo { } #[derive(Copy)] //~ ERROR the trait `Copy` may not be implemented -struct Bar; +struct Bar(::std::marker::PhantomData); #[unsafe_destructor] impl Drop for Bar { diff --git a/src/test/compile-fail/explicit-self-lifetime-mismatch.rs b/src/test/compile-fail/explicit-self-lifetime-mismatch.rs index fbc5263d82..92542ab3bc 100644 --- a/src/test/compile-fail/explicit-self-lifetime-mismatch.rs +++ b/src/test/compile-fail/explicit-self-lifetime-mismatch.rs @@ -15,8 +15,14 @@ struct Foo<'a,'b> { impl<'a,'b> Foo<'a,'b> { fn bar(self: Foo<'b,'a>) {} - //~^ ERROR mismatched types: expected `Foo<'a, 'b>`, found `Foo<'b, 'a>` - //~^^ ERROR mismatched types: expected `Foo<'a, 'b>`, found `Foo<'b, 'a>` + //~^ ERROR mismatched types + //~| expected `Foo<'a, 'b>` + //~| found `Foo<'b, 'a>` + //~| lifetime mismatch + //~| ERROR mismatched types + //~| expected `Foo<'a, 'b>` + //~| found `Foo<'b, 'a>` + //~| lifetime mismatch } fn main() {} diff --git a/src/test/compile-fail/extern-with-type-bounds.rs b/src/test/compile-fail/extern-with-type-bounds.rs index d2c88865d5..ade8b397e0 100644 --- a/src/test/compile-fail/extern-with-type-bounds.rs +++ b/src/test/compile-fail/extern-with-type-bounds.rs @@ -10,11 +10,9 @@ #![feature(intrinsics)] -use std::intrinsics::TypeId; - extern "rust-intrinsic" { // Real example from libcore - fn type_id() -> TypeId; + fn type_id() -> u64; // Silent bounds made explicit to make sure they are actually // resolved. diff --git a/src/test/compile-fail/extern-wrong-value-type.rs b/src/test/compile-fail/extern-wrong-value-type.rs index d7586af291..db3373ea02 100644 --- a/src/test/compile-fail/extern-wrong-value-type.rs +++ b/src/test/compile-fail/extern-wrong-value-type.rs @@ -16,5 +16,7 @@ fn is_fn(_: F) where F: Fn() {} fn main() { // extern functions are extern "C" fn let _x: extern "C" fn() = f; // OK - is_fn(f); //~ ERROR the trait `core::ops::Fn()` is not implemented for the type `extern "C" fn() + is_fn(f); + //~^ ERROR the trait `core::ops::Fn<()>` is not implemented for the type `extern "C" fn() + //~| ERROR the trait `core::ops::Fn<()>` is not implemented for the type `extern "C" fn() } diff --git a/src/test/compile-fail/fail-no-dead-code-core.rs b/src/test/compile-fail/fail-no-dead-code-core.rs index 6f75181c31..9923db3c56 100644 --- a/src/test/compile-fail/fail-no-dead-code-core.rs +++ b/src/test/compile-fail/fail-no-dead-code-core.rs @@ -10,6 +10,7 @@ #![deny(dead_code)] #![allow(unreachable_code)] +#![feature(core)] #[macro_use] extern crate core; diff --git a/src/test/compile-fail/feature-gate-advanced-slice-features.rs b/src/test/compile-fail/feature-gate-advanced-slice-features.rs index a37a8a326a..d5841e1e77 100644 --- a/src/test/compile-fail/feature-gate-advanced-slice-features.rs +++ b/src/test/compile-fail/feature-gate-advanced-slice-features.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - let x = [ 1is, 2, 3, 4, 5 ]; + let x = [ 1, 2, 3, 4, 5 ]; match x { [ xs.., 4, 5 ] => {} //~ ERROR multiple-element slice matches [ 1, xs.., 5 ] => {} //~ ERROR multiple-element slice matches diff --git a/src/test/compile-fail/feature-gate-box-expr.rs b/src/test/compile-fail/feature-gate-box-expr.rs index bc7a70471c..39f54be456 100644 --- a/src/test/compile-fail/feature-gate-box-expr.rs +++ b/src/test/compile-fail/feature-gate-box-expr.rs @@ -11,13 +11,13 @@ fn main() { use std::boxed::HEAP; - let x = box 'c'; //~ ERROR box expression syntax is experimental in alpha release + let x = box 'c'; //~ ERROR box expression syntax is experimental println!("x: {}", x); - let x = box () 'c'; //~ ERROR box expression syntax is experimental in alpha release + let x = box () 'c'; //~ ERROR box expression syntax is experimental println!("x: {}", x); - let x = box (HEAP) 'c'; //~ ERROR box expression syntax is experimental in alpha release + let x = box (HEAP) 'c'; //~ ERROR box expression syntax is experimental println!("x: {}", x); } diff --git a/src/test/compile-fail/feature-gate-box-pat.rs b/src/test/compile-fail/feature-gate-box-pat.rs index b36bc22b9d..e64081823e 100644 --- a/src/test/compile-fail/feature-gate-box-pat.rs +++ b/src/test/compile-fail/feature-gate-box-pat.rs @@ -9,6 +9,6 @@ // except according to those terms. fn main() { - let box x = Box::new('c'); //~ ERROR box pattern syntax is experimental in alpha release + let box x = Box::new('c'); //~ ERROR box pattern syntax is experimental println!("x: {}", x); } diff --git a/src/test/compile-fail/feature-gate-int-uint.rs b/src/test/compile-fail/feature-gate-int-uint.rs index 016a039428..948e485ccf 100644 --- a/src/test/compile-fail/feature-gate-int-uint.rs +++ b/src/test/compile-fail/feature-gate-int-uint.rs @@ -8,7 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(dead_code)] +#![allow(dead_code, unused_variables)] +#![feature(rustc_attrs)] mod u { type X = uint; //~ WARN the `uint` type is deprecated @@ -16,7 +17,8 @@ mod u { x: uint //~ WARN the `uint` type is deprecated } fn bar(x: uint) { //~ WARN the `uint` type is deprecated - 1u; //~ WARN the `u` suffix on integers 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 { @@ -25,11 +27,11 @@ mod i { x: int //~ WARN the `int` type is deprecated } fn bar(x: int) { //~ WARN the `int` type is deprecated - 1i; //~ WARN the `i` suffix on integers 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 } } -fn main() { - // make compilation fail, after feature gating - let () = 1u8; //~ ERROR +#[rustc_error] +fn main() { //~ ERROR compilation successful } diff --git a/src/test/compile-fail/feature-gate-main.rs b/src/test/compile-fail/feature-gate-main.rs new file mode 100644 index 0000000000..db1c1a9441 --- /dev/null +++ b/src/test/compile-fail/feature-gate-main.rs @@ -0,0 +1,12 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[main] +fn foo() {} //~ ERROR: declaration of a nonstandard #[main] function may change over time diff --git a/src/test/compile-fail/feature-gate-simd-ffi.rs b/src/test/compile-fail/feature-gate-simd-ffi.rs new file mode 100644 index 0000000000..9ee3fcee02 --- /dev/null +++ b/src/test/compile-fail/feature-gate-simd-ffi.rs @@ -0,0 +1,26 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(simd, core)] +#![allow(dead_code)] + +use std::simd::f32x4; + +#[simd] #[derive(Copy)] #[repr(C)] struct LocalSimd(u8, u8); + +extern { + fn foo() -> f32x4; //~ ERROR use of SIMD type + fn bar(x: f32x4); //~ ERROR use of SIMD type + + fn baz() -> LocalSimd; //~ ERROR use of SIMD type + fn qux(x: LocalSimd); //~ ERROR use of SIMD type +} + +fn main() {} diff --git a/src/test/compile-fail/feature-gate-start.rs b/src/test/compile-fail/feature-gate-start.rs new file mode 100644 index 0000000000..6a9acf0429 --- /dev/null +++ b/src/test/compile-fail/feature-gate-start.rs @@ -0,0 +1,13 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[start] +fn foo() {} //~ ERROR: a #[start] function is an experimental feature + diff --git a/src/test/compile-fail/feature-gate-unboxed-closures-manual-impls.rs b/src/test/compile-fail/feature-gate-unboxed-closures-manual-impls.rs index 8999da5b17..e5e5ddadaf 100644 --- a/src/test/compile-fail/feature-gate-unboxed-closures-manual-impls.rs +++ b/src/test/compile-fail/feature-gate-unboxed-closures-manual-impls.rs @@ -8,18 +8,38 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// Test that manual impls of the `Fn` traits are not possible without +// a feature gate. In fact, the specialized check for these cases +// never triggers (yet), because they encounter other problems around +// angle bracket vs parentheses notation. + #![allow(dead_code)] struct Foo; -impl Fn<(), ()> for Foo { //~ ERROR manual implementations of `Fn` are experimental +impl Fn<()> for Foo { + //~^ ERROR angle-bracket notation is not stable when used with the `Fn` family of traits + type Output = (); + + extern "rust-call" fn call(&self, args: ()) -> () {} +} +struct Foo1; +impl Fn() for Foo1 { + //~^ ERROR associated type bindings are not allowed here + extern "rust-call" fn call(&self, args: ()) -> () {} } struct Bar; -impl FnMut<(), ()> for Bar { //~ ERROR manual implementations of `FnMut` are experimental +impl FnMut<()> for Bar { + //~^ ERROR angle-bracket notation is not stable when used with the `Fn` family of traits + type Output = (); + extern "rust-call" fn call_mut(&self, args: ()) -> () {} } struct Baz; -impl FnOnce<(), ()> for Baz { //~ ERROR manual implementations of `FnOnce` are experimental +impl FnOnce<()> for Baz { + //~^ ERROR angle-bracket notation is not stable when used with the `Fn` family of traits + type Output = (); + extern "rust-call" fn call_once(&self, args: ()) -> () {} } diff --git a/src/test/compile-fail/feature-gate-unboxed-closures-method-calls.rs b/src/test/compile-fail/feature-gate-unboxed-closures-method-calls.rs index 5a066c441c..eea1f61d63 100644 --- a/src/test/compile-fail/feature-gate-unboxed-closures-method-calls.rs +++ b/src/test/compile-fail/feature-gate-unboxed-closures-method-calls.rs @@ -10,7 +10,7 @@ #![allow(dead_code)] -fn foo>(mut f: F) { +fn foo(mut f: F) { f.call(()); //~ ERROR explicit use of unboxed closure method `call` f.call_mut(()); //~ ERROR explicit use of unboxed closure method `call_mut` f.call_once(()); //~ ERROR explicit use of unboxed closure method `call_once` diff --git a/src/test/compile-fail/feature-gate-unboxed-closures-ufcs-calls.rs b/src/test/compile-fail/feature-gate-unboxed-closures-ufcs-calls.rs index 8efaf00c9c..f15c5c4da2 100644 --- a/src/test/compile-fail/feature-gate-unboxed-closures-ufcs-calls.rs +++ b/src/test/compile-fail/feature-gate-unboxed-closures-ufcs-calls.rs @@ -10,7 +10,7 @@ #![allow(dead_code)] -fn foo>(mut f: F, mut g: F) { +fn foo(mut f: F, mut g: F) { Fn::call(&g, ()); //~ ERROR explicit use of unboxed closure method `call` FnMut::call_mut(&mut g, ()); //~ ERROR explicit use of unboxed closure method `call_mut` FnOnce::call_once(g, ()); //~ ERROR explicit use of unboxed closure method `call_once` diff --git a/src/test/compile-fail/fn-item-type.rs b/src/test/compile-fail/fn-item-type.rs index b2394a2989..5015810ff4 100644 --- a/src/test/compile-fail/fn-item-type.rs +++ b/src/test/compile-fail/fn-item-type.rs @@ -18,8 +18,16 @@ fn eq(x: T, y: T) { } fn main() { let f = if true { foo } else { bar }; - //~^ ERROR expected fn item, found a different fn item + //~^ ERROR if and else have incompatible types + //~| expected `fn(isize) -> isize {foo}` + //~| found `fn(isize) -> isize {bar}` + //~| expected fn item, + //~| found a different fn item eq(foo, bar); - //~^ ERROR expected fn item, found a different fn item + //~^ ERROR mismatched types + //~| expected `fn(isize) -> isize {foo}` + //~| found `fn(isize) -> isize {bar}` + //~| expected fn item + //~| found a different fn item } diff --git a/src/test/compile-fail/fn-trait-formatting.rs b/src/test/compile-fail/fn-trait-formatting.rs index 3f5a92605b..71e1f7091b 100644 --- a/src/test/compile-fail/fn-trait-formatting.rs +++ b/src/test/compile-fail/fn-trait-formatting.rs @@ -14,12 +14,27 @@ fn needs_fn(x: F) where F: Fn(isize) -> isize {} fn main() { - let _: () = (box |:_: isize| {}) as Box; //~ ERROR object-safe - //~^ ERROR Box - let _: () = (box |&:_: isize, isize| {}) as Box; - //~^ ERROR Box - let _: () = (box |&mut:| -> isize unimplemented!()) as Box isize>; - //~^ ERROR Box isize> + let _: () = (box |_: isize| {}) as Box; + //~^ ERROR object-safe + //~| ERROR mismatched types + //~| expected `()` + //~| found `Box` + //~| expected () + //~| found box + let _: () = (box |_: isize, isize| {}) as Box; + //~^ ERROR mismatched types + //~| expected `()` + //~| found `Box` + //~| expected () + //~| found box + let _: () = (box || -> isize unimplemented!()) as Box isize>; + //~^ ERROR mismatched types + //~| expected `()` + //~| found `Box isize>` + //~| expected () + //~| found box - needs_fn(1is); //~ ERROR `core::ops::Fn(isize) -> isize` + needs_fn(1); + //~^ ERROR `core::ops::Fn<(isize,)>` + //~| ERROR `core::ops::Fn<(isize,)>` } diff --git a/src/test/compile-fail/for-loop-bogosity.rs b/src/test/compile-fail/for-loop-bogosity.rs index fd920f9239..6bc0e74a2e 100644 --- a/src/test/compile-fail/for-loop-bogosity.rs +++ b/src/test/compile-fail/for-loop-bogosity.rs @@ -24,7 +24,10 @@ pub fn main() { x: 1, y: 2, }; - for x in bogus { //~ ERROR has type `MyStruct` which does not implement the `Iterator` trait + for x in bogus { //~ ERROR `core::iter::Iterator` is not implemented for the type `MyStruct` + //~^ ERROR + //~^^ ERROR + // FIXME(#21528) not fulfilled obligation error should be reported once, not thrice drop(x); } } diff --git a/src/test/compile-fail/vec-matching-obsolete-syntax.rs b/src/test/compile-fail/for-loop-hygiene.rs similarity index 66% rename from src/test/compile-fail/vec-matching-obsolete-syntax.rs rename to src/test/compile-fail/for-loop-hygiene.rs index 2715b31d19..ff6f848ab5 100644 --- a/src/test/compile-fail/vec-matching-obsolete-syntax.rs +++ b/src/test/compile-fail/for-loop-hygiene.rs @@ -8,15 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// for-loops are expanded in the front end, and use an `iter` ident in their expansion. Check that +// `iter` is not accessible inside the for loop. + +#![allow(unstable)] + fn main() { - let x = [1is, 2, 3]; - match x { - [a, b, ..c] => { //~ ERROR obsolete syntax - assert_eq!(a, 1); - assert_eq!(b, 2); - let expected: &[_] = &[3]; - assert_eq!(c, expected); - } + for _ in 0..10 { + iter.next(); //~ error: unresolved name `iter` } } - diff --git a/src/test/compile-fail/for-loop-refutable-pattern-error-message.rs b/src/test/compile-fail/for-loop-refutable-pattern-error-message.rs index c381fcf3ef..ab6dc2bab3 100644 --- a/src/test/compile-fail/for-loop-refutable-pattern-error-message.rs +++ b/src/test/compile-fail/for-loop-refutable-pattern-error-message.rs @@ -8,9 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - fn main() { for - &1is //~ ERROR refutable pattern in `for` loop binding - in [1is].iter() {} + &1 //~ ERROR refutable pattern in `for` loop binding + in [1].iter() {} } diff --git a/src/test/compile-fail/fully-qualified-type-name1.rs b/src/test/compile-fail/fully-qualified-type-name1.rs index 5ab946a53e..029acbff9c 100644 --- a/src/test/compile-fail/fully-qualified-type-name1.rs +++ b/src/test/compile-fail/fully-qualified-type-name1.rs @@ -13,5 +13,9 @@ fn main() { let x: Option; x = 5; - //~^ ERROR mismatched types: expected `core::option::Option` + //~^ ERROR mismatched types + //~| expected `core::option::Option` + //~| found `_` + //~| expected enum `core::option::Option` + //~| found integral variable } diff --git a/src/test/compile-fail/fully-qualified-type-name2.rs b/src/test/compile-fail/fully-qualified-type-name2.rs index 94af50dac0..ab542d9080 100644 --- a/src/test/compile-fail/fully-qualified-type-name2.rs +++ b/src/test/compile-fail/fully-qualified-type-name2.rs @@ -20,7 +20,11 @@ mod y { fn bar(x: x::foo) -> y::foo { return x; - //~^ ERROR mismatched types: expected `y::foo`, found `x::foo` + //~^ ERROR mismatched types + //~| expected `y::foo` + //~| found `x::foo` + //~| expected enum `y::foo` + //~| found enum `x::foo` } fn main() { diff --git a/src/test/compile-fail/fully-qualified-type-name4.rs b/src/test/compile-fail/fully-qualified-type-name4.rs index 9250444c3e..d6d668b366 100644 --- a/src/test/compile-fail/fully-qualified-type-name4.rs +++ b/src/test/compile-fail/fully-qualified-type-name4.rs @@ -14,7 +14,11 @@ use std::option::Option; fn bar(x: usize) -> Option { return x; - //~^ ERROR mismatched types: expected `core::option::Option` + //~^ ERROR mismatched types + //~| expected `core::option::Option` + //~| found `usize` + //~| expected enum `core::option::Option` + //~| found usize } fn main() { diff --git a/src/test/compile-fail/functional-struct-update-respects-privacy.rs b/src/test/compile-fail/functional-struct-update-respects-privacy.rs new file mode 100644 index 0000000000..51e23a689a --- /dev/null +++ b/src/test/compile-fail/functional-struct-update-respects-privacy.rs @@ -0,0 +1,42 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// RFC 736 (and Issue 21407): functional struct update should respect privacy. + +// The `foo` module attempts to maintains an invariant that each `S` +// has a unique `u64` id. +use self::foo::S; +mod foo { + use std::cell::{UnsafeCell}; + + static mut count : UnsafeCell = UnsafeCell { value: 1 }; + + pub struct S { pub a: u8, pub b: String, secret_uid: u64 } + + pub fn make_secrets(a: u8, b: String) -> S { + let val = unsafe { let p = count.get(); let val = *p; *p = val + 1; val }; + println!("creating {}, uid {}", b, val); + S { a: a, b: b, secret_uid: val } + } + + impl Drop for S { + fn drop(&mut self) { + println!("dropping {}, uid {}", self.b, self.secret_uid); + } + } +} + +fn main() { + let s_1 = foo::make_secrets(3, format!("ess one")); + let s_2 = foo::S { b: format!("ess two"), ..s_1 }; // FRU ... + //~^ ERROR field `secret_uid` of struct `foo::S` is private + println!("main forged an S named: {}", s_2.b); + // at end of scope, ... both s_1 *and* s_2 get dropped. Boom! +} diff --git a/src/test/compile-fail/gated-bad-feature.rs b/src/test/compile-fail/gated-bad-feature.rs index 39cd3e3b86..5baafd4153 100644 --- a/src/test/compile-fail/gated-bad-feature.rs +++ b/src/test/compile-fail/gated-bad-feature.rs @@ -20,4 +20,3 @@ #![feature = "foo"] //~ ERROR: malformed feature #![feature(test_removed_feature)] //~ ERROR: feature has been removed -#![feature(test_accepted_feature)] //~ WARNING: feature has been added diff --git a/src/test/compile-fail/gated-no-std.rs b/src/test/compile-fail/gated-no-std.rs new file mode 100644 index 0000000000..893ba8a8a8 --- /dev/null +++ b/src/test/compile-fail/gated-no-std.rs @@ -0,0 +1,13 @@ +// Copyright 2105 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![no_std] //~ ERROR no_std is experimental + +fn main() {} diff --git a/src/test/compile-fail/generic-impl-less-params-with-defaults.rs b/src/test/compile-fail/generic-impl-less-params-with-defaults.rs index 02f09749d6..9fea5e609d 100644 --- a/src/test/compile-fail/generic-impl-less-params-with-defaults.rs +++ b/src/test/compile-fail/generic-impl-less-params-with-defaults.rs @@ -8,10 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct Foo; +use std::marker; + +struct Foo( + marker::PhantomData<(A,B,C)>); impl Foo { - fn new() -> Foo {Foo} + fn new() -> Foo {Foo(marker::PhantomData)} } fn main() { diff --git a/src/test/compile-fail/generic-impl-more-params-with-defaults.rs b/src/test/compile-fail/generic-impl-more-params-with-defaults.rs index d88da2625c..73c19aa012 100644 --- a/src/test/compile-fail/generic-impl-more-params-with-defaults.rs +++ b/src/test/compile-fail/generic-impl-more-params-with-defaults.rs @@ -8,12 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::marker; + struct Heap; -struct Vec; +struct Vec( + marker::PhantomData<(T,A)>); impl Vec { - fn new() -> Vec {Vec} + fn new() -> Vec {Vec(marker::PhantomData)} } fn main() { diff --git a/src/test/compile-fail/generic-lifetime-trait-impl.rs b/src/test/compile-fail/generic-lifetime-trait-impl.rs index fc54002820..9b9f09f477 100644 --- a/src/test/compile-fail/generic-lifetime-trait-impl.rs +++ b/src/test/compile-fail/generic-lifetime-trait-impl.rs @@ -16,9 +16,12 @@ // // Regression test for issue #16218. -trait Bar<'a> {} +trait Bar<'a> { + fn dummy(&'a self); +} trait Foo<'a> { + fn dummy(&'a self) { } fn bar<'b, T: Bar<'b>>(self) -> &'b str; } diff --git a/src/test/compile-fail/generic-type-less-params-with-defaults.rs b/src/test/compile-fail/generic-type-less-params-with-defaults.rs index f25d8f99b8..37737fda47 100644 --- a/src/test/compile-fail/generic-type-less-params-with-defaults.rs +++ b/src/test/compile-fail/generic-type-less-params-with-defaults.rs @@ -8,9 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::marker; + struct Heap; -struct Vec; +struct Vec( + marker::PhantomData<(T,A)>); fn main() { let _: Vec; //~ ERROR wrong number of type arguments: expected at least 1, found 0 diff --git a/src/test/compile-fail/generic-type-more-params-with-defaults.rs b/src/test/compile-fail/generic-type-more-params-with-defaults.rs index 19d303488a..ad7e4f190c 100644 --- a/src/test/compile-fail/generic-type-more-params-with-defaults.rs +++ b/src/test/compile-fail/generic-type-more-params-with-defaults.rs @@ -8,9 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::marker; + struct Heap; -struct Vec; +struct Vec( + marker::PhantomData<(T,A)>); fn main() { let _: Vec; diff --git a/src/test/compile-fail/generic-type-params-name-repr.rs b/src/test/compile-fail/generic-type-params-name-repr.rs index 5769b9d793..a452cd35f9 100644 --- a/src/test/compile-fail/generic-type-params-name-repr.rs +++ b/src/test/compile-fail/generic-type-params-name-repr.rs @@ -8,34 +8,60 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::marker; + struct A; struct B; struct C; -struct Foo; +struct Foo(marker::PhantomData<(T,U,V)>); -struct Hash; -struct HashMap>; +struct Hash(marker::PhantomData); +struct HashMap>(marker::PhantomData<(K,V,H)>); fn main() { // Ensure that the printed type doesn't include the default type params... let _: Foo = (); - //~^ ERROR mismatched types: expected `Foo`, found `()` + //~^ ERROR mismatched types + //~| expected `Foo` + //~| found `()` + //~| expected struct `Foo` + //~| found () // ...even when they're present, but the same types as the defaults. let _: Foo = (); - //~^ ERROR mismatched types: expected `Foo`, found `()` + //~^ ERROR mismatched types + //~| expected `Foo` + //~| found `()` + //~| expected struct `Foo` + //~| found () // Including cases where the default is using previous type params. let _: HashMap = (); - //~^ ERROR mismatched types: expected `HashMap`, found `()` + //~^ ERROR mismatched types + //~| expected `HashMap` + //~| found `()` + //~| expected struct `HashMap` + //~| found () let _: HashMap> = (); - //~^ ERROR mismatched types: expected `HashMap`, found `()` + //~^ ERROR mismatched types + //~| expected `HashMap` + //~| found `()` + //~| expected struct `HashMap` + //~| found () // But not when there's a different type in between. let _: Foo = (); - //~^ ERROR mismatched types: expected `Foo`, found `()` + //~^ ERROR mismatched types + //~| expected `Foo` + //~| found `()` + //~| expected struct `Foo` + //~| found () // And don't print <> at all when there's just defaults. let _: Foo = (); - //~^ ERROR mismatched types: expected `Foo`, found `()` + //~^ ERROR mismatched types + //~| expected `Foo` + //~| found `()` + //~| expected struct `Foo` + //~| found () } diff --git a/src/test/compile-fail/hashmap-iter-value-lifetime.rs b/src/test/compile-fail/hashmap-iter-value-lifetime.rs index db1e1e8efe..9cf145a1ff 100644 --- a/src/test/compile-fail/hashmap-iter-value-lifetime.rs +++ b/src/test/compile-fail/hashmap-iter-value-lifetime.rs @@ -10,7 +10,7 @@ fn main() { let mut my_stuff = std::collections::HashMap::new(); - my_stuff.insert(0is, 42is); + my_stuff.insert(0, 42); let (_, thing) = my_stuff.iter().next().unwrap(); diff --git a/src/test/compile-fail/hashmap-lifetimes.rs b/src/test/compile-fail/hashmap-lifetimes.rs index 40673dd92b..6858599f63 100644 --- a/src/test/compile-fail/hashmap-lifetimes.rs +++ b/src/test/compile-fail/hashmap-lifetimes.rs @@ -10,7 +10,7 @@ fn main() { let mut my_stuff = std::collections::HashMap::new(); - my_stuff.insert(0is, 42is); + my_stuff.insert(0, 42); let mut it = my_stuff.iter(); my_stuff.insert(1, 43); //~ ERROR cannot borrow diff --git a/src/test/compile-fail/hrtb-precedence-of-plus-error-message.rs b/src/test/compile-fail/hrtb-precedence-of-plus-error-message.rs index 41a0be37ad..db67249bbd 100644 --- a/src/test/compile-fail/hrtb-precedence-of-plus-error-message.rs +++ b/src/test/compile-fail/hrtb-precedence-of-plus-error-message.rs @@ -19,17 +19,17 @@ trait Bar { struct Foo<'a> { a: &'a Bar+'a, //~^ ERROR E0178 - //~^^ NOTE perhaps you meant `&'a (Bar + 'a)`? + //~^^ HELP perhaps you meant `&'a (Bar + 'a)`? b: &'a mut Bar+'a, //~^ ERROR E0178 - //~^^ NOTE perhaps you meant `&'a mut (Bar + 'a)`? + //~^^ HELP perhaps you meant `&'a mut (Bar + 'a)`? c: Box, // OK, no paren needed in this context d: fn() -> Bar+'a, //~^ ERROR E0178 - //~^^ NOTE perhaps you forgot parentheses + //~^^ HELP perhaps you forgot parentheses //~^^^ WARN deprecated syntax } diff --git a/src/test/compile-fail/huge-enum.rs b/src/test/compile-fail/huge-enum.rs index aef1fa85e0..6e7c05370b 100644 --- a/src/test/compile-fail/huge-enum.rs +++ b/src/test/compile-fail/huge-enum.rs @@ -12,12 +12,12 @@ // FIXME: work properly with higher limits -#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))] +#[cfg(target_pointer_width = "32")] fn main() { let big: Option<[u32; (1<<29)-1]> = None; } -#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))] +#[cfg(target_pointer_width = "64")] fn main() { let big: Option<[u32; (1<<45)-1]> = None; } diff --git a/src/test/compile-fail/hygienic-label-3.rs b/src/test/compile-fail/hygienic-label-3.rs index 4ff3bec3c6..e58cd09a84 100644 --- a/src/test/compile-fail/hygienic-label-3.rs +++ b/src/test/compile-fail/hygienic-label-3.rs @@ -13,7 +13,7 @@ macro_rules! foo { } pub fn main() { - 'x: for _ in range(0,1) { + 'x: for _ in 0..1 { foo!() //~ ERROR use of undeclared label `'x` }; } diff --git a/src/test/compile-fail/hygienic-label-4.rs b/src/test/compile-fail/hygienic-label-4.rs index 174e8a2834..5bfcb6360e 100644 --- a/src/test/compile-fail/hygienic-label-4.rs +++ b/src/test/compile-fail/hygienic-label-4.rs @@ -9,7 +9,7 @@ // except according to those terms. macro_rules! foo { - ($e: expr) => { 'x: for _ in range(0,1) { $e } } + ($e: expr) => { 'x: for _ in 0..1 { $e } } } pub fn main() { diff --git a/src/test/compile-fail/if-branch-types.rs b/src/test/compile-fail/if-branch-types.rs index be54554a3c..b7a5b991c6 100644 --- a/src/test/compile-fail/if-branch-types.rs +++ b/src/test/compile-fail/if-branch-types.rs @@ -9,6 +9,10 @@ // except according to those terms. fn main() { - let x = if true { 10is } else { 10us }; - //~^ ERROR if and else have incompatible types: expected `isize`, found `usize` + let x = if true { 10i32 } else { 10u32 }; + //~^ ERROR if and else have incompatible types + //~| expected `i32` + //~| found `u32` + //~| expected i32 + //~| found u32 } diff --git a/src/test/compile-fail/if-let.rs b/src/test/compile-fail/if-let.rs index d83779c4f0..1e9144910b 100644 --- a/src/test/compile-fail/if-let.rs +++ b/src/test/compile-fail/if-let.rs @@ -20,20 +20,20 @@ fn macros() { }} } - foo!(a, 1is, { //~ ERROR irrefutable if-let + foo!(a, 1, { //~ ERROR irrefutable if-let println!("irrefutable pattern"); }); - bar!(a, 1is, { //~ ERROR irrefutable if-let + bar!(a, 1, { //~ ERROR irrefutable if-let println!("irrefutable pattern"); }); } pub fn main() { - if let a = 1is { //~ ERROR irrefutable if-let + if let a = 1 { //~ ERROR irrefutable if-let println!("irrefutable pattern"); } - if let a = 1is { //~ ERROR irrefutable if-let + if let a = 1 { //~ ERROR irrefutable if-let println!("irrefutable pattern"); } else if true { println!("else-if in irrefutable if-let"); @@ -41,15 +41,15 @@ pub fn main() { println!("else in irrefutable if-let"); } - if let 1is = 2is { + if let 1 = 2 { println!("refutable pattern"); - } else if let a = 1is { //~ ERROR irrefutable if-let + } else if let a = 1 { //~ ERROR irrefutable if-let println!("irrefutable pattern"); } if true { println!("if"); - } else if let a = 1is { //~ ERROR irrefutable if-let + } else if let a = 1 { //~ ERROR irrefutable if-let println!("irrefutable pattern"); } } diff --git a/src/test/compile-fail/if-without-else-result.rs b/src/test/compile-fail/if-without-else-result.rs index 89beb9a316..a9567f4272 100644 --- a/src/test/compile-fail/if-without-else-result.rs +++ b/src/test/compile-fail/if-without-else-result.rs @@ -10,6 +10,10 @@ fn main() { let a = if true { true }; -//~^ ERROR if may be missing an else clause: expected `()`, found `bool` (expected (), found bool) + //~^ ERROR if may be missing an else clause + //~| expected `()` + //~| found `bool` + //~| expected () + //~| found bool println!("{}", a); } diff --git a/src/test/compile-fail/immut-function-arguments.rs b/src/test/compile-fail/immut-function-arguments.rs index 99927d8b9b..949c1c0d9c 100644 --- a/src/test/compile-fail/immut-function-arguments.rs +++ b/src/test/compile-fail/immut-function-arguments.rs @@ -14,7 +14,7 @@ fn f(y: Box) { } fn g() { - let _frob = |&: q: Box| { *q = 2; }; //~ ERROR cannot assign + let _frob = |q: Box| { *q = 2; }; //~ ERROR cannot assign } diff --git a/src/test/compile-fail/implicit-method-bind.rs b/src/test/compile-fail/implicit-method-bind.rs index d329f72f78..6a9c304805 100644 --- a/src/test/compile-fail/implicit-method-bind.rs +++ b/src/test/compile-fail/implicit-method-bind.rs @@ -11,5 +11,5 @@ use std::num::SignedInt; fn main() { - let _f = 10is.abs; //~ ERROR attempted to take value of method + let _f = 10.abs; //~ ERROR attempted to take value of method } diff --git a/src/test/compile-fail/import-glob-circular.rs b/src/test/compile-fail/import-glob-circular.rs index 0f6e3dc134..f38172db44 100644 --- a/src/test/compile-fail/import-glob-circular.rs +++ b/src/test/compile-fail/import-glob-circular.rs @@ -13,13 +13,13 @@ mod circ1 { pub use circ2::f2; pub fn f1() { println!("f1"); } - pub fn common() -> usize { return 0us; } + pub fn common() -> usize { return 0_usize; } } mod circ2 { pub use circ1::f1; pub fn f2() { println!("f2"); } - pub fn common() -> usize { return 1us; } + pub fn common() -> usize { return 1_usize; } } mod test { diff --git a/src/test/compile-fail/index-bot.rs b/src/test/compile-fail/index-bot.rs index 876c1e481f..b28f2a746f 100644 --- a/src/test/compile-fail/index-bot.rs +++ b/src/test/compile-fail/index-bot.rs @@ -9,5 +9,5 @@ // except according to those terms. fn main() { - (return)[0us]; //~ ERROR the type of this value must be known in this context + (return)[0_usize]; //~ ERROR the type of this value must be known in this context } diff --git a/src/test/compile-fail/infinite-instantiation.rs b/src/test/compile-fail/infinite-instantiation.rs index a922f5fe45..2642ac6204 100644 --- a/src/test/compile-fail/infinite-instantiation.rs +++ b/src/test/compile-fail/infinite-instantiation.rs @@ -28,11 +28,11 @@ impl to_opt for Option { } fn function(counter: usize, t: T) { - if counter > 0us { - function(counter - 1us, t.to_option()); + if counter > 0_usize { + function(counter - 1_usize, t.to_option()); } } fn main() { - function(22us, 22us); + function(22_usize, 22_usize); } diff --git a/src/test/compile-fail/integer-literal-suffix-inference.rs b/src/test/compile-fail/integer-literal-suffix-inference.rs index 1e42a9447f..5d9314faef 100644 --- a/src/test/compile-fail/integer-literal-suffix-inference.rs +++ b/src/test/compile-fail/integer-literal-suffix-inference.rs @@ -39,62 +39,242 @@ fn main() { fn id_u64(n: u64) -> u64 { n } id_i8(a8); // ok - id_i8(a16); //~ ERROR mismatched types: expected `i8`, found `i16` - id_i8(a32); //~ ERROR mismatched types: expected `i8`, found `i32` - id_i8(a64); //~ ERROR mismatched types: expected `i8`, found `i64` + id_i8(a16); + //~^ ERROR mismatched types + //~| expected `i8` + //~| found `i16` + //~| expected i8 + //~| found i16 + id_i8(a32); + //~^ ERROR mismatched types + //~| expected `i8` + //~| found `i32` + //~| expected i8 + //~| found i32 + id_i8(a64); + //~^ ERROR mismatched types + //~| expected `i8` + //~| found `i64` + //~| expected i8 + //~| found i64 - id_i16(a8); //~ ERROR mismatched types: expected `i16`, found `i8` + id_i16(a8); + //~^ ERROR mismatched types + //~| expected `i16` + //~| found `i8` + //~| expected i16 + //~| found i8 id_i16(a16); // ok - id_i16(a32); //~ ERROR mismatched types: expected `i16`, found `i32` - id_i16(a64); //~ ERROR mismatched types: expected `i16`, found `i64` + id_i16(a32); + //~^ ERROR mismatched types + //~| expected `i16` + //~| found `i32` + //~| expected i16 + //~| found i32 + id_i16(a64); + //~^ ERROR mismatched types + //~| expected `i16` + //~| found `i64` + //~| expected i16 + //~| found i64 - id_i32(a8); //~ ERROR mismatched types: expected `i32`, found `i8` - id_i32(a16); //~ ERROR mismatched types: expected `i32`, found `i16` + id_i32(a8); + //~^ ERROR mismatched types + //~| expected `i32` + //~| found `i8` + //~| expected i32 + //~| found i8 + id_i32(a16); + //~^ ERROR mismatched types + //~| expected `i32` + //~| found `i16` + //~| expected i32 + //~| found i16 id_i32(a32); // ok - id_i32(a64); //~ ERROR mismatched types: expected `i32`, found `i64` + id_i32(a64); + //~^ ERROR mismatched types + //~| expected `i32` + //~| found `i64` + //~| expected i32 + //~| found i64 - id_i64(a8); //~ ERROR mismatched types: expected `i64`, found `i8` - id_i64(a16); //~ ERROR mismatched types: expected `i64`, found `i16` - id_i64(a32); //~ ERROR mismatched types: expected `i64`, found `i32` + id_i64(a8); + //~^ ERROR mismatched types + //~| expected `i64` + //~| found `i8` + //~| expected i64 + //~| found i8 + id_i64(a16); + //~^ ERROR mismatched types + //~| expected `i64` + //~| found `i16` + //~| expected i64 + //~| found i16 + id_i64(a32); + //~^ ERROR mismatched types + //~| expected `i64` + //~| found `i32` + //~| expected i64 + //~| found i32 id_i64(a64); // ok id_i8(c8); // ok - id_i8(c16); //~ ERROR mismatched types: expected `i8`, found `i16` - id_i8(c32); //~ ERROR mismatched types: expected `i8`, found `i32` - id_i8(c64); //~ ERROR mismatched types: expected `i8`, found `i64` + id_i8(c16); + //~^ ERROR mismatched types + //~| expected `i8` + //~| found `i16` + //~| expected i8 + //~| found i16 + id_i8(c32); + //~^ ERROR mismatched types + //~| expected `i8` + //~| found `i32` + //~| expected i8 + //~| found i32 + id_i8(c64); + //~^ ERROR mismatched types + //~| expected `i8` + //~| found `i64` + //~| expected i8 + //~| found i64 - id_i16(c8); //~ ERROR mismatched types: expected `i16`, found `i8` + id_i16(c8); + //~^ ERROR mismatched types + //~| expected `i16` + //~| found `i8` + //~| expected i16 + //~| found i8 id_i16(c16); // ok - id_i16(c32); //~ ERROR mismatched types: expected `i16`, found `i32` - id_i16(c64); //~ ERROR mismatched types: expected `i16`, found `i64` + id_i16(c32); + //~^ ERROR mismatched types + //~| expected `i16` + //~| found `i32` + //~| expected i16 + //~| found i32 + id_i16(c64); + //~^ ERROR mismatched types + //~| expected `i16` + //~| found `i64` + //~| expected i16 + //~| found i64 - id_i32(c8); //~ ERROR mismatched types: expected `i32`, found `i8` - id_i32(c16); //~ ERROR mismatched types: expected `i32`, found `i16` + id_i32(c8); + //~^ ERROR mismatched types + //~| expected `i32` + //~| found `i8` + //~| expected i32 + //~| found i8 + id_i32(c16); + //~^ ERROR mismatched types + //~| expected `i32` + //~| found `i16` + //~| expected i32 + //~| found i16 id_i32(c32); // ok - id_i32(c64); //~ ERROR mismatched types: expected `i32`, found `i64` + id_i32(c64); + //~^ ERROR mismatched types + //~| expected `i32` + //~| found `i64` + //~| expected i32 + //~| found i64 - id_i64(a8); //~ ERROR mismatched types: expected `i64`, found `i8` - id_i64(a16); //~ ERROR mismatched types: expected `i64`, found `i16` - id_i64(a32); //~ ERROR mismatched types: expected `i64`, found `i32` + id_i64(a8); + //~^ ERROR mismatched types + //~| expected `i64` + //~| found `i8` + //~| expected i64 + //~| found i8 + id_i64(a16); + //~^ ERROR mismatched types + //~| expected `i64` + //~| found `i16` + //~| expected i64 + //~| found i16 + id_i64(a32); + //~^ ERROR mismatched types + //~| expected `i64` + //~| found `i32` + //~| expected i64 + //~| found i32 id_i64(a64); // ok id_u8(b8); // ok - id_u8(b16); //~ ERROR mismatched types: expected `u8`, found `u16` - id_u8(b32); //~ ERROR mismatched types: expected `u8`, found `u32` - id_u8(b64); //~ ERROR mismatched types: expected `u8`, found `u64` + id_u8(b16); + //~^ ERROR mismatched types + //~| expected `u8` + //~| found `u16` + //~| expected u8 + //~| found u16 + id_u8(b32); + //~^ ERROR mismatched types + //~| expected `u8` + //~| found `u32` + //~| expected u8 + //~| found u32 + id_u8(b64); + //~^ ERROR mismatched types + //~| expected `u8` + //~| found `u64` + //~| expected u8 + //~| found u64 - id_u16(b8); //~ ERROR mismatched types: expected `u16`, found `u8` + id_u16(b8); + //~^ ERROR mismatched types + //~| expected `u16` + //~| found `u8` + //~| expected u16 + //~| found u8 id_u16(b16); // ok - id_u16(b32); //~ ERROR mismatched types: expected `u16`, found `u32` - id_u16(b64); //~ ERROR mismatched types: expected `u16`, found `u64` + id_u16(b32); + //~^ ERROR mismatched types + //~| expected `u16` + //~| found `u32` + //~| expected u16 + //~| found u32 + id_u16(b64); + //~^ ERROR mismatched types + //~| expected `u16` + //~| found `u64` + //~| expected u16 + //~| found u64 - id_u32(b8); //~ ERROR mismatched types: expected `u32`, found `u8` - id_u32(b16); //~ ERROR mismatched types: expected `u32`, found `u16` + id_u32(b8); + //~^ ERROR mismatched types + //~| expected `u32` + //~| found `u8` + //~| expected u32 + //~| found u8 + id_u32(b16); + //~^ ERROR mismatched types + //~| expected `u32` + //~| found `u16` + //~| expected u32 + //~| found u16 id_u32(b32); // ok - id_u32(b64); //~ ERROR mismatched types: expected `u32`, found `u64` + id_u32(b64); + //~^ ERROR mismatched types + //~| expected `u32` + //~| found `u64` + //~| expected u32 + //~| found u64 - id_u64(b8); //~ ERROR mismatched types: expected `u64`, found `u8` - id_u64(b16); //~ ERROR mismatched types: expected `u64`, found `u16` - id_u64(b32); //~ ERROR mismatched types: expected `u64`, found `u32` + id_u64(b8); + //~^ ERROR mismatched types + //~| expected `u64` + //~| found `u8` + //~| expected u64 + //~| found u8 + id_u64(b16); + //~^ ERROR mismatched types + //~| expected `u64` + //~| found `u16` + //~| expected u64 + //~| found u16 + id_u64(b32); + //~^ ERROR mismatched types + //~| expected `u64` + //~| found `u32` + //~| expected u64 + //~| found u32 id_u64(b64); // ok } diff --git a/src/test/compile-fail/integral-indexing.rs b/src/test/compile-fail/integral-indexing.rs index ef651dd9ce..e8998dd7a9 100644 --- a/src/test/compile-fail/integral-indexing.rs +++ b/src/test/compile-fail/integral-indexing.rs @@ -11,17 +11,17 @@ pub fn main() { let v: Vec = vec!(0, 1, 2, 3, 4, 5); let s: String = "abcdef".to_string(); - v.as_slice()[3us]; - v.as_slice()[3]; - v.as_slice()[3u8]; //~ERROR the trait `core::ops::Index` is not implemented + v[3_usize]; + v[3]; + v[3u8]; //~ERROR the trait `core::ops::Index` is not implemented //~^ ERROR the trait `core::ops::Index` is not implemented - v.as_slice()[3i8]; //~ERROR the trait `core::ops::Index` is not implemented + v[3i8]; //~ERROR the trait `core::ops::Index` is not implemented //~^ ERROR the trait `core::ops::Index` is not implemented - v.as_slice()[3u32]; //~ERROR the trait `core::ops::Index` is not implemented + v[3u32]; //~ERROR the trait `core::ops::Index` is not implemented //~^ ERROR the trait `core::ops::Index` is not implemented - v.as_slice()[3i32]; //~ERROR the trait `core::ops::Index` is not implemented + v[3i32]; //~ERROR the trait `core::ops::Index` is not implemented //~^ ERROR the trait `core::ops::Index` is not implemented - s.as_bytes()[3us]; + s.as_bytes()[3_usize]; s.as_bytes()[3]; s.as_bytes()[3u8]; //~ERROR the trait `core::ops::Index` is not implemented //~^ERROR the trait `core::ops::Index` is not implemented diff --git a/src/test/compile-fail/integral-variable-unification-error.rs b/src/test/compile-fail/integral-variable-unification-error.rs index fbbe4cf8db..3374f71591 100644 --- a/src/test/compile-fail/integral-variable-unification-error.rs +++ b/src/test/compile-fail/integral-variable-unification-error.rs @@ -11,5 +11,9 @@ fn main() { let mut x = 2; x = 5.0; -//~^ ERROR expected `_`, found `_` (expected integral variable, found floating-point variable) + //~^ ERROR mismatched types + //~| expected `_` + //~| found `_` + //~| expected integral variable + //~| found floating-point variable } diff --git a/src/test/compile-fail/issue-10176.rs b/src/test/compile-fail/issue-10176.rs index 832cc57bd2..6e84e77789 100644 --- a/src/test/compile-fail/issue-10176.rs +++ b/src/test/compile-fail/issue-10176.rs @@ -10,7 +10,11 @@ fn f() -> isize { (return 1, return 2) -//~^ ERROR mismatched types: expected `isize`, found `(_, _)` (expected isize, found tuple) +//~^ ERROR mismatched types +//~| expected `isize` +//~| found `(_, _)` +//~| expected isize +//~| found tuple } fn main() {} diff --git a/src/test/compile-fail/issue-10398.rs b/src/test/compile-fail/issue-10398.rs index c1102bc84a..736f963012 100644 --- a/src/test/compile-fail/issue-10398.rs +++ b/src/test/compile-fail/issue-10398.rs @@ -11,8 +11,8 @@ #![feature(box_syntax)] fn main() { - let x = box 1is; - let f = move|:| { + let x = box 1; + let f = move|| { let _a = x; drop(x); //~^ ERROR: use of moved value: `x` diff --git a/src/test/compile-fail/issue-10991.rs b/src/test/compile-fail/issue-10991.rs index 2913ddf395..25060b94dc 100644 --- a/src/test/compile-fail/issue-10991.rs +++ b/src/test/compile-fail/issue-10991.rs @@ -10,5 +10,5 @@ fn main() { let nil = (); - let _t = nil as usize; //~ ERROR: cast from nil: `()` as `usize` + let _t = nil as usize; //~ ERROR: non-scalar cast: `()` as `usize` } diff --git a/src/test/compile-fail/issue-11192.rs b/src/test/compile-fail/issue-11192.rs index 0d7a846bff..a95bcc73a9 100644 --- a/src/test/compile-fail/issue-11192.rs +++ b/src/test/compile-fail/issue-11192.rs @@ -22,7 +22,7 @@ impl Drop for Foo { fn main() { let mut ptr = box Foo { x: 0 }; - let mut test = |&mut: foo: &Foo| { + let mut test = |foo: &Foo| { println!("access {}", foo.x); ptr = box Foo { x: ptr.x + 1 }; println!("access {}", foo.x); diff --git a/src/test/compile-fail/issue-11319.rs b/src/test/compile-fail/issue-11319.rs index c818b3bb26..d3e44b71b1 100644 --- a/src/test/compile-fail/issue-11319.rs +++ b/src/test/compile-fail/issue-11319.rs @@ -10,7 +10,11 @@ fn main() { match Some(10) { - //~^ ERROR match arms have incompatible types: expected `bool`, found `()` + //~^ ERROR match arms have incompatible types: + //~| expected `bool` + //~| found `()` + //~| expected bool + //~| found () Some(5) => false, Some(2) => true, None => (), //~ NOTE match arm with an incompatible type diff --git a/src/test/compile-fail/issue-11374.rs b/src/test/compile-fail/issue-11374.rs index 6b048528a9..09d7293a3d 100644 --- a/src/test/compile-fail/issue-11374.rs +++ b/src/test/compile-fail/issue-11374.rs @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::io; +use std::old_io; use std::vec; pub struct Container<'a> { - reader: &'a mut Reader //~ ERROR explicit lifetime bound required + reader: &'a mut Reader } impl<'a> Container<'a> { @@ -26,12 +26,12 @@ impl<'a> Container<'a> { } pub fn for_stdin<'a>() -> Container<'a> { - let mut r = io::stdin(); + let mut r = old_io::stdin(); Container::wrap(&mut r as &mut Reader) } fn main() { let mut c = for_stdin(); let mut v = Vec::new(); - c.read_to(v.as_mut_slice()); + c.read_to(v); //~ ERROR mismatched types } diff --git a/src/test/compile-fail/issue-11493.rs b/src/test/compile-fail/issue-11493.rs index 895eb4cf96..333ff7118d 100644 --- a/src/test/compile-fail/issue-11493.rs +++ b/src/test/compile-fail/issue-11493.rs @@ -11,6 +11,6 @@ // This file must never have a trailing newline fn main() { - let x = Some(3is); - let y = x.as_ref().unwrap_or(&5is); //~ ERROR: borrowed value does not live long enough + let x = Some(3); + let y = x.as_ref().unwrap_or(&5); //~ ERROR: borrowed value does not live long enough } diff --git a/src/test/compile-fail/issue-11515.rs b/src/test/compile-fail/issue-11515.rs index f0089b0ae5..4ff574e939 100644 --- a/src/test/compile-fail/issue-11515.rs +++ b/src/test/compile-fail/issue-11515.rs @@ -10,7 +10,7 @@ #![feature(box_syntax)] -struct Test<'s> { +struct Test { func: Box } diff --git a/src/test/compile-fail/issue-11714.rs b/src/test/compile-fail/issue-11714.rs index eef035d3d9..d307352517 100644 --- a/src/test/compile-fail/issue-11714.rs +++ b/src/test/compile-fail/issue-11714.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn blah() -> isize { //~ ERROR not all control paths return a value - 1is +fn blah() -> i32 { //~ ERROR not all control paths return a value + 1i32 ; //~ HELP consider removing this semicolon: } diff --git a/src/test/compile-fail/issue-11771.rs b/src/test/compile-fail/issue-11771.rs index 7ce23e1f6a..2de86e527e 100644 --- a/src/test/compile-fail/issue-11771.rs +++ b/src/test/compile-fail/issue-11771.rs @@ -11,11 +11,19 @@ fn main() { let x = (); 1 + - x //~ ERROR mismatched types: expected `_`, found `()` (expected integral variable, found ()) + x //~ ERROR mismatched types + //~| expected `_` + //~| found `()` + //~| expected integral variable + //~| found () ; let x: () = (); 1 + - x //~ ERROR mismatched types: expected `_`, found `()` (expected integral variable, found ()) + x //~ ERROR mismatched types + //~| expected `_` + //~| found `()` + //~| expected integral variable + //~| found () ; } diff --git a/src/test/compile-fail/issue-11873.rs b/src/test/compile-fail/issue-11873.rs index 67578de892..38956944f6 100644 --- a/src/test/compile-fail/issue-11873.rs +++ b/src/test/compile-fail/issue-11873.rs @@ -9,8 +9,8 @@ // except according to those terms. fn main() { - let mut v = vec!(1is); - let mut f = |&mut:| v.push(2is); + let mut v = vec!(1); + let mut f = || v.push(2); let _w = v; //~ ERROR: cannot move out of `v` f(); diff --git a/src/test/compile-fail/issue-11925.rs b/src/test/compile-fail/issue-11925.rs index e5f3b7d62d..df4dab2552 100644 --- a/src/test/compile-fail/issue-11925.rs +++ b/src/test/compile-fail/issue-11925.rs @@ -8,12 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(box_syntax)] +#![feature(box_syntax, unboxed_closures)] + +fn to_fn_once>(f: F) -> F { f } fn main() { let r = { - let x = box 42is; - let f = move|:| &x; //~ ERROR: `x` does not live long enough + let x = box 42; + let f = to_fn_once(move|| &x); //~ ERROR: `x` does not live long enough f() }; diff --git a/src/test/compile-fail/issue-12028.rs b/src/test/compile-fail/issue-12028.rs index 24ffc5e9ee..980385ce4c 100644 --- a/src/test/compile-fail/issue-12028.rs +++ b/src/test/compile-fail/issue-12028.rs @@ -43,7 +43,7 @@ impl Hash for u8 { impl StreamHash for u8 { fn input_stream(&self, stream: &mut H::S) { - Stream::input(&*stream, &[*self]); + Stream::input(stream, &[*self]); } } diff --git a/src/test/compile-fail/issue-12041.rs b/src/test/compile-fail/issue-12041.rs index 02c19204f7..735f529277 100644 --- a/src/test/compile-fail/issue-12041.rs +++ b/src/test/compile-fail/issue-12041.rs @@ -9,15 +9,15 @@ // except according to those terms. use std::sync::mpsc::channel; -use std::thread::Thread; +use std::thread; fn main() { let (tx, rx) = channel(); - let _t = Thread::spawn(move|| -> () { + let _t = thread::spawn(move|| -> () { loop { let tx = tx; //~^ ERROR: use of moved value: `tx` - tx.send(1is); + tx.send(1); } }); } diff --git a/src/test/compile-fail/issue-12116.rs b/src/test/compile-fail/issue-12116.rs index 6f75909fad..1978068575 100644 --- a/src/test/compile-fail/issue-12116.rs +++ b/src/test/compile-fail/issue-12116.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(box_patterns)] #![feature(box_syntax)] enum IntList { diff --git a/src/test/compile-fail/issue-12127.rs b/src/test/compile-fail/issue-12127.rs index c06082de3c..40d446b91a 100644 --- a/src/test/compile-fail/issue-12127.rs +++ b/src/test/compile-fail/issue-12127.rs @@ -8,14 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(box_syntax)] +#![feature(box_syntax, unboxed_closures)] +fn to_fn_once>(f: F) -> F { f } fn do_it(x: &isize) { } fn main() { let x = box 22; - let f = move|:| do_it(&*x); - (move|:| { + let f = to_fn_once(move|| do_it(&*x)); + to_fn_once(move|| { f(); f(); //~^ ERROR: use of moved value: `f` diff --git a/src/test/compile-fail/issue-12369.rs b/src/test/compile-fail/issue-12369.rs index 0587bdf613..9a471a4341 100644 --- a/src/test/compile-fail/issue-12369.rs +++ b/src/test/compile-fail/issue-12369.rs @@ -10,7 +10,7 @@ fn main() { let sl = vec![1,2,3]; - let v: isize = match sl.as_slice() { + let v: isize = match &*sl { [] => 0, [a,b,c] => 3, [a, rest..] => a, diff --git a/src/test/compile-fail/issue-12997-2.rs b/src/test/compile-fail/issue-12997-2.rs index 39957a2422..1cf534e7e4 100644 --- a/src/test/compile-fail/issue-12997-2.rs +++ b/src/test/compile-fail/issue-12997-2.rs @@ -12,6 +12,10 @@ //! Test that makes sure wrongly-typed bench functions are rejected -// error-pattern:expected &-ptr, found isize #[bench] fn bar(x: isize) { } +//~^ ERROR mismatched types +//~| expected `fn(&mut test::Bencher)` +//~| found `fn(isize) {bar}` +//~| expected &-ptr +//~| found isize diff --git a/src/test/compile-fail/issue-13058.rs b/src/test/compile-fail/issue-13058.rs index eee82483ca..06f14158b9 100644 --- a/src/test/compile-fail/issue-13058.rs +++ b/src/test/compile-fail/issue-13058.rs @@ -34,6 +34,10 @@ fn check<'r, I: Iterator, T: Itble<'r, usize, I>>(cont: &T) -> bool } fn main() { - check((3us, 5us)); -//~^ ERROR mismatched types: expected `&_`, found `(usize, usize)` (expected &-ptr, found tuple) + check((3_usize, 5_usize)); +//~^ ERROR mismatched types +//~| expected `&_` +//~| found `(usize, usize)` +//~| expected &-ptr +//~| found tuple } diff --git a/src/test/compile-fail/issue-13359.rs b/src/test/compile-fail/issue-13359.rs index 2e33886037..c53e576094 100644 --- a/src/test/compile-fail/issue-13359.rs +++ b/src/test/compile-fail/issue-13359.rs @@ -14,8 +14,16 @@ fn bar(_s: u32) { } fn main() { foo(1*(1 as isize)); - //~^ ERROR: mismatched types: expected `i16`, found `isize` (expected i16, found isize) + //~^ ERROR mismatched types + //~| expected `i16` + //~| found `isize` + //~| expected i16 + //~| found isize bar(1*(1 as usize)); - //~^ ERROR: mismatched types: expected `u32`, found `usize` (expected u32, found usize) + //~^ ERROR mismatched types + //~| expected `u32` + //~| found `usize` + //~| expected u32 + //~| found usize } diff --git a/src/test/compile-fail/issue-13466.rs b/src/test/compile-fail/issue-13466.rs index 7d554545b5..16128e52d6 100644 --- a/src/test/compile-fail/issue-13466.rs +++ b/src/test/compile-fail/issue-13466.rs @@ -14,8 +14,19 @@ pub fn main() { // The expected arm type `Option` has one type parameter, while // the actual arm `Result` has two. typeck should not be // tricked into looking up a non-existing second type parameter. - let _x: usize = match Some(1us) { - Ok(u) => u, //~ ERROR mismatched types: expected `core::option::Option` - Err(e) => panic!(e) //~ ERROR mismatched types: expected `core::option::Option` + let _x: usize = match Some(1_usize) { + Ok(u) => u, + //~^ ERROR mismatched types + //~| expected `core::option::Option` + //~| found `core::result::Result<_, _>` + //~| expected enum `core::option::Option` + //~| found enum `core::result::Result` + + Err(e) => panic!(e) + //~^ ERROR mismatched types + //~| expected `core::option::Option` + //~| found `core::result::Result<_, _>` + //~| expected enum `core::option::Option` + //~| found enum `core::result::Result` }; } diff --git a/src/test/compile-fail/issue-13482-2.rs b/src/test/compile-fail/issue-13482-2.rs index ef7d3d4d15..86a79416c7 100644 --- a/src/test/compile-fail/issue-13482-2.rs +++ b/src/test/compile-fail/issue-13482-2.rs @@ -14,8 +14,11 @@ fn main() { let x = [1,2]; let y = match x { [] => None, - //~^ ERROR types: expected `[_#0i; 2]`, found `[_#7t; 0]` - // (expected array of 2 elements, found array of 0 elements) +//~^ ERROR mismatched types +//~| expected `[_#0i; 2]` +//~| found `[_#7t; 0]` +//~| expected an array with a fixed size of 2 elements +//~| found one with 0 elements [a,_] => Some(a) }; } diff --git a/src/test/compile-fail/issue-13482.rs b/src/test/compile-fail/issue-13482.rs index 157280b171..a345ce7961 100644 --- a/src/test/compile-fail/issue-13482.rs +++ b/src/test/compile-fail/issue-13482.rs @@ -12,8 +12,10 @@ fn main() { let x = [1,2]; let y = match x { [] => None, -//~^ ERROR types: expected `[_; 2]`, found `[_; 0]` -// (expected array of 2 elements, found array of 0 elements) + //~^ ERROR mismatched types + //~| expected `[_; 2]` + //~| found `[_; 0]` + //~| expected array with a fixed size of 2 elements [a,_] => Some(a) }; } diff --git a/src/test/compile-fail/issue-13497-2.rs b/src/test/compile-fail/issue-13497-2.rs index c7a8c87bb2..3171683749 100644 --- a/src/test/compile-fail/issue-13497-2.rs +++ b/src/test/compile-fail/issue-13497-2.rs @@ -11,7 +11,7 @@ fn read_lines_borrowed<'a>() -> Vec<&'a str> { let rawLines: Vec = vec!["foo ".to_string(), " bar".to_string()]; rawLines //~ ERROR `rawLines` does not live long enough - .iter().map(|l| l.as_slice().trim()).collect() + .iter().map(|l| l.trim()).collect() } fn main() {} diff --git a/src/test/compile-fail/issue-13497.rs b/src/test/compile-fail/issue-13497.rs index da8b93e3c9..d544a92d9c 100644 --- a/src/test/compile-fail/issue-13497.rs +++ b/src/test/compile-fail/issue-13497.rs @@ -12,7 +12,7 @@ fn read_lines_borrowed1() -> Vec< &str //~ ERROR missing lifetime specifier > { let rawLines: Vec = vec!["foo ".to_string(), " bar".to_string()]; - rawLines.iter().map(|l| l.as_slice().trim()).collect() + rawLines.iter().map(|l| l.trim()).collect() } fn main() {} diff --git a/src/test/compile-fail/issue-1362.rs b/src/test/compile-fail/issue-1362.rs index 28d16f9c0b..d51db47959 100644 --- a/src/test/compile-fail/issue-1362.rs +++ b/src/test/compile-fail/issue-1362.rs @@ -11,7 +11,7 @@ // Regression test for issue #1362 - without that fix the span will be bogus // no-reformat fn main() { - let x: usize = 20is; //~ ERROR mismatched types + let x: u32 = 20i32; //~ ERROR mismatched types } // NOTE: Do not add any extra lines as the line number the error is // on is significant; an error later in the source file might not diff --git a/src/test/compile-fail/issue-13624.rs b/src/test/compile-fail/issue-13624.rs index 83612823c5..2a5805790a 100644 --- a/src/test/compile-fail/issue-13624.rs +++ b/src/test/compile-fail/issue-13624.rs @@ -15,7 +15,11 @@ mod a { pub fn get_enum_struct_variant() -> () { Enum::EnumStructVariant { x: 1, y: 2, z: 3 } -//~^ ERROR mismatched types: expected `()`, found `a::Enum` (expected (), found enum a::Enum) + //~^ ERROR mismatched types + //~| expected `()` + //~| found `a::Enum` + //~| expected () + //~| found enum `a::Enum` } } @@ -27,8 +31,11 @@ mod b { let enum_struct_variant = ::a::get_enum_struct_variant(); match enum_struct_variant { a::Enum::EnumStructVariant { x, y, z } => { - //~^ ERROR mismatched types: expected `()`, found `a::Enum` - // (expected (), found enum a::Enum) + //~^ ERROR mismatched types + //~| expected `()` + //~| found `a::Enum` + //~| expected () + // found enum `a::Enum` } } } diff --git a/src/test/compile-fail/issue-13853-2.rs b/src/test/compile-fail/issue-13853-2.rs index ea0d880f4a..dc697e4784 100644 --- a/src/test/compile-fail/issue-13853-2.rs +++ b/src/test/compile-fail/issue-13853-2.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait FromStructReader<'a> { } +use std::marker::PhantomFn; + +trait FromStructReader<'a> : PhantomFn<(Self,&'a ())> { } trait ResponseHook { fn get<'a, T: FromStructReader<'a>>(&'a self); } diff --git a/src/test/compile-fail/issue-13853-3.rs b/src/test/compile-fail/issue-13853-3.rs index f10c47b594..7ca158c3e3 100644 --- a/src/test/compile-fail/issue-13853-3.rs +++ b/src/test/compile-fail/issue-13853-3.rs @@ -10,6 +10,8 @@ #![crate_type = "lib"] +use std::marker::PhantomData; + enum NodeContents<'a> { Children(Vec>), } @@ -22,11 +24,12 @@ impl<'a> Drop for NodeContents<'a> { struct Node<'a> { contents: NodeContents<'a>, + marker: PhantomData<&'a ()>, } impl<'a> Node<'a> { fn noName(contents: NodeContents<'a>) -> Node<'a> { - Node{ contents: contents,} + Node { contents: contents, marker: PhantomData } } } diff --git a/src/test/compile-fail/issue-13853.rs b/src/test/compile-fail/issue-13853.rs index 509ca9b80f..cd3f337c4a 100644 --- a/src/test/compile-fail/issue-13853.rs +++ b/src/test/compile-fail/issue-13853.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Node { +use std::marker::MarkerTrait; + +trait Node : MarkerTrait { fn zomg(); } @@ -32,7 +34,7 @@ impl Node for Stuff { fn iterate>(graph: &G) { for node in graph.iter() { //~ ERROR does not implement any method in scope named - node.zomg(); + node.zomg(); //~ error: the type of this value must be known in this context } } diff --git a/src/test/compile-fail/issue-14091.rs b/src/test/compile-fail/issue-14091.rs index c2ad09f5cb..3ceb465cb4 100644 --- a/src/test/compile-fail/issue-14091.rs +++ b/src/test/compile-fail/issue-14091.rs @@ -8,6 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: expected `bool`, found `_` (expected bool, found integral variable) +// error-pattern:mismatched types +// error-pattern:expected `bool` +// error-pattern:found `_` +// error-pattern:expected bool +// error-pattern:found integral variable fn main(){assert!(1,1);} diff --git a/src/test/compile-fail/issue-14285.rs b/src/test/compile-fail/issue-14285.rs index cbf4412a81..3a5df9e805 100644 --- a/src/test/compile-fail/issue-14285.rs +++ b/src/test/compile-fail/issue-14285.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Foo {} +trait Foo { + fn dummy(&self) { } +} struct A; diff --git a/src/test/compile-fail/issue-1448-2.rs b/src/test/compile-fail/issue-1448-2.rs index 371adf931b..ddfed3647c 100644 --- a/src/test/compile-fail/issue-1448-2.rs +++ b/src/test/compile-fail/issue-1448-2.rs @@ -10,8 +10,8 @@ // Regression test for issue #1448 and #1386 -fn foo(a: usize) -> usize { a } +fn foo(a: u32) -> u32 { a } fn main() { - println!("{}", foo(10is)); //~ ERROR mismatched types + println!("{}", foo(10i32)); //~ ERROR mismatched types } diff --git a/src/test/compile-fail/issue-14541.rs b/src/test/compile-fail/issue-14541.rs index ac49f8b99c..deb8f00cd0 100644 --- a/src/test/compile-fail/issue-14541.rs +++ b/src/test/compile-fail/issue-14541.rs @@ -13,8 +13,11 @@ struct vec3 { y: f32, z: f32 } fn make(v: vec2) { let vec3 { y: _, z: _ } = v; - //~^ ERROR mismatched types: expected `vec2`, found `vec3` - // (expected struct vec2, found struct vec3) + //~^ ERROR mismatched types + //~| expected `vec2` + //~| found `vec3` + //~| expected struct `vec2` + //~| found struct `vec3` } fn main() { } diff --git a/src/test/compile-fail/issue-14845.rs b/src/test/compile-fail/issue-14845.rs index 5166d84a02..d7ff6f2fe6 100644 --- a/src/test/compile-fail/issue-14845.rs +++ b/src/test/compile-fail/issue-14845.rs @@ -16,9 +16,17 @@ struct X { fn main() { let x = X { a: [0] }; let _f = &x.a as *mut u8; - //~^ ERROR mismatched types: expected `*mut u8`, found `&[u8; 1]` + //~^ ERROR mismatched types + //~| expected `*mut u8` + //~| found `&[u8; 1]` + //~| expected u8 + //~| found array of 1 elements let local = [0u8]; let _v = &local as *mut u8; - //~^ ERROR mismatched types: expected `*mut u8`, found `&[u8; 1]` + //~^ ERROR mismatched types + //~| expected `*mut u8` + //~| found `&[u8; 1]` + //~| expected u8, + //~| found array of 1 elements } diff --git a/src/test/compile-fail/issue-14853.rs b/src/test/compile-fail/issue-14853.rs index 3d8ebc1ecd..0b846651ac 100644 --- a/src/test/compile-fail/issue-14853.rs +++ b/src/test/compile-fail/issue-14853.rs @@ -8,20 +8,20 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::fmt::Show; +use std::fmt::Debug; +use std::marker::MarkerTrait; -trait Str {} +trait Str : MarkerTrait {} trait Something { - fn yay(_: Option, thing: &[T]); + fn yay(_: Option, thing: &[T]); } struct X { data: u32 } impl Something for X { fn yay(_:Option, thing: &[T]) { -//~^ ERROR in method `yay`, type parameter 0 requires bound `Str`, which is not required - + //~^ ERROR the requirement `T : Str` appears on the impl method } } diff --git a/src/test/compile-fail/issue-15094.rs b/src/test/compile-fail/issue-15094.rs index 5b33069b59..8f79022405 100644 --- a/src/test/compile-fail/issue-15094.rs +++ b/src/test/compile-fail/issue-15094.rs @@ -12,22 +12,24 @@ use std::{fmt, ops}; -struct Shower { +struct Debuger { x: T } -impl ops::Fn<(), ()> for Shower { +impl ops::Fn<(),> for Debuger { + type Output = (); + fn call(&self, _args: ()) { //~^ ERROR `call` has an incompatible type for trait: expected "rust-call" fn, found "Rust" fn println!("{:?}", self.x); } } -fn make_shower(x: T) -> Shower { - Shower { x: x } +fn make_shower(x: T) -> Debuger { + Debuger { x: x } } pub fn main() { - let show3 = make_shower(3is); + let show3 = make_shower(3); show3(); } diff --git a/src/test/compile-fail/issue-15167.rs b/src/test/compile-fail/issue-15167.rs index 630c35d6a4..7da1b9efd3 100644 --- a/src/test/compile-fail/issue-15167.rs +++ b/src/test/compile-fail/issue-15167.rs @@ -18,7 +18,7 @@ macro_rules! f { () => (n) } fn main() -> (){ - for n in range(0is, 1) { + for n in 0..1 { println!("{}", f!()); //~ ERROR unresolved name `n` } } diff --git a/src/test/compile-fail/issue-15381.rs b/src/test/compile-fail/issue-15381.rs index 6a26073be5..817e4ae165 100644 --- a/src/test/compile-fail/issue-15381.rs +++ b/src/test/compile-fail/issue-15381.rs @@ -14,7 +14,7 @@ fn main() { for [x,y,z] //~^ ERROR refutable pattern in `for` loop binding: `[]` not covered - in values.as_slice().chunks(3).filter(|&xs| xs.len() == 3) { + in values.chunks(3).filter(|&xs| xs.len() == 3) { println!("y={}", y); } } diff --git a/src/test/compile-fail/issue-15480.rs b/src/test/compile-fail/issue-15480.rs index 59d87b5277..30f58f909a 100644 --- a/src/test/compile-fail/issue-15480.rs +++ b/src/test/compile-fail/issue-15480.rs @@ -10,11 +10,11 @@ fn main() { let v = vec![ - &3is + &3 //~^ ERROR borrowed value does not live long enough ]; - for &&x in v.iter() { + for &&x in &v { println!("{}", x + 3); } } diff --git a/src/test/compile-fail/issue-15783.rs b/src/test/compile-fail/issue-15783.rs index 1b1b030238..13a5fa4b8a 100644 --- a/src/test/compile-fail/issue-15783.rs +++ b/src/test/compile-fail/issue-15783.rs @@ -14,7 +14,12 @@ pub fn foo(params: Option<&[&str]>) -> usize { fn main() { let name = "Foo"; - let msg = foo(Some(&[name.as_slice()])); -//~^ ERROR mismatched types: expected `core::option::Option<&[&str]>` + let x = Some(&[name]); + let msg = foo(x); +//~^ ERROR mismatched types +//~| expected `core::option::Option<&[&str]>` +//~| found `core::option::Option<&[&str; 1]>` +//~| expected slice +//~| found array of 1 elements assert_eq!(msg, 3); } diff --git a/src/test/compile-fail/issue-15896.rs b/src/test/compile-fail/issue-15896.rs index c4373ba335..7381ade263 100644 --- a/src/test/compile-fail/issue-15896.rs +++ b/src/test/compile-fail/issue-15896.rs @@ -19,8 +19,11 @@ fn main() { let u = match e { E::B( Tau{t: x}, - //~^ ERROR mismatched types: expected `main::R`, found `main::Tau` - // (expected enum main::R, found struct main::Tau) + //~^ ERROR mismatched types + //~| expected `main::R` + //~| found `main::Tau` + //~| expected enum `main::R` + //~| found struct `main::Tau` _) => x, }; } diff --git a/src/test/compile-fail/issue-16338.rs b/src/test/compile-fail/issue-16338.rs index f62bccb22f..ba936561ae 100644 --- a/src/test/compile-fail/issue-16338.rs +++ b/src/test/compile-fail/issue-16338.rs @@ -12,7 +12,10 @@ use std::raw::Slice; fn main() { let Slice { data: data, len: len } = "foo"; - //~^ ERROR mismatched types: expected `&str`, found `core::raw::Slice<_>` - // (expected &-ptr, found struct core::raw::Slice) + //~^ ERROR mismatched types + //~| expected `&str` + //~| found `core::raw::Slice<_>` + //~| expected &-ptr + //~| found struct `core::raw::Slice` } diff --git a/src/test/compile-fail/issue-16401.rs b/src/test/compile-fail/issue-16401.rs index 4890cc52c0..b943ef510d 100644 --- a/src/test/compile-fail/issue-16401.rs +++ b/src/test/compile-fail/issue-16401.rs @@ -13,8 +13,11 @@ use std::raw::Slice; fn main() { match () { Slice { data: data, len: len } => (), - //~^ ERROR mismatched types: expected `()`, found `core::raw::Slice<_>` - // (expected (), found struct core::raw::Slice) + //~^ ERROR mismatched types + //~| expected `()` + //~| found `core::raw::Slice<_>` + //~| expected () + //~| found struct `core::raw::Slice` _ => unreachable!() } } diff --git a/src/test/compile-fail/issue-16538.rs b/src/test/compile-fail/issue-16538.rs index a6b73dcc19..6d2cfcab04 100644 --- a/src/test/compile-fail/issue-16538.rs +++ b/src/test/compile-fail/issue-16538.rs @@ -20,6 +20,7 @@ mod Y { static foo: *const Y::X = Y::foo(Y::x as *const Y::X); //~^ ERROR cannot refer to other statics by value -//~| ERROR: the trait `core::marker::Sync` is not implemented for the type +//~| ERROR the trait `core::marker::Sync` is not implemented for the type +//~| ERROR function calls in statics are limited to struct and enum constructors fn main() {} diff --git a/src/test/compile-fail/issue-16747.rs b/src/test/compile-fail/issue-16747.rs index 814b885e3a..a213234b89 100644 --- a/src/test/compile-fail/issue-16747.rs +++ b/src/test/compile-fail/issue-16747.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait ListItem<'a> { +use std::marker::MarkerTrait; + +trait ListItem<'a> : MarkerTrait { fn list_name() -> &'a str; } diff --git a/src/test/compile-fail/issue-16939.rs b/src/test/compile-fail/issue-16939.rs index 9d2212b69c..7ec3fef5c8 100644 --- a/src/test/compile-fail/issue-16939.rs +++ b/src/test/compile-fail/issue-16939.rs @@ -14,7 +14,7 @@ // wrong arity. fn _foo (f: F) { - |&: t| f(t); //~ ERROR E0057 + |t| f(t); //~ ERROR E0057 } fn main() {} diff --git a/src/test/compile-fail/issue-17033.rs b/src/test/compile-fail/issue-17033.rs index 5048a9aa91..6010e20692 100644 --- a/src/test/compile-fail/issue-17033.rs +++ b/src/test/compile-fail/issue-17033.rs @@ -11,7 +11,11 @@ #![feature(overloaded_calls)] fn f<'r>(p: &'r mut fn(p: &mut ())) { - (*p)(()) //~ ERROR mismatched types: expected `&mut ()`, found `()` + (*p)(()) //~ ERROR mismatched types + //~| expected `&mut ()` + //~| found `()` + //~| expected &-ptr + //~| found () } fn main() {} diff --git a/src/test/compile-fail/issue-17283.rs b/src/test/compile-fail/issue-17283.rs index 0c9fd9d948..6573137909 100644 --- a/src/test/compile-fail/issue-17283.rs +++ b/src/test/compile-fail/issue-17283.rs @@ -16,22 +16,34 @@ struct Foo { } fn main() { - let x = 1us; + let x = 1_usize; let y: Foo; // `x { ... }` should not be interpreted as a struct literal here if x = x { - //~^ ERROR mismatched types: expected `bool`, found `()` (expected bool, found ()) + //~^ ERROR mismatched types + //~| expected `bool` + //~| found `()` + //~| expected bool + //~| found () println!("{}", x); } // Explicit parentheses on the left should match behavior of above if (x = x) { - //~^ ERROR mismatched types: expected `bool`, found `()` (expected bool, found ()) + //~^ ERROR mismatched types + //~| expected `bool` + //~| found `()` + //~| expected bool + //~| found () println!("{}", x); } // The struct literal interpretation is fine with explicit parentheses on the right if y = (Foo { foo: x }) { - //~^ ERROR mismatched types: expected `bool`, found `()` (expected bool, found ()) + //~^ ERROR mismatched types + //~| expected `bool` + //~| found `()` + //~| expected bool + //~| found () println!("{}", x); } } diff --git a/src/test/compile-fail/issue-17337.rs b/src/test/compile-fail/issue-17337.rs index 24425e5eee..ff640793af 100644 --- a/src/test/compile-fail/issue-17337.rs +++ b/src/test/compile-fail/issue-17337.rs @@ -8,13 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(staged_api)] #![staged_api] #![deny(deprecated)] struct Foo; impl Foo { - #[deprecated] + #[unstable(feature = "test_feature")] + #[deprecated(since = "1.0.0")] fn foo(self) {} } diff --git a/src/test/compile-fail/issue-17385.rs b/src/test/compile-fail/issue-17385.rs index 38278c524c..eb293c7924 100644 --- a/src/test/compile-fail/issue-17385.rs +++ b/src/test/compile-fail/issue-17385.rs @@ -23,10 +23,10 @@ impl Drop for Enum { } fn main() { - let foo = X(1is); + let foo = X(1); drop(foo); match foo { //~ ERROR use of moved value - X(1is) => (), + X(1) => (), _ => unreachable!() } diff --git a/src/test/compile-fail/issue-17405.rs b/src/test/compile-fail/issue-17405.rs index 63120e85b0..de8a4f6347 100644 --- a/src/test/compile-fail/issue-17405.rs +++ b/src/test/compile-fail/issue-17405.rs @@ -13,7 +13,7 @@ enum Foo { } fn main() { - match Foo::Bar(1is) { + match Foo::Bar(1) { Foo { i } => () //~ ERROR `Foo` does not name a struct or a struct variant } } diff --git a/src/test/compile-fail/issue-17431-4.rs b/src/test/compile-fail/issue-17431-4.rs index 1e27f02556..22aaa796ad 100644 --- a/src/test/compile-fail/issue-17431-4.rs +++ b/src/test/compile-fail/issue-17431-4.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct Foo { foo: Option>> } +use std::marker; + +struct Foo { foo: Option>>, marker: marker::PhantomData } //~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable impl Foo { fn bar(&self) {} } diff --git a/src/test/compile-fail/issue-17431-5.rs b/src/test/compile-fail/issue-17431-5.rs index d22d79ecaa..cc9cc2e3c0 100644 --- a/src/test/compile-fail/issue-17431-5.rs +++ b/src/test/compile-fail/issue-17431-5.rs @@ -8,8 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::marker; + struct Foo { foo: Bar } -struct Bar { x: Bar } +struct Bar { x: Bar , marker: marker::PhantomData } //~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable impl Foo { fn foo(&self) {} } diff --git a/src/test/compile-fail/issue-17441.rs b/src/test/compile-fail/issue-17441.rs index e9e69dadd3..321b8b260d 100644 --- a/src/test/compile-fail/issue-17441.rs +++ b/src/test/compile-fail/issue-17441.rs @@ -11,16 +11,16 @@ #![feature(box_syntax)] fn main() { - let _foo = &[1us, 2] as [usize]; + let _foo = &[1_usize, 2] as [usize]; //~^ ERROR cast to unsized type: `&[usize; 2]` as `[usize]` //~^^ HELP consider using an implicit coercion to `&[usize]` instead - let _bar = box 1us as std::fmt::Show; + let _bar = box 1_usize as std::fmt::Show; //~^ ERROR cast to unsized type: `Box` as `core::fmt::Show` //~^^ HELP did you mean `Box`? - let _baz = 1us as std::fmt::Show; + let _baz = 1_usize as std::fmt::Show; //~^ ERROR cast to unsized type: `usize` as `core::fmt::Show` //~^^ HELP consider using a box or reference as appropriate - let _quux = [1us, 2] as [usize]; + let _quux = [1_usize, 2] as [usize]; //~^ ERROR cast to unsized type: `[usize; 2]` as `[usize]` //~^^ HELP consider using a box or reference as appropriate } diff --git a/src/test/compile-fail/issue-17458.rs b/src/test/compile-fail/issue-17458.rs index d9fd67f919..d6f70ae1e5 100644 --- a/src/test/compile-fail/issue-17458.rs +++ b/src/test/compile-fail/issue-17458.rs @@ -9,7 +9,7 @@ // except according to those terms. static X: usize = 0 as *const usize as usize; -//~^ ERROR: can not cast a pointer to an integer in a constant expression +//~^ ERROR: can not cast a pointer to an integer in statics fn main() { assert_eq!(X, 0); diff --git a/src/test/compile-fail/issue-17545.rs b/src/test/compile-fail/issue-17545.rs index 0501a3013c..84800218ef 100644 --- a/src/test/compile-fail/issue-17545.rs +++ b/src/test/compile-fail/issue-17545.rs @@ -10,7 +10,7 @@ #![feature(unboxed_closures)] -pub fn foo<'a, F: Fn<(&'a (),), ()>>(bar: F) { +pub fn foo<'a, F: Fn(&'a ())>(bar: F) { bar.call(( &(), //~ ERROR borrowed value does not live long enough )); diff --git a/src/test/compile-fail/issue-17551.rs b/src/test/compile-fail/issue-17551.rs index 3889b6f4f7..5781cb7411 100644 --- a/src/test/compile-fail/issue-17551.rs +++ b/src/test/compile-fail/issue-17551.rs @@ -10,9 +10,11 @@ #![feature(unboxed_closures)] -struct B; +use std::marker; + +struct B(marker::PhantomData); fn main() { - let foo = B; - let closure = |:| foo; //~ ERROR unable to infer enough type information + let foo = B(marker::PhantomData); //~ ERROR unable to infer enough type information + let closure = || foo; } diff --git a/src/test/compile-fail/issue-17651.rs b/src/test/compile-fail/issue-17651.rs index fbecd0487b..172f37af83 100644 --- a/src/test/compile-fail/issue-17651.rs +++ b/src/test/compile-fail/issue-17651.rs @@ -14,7 +14,7 @@ #![feature(box_syntax)] fn main() { - (|&:| box *[0us].as_slice())(); + (|| box *[0_usize].as_slice())(); //~^ ERROR cannot move out of borrowed content //~^^ ERROR cannot move a value of type [usize] } diff --git a/src/test/compile-fail/issue-17718-const-bad-values.rs b/src/test/compile-fail/issue-17718-const-bad-values.rs index daa250d12f..2347d3f3d5 100644 --- a/src/test/compile-fail/issue-17718-const-bad-values.rs +++ b/src/test/compile-fail/issue-17718-const-bad-values.rs @@ -9,12 +9,12 @@ // except according to those terms. const C1: &'static mut [usize] = &mut []; -//~^ ERROR: constants are not allowed to have mutable references +//~^ ERROR: references in constants may only refer to immutable values static mut S: usize = 3; const C2: &'static mut usize = &mut S; //~^ ERROR: constants cannot refer to other statics -//~^^ ERROR: are not allowed to have mutable references +//~^^ ERROR: references in constants may only refer to immutable values fn main() {} diff --git a/src/test/compile-fail/issue-17718-const-naming.rs b/src/test/compile-fail/issue-17718-const-naming.rs index 15f66493f8..06719e2756 100644 --- a/src/test/compile-fail/issue-17718-const-naming.rs +++ b/src/test/compile-fail/issue-17718-const-naming.rs @@ -11,7 +11,7 @@ #[deny(warnings)] const foo: isize = 3; -//~^ ERROR: should have an uppercase name such as +//~^ ERROR: should have an upper case name such as //~^^ ERROR: constant item is never used fn main() {} diff --git a/src/test/compile-fail/issue-17718-patterns.rs b/src/test/compile-fail/issue-17718-patterns.rs index 6c4d087470..b7f58791bf 100644 --- a/src/test/compile-fail/issue-17718-patterns.rs +++ b/src/test/compile-fail/issue-17718-patterns.rs @@ -13,7 +13,7 @@ static mut A2: usize = 1; const A3: usize = 1; fn main() { - match 1us { + match 1_usize { A1 => {} //~ ERROR: static variables cannot be referenced in a pattern A2 => {} //~ ERROR: static variables cannot be referenced in a pattern A3 => {} diff --git a/src/test/compile-fail/issue-17718-static-sync.rs b/src/test/compile-fail/issue-17718-static-sync.rs index 394a9cc69b..fa8035a796 100644 --- a/src/test/compile-fail/issue-17718-static-sync.rs +++ b/src/test/compile-fail/issue-17718-static-sync.rs @@ -8,12 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::marker; +#![feature(optin_builtin_traits)] -struct Foo { marker: marker::NoSync } +use std::marker::Sync; + +struct Foo; +impl !Sync for Foo {} static FOO: usize = 3; -static BAR: Foo = Foo { marker: marker::NoSync }; +static BAR: Foo = Foo; //~^ ERROR: the trait `core::marker::Sync` is not implemented fn main() {} diff --git a/src/test/compile-fail/issue-17728.rs b/src/test/compile-fail/issue-17728.rs index 66ef7b807f..83e52216be 100644 --- a/src/test/compile-fail/issue-17728.rs +++ b/src/test/compile-fail/issue-17728.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::fmt::{Show, Formatter, Error}; +use std::fmt::{Debug, Formatter, Error}; use std::collections::HashMap; trait HasInventory { @@ -30,7 +30,7 @@ trait TraversesWorld { } -#[derive(Show, Eq, PartialEq, Hash)] +#[derive(Debug, Eq, PartialEq, Hash)] enum RoomDirection { West, East, @@ -97,10 +97,10 @@ impl Player { impl TraversesWorld for Player { } -impl Show for Player { +impl Debug for Player { fn fmt(&self, formatter: &mut Formatter) -> Result<(), Error> { formatter.write_str("Player{ name:"); - formatter.write_str(self.name.as_slice()); + formatter.write_str(&self.name); formatter.write_str(" }"); Ok(()) } diff --git a/src/test/compile-fail/issue-17740.rs b/src/test/compile-fail/issue-17740.rs index 73f86fee90..b4791eba76 100644 --- a/src/test/compile-fail/issue-17740.rs +++ b/src/test/compile-fail/issue-17740.rs @@ -14,8 +14,14 @@ struct Foo<'a> { impl <'a> Foo<'a>{ fn bar(self: &mut Foo) { - //~^ mismatched types: expected `Foo<'a>`, found `Foo<'_>` (lifetime mismatch) - //~| mismatched types: expected `Foo<'a>`, found `Foo<'_>` (lifetime mismatch) + //~^ mismatched types + //~| expected `Foo<'a>` + //~| found `Foo<'_>` + //~| lifetime mismatch + //~| mismatched types + //~| expected `Foo<'a>` + //~| found `Foo<'_>` + //~| lifetime mismatch } } diff --git a/src/test/compile-fail/issue-17800.rs b/src/test/compile-fail/issue-17800.rs index 89611e4f3f..5196b6ea87 100644 --- a/src/test/compile-fail/issue-17800.rs +++ b/src/test/compile-fail/issue-17800.rs @@ -14,8 +14,8 @@ enum MyOption { } fn main() { - match MyOption::MySome(42is) { - MyOption::MySome { x: 42is } => (), + match MyOption::MySome(42) { + MyOption::MySome { x: 42 } => (), //~^ ERROR `MyOption::MySome` does not name a struct or a struct variant _ => (), } diff --git a/src/test/compile-fail/deriving-span-Rand-enum.rs b/src/test/compile-fail/issue-17904-2.rs similarity index 71% rename from src/test/compile-fail/deriving-span-Rand-enum.rs rename to src/test/compile-fail/issue-17904-2.rs index dcfdbdc806..a33ec23a16 100644 --- a/src/test/compile-fail/deriving-span-Rand-enum.rs +++ b/src/test/compile-fail/issue-17904-2.rs @@ -8,18 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' +// Test that we can parse a unit struct with a where clause, even if +// it leads to a error later on since `T` is unused. -extern crate rand; - - -struct Error; - -#[derive(Rand)] -enum Enum { - A( - Error //~ ERROR - ) -} +struct Foo where T: Copy; //~ ERROR parameter `T` is never used fn main() {} diff --git a/src/test/compile-fail/issue-17905.rs b/src/test/compile-fail/issue-17905.rs index 1418cdf403..eabdb36a7e 100644 --- a/src/test/compile-fail/issue-17905.rs +++ b/src/test/compile-fail/issue-17905.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(Show)] +#[derive(Debug)] struct Pair (T, V); impl Pair< @@ -16,12 +16,15 @@ impl Pair< isize > { fn say(self: &Pair<&str, isize>) { -//~^ ERROR mismatched types: expected `Pair<&'static str, isize>`, found `Pair<&str, isize>` +//~^ ERROR mismatched types +//~| expected `Pair<&'static str, isize>` +//~| found `Pair<&str, isize>` +//~| lifetime mismatch println!("{}", self); } } fn main() { - let result = &Pair("shane", 1is); + let result = &Pair("shane", 1); result.say(); } diff --git a/src/test/compile-fail/issue-17913.rs b/src/test/compile-fail/issue-17913.rs index 56cd544b3c..8035cffabd 100644 --- a/src/test/compile-fail/issue-17913.rs +++ b/src/test/compile-fail/issue-17913.rs @@ -13,16 +13,16 @@ #![feature(box_syntax)] -#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))] +#[cfg(target_pointer_width = "64")] fn main() { - let n = 0us; - let a = box [&n; 0xF000000000000000us]; - println!("{}", a[0xFFFFFFu]); + let n = 0_usize; + let a = box [&n; 0xF000000000000000_usize]; + println!("{}", a[0xFFFFFF_usize]); } -#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))] +#[cfg(target_pointer_width = "32")] fn main() { - let n = 0us; - let a = box [&n; 0xFFFFFFFFu]; - println!("{}", a[0xFFFFFFu]); + let n = 0_usize; + let a = box [&n; 0xFFFFFFFF_usize]; + println!("{}", a[0xFFFFFF_usize]); } diff --git a/src/test/compile-fail/issue-17933.rs b/src/test/compile-fail/issue-17933.rs index 47f8d75250..bd04740849 100644 --- a/src/test/compile-fail/issue-17933.rs +++ b/src/test/compile-fail/issue-17933.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub static X: usize = 1us; +pub static X: usize = 1_usize; fn main() { - match 1us { + match 1_usize { self::X => { }, //~^ ERROR static variables cannot be referenced in a pattern, use a `const` instead _ => { }, diff --git a/src/test/compile-fail/issue-17999.rs b/src/test/compile-fail/issue-17999.rs index 5726960f66..88945f80ea 100644 --- a/src/test/compile-fail/issue-17999.rs +++ b/src/test/compile-fail/issue-17999.rs @@ -11,7 +11,7 @@ #![deny(unused_variables)] fn main() { - for _ in range(1is, 101) { + for _ in 1..101 { let x = (); //~ ERROR: unused variable: `x` match () { a => {} //~ ERROR: unused variable: `a` diff --git a/src/test/compile-fail/issue-18107.rs b/src/test/compile-fail/issue-18107.rs index 83427e8aa6..d5fb22bdeb 100644 --- a/src/test/compile-fail/issue-18107.rs +++ b/src/test/compile-fail/issue-18107.rs @@ -8,15 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::marker::MarkerTrait; - -pub trait AbstractRenderer {} +pub trait AbstractRenderer : MarkerTrait {} fn _create_render(_: &()) -> AbstractRenderer //~^ ERROR: the trait `core::marker::Sized` is not implemented { - match 0us { + match 0_usize { _ => unimplemented!() } } diff --git a/src/test/compile-fail/issue-18118.rs b/src/test/compile-fail/issue-18118.rs index 129f28f1d8..c5370879cc 100644 --- a/src/test/compile-fail/issue-18118.rs +++ b/src/test/compile-fail/issue-18118.rs @@ -9,9 +9,10 @@ // except according to those terms. pub fn main() { - static z: &'static isize = { + const z: &'static isize = { let p = 3; + //~^ ERROR blocks in constants are limited to items and tail expressions &p -//~^ ERROR cannot borrow a local variable inside a static block, define a separate static instead + //~^ ERROR paths in constants may only refer to constants or functions }; } diff --git a/src/test/compile-fail/issue-18252.rs b/src/test/compile-fail/issue-18252.rs index 822c86d1d3..54c51405bd 100644 --- a/src/test/compile-fail/issue-18252.rs +++ b/src/test/compile-fail/issue-18252.rs @@ -13,5 +13,5 @@ enum Foo { } fn main() { - let f = Foo::Variant(42us); //~ ERROR uses it like a function + let f = Foo::Variant(42_usize); //~ ERROR uses it like a function } diff --git a/src/test/compile-fail/issue-18389.rs b/src/test/compile-fail/issue-18389.rs index 37bb1cb191..20323e9900 100644 --- a/src/test/compile-fail/issue-18389.rs +++ b/src/test/compile-fail/issue-18389.rs @@ -11,7 +11,7 @@ #![feature(unboxed_closures)] use std::any::Any; -use std::intrinsics::TypeId; +use std::any::TypeId; pub trait Pt {} pub trait Rt {} diff --git a/src/test/compile-fail/issue-18400.rs b/src/test/compile-fail/issue-18400.rs index a6662e78f3..015f1fa603 100644 --- a/src/test/compile-fail/issue-18400.rs +++ b/src/test/compile-fail/issue-18400.rs @@ -22,7 +22,7 @@ impl<'a, T, S> Set<&'a [T]> for S where } fn set(&mut self, bits: &[T]) { - for &bit in bits.iter() { + for &bit in bits { self.set(bit) } } @@ -32,5 +32,8 @@ fn main() { let bits: &[_] = &[0, 1]; 0.contains(bits); -//~^ ERROR the trait `Set<_>` is not implemented for the type `_` + //~^ ERROR overflow + //~| ERROR overflow + //~| ERROR overflow + //~| ERROR mismatched types } diff --git a/src/test/compile-fail/issue-18566.rs b/src/test/compile-fail/issue-18566.rs index 85dda340d1..dd3844b1a0 100644 --- a/src/test/compile-fail/issue-18566.rs +++ b/src/test/compile-fail/issue-18566.rs @@ -28,7 +28,7 @@ impl Tr for usize { } fn main() { - let s = &mut 1us; + let s = &mut 1_usize; MyPtr(s).poke(s); //~^ ERROR cannot borrow `*s` as mutable more than once at a time diff --git a/src/test/compile-fail/issue-18611.rs b/src/test/compile-fail/issue-18611.rs index a662e9ca98..e81a576fa6 100644 --- a/src/test/compile-fail/issue-18611.rs +++ b/src/test/compile-fail/issue-18611.rs @@ -8,11 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::marker::MarkerTrait; + fn add_state(op: ::State) { //~^ ERROR the trait `HasState` is not implemented for the type `isize` } -trait HasState { +trait HasState : MarkerTrait { type State; } diff --git a/src/test/compile-fail/issue-18783.rs b/src/test/compile-fail/issue-18783.rs index bed835d9bd..13908bda9d 100644 --- a/src/test/compile-fail/issue-18783.rs +++ b/src/test/compile-fail/issue-18783.rs @@ -13,19 +13,20 @@ use std::cell::RefCell; fn main() { + let mut y = 1_usize; let c = RefCell::new(vec![]); - let mut y = 1us; c.push(box || y = 0); c.push(box || y = 0); //~^ ERROR cannot borrow `y` as mutable more than once at a time } fn ufcs() { + let mut y = 1_usize; let c = RefCell::new(vec![]); - let mut y = 1us; Push::push(&c, box || y = 0); Push::push(&c, box || y = 0); +//~^ ERROR cannot borrow `y` as mutable more than once at a time } trait Push<'c> { diff --git a/src/test/compile-fail/issue-18819.rs b/src/test/compile-fail/issue-18819.rs index 3a9de74104..951d78410b 100644 --- a/src/test/compile-fail/issue-18819.rs +++ b/src/test/compile-fail/issue-18819.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Foo { +use std::marker::MarkerTrait; + +trait Foo : MarkerTrait { type Item; } diff --git a/src/test/compile-fail/issue-18959.rs b/src/test/compile-fail/issue-18959.rs index e174fb9b7a..368f3c16f5 100644 --- a/src/test/compile-fail/issue-18959.rs +++ b/src/test/compile-fail/issue-18959.rs @@ -17,7 +17,7 @@ impl Foo for Thing { fn foo(&self, _: &T) {} } -#[inline(never)] fn foo(b: &Bar) { b.foo(&0us) } +#[inline(never)] fn foo(b: &Bar) { b.foo(&0_usize) } fn main() { let mut thing = Thing; diff --git a/src/test/compile-fail/issue-1962.rs b/src/test/compile-fail/issue-1962.rs index 44abfca165..db3e9c23b7 100644 --- a/src/test/compile-fail/issue-1962.rs +++ b/src/test/compile-fail/issue-1962.rs @@ -10,9 +10,9 @@ // compile-flags: -D while-true fn main() { - let mut i = 0is; + let mut i = 0; while true { //~ ERROR denote infinite loops with loop - i += 1is; - if i == 5is { break; } + i += 1; + if i == 5 { break; } } } diff --git a/src/test/compile-fail/issue-19660.rs b/src/test/compile-fail/issue-19660.rs new file mode 100644 index 0000000000..77aba7335b --- /dev/null +++ b/src/test/compile-fail/issue-19660.rs @@ -0,0 +1,26 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// error-pattern: requires `copy` lang_item + +#![feature(lang_items, start, no_std)] +#![no_std] + +#[lang="phantom_fn"] +trait PhantomFn { } +impl PhantomFn for U { } + +#[lang = "sized"] +trait Sized : PhantomFn {} + +#[start] +fn main(_: int, _: *const *const u8) -> int { + 0 +} diff --git a/src/test/compile-fail/issue-19991.rs b/src/test/compile-fail/issue-19991.rs index 0f1dbfa349..2d73b98ec1 100644 --- a/src/test/compile-fail/issue-19991.rs +++ b/src/test/compile-fail/issue-19991.rs @@ -12,7 +12,11 @@ // clause does not exist, instead of the unsympathetic "match arms have incompatible types" fn main() { - if let Some(homura) = Some("madoka") { //~ ERROR missing an else clause: expected `()` + if let Some(homura) = Some("madoka") { //~ ERROR missing an else clause + //~| expected `()` + //~| found `i32` + //~| expected () + //~| found i32 765i32 }; } diff --git a/src/test/compile-fail/issue-20427.rs b/src/test/compile-fail/issue-20427.rs new file mode 100644 index 0000000000..96d4fae8b0 --- /dev/null +++ b/src/test/compile-fail/issue-20427.rs @@ -0,0 +1,66 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:i8.rs +extern crate i8; +use std::string as i16; +static i32: i32 = 0; +const i64: i64 = 0; +fn u8(f32: f32) {} +fn f(f64: f64) {} +//~^ ERROR user-defined types or type parameters cannot shadow the primitive types +type u16 = u16; //~ ERROR user-defined types or type parameters cannot shadow the primitive types +enum u32 {} //~ ERROR user-defined types or type parameters cannot shadow the primitive types +struct u64; //~ ERROR user-defined types or type parameters cannot shadow the primitive types +trait bool {} //~ ERROR user-defined types or type parameters cannot shadow the primitive types + +mod char { + extern crate i8; + static i32_: i32 = 0; + const i64_: i64 = 0; + fn u8_(f32: f32) {} + fn f_(f64: f64_) {} + type u16_ = u16; + enum u32_ {} + struct u64_; + trait bool_ {} + mod char_ {} + + mod str { + use super::i8 as i8; + use super::i32_ as i32; + use super::i64_ as i64; + use super::u8_ as u8; + use super::f_ as f64; + use super::u16_ as u16; + //~^ ERROR user-defined types or type parameters cannot shadow the primitive types + use super::u32_ as u32; + //~^ ERROR user-defined types or type parameters cannot shadow the primitive types + use super::u64_ as u64; + //~^ ERROR user-defined types or type parameters cannot shadow the primitive types + use super::bool_ as bool; + //~^ ERROR user-defined types or type parameters cannot shadow the primitive types + use super::char_ as char; + } +} + +trait isize_ { + type isize; //~ ERROR user-defined types or type parameters cannot shadow the primitive types +} + +fn usize<'usize>(usize: &'usize usize) -> &'usize usize { usize } + +fn main() { + let bool = true; + match bool { + str @ true => if str { i32 as i64 } else { 0 }, + false => i64, + } +} diff --git a/src/test/compile-fail/issue-20605.rs b/src/test/compile-fail/issue-20605.rs new file mode 100644 index 0000000000..87b7616db8 --- /dev/null +++ b/src/test/compile-fail/issue-20605.rs @@ -0,0 +1,19 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn changer<'a>(mut things: Box>) { + for item in *things { *item = 0 } +//~^ ERROR the trait `core::marker::Sized` is not implemented for the type `core::iter::Iterator +//~^^ ERROR +//~^^^ ERROR +// FIXME(#21528) error should be reported once, not thrice +} + +fn main() {} diff --git a/src/test/compile-fail/issue-2063.rs b/src/test/compile-fail/issue-2063.rs index 00607f8503..aed395d17e 100644 --- a/src/test/compile-fail/issue-2063.rs +++ b/src/test/compile-fail/issue-2063.rs @@ -12,10 +12,11 @@ // cause compiler to loop. Note that no instances // of such a type could ever be constructed. +use std::marker::MarkerTrait; struct t(Box); //~ ERROR this type cannot be instantiated -trait to_str_2 { +trait to_str_2 : MarkerTrait { fn my_to_string() -> String; } diff --git a/src/test/compile-fail/issue-20801.rs b/src/test/compile-fail/issue-20801.rs new file mode 100644 index 0000000000..929c8ec0fd --- /dev/null +++ b/src/test/compile-fail/issue-20801.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// We used to ICE when moving out of a `*mut T` or `*const T`. + +struct T(u8); + +static mut GLOBAL_MUT_T: T = T(0); + +static GLOBAL_T: T = T(0); + +fn imm_ref() -> &'static T { + unsafe { &GLOBAL_T } +} + +fn mut_ref() -> &'static mut T { + unsafe { &mut GLOBAL_MUT_T } +} + +fn mut_ptr() -> *mut T { + unsafe { 0u8 as *mut T } +} + +fn const_ptr() -> *const T { + unsafe { 0u8 as *const T } +} + +pub fn main() { + let a = unsafe { *mut_ref() }; + //~^ ERROR cannot move out of borrowed content + + let b = unsafe { *imm_ref() }; + //~^ ERROR cannot move out of borrowed content + + let c = unsafe { *mut_ptr() }; + //~^ ERROR cannot move out of dereference of unsafe pointer + + let d = unsafe { *const_ptr() }; + //~^ ERROR cannot move out of dereference of unsafe pointer +} diff --git a/src/test/compile-fail/issue-20831-debruijn.rs b/src/test/compile-fail/issue-20831-debruijn.rs new file mode 100644 index 0000000000..5b623ac377 --- /dev/null +++ b/src/test/compile-fail/issue-20831-debruijn.rs @@ -0,0 +1,50 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Regression test for #20831: debruijn index account was thrown off +// by the (anonymous) lifetime in `::Output` +// below. Note that changing to a named lifetime made the problem go +// away. + +use std::cell::RefCell; +use std::marker::MarkerTrait; +use std::ops::{Shl, Shr}; + +pub trait Subscriber : MarkerTrait { + type Input; +} + +pub trait Publisher<'a> { + type Output; + fn subscribe(&mut self, Box + 'a>); +} + +pub trait Processor<'a> : Subscriber + Publisher<'a> { } + +impl<'a, P> Processor<'a> for P where P : Subscriber + Publisher<'a> { } + +struct MyStruct<'a> { + sub: Box + 'a> +} + +impl<'a> Publisher<'a> for MyStruct<'a> { + type Output = u64; + fn subscribe(&mut self, t : Box::Output> + 'a>) { + // Not obvious, but there is an implicit lifetime here -------^ + //~^^ ERROR cannot infer + // + // The fact that `Publisher` is using an implicit lifetime is + // what was causing the debruijn accounting to be off, so + // leave it that way! + self.sub = t; + } +} + +fn main() {} diff --git a/src/test/compile-fail/issue-21045.rs b/src/test/compile-fail/issue-21045.rs new file mode 100644 index 0000000000..134240f8c8 --- /dev/null +++ b/src/test/compile-fail/issue-21045.rs @@ -0,0 +1,16 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +#![feature(asm)] + +fn main() { + let a; + asm!("nop" "nop"); //~ ERROR malformed inline assembly + asm!("nop" "nop" : "=r"(a)); //~ ERROR malformed inline assembly +} diff --git a/src/test/compile-fail/issue-21146.rs b/src/test/compile-fail/issue-21146.rs new file mode 100644 index 0000000000..4c6059c132 --- /dev/null +++ b/src/test/compile-fail/issue-21146.rs @@ -0,0 +1,13 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// error-pattern: expected item, found `parse_error` +include!("../auxiliary/issue-21146-inc.rs"); +fn main() {} diff --git a/src/test/compile-fail/issue-21160.rs b/src/test/compile-fail/issue-21160.rs new file mode 100644 index 0000000000..557bf518a3 --- /dev/null +++ b/src/test/compile-fail/issue-21160.rs @@ -0,0 +1,21 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Bar; + +impl Bar { + fn hash(&self, _: T) {} +} + +#[derive(Hash)] +struct Foo(Bar); +//~^ error: the trait `core::hash::Hash` is not implemented for the type `Bar` + +fn main() {} diff --git a/src/test/compile-fail/issue-21202.rs b/src/test/compile-fail/issue-21202.rs new file mode 100644 index 0000000000..5c1de6dfc5 --- /dev/null +++ b/src/test/compile-fail/issue-21202.rs @@ -0,0 +1,25 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:issue-21202.rs + +extern crate "issue-21202" as crate1; + +use crate1::A; + +mod B { + use crate1::A::Foo; + fn bar(f: Foo) { + Foo::foo(&f); + //~^ ERROR: function `foo` is private + } +} + +fn main() { } diff --git a/src/test/compile-fail/issue-21356.rs b/src/test/compile-fail/issue-21356.rs new file mode 100644 index 0000000000..fefd432e22 --- /dev/null +++ b/src/test/compile-fail/issue-21356.rs @@ -0,0 +1,14 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +macro_rules! test { ($wrong:t_ty ..) => () } + //~^ ERROR: invalid fragment specifier `t_ty` + +fn main() {} diff --git a/src/test/compile-fail/issue-2149.rs b/src/test/compile-fail/issue-2149.rs index 691660f897..37dbcaf39b 100644 --- a/src/test/compile-fail/issue-2149.rs +++ b/src/test/compile-fail/issue-2149.rs @@ -15,11 +15,11 @@ trait vec_monad { impl vec_monad for Vec { fn bind(&self, mut f: F) where F: FnMut(A) -> Vec { let mut r = panic!(); - for elt in self.iter() { r = r + f(*elt); } - //~^ ERROR the type of this value must be known + for elt in self { r = r + f(*elt); } + //~^ ERROR binary operation `+` cannot be applied to type `collections::vec::Vec` } } fn main() { - ["hi"].bind(|&mut: x| [x] ); + ["hi"].bind(|x| [x] ); //~^ ERROR type `[&str; 1]` does not implement any method in scope named `bind` } diff --git a/src/test/compile-fail/issue-2150.rs b/src/test/compile-fail/issue-2150.rs index f18db94acf..505885e6c4 100644 --- a/src/test/compile-fail/issue-2150.rs +++ b/src/test/compile-fail/issue-2150.rs @@ -15,7 +15,7 @@ fn fail_len(v: Vec ) -> usize { let mut i = 3; panic!(); - for x in v.iter() { i += 1us; } + for x in &v { i += 1_usize; } //~^ ERROR: unreachable statement return i; } diff --git a/src/test/compile-fail/issue-21554.rs b/src/test/compile-fail/issue-21554.rs new file mode 100644 index 0000000000..a2cac55033 --- /dev/null +++ b/src/test/compile-fail/issue-21554.rs @@ -0,0 +1,15 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Inches(i32); + +fn main() { + Inches as f32; //~ ERROR illegal cast; cast through an integer first +} diff --git a/src/test/compile-fail/issue-21600.rs b/src/test/compile-fail/issue-21600.rs new file mode 100644 index 0000000000..f9a79dbb9c --- /dev/null +++ b/src/test/compile-fail/issue-21600.rs @@ -0,0 +1,27 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn call_it(f: F) where F: Fn() { f(); } + +struct A; + +impl A { + fn gen(&self) {} + fn gen_mut(&mut self) {} +} + +fn main() { + let mut x = A; + call_it(|| { //~ HELP consider changing this to accept closures that implement `FnMut` + call_it(|| x.gen()); + call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer + //~^ ERROR cannot borrow data mutably in a captured outer + }); +} diff --git a/src/test/compile-fail/issue-21763.rs b/src/test/compile-fail/issue-21763.rs new file mode 100644 index 0000000000..bcf3a0a9ac --- /dev/null +++ b/src/test/compile-fail/issue-21763.rs @@ -0,0 +1,21 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Regression test for HashMap only impl'ing Send/Sync if its contents do + +use std::collections::HashMap; +use std::rc::Rc; + +fn foo() {} + +fn main() { + foo::, Rc<()>>>(); + //~^ ERROR: the trait `core::marker::Send` is not implemented for the type `alloc::rc::Rc<()>` +} diff --git a/src/libregex/test/native_static.rs b/src/test/compile-fail/issue-21974.rs similarity index 51% rename from src/libregex/test/native_static.rs rename to src/test/compile-fail/issue-21974.rs index 62e14731c2..f768d6c00e 100644 --- a/src/libregex/test/native_static.rs +++ b/src/test/compile-fail/issue-21974.rs @@ -8,19 +8,21 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use regex::Regex; -static RE: Regex = regex!(r"\d+"); +// Test that (for now) we report an ambiguity error here, because +// specific trait relationships are ignored for the purposes of trait +// matching. This behavior should likely be improved such that this +// test passes. See #21974 for more details. -#[test] -fn static_splitn() { - let text = "cauchy123plato456tyler789binx"; - let subs: Vec<&str> = RE.splitn(text, 2).collect(); - assert_eq!(subs, vec!("cauchy", "plato456tyler789binx")); +trait Foo { + fn foo(self); } -#[test] -fn static_split() { - let text = "cauchy123plato456tyler789binx"; - let subs: Vec<&str> = RE.split(text).collect(); - assert_eq!(subs, vec!("cauchy", "plato", "tyler", "binx")); +fn foo<'a,'b,T>(x: &'a T, y: &'b T) + where &'a T : Foo, + &'b T : Foo +{ + x.foo(); //~ ERROR type annotations required + y.foo(); } + +fn main() { } diff --git a/src/test/compile-fail/issue-2611-4.rs b/src/test/compile-fail/issue-2611-4.rs index b141c1f441..24cc0099b8 100644 --- a/src/test/compile-fail/issue-2611-4.rs +++ b/src/test/compile-fail/issue-2611-4.rs @@ -12,7 +12,7 @@ // than the trait method it's implementing trait A { - fn b(x: C) -> C; + fn b(&self, x: C) -> C; } struct E { @@ -20,7 +20,8 @@ struct E { } impl A for E { - fn b(_x: F) -> F { panic!() } //~ ERROR type parameter 0 requires `Sync` + fn b(&self, _x: F) -> F { panic!() } + //~^ ERROR `F : core::marker::Sync` appears on the impl method } fn main() {} diff --git a/src/test/compile-fail/issue-2951.rs b/src/test/compile-fail/issue-2951.rs index 694bf05b21..d0781b5658 100644 --- a/src/test/compile-fail/issue-2951.rs +++ b/src/test/compile-fail/issue-2951.rs @@ -10,7 +10,12 @@ fn foo(x: T, y: U) { let mut xx = x; - xx = y; //~ ERROR expected `T`, found `U` + xx = y; + //~^ ERROR mismatched types + //~| expected `T` + //~| found `U` + //~| expected type parameter + //~| found a different type parameter } fn main() { diff --git a/src/test/compile-fail/issue-3008-3.rs b/src/test/compile-fail/issue-3008-3.rs index a338a01690..af6cee1f10 100644 --- a/src/test/compile-fail/issue-3008-3.rs +++ b/src/test/compile-fail/issue-3008-3.rs @@ -8,8 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::marker; + enum E1 { V1(E2), } -enum E2 { V2(E2), } +enum E2 { V2(E2, marker::PhantomData), } //~^ ERROR illegal recursive enum type; wrap the inner value in a box to make it representable impl E1 { fn foo(&self) {} } diff --git a/src/test/compile-fail/issue-3044.rs b/src/test/compile-fail/issue-3044.rs index c67d6b1ce8..0f7cc2cb72 100644 --- a/src/test/compile-fail/issue-3044.rs +++ b/src/test/compile-fail/issue-3044.rs @@ -11,7 +11,7 @@ fn main() { let needlesArr: Vec = vec!('a', 'f'); - needlesArr.iter().fold(|&: x, y| { + needlesArr.iter().fold(|x, y| { }); //~^^ ERROR this function takes 2 parameters but 1 parameter was supplied // diff --git a/src/test/compile-fail/issue-3477.rs b/src/test/compile-fail/issue-3477.rs index 798a8cfec9..5e7c23164c 100644 --- a/src/test/compile-fail/issue-3477.rs +++ b/src/test/compile-fail/issue-3477.rs @@ -9,5 +9,10 @@ // except according to those terms. fn main() { - let _p: char = 100; //~ ERROR mismatched types: expected `char`, found + let _p: char = 100; + //~^ ERROR mismatched types + //~| expected `char` + //~| found `u8` + //~| expected char + //~| found u8 } diff --git a/src/test/compile-fail/issue-3521.rs b/src/test/compile-fail/issue-3521.rs index 67ab5508ec..c49959c16a 100644 --- a/src/test/compile-fail/issue-3521.rs +++ b/src/test/compile-fail/issue-3521.rs @@ -11,7 +11,7 @@ fn main() { let foo = 100; - #[derive(Show)] + #[derive(Debug)] enum Stuff { Bar = foo //~ ERROR attempt to use a non-constant value in a constant } diff --git a/src/test/compile-fail/issue-3563.rs b/src/test/compile-fail/issue-3563.rs index 86ab9be77f..0e1cc18dba 100644 --- a/src/test/compile-fail/issue-3563.rs +++ b/src/test/compile-fail/issue-3563.rs @@ -10,8 +10,13 @@ trait A { fn a(&self) { - |&:| self.b() //~ ERROR type `&Self` does not implement any method in scope named `b` - //~^ ERROR expected (), found closure + || self.b() + //~^ ERROR type `&Self` does not implement any method in scope named `b` + //~| ERROR mismatched types + //~| expected `()` + //~| found closure + //~| expected () + //~| found closure } } fn main() {} diff --git a/src/test/compile-fail/issue-3601.rs b/src/test/compile-fail/issue-3601.rs index 15b3ec0bfe..b25e683db0 100644 --- a/src/test/compile-fail/issue-3601.rs +++ b/src/test/compile-fail/issue-3601.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(box_patterns)] #![feature(box_syntax)] struct HTMLImageData { diff --git a/src/test/compile-fail/issue-3680.rs b/src/test/compile-fail/issue-3680.rs index f018a02a94..4aff95b57d 100644 --- a/src/test/compile-fail/issue-3680.rs +++ b/src/test/compile-fail/issue-3680.rs @@ -11,7 +11,10 @@ fn main() { match None { Err(_) => () - //~^ ERROR mismatched types: expected `core::option::Option<_>` - // , found `core::result::Result<_, _>` + //~^ ERROR mismatched types + //~| expected `core::option::Option<_>` + //~| found `core::result::Result<_, _>` + //~| expected enum `core::option::Option` + //~| found enum `core::result::Result` } } diff --git a/src/test/compile-fail/issue-3707.rs b/src/test/compile-fail/issue-3707.rs index 0aa357f239..0d57a8a50c 100644 --- a/src/test/compile-fail/issue-3707.rs +++ b/src/test/compile-fail/issue-3707.rs @@ -14,7 +14,7 @@ struct Obj { impl Obj { pub fn boom() -> bool { - return 1is+1 == 2 + return 1+1 == 2 } pub fn chirp(&self) { self.boom(); //~ ERROR `&Obj` does not implement any method in scope named `boom` @@ -24,5 +24,5 @@ impl Obj { fn main() { let o = Obj { member: 0 }; o.chirp(); - 1is + 1; + 1 + 1; } diff --git a/src/test/compile-fail/issue-4201.rs b/src/test/compile-fail/issue-4201.rs index 0391c73d90..b5af1f03b6 100644 --- a/src/test/compile-fail/issue-4201.rs +++ b/src/test/compile-fail/issue-4201.rs @@ -12,7 +12,11 @@ fn main() { let a = if true { 0 } else if false { -//~^ ERROR if may be missing an else clause: expected `()`, found `_` +//~^ ERROR if may be missing an else clause +//~| expected `()` +//~| found `_` +//~| expected () +//~| found integral variable 1 }; } diff --git a/src/test/compile-fail/issue-4335.rs b/src/test/compile-fail/issue-4335.rs index 292d1d9616..d0da51373d 100644 --- a/src/test/compile-fail/issue-4335.rs +++ b/src/test/compile-fail/issue-4335.rs @@ -14,10 +14,10 @@ fn id(t: T) -> T { t } fn f<'r, T>(v: &'r T) -> Box T + 'r> { - id(box |&mut:| *v) //~ ERROR cannot infer + id(box || *v) //~ ERROR cannot infer } fn main() { - let v = &5is; + let v = &5; println!("{}", f(v).call_mut(())); } diff --git a/src/test/compile-fail/issue-4517.rs b/src/test/compile-fail/issue-4517.rs index 1943f1e5a1..6d4777be40 100644 --- a/src/test/compile-fail/issue-4517.rs +++ b/src/test/compile-fail/issue-4517.rs @@ -11,8 +11,11 @@ fn bar(int_param: usize) {} fn main() { - let foo: [u8; 4] = [1u8; 4us]; + let foo: [u8; 4] = [1u8; 4_usize]; bar(foo); - //~^ ERROR mismatched types: expected `usize`, found `[u8; 4]` - // (expected usize, found vector) + //~^ ERROR mismatched types + //~| expected `usize` + //~| found `[u8; 4]` + //~| expected usize + //~| found array of 4 elements } diff --git a/src/test/compile-fail/issue-4968.rs b/src/test/compile-fail/issue-4968.rs index 88933c0add..e7cd20f38a 100644 --- a/src/test/compile-fail/issue-4968.rs +++ b/src/test/compile-fail/issue-4968.rs @@ -13,6 +13,9 @@ const A: (isize,isize) = (4,2); fn main() { match 42 { A => () } - //~^ ERROR mismatched types: expected `_`, found `(isize, isize)` - // (expected integral variable, found tuple) + //~^ ERROR mismatched types + //~| expected `_` + //~| found `(isize, isize)` + //~| expected integral variable + //~| found tuple } diff --git a/src/test/compile-fail/issue-4972.rs b/src/test/compile-fail/issue-4972.rs index b2b9dfce09..f384dba7c9 100644 --- a/src/test/compile-fail/issue-4972.rs +++ b/src/test/compile-fail/issue-4972.rs @@ -8,9 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(box_patterns)] #![feature(box_syntax)] -trait MyTrait { } +trait MyTrait { + fn dummy(&self) {} +} pub enum TraitWrapper { A(Box), diff --git a/src/test/compile-fail/issue-5035-2.rs b/src/test/compile-fail/issue-5035-2.rs index 9e324cdd61..d316b44794 100644 --- a/src/test/compile-fail/issue-5035-2.rs +++ b/src/test/compile-fail/issue-5035-2.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait I {} +use std::marker::MarkerTrait; + +trait I : MarkerTrait {} type K = I+'static; fn foo(_x: K) {} //~ ERROR: the trait `core::marker::Sized` is not implemented diff --git a/src/test/compile-fail/issue-5100.rs b/src/test/compile-fail/issue-5100.rs index ca7f87ff61..35096110e8 100644 --- a/src/test/compile-fail/issue-5100.rs +++ b/src/test/compile-fail/issue-5100.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(box_patterns)] #![feature(box_syntax)] enum A { B, C } @@ -15,28 +16,48 @@ enum A { B, C } fn main() { match (true, false) { A::B => (), -//~^ ERROR mismatched types: expected `(bool, bool)`, found `A` (expected tuple, found enum A) +//~^ ERROR mismatched types: +//~| expected `(bool, bool)` +//~| found `A` +//~| expected tuple +//~| found enum `A` _ => () } match (true, false) { (true, false, false) => () -//~^ ERROR mismatched types: expected `(bool, bool)`, found `(_, _, _)` +//~^ ERROR mismatched types +//~| expected `(bool, bool)` +//~| found `(_, _, _)` +//~| expected a tuple with 2 elements +//~| found one with 3 elements } match (true, false) { (true, false, false) => () -//~^ ERROR (expected a tuple with 2 elements, found one with 3 elements) +//~^ ERROR mismatched types +//~| expected `(bool, bool)` +//~| found `(_, _, _)` +//~| expected a tuple with 2 elements +//~| found one with 3 elements } match (true, false) { box (true, false) => () -//~^ ERROR mismatched types: expected `(bool, bool)`, found `Box<_>` (expected tuple, found box) +//~^ ERROR mismatched types +//~| expected `(bool, bool)` +//~| found `Box<_>` +//~| expected tuple +//~| found box } match (true, false) { &(true, false) => () -//~^ ERROR mismatched types: expected `(bool, bool)`, found `&_` (expected tuple, found &-ptr) +//~^ ERROR mismatched types +//~| expected `(bool, bool)` +//~| found `&_` +//~| expected tuple +//~| found &-ptr } @@ -44,8 +65,12 @@ fn main() { ('c', 'd'), ('e', 'f')]; - for &(x,y) in v.iter() {} // should be OK + for &(x,y) in &v {} // should be OK // Make sure none of the errors above were fatal - let x: char = true; //~ ERROR expected `char`, found `bool` + let x: char = true; //~ ERROR mismatched types + //~| expected `char` + //~| found `bool` + //~| expected char + //~| found bool } diff --git a/src/test/compile-fail/issue-5216.rs b/src/test/compile-fail/issue-5216.rs index fef414ce97..81424577d4 100644 --- a/src/test/compile-fail/issue-5216.rs +++ b/src/test/compile-fail/issue-5216.rs @@ -9,12 +9,12 @@ // except according to those terms. fn f() { } -struct S(Box); //~ ERROR explicit lifetime bound required -pub static C: S = S(f); +struct S(Box); +pub static C: S = S(f); //~ ERROR mismatched types fn g() { } -type T = Box; //~ ERROR explicit lifetime bound required -pub static D: T = g; +type T = Box; +pub static D: T = g; //~ ERROR mismatched types fn main() {} diff --git a/src/test/compile-fail/issue-5239-1.rs b/src/test/compile-fail/issue-5239-1.rs index 0eaa40efca..49a43ee37a 100644 --- a/src/test/compile-fail/issue-5239-1.rs +++ b/src/test/compile-fail/issue-5239-1.rs @@ -11,6 +11,6 @@ // Regression test for issue #5239 fn main() { - let x = |&: ref x: isize| -> isize { x += 1; }; + let x = |ref x: isize| -> isize { x += 1; }; //~^ ERROR binary assignment operation `+=` cannot be applied to type `&isize` } diff --git a/src/test/compile-fail/issue-5358-1.rs b/src/test/compile-fail/issue-5358-1.rs index 96bad3a6a4..32702d3e2f 100644 --- a/src/test/compile-fail/issue-5358-1.rs +++ b/src/test/compile-fail/issue-5358-1.rs @@ -13,7 +13,12 @@ struct S(Either); fn main() { match S(Either::Left(5)) { - Either::Right(_) => {} //~ ERROR mismatched types: expected `S`, found `Either + Either::Right(_) => {} + //~^ ERROR mismatched types + //~| expected `S` + //~| found `Either<_, _>` + //~| expected struct `S` + //~| found enum `Either` _ => {} } } diff --git a/src/test/compile-fail/issue-5500.rs b/src/test/compile-fail/issue-5500.rs index 5686734906..565634191b 100644 --- a/src/test/compile-fail/issue-5500.rs +++ b/src/test/compile-fail/issue-5500.rs @@ -10,5 +10,9 @@ fn main() { &panic!() - //~^ ERROR mismatched types: expected `()`, found `&_` (expected (), found &-ptr) + //~^ ERROR mismatched types + //~| expected `()` + //~| found `&_` + //~| expected () + //~| found &-ptr } diff --git a/src/test/compile-fail/issue-5543.rs b/src/test/compile-fail/issue-5543.rs index cf98f1572e..4d721ad766 100644 --- a/src/test/compile-fail/issue-5543.rs +++ b/src/test/compile-fail/issue-5543.rs @@ -10,7 +10,7 @@ #![feature(box_syntax)] -trait Foo {} +trait Foo { fn foo(&self) {} } impl Foo for u8 {} fn main() { diff --git a/src/test/compile-fail/issue-5883.rs b/src/test/compile-fail/issue-5883.rs index 9ff957b6e6..b0db990619 100644 --- a/src/test/compile-fail/issue-5883.rs +++ b/src/test/compile-fail/issue-5883.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait A {} +use std::marker::MarkerTrait; + +trait A : MarkerTrait {} struct Struct { r: A+'static @@ -20,6 +22,6 @@ fn new_struct(r: A+'static) Struct { r: r } } -trait Curve {} +trait Curve : MarkerTrait {} enum E {X(Curve+'static)} fn main() {} diff --git a/src/test/compile-fail/issue-6458.rs b/src/test/compile-fail/issue-6458.rs index efa3100360..0bf9a3c2d4 100644 --- a/src/test/compile-fail/issue-6458.rs +++ b/src/test/compile-fail/issue-6458.rs @@ -8,13 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub struct TypeWithState; +use std::marker; + +pub struct TypeWithState(marker::PhantomData); pub struct MyState; pub fn foo(_: TypeWithState) {} pub fn bar() { - foo(TypeWithState); //~ ERROR type annotations required + foo(TypeWithState(marker::PhantomData)); //~ ERROR type annotations required } fn main() { diff --git a/src/test/compile-fail/issue-6801.rs b/src/test/compile-fail/issue-6801.rs index 9424ff22dc..9e79701939 100644 --- a/src/test/compile-fail/issue-6801.rs +++ b/src/test/compile-fail/issue-6801.rs @@ -24,7 +24,7 @@ fn invoke(f: F) where F: FnOnce() -> usize { fn main() { let x : Box = box 9; - let sq = |:| { *x * *x }; + let sq = || { *x * *x }; twice(x); //~ ERROR: cannot move out of invoke(sq); diff --git a/src/test/compile-fail/issue-6936.rs b/src/test/compile-fail/issue-6936.rs new file mode 100644 index 0000000000..f5c879a07e --- /dev/null +++ b/src/test/compile-fail/issue-6936.rs @@ -0,0 +1,44 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct T; + +mod t1 { + type Foo = ::T; + mod Foo {} //~ ERROR: duplicate definition of type or module `Foo` +} + +mod t2 { + type Foo = ::T; + struct Foo; //~ ERROR: duplicate definition of type or module `Foo` +} + +mod t3 { + type Foo = ::T; + enum Foo {} //~ ERROR: duplicate definition of type or module `Foo` +} + +mod t4 { + type Foo = ::T; + fn Foo() {} // ok +} + +mod t5 { + type Bar = T; + mod Bar {} //~ ERROR: duplicate definition of type or module `Bar` +} + +mod t6 { + type Foo = ::T; + impl Foo {} // ok +} + + +fn main() {} diff --git a/src/test/compile-fail/issue-7013.rs b/src/test/compile-fail/issue-7013.rs index d246e4e54d..90ecfb6015 100644 --- a/src/test/compile-fail/issue-7013.rs +++ b/src/test/compile-fail/issue-7013.rs @@ -35,5 +35,4 @@ struct A { fn main() { let a = A {v: box B{v: None} as Box}; //~^ ERROR the trait `core::marker::Send` is not implemented - //~^^ ERROR the trait `core::marker::Send` is not implemented } diff --git a/src/test/compile-fail/issue-7061.rs b/src/test/compile-fail/issue-7061.rs index c6869c4405..e261249bc9 100644 --- a/src/test/compile-fail/issue-7061.rs +++ b/src/test/compile-fail/issue-7061.rs @@ -12,7 +12,11 @@ struct BarStruct; impl<'a> BarStruct { fn foo(&'a mut self) -> Box { self } - //~^ ERROR: error: mismatched types: expected `Box`, found `&'a mut BarStruct + //~^ ERROR mismatched types + //~| expected `Box` + //~| found `&'a mut BarStruct` + //~| expected box + //~| found &-ptr } fn main() {} diff --git a/src/test/compile-fail/issue-7092.rs b/src/test/compile-fail/issue-7092.rs index 116639f494..eefb34fbe4 100644 --- a/src/test/compile-fail/issue-7092.rs +++ b/src/test/compile-fail/issue-7092.rs @@ -14,7 +14,11 @@ enum Whatever { fn foo(x: Whatever) { match x { Some(field) => -//~^ ERROR: mismatched types: expected `Whatever`, found `core::option::Option<_>` +//~^ ERROR mismatched types +//~| expected `Whatever` +//~| found `core::option::Option<_>` +//~| expected enum `Whatever` +//~| found enum `core::option::Option` field.access(), //~ ERROR the type of this value must be known in this context } } diff --git a/src/test/compile-fail/issue-7364.rs b/src/test/compile-fail/issue-7364.rs index 2e644b6540..6a36b2f84b 100644 --- a/src/test/compile-fail/issue-7364.rs +++ b/src/test/compile-fail/issue-7364.rs @@ -12,10 +12,11 @@ use std::cell::RefCell; -// Regresion test for issue 7364 +// Regression test for issue 7364 static boxed: Box> = box RefCell::new(0); -//~^ ERROR statics are not allowed to have custom pointers -//~| ERROR: the trait `core::marker::Sync` is not implemented for the type -//~| ERROR: the trait `core::marker::Sync` is not implemented for the type +//~^ ERROR allocations are not allowed in statics +//~| ERROR the trait `core::marker::Sync` is not implemented for the type +//~| ERROR the trait `core::marker::Sync` is not implemented for the type +//~| ERROR function calls in statics are limited to struct and enum constructors fn main() { } diff --git a/src/test/compile-fail/issue-7573.rs b/src/test/compile-fail/issue-7573.rs index 897afb1c10..2d1cea1d44 100644 --- a/src/test/compile-fail/issue-7573.rs +++ b/src/test/compile-fail/issue-7573.rs @@ -25,14 +25,14 @@ impl CrateId { pub fn remove_package_from_database() { let mut lines_to_use: Vec<&CrateId> = Vec::new(); - let push_id = |&mut: installed_id: &CrateId| { + let push_id = |installed_id: &CrateId| { lines_to_use.push(installed_id); //~^ ERROR cannot infer an appropriate lifetime for automatic coercion due to // conflicting requirements }; list_database(push_id); - for l in lines_to_use.iter() { + for l in &lines_to_use { println!("{}", l.local_path); } @@ -41,7 +41,7 @@ pub fn remove_package_from_database() { pub fn list_database(mut f: F) where F: FnMut(&CrateId) { let stuff = ["foo", "bar"]; - for l in stuff.iter() { + for l in &stuff { f(&CrateId::new(*l)); } } diff --git a/src/test/compile-fail/issue-7575.rs b/src/test/compile-fail/issue-7575.rs index 49e54f25bf..b6643f4395 100644 --- a/src/test/compile-fail/issue-7575.rs +++ b/src/test/compile-fail/issue-7575.rs @@ -10,12 +10,14 @@ // Test the mechanism for warning about possible missing `self` declarations. +use std::marker::MarkerTrait; + trait CtxtFn { fn f8(self, usize) -> usize; fn f9(usize) -> usize; //~ NOTE candidate } -trait OtherTrait { +trait OtherTrait : MarkerTrait { fn f9(usize) -> usize; //~ NOTE candidate } @@ -24,23 +26,23 @@ trait OtherTrait { // declaration to match against, so we wind up prisizeing it as a // candidate. This seems not unreasonable -- perhaps the user meant to // implement it, after all. -trait UnusedTrait { +trait UnusedTrait : MarkerTrait { fn f9(usize) -> usize; //~ NOTE candidate } impl CtxtFn for usize { fn f8(self, i: usize) -> usize { - i * 4us + i * 4_usize } fn f9(i: usize) -> usize { - i * 4us + i * 4_usize } } impl OtherTrait for usize { fn f9(i: usize) -> usize { - i * 8us + i * 8_usize } } @@ -52,7 +54,7 @@ impl Myisize { } } -trait ManyImplTrait { +trait ManyImplTrait : MarkerTrait { fn is_str() -> bool { //~ NOTE candidate false } diff --git a/src/test/compile-fail/issue-7867.rs b/src/test/compile-fail/issue-7867.rs index e459a243cc..7bb4aac23d 100644 --- a/src/test/compile-fail/issue-7867.rs +++ b/src/test/compile-fail/issue-7867.rs @@ -14,14 +14,27 @@ mod foo { pub fn bar() {} } fn main() { match (true, false) { - A::B => (), //~ ERROR expected `(bool, bool)`, found `A` (expected tuple, found enum A) + A::B => (), + //~^ ERROR mismatched types + //~| expected `(bool, bool)` + //~| found `A` + //~| expected tuple + //~| found enum `A` _ => () } - match &Some(42is) { - Some(x) => (), //~ ERROR expected `&core::option::Option`, - // found `core::option::Option<_>` - None => () //~ ERROR expected `&core::option::Option`, - // found `core::option::Option<_>` + match &Some(42i32) { + Some(x) => (), + //~^ ERROR mismatched types + //~| expected `&core::option::Option` + //~| found `core::option::Option<_>` + //~| expected &-ptr + //~| found enum `core::option::Option` + None => () + //~^ ERROR mismatched types + //~| expected `&core::option::Option` + //~| found `core::option::Option<_>` + //~| expected &-ptr + //~| found enum `core::option::Option` } } diff --git a/src/test/compile-fail/issue-8460-const.rs b/src/test/compile-fail/issue-8460-const.rs new file mode 100644 index 0000000000..954ae8ebc4 --- /dev/null +++ b/src/test/compile-fail/issue-8460-const.rs @@ -0,0 +1,55 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::{int, i8, i16, i32, i64}; +use std::thread; + +fn main() { + assert!(thread::spawn(move|| { int::MIN / -1; }).join().is_err()); + //~^ ERROR attempted to divide with overflow in a constant expression + assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); + //~^ ERROR attempted to divide with overflow in a constant expression + assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); + //~^ ERROR attempted to divide with overflow in a constant expression + assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); + //~^ ERROR attempted to divide with overflow in a constant expression + assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); + //~^ ERROR attempted to divide with overflow in a constant expression + assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); + //~^ ERROR attempted to divide by zero in a constant expression + assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); + //~^ ERROR attempted to divide by zero in a constant expression + assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); + //~^ ERROR attempted to divide by zero in a constant expression + assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); + //~^ ERROR attempted to divide by zero in a constant expression + assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); + //~^ ERROR attempted to divide by zero in a constant expression + assert!(thread::spawn(move|| { int::MIN % -1; }).join().is_err()); + //~^ ERROR attempted remainder with overflow in a constant expression + assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); + //~^ ERROR attempted remainder with overflow in a constant expression + assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); + //~^ ERROR attempted remainder with overflow in a constant expression + assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); + //~^ ERROR attempted remainder with overflow in a constant expression + assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); + //~^ ERROR attempted remainder with overflow in a constant expression + assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); + //~^ ERROR attempted remainder with a divisor of zero in a constant expression + assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); + //~^ ERROR attempted remainder with a divisor of zero in a constant expression + assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); + //~^ ERROR attempted remainder with a divisor of zero in a constant expression + assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); + //~^ ERROR attempted remainder with a divisor of zero in a constant expression + assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); + //~^ ERROR attempted remainder with a divisor of zero in a constant expression +} diff --git a/src/test/compile-fail/issue-8727.rs b/src/test/compile-fail/issue-8727.rs index d1a86d334c..72da6dcaa6 100644 --- a/src/test/compile-fail/issue-8727.rs +++ b/src/test/compile-fail/issue-8727.rs @@ -13,16 +13,12 @@ // Verify the compiler fails with an error on infinite function // recursions. -struct Data(Box>); - -fn generic( _ : Vec<(Data,T)> ) { - let rec : Vec<(Data,(bool,T))> = Vec::new(); - generic( rec ); +fn generic() { + generic::>(); } fn main () { // Use generic at least once to trigger instantiation. - let input : Vec<(Data,())> = Vec::new(); - generic(input); + generic::(); } diff --git a/src/test/compile-fail/issue-8761.rs b/src/test/compile-fail/issue-8761.rs index 3f9e92afba..30e4ec8ad0 100644 --- a/src/test/compile-fail/issue-8761.rs +++ b/src/test/compile-fail/issue-8761.rs @@ -10,9 +10,17 @@ enum Foo { A = 1i64, - //~^ ERROR mismatched types: expected `isize`, found `i64` + //~^ ERROR mismatched types + //~| expected `isize` + //~| found `i64` + //~| expected isize + //~| found i64 B = 2u8 - //~^ ERROR mismatched types: expected `isize`, found `u8` + //~^ ERROR mismatched types + //~| expected `isize` + //~| found `u8` + //~| expected isize + //~| found u8 } fn main() {} diff --git a/src/test/compile-fail/issue-9243.rs b/src/test/compile-fail/issue-9243.rs index 808aa098c5..7424a45d04 100644 --- a/src/test/compile-fail/issue-9243.rs +++ b/src/test/compile-fail/issue-9243.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Regresion test for issue 9243 +// Regression test for issue 9243 struct Test { mem: isize, diff --git a/src/test/compile-fail/issue-9575.rs b/src/test/compile-fail/issue-9575.rs index b7537f2a93..94dd787f08 100644 --- a/src/test/compile-fail/issue-9575.rs +++ b/src/test/compile-fail/issue-9575.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(start)] + #[start] fn start(argc: isize, argv: *const *const u8, crate_map: *const u8) -> isize { //~^ ERROR incorrect number of function parameters diff --git a/src/test/compile-fail/kindck-copy.rs b/src/test/compile-fail/kindck-copy.rs index 4398be4b21..74e372e41e 100644 --- a/src/test/compile-fail/kindck-copy.rs +++ b/src/test/compile-fail/kindck-copy.rs @@ -10,20 +10,19 @@ // Test which of the builtin types are considered POD. - +use std::marker::MarkerTrait; use std::rc::Rc; fn assert_copy() { } -trait Dummy { } +trait Dummy : MarkerTrait { } +#[derive(Copy)] struct MyStruct { x: isize, y: isize, } -impl Copy for MyStruct {} - struct MyNoncopyStruct { x: Box, } diff --git a/src/test/compile-fail/kindck-impl-type-params-2.rs b/src/test/compile-fail/kindck-impl-type-params-2.rs index cd47bd721f..b575144f63 100644 --- a/src/test/compile-fail/kindck-impl-type-params-2.rs +++ b/src/test/compile-fail/kindck-impl-type-params-2.rs @@ -10,7 +10,9 @@ #![feature(box_syntax)] -trait Foo { +use std::marker::MarkerTrait; + +trait Foo : MarkerTrait { } impl Foo for T { @@ -19,7 +21,7 @@ impl Foo for T { fn take_param(foo: &T) { } fn main() { - let x = box 3is; + let x = box 3; take_param(&x); //~^ ERROR the trait `core::marker::Copy` is not implemented } diff --git a/src/test/compile-fail/kindck-impl-type-params.rs b/src/test/compile-fail/kindck-impl-type-params.rs index 5d09068941..dffc8fa2ab 100644 --- a/src/test/compile-fail/kindck-impl-type-params.rs +++ b/src/test/compile-fail/kindck-impl-type-params.rs @@ -13,40 +13,44 @@ #![feature(box_syntax)] -struct S; +use std::marker; -trait Gettable {} +struct S(marker::PhantomData); -impl Gettable for S {} +trait Gettable { + fn get(&self) -> T { panic!() } +} + +impl Gettable for S {} fn f(val: T) { - let t: S = S; + let t: S = S(marker::PhantomData); let a = &t as &Gettable; //~^ ERROR the trait `core::marker::Send` is not implemented //~^^ ERROR the trait `core::marker::Copy` is not implemented } fn g(val: T) { - let t: S = S; + let t: S = S(marker::PhantomData); let a: &Gettable = &t; //~^ ERROR the trait `core::marker::Send` is not implemented //~^^ ERROR the trait `core::marker::Copy` is not implemented } fn foo<'a>() { - let t: S<&'a isize> = S; + let t: S<&'a isize> = S(marker::PhantomData); let a = &t as &Gettable<&'a isize>; - //~^ ERROR declared lifetime bound not satisfied + //~^ ERROR cannot infer } fn foo2<'a>() { - let t: Box> = box S; + let t: Box> = box S(marker::PhantomData); let a = t as Box>; //~^ ERROR the trait `core::marker::Copy` is not implemented } fn foo3<'a>() { - let t: Box> = box S; + let t: Box> = box S(marker::PhantomData); let a: Box> = t; //~^ ERROR the trait `core::marker::Copy` is not implemented } diff --git a/src/test/compile-fail/kindck-inherited-copy-bound.rs b/src/test/compile-fail/kindck-inherited-copy-bound.rs index 4ccb240071..0072b1228a 100644 --- a/src/test/compile-fail/kindck-inherited-copy-bound.rs +++ b/src/test/compile-fail/kindck-inherited-copy-bound.rs @@ -15,6 +15,7 @@ use std::any::Any; trait Foo : Copy { + fn foo(&self) {} } impl Foo for T { @@ -23,12 +24,12 @@ impl Foo for T { fn take_param(foo: &T) { } fn a() { - let x = box 3is; + let x = box 3; take_param(&x); //~ ERROR `core::marker::Copy` is not implemented } fn b() { - let x = box 3is; + let x = box 3; let y = &x; let z = &x as &Foo; //~ ERROR `core::marker::Copy` is not implemented } diff --git a/src/test/compile-fail/kindck-nonsendable-1.rs b/src/test/compile-fail/kindck-nonsendable-1.rs index 79aec386d9..e6041cddea 100644 --- a/src/test/compile-fail/kindck-nonsendable-1.rs +++ b/src/test/compile-fail/kindck-nonsendable-1.rs @@ -16,9 +16,8 @@ fn foo(_x: Rc) {} fn bar(_: F) { } fn main() { - let x = Rc::new(3us); + let x = Rc::new(3_usize); bar(move|| foo(x)); //~^ ERROR `core::marker::Send` is not implemented - //~^^ ERROR `core::marker::Send` is not implemented } diff --git a/src/test/compile-fail/kindck-send-object.rs b/src/test/compile-fail/kindck-send-object.rs index 7984b3b32c..0c68401bb2 100644 --- a/src/test/compile-fail/kindck-send-object.rs +++ b/src/test/compile-fail/kindck-send-object.rs @@ -12,15 +12,17 @@ // in this file all test the "kind" violates detected during kindck. // See all `regions-bounded-by-send.rs` +use std::marker::MarkerTrait; + fn assert_send() { } -trait Dummy { } +trait Dummy : MarkerTrait { } trait Message : Send { } // careful with object types, who knows what they close over... fn object_ref_with_static_bound_not_ok() { assert_send::<&'static (Dummy+'static)>(); - //~^ ERROR the trait `core::marker::Send` is not implemented + //~^ ERROR the trait `core::marker::Sync` is not implemented } fn box_object_with_no_bound_not_ok<'a>() { @@ -28,7 +30,7 @@ fn box_object_with_no_bound_not_ok<'a>() { } fn object_with_send_bound_ok() { - assert_send::<&'static (Dummy+Send)>(); + assert_send::<&'static (Dummy+Sync)>(); assert_send::>(); } diff --git a/src/test/compile-fail/kindck-send-object1.rs b/src/test/compile-fail/kindck-send-object1.rs index c781fffff2..f86eac8b16 100644 --- a/src/test/compile-fail/kindck-send-object1.rs +++ b/src/test/compile-fail/kindck-send-object1.rs @@ -12,22 +12,24 @@ // is broken into two parts because some errors occur in distinct // phases in the compiler. See kindck-send-object2.rs as well! -fn assert_send() { } -trait Dummy { } +use std::marker::MarkerTrait; + +fn assert_send() { } +trait Dummy : MarkerTrait { } // careful with object types, who knows what they close over... fn test51<'a>() { assert_send::<&'a Dummy>(); - //~^ ERROR the trait `core::marker::Send` is not implemented + //~^ ERROR the trait `core::marker::Sync` is not implemented } fn test52<'a>() { - assert_send::<&'a (Dummy+Send)>(); - //~^ ERROR declared lifetime bound not satisfied + assert_send::<&'a (Dummy+Sync)>(); + //~^ ERROR does not fulfill the required lifetime } // ...unless they are properly bounded fn test60() { - assert_send::<&'static (Dummy+Send)>(); + assert_send::<&'static (Dummy+Sync)>(); } fn test61() { assert_send::>(); diff --git a/src/test/compile-fail/kindck-send-object2.rs b/src/test/compile-fail/kindck-send-object2.rs index 75bae09b37..08516e6731 100644 --- a/src/test/compile-fail/kindck-send-object2.rs +++ b/src/test/compile-fail/kindck-send-object2.rs @@ -10,11 +10,13 @@ // Continue kindck-send-object1.rs. +use std::marker::MarkerTrait; + fn assert_send() { } -trait Dummy { } +trait Dummy : MarkerTrait { } fn test50() { - assert_send::<&'static Dummy>(); //~ ERROR the trait `core::marker::Send` is not implemented + assert_send::<&'static Dummy>(); //~ ERROR the trait `core::marker::Sync` is not implemented } fn test53() { @@ -23,7 +25,7 @@ fn test53() { // ...unless they are properly bounded fn test60() { - assert_send::<&'static (Dummy+Send)>(); + assert_send::<&'static (Dummy+Sync)>(); } fn test61() { assert_send::>(); diff --git a/src/test/compile-fail/kindck-send-owned.rs b/src/test/compile-fail/kindck-send-owned.rs index 7025249faf..406711902a 100644 --- a/src/test/compile-fail/kindck-send-owned.rs +++ b/src/test/compile-fail/kindck-send-owned.rs @@ -18,8 +18,8 @@ fn test31() { assert_send::(); } fn test32() { assert_send:: >(); } // but not if they own a bad thing -fn test40<'a>(_: &'a isize) { - assert_send::>(); //~ ERROR declared lifetime bound not satisfied +fn test40() { + assert_send::>(); //~ ERROR `core::marker::Send` is not implemented } fn main() { } diff --git a/src/test/compile-fail/kindck-send-region-pointers.rs b/src/test/compile-fail/kindck-send-region-pointers.rs deleted file mode 100644 index c6987e89e3..0000000000 --- a/src/test/compile-fail/kindck-send-region-pointers.rs +++ /dev/null @@ -1,34 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that borrowed pointers are not sendable unless 'static. - -fn assert_send() { } - -// lifetime pointers with 'static lifetime are ok -fn test01() { assert_send::<&'static isize>(); } -fn test02() { assert_send::<&'static str>(); } -fn test03() { assert_send::<&'static [isize]>(); } - -// whether or not they are mutable -fn test10() { assert_send::<&'static mut isize>(); } - -// otherwise lifetime pointers are not ok -fn test20<'a>(_: &'a isize) { - assert_send::<&'a isize>(); //~ ERROR declared lifetime bound not satisfied -} -fn test21<'a>(_: &'a isize) { - assert_send::<&'a str>(); //~ ERROR declared lifetime bound not satisfied -} -fn test22<'a>(_: &'a isize) { - assert_send::<&'a [isize]>(); //~ ERROR declared lifetime bound not satisfied -} - -fn main() { } diff --git a/src/test/compile-fail/lang-item-missing.rs b/src/test/compile-fail/lang-item-missing.rs index 793d9c77c3..c7426fc6fc 100644 --- a/src/test/compile-fail/lang-item-missing.rs +++ b/src/test/compile-fail/lang-item-missing.rs @@ -13,6 +13,7 @@ // error-pattern: requires `sized` lang_item +#![feature(start, no_std)] #![no_std] #[start] diff --git a/src/test/compile-fail/lifetime-inference-give-expl-lifetime-param-3.rs b/src/test/compile-fail/lifetime-inference-give-expl-lifetime-param-3.rs index 04c5b223cb..66d8927ee5 100644 --- a/src/test/compile-fail/lifetime-inference-give-expl-lifetime-param-3.rs +++ b/src/test/compile-fail/lifetime-inference-give-expl-lifetime-param-3.rs @@ -10,7 +10,9 @@ // ignore-tidy-linelength -struct Bar<'x, 'y, 'z> { bar: &'y i32, baz: i32 } +use std::marker::PhantomData; + +struct Bar<'x, 'y, 'z> { bar: &'y i32, baz: i32, marker: PhantomData<(&'x(),&'y(),&'z())> } fn bar1<'a>(x: &Bar) -> (&'a i32, &'a i32, &'a i32) { //~^ HELP: consider using an explicit lifetime parameter as shown: fn bar1<'b, 'c, 'a>(x: &'a Bar<'b, 'a, 'c>) -> (&'a i32, &'a i32, &'a i32) (x.bar, &x.baz, &x.baz) diff --git a/src/test/compile-fail/lifetime-inference-give-expl-lifetime-param.rs b/src/test/compile-fail/lifetime-inference-give-expl-lifetime-param.rs index c60e321219..a85776a938 100644 --- a/src/test/compile-fail/lifetime-inference-give-expl-lifetime-param.rs +++ b/src/test/compile-fail/lifetime-inference-give-expl-lifetime-param.rs @@ -10,7 +10,9 @@ // ignore-tidy-linelength -struct Foo<'x> { bar: isize } +use std::marker::PhantomData; + +struct Foo<'x> { bar: isize, marker: PhantomData<&'x ()> } fn foo1<'a>(x: &Foo) -> &'a isize { //~^ HELP: consider using an explicit lifetime parameter as shown: fn foo1<'a>(x: &'a Foo) -> &'a isize &x.bar //~ ERROR: cannot infer diff --git a/src/test/compile-fail/linkage1.rs b/src/test/compile-fail/linkage1.rs index 555cc2b9a7..35f93c13fb 100644 --- a/src/test/compile-fail/linkage1.rs +++ b/src/test/compile-fail/linkage1.rs @@ -11,4 +11,5 @@ extern { #[linkage = "extern_weak"] static foo: isize; //~^ ERROR: the `linkage` attribute is experimental and not portable + //~^^ ERROR: the `linkage` attribute is experimental and not portable } diff --git a/src/test/compile-fail/linkage4.rs b/src/test/compile-fail/linkage4.rs index 635d58e04c..1cf6e90d6c 100644 --- a/src/test/compile-fail/linkage4.rs +++ b/src/test/compile-fail/linkage4.rs @@ -10,6 +10,6 @@ #[linkage = "external"] static foo: isize = 0; -//~^ ERROR: the `linkage` attribute is experimental and not portable +//~^^ ERROR: the `linkage` attribute is experimental and not portable fn main() {} diff --git a/src/test/compile-fail/lint-ctypes.rs b/src/test/compile-fail/lint-ctypes.rs index 801f9dfd1c..3f25e9c7b7 100644 --- a/src/test/compile-fail/lint-ctypes.rs +++ b/src/test/compile-fail/lint-ctypes.rs @@ -9,6 +9,7 @@ // except according to those terms. #![deny(improper_ctypes)] +#![feature(libc)] extern crate libc; diff --git a/src/test/compile-fail/lint-dead-code-1.rs b/src/test/compile-fail/lint-dead-code-1.rs index 34c79be711..e91e6efd1c 100644 --- a/src/test/compile-fail/lint-dead-code-1.rs +++ b/src/test/compile-fail/lint-dead-code-1.rs @@ -8,12 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(no_std)] #![no_std] #![allow(unused_variables)] #![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] -#![allow(missing_copy_implementations)] #![deny(dead_code)] +#![feature(core)] #![crate_type="lib"] @@ -90,7 +91,7 @@ pub fn pub_fn() { let e = used_enum::foo3; SemiUsedStruct::la_la_la(); - let i = 1is; + let i = 1; match i { USED_STATIC => (), USED_CONST => (), diff --git a/src/test/compile-fail/lint-dead-code-2.rs b/src/test/compile-fail/lint-dead-code-2.rs index e8b85ffd69..4a0e4f4319 100644 --- a/src/test/compile-fail/lint-dead-code-2.rs +++ b/src/test/compile-fail/lint-dead-code-2.rs @@ -10,6 +10,7 @@ #![allow(unused_variables)] #![deny(dead_code)] +#![feature(main, start)] struct Foo; diff --git a/src/test/compile-fail/lint-dead-code-3.rs b/src/test/compile-fail/lint-dead-code-3.rs index 03b89c522c..f60c39ba02 100644 --- a/src/test/compile-fail/lint-dead-code-3.rs +++ b/src/test/compile-fail/lint-dead-code-3.rs @@ -11,6 +11,7 @@ #![allow(unused_variables)] #![allow(non_camel_case_types)] #![deny(dead_code)] +#![feature(libc)] #![crate_type="lib"] @@ -85,6 +86,6 @@ mod inner { } pub fn foo() { - let a = &1is as &inner::Trait; + let a = &1 as &inner::Trait; a.f(); } diff --git a/src/test/compile-fail/lint-dead-code-4.rs b/src/test/compile-fail/lint-dead-code-4.rs index ac8f158f8f..f304c26efb 100644 --- a/src/test/compile-fail/lint-dead-code-4.rs +++ b/src/test/compile-fail/lint-dead-code-4.rs @@ -11,6 +11,8 @@ #![allow(unused_variables)] #![allow(non_camel_case_types)] #![deny(dead_code)] +#![feature(libc)] +#![feature(core)] extern crate libc; @@ -61,6 +63,6 @@ fn field_match_in_let(f: Bar) -> bool { fn main() { field_read(Foo { x: 1, b: false, marker: std::marker::NoCopy }); field_match_in_patterns(XYZ::Z); - field_match_in_let(Bar { x: 42us, b: true, _guard: () }); + field_match_in_let(Bar { x: 42_usize, b: true, _guard: () }); let _ = Baz { x: 0 }; } diff --git a/src/test/compile-fail/lint-exceeding-bitshifts.rs b/src/test/compile-fail/lint-exceeding-bitshifts.rs index 91a4d0fea0..345e56e2e5 100644 --- a/src/test/compile-fail/lint-exceeding-bitshifts.rs +++ b/src/test/compile-fail/lint-exceeding-bitshifts.rs @@ -11,6 +11,7 @@ #![deny(exceeding_bitshifts)] #![allow(unused_variables)] #![allow(dead_code)] +#![feature(core)] fn main() { let n = 1u8 << 7; @@ -56,7 +57,7 @@ fn main() { let n = 1u8 << (4+3); let n = 1u8 << (4+4); //~ ERROR: bitshift exceeds the type's number of bits - let n = 1is << std::isize::BITS; //~ ERROR: bitshift exceeds the type's number of bits - let n = 1us << std::usize::BITS; //~ ERROR: bitshift exceeds the type's number of bits + let n = 1_isize << std::isize::BITS; //~ ERROR: bitshift exceeds the type's number of bits + let n = 1_usize << std::usize::BITS; //~ ERROR: bitshift exceeds the type's number of bits } diff --git a/src/test/compile-fail/lint-forbid-attr.rs b/src/test/compile-fail/lint-forbid-attr.rs index d1fcf62115..fcc8fb6f93 100644 --- a/src/test/compile-fail/lint-forbid-attr.rs +++ b/src/test/compile-fail/lint-forbid-attr.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![forbid(unstable)] +#![forbid(deprecated)] -#[allow(unstable)] //~ ERROR allow(unstable) overruled by outer forbid(unstable) +#[allow(deprecated)] //~ ERROR allow(deprecated) overruled by outer forbid(deprecated) fn main() { } diff --git a/src/test/compile-fail/lint-forbid-cmdline.rs b/src/test/compile-fail/lint-forbid-cmdline.rs index e3be0d06a3..be927297be 100644 --- a/src/test/compile-fail/lint-forbid-cmdline.rs +++ b/src/test/compile-fail/lint-forbid-cmdline.rs @@ -8,9 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: -F unstable +// compile-flags: -F deprecated +#![feature(staged_api)] #![staged_api] -#[allow(unstable)] //~ ERROR allow(unstable) overruled by outer forbid(unstable) +#[allow(deprecated)] //~ ERROR allow(deprecated) overruled by outer forbid(deprecated) fn main() { } diff --git a/src/test/compile-fail/lint-group-style.rs b/src/test/compile-fail/lint-group-style.rs index 24d16bcaaf..59ab5be157 100644 --- a/src/test/compile-fail/lint-group-style.rs +++ b/src/test/compile-fail/lint-group-style.rs @@ -24,7 +24,7 @@ mod test { mod bad { fn CamelCase() {} //~ ERROR function `CamelCase` should have a snake case name - static bad: isize = 1; //~ ERROR static constant `bad` should have an uppercase name + static bad: isize = 1; //~ ERROR static constant `bad` should have an upper case name } mod warn { diff --git a/src/test/compile-fail/lint-missing-doc.rs b/src/test/compile-fail/lint-missing-doc.rs index 55103f10f2..73a58741bb 100644 --- a/src/test/compile-fail/lint-missing-doc.rs +++ b/src/test/compile-fail/lint-missing-doc.rs @@ -12,7 +12,6 @@ // injected intrinsics by the compiler. #![deny(missing_docs)] #![allow(dead_code)] -#![allow(missing_copy_implementations)] //! Some garbage docs for the crate here #![doc="More garbage"] @@ -48,20 +47,26 @@ fn foo3() {} /// dox pub trait A { /// dox - fn foo(); + fn foo(&self); /// dox - fn foo_with_impl() {} + fn foo_with_impl(&self) {} } + #[allow(missing_docs)] trait B { - fn foo(); - fn foo_with_impl() {} + fn foo(&self); + fn foo_with_impl(&self) {} } + pub trait C { //~ ERROR: missing documentation - fn foo(); //~ ERROR: missing documentation - fn foo_with_impl() {} //~ ERROR: missing documentation + fn foo(&self); //~ ERROR: missing documentation + fn foo_with_impl(&self) {} //~ ERROR: missing documentation +} + +#[allow(missing_docs)] +pub trait D { + fn dummy(&self) { } } -#[allow(missing_docs)] pub trait D {} impl Foo { pub fn foo() {} diff --git a/src/test/compile-fail/lint-non-camel-case-types.rs b/src/test/compile-fail/lint-non-camel-case-types.rs index 70d6b24098..9f58d5791c 100644 --- a/src/test/compile-fail/lint-non-camel-case-types.rs +++ b/src/test/compile-fail/lint-non-camel-case-types.rs @@ -30,6 +30,7 @@ enum Foo5 { } trait foo6 { //~ ERROR trait `foo6` should have a camel case name such as `Foo6` + fn dummy(&self) { } } fn f(_: ty) {} //~ ERROR type parameter `ty` should have a camel case name such as `Ty` diff --git a/src/test/compile-fail/lint-non-uppercase-statics.rs b/src/test/compile-fail/lint-non-uppercase-statics.rs index 10475f967d..e1fbc73bbe 100644 --- a/src/test/compile-fail/lint-non-uppercase-statics.rs +++ b/src/test/compile-fail/lint-non-uppercase-statics.rs @@ -11,6 +11,6 @@ #![forbid(non_upper_case_globals)] #![allow(dead_code)] -static foo: isize = 1; //~ ERROR static constant `foo` should have an uppercase name such as `FOO` +static foo: isize = 1; //~ ERROR static constant `foo` should have an upper case name such as `FOO` fn main() { } diff --git a/src/test/compile-fail/lint-obsolete-attr.rs b/src/test/compile-fail/lint-obsolete-attr.rs index e4fd042d09..b234f08d04 100644 --- a/src/test/compile-fail/lint-obsolete-attr.rs +++ b/src/test/compile-fail/lint-obsolete-attr.rs @@ -13,8 +13,9 @@ #![deny(unused_attributes)] #![allow(dead_code)] +#![feature(custom_attribute)] -#[abi="stdcall"] extern {} //~ ERROR unused attribute +#[ab_isize="stdcall"] extern {} //~ ERROR unused attribute #[fixed_stack_segment] fn f() {} //~ ERROR unused attribute diff --git a/src/test/compile-fail/lint-output-format.rs b/src/test/compile-fail/lint-output-format.rs index 10217481bf..ec4e3c774d 100644 --- a/src/test/compile-fail/lint-output-format.rs +++ b/src/test/compile-fail/lint-output-format.rs @@ -8,13 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags:-F unstable +// compile-flags: -F unused_features // aux-build:lint_output_format.rs -extern crate lint_output_format; //~ ERROR: use of unmarked item +#![feature(foo)] //~ ERROR unused or unknown feature + +extern crate lint_output_format; //~ WARNING: use of unstable library feature use lint_output_format::{foo, bar}; fn main() { let _x = foo(); //~ WARNING #[warn(deprecated)] on by default - let _y = bar(); //~ ERROR [-F unstable] + let _y = bar(); //~ WARNING: use of unstable library feature } diff --git a/src/test/compile-fail/lint-stability.rs b/src/test/compile-fail/lint-stability.rs index eab5e98d68..88f2cbdea6 100644 --- a/src/test/compile-fail/lint-stability.rs +++ b/src/test/compile-fail/lint-stability.rs @@ -12,19 +12,19 @@ // aux-build:inherited_stability.rs // aux-build:stability_cfg1.rs // aux-build:stability_cfg2.rs +// ignore-tidy-linelength -#![deny(unstable)] #![deny(deprecated)] -#![deny(unstable)] #![allow(dead_code)] +#![feature(staged_api)] #![staged_api] #[macro_use] -extern crate lint_stability; //~ ERROR: use of unmarked item +extern crate lint_stability; mod cross_crate { extern crate stability_cfg1; - extern crate stability_cfg2; //~ ERROR: use of unstable item + extern crate stability_cfg2; //~ WARNING: use of unstable library feature use lint_stability::*; @@ -39,25 +39,27 @@ mod cross_crate { foo.method_deprecated_text(); //~ ERROR use of deprecated item: text foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text - experimental(); //~ ERROR use of unstable item - foo.method_experimental(); //~ ERROR use of unstable item - foo.trait_experimental(); //~ ERROR use of unstable item + deprecated_unstable(); //~ ERROR use of deprecated item + //~^ WARNING use of unstable library feature + foo.method_deprecated_unstable(); //~ ERROR use of deprecated item + //~^ WARNING use of unstable library feature + foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item + //~^ WARNING use of unstable library feature - experimental_text(); //~ ERROR use of unstable item: text - foo.method_experimental_text(); //~ ERROR use of unstable item: text - foo.trait_experimental_text(); //~ ERROR use of unstable item: text + deprecated_unstable_text(); //~ ERROR use of deprecated item: text + //~^ WARNING use of unstable library feature + foo.method_deprecated_unstable_text(); //~ ERROR use of deprecated item: text + //~^ WARNING use of unstable library feature + foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text + //~^ WARNING use of unstable library feature - unstable(); //~ ERROR use of unstable item - foo.method_unstable(); //~ ERROR use of unstable item - foo.trait_unstable(); //~ ERROR use of unstable item + unstable(); //~ WARNING use of unstable library feature + foo.method_unstable(); //~ WARNING use of unstable library feature + foo.trait_unstable(); //~ WARNING use of unstable library feature - unstable_text(); //~ ERROR use of unstable item: text - foo.method_unstable_text(); //~ ERROR use of unstable item: text - foo.trait_unstable_text(); //~ ERROR use of unstable item: text - - unmarked(); //~ ERROR use of unmarked item - foo.method_unmarked(); //~ ERROR use of unmarked item - foo.trait_unmarked(); //~ ERROR use of unmarked item + unstable_text(); //~ WARNING use of unstable library feature 'test_feature': text + foo.method_unstable_text(); //~ WARNING use of unstable library feature 'test_feature': text + foo.trait_unstable_text(); //~ WARNING use of unstable library feature 'test_feature': text stable(); foo.method_stable(); @@ -67,284 +69,195 @@ mod cross_crate { foo.method_stable_text(); foo.trait_stable_text(); - frozen(); - foo.method_frozen(); - foo.trait_frozen(); - - frozen_text(); - foo.method_frozen_text(); - foo.trait_frozen_text(); - - locked(); - foo.method_locked(); - foo.trait_locked(); - - locked_text(); - foo.method_locked_text(); - foo.trait_locked_text(); - let _ = DeprecatedStruct { i: 0 }; //~ ERROR use of deprecated item - let _ = ExperimentalStruct { i: 0 }; //~ ERROR use of unstable item - let _ = UnstableStruct { i: 0 }; //~ ERROR use of unstable item - let _ = UnmarkedStruct { i: 0 }; //~ ERROR use of unmarked item + let _ = DeprecatedUnstableStruct { i: 0 }; //~ ERROR use of deprecated item + //~^ WARNING use of unstable library feature + let _ = UnstableStruct { i: 0 }; //~ WARNING use of unstable library feature let _ = StableStruct { i: 0 }; - let _ = FrozenStruct { i: 0 }; - let _ = LockedStruct { i: 0 }; let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item - let _ = ExperimentalUnitStruct; //~ ERROR use of unstable item - let _ = UnstableUnitStruct; //~ ERROR use of unstable item - let _ = UnmarkedUnitStruct; //~ ERROR use of unmarked item + let _ = DeprecatedUnstableUnitStruct; //~ ERROR use of deprecated item + //~^ WARNING use of unstable library feature + let _ = UnstableUnitStruct; //~ WARNING use of unstable library feature let _ = StableUnitStruct; - let _ = FrozenUnitStruct; - let _ = LockedUnitStruct; let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item - let _ = Enum::ExperimentalVariant; //~ ERROR use of unstable item - let _ = Enum::UnstableVariant; //~ ERROR use of unstable item - let _ = Enum::UnmarkedVariant; //~ ERROR use of unmarked item + let _ = Enum::DeprecatedUnstableVariant; //~ ERROR use of deprecated item + //~^ WARNING use of unstable library feature + let _ = Enum::UnstableVariant; //~ WARNING use of unstable library feature let _ = Enum::StableVariant; - let _ = Enum::FrozenVariant; - let _ = Enum::LockedVariant; let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item - let _ = ExperimentalTupleStruct (1); //~ ERROR use of unstable item - let _ = UnstableTupleStruct (1); //~ ERROR use of unstable item - let _ = UnmarkedTupleStruct (1); //~ ERROR use of unmarked item + let _ = DeprecatedUnstableTupleStruct (1); //~ ERROR use of deprecated item + //~^ WARNING use of unstable library feature + let _ = UnstableTupleStruct (1); //~ WARNING use of unstable library feature let _ = StableTupleStruct (1); - let _ = FrozenTupleStruct (1); - let _ = LockedTupleStruct (1); // At the moment, the lint checker only checks stability in // in the arguments of macros. // Eventually, we will want to lint the contents of the // macro in the module *defining* it. Also, stability levels // on macros themselves are not yet linted. - macro_test!(); macro_test_arg!(deprecated_text()); //~ ERROR use of deprecated item: text + macro_test_arg!(deprecated_unstable_text()); //~ ERROR use of deprecated item: text + //~^ WARNING use of unstable library feature macro_test_arg!(macro_test_arg!(deprecated_text())); //~ ERROR use of deprecated item: text - macro_test_arg_nested!(deprecated_text); } fn test_method_param(foo: F) { foo.trait_deprecated(); //~ ERROR use of deprecated item foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text - foo.trait_experimental(); //~ ERROR use of unstable item - foo.trait_experimental_text(); //~ ERROR use of unstable item: text - foo.trait_unstable(); //~ ERROR use of unstable item - foo.trait_unstable_text(); //~ ERROR use of unstable item: text - foo.trait_unmarked(); //~ ERROR use of unmarked item + foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item + //~^ WARNING use of unstable library feature + foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text + //~^ WARNING use of unstable library feature + foo.trait_unstable(); //~ WARNING use of unstable library feature + foo.trait_unstable_text(); //~ WARNING use of unstable library feature 'test_feature': text foo.trait_stable(); } fn test_method_object(foo: &Trait) { foo.trait_deprecated(); //~ ERROR use of deprecated item foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text - foo.trait_experimental(); //~ ERROR use of unstable item - foo.trait_experimental_text(); //~ ERROR use of unstable item: text - foo.trait_unstable(); //~ ERROR use of unstable item - foo.trait_unstable_text(); //~ ERROR use of unstable item: text - foo.trait_unmarked(); //~ ERROR use of unmarked item + foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item + //~^ WARNING use of unstable library feature + foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text + //~^ WARNING use of unstable library feature + foo.trait_unstable(); //~ WARNING use of unstable library feature + foo.trait_unstable_text(); //~ WARNING use of unstable library feature 'test_feature': text foo.trait_stable(); } struct S; - impl ExperimentalTrait for S { } //~ ERROR use of unstable item + impl UnstableTrait for S { } //~ WARNING use of unstable library feature + + trait LocalTrait : UnstableTrait { } //~ WARNING use of unstable library feature - trait LocalTrait : ExperimentalTrait { } //~ ERROR use of unstable item + impl Trait for S { + fn trait_stable(&self) {} + fn trait_unstable(&self) {} //~ WARNING use of unstable library feature + } } mod inheritance { - extern crate inherited_stability; //~ ERROR: use of unstable item - use self::inherited_stability::*; + extern crate inherited_stability; //~ WARNING: use of unstable library feature + use self::inherited_stability::*; //~ WARNING: use of unstable library feature fn test_inheritance() { - experimental(); //~ ERROR use of unstable item + unstable(); //~ WARNING use of unstable library feature stable(); - stable_mod::experimental(); //~ ERROR use of unstable item + stable_mod::unstable(); //~ WARNING use of unstable library feature stable_mod::stable(); - unstable_mod::experimental(); //~ ERROR use of unstable item - unstable_mod::unstable(); //~ ERROR use of unstable item + unstable_mod::deprecated(); //~ ERROR use of deprecated item + unstable_mod::unstable(); //~ WARNING use of unstable library feature - experimental_mod::experimental(); //~ ERROR use of unstable item - experimental_mod::stable(); - - let _ = Experimental::ExperimentalVariant; //~ ERROR use of unstable item - let _ = Experimental::StableVariant; + let _ = Unstable::UnstableVariant; //~ WARNING use of unstable library feature + let _ = Unstable::StableVariant; let x: usize = 0; - x.experimental(); //~ ERROR use of unstable item + x.unstable(); //~ WARNING use of unstable library feature x.stable(); } } mod this_crate { - #[deprecated] + #[unstable(feature = "test_feature")] + #[deprecated(since = "1.0.0")] pub fn deprecated() {} - #[deprecated="text"] + #[unstable(feature = "test_feature")] + #[deprecated(since = "1.0.0", reason = "text")] pub fn deprecated_text() {} - #[unstable] - pub fn experimental() {} - #[unstable="text"] - pub fn experimental_text() {} - - #[unstable] + #[unstable(feature = "test_feature")] pub fn unstable() {} - #[unstable="text"] + #[unstable(feature = "test_feature", reason = "text")] pub fn unstable_text() {} - pub fn unmarked() {} - - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn stable() {} - #[stable="text"] + #[stable(feature = "rust1", since = "1.0.0", reason = "text")] pub fn stable_text() {} - #[locked] - pub fn locked() {} - #[locked="text"] - pub fn locked_text() {} - - #[frozen] - pub fn frozen() {} - #[frozen="text"] - pub fn frozen_text() {} - - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub struct MethodTester; impl MethodTester { - #[deprecated] + #[unstable(feature = "test_feature")] + #[deprecated(since = "1.0.0")] pub fn method_deprecated(&self) {} - #[deprecated="text"] + #[unstable(feature = "test_feature")] + #[deprecated(since = "1.0.0", reason = "text")] pub fn method_deprecated_text(&self) {} - #[unstable] - pub fn method_experimental(&self) {} - #[unstable="text"] - pub fn method_experimental_text(&self) {} - - #[unstable] + #[unstable(feature = "test_feature")] pub fn method_unstable(&self) {} - #[unstable="text"] + #[unstable(feature = "test_feature", reason = "text")] pub fn method_unstable_text(&self) {} - pub fn method_unmarked(&self) {} - - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn method_stable(&self) {} - #[stable="text"] + #[stable(feature = "rust1", since = "1.0.0", reason = "text")] pub fn method_stable_text(&self) {} - - #[locked] - pub fn method_locked(&self) {} - #[locked="text"] - pub fn method_locked_text(&self) {} - - #[frozen] - pub fn method_frozen(&self) {} - #[frozen="text"] - pub fn method_frozen_text(&self) {} } pub trait Trait { - #[deprecated] + #[unstable(feature = "test_feature")] + #[deprecated(since = "1.0.0")] fn trait_deprecated(&self) {} - #[deprecated="text"] + #[unstable(feature = "test_feature")] + #[deprecated(since = "1.0.0", reason = "text")] fn trait_deprecated_text(&self) {} - #[unstable] - fn trait_experimental(&self) {} - #[unstable="text"] - fn trait_experimental_text(&self) {} - - #[unstable] + #[unstable(feature = "test_feature")] fn trait_unstable(&self) {} - #[unstable="text"] + #[unstable(feature = "test_feature", reason = "text")] fn trait_unstable_text(&self) {} - fn trait_unmarked(&self) {} - - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn trait_stable(&self) {} - #[stable="text"] + #[stable(feature = "rust1", since = "1.0.0", reason = "text")] fn trait_stable_text(&self) {} - - #[locked] - fn trait_locked(&self) {} - #[locked="text"] - fn trait_locked_text(&self) {} - - #[frozen] - fn trait_frozen(&self) {} - #[frozen="text"] - fn trait_frozen_text(&self) {} } impl Trait for MethodTester {} - #[deprecated] + #[unstable(feature = "test_feature")] + #[deprecated(since = "1.0.0")] pub struct DeprecatedStruct { i: isize } - #[unstable] - pub struct ExperimentalStruct { i: isize } - #[unstable] + #[unstable(feature = "test_feature")] pub struct UnstableStruct { i: isize } - pub struct UnmarkedStruct { i: isize } - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub struct StableStruct { i: isize } - #[frozen] - pub struct FrozenStruct { i: isize } - #[locked] - pub struct LockedStruct { i: isize } - #[deprecated] + #[unstable(feature = "test_feature")] + #[deprecated(since = "1.0.0")] pub struct DeprecatedUnitStruct; - #[unstable] - pub struct ExperimentalUnitStruct; - #[unstable] + #[unstable(feature = "test_feature")] pub struct UnstableUnitStruct; - pub struct UnmarkedUnitStruct; - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub struct StableUnitStruct; - #[frozen] - pub struct FrozenUnitStruct; - #[locked] - pub struct LockedUnitStruct; pub enum Enum { - #[deprecated] + #[unstable(feature = "test_feature")] + #[deprecated(since = "1.0.0")] DeprecatedVariant, - #[unstable] - ExperimentalVariant, - #[unstable] + #[unstable(feature = "test_feature")] UnstableVariant, - UnmarkedVariant, - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] StableVariant, - #[frozen] - FrozenVariant, - #[locked] - LockedVariant, } - #[deprecated] + #[unstable(feature = "test_feature")] + #[deprecated(since = "1.0.0")] pub struct DeprecatedTupleStruct(isize); - #[unstable] - pub struct ExperimentalTupleStruct(isize); - #[unstable] + #[unstable(feature = "test_feature")] pub struct UnstableTupleStruct(isize); - pub struct UnmarkedTupleStruct(isize); - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub struct StableTupleStruct(isize); - #[frozen] - pub struct FrozenTupleStruct(isize); - #[locked] - pub struct LockedTupleStruct(isize); fn test() { // Only the deprecated cases of the following should generate @@ -361,14 +274,6 @@ mod this_crate { foo.method_deprecated_text(); //~ ERROR use of deprecated item: text foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text - experimental(); - foo.method_experimental(); - foo.trait_experimental(); - - experimental_text(); - foo.method_experimental_text(); - foo.trait_experimental_text(); - unstable(); foo.method_unstable(); foo.trait_unstable(); @@ -377,10 +282,6 @@ mod this_crate { foo.method_unstable_text(); foo.trait_unstable_text(); - unmarked(); - foo.method_unmarked(); - foo.trait_unmarked(); - stable(); foo.method_stable(); foo.trait_stable(); @@ -389,93 +290,60 @@ mod this_crate { foo.method_stable_text(); foo.trait_stable_text(); - frozen(); - foo.method_frozen(); - foo.trait_frozen(); - - frozen_text(); - foo.method_frozen_text(); - foo.trait_frozen_text(); - - locked(); - foo.method_locked(); - foo.trait_locked(); - - locked_text(); - foo.method_locked_text(); - foo.trait_locked_text(); - let _ = DeprecatedStruct { i: 0 }; //~ ERROR use of deprecated item - let _ = ExperimentalStruct { i: 0 }; let _ = UnstableStruct { i: 0 }; - let _ = UnmarkedStruct { i: 0 }; let _ = StableStruct { i: 0 }; - let _ = FrozenStruct { i: 0 }; - let _ = LockedStruct { i: 0 }; let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item - let _ = ExperimentalUnitStruct; let _ = UnstableUnitStruct; - let _ = UnmarkedUnitStruct; let _ = StableUnitStruct; - let _ = FrozenUnitStruct; - let _ = LockedUnitStruct; let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item - let _ = Enum::ExperimentalVariant; let _ = Enum::UnstableVariant; - let _ = Enum::UnmarkedVariant; let _ = Enum::StableVariant; - let _ = Enum::FrozenVariant; - let _ = Enum::LockedVariant; let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item - let _ = ExperimentalTupleStruct (1); let _ = UnstableTupleStruct (1); - let _ = UnmarkedTupleStruct (1); let _ = StableTupleStruct (1); - let _ = FrozenTupleStruct (1); - let _ = LockedTupleStruct (1); } fn test_method_param(foo: F) { foo.trait_deprecated(); //~ ERROR use of deprecated item foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text - foo.trait_experimental(); - foo.trait_experimental_text(); foo.trait_unstable(); foo.trait_unstable_text(); - foo.trait_unmarked(); foo.trait_stable(); } fn test_method_object(foo: &Trait) { foo.trait_deprecated(); //~ ERROR use of deprecated item foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text - foo.trait_experimental(); - foo.trait_experimental_text(); foo.trait_unstable(); foo.trait_unstable_text(); - foo.trait_unmarked(); foo.trait_stable(); } - #[deprecated] + #[unstable(feature = "test_feature")] + #[deprecated(since = "1.0.0")] fn test_fn_body() { fn fn_in_body() {} fn_in_body(); } impl MethodTester { - #[deprecated] + #[unstable(feature = "test_feature")] + #[deprecated(since = "1.0.0")] fn test_method_body(&self) { fn fn_in_body() {} fn_in_body(); } } - #[deprecated] - pub trait DeprecatedTrait {} + #[unstable(feature = "test_feature")] + #[deprecated(since = "1.0.0")] + pub trait DeprecatedTrait { + fn dummy(&self) { } + } struct S; diff --git a/src/test/compile-fail/lint-stability2.rs b/src/test/compile-fail/lint-stability2.rs new file mode 100644 index 0000000000..d2ec00d649 --- /dev/null +++ b/src/test/compile-fail/lint-stability2.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:lint_stability.rs +// error-pattern: use of deprecated item + +#![deny(deprecated)] + +#[macro_use] +extern crate lint_stability; + +use lint_stability::*; + +fn main() { + macro_test!(); +} diff --git a/src/test/compile-fail/lint-stability3.rs b/src/test/compile-fail/lint-stability3.rs new file mode 100644 index 0000000000..88a93134b4 --- /dev/null +++ b/src/test/compile-fail/lint-stability3.rs @@ -0,0 +1,25 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:lint_stability.rs +// error-pattern: use of deprecated item + +#![deny(deprecated)] +#![allow(warnings)] + +#[macro_use] +extern crate lint_stability; + +use lint_stability::*; + +fn main() { + macro_test_arg_nested!(deprecated_text); +} + diff --git a/src/test/compile-fail/lint-type-limits.rs b/src/test/compile-fail/lint-type-limits.rs index a2bc464ac4..c00bd2adaa 100644 --- a/src/test/compile-fail/lint-type-limits.rs +++ b/src/test/compile-fail/lint-type-limits.rs @@ -10,11 +10,11 @@ #![allow(dead_code)] -// compile-flags: -D type-limits +// compile-flags: -D unused-comparisons fn main() { } fn foo() { - let mut i = 100us; + let mut i = 100_usize; while i >= 0 { //~ ERROR comparison is useless due to type limits i -= 1; } @@ -26,7 +26,7 @@ fn bar() -> i8 { fn baz() -> bool { 128 > bar() //~ ERROR comparison is useless due to type limits - //~^ WARNING literal out of range for its type + //~^ WARNING literal out of range for i8 } fn bleh() { @@ -44,18 +44,18 @@ fn bleh() { fn qux() { let mut i = 1i8; while 200 != i { //~ ERROR comparison is useless due to type limits - //~^ WARNING literal out of range for its type + //~^ WARNING literal out of range for i8 i += 1; } } fn quy() { - let i = -23us; //~ WARNING negation of unsigned int literal may be unintentional + let i = -23_usize; //~ WARNING negation of unsigned int literal may be unintentional //~^ WARNING unused variable } fn quz() { - let i = 23us; + let i = 23_usize; let j = -i; //~ WARNING negation of unsigned int variable may be unintentional //~^ WARNING unused variable } diff --git a/src/test/compile-fail/lint-type-overflow.rs b/src/test/compile-fail/lint-type-overflow.rs index 47dc93dae1..ed6a0bd37e 100644 --- a/src/test/compile-fail/lint-type-overflow.rs +++ b/src/test/compile-fail/lint-type-overflow.rs @@ -18,42 +18,43 @@ fn test(x: i8) { #[allow(unused_variables)] fn main() { let x1: u8 = 255; // should be OK - let x1: u8 = 256; //~ error: literal out of range for its type + let x1: u8 = 256; //~ error: literal out of range for u8 let x1 = 255_u8; // should be OK - let x1 = 256_u8; //~ error: literal out of range for its type + let x1 = 256_u8; //~ error: literal out of range for u8 let x2: i8 = -128; // should be OK - let x1: i8 = 128; //~ error: literal out of range for its type - let x2: i8 = --128; //~ error: literal out of range for its type + let x1: i8 = 128; //~ error: literal out of range for i8 + let x2: i8 = --128; //~ error: literal out of range for i8 - let x3: i8 = -129; //~ error: literal out of range for its type - let x3: i8 = -(129); //~ error: literal out of range for its type - let x3: i8 = -{129}; //~ error: literal out of range for its type + let x3: i8 = -129; //~ error: literal out of range for i8 + let x3: i8 = -(129); //~ error: literal out of range for i8 + let x3: i8 = -{129}; //~ error: literal out of range for i8 - test(1000); //~ error: literal out of range for its type + test(1000); //~ error: literal out of range for i8 - let x = 128_i8; //~ error: literal out of range for its type + let x = 128_i8; //~ error: literal out of range for i8 let x = 127_i8; let x = -128_i8; let x = -(128_i8); - let x = -129_i8; //~ error: literal out of range for its type + let x = -129_i8; //~ error: literal out of range for i8 let x: i32 = 2147483647; // should be OK let x = 2147483647_i32; // should be OK - let x: i32 = 2147483648; //~ error: literal out of range for its type - let x = 2147483648_i32; //~ error: literal out of range for its type + let x: i32 = 2147483648; //~ error: literal out of range for i32 + let x = 2147483648_i32; //~ error: literal out of range for i32 let x: i32 = -2147483648; // should be OK let x = -2147483648_i32; // should be OK - let x: i32 = -2147483649; //~ error: literal out of range for its type - let x = -2147483649_i32; //~ error: literal out of range for its type + let x: i32 = -2147483649; //~ error: literal out of range for i32 + let x = -2147483649_i32; //~ error: literal out of range for i32 + let x = 2147483648; //~ error: literal out of range for i32 - let x = 9223372036854775808_i64; //~ error: literal out of range for its type + let x = 9223372036854775808_i64; //~ error: literal out of range for i64 let x = -9223372036854775808_i64; // should be OK - let x = 18446744073709551615_i64; //~ error: literal out of range for its type + let x = 18446744073709551615_i64; //~ error: literal out of range for i64 - let x = -3.40282348e+38_f32; //~ error: literal out of range for its type - let x = 3.40282348e+38_f32; //~ error: literal out of range for its type - let x = -1.7976931348623159e+308_f64; //~ error: literal out of range for its type - let x = 1.7976931348623159e+308_f64; //~ error: literal out of range for its type + let x = -3.40282348e+38_f32; //~ error: literal out of range for f32 + let x = 3.40282348e+38_f32; //~ error: literal out of range for f32 + let x = -1.7976931348623159e+308_f64; //~ error: literal out of range for f64 + let x = 1.7976931348623159e+308_f64; //~ error: literal out of range for f64 } diff --git a/src/test/compile-fail/lint-unconditional-recursion.rs b/src/test/compile-fail/lint-unconditional-recursion.rs new file mode 100644 index 0000000000..0c3d1c6ade --- /dev/null +++ b/src/test/compile-fail/lint-unconditional-recursion.rs @@ -0,0 +1,66 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![deny(unconditional_recursion)] +#![allow(dead_code)] +fn foo() { //~ ERROR function cannot return without recurring + foo(); //~ NOTE recursive call site +} + +fn bar() { + if true { + bar() + } +} + +fn baz() { //~ ERROR function cannot return without recurring + if true { + baz() //~ NOTE recursive call site + } else { + baz() //~ NOTE recursive call site + } +} + +fn qux() { + loop {} +} + +fn quz() -> bool { //~ ERROR function cannot return without recurring + if true { + while quz() {} //~ NOTE recursive call site + true + } else { + loop { quz(); } //~ NOTE recursive call site + } +} + +trait Foo { + fn bar(&self) { //~ ERROR function cannot return without recurring + self.bar() //~ NOTE recursive call site + } +} + +impl Foo for Box { + fn bar(&self) { //~ ERROR function cannot return without recurring + loop { + self.bar() //~ NOTE recursive call site + } + } + +} + +struct Baz; +impl Baz { + fn qux(&self) { //~ ERROR function cannot return without recurring + self.qux(); //~ NOTE recursive call site + } +} + +fn main() {} diff --git a/src/test/compile-fail/lint-unexported-no-mangle.rs b/src/test/compile-fail/lint-unexported-no-mangle.rs new file mode 100644 index 0000000000..216fcf9353 --- /dev/null +++ b/src/test/compile-fail/lint-unexported-no-mangle.rs @@ -0,0 +1,40 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags:-F private_no_mangle_fns -F no_mangle_const_items -F private_no_mangle_statics + +// FIXME(#19495) no_mangle'ing main ICE's. +#[no_mangle] +fn foo() { //~ ERROR function foo is marked #[no_mangle], but not exported +} + +#[allow(dead_code)] +#[no_mangle] +const FOO: u64 = 1; //~ ERROR const items should never be #[no_mangle] + +#[no_mangle] +pub const PUB_FOO: u64 = 1; //~ ERROR const items should never be #[no_mangle] + +#[no_mangle] +pub fn bar() { +} + +#[no_mangle] +pub static BAR: u64 = 1; + +#[allow(dead_code)] +#[no_mangle] +static PRIVATE_BAR: u64 = 1; //~ ERROR static PRIVATE_BAR is marked #[no_mangle], but not exported + + +fn main() { + foo(); + bar(); +} diff --git a/src/test/compile-fail/lint-unknown-attr.rs b/src/test/compile-fail/lint-unknown-attr.rs index e4cb92477c..af4e81be19 100644 --- a/src/test/compile-fail/lint-unknown-attr.rs +++ b/src/test/compile-fail/lint-unknown-attr.rs @@ -11,6 +11,7 @@ // When denying at the crate level, be sure to not get random warnings from the // injected intrinsics by the compiler. +#![feature(custom_attribute)] #![deny(unused_attributes)] #![mutable_doc] //~ ERROR unused attribute diff --git a/src/test/compile-fail/marker-no-send.rs b/src/test/compile-fail/lint-unknown-feature-default.rs similarity index 75% rename from src/test/compile-fail/marker-no-send.rs rename to src/test/compile-fail/lint-unknown-feature-default.rs index 032718d7e9..afd1a3933b 100644 --- a/src/test/compile-fail/marker-no-send.rs +++ b/src/test/compile-fail/lint-unknown-feature-default.rs @@ -8,11 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::marker; +// Tests the default for the unused_features lint -fn foo(p: P) { } +#![deny(warnings)] -fn main() -{ - foo(marker::NoSend); //~ ERROR the trait `core::marker::Send` is not implemented -} +#![feature(this_is_not_a_feature)] //~ ERROR: unused or unknown feature + +fn main() { } diff --git a/src/test/compile-fail/lint-unknown-feature.rs b/src/test/compile-fail/lint-unknown-feature.rs index 6252e01749..ac1720b339 100644 --- a/src/test/compile-fail/lint-unknown-feature.rs +++ b/src/test/compile-fail/lint-unknown-feature.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![deny(unknown_features)] +#![deny(unused_features)] -#![feature(this_is_not_a_feature)] //~ ERROR: unknown feature +#![feature(this_is_not_a_feature)] //~ ERROR: unused or unknown feature fn main() {} diff --git a/src/test/compile-fail/lint-unnecessary-parens.rs b/src/test/compile-fail/lint-unnecessary-parens.rs index 4ccc3d8b64..b5eac73a55 100644 --- a/src/test/compile-fail/lint-unnecessary-parens.rs +++ b/src/test/compile-fail/lint-unnecessary-parens.rs @@ -17,7 +17,7 @@ impl X { } fn foo() -> isize { - return (1is); //~ ERROR unnecessary parentheses around `return` value + return (1); //~ ERROR unnecessary parentheses around `return` value } fn bar() -> X { return (X { y: true }); //~ ERROR unnecessary parentheses around `return` value @@ -32,8 +32,8 @@ fn main() { match (true) { //~ ERROR unnecessary parentheses around `match` head expression _ => {} } - if let 1is = (1is) {} //~ ERROR unnecessary parentheses around `if let` head expression - while let 1is = (2is) {} //~ ERROR unnecessary parentheses around `while let` head expression + if let 1 = (1) {} //~ ERROR unnecessary parentheses around `if let` head expression + while let 1 = (2) {} //~ ERROR unnecessary parentheses around `while let` head expression let v = X { y: false }; // struct lits needs parens, so these shouldn't warn. if (v == X { y: true }) {} @@ -47,7 +47,7 @@ fn main() { _ => {} } - let mut _a = (0is); //~ ERROR unnecessary parentheses around assigned value - _a = (0is); //~ ERROR unnecessary parentheses around assigned value - _a += (1is); //~ ERROR unnecessary parentheses around assigned value + let mut _a = (0); //~ ERROR unnecessary parentheses around assigned value + _a = (0); //~ ERROR unnecessary parentheses around assigned value + _a += (1); //~ ERROR unnecessary parentheses around assigned value } diff --git a/src/test/compile-fail/lint-unused-extern-crate.rs b/src/test/compile-fail/lint-unused-extern-crate.rs index c9d34d4047..ada0cd2bc9 100644 --- a/src/test/compile-fail/lint-unused-extern-crate.rs +++ b/src/test/compile-fail/lint-unused-extern-crate.rs @@ -12,6 +12,10 @@ #![deny(unused_extern_crates)] #![allow(unused_variables)] +#![allow(deprecated)] +#![feature(libc)] +#![feature(collections)] +#![feature(rand)] extern crate libc; //~ ERROR: unused extern crate diff --git a/src/test/compile-fail/lint-unused-imports.rs b/src/test/compile-fail/lint-unused-imports.rs index 84d7200314..1468ae64d9 100644 --- a/src/test/compile-fail/lint-unused-imports.rs +++ b/src/test/compile-fail/lint-unused-imports.rs @@ -54,7 +54,7 @@ mod bar { pub mod c { use foo::Point; use foo::Square; //~ ERROR unused import - pub fn cc(p: Point) -> isize { return 2is * (p.x + p.y); } + pub fn cc(p: Point) -> isize { return 2 * (p.x + p.y); } } #[allow(unused_imports)] @@ -65,8 +65,8 @@ mod bar { fn main() { cal(foo::Point{x:3, y:9}); - let mut a = 3is; - let mut b = 4is; + let mut a = 3; + let mut b = 4; swap(&mut a, &mut b); test::C.b(); let _a = foo(); diff --git a/src/test/compile-fail/lint-unused-mut-variables.rs b/src/test/compile-fail/lint-unused-mut-variables.rs index 501eea770d..dcc82b8920 100644 --- a/src/test/compile-fail/lint-unused-mut-variables.rs +++ b/src/test/compile-fail/lint-unused-mut-variables.rs @@ -18,16 +18,16 @@ fn main() { // negative cases - let mut a = 3is; //~ ERROR: variable does not need to be mutable - let mut a = 2is; //~ ERROR: variable does not need to be mutable - let mut b = 3is; //~ ERROR: variable does not need to be mutable - let mut a = vec!(3is); //~ ERROR: variable does not need to be mutable - let (mut a, b) = (1is, 2is); //~ ERROR: variable does not need to be mutable + let mut a = 3; //~ ERROR: variable does not need to be mutable + let mut a = 2; //~ ERROR: variable does not need to be mutable + let mut b = 3; //~ ERROR: variable does not need to be mutable + let mut a = vec!(3); //~ ERROR: variable does not need to be mutable + let (mut a, b) = (1, 2); //~ ERROR: variable does not need to be mutable - match 30is { + match 30 { mut x => {} //~ ERROR: variable does not need to be mutable } - match (30is, 2is) { + match (30, 2) { (mut x, 1) | //~ ERROR: variable does not need to be mutable (mut x, 2) | (mut x, 3) => { @@ -35,28 +35,28 @@ fn main() { _ => {} } - let x = |&: mut y: isize| 10is; //~ ERROR: variable does not need to be mutable + let x = |mut y: isize| 10; //~ ERROR: variable does not need to be mutable fn what(mut foo: isize) {} //~ ERROR: variable does not need to be mutable // positive cases - let mut a = 2is; - a = 3is; + let mut a = 2; + a = 3; let mut a = Vec::new(); - a.push(3is); + a.push(3); let mut a = Vec::new(); callback(|| { - a.push(3is); + a.push(3); }); - let (mut a, b) = (1is, 2is); + let (mut a, b) = (1, 2); a = 34; - match 30is { + match 30 { mut x => { - x = 21is; + x = 21; } } - match (30is, 2is) { + match (30, 2) { (mut x, 1) | (mut x, 2) | (mut x, 3) => { @@ -65,12 +65,12 @@ fn main() { _ => {} } - let x = |&mut: mut y: isize| y = 32is; - fn nothing(mut foo: isize) { foo = 37is; } + let x = |mut y: isize| y = 32; + fn nothing(mut foo: isize) { foo = 37; } // leading underscore should avoid the warning, just like the // unused variable lint. - let mut _allowed = 1is; + let mut _allowed = 1; } fn callback(f: F) where F: FnOnce() {} @@ -78,6 +78,6 @@ fn callback(f: F) where F: FnOnce() {} // make sure the lint attribute can be turned off #[allow(unused_mut)] fn foo(mut a: isize) { - let mut a = 3is; - let mut b = vec!(2is); + let mut a = 3; + let mut b = vec!(2); } diff --git a/src/test/compile-fail/lint-uppercase-variables.rs b/src/test/compile-fail/lint-uppercase-variables.rs index 9317e465a7..a4f46cbd18 100644 --- a/src/test/compile-fail/lint-uppercase-variables.rs +++ b/src/test/compile-fail/lint-uppercase-variables.rs @@ -13,8 +13,9 @@ #![allow(dead_code)] #![deny(non_snake_case)] -use std::io::File; -use std::io::IoError; +mod foo { + pub enum Foo { Foo } +} struct Something { X: usize //~ ERROR structure field `X` should have a snake case name such as `x` @@ -28,13 +29,11 @@ fn main() { let Test: usize = 0; //~ ERROR variable `Test` should have a snake case name such as `test` println!("{}", Test); - let mut f = File::open(&Path::new("something.txt")); - let mut buff = [0u8; 16]; - match f.read(&mut buff) { - Ok(cnt) => println!("read this many bytes: {}", cnt), - Err(IoError{ kind: EndOfFile, .. }) => println!("Got end of file: {:?}", EndOfFile), -//~^ ERROR variable `EndOfFile` should have a snake case name such as `end_of_file` -//~^^ WARN `EndOfFile` is named the same as one of the variants of the type `std::io::IoErrorKind` + match foo::Foo::Foo { + Foo => {} +//~^ ERROR variable `Foo` should have a snake case name such as `foo` +//~^^ WARN `Foo` is named the same as one of the variants of the type `foo::Foo` +//~^^^ WARN unused variable: `Foo` } test(1); diff --git a/src/test/compile-fail/lint-visible-private-types.rs b/src/test/compile-fail/lint-visible-private-types.rs index 8cf375f80f..918b4ee209 100644 --- a/src/test/compile-fail/lint-visible-private-types.rs +++ b/src/test/compile-fail/lint-visible-private-types.rs @@ -12,8 +12,10 @@ #![allow(dead_code)] #![crate_type="lib"] -struct Private; -pub struct Public; +use std::marker; + +struct Private(marker::PhantomData); +pub struct Public(marker::PhantomData); impl Private> { pub fn a(&self) -> Private { panic!() } @@ -103,7 +105,7 @@ impl PrivTrait for (Private,) { fn bar(&self) -> Private { panic!() } } -pub trait ParamTrait { +pub trait ParamTrait : marker::MarkerTrait { fn foo() -> T; } diff --git a/src/test/compile-fail/liveness-bad-bang-2.rs b/src/test/compile-fail/liveness-bad-bang-2.rs index bb04917559..d0bc71edf2 100644 --- a/src/test/compile-fail/liveness-bad-bang-2.rs +++ b/src/test/compile-fail/liveness-bad-bang-2.rs @@ -11,7 +11,7 @@ // Tests that a function with a ! annotation always actually fails fn bad_bang(i: usize) -> ! { //~ ERROR computation may converge in a function marked as diverging - println!("{}", 3is); + println!("{}", 3); } -fn main() { bad_bang(5us); } +fn main() { bad_bang(5); } diff --git a/src/test/compile-fail/liveness-return-last-stmt-semi.rs b/src/test/compile-fail/liveness-return-last-stmt-semi.rs index 4b8f84ae70..57252dd58d 100644 --- a/src/test/compile-fail/liveness-return-last-stmt-semi.rs +++ b/src/test/compile-fail/liveness-return-last-stmt-semi.rs @@ -10,11 +10,11 @@ // // regression test for #8005 -macro_rules! test { () => { fn foo() -> isize { 1is; } } } - //~^ ERROR not all control paths return a value - //~^^ HELP consider removing this semicolon +macro_rules! test { () => { fn foo() -> i32 { 1i32; } } } + //~^ ERROR not all control paths return a value + //~^^ HELP consider removing this semicolon -fn no_return() -> isize {} //~ ERROR not all control paths return a value +fn no_return() -> i32 {} //~ ERROR not all control paths return a value fn bar(x: u32) -> u32 { //~ ERROR not all control paths return a value x * 2; //~ HELP consider removing this semicolon diff --git a/src/test/compile-fail/liveness-unused.rs b/src/test/compile-fail/liveness-unused.rs index c9f8230b6c..ac4b8a5f30 100644 --- a/src/test/compile-fail/liveness-unused.rs +++ b/src/test/compile-fail/liveness-unused.rs @@ -29,40 +29,40 @@ fn f1d() { } fn f2() { - let x = 3is; + let x = 3; //~^ ERROR unused variable: `x` } fn f3() { - let mut x = 3is; + let mut x = 3; //~^ ERROR variable `x` is assigned to, but never used - x += 4is; + x += 4; //~^ ERROR value assigned to `x` is never read } fn f3b() { - let mut z = 3is; + let mut z = 3; //~^ ERROR variable `z` is assigned to, but never used loop { - z += 4is; + z += 4; } } #[allow(unused_variables)] fn f3c() { - let mut z = 3is; - loop { z += 4is; } + let mut z = 3; + loop { z += 4; } } #[allow(unused_variables)] #[allow(unused_assignments)] fn f3d() { - let mut x = 3is; - x += 4is; + let mut x = 3; + x += 4; } fn f4() { - match Some(3is) { + match Some(3) { Some(i) => { //~^ ERROR unused variable: `i` } @@ -75,7 +75,7 @@ enum tri { } fn f4b() -> isize { - match tri::a(3is) { + match tri::a(3) { tri::a(i) | tri::b(i) | tri::c(i) => { i } @@ -83,20 +83,20 @@ fn f4b() -> isize { } fn f5a() { - for x in range(1is, 10) { } + for x in 1..10 { } //~^ ERROR unused variable: `x` } fn f5b() { - for (x, _) in [1is, 2, 3].iter().enumerate() { } + for (x, _) in [1, 2, 3].iter().enumerate() { } //~^ ERROR unused variable: `x` } fn f5c() { - for (_, x) in [1is, 2, 3].iter().enumerate() { + for (_, x) in [1, 2, 3].iter().enumerate() { //~^ ERROR unused variable: `x` continue; - std::os::set_exit_status(*x); //~ WARNING unreachable statement + drop(*x as i32); //~ WARNING unreachable statement } } diff --git a/src/test/compile-fail/liveness-use-after-move.rs b/src/test/compile-fail/liveness-use-after-move.rs index 21e52f1306..985eb1cd7b 100644 --- a/src/test/compile-fail/liveness-use-after-move.rs +++ b/src/test/compile-fail/liveness-use-after-move.rs @@ -11,7 +11,7 @@ #![feature(box_syntax)] fn main() { - let x = box 5is; + let x = box 5; let y = x; println!("{}", *x); //~ ERROR use of moved value: `*x` y.clone(); diff --git a/src/test/compile-fail/liveness-use-after-send.rs b/src/test/compile-fail/liveness-use-after-send.rs index 4ba24800f5..03d8d62e0b 100644 --- a/src/test/compile-fail/liveness-use-after-send.rs +++ b/src/test/compile-fail/liveness-use-after-send.rs @@ -8,14 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn send(ch: _chan, data: T) { +use std::marker; + +fn send(ch: _chan, data: T) { println!("{:?}", ch); println!("{:?}", data); panic!(); } -#[derive(Show)] -struct _chan(isize); +#[derive(Debug)] +struct _chan(isize, marker::PhantomData); // Tests that "log(debug, message);" is flagged as using // message after the send deinitializes it diff --git a/src/test/compile-fail/reserved-be.rs b/src/test/compile-fail/log-syntax-gate2.rs similarity index 86% rename from src/test/compile-fail/reserved-be.rs rename to src/test/compile-fail/log-syntax-gate2.rs index 386d53cc16..bb19e97ab0 100644 --- a/src/test/compile-fail/reserved-be.rs +++ b/src/test/compile-fail/log-syntax-gate2.rs @@ -9,6 +9,5 @@ // except according to those terms. fn main() { - let be = 0; - //~^ ERROR `be` is a reserved keyword + println!("{}", log_syntax!()); //~ ERROR `log_syntax!` is not stable } diff --git a/src/test/compile-fail/loop-does-not-diverge.rs b/src/test/compile-fail/loop-does-not-diverge.rs index e2d3d059ad..12de4a714e 100644 --- a/src/test/compile-fail/loop-does-not-diverge.rs +++ b/src/test/compile-fail/loop-does-not-diverge.rs @@ -14,7 +14,7 @@ fn forever() -> ! { loop { break; } - return 42is; //~ ERROR `return` in a function declared as diverging + return 42; //~ ERROR `return` in a function declared as diverging } fn main() { diff --git a/src/test/compile-fail/lub-if.rs b/src/test/compile-fail/lub-if.rs index 6dcf1fdee8..06af8ac871 100644 --- a/src/test/compile-fail/lub-if.rs +++ b/src/test/compile-fail/lub-if.rs @@ -16,14 +16,14 @@ pub fn opt_str0<'a>(maybestr: &'a Option) -> &'a str { if maybestr.is_none() { "(none)" } else { - let s: &'a str = maybestr.as_ref().unwrap().as_slice(); + let s: &'a str = maybestr.as_ref().unwrap(); s } } pub fn opt_str1<'a>(maybestr: &'a Option) -> &'a str { if maybestr.is_some() { - let s: &'a str = maybestr.as_ref().unwrap().as_slice(); + let s: &'a str = maybestr.as_ref().unwrap(); s } else { "(none)" @@ -34,14 +34,14 @@ pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { if maybestr.is_none() { "(none)" } else { - let s: &'a str = maybestr.as_ref().unwrap().as_slice(); + let s: &'a str = maybestr.as_ref().unwrap(); s //~ ERROR cannot infer an appropriate lifetime for automatic coercion due to conflicting } } pub fn opt_str3<'a>(maybestr: &'a Option) -> &'static str { if maybestr.is_some() { - let s: &'a str = maybestr.as_ref().unwrap().as_slice(); + let s: &'a str = maybestr.as_ref().unwrap(); s //~ ERROR cannot infer an appropriate lifetime for automatic coercion due to conflicting } else { "(none)" diff --git a/src/test/compile-fail/lub-match.rs b/src/test/compile-fail/lub-match.rs index 1939df2877..1b5824964a 100644 --- a/src/test/compile-fail/lub-match.rs +++ b/src/test/compile-fail/lub-match.rs @@ -15,7 +15,7 @@ pub fn opt_str0<'a>(maybestr: &'a Option) -> &'a str { match *maybestr { Some(ref s) => { - let s: &'a str = s.as_slice(); + let s: &'a str = s; s } None => "(none)", @@ -26,7 +26,7 @@ pub fn opt_str1<'a>(maybestr: &'a Option) -> &'a str { match *maybestr { None => "(none)", Some(ref s) => { - let s: &'a str = s.as_slice(); + let s: &'a str = s; s } } @@ -36,7 +36,7 @@ pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { match *maybestr { None => "(none)", Some(ref s) => { - let s: &'a str = s.as_slice(); + let s: &'a str = s; s //~^ ERROR cannot infer an appropriate lifetime } @@ -46,7 +46,7 @@ pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { pub fn opt_str3<'a>(maybestr: &'a Option) -> &'static str { match *maybestr { Some(ref s) => { - let s: &'a str = s.as_slice(); + let s: &'a str = s; s //~^ ERROR cannot infer an appropriate lifetime } diff --git a/src/test/compile-fail/macro-inner-attributes.rs b/src/test/compile-fail/macro-inner-attributes.rs index e4fc5bb462..e76eaea365 100644 --- a/src/test/compile-fail/macro-inner-attributes.rs +++ b/src/test/compile-fail/macro-inner-attributes.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(custom_attribute)] + macro_rules! test { ($nm:ident, #[$a:meta], $i:item) => (mod $nm { #![$a] $i }); } diff --git a/src/test/compile-fail/macro-no-implicit-reexport.rs b/src/test/compile-fail/macro-no-implicit-reexport.rs index 1e2172f4a7..13dbab12b7 100644 --- a/src/test/compile-fail/macro-no-implicit-reexport.rs +++ b/src/test/compile-fail/macro-no-implicit-reexport.rs @@ -16,5 +16,5 @@ extern crate macro_non_reexport_2; fn main() { - assert_eq!(reexported!(), 3us); //~ ERROR macro undefined + assert_eq!(reexported!(), 3_usize); //~ ERROR macro undefined } diff --git a/src/test/compile-fail/macro-outer-attributes.rs b/src/test/compile-fail/macro-outer-attributes.rs index a0f23c72bc..cff01f36f3 100644 --- a/src/test/compile-fail/macro-outer-attributes.rs +++ b/src/test/compile-fail/macro-outer-attributes.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(custom_attribute)] + macro_rules! test { ($nm:ident, #[$a:meta], $i:item) => (mod $nm { #[$a] $i }); } diff --git a/src/test/compile-fail/macro-reexport-malformed-1.rs b/src/test/compile-fail/macro-reexport-malformed-1.rs index b9f754b277..6c85cf5c7f 100644 --- a/src/test/compile-fail/macro-reexport-malformed-1.rs +++ b/src/test/compile-fail/macro-reexport-malformed-1.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(macro_reexport)] + #[macro_reexport] //~ ERROR bad macro reexport extern crate std; diff --git a/src/test/compile-fail/macro-reexport-malformed-2.rs b/src/test/compile-fail/macro-reexport-malformed-2.rs index 9ced5be847..1dd0168181 100644 --- a/src/test/compile-fail/macro-reexport-malformed-2.rs +++ b/src/test/compile-fail/macro-reexport-malformed-2.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(macro_reexport)] + #[macro_reexport="foo"] //~ ERROR bad macro reexport extern crate std; diff --git a/src/test/compile-fail/macro-reexport-malformed-3.rs b/src/test/compile-fail/macro-reexport-malformed-3.rs index c8bd0a0509..7ae045f6e4 100644 --- a/src/test/compile-fail/macro-reexport-malformed-3.rs +++ b/src/test/compile-fail/macro-reexport-malformed-3.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(macro_reexport)] + #[macro_reexport(foo="bar")] //~ ERROR bad macro reexport extern crate std; diff --git a/src/test/compile-fail/macro-reexport-not-locally-visible.rs b/src/test/compile-fail/macro-reexport-not-locally-visible.rs index cf0d79e0fe..dc8f4fadc7 100644 --- a/src/test/compile-fail/macro-reexport-not-locally-visible.rs +++ b/src/test/compile-fail/macro-reexport-not-locally-visible.rs @@ -11,10 +11,12 @@ // aux-build:macro_reexport_1.rs // ignore-stage1 +#![feature(macro_reexport)] + #[macro_reexport(reexported)] #[no_link] extern crate macro_reexport_1; fn main() { - assert_eq!(reexported!(), 3us); //~ ERROR macro undefined + assert_eq!(reexported!(), 3_usize); //~ ERROR macro undefined } diff --git a/src/test/run-pass-fulldeps/plugin-args-4.rs b/src/test/compile-fail/macro-reexport-undef.rs similarity index 73% rename from src/test/run-pass-fulldeps/plugin-args-4.rs rename to src/test/compile-fail/macro-reexport-undef.rs index 8563c8c178..e9b3ceff83 100644 --- a/src/test/run-pass-fulldeps/plugin-args-4.rs +++ b/src/test/compile-fail/macro-reexport-undef.rs @@ -8,15 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:plugin_args.rs +// aux-build:two_macros.rs // ignore-stage1 -#![feature(plugin)] +#[macro_use(macro_two)] +#[macro_reexport(no_way)] //~ ERROR reexported macro not found +extern crate two_macros; -#[no_link] -#[plugin="foobar"] -extern crate plugin_args; - -fn main() { - assert_eq!(plugin_args!(), "#[plugin = \"foobar\"]"); +pub fn main() { + macro_two!(); } diff --git a/src/test/compile-fail/lint-renaming.rs b/src/test/compile-fail/macro-use-undef.rs similarity index 63% rename from src/test/compile-fail/lint-renaming.rs rename to src/test/compile-fail/macro-use-undef.rs index 7ffec37772..a5a350bd30 100644 --- a/src/test/compile-fail/lint-renaming.rs +++ b/src/test/compile-fail/macro-use-undef.rs @@ -1,4 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// 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. // @@ -8,9 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Check that lint deprecation works +// aux-build:two_macros.rs +// ignore-stage1 + +#[macro_use(macro_two, no_way)] //~ ERROR imported macro not found +extern crate two_macros; -#[deny(unused_variable)] //~ warning: lint unused_variable has been renamed to unused_variables pub fn main() { - let x = 0u8; //~ error: unused variable: + macro_two!(); } diff --git a/src/test/compile-fail/macros-nonfatal-errors.rs b/src/test/compile-fail/macros-nonfatal-errors.rs index ce1b372a4c..42a0f41dd9 100644 --- a/src/test/compile-fail/macros-nonfatal-errors.rs +++ b/src/test/compile-fail/macros-nonfatal-errors.rs @@ -15,7 +15,6 @@ #![feature(trace_macros, concat_idents)] #[derive(Default, //~ ERROR - Rand, //~ ERROR Zero)] //~ ERROR enum CantDeriveThose {} diff --git a/src/test/compile-fail/malformed-plugin-1.rs b/src/test/compile-fail/malformed-plugin-1.rs new file mode 100644 index 0000000000..254a797ef1 --- /dev/null +++ b/src/test/compile-fail/malformed-plugin-1.rs @@ -0,0 +1,13 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![plugin] //~ ERROR malformed plugin attribute + +fn main() {} diff --git a/src/test/compile-fail/malformed-plugin-2.rs b/src/test/compile-fail/malformed-plugin-2.rs new file mode 100644 index 0000000000..884087b7bc --- /dev/null +++ b/src/test/compile-fail/malformed-plugin-2.rs @@ -0,0 +1,13 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![plugin="bleh"] //~ ERROR malformed plugin attribute + +fn main() {} diff --git a/src/test/compile-fail/malformed-plugin-3.rs b/src/test/compile-fail/malformed-plugin-3.rs new file mode 100644 index 0000000000..4885bb901d --- /dev/null +++ b/src/test/compile-fail/malformed-plugin-3.rs @@ -0,0 +1,13 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![plugin(foo="bleh")] //~ ERROR malformed plugin attribute + +fn main() {} diff --git a/src/test/compile-fail/map-types.rs b/src/test/compile-fail/map-types.rs index ba2205f586..6e8719eeac 100644 --- a/src/test/compile-fail/map-types.rs +++ b/src/test/compile-fail/map-types.rs @@ -14,7 +14,10 @@ extern crate collections; use std::collections::HashMap; -trait Map {} +trait Map +{ + fn get(&self, k: K) -> V { panic!() } +} impl Map for HashMap {} diff --git a/src/test/compile-fail/match-ill-type1.rs b/src/test/compile-fail/match-ill-type1.rs index 908d46f398..c60ef2ed28 100644 --- a/src/test/compile-fail/match-ill-type1.rs +++ b/src/test/compile-fail/match-ill-type1.rs @@ -10,7 +10,7 @@ fn main() { match 1 { - 1...2us => 1, //~ ERROR mismatched types in range + 1...2_usize => 1, //~ ERROR mismatched types in range _ => 2, }; } diff --git a/src/test/compile-fail/match-ill-type2.rs b/src/test/compile-fail/match-ill-type2.rs index 6b6954101b..aa47ea670f 100644 --- a/src/test/compile-fail/match-ill-type2.rs +++ b/src/test/compile-fail/match-ill-type2.rs @@ -9,9 +9,9 @@ // except according to those terms. fn main() { - match 1is { - 1is => 1is, - 2us => 1is, //~ ERROR mismatched types - _ => 2is, + match 1i32 { + 1i32 => 1, + 2u32 => 1, //~ ERROR mismatched types + _ => 2, }; } diff --git a/src/test/compile-fail/match-non-exhaustive.rs b/src/test/compile-fail/match-non-exhaustive.rs index 2aeccacb0f..a24d2ed4b7 100644 --- a/src/test/compile-fail/match-non-exhaustive.rs +++ b/src/test/compile-fail/match-non-exhaustive.rs @@ -9,6 +9,6 @@ // except according to those terms. fn main() { - match 0is { 1is => () } //~ ERROR non-exhaustive patterns - match 0is { 0is if false => () } //~ ERROR non-exhaustive patterns + match 0 { 1 => () } //~ ERROR non-exhaustive patterns + match 0 { 0 if false => () } //~ ERROR non-exhaustive patterns } diff --git a/src/test/compile-fail/match-range-fail-dominate.rs b/src/test/compile-fail/match-range-fail-dominate.rs index 7d33963003..825a485d52 100644 --- a/src/test/compile-fail/match-range-fail-dominate.rs +++ b/src/test/compile-fail/match-range-fail-dominate.rs @@ -15,21 +15,21 @@ //error-pattern: unreachable fn main() { - match 5us { - 1us ... 10us => { } - 5us ... 6us => { } + match 5 { + 1 ... 10 => { } + 5 ... 6 => { } _ => {} }; - match 5us { - 3us ... 6us => { } - 4us ... 6us => { } + match 5 { + 3 ... 6 => { } + 4 ... 6 => { } _ => {} }; - match 5us { - 4us ... 6us => { } - 4us ... 6us => { } + match 5 { + 4 ... 6 => { } + 4 ... 6 => { } _ => {} }; diff --git a/src/test/compile-fail/match-range-fail.rs b/src/test/compile-fail/match-range-fail.rs index 1c804b0552..c3292adfa3 100644 --- a/src/test/compile-fail/match-range-fail.rs +++ b/src/test/compile-fail/match-range-fail.rs @@ -13,8 +13,8 @@ //error-pattern: mismatched types fn main() { - match 5us { - 6us ... 1us => { } + match 5 { + 6 ... 1 => { } _ => { } }; @@ -22,8 +22,8 @@ fn main() { "bar" ... "foo" => { } }; - match 5us { - 'c' ... 100us => { } + match 5 { + 'c' ... 100 => { } _ => { } }; } diff --git a/src/test/compile-fail/match-static-const-lc.rs b/src/test/compile-fail/match-static-const-lc.rs index 345c4aa69a..04b234d8db 100644 --- a/src/test/compile-fail/match-static-const-lc.rs +++ b/src/test/compile-fail/match-static-const-lc.rs @@ -19,7 +19,7 @@ pub const a : isize = 97; fn f() { let r = match (0,0) { (0, a) => 0, - //~^ ERROR static constant in pattern `a` should have an uppercase name such as `A` + //~^ ERROR constant in pattern `a` should have an upper case name such as `A` (x, y) => 1 + x + y, }; assert!(r == 1); @@ -34,7 +34,7 @@ fn g() { use self::m::aha; let r = match (0,0) { (0, aha) => 0, - //~^ ERROR static constant in pattern `aha` should have an uppercase name such as `AHA` + //~^ ERROR constant in pattern `aha` should have an upper case name such as `AHA` (x, y) => 1 + x + y, }; assert!(r == 1); @@ -48,7 +48,7 @@ fn h() { use self::n::OKAY as not_okay; let r = match (0,0) { (0, not_okay) => 0, -//~^ ERROR static constant in pattern `not_okay` should have an uppercase name such as `NOT_OKAY` +//~^ ERROR constant in pattern `not_okay` should have an upper case name such as `NOT_OKAY` (x, y) => 1 + x + y, }; assert!(r == 1); diff --git a/src/test/compile-fail/match-struct.rs b/src/test/compile-fail/match-struct.rs index e3b47372a4..5bda378968 100644 --- a/src/test/compile-fail/match-struct.rs +++ b/src/test/compile-fail/match-struct.rs @@ -14,7 +14,12 @@ enum E { C(isize) } fn main() { match (S { a: 1 }) { - E::C(_) => (), //~ ERROR mismatched types: expected `S`, found `E` + E::C(_) => (), + //~^ ERROR mismatched types + //~| expected `S` + //~| found `E` + //~| expected struct `S` + //~| found enum `E` _ => () } } diff --git a/src/test/compile-fail/match-vec-fixed.rs b/src/test/compile-fail/match-vec-fixed.rs index c35dc8d7c8..e778dd18e6 100644 --- a/src/test/compile-fail/match-vec-fixed.rs +++ b/src/test/compile-fail/match-vec-fixed.rs @@ -9,7 +9,7 @@ // except according to those terms. fn a() { - let v = [1is, 2, 3]; + let v = [1, 2, 3]; match v { [_, _, _] => {} [_, _, _] => {} //~ ERROR unreachable pattern diff --git a/src/test/compile-fail/match-vec-mismatch-2.rs b/src/test/compile-fail/match-vec-mismatch-2.rs index 6bb049f3ca..a4abdf3ddf 100644 --- a/src/test/compile-fail/match-vec-mismatch-2.rs +++ b/src/test/compile-fail/match-vec-mismatch-2.rs @@ -11,6 +11,10 @@ fn main() { match () { [()] => { } -//~^ ERROR mismatched types: expected `()`, found `&[_]` (expected (), found &-ptr) + //~^ ERROR mismatched types + //~| expected `()` + //~| found `&[_]` + //~| expected () + //~| found &-ptr } } diff --git a/src/test/compile-fail/match-vec-unreachable.rs b/src/test/compile-fail/match-vec-unreachable.rs index e2671552b4..2c63438cbf 100644 --- a/src/test/compile-fail/match-vec-unreachable.rs +++ b/src/test/compile-fail/match-vec-unreachable.rs @@ -11,7 +11,7 @@ fn main() { let x: Vec<(isize, isize)> = Vec::new(); - let x: &[(isize, isize)] = x.as_slice(); + let x: &[(isize, isize)] = &x; match x { [a, (2, 3), _] => (), [(1, 2), (2, 3), b] => (), //~ ERROR unreachable pattern @@ -21,7 +21,7 @@ fn main() { let x: Vec = vec!["foo".to_string(), "bar".to_string(), "baz".to_string()]; - let x: &[String] = x.as_slice(); + let x: &[String] = &x; match x { [a, _, _, ..] => { println!("{}", a); } [_, _, _, _, _] => { } //~ ERROR unreachable pattern @@ -29,7 +29,7 @@ fn main() { } let x: Vec = vec!('a', 'b', 'c'); - let x: &[char] = x.as_slice(); + let x: &[char] = &x; match x { ['a', 'b', 'c', _tail..] => {} ['a', 'b', 'c'] => {} //~ ERROR unreachable pattern diff --git a/src/test/compile-fail/method-ambig-one-trait-coerce.rs b/src/test/compile-fail/method-ambig-one-trait-coerce.rs deleted file mode 100644 index cb5da4bb54..0000000000 --- a/src/test/compile-fail/method-ambig-one-trait-coerce.rs +++ /dev/null @@ -1,50 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that when we pick a trait based on coercion, versus subtyping, -// we consider all possible coercions equivalent and don't try to pick -// a best one. - -trait Object { } - -trait foo { - fn foo(self) -> isize; -} - -impl foo for Box { - fn foo(self) -> isize {1} -} - -impl foo for Box { - fn foo(self) -> isize {2} -} - -fn test1(x: Box) { - // FIXME(#18737) -- we ought to consider this to be ambiguous, - // since we could coerce to either impl. However, what actually - // happens is that we consider both impls applicable because of - // incorrect subtyping relation. We then decide to call this a - // call to the `foo` trait, leading to the following error - // message. - - x.foo(); //~ ERROR `foo` is not implemented -} - -fn test2(x: Box) { - // Not ambiguous because it is a precise match: - x.foo(); -} - -fn test3(x: Box) { - // Not ambiguous because it is a precise match: - x.foo(); -} - -fn main() { } diff --git a/src/test/compile-fail/method-ambig-two-traits-cross-crate.rs b/src/test/compile-fail/method-ambig-two-traits-cross-crate.rs index cab6a8610b..981c4c6f40 100644 --- a/src/test/compile-fail/method-ambig-two-traits-cross-crate.rs +++ b/src/test/compile-fail/method-ambig-two-traits-cross-crate.rs @@ -18,5 +18,5 @@ trait me2 { fn me(&self) -> usize; } impl me2 for usize { fn me(&self) -> usize { *self } } -fn main() { 1us.me(); } //~ ERROR E0034 +fn main() { 1_usize.me(); } //~ ERROR E0034 diff --git a/src/test/compile-fail/method-ambig-two-traits-with-default-method.rs b/src/test/compile-fail/method-ambig-two-traits-with-default-method.rs index 87e3655d31..17312fb186 100644 --- a/src/test/compile-fail/method-ambig-two-traits-with-default-method.rs +++ b/src/test/compile-fail/method-ambig-two-traits-with-default-method.rs @@ -19,5 +19,5 @@ impl Foo for usize {} impl Bar for usize {} fn main() { - 1us.method(); //~ ERROR E0034 + 1_usize.method(); //~ ERROR E0034 } diff --git a/src/test/compile-fail/method-missing-call.rs b/src/test/compile-fail/method-missing-call.rs index 899c1ef16a..6616dcc8e1 100644 --- a/src/test/compile-fail/method-missing-call.rs +++ b/src/test/compile-fail/method-missing-call.rs @@ -33,7 +33,7 @@ fn main() { //~^ HELP maybe a `()` to call it is missing // Ensure the span is useful - let ys = &[1is,2,3,4,5,6,7]; + let ys = &[1,2,3,4,5,6,7]; let a = ys.iter() .map(|x| x) .filter(|&&x| x == 1) diff --git a/src/test/compile-fail/method-self-arg-1.rs b/src/test/compile-fail/method-self-arg-1.rs index 178b731997..7b6868af80 100644 --- a/src/test/compile-fail/method-self-arg-1.rs +++ b/src/test/compile-fail/method-self-arg-1.rs @@ -18,7 +18,14 @@ impl Foo { fn main() { let x = Foo; - Foo::bar(x); //~ERROR mismatched types: expected `&Foo`, found `Foo` - Foo::bar(&&x); //~ERROR mismatched types: expected `&Foo`, found `&&Foo` - Foo::bar(&42is); //~ERROR mismatched types: expected `&Foo`, found `&isize` + Foo::bar(x); //~ ERROR mismatched types + //~| expected `&Foo` + //~| found `Foo` + //~| expected &-ptr + //~| found struct `Foo` + Foo::bar(&42i32); //~ ERROR mismatched types + //~| expected `&Foo` + //~| found `&i32` + //~| expected struct `Foo` + //~| found i32 } diff --git a/src/test/compile-fail/method-self-arg-2.rs b/src/test/compile-fail/method-self-arg-2.rs index ad255ecd9c..dd5b200414 100644 --- a/src/test/compile-fail/method-self-arg-2.rs +++ b/src/test/compile-fail/method-self-arg-2.rs @@ -22,6 +22,7 @@ fn main() { let y = &mut x; Foo::bar(&x); //~ERROR cannot borrow `x` - let x = Foo; - Foo::baz(&x); //~ERROR cannot borrow immutable borrowed content as mutable + let mut x = Foo; + let y = &mut x; + Foo::baz(&mut x); //~ERROR cannot borrow `x` } diff --git a/src/test/compile-fail/method-suggestion-no-duplication.rs b/src/test/compile-fail/method-suggestion-no-duplication.rs new file mode 100644 index 0000000000..e807d2b944 --- /dev/null +++ b/src/test/compile-fail/method-suggestion-no-duplication.rs @@ -0,0 +1,24 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// issue #21405 + +struct Foo; + +fn foo(f: F) where F: FnMut(Foo) {} + +fn main() { + foo(|s| s.is_empty()); + //~^ ERROR does not implement any method + //~^^ HELP #1: `core::slice::SliceExt` + //~^^^ HELP #2: `core::str::StrExt` + //~^^^^ HELP #3: `collections::slice::SliceExt` + //~^^^^^ HELP #4: `collections::str::StrExt` +} diff --git a/src/test/compile-fail/missing-stability.rs b/src/test/compile-fail/missing-stability.rs new file mode 100644 index 0000000000..cf7a8378b9 --- /dev/null +++ b/src/test/compile-fail/missing-stability.rs @@ -0,0 +1,33 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Checks that exported items without stability attributes cause an error + +#![crate_type="lib"] +#![feature(staged_api)] +#![staged_api] + +pub fn unmarked() { + //~^ ERROR This node does not have a stability attribute + () +} + +#[unstable(feature = "foo")] +pub mod foo { + // #[unstable] is inherited + pub fn unmarked() {} +} + +#[stable(feature = "bar", since="1.0.0")] +pub mod bar { + // #[stable] is not inherited + pub fn unmarked() {} + //~^ ERROR This node does not have a stability attribute +} diff --git a/src/test/compile-fail/missing_debug_impls.rs b/src/test/compile-fail/missing_debug_impls.rs new file mode 100644 index 0000000000..ddc9081e33 --- /dev/null +++ b/src/test/compile-fail/missing_debug_impls.rs @@ -0,0 +1,48 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: --crate-type lib +#![deny(missing_debug_implementations)] +#![allow(unused)] + +use std::fmt; + +pub enum A {} //~ ERROR type does not implement `fmt::Debug` + +#[derive(Debug)] +pub enum B {} + +pub enum C {} + +impl fmt::Debug for C { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + Ok(()) + } +} + +pub struct Foo; //~ ERROR type does not implement `fmt::Debug` + +#[derive(Debug)] +pub struct Bar; + +pub struct Baz; + +impl fmt::Debug for Baz { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + Ok(()) + } +} + +struct PrivateStruct; + +enum PrivateEnum {} + +#[derive(Debug)] +struct GenericType(T); diff --git a/src/test/compile-fail/move-fragments-1.rs b/src/test/compile-fail/move-fragments-1.rs index 3f14be2da1..0219f5b6be 100644 --- a/src/test/compile-fail/move-fragments-1.rs +++ b/src/test/compile-fail/move-fragments-1.rs @@ -18,6 +18,8 @@ // These are all fairly trivial cases: unused variables or direct // drops of substructure. +#![feature(rustc_attrs)] + pub struct D { d: isize } impl Drop for D { fn drop(&mut self) { } } diff --git a/src/test/compile-fail/move-fragments-2.rs b/src/test/compile-fail/move-fragments-2.rs index 6c0635d6be..175488bf2f 100644 --- a/src/test/compile-fail/move-fragments-2.rs +++ b/src/test/compile-fail/move-fragments-2.rs @@ -18,6 +18,8 @@ // These are checking that enums are tracked; note that their output // paths include "downcasts" of the path to a particular enum. +#![feature(rustc_attrs)] + use self::Lonely::{Zero, One, Two}; pub struct D { d: isize } diff --git a/src/test/compile-fail/move-fragments-3.rs b/src/test/compile-fail/move-fragments-3.rs index 24d73ec227..b65921177a 100644 --- a/src/test/compile-fail/move-fragments-3.rs +++ b/src/test/compile-fail/move-fragments-3.rs @@ -18,6 +18,8 @@ // This checks the handling of `_` within variants, especially when mixed // with bindings. +#![feature(rustc_attrs)] + use self::Lonely::{Zero, One, Two}; pub struct D { d: isize } diff --git a/src/test/compile-fail/move-fragments-4.rs b/src/test/compile-fail/move-fragments-4.rs index 97e8e45ed0..191e23a286 100644 --- a/src/test/compile-fail/move-fragments-4.rs +++ b/src/test/compile-fail/move-fragments-4.rs @@ -19,6 +19,8 @@ // early draft of the code did not properly traverse up through all of // the parents of the leaf fragment.) +#![feature(rustc_attrs)] + pub struct D { d: isize } impl Drop for D { fn drop(&mut self) { } } diff --git a/src/test/compile-fail/move-fragments-5.rs b/src/test/compile-fail/move-fragments-5.rs index 9f70421fa8..38a385eaca 100644 --- a/src/test/compile-fail/move-fragments-5.rs +++ b/src/test/compile-fail/move-fragments-5.rs @@ -17,6 +17,8 @@ // This is the first test that checks moving into local variables. +#![feature(rustc_attrs)] + pub struct D { d: isize } impl Drop for D { fn drop(&mut self) { } } diff --git a/src/test/compile-fail/move-fragments-6.rs b/src/test/compile-fail/move-fragments-6.rs index b249d0d739..122727c3f6 100644 --- a/src/test/compile-fail/move-fragments-6.rs +++ b/src/test/compile-fail/move-fragments-6.rs @@ -18,6 +18,8 @@ // Test that moving into a field (i.e. overwriting it) fragments the // receiver. +#![feature(rustc_attrs)] + use std::mem::drop; pub struct Pair { x: X, y: Y } diff --git a/src/test/compile-fail/move-fragments-7.rs b/src/test/compile-fail/move-fragments-7.rs index 2af2b2957f..a2a37208cd 100644 --- a/src/test/compile-fail/move-fragments-7.rs +++ b/src/test/compile-fail/move-fragments-7.rs @@ -19,6 +19,8 @@ // both moving out of the structure (i.e. reading `*p.x`) and writing // into the container (i.e. writing `*p.x`). +#![feature(rustc_attrs)] + pub struct D { d: isize } impl Drop for D { fn drop(&mut self) { } } diff --git a/src/test/compile-fail/move-fragments-8.rs b/src/test/compile-fail/move-fragments-8.rs index 18bf406607..e57268dbfa 100644 --- a/src/test/compile-fail/move-fragments-8.rs +++ b/src/test/compile-fail/move-fragments-8.rs @@ -22,6 +22,8 @@ // also that in this case we cannot do a move out of `&T`, so we only // test writing `*p.x` here. +#![feature(rustc_attrs)] + pub struct D { d: isize } impl Drop for D { fn drop(&mut self) { } } diff --git a/src/test/compile-fail/move-fragments-9.rs b/src/test/compile-fail/move-fragments-9.rs index d0eeebd02f..350f416903 100644 --- a/src/test/compile-fail/move-fragments-9.rs +++ b/src/test/compile-fail/move-fragments-9.rs @@ -14,6 +14,8 @@ // Note also that the `test_move_array_then_overwrite` tests represent // cases that we probably should make illegal. +#![feature(rustc_attrs)] + pub struct D { d: isize } impl Drop for D { fn drop(&mut self) { } } @@ -33,15 +35,6 @@ pub fn test_move_array_into_recv(a: [D; 3], recv: &mut [D; 3]) { *recv = a; } -#[rustc_move_fragments] -pub fn test_extract_array_elem(a: [D; 3], i: usize) -> D { - //~^ ERROR parent_of_fragments: `$(local a)` - //~| ERROR assigned_leaf_path: `$(local i)` - //~| ERROR moved_leaf_path: `$(local a).[]` - //~| ERROR unmoved_fragment: `$(allbutone $(local a).[])` - a[i] -} - #[rustc_move_fragments] pub fn test_overwrite_array_elem(mut a: [D; 3], i: usize, d: D) { //~^ ERROR parent_of_fragments: `$(local mut a)` @@ -53,48 +46,4 @@ pub fn test_overwrite_array_elem(mut a: [D; 3], i: usize, d: D) { a[i] = d; } -// FIXME (pnkfelix): Both test_move_array_then_overwrite_elem1 and -// test_move_array_then_overwrite_elem2 illustrate a behavior that -// we need to make illegal if we want to get rid of drop-flags. -// See RFC PR 320 for more discussion. - -#[rustc_move_fragments] -pub fn test_move_array_then_overwrite_elem1(mut a: [D; 3], i: usize, recv: &mut [D; 3], d: D) { - //~^ ERROR parent_of_fragments: `$(local mut a)` - //~| ERROR parent_of_fragments: `$(local recv)` - //~| ERROR assigned_leaf_path: `$(local recv).*` - //~| ERROR assigned_leaf_path: `$(local i)` - //~| ERROR assigned_leaf_path: `$(local d)` - //~| ERROR moved_leaf_path: `$(local d)` - //~| ERROR assigned_leaf_path: `$(local mut a).[]` - //~| ERROR unmoved_fragment: `$(allbutone $(local mut a).[])` - - // This test covers the case where the array contents have been all moved away, but - // we still need to deal with new initializing writes into the array. - *recv = a; - a[i] = d; -} - -#[rustc_move_fragments] -pub fn test_move_array_then_overwrite_elem2(mut a: [D; 3], i: usize, j: usize, - recv: &mut [D; 3], d1: D, d2: D) { - //~^^ ERROR parent_of_fragments: `$(local mut a)` - //~| ERROR parent_of_fragments: `$(local recv)` - //~| ERROR assigned_leaf_path: `$(local recv).*` - //~| ERROR assigned_leaf_path: `$(local i)` - //~| ERROR assigned_leaf_path: `$(local j)` - //~| ERROR assigned_leaf_path: `$(local d1)` - //~| ERROR assigned_leaf_path: `$(local d2)` - //~| ERROR moved_leaf_path: `$(local d1)` - //~| ERROR moved_leaf_path: `$(local d2)` - //~| ERROR assigned_leaf_path: `$(local mut a).[]` - //~| ERROR unmoved_fragment: `$(allbutone $(local mut a).[])` - - // This test covers the case where the array contents have been all moved away, but - // we still need to deal with new initializing writes into the array. - *recv = a; - a[i] = d1; - a[j] = d2; -} - pub fn main() { } diff --git a/src/test/compile-fail/move-into-dead-array-1.rs b/src/test/compile-fail/move-into-dead-array-1.rs new file mode 100644 index 0000000000..61ccb694fd --- /dev/null +++ b/src/test/compile-fail/move-into-dead-array-1.rs @@ -0,0 +1,25 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Ensure that we cannot move into an uninitialized fixed-size array. + +struct D { _x: u8 } + +fn d() -> D { D { _x: 0 } } + +fn main() { + foo(1); + foo(3); +} + +fn foo(i: usize) { + let mut a: [D; 4]; + a[i] = d(); //~ ERROR use of possibly uninitialized variable: `a` +} diff --git a/src/test/compile-fail/move-into-dead-array-2.rs b/src/test/compile-fail/move-into-dead-array-2.rs new file mode 100644 index 0000000000..d484837c00 --- /dev/null +++ b/src/test/compile-fail/move-into-dead-array-2.rs @@ -0,0 +1,25 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Ensure that we cannot move into an uninitialized fixed-size array. + +struct D { _x: u8 } + +fn d() -> D { D { _x: 0 } } + +fn main() { + foo([d(), d(), d(), d()], 1); + foo([d(), d(), d(), d()], 3); +} + +fn foo(mut a: [D; 4], i: usize) { + drop(a); + a[i] = d(); //~ ERROR use of moved value: `a` +} diff --git a/src/test/compile-fail/move-out-of-array-1.rs b/src/test/compile-fail/move-out-of-array-1.rs new file mode 100644 index 0000000000..148dec0282 --- /dev/null +++ b/src/test/compile-fail/move-out-of-array-1.rs @@ -0,0 +1,28 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Ensure that we cannot move out of a fixed-size array (especially +// when the element type has a destructor). + + +struct D { _x: u8 } + +impl Drop for D { fn drop(&mut self) { } } + +fn main() { + fn d() -> D { D { _x: 0 } } + + let _d1 = foo([d(), d(), d(), d()], 1); + let _d3 = foo([d(), d(), d(), d()], 3); +} + +fn foo(a: [D; 4], i: usize) -> D { + a[i] //~ ERROR cannot move out of type `[D; 4]` +} diff --git a/src/test/compile-fail/move-out-of-tuple-field.rs b/src/test/compile-fail/move-out-of-tuple-field.rs index ace6c80e3e..7e3a85569d 100644 --- a/src/test/compile-fail/move-out-of-tuple-field.rs +++ b/src/test/compile-fail/move-out-of-tuple-field.rs @@ -13,11 +13,11 @@ struct Foo(Box); fn main() { - let x = (box 1is,); + let x = (box 1,); let y = x.0; let z = x.0; //~ ERROR use of moved value: `x.0` - let x = Foo(box 1is); + let x = Foo(box 1); let y = x.0; let z = x.0; //~ ERROR use of moved value: `x.0` } diff --git a/src/test/compile-fail/moves-based-on-type-block-bad.rs b/src/test/compile-fail/moves-based-on-type-block-bad.rs index 179c71d365..a1e876594c 100644 --- a/src/test/compile-fail/moves-based-on-type-block-bad.rs +++ b/src/test/compile-fail/moves-based-on-type-block-bad.rs @@ -10,6 +10,7 @@ // ignore-tidy-linelength +#![feature(box_patterns)] #![feature(box_syntax)] struct S { diff --git a/src/test/compile-fail/moves-based-on-type-capture-clause-bad.rs b/src/test/compile-fail/moves-based-on-type-capture-clause-bad.rs index dc90994fcc..32fa773ec8 100644 --- a/src/test/compile-fail/moves-based-on-type-capture-clause-bad.rs +++ b/src/test/compile-fail/moves-based-on-type-capture-clause-bad.rs @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::thread::Thread; +use std::thread; fn main() { let x = "Hello world!".to_string(); - Thread::spawn(move|| { + thread::spawn(move|| { println!("{}", x); }); println!("{}", x); //~ ERROR use of moved value diff --git a/src/test/compile-fail/moves-based-on-type-exprs.rs b/src/test/compile-fail/moves-based-on-type-exprs.rs index 58f1f78fa5..9ad44567a4 100644 --- a/src/test/compile-fail/moves-based-on-type-exprs.rs +++ b/src/test/compile-fail/moves-based-on-type-exprs.rs @@ -24,13 +24,13 @@ fn f10() { fn f20() { let x = "hi".to_string(); - let _y = (x, 3is); + let _y = (x, 3); touch(&x); //~ ERROR use of moved value: `x` } fn f21() { - let x = vec!(1is, 2, 3); - let _y = (x[0], 3is); + let x = vec!(1, 2, 3); + let _y = (x[0], 3); touch(&x); } @@ -61,9 +61,9 @@ fn f50(cond: bool) { let x = "hi".to_string(); let y = "ho".to_string(); let _y = match cond { - _ if guard(x) => 10is, - true => 10is, - false => 20is, + _ if guard(x) => 10, + true => 10, + false => 20, }; touch(&x); //~ ERROR use of moved value: `x` touch(&y); @@ -95,7 +95,7 @@ fn f110() { fn f120() { let mut x = vec!("hi".to_string(), "ho".to_string()); - x.as_mut_slice().swap(0, 1); + x.swap(0, 1); touch(&x[0]); touch(&x[1]); } diff --git a/src/test/compile-fail/moves-based-on-type-move-out-of-closure-env-issue-1965.rs b/src/test/compile-fail/moves-based-on-type-move-out-of-closure-env-issue-1965.rs index 5dfe7f0c71..4251be36ab 100644 --- a/src/test/compile-fail/moves-based-on-type-move-out-of-closure-env-issue-1965.rs +++ b/src/test/compile-fail/moves-based-on-type-move-out-of-closure-env-issue-1965.rs @@ -8,13 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(box_syntax)] +#![feature(box_syntax, unboxed_closures)] use std::usize; +fn to_fn>(f: F) -> F { f } + fn test(_x: Box) {} fn main() { let i = box 3; - let _f = |&:| test(i); //~ ERROR cannot move out + let _f = to_fn(|| test(i)); //~ ERROR cannot move out } diff --git a/src/test/compile-fail/multiple-main-2.rs b/src/test/compile-fail/multiple-main-2.rs index e3dbc67b7a..d9c232d7da 100644 --- a/src/test/compile-fail/multiple-main-2.rs +++ b/src/test/compile-fail/multiple-main-2.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(main)] + #[main] fn bar() { } diff --git a/src/test/compile-fail/multiple-main-3.rs b/src/test/compile-fail/multiple-main-3.rs index 58cc148568..866a59e7a4 100644 --- a/src/test/compile-fail/multiple-main-3.rs +++ b/src/test/compile-fail/multiple-main-3.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(main)] + #[main] fn main1() { } diff --git a/src/test/compile-fail/mut-cant-alias.rs b/src/test/compile-fail/mut-cant-alias.rs index 847a3eaf8a..99d7258477 100644 --- a/src/test/compile-fail/mut-cant-alias.rs +++ b/src/test/compile-fail/mut-cant-alias.rs @@ -11,7 +11,7 @@ use std::cell::RefCell; fn main() { - let m = RefCell::new(0is); + let m = RefCell::new(0); let mut b = m.borrow_mut(); let b1 = &mut *b; let b2 = &mut *b; //~ ERROR cannot borrow diff --git a/src/test/compile-fail/mut-cross-borrowing.rs b/src/test/compile-fail/mut-cross-borrowing.rs index 7fb5c2ac4a..2cf6e67a90 100644 --- a/src/test/compile-fail/mut-cross-borrowing.rs +++ b/src/test/compile-fail/mut-cross-borrowing.rs @@ -13,7 +13,7 @@ fn f(_: &mut isize) {} fn main() { - let mut x = box 3is; + let mut x = box 3; f(x) //~ ERROR mismatched types } diff --git a/src/test/compile-fail/mut-not-freeze.rs b/src/test/compile-fail/mut-not-freeze.rs index 8c39320276..2269c58c97 100644 --- a/src/test/compile-fail/mut-not-freeze.rs +++ b/src/test/compile-fail/mut-not-freeze.rs @@ -13,7 +13,7 @@ use std::cell::RefCell; fn f(_: T) {} fn main() { - let x = RefCell::new(0is); + let x = RefCell::new(0); f(x); //~^ ERROR `core::marker::Sync` is not implemented //~^^ ERROR `core::marker::Sync` is not implemented diff --git a/src/test/compile-fail/mut-pattern-internal-mutability.rs b/src/test/compile-fail/mut-pattern-internal-mutability.rs index 92f02114a1..b0d618328d 100644 --- a/src/test/compile-fail/mut-pattern-internal-mutability.rs +++ b/src/test/compile-fail/mut-pattern-internal-mutability.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - let foo = &mut 1is; + let foo = &mut 1; let &mut x = foo; x += 1; //~ ERROR re-assignment of immutable variable diff --git a/src/test/compile-fail/mut-pattern-mismatched.rs b/src/test/compile-fail/mut-pattern-mismatched.rs index 9f1d3d1fb3..6de69a9adb 100644 --- a/src/test/compile-fail/mut-pattern-mismatched.rs +++ b/src/test/compile-fail/mut-pattern-mismatched.rs @@ -9,16 +9,22 @@ // except according to those terms. fn main() { - let foo = &mut 1is; + let foo = &mut 1i32; // (separate lines to ensure the spans are accurate) - let &_ //~ ERROR expected `&mut isize`, found `&_` + let &_ //~ ERROR mismatched types + //~| expected `&mut i32` + //~| found `&_` + //~| values differ in mutability = foo; let &mut _ = foo; - let bar = &1is; + let bar = &1i32; let &_ = bar; - let &mut _ //~ ERROR expected `&isize`, found `&mut _` + let &mut _ //~ ERROR mismatched types + //~| expected `&i32` + //~| found `&mut _` + //~| values differ in mutability = bar; } diff --git a/src/test/compile-fail/mut-ptr-cant-outlive-ref.rs b/src/test/compile-fail/mut-ptr-cant-outlive-ref.rs index 74b561c37a..8e968d90a2 100644 --- a/src/test/compile-fail/mut-ptr-cant-outlive-ref.rs +++ b/src/test/compile-fail/mut-ptr-cant-outlive-ref.rs @@ -11,7 +11,7 @@ use std::cell::RefCell; fn main() { - let m = RefCell::new(0is); + let m = RefCell::new(0); let p; { let b = m.borrow(); diff --git a/src/test/compile-fail/mutable-class-fields-2.rs b/src/test/compile-fail/mutable-class-fields-2.rs index 932c2a9715..b6744d4b33 100644 --- a/src/test/compile-fail/mutable-class-fields-2.rs +++ b/src/test/compile-fail/mutable-class-fields-2.rs @@ -29,6 +29,6 @@ fn cat(in_x : usize, in_y : isize) -> cat { } fn main() { - let nyan : cat = cat(52us, 99); + let nyan : cat = cat(52_usize, 99); nyan.eat(); } diff --git a/src/test/compile-fail/mutable-class-fields.rs b/src/test/compile-fail/mutable-class-fields.rs index a840ac63dd..94b1047f85 100644 --- a/src/test/compile-fail/mutable-class-fields.rs +++ b/src/test/compile-fail/mutable-class-fields.rs @@ -21,6 +21,6 @@ fn cat(in_x : usize, in_y : isize) -> cat { } fn main() { - let nyan : cat = cat(52us, 99); + let nyan : cat = cat(52_usize, 99); nyan.how_hungry = 0; //~ ERROR cannot assign } diff --git a/src/test/compile-fail/mutable-enum-indirect.rs b/src/test/compile-fail/mutable-enum-indirect.rs index f90bb610d3..1657d602e2 100644 --- a/src/test/compile-fail/mutable-enum-indirect.rs +++ b/src/test/compile-fail/mutable-enum-indirect.rs @@ -11,13 +11,18 @@ // Tests that an `&` pointer to something inherently mutable is itself // to be considered mutable. -use std::marker; +#![feature(optin_builtin_traits)] -enum Foo { A(marker::NoSync) } +use std::marker::Sync; + +struct NoSync; +impl !Sync for NoSync {} + +enum Foo { A(NoSync) } fn bar(_: T) {} fn main() { - let x = Foo::A(marker::NoSync); + let x = Foo::A(NoSync); bar(&x); //~ ERROR the trait `core::marker::Sync` is not implemented } diff --git a/src/test/compile-fail/no-capture-arc.rs b/src/test/compile-fail/no-capture-arc.rs index beb0d0ee47..7b7b3c414d 100644 --- a/src/test/compile-fail/no-capture-arc.rs +++ b/src/test/compile-fail/no-capture-arc.rs @@ -11,13 +11,13 @@ // error-pattern: use of moved value use std::sync::Arc; -use std::thread::Thread; +use std::thread; fn main() { - let v = vec!(1is, 2, 3, 4, 5, 6, 7, 8, 9, 10); + let v = vec!(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); let arc_v = Arc::new(v); - Thread::spawn(move|| { + thread::spawn(move|| { assert_eq!((*arc_v)[3], 4); }); diff --git a/src/test/compile-fail/no-method-suggested-traits.rs b/src/test/compile-fail/no-method-suggested-traits.rs new file mode 100644 index 0000000000..21f8a98280 --- /dev/null +++ b/src/test/compile-fail/no-method-suggested-traits.rs @@ -0,0 +1,134 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:no_method_suggested_traits.rs + +extern crate no_method_suggested_traits; + +struct Foo; +enum Bar { X } + +mod foo { + trait Bar { + fn method(&self) {} + + fn method2(&self) {} + } + + impl Bar for u32 {} + + impl Bar for char {} +} + +fn main() { + // test the values themselves, and autoderef. + + + 1u32.method(); + //~^ HELP following traits are implemented but not in scope, perhaps add a `use` for one of them + //~^^ ERROR does not implement + //~^^^ HELP `foo::Bar` + //~^^^^ HELP `no_method_suggested_traits::foo::PubPub` + std::rc::Rc::new(&mut Box::new(&1u32)).method(); + //~^ HELP following traits are implemented but not in scope, perhaps add a `use` for one of them + //~^^ ERROR does not implement + //~^^^ HELP `foo::Bar` + //~^^^^ HELP `no_method_suggested_traits::foo::PubPub` + + 'a'.method(); + //~^ ERROR does not implement + //~^^ HELP the following trait is implemented but not in scope, perhaps add a `use` for it: + //~^^^ HELP `foo::Bar` + std::rc::Rc::new(&mut Box::new(&'a')).method(); + //~^ ERROR does not implement + //~^^ HELP the following trait is implemented but not in scope, perhaps add a `use` for it: + //~^^^ HELP `foo::Bar` + + 1i32.method(); + //~^ ERROR does not implement + //~^^ HELP the following trait is implemented but not in scope, perhaps add a `use` for it: + //~^^^ HELP `no_method_suggested_traits::foo::PubPub` + std::rc::Rc::new(&mut Box::new(&1i32)).method(); + //~^ ERROR does not implement + //~^^ HELP the following trait is implemented but not in scope, perhaps add a `use` for it: + //~^^^ HELP `no_method_suggested_traits::foo::PubPub` + + Foo.method(); + //~^ ERROR does not implement + //~^^ HELP following traits define a method `method`, perhaps you need to implement one of them + //~^^^ HELP `foo::Bar` + //~^^^^ HELP `no_method_suggested_traits::foo::PubPub` + //~^^^^^ HELP `no_method_suggested_traits::reexport::Reexported` + //~^^^^^^ HELP `no_method_suggested_traits::bar::PubPriv` + //~^^^^^^^ HELP `no_method_suggested_traits::qux::PrivPub` + //~^^^^^^^^ HELP `no_method_suggested_traits::quz::PrivPriv` + std::rc::Rc::new(&mut Box::new(&Foo)).method(); + //~^ ERROR does not implement + //~^^ HELP following traits define a method `method`, perhaps you need to implement one of them + //~^^^ HELP `foo::Bar` + //~^^^^ HELP `no_method_suggested_traits::foo::PubPub` + //~^^^^^ HELP `no_method_suggested_traits::reexport::Reexported` + //~^^^^^^ HELP `no_method_suggested_traits::bar::PubPriv` + //~^^^^^^^ HELP `no_method_suggested_traits::qux::PrivPub` + //~^^^^^^^^ HELP `no_method_suggested_traits::quz::PrivPriv` + + 1u64.method2(); + //~^ ERROR does not implement + //~^^ HELP the following trait defines a method `method2`, perhaps you need to implement it + //~^^^ HELP `foo::Bar` + std::rc::Rc::new(&mut Box::new(&1u64)).method2(); + //~^ ERROR does not implement + //~^^ HELP the following trait defines a method `method2`, perhaps you need to implement it + //~^^^ HELP `foo::Bar` + + no_method_suggested_traits::Foo.method2(); + //~^ ERROR does not implement + //~^^ HELP following trait defines a method `method2`, perhaps you need to implement it + //~^^^ HELP `foo::Bar` + std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method2(); + //~^ ERROR does not implement + //~^^ HELP following trait defines a method `method2`, perhaps you need to implement it + //~^^^ HELP `foo::Bar` + no_method_suggested_traits::Bar::X.method2(); + //~^ ERROR does not implement + //~^^ HELP following trait defines a method `method2`, perhaps you need to implement it + //~^^^ HELP `foo::Bar` + std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method2(); + //~^ ERROR does not implement + //~^^ HELP following trait defines a method `method2`, perhaps you need to implement it + //~^^^ HELP `foo::Bar` + + Foo.method3(); + //~^ ERROR does not implement + //~^^ HELP following trait defines a method `method3`, perhaps you need to implement it + //~^^^ HELP `no_method_suggested_traits::foo::PubPub` + std::rc::Rc::new(&mut Box::new(&Foo)).method3(); + //~^ ERROR does not implement + //~^^ HELP following trait defines a method `method3`, perhaps you need to implement it + //~^^^ HELP `no_method_suggested_traits::foo::PubPub` + Bar::X.method3(); + //~^ ERROR does not implement + //~^^ HELP following trait defines a method `method3`, perhaps you need to implement it + //~^^^ HELP `no_method_suggested_traits::foo::PubPub` + std::rc::Rc::new(&mut Box::new(&Bar::X)).method3(); + //~^ ERROR does not implement + //~^^ HELP following trait defines a method `method3`, perhaps you need to implement it + //~^^^ HELP `no_method_suggested_traits::foo::PubPub` + + // should have no help: + 1_usize.method3(); //~ ERROR does not implement + std::rc::Rc::new(&mut Box::new(&1_usize)).method3(); //~ ERROR does not implement + no_method_suggested_traits::Foo.method3(); //~ ERROR does not implement + std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method3(); + //~^ ERROR does not implement + no_method_suggested_traits::Bar::X.method3(); //~ ERROR does not implement + std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method3(); + //~^ ERROR does not implement +} diff --git a/src/test/compile-fail/no-reuse-move-arc.rs b/src/test/compile-fail/no-reuse-move-arc.rs index d8f0fa497a..1720b40c83 100644 --- a/src/test/compile-fail/no-reuse-move-arc.rs +++ b/src/test/compile-fail/no-reuse-move-arc.rs @@ -9,13 +9,13 @@ // except according to those terms. use std::sync::Arc; -use std::thread::Thread; +use std::thread; fn main() { - let v = vec!(1is, 2, 3, 4, 5, 6, 7, 8, 9, 10); + let v = vec!(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); let arc_v = Arc::new(v); - Thread::spawn(move|| { + thread::spawn(move|| { assert_eq!((*arc_v)[3], 4); }); diff --git a/src/test/compile-fail/no-send-res-ports.rs b/src/test/compile-fail/no-send-res-ports.rs index 551953af13..5ebc386109 100644 --- a/src/test/compile-fail/no-send-res-ports.rs +++ b/src/test/compile-fail/no-send-res-ports.rs @@ -10,14 +10,14 @@ #![feature(unsafe_destructor)] -use std::thread::Thread; +use std::thread; use std::rc::Rc; -#[derive(Show)] +#[derive(Debug)] struct Port(Rc); fn main() { - #[derive(Show)] + #[derive(Debug)] struct foo { _x: Port<()>, } @@ -35,9 +35,8 @@ fn main() { let x = foo(Port(Rc::new(()))); - Thread::spawn(move|| { + thread::spawn(move|| { //~^ ERROR `core::marker::Send` is not implemented - //~^^ ERROR `core::marker::Send` is not implemented let y = x; println!("{:?}", y); }); diff --git a/src/test/compile-fail/no-type-for-node-ice.rs b/src/test/compile-fail/no-type-for-node-ice.rs new file mode 100644 index 0000000000..aab4db6ead --- /dev/null +++ b/src/test/compile-fail/no-type-for-node-ice.rs @@ -0,0 +1,15 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Related issues: #20401, #20506, #20614, #20752, #20829, #20846, #20885, #20886 + +fn main() { + "".homura[""]; //~ ERROR no field with that name was found +} diff --git a/src/test/compile-fail/no_send-enum.rs b/src/test/compile-fail/no_send-enum.rs index cf1f13e8bb..625d51260c 100644 --- a/src/test/compile-fail/no_send-enum.rs +++ b/src/test/compile-fail/no_send-enum.rs @@ -8,16 +8,21 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::marker; +#![feature(optin_builtin_traits)] + +use std::marker::Send; + +struct NoSend; +impl !Send for NoSend {} enum Foo { - A(marker::NoSend) + A(NoSend) } fn bar(_: T) {} fn main() { - let x = Foo::A(marker::NoSend); + let x = Foo::A(NoSend); bar(x); //~^ ERROR `core::marker::Send` is not implemented } diff --git a/src/test/compile-fail/no_send-rc.rs b/src/test/compile-fail/no_send-rc.rs index 82cc319466..b5c572b17d 100644 --- a/src/test/compile-fail/no_send-rc.rs +++ b/src/test/compile-fail/no_send-rc.rs @@ -13,8 +13,7 @@ use std::rc::Rc; fn bar(_: T) {} fn main() { - let x = Rc::new(5is); + let x = Rc::new(5); bar(x); //~^ ERROR `core::marker::Send` is not implemented - //~^^ ERROR `core::marker::Send` is not implemented } diff --git a/src/test/compile-fail/no_send-struct.rs b/src/test/compile-fail/no_send-struct.rs index bef7052378..7f16db0ba9 100644 --- a/src/test/compile-fail/no_send-struct.rs +++ b/src/test/compile-fail/no_send-struct.rs @@ -8,17 +8,20 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::marker; +#![feature(optin_builtin_traits)] + +use std::marker::Send; struct Foo { a: isize, - ns: marker::NoSend } +impl !Send for Foo {} + fn bar(_: T) {} fn main() { - let x = Foo { a: 5, ns: marker::NoSend }; + let x = Foo { a: 5 }; bar(x); //~^ ERROR the trait `core::marker::Send` is not implemented } diff --git a/src/test/compile-fail/no_share-enum.rs b/src/test/compile-fail/no_share-enum.rs index 33222eef44..9331afdbbb 100644 --- a/src/test/compile-fail/no_share-enum.rs +++ b/src/test/compile-fail/no_share-enum.rs @@ -8,14 +8,19 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::marker; +#![feature(optin_builtin_traits)] -enum Foo { A(marker::NoSync) } +use std::marker::Sync; + +struct NoSync; +impl !Sync for NoSync {} + +enum Foo { A(NoSync) } fn bar(_: T) {} fn main() { - let x = Foo::A(marker::NoSync); + let x = Foo::A(NoSync); bar(x); //~^ ERROR the trait `core::marker::Sync` is not implemented } diff --git a/src/test/compile-fail/no_share-rc.rs b/src/test/compile-fail/no_share-rc.rs index 0d3e380d4a..4bc3442871 100644 --- a/src/test/compile-fail/no_share-rc.rs +++ b/src/test/compile-fail/no_share-rc.rs @@ -14,8 +14,7 @@ use std::cell::RefCell; fn bar(_: T) {} fn main() { - let x = Rc::new(RefCell::new(5is)); + let x = Rc::new(RefCell::new(5)); bar(x); //~^ ERROR the trait `core::marker::Sync` is not implemented - //~^^ ERROR the trait `core::marker::Sync` is not implemented } diff --git a/src/test/compile-fail/no_share-struct.rs b/src/test/compile-fail/no_share-struct.rs index c7028ce978..b5ccceb3b2 100644 --- a/src/test/compile-fail/no_share-struct.rs +++ b/src/test/compile-fail/no_share-struct.rs @@ -8,14 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::marker; +#![feature(optin_builtin_traits)] -struct Foo { a: isize, m: marker::NoSync } +use std::marker::Sync; + +struct Foo { a: isize } +impl !Sync for Foo {} fn bar(_: T) {} fn main() { - let x = Foo { a: 5, m: marker::NoSync }; + let x = Foo { a: 5 }; bar(x); //~^ ERROR the trait `core::marker::Sync` is not implemented } diff --git a/src/test/compile-fail/noexporttypeexe.rs b/src/test/compile-fail/noexporttypeexe.rs index 8fa4e81c88..85a4749230 100644 --- a/src/test/compile-fail/noexporttypeexe.rs +++ b/src/test/compile-fail/noexporttypeexe.rs @@ -18,5 +18,9 @@ fn main() { // because the def_id associated with the type was // not convertible to a path. let x: isize = noexporttypelib::foo(); - //~^ ERROR expected `isize`, found `core::option::Option` + //~^ ERROR mismatched types + //~| expected `isize` + //~| found `core::option::Option` + //~| expected isize + //~| found enum `core::option::Option` } diff --git a/src/test/compile-fail/non-exhaustive-match.rs b/src/test/compile-fail/non-exhaustive-match.rs index ccf69a4d2c..1dec049aed 100644 --- a/src/test/compile-fail/non-exhaustive-match.rs +++ b/src/test/compile-fail/non-exhaustive-match.rs @@ -16,10 +16,10 @@ fn main() { match true { //~ ERROR non-exhaustive patterns: `false` not covered true => {} } - match Some(10is) { //~ ERROR non-exhaustive patterns: `Some(_)` not covered + match Some(10) { //~ ERROR non-exhaustive patterns: `Some(_)` not covered None => {} } - match (2is, 3is, 4is) { //~ ERROR non-exhaustive patterns: `(_, _, _)` not covered + match (2, 3, 4) { //~ ERROR non-exhaustive patterns: `(_, _, _)` not covered (_, _, 4) => {} } match (t::a, t::a) { //~ ERROR non-exhaustive patterns: `(a, a)` not covered @@ -35,29 +35,29 @@ fn main() { (_, t::a) => {} (t::b, t::b) => {} } - let vec = vec!(Some(42is), None, Some(21is)); - let vec: &[Option] = vec.as_slice(); + let vec = vec!(Some(42), None, Some(21)); + let vec: &[Option] = &vec; match vec { //~ ERROR non-exhaustive patterns: `[]` not covered [Some(..), None, tail..] => {} [Some(..), Some(..), tail..] => {} [None] => {} } - let vec = vec!(1is); - let vec: &[isize] = vec.as_slice(); + let vec = vec!(1); + let vec: &[isize] = &vec; match vec { [_, tail..] => (), [] => () } let vec = vec!(0.5f32); - let vec: &[f32] = vec.as_slice(); + let vec: &[f32] = &vec; match vec { //~ ERROR non-exhaustive patterns: `[_, _, _, _]` not covered [0.1, 0.2, 0.3] => (), [0.1, 0.2] => (), [0.1] => (), [] => () } - let vec = vec!(Some(42is), None, Some(21is)); - let vec: &[Option] = vec.as_slice(); + let vec = vec!(Some(42), None, Some(21)); + let vec: &[Option] = &vec; match vec { [Some(..), None, tail..] => {} [Some(..), Some(..), tail..] => {} diff --git a/src/test/compile-fail/non-exhaustive-pattern-witness.rs b/src/test/compile-fail/non-exhaustive-pattern-witness.rs index 3bd3a0c653..0eb91e0419 100644 --- a/src/test/compile-fail/non-exhaustive-pattern-witness.rs +++ b/src/test/compile-fail/non-exhaustive-pattern-witness.rs @@ -27,7 +27,7 @@ fn struct_with_a_nested_enum_and_vector() { Foo { first: true, second: None } => (), Foo { first: true, second: Some(_) } => (), Foo { first: false, second: None } => (), - Foo { first: false, second: Some([1us, 2us, 3us, 4us]) } => () + Foo { first: false, second: Some([1_usize, 2_usize, 3_usize, 4_usize]) } => () } } diff --git a/src/test/compile-fail/noncopyable-class.rs b/src/test/compile-fail/noncopyable-class.rs index 029b848599..df135c3a8e 100644 --- a/src/test/compile-fail/noncopyable-class.rs +++ b/src/test/compile-fail/noncopyable-class.rs @@ -11,7 +11,7 @@ // Test that a class with a non-copyable field can't be // copied -#[derive(Show)] +#[derive(Debug)] struct bar { x: isize, } @@ -26,7 +26,7 @@ fn bar(x:isize) -> bar { } } -#[derive(Show)] +#[derive(Debug)] struct foo { i: isize, j: bar, diff --git a/src/test/compile-fail/nonscalar-cast.rs b/src/test/compile-fail/nonscalar-cast.rs index f32c96b7b6..d6f274da96 100644 --- a/src/test/compile-fail/nonscalar-cast.rs +++ b/src/test/compile-fail/nonscalar-cast.rs @@ -10,7 +10,7 @@ // error-pattern:non-scalar cast -#[derive(Show)] +#[derive(Debug)] struct foo { x: isize } diff --git a/src/test/compile-fail/object-does-not-impl-trait.rs b/src/test/compile-fail/object-does-not-impl-trait.rs index cfaf149a49..607ab13d12 100644 --- a/src/test/compile-fail/object-does-not-impl-trait.rs +++ b/src/test/compile-fail/object-does-not-impl-trait.rs @@ -11,8 +11,9 @@ // Test that an object type `Box` is not considered to implement the // trait `Foo`. Issue #5087. +use std::marker::MarkerTrait; -trait Foo {} +trait Foo : MarkerTrait {} fn take_foo(f: F) {} fn take_object(f: Box) { take_foo(f); } //~^ ERROR the trait `Foo` is not implemented diff --git a/src/test/compile-fail/object-lifetime-default-ambiguous.rs b/src/test/compile-fail/object-lifetime-default-ambiguous.rs new file mode 100644 index 0000000000..322283a4ca --- /dev/null +++ b/src/test/compile-fail/object-lifetime-default-ambiguous.rs @@ -0,0 +1,61 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that if a struct declares multiple region bounds for a given +// type parameter, an explicit lifetime bound is required on object +// lifetimes within. + +#![allow(dead_code)] + +trait Test { + fn foo(&self) { } +} + +struct Ref0 { + r: *mut T +} + +struct Ref1<'a,T:'a+?Sized> { + r: &'a T +} + +struct Ref2<'a,'b:'a,T:'a+'b+?Sized> { + r: &'a &'b T +} + +fn a<'a,'b>(t: Ref2<'a,'b,Test>) { + //~^ ERROR lifetime bound for this object type cannot be deduced from context +} + +fn b(t: Ref2) { + //~^ ERROR lifetime bound for this object type cannot be deduced from context +} + +fn c(t: Ref2<&Test>) { + // In this case, the &'a overrides. +} + +fn d(t: Ref2>) { + // In this case, the lifetime parameter from the Ref1 overrides. +} + +fn e(t: Ref2>) { + //~^ ERROR lifetime bound for this object type cannot be deduced from context + // + // In this case, Ref2 is ambiguous, and Ref0 inherits the + // ambiguity. +} + +fn f(t: &Ref2) { + //~^ ERROR lifetime bound for this object type cannot be deduced from context +} + +fn main() { +} diff --git a/src/test/compile-fail/object-lifetime-default-elision.rs b/src/test/compile-fail/object-lifetime-default-elision.rs new file mode 100644 index 0000000000..0077d10e6c --- /dev/null +++ b/src/test/compile-fail/object-lifetime-default-elision.rs @@ -0,0 +1,89 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test various cases where the old rules under lifetime elision +// yield slightly different results than the new rules. + +#![allow(dead_code)] + +trait SomeTrait { + fn dummy(&self) { } +} + +struct SomeStruct<'a> { + r: Box +} + +fn deref(ss: &T) -> T { + // produces the type of a deref without worrying about whether a + // move out would actually be legal + loop { } +} + +fn load0<'a>(ss: &'a Box) -> Box { + // Under old rules, the fully elaborated types of input/output were: + // + // for<'a,'b> fn(&'a Box) -> Box + // + // Under new rules the result is: + // + // for<'a> fn(&'a Box) -> Box + // + // Therefore, we get a type error attempting to return `deref(ss)` + // since `SomeTrait+'a <: SomeTrait+'static` does not hold. + + deref(ss) + //~^ ERROR cannot infer +} + +fn load1(ss: &SomeTrait) -> &SomeTrait { + // Under old rules, the fully elaborated types of input/output were: + // + // for<'a,'b> fn(&'a (SomeTrait+'b)) -> &'a (SomeTrait+'a) + // + // Under new rules the result is: + // + // for<'a> fn(&'a (SomeTrait+'a)) -> &'a (SomeTrait+'a) + // + // In both cases, returning `ss` is legal. + + ss +} + +fn load2<'a>(ss: &'a SomeTrait) -> &SomeTrait { + // Same as `load1` but with an explicit name thrown in for fun. + + ss +} + +fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait { + // Under old rules, the fully elaborated types of input/output were: + // + // for<'a,'b,'c>fn(&'a (SomeTrait+'c)) -> &'b (SomeTrait+'a) + // + // Based on the input/output types, the compiler could infer that + // 'c : 'a + // 'b : 'a + // must hold, and therefore it permitted `&'a (Sometrait+'c)` to be + // coerced to `&'b (SomeTrait+'a)`. + // + // Under the newer defaults, though, we get: + // + // for<'a,'b> fn(&'a (SomeTrait+'a)) -> &'b (SomeTrait+'b) + // + // which fails to type check. + + ss + //~^ ERROR cannot infer + //~| ERROR mismatched types +} + +fn main() { +} diff --git a/src/test/compile-fail/object-lifetime-default-from-box-error.rs b/src/test/compile-fail/object-lifetime-default-from-box-error.rs new file mode 100644 index 0000000000..70752cbfda --- /dev/null +++ b/src/test/compile-fail/object-lifetime-default-from-box-error.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test various cases where the defaults should lead to errors being +// reported. + +#![allow(dead_code)] + +trait SomeTrait { + fn dummy(&self) { } +} + +struct SomeStruct<'a> { + r: Box +} + +fn load(ss: &mut SomeStruct) -> Box { + // `Box` defaults to a `'static` bound, so this return + // is illegal. + + ss.r //~ ERROR mismatched types +} + +fn store(ss: &mut SomeStruct, b: Box) { + // No error: b is bounded by 'static which outlives the + // (anonymous) lifetime on the struct. + + ss.r = b; +} + +fn store1<'b>(ss: &mut SomeStruct, b: Box) { + // Here we override the lifetimes explicitly, and so naturally we get an error. + + ss.r = b; //~ ERROR mismatched types +} + +fn main() { +} diff --git a/src/test/compile-fail/object-lifetime-default-mybox.rs b/src/test/compile-fail/object-lifetime-default-mybox.rs new file mode 100644 index 0000000000..23ddea4499 --- /dev/null +++ b/src/test/compile-fail/object-lifetime-default-mybox.rs @@ -0,0 +1,43 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test a "pass-through" object-lifetime-default that produces errors. + +#![allow(dead_code)] + +trait SomeTrait { + fn dummy(&self) { } +} + +struct MyBox { + r: Box +} + +fn deref(ss: &T) -> T { + // produces the type of a deref without worrying about whether a + // move out would actually be legal + loop { } +} + +fn load0(ss: &MyBox) -> MyBox { + deref(ss) //~ ERROR cannot infer +} + +fn load1<'a,'b>(a: &'a MyBox, + b: &'b MyBox) + -> &'b MyBox +{ + a + //~^ ERROR cannot infer + //~| ERROR mismatched types +} + +fn main() { +} diff --git a/src/test/compile-fail/object-lifetime-default.rs b/src/test/compile-fail/object-lifetime-default.rs new file mode 100644 index 0000000000..ac03c085b7 --- /dev/null +++ b/src/test/compile-fail/object-lifetime-default.rs @@ -0,0 +1,34 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(rustc_attrs)] + +#[rustc_object_lifetime_default] +struct A(T); //~ ERROR None + +#[rustc_object_lifetime_default] +struct B<'a,T>(&'a (), T); //~ ERROR None + +#[rustc_object_lifetime_default] +struct C<'a,T:'a>(&'a T); //~ ERROR 'a + +#[rustc_object_lifetime_default] +struct D<'a,'b,T:'a+'b>(&'a T, &'b T); //~ ERROR Ambiguous + +#[rustc_object_lifetime_default] +struct E<'a,'b:'a,T:'b>(&'a T, &'b T); //~ ERROR 'b + +#[rustc_object_lifetime_default] +struct F<'a,'b,T:'a,U:'b>(&'a T, &'b U); //~ ERROR 'a,'b + +#[rustc_object_lifetime_default] +struct G<'a,'b,T:'a,U:'a+'b>(&'a T, &'b U); //~ ERROR 'a,Ambiguous + +fn main() { } diff --git a/src/test/compile-fail/object-safety-issue-22040.rs b/src/test/compile-fail/object-safety-issue-22040.rs new file mode 100644 index 0000000000..edf32131b6 --- /dev/null +++ b/src/test/compile-fail/object-safety-issue-22040.rs @@ -0,0 +1,50 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Regression test for #22040. + +use std::fmt::Debug; + +trait Expr: Debug + PartialEq { + fn print_element_count(&self); +} + +//#[derive(PartialEq)] +#[derive(Debug)] +struct SExpr<'x> { + elements: Vec>, +} + +impl<'x> PartialEq for SExpr<'x> { + fn eq(&self, other:&SExpr<'x>) -> bool { + println!("L1: {} L2: {}", self.elements.len(), other.elements.len()); + let result = self.elements.len() == other.elements.len(); + + println!("Got compare {}", result); + return result; + } +} + +impl <'x> SExpr<'x> { + fn new() -> SExpr<'x> { return SExpr{elements: Vec::new(),}; } +} + +impl <'x> Expr for SExpr<'x> { + fn print_element_count(&self) { + println!("element count: {}", self.elements.len()); + } +} + +fn main() { + let a: Box = Box::new(SExpr::new()); //~ ERROR trait `Expr` is not object-safe + let b: Box = Box::new(SExpr::new()); //~ ERROR trait `Expr` is not object-safe + + assert_eq!(a , b); +} diff --git a/src/test/compile-fail/object-safety-no-static.rs b/src/test/compile-fail/object-safety-no-static.rs index 6a010d4969..aae829ec7b 100644 --- a/src/test/compile-fail/object-safety-no-static.rs +++ b/src/test/compile-fail/object-safety-no-static.rs @@ -11,7 +11,7 @@ // Check that we correctly prevent users from making trait objects // from traits with static methods. -trait Foo { +trait Foo : ::std::marker::MarkerTrait { fn foo(); } diff --git a/src/test/compile-fail/object-safety-phantom-fn.rs b/src/test/compile-fail/object-safety-phantom-fn.rs new file mode 100644 index 0000000000..1c95ee43d2 --- /dev/null +++ b/src/test/compile-fail/object-safety-phantom-fn.rs @@ -0,0 +1,34 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Check that `Self` appearing in a phantom fn does not make a trait not object safe. + +#![feature(rustc_attrs)] +#![allow(dead_code)] + +use std::marker::PhantomFn; + +trait Baz : PhantomFn { +} + +trait Bar : PhantomFn<(Self, T)> { +} + +fn make_bar>(t: &T) -> &Bar { + t +} + +fn make_baz(t: &T) -> &Baz { + t +} + +#[rustc_error] +fn main() { //~ ERROR compilation successful +} diff --git a/src/test/compile-fail/object-safety-supertrait-mentions-Self.rs b/src/test/compile-fail/object-safety-supertrait-mentions-Self.rs new file mode 100644 index 0000000000..d3f9dc7302 --- /dev/null +++ b/src/test/compile-fail/object-safety-supertrait-mentions-Self.rs @@ -0,0 +1,32 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Check that we correctly prevent users from making trait objects +// form traits that make use of `Self` in an argument or return position. + +trait Bar { + fn bar(&self, x: &T); +} + +trait Baz : Bar { +} + +fn make_bar>(t: &T) -> &Bar { + t +} + +fn make_baz(t: &T) -> &Baz { + t + //~^ ERROR `Baz` is not object-safe + //~| NOTE the trait cannot use `Self` as a type parameter in the supertrait listing +} + +fn main() { +} diff --git a/src/test/compile-fail/obsolete-tilde.rs b/src/test/compile-fail/obsolete-tilde.rs deleted file mode 100644 index d290d5536a..0000000000 --- a/src/test/compile-fail/obsolete-tilde.rs +++ /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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that ~ pointers give an obsolescence message. - -fn foo(x: ~isize) {} //~ ERROR obsolete syntax: `~` notation for owned pointers -fn bar(x: ~str) {} //~ ERROR obsolete syntax: `~` notation for owned pointers -fn baz(x: ~[isize]) {} //~ ERROR obsolete syntax: `~[T]` is no longer a type - -fn main() { - let x = ~4is; //~ ERROR obsolete syntax: `~` notation for owned pointer allocation - let y = ~"hello"; //~ ERROR obsolete syntax: `~` notation for owned pointer allocation - let z = ~[1is, 2, 3]; //~ ERROR obsolete syntax: `~[T]` is no longer a type -} diff --git a/src/test/compile-fail/obsolete-tuple-struct-deref.rs b/src/test/compile-fail/obsolete-tuple-struct-deref.rs deleted file mode 100644 index ad5fac3e21..0000000000 --- a/src/test/compile-fail/obsolete-tuple-struct-deref.rs +++ /dev/null @@ -1,15 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn main() { - struct S(isize); - let s = S(0); - let x = *s; //~ ERROR single-field tuple-structs can no longer be dereferenced -} diff --git a/src/test/compile-fail/occurs-check-2.rs b/src/test/compile-fail/occurs-check-2.rs index bfabcff511..fd2903a85d 100644 --- a/src/test/compile-fail/occurs-check-2.rs +++ b/src/test/compile-fail/occurs-check-2.rs @@ -14,5 +14,9 @@ fn main() { let f; let g; g = f; - f = box g; //~ ERROR cyclic type of infinite size + f = box g; + //~^ ERROR mismatched types + //~| expected `_` + //~| found `Box<_>` + //~| cyclic type of infinite size } diff --git a/src/test/compile-fail/occurs-check.rs b/src/test/compile-fail/occurs-check.rs index 417bd9b57e..036fcc1b9d 100644 --- a/src/test/compile-fail/occurs-check.rs +++ b/src/test/compile-fail/occurs-check.rs @@ -12,5 +12,9 @@ fn main() { let f; - f = box f; //~ ERROR cyclic type of infinite size + f = box f; + //~^ ERROR mismatched types + //~| expected `_` + //~| found `Box<_>` + //~| cyclic type of infinite size } diff --git a/src/test/compile-fail/on-unimplemented-bad-anno.rs b/src/test/compile-fail/on-unimplemented-bad-anno.rs new file mode 100644 index 0000000000..7538b1c85e --- /dev/null +++ b/src/test/compile-fail/on-unimplemented-bad-anno.rs @@ -0,0 +1,47 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// ignore-tidy-linelength + +#![feature(on_unimplemented)] + +#![allow(unused)] + +use std::marker; + +#[rustc_on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}`"] +trait Foo + : marker::PhantomFn<(Self,Bar,Baz,Quux)> +{} + +#[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"] +trait MyFromIterator { + /// Build a container with elements from an external iterator. + fn my_from_iter>(iterator: T) -> Self; +} + +#[rustc_on_unimplemented] //~ ERROR this attribute must have a value +trait BadAnnotation1 + : marker::MarkerTrait +{} + +#[rustc_on_unimplemented = "Unimplemented trait error on `{Self}` with params `<{A},{B},{C}>`"] +//~^ ERROR there is no type parameter C on trait BadAnnotation2 +trait BadAnnotation2 + : marker::PhantomFn<(Self,A,B)> +{} + +#[rustc_on_unimplemented = "Unimplemented trait error on `{Self}` with params `<{A},{B},{}>`"] +//~^ only named substitution parameters are allowed +trait BadAnnotation3 + : marker::PhantomFn<(Self,A,B)> +{} + +pub fn main() { +} diff --git a/src/test/compile-fail/on-unimplemented.rs b/src/test/compile-fail/on-unimplemented.rs new file mode 100644 index 0000000000..2447d08642 --- /dev/null +++ b/src/test/compile-fail/on-unimplemented.rs @@ -0,0 +1,42 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// ignore-tidy-linelength + +#![feature(on_unimplemented)] + +use std::marker; + +#[rustc_on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}`"] +trait Foo + : marker::PhantomFn<(Self,Bar,Baz,Quux)> +{} + +fn foobar>() -> T { + +} + +#[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"] +trait MyFromIterator { + /// Build a container with elements from an external iterator. + fn my_from_iter>(iterator: T) -> Self; +} + +fn collect, B: MyFromIterator>(it: I) -> B { + MyFromIterator::my_from_iter(it) +} + +pub fn main() { + let x = vec!(1u8, 2, 3, 4); + let y: Option> = collect(x.iter()); // this should give approximately the same error for x.iter().collect() + //~^ ERROR + //~^^ NOTE a collection of type `core::option::Option>` cannot be built from an iterator over elements of type `&u8` + let x: String = foobar(); //~ ERROR + //~^ NOTE test error `collections::string::String` with `u8` `_` `u32` +} diff --git a/src/test/compile-fail/or-patter-mismatch.rs b/src/test/compile-fail/or-patter-mismatch.rs index 74f674e64b..4b261d8988 100644 --- a/src/test/compile-fail/or-patter-mismatch.rs +++ b/src/test/compile-fail/or-patter-mismatch.rs @@ -12,4 +12,4 @@ enum blah { a(isize, isize, usize), b(isize, isize), } -fn main() { match blah::a(1, 1, 2us) { blah::a(_, x, y) | blah::b(x, y) => { } } } +fn main() { match blah::a(1, 1, 2_usize) { blah::a(_, x, y) | blah::b(x, y) => { } } } diff --git a/src/test/compile-fail/orphan-check-diagnostics.rs b/src/test/compile-fail/orphan-check-diagnostics.rs new file mode 100644 index 0000000000..8201565c33 --- /dev/null +++ b/src/test/compile-fail/orphan-check-diagnostics.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:orphan_check_diagnostics.rs +// see #22388 + +extern crate orphan_check_diagnostics; + +use orphan_check_diagnostics::RemoteTrait; + +trait LocalTrait { fn dummy(&self) { } } + +impl RemoteTrait for T where T: LocalTrait {} +//~^ ERROR type parameter `T` must be used as the type parameter for some local type + +fn main() {} diff --git a/src/test/compile-fail/overloaded-calls-bad.rs b/src/test/compile-fail/overloaded-calls-bad.rs index d784ba2d0d..61752e62ab 100644 --- a/src/test/compile-fail/overloaded-calls-bad.rs +++ b/src/test/compile-fail/overloaded-calls-bad.rs @@ -17,7 +17,9 @@ struct S { y: isize, } -impl FnMut<(isize,),isize> for S { +impl FnMut<(isize,)> for S { + type Output = isize; + extern "rust-call" fn call_mut(&mut self, (z,): (isize,)) -> isize { self.x * self.y * z } diff --git a/src/test/compile-fail/overloaded-calls-nontuple.rs b/src/test/compile-fail/overloaded-calls-nontuple.rs index c06ab04cd8..41ecf71461 100644 --- a/src/test/compile-fail/overloaded-calls-nontuple.rs +++ b/src/test/compile-fail/overloaded-calls-nontuple.rs @@ -17,7 +17,8 @@ struct S { y: isize, } -impl FnMut for S { +impl FnMut for S { + type Output = isize; extern "rust-call" fn call_mut(&mut self, z: isize) -> isize { self.x + self.y + z } diff --git a/src/test/compile-fail/packed-struct-generic-transmute.rs b/src/test/compile-fail/packed-struct-generic-transmute.rs index 6b6ab3f297..82425d2c22 100644 --- a/src/test/compile-fail/packed-struct-generic-transmute.rs +++ b/src/test/compile-fail/packed-struct-generic-transmute.rs @@ -32,6 +32,6 @@ fn main() { let foo = Foo { bar: [1u8, 2, 3, 4, 5], baz: 10i32 }; unsafe { let oof: Oof<[u8; 5], i32> = mem::transmute(foo); - println!("{:?} {:?}", &oof.rab[], oof.zab); + println!("{:?} {:?}", &oof.rab[..], oof.zab); } } diff --git a/src/test/compile-fail/packed-struct-transmute.rs b/src/test/compile-fail/packed-struct-transmute.rs index b80dd0b36e..1b164709ac 100644 --- a/src/test/compile-fail/packed-struct-transmute.rs +++ b/src/test/compile-fail/packed-struct-transmute.rs @@ -23,7 +23,7 @@ struct Foo { baz: usize } -#[derive(Show)] +#[derive(Debug)] struct Oof { rab: u8, zab: usize diff --git a/src/test/compile-fail/pattern-bindings-after-at.rs b/src/test/compile-fail/pattern-bindings-after-at.rs index 70840200aa..8054409932 100644 --- a/src/test/compile-fail/pattern-bindings-after-at.rs +++ b/src/test/compile-fail/pattern-bindings-after-at.rs @@ -14,7 +14,7 @@ enum Option { } fn main() { - match &mut Some(1is) { + match &mut Some(1) { ref mut z @ &mut Some(ref a) => { //~^ ERROR pattern bindings are not allowed after an `@` **z = None; diff --git a/src/test/compile-fail/pattern-error-continue.rs b/src/test/compile-fail/pattern-error-continue.rs index c288429dcd..aa7202574a 100644 --- a/src/test/compile-fail/pattern-error-continue.rs +++ b/src/test/compile-fail/pattern-error-continue.rs @@ -30,9 +30,18 @@ fn main() { } match 'c' { S { .. } => (), - //~^ ERROR mismatched types: expected `char`, found `S` (expected char, found struct S) + //~^ ERROR mismatched types + //~| expected `char` + //~| found `S` + //~| expected char + //~| found struct `S` _ => () } - f(true); //~ ERROR mismatched types: expected `char`, found `bool` + f(true); + //~^ ERROR mismatched types + //~| expected `char` + //~| found `bool` + //~| expected char + //~| found 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 new file mode 100644 index 0000000000..ccda5cbdce --- /dev/null +++ b/src/test/compile-fail/plugin-extern-crate-attr-deprecated.rs @@ -0,0 +1,15 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[plugin] //~ ERROR #[plugin] on `extern crate` is deprecated +//~^ HELP use a crate attribute instead, i.e. #![plugin(std)] +extern crate std; + +fn main() {} diff --git a/src/test/compile-fail/pptypedef.rs b/src/test/compile-fail/pptypedef.rs index e3c440d61c..ccf82e90b7 100644 --- a/src/test/compile-fail/pptypedef.rs +++ b/src/test/compile-fail/pptypedef.rs @@ -11,9 +11,17 @@ fn let_in(x: T, f: F) where F: FnOnce(T) {} fn main() { - let_in(3us, |i| { assert!(i == 3is); }); - //~^ ERROR expected `usize`, found `isize` + let_in(3u32, |i| { assert!(i == 3i32); }); + //~^ ERROR mismatched types + //~| expected `u32` + //~| found `i32` + //~| expected u32 + //~| found i32 - let_in(3is, |i| { assert!(i == 3us); }); - //~^ ERROR expected `isize`, found `usize` + let_in(3i32, |i| { assert!(i == 3u32); }); + //~^ ERROR mismatched types + //~| expected `i32` + //~| found `u32` + //~| expected i32 + //~| found u32 } diff --git a/src/test/compile-fail/priv-in-bad-locations.rs b/src/test/compile-fail/priv-in-bad-locations.rs index db649ed0cc..43d112b8aa 100644 --- a/src/test/compile-fail/priv-in-bad-locations.rs +++ b/src/test/compile-fail/priv-in-bad-locations.rs @@ -14,7 +14,7 @@ pub extern { } trait A { - fn foo() {} + fn foo(&self) {} } struct B; @@ -22,7 +22,7 @@ struct B; pub impl B {} //~ ERROR: unnecessary visibility pub impl A for B { //~ ERROR: unnecessary visibility - pub fn foo() {} //~ ERROR: unnecessary visibility + pub fn foo(&self) {} //~ ERROR: unnecessary visibility } pub fn main() {} diff --git a/src/test/compile-fail/privacy-ns2.rs b/src/test/compile-fail/privacy-ns2.rs index 7fe0574ab7..67bb566ea6 100644 --- a/src/test/compile-fail/privacy-ns2.rs +++ b/src/test/compile-fail/privacy-ns2.rs @@ -17,7 +17,9 @@ // public type, private value pub mod foo1 { - pub trait Bar { + use std::marker::MarkerTrait; + + pub trait Bar : MarkerTrait { } pub struct Baz; @@ -39,7 +41,7 @@ fn test_list1() { // private type, public value pub mod foo2 { - trait Bar { + trait Bar : ::std::marker::MarkerTrait { } pub struct Baz; @@ -60,7 +62,7 @@ fn test_list2() { // neither public pub mod foo3 { - trait Bar { + trait Bar : ::std::marker::MarkerTrait { } pub struct Baz; diff --git a/src/test/compile-fail/privacy1.rs b/src/test/compile-fail/privacy1.rs index 9dafae3d87..1ae79adbad 100644 --- a/src/test/compile-fail/privacy1.rs +++ b/src/test/compile-fail/privacy1.rs @@ -8,14 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(lang_items)] +#![feature(lang_items, start, no_std)] #![no_std] // makes debugging this test *a lot* easier (during resolve) +#[lang="phantom_fn"] +pub trait PhantomFn { } +impl PhantomFn for U { } + #[lang="sized"] -pub trait Sized {} +pub trait Sized : PhantomFn {} #[lang="copy"] -pub trait Copy {} +pub trait Copy : PhantomFn {} mod bar { // shouldn't bring in too much diff --git a/src/test/compile-fail/privacy2.rs b/src/test/compile-fail/privacy2.rs index b59905776d..7b4a2a3595 100644 --- a/src/test/compile-fail/privacy2.rs +++ b/src/test/compile-fail/privacy2.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(start, no_std)] #![no_std] // makes debugging this test *a lot* easier (during resolve) // Test to make sure that globs don't leak in regular `use` statements. diff --git a/src/test/compile-fail/privacy3.rs b/src/test/compile-fail/privacy3.rs index 80219b70e0..8c9de1fa25 100644 --- a/src/test/compile-fail/privacy3.rs +++ b/src/test/compile-fail/privacy3.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(start, no_std)] #![no_std] // makes debugging this test *a lot* easier (during resolve) // Test to make sure that private items imported through globs remain private diff --git a/src/test/compile-fail/privacy4.rs b/src/test/compile-fail/privacy4.rs index 3f17d46389..adce93af07 100644 --- a/src/test/compile-fail/privacy4.rs +++ b/src/test/compile-fail/privacy4.rs @@ -8,11 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(lang_items)] +#![feature(lang_items, start, no_std)] #![no_std] // makes debugging this test *a lot* easier (during resolve) -#[lang = "sized"] pub trait Sized {} -#[lang="copy"] pub trait Copy {} +#[lang="phantom_fn"] +pub trait PhantomFn { } +impl PhantomFn for U { } + +#[lang = "sized"] pub trait Sized : PhantomFn {} +#[lang="copy"] pub trait Copy : PhantomFn {} // Test to make sure that private items imported through globs remain private // when they're used. diff --git a/src/test/compile-fail/private-method.rs b/src/test/compile-fail/private-method.rs index e8e26cf8ce..ccbdd52a98 100644 --- a/src/test/compile-fail/private-method.rs +++ b/src/test/compile-fail/private-method.rs @@ -30,6 +30,6 @@ mod kitties { } fn main() { - let nyan : kitties::cat = kitties::cat(52us, 99); + let nyan : kitties::cat = kitties::cat(52_usize, 99); nyan.nap(); } diff --git a/src/test/compile-fail/private-struct-field-cross-crate.rs b/src/test/compile-fail/private-struct-field-cross-crate.rs index 36b6000cee..243d835d46 100644 --- a/src/test/compile-fail/private-struct-field-cross-crate.rs +++ b/src/test/compile-fail/private-struct-field-cross-crate.rs @@ -13,7 +13,7 @@ extern crate cci_class; use cci_class::kitties::cat; fn main() { - let nyan : cat = cat(52us, 99); - assert!((nyan.meows == 52us)); + let nyan : cat = cat(52_usize, 99); + assert!((nyan.meows == 52_usize)); //~^ ERROR field `meows` of struct `cci_class::kitties::cat` is private } diff --git a/src/test/compile-fail/ptr-coercion.rs b/src/test/compile-fail/ptr-coercion.rs index 392a803b0d..18e210076c 100644 --- a/src/test/compile-fail/ptr-coercion.rs +++ b/src/test/compile-fail/ptr-coercion.rs @@ -13,12 +13,21 @@ pub fn main() { // *const -> *mut - let x: *const isize = &42is; - let x: *mut isize = x; //~ERROR values differ in mutability + let x: *const isize = &42; + let x: *mut isize = x; //~ ERROR mismatched types + //~| expected `*mut isize` + //~| found `*const isize` + //~| values differ in mutability // & -> *mut - let x: *mut isize = &42; //~ERROR values differ in mutability + let x: *mut isize = &42; //~ ERROR mismatched types + //~| expected `*mut isize` + //~| found `&isize` + //~| values differ in mutability let x: *const isize = &42; - let x: *mut isize = x; //~ERROR values differ in mutability + let x: *mut isize = x; //~ ERROR mismatched types + //~| expected `*mut isize` + //~| found `*const isize` + //~| values differ in mutability } diff --git a/src/test/compile-fail/pub-item-macro.rs b/src/test/compile-fail/pub-item-macro.rs new file mode 100644 index 0000000000..8809e9a257 --- /dev/null +++ b/src/test/compile-fail/pub-item-macro.rs @@ -0,0 +1,28 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Issue #14660 + +macro_rules! priv_x { () => { + static x: u32 = 0; +}} + +macro_rules! pub_x { () => { + pub priv_x!(); //~ ERROR can't qualify macro invocation with `pub` + //~^ HELP try adjusting the macro to put `pub` inside the invocation +}} + +mod foo { + pub_x!(); +} + +fn main() { + let y: u32 = foo::x; +} diff --git a/src/test/compile-fail/pub-method-macro.rs b/src/test/compile-fail/pub-method-macro.rs new file mode 100644 index 0000000000..aa890550f1 --- /dev/null +++ b/src/test/compile-fail/pub-method-macro.rs @@ -0,0 +1,34 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Issue #18317 + +mod bleh { + macro_rules! defn { + ($n:ident) => ( + fn $n (&self) -> i32 { + println!("{}", stringify!($n)); + 1 + } + ) + } + + #[derive(Copy)] + pub struct S; + + impl S { + pub defn!(f); //~ ERROR can't qualify macro invocation with `pub` + //~^ HELP try adjusting the macro to put `pub` inside the invocation + } +} + +fn main() { + bleh::S.f(); +} diff --git a/src/test/compile-fail/range-1.rs b/src/test/compile-fail/range-1.rs index 9888c08569..a8b6e39941 100644 --- a/src/test/compile-fail/range-1.rs +++ b/src/test/compile-fail/range-1.rs @@ -12,15 +12,15 @@ pub fn main() { // Mixed types. - let _ = 0us..10is; + let _ = 0u32..10i32; //~^ ERROR start and end of range have incompatible types // Float => does not implement iterator. for i in 0f32..42f32 {} - //~^ ERROR `for` loop expression has type `core::ops::Range` which does not implement + //~^ ERROR the trait `core::num::Int` is not implemented for the type `f32` // Unsized type. - let arr: &[_] = &[1us, 2, 3]; - let range = (*arr)..; + let arr: &[_] = &[1u32, 2, 3]; + let range = *arr..; //~^ ERROR the trait `core::marker::Sized` is not implemented } diff --git a/src/test/compile-fail/range-2.rs b/src/test/compile-fail/range-2.rs index 6d176ca370..c905332857 100644 --- a/src/test/compile-fail/range-2.rs +++ b/src/test/compile-fail/range-2.rs @@ -12,7 +12,7 @@ pub fn main() { let r = { - (&42is)..&42 + &42..&42 //~^ ERROR borrowed value does not live long enough //~^^ ERROR borrowed value does not live long enough }; diff --git a/src/test/compile-fail/recursion.rs b/src/test/compile-fail/recursion.rs index f39c839a0e..ffc21a5ce6 100644 --- a/src/test/compile-fail/recursion.rs +++ b/src/test/compile-fail/recursion.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-command-line: See https://github.com/rust-lang/rust/issues/20747 +//~^^^^^^^^^^ ERROR overflow // // We also get a second error message at the top of file (dummy // span). This is not helpful, but also kind of annoying to prevent, diff --git a/src/test/compile-fail/refutable-pattern-errors.rs b/src/test/compile-fail/refutable-pattern-errors.rs index d06c73c4cc..ce93e1875a 100644 --- a/src/test/compile-fail/refutable-pattern-errors.rs +++ b/src/test/compile-fail/refutable-pattern-errors.rs @@ -13,6 +13,6 @@ fn func((1, (Some(1), 2...3)): (isize, (Option, isize))) { } //~^ ERROR refutable pattern in function argument: `(_, _)` not covered fn main() { - let (1is, (Some(1is), 2is...3is)) = (1is, (None, 2is)); + let (1, (Some(1), 2...3)) = (1, (None, 2)); //~^ ERROR refutable pattern in local binding: `(_, _)` not covered } diff --git a/src/test/compile-fail/refutable-pattern-in-fn-arg.rs b/src/test/compile-fail/refutable-pattern-in-fn-arg.rs index 53f923e506..be42f0f0ed 100644 --- a/src/test/compile-fail/refutable-pattern-in-fn-arg.rs +++ b/src/test/compile-fail/refutable-pattern-in-fn-arg.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - let f = |&: 3: isize| println!("hello"); + let f = |3: isize| println!("hello"); //~^ ERROR refutable pattern in function argument: `_` not covered f(4); } diff --git a/src/test/compile-fail/region-bound-on-closure-outlives-call.rs b/src/test/compile-fail/region-bound-on-closure-outlives-call.rs index 5b04fa3d87..9f35c636b4 100644 --- a/src/test/compile-fail/region-bound-on-closure-outlives-call.rs +++ b/src/test/compile-fail/region-bound-on-closure-outlives-call.rs @@ -9,7 +9,7 @@ // except according to those terms. fn call_rec(mut f: F) -> usize where F: FnMut(usize) -> usize { - (|&mut: x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` + (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` } fn main() {} diff --git a/src/test/compile-fail/region-bounds-on-objects-and-type-parameters.rs b/src/test/compile-fail/region-bounds-on-objects-and-type-parameters.rs index 6b3c92e002..b8cbbdbe9e 100644 --- a/src/test/compile-fail/region-bounds-on-objects-and-type-parameters.rs +++ b/src/test/compile-fail/region-bounds-on-objects-and-type-parameters.rs @@ -25,7 +25,7 @@ struct Foo<'a,'b,'c> { c: Box>, d: Box, e: Box+Send>, // we can derive two bounds, but one is 'static, so ok - f: Box, //~ ERROR explicit lifetime bound required + f: Box, // OK, defaults to 'static due to RFC 599. g: Box, z: Box+'b+'c>, //~ ERROR only a single explicit lifetime bound is permitted diff --git a/src/test/compile-fail/region-object-lifetime-1.rs b/src/test/compile-fail/region-object-lifetime-1.rs index 4758ce71ff..2095fb903b 100644 --- a/src/test/compile-fail/region-object-lifetime-1.rs +++ b/src/test/compile-fail/region-object-lifetime-1.rs @@ -11,6 +11,9 @@ // Various tests related to testing how region inference works // with respect to the object receivers. +#![feature(rustc_attrs)] +#![allow(warnings)] + trait Foo { fn borrowed<'a>(&'a self) -> &'a (); } @@ -21,29 +24,6 @@ fn borrowed_receiver_same_lifetime<'a>(x: &'a Foo) -> &'a () { x.borrowed() } -// Borrowed receiver but two distinct lifetimes, we get an error. -fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () { - x.borrowed() //~ ERROR cannot infer -} - -// Borrowed receiver with two distinct lifetimes, but we know that -// 'b:'a, hence &'a () is permitted. -fn borrowed_receiver_related_lifetimes<'a,'b>(x: &'a (Foo+'b)) -> &'a () { - x.borrowed() -} - -// Here we have two distinct lifetimes, but we try to return a pointer -// with the longer lifetime when (from the signature) we only know -// that it lives as long as the shorter lifetime. Therefore, error. -fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () { - x.borrowed() //~ ERROR cannot infer -} - -// Here, the object is bounded by an anonymous lifetime and returned -// as `&'static`, so you get an error. -fn owned_receiver(x: Box) -> &'static () { - x.borrowed() //~ ERROR cannot infer -} - -fn main() {} +#[rustc_error] +fn main() {} //~ ERROR compilation successful diff --git a/src/test/compile-fail/region-object-lifetime-2.rs b/src/test/compile-fail/region-object-lifetime-2.rs new file mode 100644 index 0000000000..f9bf4e257b --- /dev/null +++ b/src/test/compile-fail/region-object-lifetime-2.rs @@ -0,0 +1,24 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Various tests related to testing how region inference works +// with respect to the object receivers. + +trait Foo { + fn borrowed<'a>(&'a self) -> &'a (); +} + +// Borrowed receiver but two distinct lifetimes, we get an error. +fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () { + x.borrowed() //~ ERROR cannot infer +} + +fn main() {} + diff --git a/src/test/compile-fail/region-object-lifetime-3.rs b/src/test/compile-fail/region-object-lifetime-3.rs new file mode 100644 index 0000000000..097053276c --- /dev/null +++ b/src/test/compile-fail/region-object-lifetime-3.rs @@ -0,0 +1,29 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Various tests related to testing how region inference works +// with respect to the object receivers. + +#![feature(rustc_attrs)] +#![allow(warnings)] + +trait Foo { + fn borrowed<'a>(&'a self) -> &'a (); +} + +// Borrowed receiver with two distinct lifetimes, but we know that +// 'b:'a, hence &'a () is permitted. +fn borrowed_receiver_related_lifetimes<'a,'b>(x: &'a (Foo+'b)) -> &'a () { + x.borrowed() +} + +#[rustc_error] +fn main() {} //~ ERROR compilation successful + diff --git a/src/test/compile-fail/region-object-lifetime-4.rs b/src/test/compile-fail/region-object-lifetime-4.rs new file mode 100644 index 0000000000..fe0ff8dc3f --- /dev/null +++ b/src/test/compile-fail/region-object-lifetime-4.rs @@ -0,0 +1,26 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Various tests related to testing how region inference works +// with respect to the object receivers. + +trait Foo { + fn borrowed<'a>(&'a self) -> &'a (); +} + +// Here we have two distinct lifetimes, but we try to return a pointer +// with the longer lifetime when (from the signature) we only know +// that it lives as long as the shorter lifetime. Therefore, error. +fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () { + x.borrowed() //~ ERROR cannot infer +} + +fn main() {} + diff --git a/src/test/compile-fail/region-object-lifetime-5.rs b/src/test/compile-fail/region-object-lifetime-5.rs new file mode 100644 index 0000000000..f07f753d82 --- /dev/null +++ b/src/test/compile-fail/region-object-lifetime-5.rs @@ -0,0 +1,25 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Various tests related to testing how region inference works +// with respect to the object receivers. + +trait Foo { + fn borrowed<'a>(&'a self) -> &'a (); +} + +// Here, the object is bounded by an anonymous lifetime and returned +// as `&'static`, so you get an error. +fn owned_receiver(x: Box) -> &'static () { + x.borrowed() //~ ERROR `*x` does not live long enough +} + +fn main() {} + diff --git a/src/test/compile-fail/region-object-lifetime-in-coercion.rs b/src/test/compile-fail/region-object-lifetime-in-coercion.rs index e4521873a6..2da414befd 100644 --- a/src/test/compile-fail/region-object-lifetime-in-coercion.rs +++ b/src/test/compile-fail/region-object-lifetime-in-coercion.rs @@ -13,24 +13,26 @@ #![feature(box_syntax)] -trait Foo {} +trait Foo : ::std::marker::MarkerTrait {} impl<'a> Foo for &'a [u8] {} fn a(v: &[u8]) -> Box { - let x: Box = box v; //~ ERROR declared lifetime bound not satisfied + let x: Box = box v; //~ ERROR does not fulfill the required lifetime x } fn b(v: &[u8]) -> Box { - box v //~ ERROR declared lifetime bound not satisfied + box v //~ ERROR does not fulfill the required lifetime } fn c(v: &[u8]) -> Box { - box v // OK thanks to lifetime elision + // same as previous case due to RFC 599 + + box v //~ ERROR does not fulfill the required lifetime } fn d<'a,'b>(v: &'a [u8]) -> Box { - box v //~ ERROR declared lifetime bound not satisfied + box v //~ ERROR does not fulfill the required lifetime } fn e<'a:'b,'b>(v: &'a [u8]) -> Box { diff --git a/src/test/compile-fail/regionck-unboxed-closure-lifetimes.rs b/src/test/compile-fail/regionck-unboxed-closure-lifetimes.rs index cdaa3468a4..9418156ffc 100644 --- a/src/test/compile-fail/regionck-unboxed-closure-lifetimes.rs +++ b/src/test/compile-fail/regionck-unboxed-closure-lifetimes.rs @@ -17,7 +17,7 @@ fn main() { { let c = 1; let c_ref = &c; //~ ERROR `c` does not live long enough - f = move |&mut: a: isize, b: isize| { a + b + *c_ref }; + f = move |a: isize, b: isize| { a + b + *c_ref }; } } diff --git a/src/test/compile-fail/regions-addr-of-self.rs b/src/test/compile-fail/regions-addr-of-self.rs index b69224d449..45e468b3ab 100644 --- a/src/test/compile-fail/regions-addr-of-self.rs +++ b/src/test/compile-fail/regions-addr-of-self.rs @@ -15,18 +15,18 @@ struct dog { impl dog { pub fn chase_cat(&mut self) { let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer - *p += 1us; + *p += 1_usize; } pub fn chase_cat_2(&mut self) { let p: &mut usize = &mut self.cats_chased; - *p += 1us; + *p += 1_usize; } } fn dog() -> dog { dog { - cats_chased: 0us + cats_chased: 0_usize } } diff --git a/src/test/compile-fail/regions-addr-of-upvar-self.rs b/src/test/compile-fail/regions-addr-of-upvar-self.rs index fa76ab758a..8cc2dd6afc 100644 --- a/src/test/compile-fail/regions-addr-of-upvar-self.rs +++ b/src/test/compile-fail/regions-addr-of-upvar-self.rs @@ -16,9 +16,9 @@ struct dog { impl dog { pub fn chase_cat(&mut self) { - let _f = |&:| { + let _f = || { let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer - *p = 3us; + *p = 3_usize; }; } } diff --git a/src/test/compile-fail/regions-assoc-type-in-supertrait-outlives-container.rs b/src/test/compile-fail/regions-assoc-type-in-supertrait-outlives-container.rs new file mode 100644 index 0000000000..6aa0cc003c --- /dev/null +++ b/src/test/compile-fail/regions-assoc-type-in-supertrait-outlives-container.rs @@ -0,0 +1,56 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we are imposing the requirement that every associated +// type of a bound that appears in the where clause on a struct must +// outlive the location in which the type appears, even when the +// associted type is in a supertype. Issue #22246. + +#![allow(dead_code)] + +use std::marker::PhantomFn; + +/////////////////////////////////////////////////////////////////////////// + +pub trait TheTrait: PhantomFn { + type TheAssocType; +} + +pub trait TheSubTrait : TheTrait { +} + +pub struct TheType<'b> { + m: [fn(&'b()); 0] +} + +impl<'b> TheTrait for TheType<'b> { + type TheAssocType = &'b (); +} + +impl<'b> TheSubTrait for TheType<'b> { +} + +/////////////////////////////////////////////////////////////////////////// + +pub struct WithAssoc { + m: [T; 0] +} + +fn with_assoc<'a,'b>() { + // For this type to be valid, the rules require that all + // associated types of traits that appear in `WithAssoc` must + // outlive 'a. In this case, that means TheType<'b>::TheAssocType, + // which is &'b (), must outlive 'a. + + let _: &'a WithAssoc> = loop { }; //~ ERROR cannot infer +} + +fn main() { +} diff --git a/src/test/compile-fail/regions-assoc-type-outlives-container-hrtb.rs b/src/test/compile-fail/regions-assoc-type-outlives-container-hrtb.rs new file mode 100644 index 0000000000..9736910d7b --- /dev/null +++ b/src/test/compile-fail/regions-assoc-type-outlives-container-hrtb.rs @@ -0,0 +1,70 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that structs with higher-ranked where clauses don't generate +// "outlives" requirements. Issue #22246. + +#![allow(dead_code)] +#![feature(rustc_attrs)] + +use std::marker::PhantomFn; + +/////////////////////////////////////////////////////////////////////////// + +pub trait TheTrait<'b> : PhantomFn<&'b Self,Self> { + type TheAssocType; +} + +pub struct TheType<'b> { + m: [fn(&'b()); 0] +} + +impl<'a,'b> TheTrait<'a> for TheType<'b> { + type TheAssocType = &'b (); +} + +/////////////////////////////////////////////////////////////////////////// + +pub struct WithHrAssoc + where for<'a> T : TheTrait<'a> +{ + m: [T; 0] +} + +fn with_assoc<'a,'b>() { + // We get no error here because the where clause has a higher-ranked assoc type, + // which could not be projected from. + + let _: &'a WithHrAssoc> = loop { }; +} + +/////////////////////////////////////////////////////////////////////////// + +pub trait TheSubTrait : for<'a> TheTrait<'a> { +} + +impl<'b> TheSubTrait for TheType<'b> { } + +pub struct WithHrAssocSub + where T : TheSubTrait +{ + m: [T; 0] +} + +fn with_assoc_sub<'a,'b>() { + // Same here, because although the where clause is not HR, it + // extends a trait in a HR way. + + let _: &'a WithHrAssocSub> = loop { }; +} + +#[rustc_error] +fn main() { //~ ERROR compilation successful +} diff --git a/src/test/compile-fail/regions-assoc-type-outlives-container-wc.rs b/src/test/compile-fail/regions-assoc-type-outlives-container-wc.rs new file mode 100644 index 0000000000..da7546ce21 --- /dev/null +++ b/src/test/compile-fail/regions-assoc-type-outlives-container-wc.rs @@ -0,0 +1,50 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we are imposing the requirement that every associated +// type of a bound that appears in the where clause on a struct must +// outlive the location in which the type appears, even when the +// constraint is in a where clause not a bound. Issue #22246. + +#![allow(dead_code)] + +use std::marker::PhantomFn; + +/////////////////////////////////////////////////////////////////////////// + +pub trait TheTrait: PhantomFn { + type TheAssocType; +} + +pub struct TheType<'b> { + m: [fn(&'b()); 0] +} + +impl<'b> TheTrait for TheType<'b> { + type TheAssocType = &'b (); +} + +/////////////////////////////////////////////////////////////////////////// + +pub struct WithAssoc where T : TheTrait { + m: [T; 0] +} + +fn with_assoc<'a,'b>() { + // For this type to be valid, the rules require that all + // associated types of traits that appear in `WithAssoc` must + // outlive 'a. In this case, that means TheType<'b>::TheAssocType, + // which is &'b (), must outlive 'a. + + let _: &'a WithAssoc> = loop { }; //~ ERROR cannot infer +} + +fn main() { +} diff --git a/src/test/compile-fail/regions-assoc-type-outlives-container.rs b/src/test/compile-fail/regions-assoc-type-outlives-container.rs new file mode 100644 index 0000000000..e1e72e6f56 --- /dev/null +++ b/src/test/compile-fail/regions-assoc-type-outlives-container.rs @@ -0,0 +1,89 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we are imposing the requirement that every associated +// type of a bound that appears in the where clause on a struct must +// outlive the location in which the type appears. Issue #22246. + +#![allow(dead_code)] +#![feature(rustc_attrs)] + +use std::marker::PhantomFn; + +/////////////////////////////////////////////////////////////////////////// + +pub trait TheTrait: PhantomFn { + type TheAssocType; +} + +pub struct TheType<'b> { + m: [fn(&'b()); 0] +} + +impl<'b> TheTrait for TheType<'b> { + type TheAssocType = &'b (); +} + +/////////////////////////////////////////////////////////////////////////// + +pub struct WithAssoc { + m: [T; 0] +} + +pub struct WithoutAssoc { + m: [T; 0] +} + +fn with_assoc<'a,'b>() { + // For this type to be valid, the rules require that all + // associated types of traits that appear in `WithAssoc` must + // outlive 'a. In this case, that means TheType<'b>::TheAssocType, + // which is &'b (), must outlive 'a. + + let _: &'a WithAssoc> = loop { }; //~ ERROR cannot infer +} + +fn with_assoc1<'a,'b>() where 'b : 'a { + // For this type to be valid, the rules require that all + // associated types of traits that appear in `WithAssoc` must + // outlive 'a. In this case, that means TheType<'b>::TheAssocType, + // which is &'b (), must outlive 'a, so 'b : 'a must hold, and + // that is in the where clauses, so we're fine. + + let _: &'a WithAssoc> = loop { }; +} + +fn without_assoc<'a,'b>() { + // Here there are no associated types and the `'b` appearing in + // `TheType<'b>` is purely covariant, so there is no requirement + // that `'b:'a` holds. + + let _: &'a WithoutAssoc> = loop { }; +} + +fn call_with_assoc<'a,'b>() { + // As `with_assoc`, but just checking that we impose the same rule + // on the value supplied for the type argument, even when there is + // no data. + + call::<&'a WithAssoc>>(); + //~^ ERROR cannot infer +} + +fn call_without_assoc<'a,'b>() { + // As `without_assoc`, but in a distinct scenario. + + call::<&'a WithoutAssoc>>(); +} + +fn call() { } + +fn main() { +} diff --git a/src/test/compile-fail/regions-assoc-type-region-bound-in-trait-not-met.rs b/src/test/compile-fail/regions-assoc-type-region-bound-in-trait-not-met.rs new file mode 100644 index 0000000000..f921eccef1 --- /dev/null +++ b/src/test/compile-fail/regions-assoc-type-region-bound-in-trait-not-met.rs @@ -0,0 +1,34 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that the compiler checks that arbitrary region bounds declared +// in the trait must be satisfied on the impl. Issue #20890. + +trait Foo<'a> { + type Value: 'a; + fn dummy(&'a self) { } +} + +impl<'a> Foo<'a> for &'a i16 { + // OK. + type Value = &'a i32; +} + +impl<'a> Foo<'static> for &'a i32 { + //~^ ERROR cannot infer + type Value = &'a i32; +} + +impl<'a,'b> Foo<'b> for &'a i64 { + //~^ ERROR cannot infer + type Value = &'a i32; +} + +fn main() { } diff --git a/src/test/compile-fail/regions-assoc-type-static-bound-in-trait-not-met.rs b/src/test/compile-fail/regions-assoc-type-static-bound-in-trait-not-met.rs new file mode 100644 index 0000000000..1cf83b8ac5 --- /dev/null +++ b/src/test/compile-fail/regions-assoc-type-static-bound-in-trait-not-met.rs @@ -0,0 +1,29 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that the compiler checks that the 'static bound declared in +// the trait must be satisfied on the impl. Issue #20890. + +trait Foo { + type Value: 'static; + fn dummy(&self) { } +} + +impl<'a> Foo for &'a i32 { + //~^ ERROR cannot infer + type Value = &'a i32; +} + +impl<'a> Foo for i32 { + // OK. + type Value = i32; +} + +fn main() { } diff --git a/src/test/compile-fail/regions-bound-missing-bound-in-impl.rs b/src/test/compile-fail/regions-bound-missing-bound-in-impl.rs index 5028ec8997..278ccd3c11 100644 --- a/src/test/compile-fail/regions-bound-missing-bound-in-impl.rs +++ b/src/test/compile-fail/regions-bound-missing-bound-in-impl.rs @@ -16,15 +16,15 @@ struct Inv<'a> { // invariant w/r/t 'a x: &'a mut &'a isize } -pub trait Foo<'a> { +pub trait Foo<'a, 't> { fn no_bound<'b>(self, b: Inv<'b>); fn has_bound<'b:'a>(self, b: Inv<'b>); fn wrong_bound1<'b,'c,'d:'a+'b>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>); - fn wrong_bound2<'b,'c,'d:'a+'b+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>); + fn okay_bound<'b,'c,'d:'a+'b+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>); + fn another_bound<'x: 'a>(self, x: Inv<'x>, y: Inv<'t>); } - -impl<'a> Foo<'a> for &'a isize { +impl<'a, 't> Foo<'a, 't> for &'a isize { fn no_bound<'b:'a>(self, b: Inv<'b>) { //~^ ERROR lifetime parameters or bounds on method `no_bound` do not match } @@ -47,9 +47,10 @@ impl<'a> Foo<'a> for &'a isize { // cases. } - fn wrong_bound2<'b,'c,'e:'b+'c>(self, b: Inv<'b>, c: Inv<'c>, e: Inv<'e>) { - //~^ ERROR distinct set of bounds from its counterpart + fn okay_bound<'b,'c,'e:'b+'c>(self, b: Inv<'b>, c: Inv<'c>, e: Inv<'e>) { } + + fn another_bound<'x: 't>(self, x: Inv<'x>, y: Inv<'t>) {} } fn main() { } diff --git a/src/test/compile-fail/regions-bounded-by-send.rs b/src/test/compile-fail/regions-bounded-by-send.rs deleted file mode 100644 index e3f0d3bcdb..0000000000 --- a/src/test/compile-fail/regions-bounded-by-send.rs +++ /dev/null @@ -1,83 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test which of the builtin types are considered sendable. The tests -// in this file all test region bound and lifetime violations that are -// detected during type check. - -extern crate core; -use core::ptr::Unique; - -fn assert_send() { } -trait Dummy:Send { } - -// lifetime pointers with 'static lifetime are ok - -fn static_lifime_ok<'a,T,U:Send>(_: &'a isize) { - assert_send::<&'static isize>(); - assert_send::<&'static str>(); - assert_send::<&'static [isize]>(); - - // whether or not they are mutable - assert_send::<&'static mut isize>(); -} - -// otherwise lifetime pointers are not ok - -fn param_not_ok<'a>(x: &'a isize) { - assert_send::<&'a isize>(); //~ ERROR declared lifetime bound not satisfied -} - -fn param_not_ok1<'a>(_: &'a isize) { - assert_send::<&'a str>(); //~ ERROR declared lifetime bound not satisfied -} - -fn param_not_ok2<'a>(_: &'a isize) { - assert_send::<&'a [isize]>(); //~ ERROR declared lifetime bound not satisfied -} - -// boxes are ok - -fn box_ok() { - assert_send::>(); - assert_send::(); - assert_send::>(); -} - -// but not if they own a bad thing - -fn box_with_region_not_ok<'a>() { - assert_send::>(); //~ ERROR declared lifetime bound not satisfied -} - -// objects with insufficient bounds no ok - -fn object_with_random_bound_not_ok<'a>() { - assert_send::<&'a (Dummy+'a)>(); - //~^ ERROR reference has a longer lifetime -} - -fn object_with_send_bound_not_ok<'a>() { - assert_send::<&'a (Dummy+Send)>(); - //~^ ERROR declared lifetime bound not satisfied -} - -// unsafe pointers are ok unless they point at unsendable things - -struct UniqueUnsafePtr(Unique<*const isize>); - -unsafe impl Send for UniqueUnsafePtr {} - -fn unsafe_ok1<'a>(_: &'a isize) { - assert_send::(); -} - -fn main() { -} diff --git a/src/test/compile-fail/regions-bounded-by-trait-requiring-static.rs b/src/test/compile-fail/regions-bounded-by-trait-requiring-static.rs index 8194af25d7..9e4c4e677c 100644 --- a/src/test/compile-fail/regions-bounded-by-trait-requiring-static.rs +++ b/src/test/compile-fail/regions-bounded-by-trait-requiring-static.rs @@ -29,15 +29,15 @@ fn static_lifime_ok<'a,T,U:Send>(_: &'a isize) { // otherwise lifetime pointers are not ok fn param_not_ok<'a>(x: &'a isize) { - assert_send::<&'a isize>(); //~ ERROR declared lifetime bound not satisfied + assert_send::<&'a isize>(); //~ ERROR does not fulfill the required lifetime } fn param_not_ok1<'a>(_: &'a isize) { - assert_send::<&'a str>(); //~ ERROR declared lifetime bound not satisfied + assert_send::<&'a str>(); //~ ERROR does not fulfill the required lifetime } fn param_not_ok2<'a>(_: &'a isize) { - assert_send::<&'a [isize]>(); //~ ERROR declared lifetime bound not satisfied + assert_send::<&'a [isize]>(); //~ ERROR does not fulfill the required lifetime } // boxes are ok @@ -51,7 +51,7 @@ fn box_ok() { // but not if they own a bad thing fn box_with_region_not_ok<'a>() { - assert_send::>(); //~ ERROR declared lifetime bound not satisfied + assert_send::>(); //~ ERROR does not fulfill the required lifetime } // unsafe pointers are ok unless they point at unsendable things @@ -62,11 +62,11 @@ fn unsafe_ok1<'a>(_: &'a isize) { } fn unsafe_ok2<'a>(_: &'a isize) { - assert_send::<*const &'a isize>(); //~ ERROR declared lifetime bound not satisfied + assert_send::<*const &'a isize>(); //~ ERROR does not fulfill the required lifetime } fn unsafe_ok3<'a>(_: &'a isize) { - assert_send::<*mut &'a isize>(); //~ ERROR declared lifetime bound not satisfied + assert_send::<*mut &'a isize>(); //~ ERROR does not fulfill the required lifetime } fn main() { diff --git a/src/test/compile-fail/regions-bounded-method-type-parameters-trait-bound.rs b/src/test/compile-fail/regions-bounded-method-type-parameters-trait-bound.rs index acc721f26b..f13d8a6089 100644 --- a/src/test/compile-fail/regions-bounded-method-type-parameters-trait-bound.rs +++ b/src/test/compile-fail/regions-bounded-method-type-parameters-trait-bound.rs @@ -8,16 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![no_std] -#![feature(lang_items)] - // Check that explicit region bounds are allowed on the various // nominal types (but not on other types) and that they are type // checked. -#[lang="sized"] -trait Sized { } - struct Inv<'a> { // invariant w/r/t 'a x: &'a mut &'a isize } diff --git a/src/test/compile-fail/regions-bounded-method-type-parameters.rs b/src/test/compile-fail/regions-bounded-method-type-parameters.rs index 9afacacd66..da4e8231a2 100644 --- a/src/test/compile-fail/regions-bounded-method-type-parameters.rs +++ b/src/test/compile-fail/regions-bounded-method-type-parameters.rs @@ -20,7 +20,7 @@ impl Foo { fn caller<'a>(x: &isize) { Foo.some_method::<&'a isize>(); - //~^ ERROR declared lifetime bound not satisfied + //~^ ERROR does not fulfill the required lifetime } fn main() { } diff --git a/src/test/compile-fail/regions-bounds.rs b/src/test/compile-fail/regions-bounds.rs index c26740c959..7f2889a327 100644 --- a/src/test/compile-fail/regions-bounds.rs +++ b/src/test/compile-fail/regions-bounds.rs @@ -16,11 +16,17 @@ struct an_enum<'a>(&'a isize); struct a_class<'a> { x:&'a isize } fn a_fn1<'a,'b>(e: an_enum<'a>) -> an_enum<'b> { - return e; //~ ERROR mismatched types: expected `an_enum<'b>`, found `an_enum<'a>` + return e; //~ ERROR mismatched types + //~| expected `an_enum<'b>` + //~| found `an_enum<'a>` + //~| lifetime mismatch } fn a_fn3<'a,'b>(e: a_class<'a>) -> a_class<'b> { - return e; //~ ERROR mismatched types: expected `a_class<'b>`, found `a_class<'a>` + return e; //~ ERROR mismatched types + //~| expected `a_class<'b>` + //~| found `a_class<'a>` + //~| lifetime mismatch } fn main() { } diff --git a/src/test/compile-fail/regions-close-associated-type-into-object.rs b/src/test/compile-fail/regions-close-associated-type-into-object.rs index 8a03f36972..979c1e997d 100644 --- a/src/test/compile-fail/regions-close-associated-type-into-object.rs +++ b/src/test/compile-fail/regions-close-associated-type-into-object.rs @@ -10,7 +10,9 @@ #![feature(box_syntax)] -trait X {} +use std::marker::MarkerTrait; + +trait X : MarkerTrait {} trait Iter { type Item: X; diff --git a/src/test/compile-fail/regions-close-object-into-object-1.rs b/src/test/compile-fail/regions-close-object-into-object-1.rs new file mode 100644 index 0000000000..7bbce7dad5 --- /dev/null +++ b/src/test/compile-fail/regions-close-object-into-object-1.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(box_syntax)] +#![allow(warnings)] + +use std::marker::PhantomFn; + +trait A : PhantomFn<(Self,T)> { } +struct B<'a, T>(&'a (A+'a)); + +trait X : ::std::marker::MarkerTrait {} + +impl<'a, T> X for B<'a, T> {} + +fn f<'a, T:'static, U>(v: Box+'static>) -> Box { + box B(&*v) as Box //~ ERROR `*v` does not live long enough +} + +fn main() {} + diff --git a/src/test/compile-fail/regions-close-object-into-object-2.rs b/src/test/compile-fail/regions-close-object-into-object-2.rs new file mode 100644 index 0000000000..6de49020a6 --- /dev/null +++ b/src/test/compile-fail/regions-close-object-into-object-2.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(box_syntax)] + +use std::marker::PhantomFn; + +trait A : PhantomFn<(Self,T)> { } +struct B<'a, T>(&'a (A+'a)); + +trait X : PhantomFn {} +impl<'a, T> X for B<'a, T> {} + +fn g<'a, T: 'static>(v: Box+'a>) -> Box { + box B(&*v) as Box //~ ERROR cannot infer +} + +fn main() { } diff --git a/src/test/compile-fail/regions-close-object-into-object-3.rs b/src/test/compile-fail/regions-close-object-into-object-3.rs new file mode 100644 index 0000000000..e22d0c7d0a --- /dev/null +++ b/src/test/compile-fail/regions-close-object-into-object-3.rs @@ -0,0 +1,27 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(box_syntax)] +#![allow(warnings)] + +use std::marker::PhantomFn; + +trait A : PhantomFn<(Self,T)> {} +struct B<'a, T>(&'a (A+'a)); + +trait X : PhantomFn {} +impl<'a, T> X for B<'a, T> {} + +fn h<'a, T, U>(v: Box+'static>) -> Box { + box B(&*v) as Box //~ ERROR `*v` does not live long enough +} + +fn main() {} + diff --git a/src/test/compile-fail/regions-close-object-into-object-4.rs b/src/test/compile-fail/regions-close-object-into-object-4.rs new file mode 100644 index 0000000000..147a575d38 --- /dev/null +++ b/src/test/compile-fail/regions-close-object-into-object-4.rs @@ -0,0 +1,26 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(box_syntax)] + +use std::marker::PhantomFn; + +trait A : PhantomFn<(Self,T)> {} +struct B<'a, T>(&'a (A+'a)); + +trait X : PhantomFn {} +impl<'a, T> X for B<'a, T> {} + +fn i<'a, T, U>(v: Box+'a>) -> Box { + box B(&*v) as Box //~ ERROR cannot infer +} + +fn main() {} + diff --git a/src/test/compile-fail/regions-close-object-into-object.rs b/src/test/compile-fail/regions-close-object-into-object-5.rs similarity index 65% rename from src/test/compile-fail/regions-close-object-into-object.rs rename to src/test/compile-fail/regions-close-object-into-object-5.rs index 675f86b58f..bdc52eca2c 100644 --- a/src/test/compile-fail/regions-close-object-into-object.rs +++ b/src/test/compile-fail/regions-close-object-into-object-5.rs @@ -9,27 +9,21 @@ // except according to those terms. #![feature(box_syntax)] +#![allow(warnings)] + +trait A +{ + fn get(&self) -> T { panic!() } +} -trait A {} struct B<'a, T>(&'a (A+'a)); -trait X {} +trait X { fn foo(&self) {} } + impl<'a, T> X for B<'a, T> {} fn f<'a, T, U>(v: Box+'static>) -> Box { - box B(&*v) as Box -} - -fn g<'a, T: 'static>(v: Box>) -> Box { - box B(&*v) as Box //~ ERROR cannot infer -} - -fn h<'a, T, U>(v: Box+'static>) -> Box { - box B(&*v) as Box -} - -fn i<'a, T, U>(v: Box>) -> Box { - box B(&*v) as Box //~ ERROR cannot infer + box B(&*v) as Box //~ ERROR the parameter type `T` may not live long enough } fn main() {} diff --git a/src/test/compile-fail/regions-close-over-borrowed-ref-in-obj.rs b/src/test/compile-fail/regions-close-over-borrowed-ref-in-obj.rs index 25b8137d29..2341d2397c 100644 --- a/src/test/compile-fail/regions-close-over-borrowed-ref-in-obj.rs +++ b/src/test/compile-fail/regions-close-over-borrowed-ref-in-obj.rs @@ -10,7 +10,9 @@ #![feature(box_syntax)] -trait Foo { } +use std::marker::MarkerTrait; + +trait Foo : MarkerTrait { } impl<'a> Foo for &'a isize { } diff --git a/src/test/compile-fail/regions-close-over-type-parameter-2.rs b/src/test/compile-fail/regions-close-over-type-parameter-2.rs index 543d4d1620..053af49e06 100644 --- a/src/test/compile-fail/regions-close-over-type-parameter-2.rs +++ b/src/test/compile-fail/regions-close-over-type-parameter-2.rs @@ -29,7 +29,7 @@ fn main() { // ~Repeat<&'blk isize> where blk is the lifetime of the block below. let _ = { - let tmp0 = 3is; + let tmp0 = 3; let tmp1 = &tmp0; //~ ERROR `tmp0` does not live long enough repeater3(tmp1) }; diff --git a/src/test/compile-fail/regions-close-param-into-object.rs b/src/test/compile-fail/regions-close-param-into-object.rs index 74b36958c9..655ac6f66c 100644 --- a/src/test/compile-fail/regions-close-param-into-object.rs +++ b/src/test/compile-fail/regions-close-param-into-object.rs @@ -10,7 +10,7 @@ #![feature(box_syntax)] -trait X {} +trait X { fn foo(&self) {} } fn p1(v: T) -> Box where T : X diff --git a/src/test/compile-fail/regions-creating-enums.rs b/src/test/compile-fail/regions-creating-enums.rs index 83cef9397c..4c361427bf 100644 --- a/src/test/compile-fail/regions-creating-enums.rs +++ b/src/test/compile-fail/regions-creating-enums.rs @@ -14,8 +14,8 @@ enum ast<'a> { } fn build() { - let x = ast::num(3us); - let y = ast::num(4us); + let x = ast::num(3_usize); + let y = ast::num(4_usize); let z = ast::add(&x, &y); compute(&z); } diff --git a/src/test/compile-fail/regions-early-bound-error-method.rs b/src/test/compile-fail/regions-early-bound-error-method.rs index 9de0ed070c..4a3ca01c84 100644 --- a/src/test/compile-fail/regions-early-bound-error-method.rs +++ b/src/test/compile-fail/regions-early-bound-error-method.rs @@ -27,7 +27,13 @@ impl<'a> GetRef<'a> for Box<'a> { impl<'a> Box<'a> { fn or<'b,G:GetRef<'b>>(&self, g2: G) -> &'a isize { - g2.get() //~ ERROR cannot infer an appropriate lifetime for automatic coercion due to + g2.get() + //~^ ERROR cannot infer an appropriate lifetime for automatic coercion due to + //~| ERROR mismatched types + //~| expected `&'a isize` + //~| found `&'b isize` + //~| lifetime mismatch + } } diff --git a/src/test/compile-fail/regions-early-bound-error.rs b/src/test/compile-fail/regions-early-bound-error.rs index 37b74aea53..57c8e3f117 100644 --- a/src/test/compile-fail/regions-early-bound-error.rs +++ b/src/test/compile-fail/regions-early-bound-error.rs @@ -26,7 +26,12 @@ impl<'a,T:Clone> GetRef<'a,T> for Box<'a,T> { } fn get<'a,'b,G:GetRef<'a, isize>>(g1: G, b: &'b isize) -> &'b isize { - g1.get() //~ ERROR cannot infer an appropriate lifetime for automatic coercion due to + g1.get() + //~^ ERROR cannot infer an appropriate lifetime for automatic coercion due to + //~| ERROR mismatched types + //~| expected `&'b isize` + //~| found `&'a isize` + //~| lifetime mismatch } fn main() { diff --git a/src/test/compile-fail/regions-escape-loop-via-variable.rs b/src/test/compile-fail/regions-escape-loop-via-variable.rs index c300c86f70..f588655d1a 100644 --- a/src/test/compile-fail/regions-escape-loop-via-variable.rs +++ b/src/test/compile-fail/regions-escape-loop-via-variable.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - let x = 3is; + let x = 3; // Here, the variable `p` gets inferred to a type with a lifetime // of the loop body. The regionck then determines that this type @@ -17,7 +17,7 @@ fn main() { let mut p = &x; loop { - let x = 1is + *p; + let x = 1 + *p; p = &x; //~ ERROR `x` does not live long enough } } diff --git a/src/test/compile-fail/regions-escape-loop-via-vec.rs b/src/test/compile-fail/regions-escape-loop-via-vec.rs index 5e6e1858cf..89350f1616 100644 --- a/src/test/compile-fail/regions-escape-loop-via-vec.rs +++ b/src/test/compile-fail/regions-escape-loop-via-vec.rs @@ -10,7 +10,7 @@ // The type of `y` ends up getting inferred to the type of the block. fn broken() { - let mut x = 3is; + let mut x = 3; let mut _y = vec!(&mut x); while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed diff --git a/src/test/compile-fail/regions-escape-unboxed-closure.rs b/src/test/compile-fail/regions-escape-unboxed-closure.rs index 06768fa688..abbefd2548 100644 --- a/src/test/compile-fail/regions-escape-unboxed-closure.rs +++ b/src/test/compile-fail/regions-escape-unboxed-closure.rs @@ -15,5 +15,5 @@ fn with_int(f: &mut FnMut(&isize)) { fn main() { let mut x: Option<&isize> = None; - with_int(&mut |&mut: y| x = Some(y)); //~ ERROR cannot infer + with_int(&mut |y| x = Some(y)); //~ ERROR cannot infer } diff --git a/src/test/compile-fail/regions-fn-subtyping-return-static.rs b/src/test/compile-fail/regions-fn-subtyping-return-static.rs index ac56e8ce14..ebf7ca289f 100644 --- a/src/test/compile-fail/regions-fn-subtyping-return-static.rs +++ b/src/test/compile-fail/regions-fn-subtyping-return-static.rs @@ -53,7 +53,12 @@ fn supply_F() { fn supply_G() { want_G(foo); want_G(bar); - want_G(baz); //~ ERROR expected concrete lifetime + want_G(baz); + //~^ ERROR mismatched types + //~| expected `fn(&'cx S) -> &'static S` + //~| found `fn(&S) -> &S {baz}` + //~| expected concrete lifetime + //~| found bound lifetime parameter 'cx } pub fn main() { diff --git a/src/test/compile-fail/regions-glb-free-free.rs b/src/test/compile-fail/regions-glb-free-free.rs index f43d35c579..323d536002 100644 --- a/src/test/compile-fail/regions-glb-free-free.rs +++ b/src/test/compile-fail/regions-glb-free-free.rs @@ -35,5 +35,5 @@ mod argparse { fn main () { let f : argparse::Flag = argparse::flag("flag", "My flag"); let updated_flag = f.set_desc("My new flag"); - assert_eq!(updated_flag.desc.as_slice(), "My new flag"); + assert_eq!(updated_flag.desc, "My new flag"); } diff --git a/src/test/compile-fail/regions-infer-contravariance-due-to-decl.rs b/src/test/compile-fail/regions-infer-contravariance-due-to-decl.rs index 6c5e90a54d..b7ef19d1e3 100644 --- a/src/test/compile-fail/regions-infer-contravariance-due-to-decl.rs +++ b/src/test/compile-fail/regions-infer-contravariance-due-to-decl.rs @@ -20,7 +20,7 @@ use std::marker; // Contravariant<'foo> <: Contravariant<'static> because // 'foo <= 'static struct Contravariant<'a> { - marker: marker::ContravariantLifetime<'a> + marker: marker::PhantomData<&'a()> } fn use_<'short,'long>(c: Contravariant<'short>, diff --git a/src/test/compile-fail/regions-infer-covariance-due-to-decl.rs b/src/test/compile-fail/regions-infer-covariance-due-to-decl.rs index d8e31fa137..0d3d9dacbd 100644 --- a/src/test/compile-fail/regions-infer-covariance-due-to-decl.rs +++ b/src/test/compile-fail/regions-infer-covariance-due-to-decl.rs @@ -17,7 +17,7 @@ use std::marker; struct Covariant<'a> { - marker: marker::CovariantLifetime<'a> + marker: marker::PhantomData } fn use_<'short,'long>(c: Covariant<'long>, diff --git a/src/test/compile-fail/regions-infer-invariance-due-to-decl.rs b/src/test/compile-fail/regions-infer-invariance-due-to-decl.rs index 5f4a1af6bf..8c191fbd5b 100644 --- a/src/test/compile-fail/regions-infer-invariance-due-to-decl.rs +++ b/src/test/compile-fail/regions-infer-invariance-due-to-decl.rs @@ -11,15 +11,15 @@ use std::marker; struct invariant<'a> { - marker: marker::InvariantLifetime<'a> + marker: marker::PhantomData<*mut &'a()> } -fn to_same_lifetime<'r>(bi: invariant<'r>) { - let bj: invariant<'r> = bi; +fn to_same_lifetime<'r>(b_isize: invariant<'r>) { + let bj: invariant<'r> = b_isize; } -fn to_longer_lifetime<'r>(bi: invariant<'r>) -> invariant<'static> { - bi //~ ERROR mismatched types +fn to_longer_lifetime<'r>(b_isize: invariant<'r>) -> invariant<'static> { + b_isize //~ ERROR mismatched types } fn main() { diff --git a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs index e42aa684e1..f280e4d978 100644 --- a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs +++ b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs @@ -13,12 +13,12 @@ struct invariant<'a> { f: Box, } -fn to_same_lifetime<'r>(bi: invariant<'r>) { - let bj: invariant<'r> = bi; +fn to_same_lifetime<'r>(b_isize: invariant<'r>) { + let bj: invariant<'r> = b_isize; } -fn to_longer_lifetime<'r>(bi: invariant<'r>) -> invariant<'static> { - bi //~ ERROR mismatched types +fn to_longer_lifetime<'r>(b_isize: invariant<'r>) -> invariant<'static> { + b_isize //~ ERROR mismatched types } fn main() { diff --git a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs index 2e634dfe3e..ced0afcebd 100644 --- a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs +++ b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs @@ -9,16 +9,16 @@ // except according to those terms. -struct invariant<'a> { +struct Invariant<'a> { f: Box FnOnce() -> &'b mut &'a isize + 'static>, } -fn to_same_lifetime<'r>(bi: invariant<'r>) { - let bj: invariant<'r> = bi; +fn to_same_lifetime<'r>(b_isize: Invariant<'r>) { + let bj: Invariant<'r> = b_isize; } -fn to_longer_lifetime<'r>(bi: invariant<'r>) -> invariant<'static> { - bi //~ ERROR mismatched types +fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { + b_isize //~ ERROR mismatched types } fn main() { diff --git a/src/test/compile-fail/regions-infer-not-param.rs b/src/test/compile-fail/regions-infer-not-param.rs index 5d7a218ca8..83b9d4633d 100644 --- a/src/test/compile-fail/regions-infer-not-param.rs +++ b/src/test/compile-fail/regions-infer-not-param.rs @@ -27,5 +27,10 @@ fn take_direct<'a,'b>(p: direct<'a>) -> direct<'b> { p } //~ ERROR mismatched ty fn take_indirect1(p: indirect1) -> indirect1 { p } fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types +//~| expected `indirect2<'b>` +//~| found `indirect2<'a>` +//~| ERROR mismatched types +//~| expected `indirect2<'b>` +//~| found `indirect2<'a>` fn main() {} diff --git a/src/test/compile-fail/regions-infer-paramd-indirect.rs b/src/test/compile-fail/regions-infer-paramd-indirect.rs index 0d441380e8..1d32e8fe7b 100644 --- a/src/test/compile-fail/regions-infer-paramd-indirect.rs +++ b/src/test/compile-fail/regions-infer-paramd-indirect.rs @@ -31,7 +31,10 @@ impl<'a> set_f<'a> for c<'a> { fn set_f_bad(&mut self, b: Box) { self.f = b; - //~^ ERROR mismatched types: expected `Box>`, found `Box>` + //~^ ERROR mismatched types + //~| expected `Box>` + //~| found `Box>` + //~| lifetime mismatch } } diff --git a/src/test/compile-fail/regions-infer-proc-static-upvar.rs b/src/test/compile-fail/regions-infer-proc-static-upvar.rs index 4e99f64dbf..ee5d5cad0a 100644 --- a/src/test/compile-fail/regions-infer-proc-static-upvar.rs +++ b/src/test/compile-fail/regions-infer-proc-static-upvar.rs @@ -16,7 +16,7 @@ fn foo(_p: F) { } static i: isize = 3; fn capture_local() { - let x = 3is; + let x = 3; let y = &x; //~ ERROR `x` does not live long enough foo(move|| { let _a = *y; diff --git a/src/test/compile-fail/regions-pattern-typing-issue-19552.rs b/src/test/compile-fail/regions-pattern-typing-issue-19552.rs index 3f722c9433..3401dd1bec 100644 --- a/src/test/compile-fail/regions-pattern-typing-issue-19552.rs +++ b/src/test/compile-fail/regions-pattern-typing-issue-19552.rs @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn assert_send(_t: T) {} +fn assert_static(_t: T) {} fn main() { let line = String::new(); - match [line.as_slice()] { //~ ERROR `line` does not live long enough - [ word ] => { assert_send(word); } + match [&*line] { //~ ERROR `line` does not live long enough + [ word ] => { assert_static(word); } } } diff --git a/src/test/compile-fail/regions-ref-in-fn-arg.rs b/src/test/compile-fail/regions-ref-in-fn-arg.rs index 13a903bf2b..bc8060e391 100644 --- a/src/test/compile-fail/regions-ref-in-fn-arg.rs +++ b/src/test/compile-fail/regions-ref-in-fn-arg.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(box_patterns)] #![feature(box_syntax)] fn arg_item(box ref x: Box) -> &'static isize { diff --git a/src/test/compile-fail/regions-return-ref-to-upvar-issue-17403.rs b/src/test/compile-fail/regions-return-ref-to-upvar-issue-17403.rs index 21586f78db..aa20efa5a1 100644 --- a/src/test/compile-fail/regions-return-ref-to-upvar-issue-17403.rs +++ b/src/test/compile-fail/regions-return-ref-to-upvar-issue-17403.rs @@ -15,8 +15,8 @@ fn main() { // Unboxed closure case { - let mut x = 0us; - let mut f = |&mut:| &mut x; //~ ERROR cannot infer + let mut x = 0_usize; + let mut f = || &mut x; //~ ERROR cannot infer let x = f(); let y = f(); } diff --git a/src/test/compile-fail/regions-steal-closure.rs b/src/test/compile-fail/regions-steal-closure.rs index 583d9695be..97b51fdb32 100644 --- a/src/test/compile-fail/regions-steal-closure.rs +++ b/src/test/compile-fail/regions-steal-closure.rs @@ -21,7 +21,7 @@ fn box_it<'r>(x: Box) -> closure_box<'r> { fn main() { let cl_box = { - let mut i = 3is; + let mut i = 3; box_it(box || i += 1) //~ ERROR cannot infer }; cl_box.cl.call_mut(()); diff --git a/src/test/compile-fail/regions-struct-not-wf.rs b/src/test/compile-fail/regions-struct-not-wf.rs index 3de137a9ef..3b8312a301 100644 --- a/src/test/compile-fail/regions-struct-not-wf.rs +++ b/src/test/compile-fail/regions-struct-not-wf.rs @@ -10,6 +10,7 @@ // Various examples of structs whose fields are not well-formed. +#![feature(no_std)] #![no_std] #![allow(dead_code)] diff --git a/src/test/compile-fail/regions-trait-1.rs b/src/test/compile-fail/regions-trait-1.rs index 63052580dc..b45a37d26e 100644 --- a/src/test/compile-fail/regions-trait-1.rs +++ b/src/test/compile-fail/regions-trait-1.rs @@ -34,7 +34,7 @@ fn get_v(gc: Box) -> usize { } fn main() { - let ctxt = ctxt { v: 22us }; + let ctxt = ctxt { v: 22_usize }; let hc = has_ctxt { c: &ctxt }; - assert_eq!(get_v(box hc as Box), 22us); + assert_eq!(get_v(box hc as Box), 22_usize); } diff --git a/src/test/compile-fail/regions-var-type-out-of-scope.rs b/src/test/compile-fail/regions-var-type-out-of-scope.rs index 039de994ea..8955a26de0 100644 --- a/src/test/compile-fail/regions-var-type-out-of-scope.rs +++ b/src/test/compile-fail/regions-var-type-out-of-scope.rs @@ -14,8 +14,8 @@ fn foo(cond: bool) { let mut x; if cond { - x = &3is; //~ ERROR borrowed value does not live long enough - assert_eq!(*x, 3is); + x = &3; //~ ERROR borrowed value does not live long enough + assert_eq!(*x, 3); } } diff --git a/src/test/compile-fail/repeat_count.rs b/src/test/compile-fail/repeat_count.rs index e94bf19955..9b3e266804 100644 --- a/src/test/compile-fail/repeat_count.rs +++ b/src/test/compile-fail/repeat_count.rs @@ -14,16 +14,45 @@ fn main() { let n = 1; let a = [0; n]; //~ ERROR expected constant integer for repeat count, found variable let b = [0; ()]; -//~^ ERROR expected constant integer for repeat count, found non-constant expression -//~^^ ERROR: expected `usize`, found `()` - let c = [0; true]; //~ ERROR expected positive integer for repeat count, found boolean - //~^ ERROR: expected `usize`, found `bool` - let d = [0; 0.5]; //~ ERROR expected positive integer for repeat count, found float - //~^ ERROR: expected `usize`, found `_` - let e = [0; "foo"]; //~ ERROR expected positive integer for repeat count, found string - //~^ ERROR: expected `usize`, found `&'static str` - let f = [0; -4]; - //~^ ERROR expected positive integer for repeat count, found negative integer - let f = [0us; -1]; - //~^ ERROR expected positive integer for repeat count, found negative integer +//~^ ERROR mismatched types +//~| expected `usize` +//~| found `()` +//~| expected usize +//~| found () +//~| ERROR expected constant integer for repeat count, found non-constant expression + let c = [0; true]; + //~^ ERROR mismatched types + //~| expected `usize` + //~| found `bool` + //~| expected usize + //~| found bool + //~| ERROR expected positive integer for repeat count, found boolean + let d = [0; 0.5]; + //~^ ERROR mismatched types + //~| expected `usize` + //~| found `_` + //~| expected usize + //~| found floating-point variable + //~| ERROR expected positive integer for repeat count, found float + let e = [0; "foo"]; + //~^ ERROR mismatched types + //~| expected `usize` + //~| found `&'static str` + //~| expected usize + //~| found &-ptr + //~| ERROR expected positive integer for repeat count, found string + let f = [0; -4_isize]; + //~^ ERROR mismatched types + //~| expected `usize` + //~| found `isize` + //~| expected usize + //~| found isize + //~| ERROR expected positive integer for repeat count, found negative integer + let f = [0_usize; -1_isize]; + //~^ ERROR mismatched types + //~| expected `usize` + //~| found `isize` + //~| expected usize + //~| found isize + //~| ERROR expected positive integer for repeat count, found negative integer } diff --git a/src/test/compile-fail/required-lang-item.rs b/src/test/compile-fail/required-lang-item.rs index ae561878e9..1b749faf1b 100644 --- a/src/test/compile-fail/required-lang-item.rs +++ b/src/test/compile-fail/required-lang-item.rs @@ -8,10 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(lang_items)] +#![feature(lang_items, no_std)] #![no_std] -#[lang="sized"] pub trait Sized {} +#[lang="phantom_fn"] +pub trait PhantomFn { } +impl PhantomFn for U { } + +#[lang="sized"] pub trait Sized : PhantomFn {} // error-pattern:requires `start` lang_item diff --git a/src/test/compile-fail/reserved-become.rs b/src/test/compile-fail/reserved-become.rs new file mode 100644 index 0000000000..82e9ebc10d --- /dev/null +++ b/src/test/compile-fail/reserved-become.rs @@ -0,0 +1,14 @@ +// Copyright 2012-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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let become = 0; + //~^ ERROR `become` is a reserved keyword +} diff --git a/src/test/compile-fail/rustc-error.rs b/src/test/compile-fail/rustc-error.rs new file mode 100644 index 0000000000..82f32cbcd1 --- /dev/null +++ b/src/test/compile-fail/rustc-error.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(rustc_attrs)] + +#[rustc_error] +fn main() { + //~^ ERROR compilation successful +} diff --git a/src/test/compile-fail/self_type_keyword.rs b/src/test/compile-fail/self_type_keyword.rs new file mode 100644 index 0000000000..6f5aeead57 --- /dev/null +++ b/src/test/compile-fail/self_type_keyword.rs @@ -0,0 +1,49 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Self; +//~^ ERROR expected identifier, found keyword `Self` + +struct Bar<'Self>; +//~^ ERROR invalid lifetime name + +pub fn main() { + let Self = 5; + //~^ ERROR expected identifier, found keyword `Self` + + match 15 { + Self => (), + //~^ ERROR expected identifier, found keyword `Self` + ref Self => (), + //~^ ERROR expected identifier, found keyword `Self` + mut Self => (), + //~^ ERROR expected identifier, found keyword `Self` + ref mut Self => (), + //~^ ERROR expected identifier, found keyword `Self` + Self!() => (), + //~^ ERROR expected identifier, found keyword `Self` + Foo { x: Self } => (), + //~^ ERROR expected identifier, found keyword `Self` + Foo { Self } => (), + //~^ ERROR expected identifier, found keyword `Self` + } +} + +use self::Self as Foo; +//~^ ERROR expected identifier, found keyword `Self` + +use std::option::Option as Self; +//~^ ERROR expected identifier, found keyword `Self` + +extern crate Self; +//~^ ERROR expected identifier, found keyword `Self` + +trait Self {} +//~^ ERROR expected identifier, found keyword `Self` diff --git a/src/test/compile-fail/borrowck-array-double-move.rs b/src/test/compile-fail/send-is-not-static-ensures-scoping.rs old mode 100644 new mode 100755 similarity index 70% rename from src/test/compile-fail/borrowck-array-double-move.rs rename to src/test/compile-fail/send-is-not-static-ensures-scoping.rs index ac9ddc2ce6..abbcd7e459 --- a/src/test/compile-fail/borrowck-array-double-move.rs +++ b/src/test/compile-fail/send-is-not-static-ensures-scoping.rs @@ -8,17 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] -#![feature(box_syntax)] - -fn f() { - let mut a = [box 0is, box 1is]; - drop(a[0]); - a[1] = box 2is; - drop(a[0]); //~ ERROR use of moved value: `a[..]` -} +use std::thread; fn main() { - f(); -} + let bad = { + let x = 1; + let y = &x; + thread::scoped(|| { //~ ERROR cannot infer an appropriate lifetime + let _z = y; + }) + }; + + bad.join(); +} diff --git a/src/test/compile-fail/seq-args.rs b/src/test/compile-fail/seq-args.rs index b4929eacf3..44b049d656 100644 --- a/src/test/compile-fail/seq-args.rs +++ b/src/test/compile-fail/seq-args.rs @@ -14,7 +14,7 @@ trait seq { } impl seq for Vec { //~ ERROR wrong number of type arguments /* ... */ } -impl seq for u32 { +impl seq for u32 { //~ ERROR wrong number of type arguments /* Treat the integer as a sequence of bits */ } diff --git a/src/test/compile-fail/shadowed-lifetime.rs b/src/test/compile-fail/shadowed-lifetime.rs index 57a2744d8f..725f83d495 100644 --- a/src/test/compile-fail/shadowed-lifetime.rs +++ b/src/test/compile-fail/shadowed-lifetime.rs @@ -13,18 +13,18 @@ struct Foo<'a>(&'a isize); impl<'a> Foo<'a> { - //~^ HELP shadowed lifetime `'a` declared here + //~^ NOTE shadowed lifetime `'a` declared here fn shadow_in_method<'a>(&'a self) -> &'a isize { //~^ WARNING lifetime name `'a` shadows another lifetime name that is already in scope - //~| HELP deprecated + //~| NOTE deprecated self.0 } fn shadow_in_type<'b>(&'b self) -> &'b isize { - //~^ HELP shadowed lifetime `'b` declared here + //~^ NOTE shadowed lifetime `'b` declared here let x: for<'b> fn(&'b isize) = panic!(); //~^ WARNING lifetime name `'b` shadows another lifetime name that is already in scope - //~| HELP deprecated + //~| NOTE deprecated self.0 } @@ -39,5 +39,5 @@ fn main() { // just to ensure that this test fails to compile; when shadowed // lifetimes become either an error or a proper lint, this will // not be needed. - let x: isize = 3us; //~ ERROR mismatched types + let x: isize = 3_usize; //~ ERROR mismatched types } diff --git a/src/test/compile-fail/shadowed-type-parameter.rs b/src/test/compile-fail/shadowed-type-parameter.rs index 1a3d782115..1f72db1e89 100644 --- a/src/test/compile-fail/shadowed-type-parameter.rs +++ b/src/test/compile-fail/shadowed-type-parameter.rs @@ -12,19 +12,21 @@ #![feature(box_syntax)] -struct Foo; +struct Foo(T); impl Foo { fn shadow_in_method(&self) {} //~^ ERROR type parameter `T` shadows another type parameter fn not_shadow_in_item(&self) { - struct Bar; // not a shadow, separate item + struct Bar(T,U); // not a shadow, separate item fn foo() {} // same } } trait Bar { + fn dummy(&self) -> T; + fn shadow_in_required(&self); //~^ ERROR type parameter `T` shadows another type parameter diff --git a/src/test/compile-fail/shift-various-bad-types.rs b/src/test/compile-fail/shift-various-bad-types.rs index 4178858404..901ae1d5e2 100644 --- a/src/test/compile-fail/shift-various-bad-types.rs +++ b/src/test/compile-fail/shift-various-bad-types.rs @@ -29,14 +29,18 @@ fn foo(p: &Panolpy) { // known to be an integer, but meh. let x; 22 >> x; - //~^ ERROR right-hand-side of a shift operation must have integral type + //~^ ERROR the type of this value must be known in this context 22 >> 1; // Integer literal types are OK // Type of the result follows the LHS, not the RHS: let _: i32 = 22_i64 >> 1_i32; - //~^ ERROR mismatched types: expected `i32`, found `i64` + //~^ ERROR mismatched types + //~| expected `i32` + //~| found `i64` + //~| expected i32 + //~| found i64) } fn main() { diff --git a/src/test/compile-fail/simd-binop.rs b/src/test/compile-fail/simd-binop.rs index 0c2d8972ce..f028c9af46 100644 --- a/src/test/compile-fail/simd-binop.rs +++ b/src/test/compile-fail/simd-binop.rs @@ -10,7 +10,6 @@ // ignore-tidy-linelength -#![allow(unstable)] use std::simd::f32x4; diff --git a/src/test/compile-fail/slice-1.rs b/src/test/compile-fail/slice-1.rs index 903760caf1..3b992e3bcc 100644 --- a/src/test/compile-fail/slice-1.rs +++ b/src/test/compile-fail/slice-1.rs @@ -8,12 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Test slicing expr[..] is an error and gives a helpful error message. +// Test slicing &expr[] is deprecated and gives a helpful error message. struct Foo; fn main() { let x = Foo; - &x[..]; //~ ERROR incorrect slicing expression: `[..]` - //~^ NOTE use `&expr[]` to construct a slice of the whole of expr + &x[]; + //~^ WARN obsolete syntax + //~| ERROR cannot index } diff --git a/src/test/compile-fail/slice-2.rs b/src/test/compile-fail/slice-2.rs index 0716229356..99dc3e68c8 100644 --- a/src/test/compile-fail/slice-2.rs +++ b/src/test/compile-fail/slice-2.rs @@ -14,7 +14,7 @@ struct Foo; fn main() { let x = Foo; - &x[]; //~ ERROR cannot index a value of type `Foo` + &x[..]; //~ ERROR cannot index a value of type `Foo` &x[Foo..]; //~ ERROR cannot index a value of type `Foo` &x[..Foo]; //~ ERROR cannot index a value of type `Foo` &x[Foo..Foo]; //~ ERROR cannot index a value of type `Foo` diff --git a/src/test/compile-fail/slice-mut.rs b/src/test/compile-fail/slice-mut.rs index 0e1dd0d8f6..e6acc32545 100644 --- a/src/test/compile-fail/slice-mut.rs +++ b/src/test/compile-fail/slice-mut.rs @@ -13,5 +13,10 @@ fn main() { let x: &[isize] = &[1, 2, 3, 4, 5]; // Immutable slices are not mutable. - let y: &mut[_] = &x[2..4]; //~ ERROR cannot borrow immutable borrowed content as mutable + + let y: &mut[_] = &x[2..4]; + //~^ ERROR mismatched types + //~| expected `&mut [_]` + //~| found `&[isize]` + //~| values differ in mutability } diff --git a/src/test/compile-fail/slightly-nice-generic-literal-messages.rs b/src/test/compile-fail/slightly-nice-generic-literal-messages.rs index a655a17c03..3c1c3796a2 100644 --- a/src/test/compile-fail/slightly-nice-generic-literal-messages.rs +++ b/src/test/compile-fail/slightly-nice-generic-literal-messages.rs @@ -8,12 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct Foo(T); +use std::marker; + +struct Foo(T, marker::PhantomData); fn main() { - match Foo(1.1) { + match Foo(1.1, marker::PhantomData) { 1 => {} - //~^ ERROR expected `Foo<_, _>`, found `_` + //~^ ERROR mismatched types + //~| expected `Foo<_, _>` + //~| found `_` + //~| expected struct `Foo` + //~| found integral variable } } diff --git a/src/test/compile-fail/stability-attribute-sanity.rs b/src/test/compile-fail/stability-attribute-sanity.rs new file mode 100644 index 0000000000..dcbb1880b1 --- /dev/null +++ b/src/test/compile-fail/stability-attribute-sanity.rs @@ -0,0 +1,95 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Various checks that stability attributes are used correctly, per RFC 507 + +#![feature(staged_api)] +#![staged_api] + +mod bogus_attribute_types_1 { + #[stable(feature = "a", since = "a", reason)] //~ ERROR incorrect meta item + fn f1() { } + + #[stable(feature = "a", since, reason = "a")] //~ ERROR incorrect meta item + fn f2() { } + + #[stable(feature, since = "a", reason = "a")] //~ ERROR incorrect meta item + fn f3() { } + + #[stable(feature = "a", since = "a", reason(b))] //~ ERROR incorrect meta item + fn f4() { } + + #[stable(feature = "a", since(b), reason = "a")] //~ ERROR incorrect meta item + fn f5() { } + + #[stable(feature(b), since = "a", reason = "a")] //~ ERROR incorrect meta item + fn f6() { } +} + +mod bogus_attribute_types_2 { + #[unstable] //~ ERROR incorrect stability attribute type + fn f1() { } + + #[unstable = "a"] //~ ERROR incorrect stability attribute type + fn f2() { } + + #[stable] //~ ERROR incorrect stability attribute type + fn f3() { } + + #[stable = "a"] //~ ERROR incorrect stability attribute type + fn f4() { } + + #[stable(feature = "a", since = "b")] + #[deprecated] //~ ERROR incorrect stability attribute type + fn f5() { } + + #[stable(feature = "a", since = "b")] + #[deprecated = "a"] //~ ERROR incorrect stability attribute type + fn f6() { } +} + +mod missing_feature_names { + #[unstable(since = "a")] //~ ERROR missing 'feature' + fn f1() { } + + #[stable(since = "a")] //~ ERROR missing 'feature' + fn f2() { } +} + +mod missing_version { + #[stable(feature = "a")] //~ ERROR missing 'since' + fn f1() { } + + #[stable(feature = "a", since = "b")] + #[deprecated(reason = "a")] //~ ERROR missing 'since' + fn f2() { } +} + +#[unstable(feature = "a", since = "b")] +#[stable(feature = "a", since = "b")] +fn multiple1() { } //~ ERROR multiple stability levels + +#[unstable(feature = "a", since = "b")] +#[unstable(feature = "a", since = "b")] +fn multiple2() { } //~ ERROR multiple stability levels + +#[stable(feature = "a", since = "b")] +#[stable(feature = "a", since = "b")] +fn multiple3() { } //~ ERROR multiple stability levels + +#[stable(feature = "a", since = "b")] +#[deprecated(since = "b")] +#[deprecated(since = "b")] +fn multiple4() { } //~ ERROR multiple deprecated attributes + +#[deprecated(since = "a")] +fn deprecated_without_unstable_or_stable() { } //~ ERROR deprecated attribute must be paired + +fn main() { } diff --git a/src/test/compile-fail/stable-features.rs b/src/test/compile-fail/stable-features.rs new file mode 100644 index 0000000000..30eb4112c3 --- /dev/null +++ b/src/test/compile-fail/stable-features.rs @@ -0,0 +1,20 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Testing that the stable_features lint catches use of stable +// language and lib features. + +#![deny(stable_features)] +#![feature(test_accepted_feature)] //~ ERROR this feature is stable +#![feature(rust1)] //~ ERROR this feature is stable + +fn main() { + let _foo: Vec<()> = Vec::new(); +} diff --git a/src/test/compile-fail/staged_api.rs b/src/test/compile-fail/staged_api.rs new file mode 100644 index 0000000000..53d687b5cf --- /dev/null +++ b/src/test/compile-fail/staged_api.rs @@ -0,0 +1,13 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![staged_api] //~ ERROR staged_api is for use by rustc only + +fn main() { } diff --git a/src/test/compile-fail/static-assert2.rs b/src/test/compile-fail/static-assert2.rs index e988cfb909..d5e70205e9 100644 --- a/src/test/compile-fail/static-assert2.rs +++ b/src/test/compile-fail/static-assert2.rs @@ -11,6 +11,6 @@ #![allow(dead_code)] #[static_assert] -static E: bool = 1is == 2; //~ ERROR static assertion failed +static E: bool = 1 == 2; //~ ERROR static assertion failed fn main() {} diff --git a/src/test/compile-fail/static-mut-not-constant.rs b/src/test/compile-fail/static-mut-not-constant.rs index 7c228ce413..08148328ed 100644 --- a/src/test/compile-fail/static-mut-not-constant.rs +++ b/src/test/compile-fail/static-mut-not-constant.rs @@ -11,7 +11,7 @@ #![feature(box_syntax)] static mut a: Box = box 3; -//~^ ERROR statics are not allowed to have custom pointers +//~^ ERROR allocations are not allowed in statics //~^^ ERROR mutable statics are not allowed to have owned pointers fn main() {} diff --git a/src/test/compile-fail/static-mut-not-pat.rs b/src/test/compile-fail/static-mut-not-pat.rs index bfdeff6ed7..76fecea0c3 100644 --- a/src/test/compile-fail/static-mut-not-pat.rs +++ b/src/test/compile-fail/static-mut-not-pat.rs @@ -19,7 +19,7 @@ fn main() { // name as a variable, hence this should be an unreachable pattern situation // instead of spitting out a custom error about some identifier collisions // (we should allow shadowing) - match 4is { + match 4 { a => {} //~ ERROR static variables cannot be referenced in a pattern _ => {} } diff --git a/src/test/compile-fail/static-region-bound.rs b/src/test/compile-fail/static-region-bound.rs index 4c59e7a769..200aa98919 100644 --- a/src/test/compile-fail/static-region-bound.rs +++ b/src/test/compile-fail/static-region-bound.rs @@ -13,8 +13,8 @@ fn f(_: T) {} fn main() { - let x = box 3is; + let x = box 3; f(x); - let x = &3is; //~ ERROR borrowed value does not live long enough + let x = &3; //~ ERROR borrowed value does not live long enough f(x); } diff --git a/src/test/compile-fail/static-vec-repeat-not-constant.rs b/src/test/compile-fail/static-vec-repeat-not-constant.rs index 7cb7615526..7a95756458 100644 --- a/src/test/compile-fail/static-vec-repeat-not-constant.rs +++ b/src/test/compile-fail/static-vec-repeat-not-constant.rs @@ -11,6 +11,6 @@ fn foo() -> isize { 23 } static a: [isize; 2] = [foo(); 2]; -//~^ ERROR: function calls in constants are limited to struct and enum constructors +//~^ ERROR: function calls in statics are limited to struct and enum constructors fn main() {} diff --git a/src/test/compile-fail/staticness-mismatch.rs b/src/test/compile-fail/staticness-mismatch.rs index bf4e46cace..2dfc9b79ee 100644 --- a/src/test/compile-fail/staticness-mismatch.rs +++ b/src/test/compile-fail/staticness-mismatch.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - trait foo { + fn dummy(&self) { } fn bar(); } diff --git a/src/test/compile-fail/std-uncopyable-atomics.rs b/src/test/compile-fail/std-uncopyable-atomics.rs index f27fa6470a..9807fc4314 100644 --- a/src/test/compile-fail/std-uncopyable-atomics.rs +++ b/src/test/compile-fail/std-uncopyable-atomics.rs @@ -17,9 +17,9 @@ use std::ptr; fn main() { let x = ATOMIC_BOOL_INIT; let x = *&x; //~ ERROR: cannot move out of borrowed content - let x = ATOMIC_INT_INIT; + let x = ATOMIC_ISIZE_INIT; let x = *&x; //~ ERROR: cannot move out of borrowed content - let x = ATOMIC_UINT_INIT; + let x = ATOMIC_USIZE_INIT; let x = *&x; //~ ERROR: cannot move out of borrowed content let x: AtomicPtr = AtomicPtr::new(ptr::null_mut()); let x = *&x; //~ ERROR: cannot move out of borrowed content diff --git a/src/test/compile-fail/struct-base-wrong-type.rs b/src/test/compile-fail/struct-base-wrong-type.rs index 2bb8d32a7e..a2ad2336d4 100644 --- a/src/test/compile-fail/struct-base-wrong-type.rs +++ b/src/test/compile-fail/struct-base-wrong-type.rs @@ -12,11 +12,27 @@ struct Foo { a: isize, b: isize } struct Bar { x: isize } static bar: Bar = Bar { x: 5 }; -static foo: Foo = Foo { a: 2, ..bar }; //~ ERROR mismatched types: expected `Foo`, found `Bar` -static foo_i: Foo = Foo { a: 2, ..4 }; //~ ERROR mismatched types: expected `Foo` +static foo: Foo = Foo { a: 2, ..bar }; //~ ERROR mismatched types + //~| expected `Foo` + //~| found `Bar` + //~| expected struct `Foo` + //~| found struct `Bar` +static foo_i: Foo = Foo { a: 2, ..4 }; //~ ERROR mismatched types + //~| expected `Foo` + //~| found `_` + //~| expected struct `Foo` + //~| found integral variable fn main() { let b = Bar { x: 5 }; - let f = Foo { a: 2, ..b }; //~ ERROR mismatched types: expected `Foo`, found `Bar` - let f_i = Foo { a: 2, ..4 }; //~ ERROR mismatched types: expected `Foo` + let f = Foo { a: 2, ..b }; //~ ERROR mismatched types + //~| expected `Foo` + //~| found `Bar` + //~| expected struct `Foo` + //~| found struct `Bar` + let f__isize = Foo { a: 2, ..4 }; //~ ERROR mismatched types + //~| expected `Foo` + //~| found `_` + //~| expected struct `Foo` + //~| found integral variable } diff --git a/src/test/compile-fail/struct-fields-hints-no-dupe.rs b/src/test/compile-fail/struct-fields-hints-no-dupe.rs new file mode 100644 index 0000000000..8df9ffd6cc --- /dev/null +++ b/src/test/compile-fail/struct-fields-hints-no-dupe.rs @@ -0,0 +1,24 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct A { + foo : i32, + car : i32, + barr : i32 +} + +fn main() { + let a = A { + foo : 5, + bar : 42,//~ ERROR structure `A` has no field named `bar` + //~^ HELP did you mean `barr`? + car : 9, + }; +} diff --git a/src/test/compile-fail/struct-fields-hints.rs b/src/test/compile-fail/struct-fields-hints.rs new file mode 100644 index 0000000000..37001f1e60 --- /dev/null +++ b/src/test/compile-fail/struct-fields-hints.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct A { + foo : i32, + car : i32, + barr : i32 +} + +fn main() { + let a = A { + foo : 5, + bar : 42,//~ ERROR structure `A` has no field named `bar` + //~^ HELP did you mean `car`? + }; +} diff --git a/src/test/compile-fail/struct-fields-typo.rs b/src/test/compile-fail/struct-fields-typo.rs new file mode 100644 index 0000000000..c897dc5520 --- /dev/null +++ b/src/test/compile-fail/struct-fields-typo.rs @@ -0,0 +1,24 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct BuildData { + foo: isize, + bar: f32 +} + +fn main() { + let foo = BuildData { + foo: 0, + bar: 0.5, + }; + let x = foo.baa;//~ ERROR attempted access of field `baa` on type `BuildData` + //~^ HELP did you mean `bar`? + println!("{}", x); +} diff --git a/src/test/compile-fail/structure-constructor-type-mismatch.rs b/src/test/compile-fail/structure-constructor-type-mismatch.rs index fb84c1e2eb..c276228b18 100644 --- a/src/test/compile-fail/structure-constructor-type-mismatch.rs +++ b/src/test/compile-fail/structure-constructor-type-mismatch.rs @@ -24,33 +24,42 @@ type PairF = Pair; fn main() { let pt = PointF { - //~^ ERROR expected f32, found isize - x: 1is, - y: 2is, + //~^ ERROR structure constructor specifies a structure of type + //~| expected f32 + //~| found i32 + x: 1i32, + y: 2i32, }; let pt2 = Point:: { - //~^ ERROR expected f32, found isize - x: 3is, - y: 4is, + //~^ ERROR structure constructor specifies a structure of type + //~| expected f32 + //~| found i32 + x: 3i32, + y: 4i32, }; let pair = PairF { - //~^ ERROR expected f32, found isize - x: 5is, - y: 6is, + //~^ ERROR structure constructor specifies a structure of type + //~| expected f32 + //~| found i32 + x: 5i32, + y: 6i32, }; - let pair2 = PairF:: { - //~^ ERROR expected f32, found isize - x: 7is, - y: 8is, + let pair2 = PairF:: { + //~^ ERROR structure constructor specifies a structure of type + //~| expected f32 + //~| found i32 + x: 7i32, + y: 8i32, }; - let pt3 = PointF:: { + let pt3 = PointF:: { //~^ ERROR wrong number of type arguments - x: 9is, - y: 10is, + //~| ERROR structure constructor specifies a structure of type + x: 9i32, + y: 10i32, }; } diff --git a/src/test/compile-fail/suppressed-error.rs b/src/test/compile-fail/suppressed-error.rs index 27f50be528..44de5d8cfe 100644 --- a/src/test/compile-fail/suppressed-error.rs +++ b/src/test/compile-fail/suppressed-error.rs @@ -10,6 +10,10 @@ fn main() { let (x, y) = (); -//~^ ERROR expected `()`, found `(_, _)` (expected (), found tuple) +//~^ ERROR mismatched types +//~| expected `()` +//~| found `(_, _)` +//~| expected () +//~| found tuple return x; } diff --git a/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs b/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs index a9df449032..660c1fa9a8 100644 --- a/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs +++ b/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:mismatched types: expected `char`, found // Issue #876 #![no_implicit_prelude] @@ -21,4 +20,9 @@ fn last(v: Vec<&T> ) -> std::option::Option { fn main() { let y; let x : char = last(y); + //~^ ERROR mismatched types + //~| expected `char` + //~| found `core::option::Option<_>` + //~| expected char + //~| found enum `core::option::Option` } diff --git a/src/test/compile-fail/tail-typeck.rs b/src/test/compile-fail/tail-typeck.rs index a934bbe61c..9c1d318d58 100644 --- a/src/test/compile-fail/tail-typeck.rs +++ b/src/test/compile-fail/tail-typeck.rs @@ -12,6 +12,6 @@ fn f() -> isize { return g(); } -fn g() -> usize { return 0us; } +fn g() -> usize { return 0_usize; } fn main() { let y = f(); } diff --git a/src/test/compile-fail/task-rng-isnt-sendable.rs b/src/test/compile-fail/task-rng-isnt-sendable.rs index fe31d81983..dc3385f4bb 100644 --- a/src/test/compile-fail/task-rng-isnt-sendable.rs +++ b/src/test/compile-fail/task-rng-isnt-sendable.rs @@ -17,5 +17,4 @@ fn test_send() {} pub fn main() { test_send::(); //~^ ERROR `core::marker::Send` is not implemented - //~^^ ERROR `core::marker::Send` is not implemented } diff --git a/src/test/compile-fail/terr-in-field.rs b/src/test/compile-fail/terr-in-field.rs index 1e5422a798..60db35b879 100644 --- a/src/test/compile-fail/terr-in-field.rs +++ b/src/test/compile-fail/terr-in-field.rs @@ -20,7 +20,11 @@ struct bar { fn want_foo(f: foo) {} fn have_bar(b: bar) { - want_foo(b); //~ ERROR (expected struct foo, found struct bar) + want_foo(b); //~ ERROR mismatched types + //~| expected `foo` + //~| found `bar` + //~| expected struct `foo` + //~| found struct `bar` } fn main() {} diff --git a/src/test/compile-fail/terr-sorts.rs b/src/test/compile-fail/terr-sorts.rs index d1a37c99c4..231d2366b4 100644 --- a/src/test/compile-fail/terr-sorts.rs +++ b/src/test/compile-fail/terr-sorts.rs @@ -18,7 +18,11 @@ type bar = Box; fn want_foo(f: foo) {} fn have_bar(b: bar) { - want_foo(b); //~ ERROR (expected struct foo, found box) + want_foo(b); //~ ERROR mismatched types + //~| expected `foo` + //~| found `Box` + //~| expected struct `foo` + //~| found box } fn main() {} diff --git a/src/test/compile-fail/trace_macros-gate.rs b/src/test/compile-fail/trace_macros-gate.rs new file mode 100644 index 0000000000..6473bcece9 --- /dev/null +++ b/src/test/compile-fail/trace_macros-gate.rs @@ -0,0 +1,30 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that the trace_macros feature gate is on. + +fn main() { + trace_macros!(); //~ ERROR `trace_macros` is not stable + trace_macros!(1); //~ ERROR `trace_macros` is not stable + trace_macros!(ident); //~ ERROR `trace_macros` is not stable + trace_macros!(for); //~ ERROR `trace_macros` is not stable + trace_macros!(true,); //~ ERROR `trace_macros` is not stable + trace_macros!(false 1); //~ ERROR `trace_macros` is not stable + + // Errors are signalled early for the above, before expansion. + // See trace_macros-gate2 and trace_macros-gate3. for examples + // of the below being caught. + + macro_rules! expando { + ($x: ident) => { trace_macros!($x) } + } + + expando!(true); +} diff --git a/src/test/compile-fail/trace_macros-gate2.rs b/src/test/compile-fail/trace_macros-gate2.rs new file mode 100644 index 0000000000..71cc45e132 --- /dev/null +++ b/src/test/compile-fail/trace_macros-gate2.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that the trace_macros feature gate is on. + +fn main() { + // (Infrastructure does not attempt to detect uses in macro definitions.) + macro_rules! expando { + ($x: ident) => { trace_macros!($x) } + } + + expando!(true); //~ ERROR `trace_macros` is not stable +} diff --git a/src/test/compile-fail/trace_macros-gate3.rs b/src/test/compile-fail/trace_macros-gate3.rs new file mode 100644 index 0000000000..66d03cf9d8 --- /dev/null +++ b/src/test/compile-fail/trace_macros-gate3.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that the trace_macros feature gate is on. + +pub fn main() { + println!("arg: {}", trace_macros!()); //~ ERROR `trace_macros` is not stable + println!("arg: {}", trace_macros!(1)); //~ ERROR `trace_macros` is not stable + println!("arg: {}", trace_macros!(ident)); //~ ERROR `trace_macros` is not stable + println!("arg: {}", trace_macros!(for)); //~ ERROR `trace_macros` is not stable + println!("arg: {}", trace_macros!(true,)); //~ ERROR `trace_macros` is not stable + println!("arg: {}", trace_macros!(false 1)); //~ ERROR `trace_macros` is not stable +} diff --git a/src/test/compile-fail/trait-as-struct-constructor.rs b/src/test/compile-fail/trait-as-struct-constructor.rs index a1fcab002e..fff1441409 100644 --- a/src/test/compile-fail/trait-as-struct-constructor.rs +++ b/src/test/compile-fail/trait-as-struct-constructor.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait TraitNotAStruct { } +trait TraitNotAStruct : ::std::marker::MarkerTrait { } fn main() { TraitNotAStruct{ value: 0 }; diff --git a/src/test/compile-fail/trait-bounds-cant-coerce.rs b/src/test/compile-fail/trait-bounds-cant-coerce.rs index 4f405e2558..3129dceffb 100644 --- a/src/test/compile-fail/trait-bounds-cant-coerce.rs +++ b/src/test/compile-fail/trait-bounds-cant-coerce.rs @@ -10,6 +10,7 @@ trait Foo { + fn dummy(&self) { } } fn a(_x: Box) { @@ -20,7 +21,11 @@ fn c(x: Box) { } fn d(x: Box) { - a(x); //~ ERROR found no bounds + a(x); //~ ERROR mismatched types + //~| expected `Box` + //~| found `Box` + //~| expected bounds `Send` + //~| found no bounds } fn main() { } diff --git a/src/test/compile-fail/trait-bounds-impl-comparison-1.rs b/src/test/compile-fail/trait-bounds-impl-comparison-1.rs index 5fc80d5660..34e06cc936 100644 --- a/src/test/compile-fail/trait-bounds-impl-comparison-1.rs +++ b/src/test/compile-fail/trait-bounds-impl-comparison-1.rs @@ -11,7 +11,10 @@ // Make sure rustc checks the type parameter bounds in implementations of traits, // see #2687 -trait A {} +use std::marker; + +trait A : marker::PhantomFn { +} trait B: A {} @@ -32,15 +35,15 @@ trait Foo { impl Foo for isize { // invalid bound for T, was defined as Eq in trait fn test_error1_fn(&self) {} - //~^ ERROR in method `test_error1_fn`, type parameter 0 requires bound `core::cmp::Ord` + //~^ ERROR the requirement `T : core::cmp::Ord` appears on the impl // invalid bound for T, was defined as Eq + Ord in trait fn test_error2_fn(&self) {} - //~^ ERROR in method `test_error2_fn`, type parameter 0 requires bound `B` + //~^ ERROR the requirement `T : B` appears on the impl // invalid bound for T, was defined as Eq + Ord in trait fn test_error3_fn(&self) {} - //~^ ERROR in method `test_error3_fn`, type parameter 0 requires bound `B` + //~^ ERROR the requirement `T : B` appears on the impl // multiple bounds, same order as in trait fn test3_fn(&self) {} @@ -50,29 +53,29 @@ impl Foo for isize { // parameters in impls must be equal or more general than in the defining trait fn test_error5_fn(&self) {} - //~^ ERROR in method `test_error5_fn`, type parameter 0 requires bound `B` + //~^ ERROR the requirement `T : B` appears on the impl // bound `std::cmp::Eq` not enforced by this implementation, but this is OK fn test6_fn(&self) {} fn test_error7_fn(&self) {} - //~^ ERROR in method `test_error7_fn`, type parameter 0 requires bound `core::cmp::Eq` + //~^ ERROR the requirement `T : core::cmp::Eq` appears on the impl fn test_error8_fn(&self) {} - //~^ ERROR in method `test_error8_fn`, type parameter 0 requires bound `C` + //~^ ERROR the requirement `T : C` appears on the impl } - -trait Getter { } +trait Getter { + fn get(&self) -> T { loop { } } +} trait Trait { - fn method>(); + fn method>(&self); } impl Trait for usize { - fn method>() {} - //~^ ERROR in method `method`, type parameter 0 requires bound `Getter` + fn method>(&self) {} + //~^ G : Getter` appears on the impl method but not on the corresponding trait method } fn main() {} - diff --git a/src/test/compile-fail/trait-bounds-impl-comparison-2.rs b/src/test/compile-fail/trait-bounds-impl-comparison-2.rs index a970a86408..284c4fac95 100644 --- a/src/test/compile-fail/trait-bounds-impl-comparison-2.rs +++ b/src/test/compile-fail/trait-bounds-impl-comparison-2.rs @@ -14,13 +14,15 @@ trait Iterator { fn next(&mut self) -> Option; } -trait IteratorUtil { +trait IteratorUtil + : ::std::marker::PhantomFn<(),A> +{ fn zip>(self, other: U) -> ZipIterator; } impl> IteratorUtil for T { fn zip>(self, other: U) -> ZipIterator { - //~^ ERROR in method `zip`, type parameter 1 requires bound `Iterator` + //~^ ERROR the requirement `U : Iterator` appears on the impl method ZipIterator{a: self, b: other} } } diff --git a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs index 434d803d71..448b186f6a 100644 --- a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs +++ b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs @@ -9,6 +9,7 @@ // except according to those terms. trait Foo { + fn dummy(&self) { } } // This should emit the less confusing error, not the more confusing one. diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs index 45a74a235e..df44e847c5 100644 --- a/src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs +++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Trait {} +trait Trait { + fn dummy(&self) { } +} struct Foo { x: T, @@ -17,7 +19,7 @@ struct Foo { fn main() { let foo = Foo { //~^ ERROR not implemented - x: 3is + x: 3 }; let baz: Foo = panic!(); diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs index d5369817e9..18871d0d38 100644 --- a/src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs +++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Trait {} +trait Trait { + fn dummy(&self) { } +} struct Foo { x: T, diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs index 6179301c11..8a9732de7f 100644 --- a/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs +++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs @@ -17,7 +17,7 @@ use trait_bounds_on_structs_and_enums_xc::{Bar, Foo, Trait}; fn main() { let foo = Foo { //~^ ERROR not implemented - x: 3is + x: 3 }; let bar: Bar = return; //~^ ERROR not implemented diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs index 490ee0e8ad..8dfdb2f205 100644 --- a/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs +++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Trait {} +use std::marker::MarkerTrait; + +trait Trait : MarkerTrait {} struct Foo { x: T, @@ -51,15 +53,15 @@ enum MoreBadness { EvenMoreBadness(Bar), } -trait PolyTrait { - fn whatever() {} +trait PolyTrait +{ + fn whatever(&self, t: T) {} } struct Struct; impl PolyTrait> for Struct { //~^ ERROR not implemented - fn whatever() {} } fn main() { diff --git a/src/test/compile-fail/trait-bounds-sugar.rs b/src/test/compile-fail/trait-bounds-sugar.rs index 4da496621d..e4058a0943 100644 --- a/src/test/compile-fail/trait-bounds-sugar.rs +++ b/src/test/compile-fail/trait-bounds-sugar.rs @@ -10,8 +10,9 @@ // Tests for "default" bounds inferred for traits with no bounds list. +use std::marker::MarkerTrait; -trait Foo {} +trait Foo : MarkerTrait {} fn a(_x: Box) { } @@ -24,8 +25,7 @@ fn c(x: Box) { } fn d(x: &'static (Foo+Sync)) { - b(x); //~ ERROR cannot infer - //~^ ERROR mismatched types + b(x); } fn main() {} diff --git a/src/test/compile-fail/trait-coercion-generic-regions.rs b/src/test/compile-fail/trait-coercion-generic-regions.rs index 9c78d7ea24..7b426a4c03 100644 --- a/src/test/compile-fail/trait-coercion-generic-regions.rs +++ b/src/test/compile-fail/trait-coercion-generic-regions.rs @@ -26,7 +26,7 @@ impl Trait<&'static str> for Struct { fn main() { let person = "Fred".to_string(); - let person: &str = person.as_slice(); //~ ERROR `person` does not live long enough + let person: &str = &person; //~ ERROR `person` does not live long enough let s: Box> = box Struct { person: person }; } diff --git a/src/test/compile-fail/trait-impl-1.rs b/src/test/compile-fail/trait-impl-1.rs index 1c7fa1e426..2f4793b4d8 100644 --- a/src/test/compile-fail/trait-impl-1.rs +++ b/src/test/compile-fail/trait-impl-1.rs @@ -12,15 +12,17 @@ // trait impl is only applied to a trait object, not concrete types which implement // the trait. -trait T {} +use std::marker::MarkerTrait; + +trait T : MarkerTrait {} impl<'a> T+'a { fn foo(&self) {} } -impl T for isize {} +impl T for i32 {} fn main() { - let x = &42is; - x.foo(); //~ERROR: type `&isize` does not implement any method in scope named `foo` + let x = &42i32; + x.foo(); //~ERROR: type `&i32` does not implement any method in scope named `foo` } diff --git a/src/test/compile-fail/trait-object-safety.rs b/src/test/compile-fail/trait-object-safety.rs index 761bcd4968..d45d13556e 100644 --- a/src/test/compile-fail/trait-object-safety.rs +++ b/src/test/compile-fail/trait-object-safety.rs @@ -12,6 +12,7 @@ trait Tr { fn foo(); + fn bar(&self) { } } struct St; diff --git a/src/test/compile-fail/trait-static-method-generic-inference.rs b/src/test/compile-fail/trait-static-method-generic-inference.rs index 651f663fc9..0e357d9d4d 100644 --- a/src/test/compile-fail/trait-static-method-generic-inference.rs +++ b/src/test/compile-fail/trait-static-method-generic-inference.rs @@ -16,6 +16,7 @@ mod base { pub trait HasNew { fn new() -> T; + fn dummy(&self) { } } pub struct Foo { diff --git a/src/test/compile-fail/trait-test-2.rs b/src/test/compile-fail/trait-test-2.rs index bdfc6dcda8..d8b3176787 100644 --- a/src/test/compile-fail/trait-test-2.rs +++ b/src/test/compile-fail/trait-test-2.rs @@ -11,11 +11,11 @@ #![feature(box_syntax)] trait bar { fn dup(&self) -> Self; fn blah(&self); } -impl bar for isize { fn dup(&self) -> isize { *self } fn blah(&self) {} } -impl bar for usize { fn dup(&self) -> usize { *self } fn blah(&self) {} } +impl bar for i32 { fn dup(&self) -> i32 { *self } fn blah(&self) {} } +impl bar for u32 { fn dup(&self) -> u32 { *self } fn blah(&self) {} } fn main() { - 10is.dup::(); //~ ERROR does not take type parameters - 10is.blah::(); //~ ERROR incorrect number of type parameters - (box 10is as Box).dup(); //~ ERROR cannot convert to a trait object + 10.dup::(); //~ ERROR does not take type parameters + 10.blah::(); //~ ERROR incorrect number of type parameters + (box 10 as Box).dup(); //~ ERROR cannot convert to a trait object } diff --git a/src/test/compile-fail/traits-multidispatch-bad.rs b/src/test/compile-fail/traits-multidispatch-bad.rs index e9a4005b4b..392eccf0f3 100644 --- a/src/test/compile-fail/traits-multidispatch-bad.rs +++ b/src/test/compile-fail/traits-multidispatch-bad.rs @@ -14,9 +14,9 @@ trait Convert { fn convert(&self) -> Target; } -impl Convert for isize { - fn convert(&self) -> usize { - *self as usize +impl Convert for i32 { + fn convert(&self) -> u32 { + *self as u32 } } @@ -26,7 +26,7 @@ where T : Convert } fn a() { - test(22is, 44is); //~ ERROR not implemented + test(22i32, 44i32); //~ ERROR mismatched types } fn main() {} diff --git a/src/test/compile-fail/traits-negative-impls.rs b/src/test/compile-fail/traits-negative-impls.rs new file mode 100644 index 0000000000..3ef760053c --- /dev/null +++ b/src/test/compile-fail/traits-negative-impls.rs @@ -0,0 +1,58 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// The dummy functions are used to avoid adding new cfail files. +// What happens is that the compiler attempts to squash duplicates and some +// errors are not reported. This way, we make sure that, for each function, different +// typeck phases are involved and all errors are reported. + +#![feature(optin_builtin_traits)] + +use std::marker::Send; + +struct Outer(T); + +struct TestType; +impl !Send for TestType {} + +struct Outer2(T); + +unsafe impl Sync for Outer2 {} + +fn is_send(_: T) {} +fn is_sync(_: T) {} + +fn dummy() { + Outer(TestType); + //~^ ERROR the trait `core::marker::Send` is not implemented for the type `TestType` + + is_send(TestType); + //~^ ERROR the trait `core::marker::Send` is not implemented for the type `TestType` + + is_send((8, TestType)); + //~^ ERROR the trait `core::marker::Send` is not implemented for the type `TestType` +} + +fn dummy2() { + is_send(Box::new(TestType)); + //~^ ERROR the trait `core::marker::Send` is not implemented for the type `TestType` +} + +fn dummy3() { + is_send(Box::new(Outer2(TestType))); + //~^ ERROR the trait `core::marker::Send` is not implemented for the type `TestType` +} + +fn main() { + // This will complain about a missing Send impl because `Sync` is implement *just* + // for T that are `Send`. Look at #20366 and #19950 + is_sync(Outer2(TestType)); + //~^ ERROR the trait `core::marker::Send` is not implemented for the type `TestType` +} diff --git a/src/test/compile-fail/tuple-arity-mismatch.rs b/src/test/compile-fail/tuple-arity-mismatch.rs index 7f073a7bfd..8ad9ca50e3 100644 --- a/src/test/compile-fail/tuple-arity-mismatch.rs +++ b/src/test/compile-fail/tuple-arity-mismatch.rs @@ -14,8 +14,16 @@ fn first((value, _): (isize, f64)) -> isize { value } fn main() { let y = first ((1,2.0,3)); - //~^ ERROR expected a tuple with 2 elements, found one with 3 elements + //~^ ERROR mismatched types + //~| expected `(isize, f64)` + //~| found `(isize, f64, _)` + //~| expected a tuple with 2 elements + //~| found one with 3 elements let y = first ((1,)); - //~^ ERROR expected `(isize, f64)`, found `(isize,)` + //~^ ERROR mismatched types + //~| expected `(isize, f64)` + //~| found `(isize,)` + //~| expected a tuple with 2 elements + //~| found one with 1 elements } diff --git a/src/test/compile-fail/tuple-index-out-of-bounds.rs b/src/test/compile-fail/tuple-index-out-of-bounds.rs index 20dd71e3bd..54b8d551f2 100644 --- a/src/test/compile-fail/tuple-index-out-of-bounds.rs +++ b/src/test/compile-fail/tuple-index-out-of-bounds.rs @@ -8,17 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct Point(isize, isize); +struct Point(i32, i32); fn main() { - let origin = Point(0, 0); + let origin = Point(0i32, 0i32); origin.0; origin.1; origin.2; //~^ ERROR attempted out-of-bounds tuple index `2` on type `Point` - let tuple = (0is, 0is); + let tuple = (0i32, 0i32); tuple.0; tuple.1; tuple.2; - //~^ ERROR attempted out-of-bounds tuple index `2` on type `(isize, isize)` + //~^ ERROR attempted out-of-bounds tuple index `2` on type `(i32, i32)` } diff --git a/src/test/compile-fail/tutorial-suffix-inference-test.rs b/src/test/compile-fail/tutorial-suffix-inference-test.rs index 1b44c7e812..bb1e199920 100644 --- a/src/test/compile-fail/tutorial-suffix-inference-test.rs +++ b/src/test/compile-fail/tutorial-suffix-inference-test.rs @@ -17,16 +17,28 @@ fn main() { identity_u8(x); // after this, `x` is assumed to have type `u8` identity_u16(x); - //~^ ERROR mismatched types: expected `u16`, found `u8` + //~^ ERROR mismatched types + //~| expected `u16` + //~| found `u8` + //~| expected u16 + //~| found u8 identity_u16(y); - //~^ ERROR mismatched types: expected `u16`, found `i32` + //~^ ERROR mismatched types + //~| expected `u16` + //~| found `i32` + //~| expected u16 + //~| found i32 - let a = 3is; + let a = 3; fn identity_i(n: isize) -> isize { n } identity_i(a); // ok identity_u16(a); - //~^ ERROR mismatched types: expected `u16`, found `isize` + //~^ ERROR mismatched types + //~| expected `u16` + //~| found `isize` + //~| expected u16 + //~| found isize } diff --git a/src/test/compile-fail/type-mismatch-multiple.rs b/src/test/compile-fail/type-mismatch-multiple.rs index 8b0897565f..3bf0896d99 100644 --- a/src/test/compile-fail/type-mismatch-multiple.rs +++ b/src/test/compile-fail/type-mismatch-multiple.rs @@ -9,7 +9,15 @@ // except according to those terms. // Checking that the compiler reports multiple type errors at once -// error-pattern:mismatched types: expected `bool` -// error-pattern:mismatched types: expected `isize` -fn main() { let a: bool = 1is; let b: isize = true; } +fn main() { let a: bool = 1i32; let b: i32 = true; } +//~^ ERROR mismatched types +//~| expected `bool` +//~| found `i32` +//~| expected bool +//~| found i32 +//~| ERROR mismatched types +//~| expected `i32` +//~| found `bool` +//~| expected i32 +//~| found bool diff --git a/src/test/compile-fail/type-parameter-defaults-referencing-Self-ppaux.rs b/src/test/compile-fail/type-parameter-defaults-referencing-Self-ppaux.rs new file mode 100644 index 0000000000..8ff514e04e --- /dev/null +++ b/src/test/compile-fail/type-parameter-defaults-referencing-Self-ppaux.rs @@ -0,0 +1,26 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test a default that references `Self` which is then used in an +// object type. Issue #18956. In this case, the value is supplied by +// the user, but pretty-printing the type during the error message +// caused an ICE. + +trait MyAdd { fn add(&self, other: &Rhs) -> Self; } + +impl MyAdd for i32 { + fn add(&self, other: &i32) -> i32 { *self + *other } +} + +fn main() { + let x = 5; + let y = x as MyAdd; + //~^ ERROR as `MyAdd` +} diff --git a/src/test/compile-fail/type-parameter-defaults-referencing-Self.rs b/src/test/compile-fail/type-parameter-defaults-referencing-Self.rs new file mode 100644 index 0000000000..9982d48502 --- /dev/null +++ b/src/test/compile-fail/type-parameter-defaults-referencing-Self.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test a default that references `Self` which is then used in an object type. +// Issue #18956. + +#![feature(default_type_params)] + +trait Foo { + fn method(&self); +} + +fn foo(x: &Foo) { } +//~^ ERROR the type parameter `T` must be explicitly specified + +fn main() { } diff --git a/src/test/compile-fail/type-parameter-names.rs b/src/test/compile-fail/type-parameter-names.rs index 42691fa522..408bf72e97 100644 --- a/src/test/compile-fail/type-parameter-names.rs +++ b/src/test/compile-fail/type-parameter-names.rs @@ -13,7 +13,11 @@ fn foo(x: Foo) -> Bar { x -//~^ ERROR expected `Bar`, found `Foo` (expected type parameter, found a different type parameter) +//~^ ERROR mismatched types +//~| expected `Bar` +//~| found `Foo` +//~| expected type parameter +//~| found a different type parameter } fn main() {} diff --git a/src/test/compile-fail/type-params-in-different-spaces-1.rs b/src/test/compile-fail/type-params-in-different-spaces-1.rs index 66479202e1..de9623de7c 100644 --- a/src/test/compile-fail/type-params-in-different-spaces-1.rs +++ b/src/test/compile-fail/type-params-in-different-spaces-1.rs @@ -12,7 +12,11 @@ use std::num::Int; trait BrokenAdd: Int { fn broken_add(&self, rhs: T) -> Self { - *self + rhs //~ ERROR expected `Self`, found `T` + *self + rhs //~ ERROR mismatched types + //~| expected `Self` + //~| found `T` + //~| expected Self + //~| found type parameter } } diff --git a/src/test/compile-fail/typeck-cast-pointer-to-float.rs b/src/test/compile-fail/typeck-cast-pointer-to-float.rs index 22a0978ef7..285a5dbee0 100644 --- a/src/test/compile-fail/typeck-cast-pointer-to-float.rs +++ b/src/test/compile-fail/typeck-cast-pointer-to-float.rs @@ -11,5 +11,5 @@ fn main() { let x : i16 = 22; ((&x) as *const i16) as f32; - //~^ ERROR: cannot cast from pointer to float directly: `*const i16` as `f32` + //~^ ERROR illegal cast; cast through an integer first: `*const i16` as `f32` } diff --git a/src/test/compile-fail/deriving-span-Rand-struct.rs b/src/test/compile-fail/typeck-negative-impls-builtin.rs similarity index 70% rename from src/test/compile-fail/deriving-span-Rand-struct.rs rename to src/test/compile-fail/typeck-negative-impls-builtin.rs index 73d89693b2..557fb2f4f8 100644 --- a/src/test/compile-fail/deriving-span-Rand-struct.rs +++ b/src/test/compile-fail/typeck-negative-impls-builtin.rs @@ -8,16 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' +#![feature(optin_builtin_traits)] -extern crate rand; +struct TestType; - -struct Error; - -#[derive(Rand)] -struct Struct { - x: Error //~ ERROR +trait TestTrait { + fn dummy(&self) { } } +impl !TestTrait for TestType {} +//~^ ERROR negative impls are currently allowed just for `Send` and `Sync` + fn main() {} diff --git a/src/test/compile-fail/typeck-unsafe-always-share.rs b/src/test/compile-fail/typeck-unsafe-always-share.rs index a9113c6e99..1cb6bd048c 100644 --- a/src/test/compile-fail/typeck-unsafe-always-share.rs +++ b/src/test/compile-fail/typeck-unsafe-always-share.rs @@ -10,29 +10,26 @@ // Verify that UnsafeCell is *always* sync regardless if `T` is sync. -// ignore-tidy-linelength +#![feature(optin_builtin_traits)] use std::cell::UnsafeCell; -use std::marker; +use std::marker::Sync; struct MySync { u: UnsafeCell } -struct NoSync { - m: marker::NoSync -} - -fn test(s: T){ +struct NoSync; +impl !Sync for NoSync {} -} +fn test(s: T) {} fn main() { - let us = UnsafeCell::new(MySync{u: UnsafeCell::new(0is)}); + let us = UnsafeCell::new(MySync{u: UnsafeCell::new(0)}); test(us); //~^ ERROR `core::marker::Sync` is not implemented - let uns = UnsafeCell::new(NoSync{m: marker::NoSync}); + let uns = UnsafeCell::new(NoSync); test(uns); //~^ ERROR `core::marker::Sync` is not implemented @@ -40,7 +37,6 @@ fn main() { test(ms); //~^ ERROR `core::marker::Sync` is not implemented - let ns = NoSync{m: marker::NoSync}; - test(ns); + test(NoSync); //~^ ERROR `core::marker::Sync` is not implemented } diff --git a/src/test/compile-fail/typeck_type_placeholder_item.rs b/src/test/compile-fail/typeck_type_placeholder_item.rs index d69c0dc5d1..5bfad94867 100644 --- a/src/test/compile-fail/typeck_type_placeholder_item.rs +++ b/src/test/compile-fail/typeck_type_placeholder_item.rs @@ -14,7 +14,7 @@ fn test() -> _ { 5 } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures -fn test2() -> (_, _) { (5us, 5us) } +fn test2() -> (_, _) { (5, 5) } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures @@ -67,7 +67,7 @@ pub fn main() { fn fn_test() -> _ { 5 } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - fn fn_test2() -> (_, _) { (5us, 5us) } + fn fn_test2() -> (_, _) { (5, 5) } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures diff --git a/src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs b/src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs index e1d17e4fef..2cb46cc352 100644 --- a/src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs +++ b/src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs @@ -16,6 +16,6 @@ struct Foo<'a, T:'a> { } pub fn main() { - let c: Foo<_, _> = Foo { r: &5us }; + let c: Foo<_, _> = Foo { r: &5 }; //~^ ERROR wrong number of type arguments: expected 1, found 2 } diff --git a/src/test/compile-fail/typeck_type_placeholder_mismatch.rs b/src/test/compile-fail/typeck_type_placeholder_mismatch.rs index 92740cf508..1daea8f915 100644 --- a/src/test/compile-fail/typeck_type_placeholder_mismatch.rs +++ b/src/test/compile-fail/typeck_type_placeholder_mismatch.rs @@ -11,19 +11,29 @@ // This test checks that genuine type errors with partial // type hints are understandable. -struct Foo; -struct Bar; +use std::marker::PhantomData; + +struct Foo(PhantomData); +struct Bar(PhantomData); pub fn main() { } fn test1() { - let x: Foo<_> = Bar::; - //~^ ERROR mismatched types: expected `Foo<_>`, found `Bar` + let x: Foo<_> = Bar::(PhantomData); + //~^ ERROR mismatched types + //~| expected `Foo<_>` + //~| found `Bar` + //~| expected struct `Foo` + //~| found struct `Bar` let y: Foo = x; } fn test2() { - let x: Foo<_> = Bar::; - //~^ ERROR mismatched types: expected `Foo<_>`, found `Bar` + let x: Foo<_> = Bar::(PhantomData); + //~^ ERROR mismatched types + //~| expected `Foo<_>` + //~| found `Bar` + //~| expected struct `Foo` + //~| found struct `Bar` } diff --git a/src/test/compile-fail/ufcs-explicit-self-bad.rs b/src/test/compile-fail/ufcs-explicit-self-bad.rs index 6c323e8c1a..cbcf31b5b7 100644 --- a/src/test/compile-fail/ufcs-explicit-self-bad.rs +++ b/src/test/compile-fail/ufcs-explicit-self-bad.rs @@ -42,8 +42,15 @@ trait SomeTrait { impl<'a, T> SomeTrait for &'a Bar { fn dummy1(self: &&'a Bar) { } fn dummy2(self: &Bar) {} //~ ERROR mismatched self type - fn dummy3(self: &&Bar) {} //~ ERROR lifetime mismatch - //~^ ERROR lifetime mismatch + fn dummy3(self: &&Bar) {} + //~^ ERROR mismatched types + //~| expected `&'a Bar` + //~| found `&Bar` + //~| lifetime mismatch + //~| ERROR mismatched types + //~| expected `&'a Bar` + //~| found `&Bar` + //~| lifetime mismatch } fn main() { diff --git a/src/test/compile-fail/issue-9957.rs b/src/test/compile-fail/ufcs-qpath-missing-params.rs similarity index 76% rename from src/test/compile-fail/issue-9957.rs rename to src/test/compile-fail/ufcs-qpath-missing-params.rs index b1204e8289..f4e18265fd 100644 --- a/src/test/compile-fail/issue-9957.rs +++ b/src/test/compile-fail/ufcs-qpath-missing-params.rs @@ -8,8 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub extern crate core; //~ ERROR: `pub` visibility is not allowed +use std::borrow::IntoCow; fn main() { - pub use std::usize; //~ ERROR: imports in functions are never reachable + ::into_cow("foo".to_string()); + //~^ ERROR wrong number of type arguments: expected 1, found 0 } diff --git a/src/test/compile-fail/ufcs-qpath-self-mismatch.rs b/src/test/compile-fail/ufcs-qpath-self-mismatch.rs new file mode 100644 index 0000000000..868c1eae4a --- /dev/null +++ b/src/test/compile-fail/ufcs-qpath-self-mismatch.rs @@ -0,0 +1,21 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::ops::Add; + +fn main() { + >::add(1, 2); + //~^ ERROR the trait `core::ops::Add` is not implemented for the type `i32` + >::add(1u32, 2); + //~^ ERROR mismatched types + >::add(1, 2u32); + //~^ ERROR mismatched types +} + diff --git a/src/test/compile-fail/unboxed-closer-non-implicit-copyable.rs b/src/test/compile-fail/unboxed-closer-non-implicit-copyable.rs index 182c632d06..2d55979491 100644 --- a/src/test/compile-fail/unboxed-closer-non-implicit-copyable.rs +++ b/src/test/compile-fail/unboxed-closer-non-implicit-copyable.rs @@ -10,8 +10,10 @@ #![feature(unboxed_closures)] +fn to_fn_once>(f: F) -> F { f } + fn main() { - let f = move|:| (); + let f = to_fn_once(move|| ()); f(); f(); //~ ERROR use of moved value } diff --git a/src/test/compile-fail/unboxed-closure-feature-gate.rs b/src/test/compile-fail/unboxed-closure-feature-gate.rs index 5eb67a9bb7..74a6f869f6 100644 --- a/src/test/compile-fail/unboxed-closure-feature-gate.rs +++ b/src/test/compile-fail/unboxed-closure-feature-gate.rs @@ -11,7 +11,12 @@ // Check that parenthetical notation is feature-gated except with the // `Fn` traits. -trait Foo { +use std::marker; + +trait Foo { + type Output; + + fn dummy(&self, a: A) { } } fn main() { diff --git a/src/test/compile-fail/unboxed-closure-illegal-move.rs b/src/test/compile-fail/unboxed-closure-illegal-move.rs index d489c3a64f..800126450c 100644 --- a/src/test/compile-fail/unboxed-closure-illegal-move.rs +++ b/src/test/compile-fail/unboxed-closure-illegal-move.rs @@ -15,31 +15,35 @@ // if the upvar is captured by ref or the closure takes self by // reference. +fn to_fn>(f: F) -> F { f } +fn to_fn_mut>(f: F) -> F { f } +fn to_fn_once>(f: F) -> F { f } + fn main() { // By-ref cases { - let x = box 0us; - let f = |&:| drop(x); //~ cannot move + let x = box 0_usize; + let f = to_fn(|| drop(x)); //~ ERROR cannot move } { - let x = box 0us; - let f = |&mut:| drop(x); //~ cannot move + let x = box 0_usize; + let f = to_fn_mut(|| drop(x)); //~ ERROR cannot move } { - let x = box 0us; - let f = |:| drop(x); //~ cannot move + let x = box 0_usize; + let f = to_fn_once(|| drop(x)); // OK -- FnOnce } // By-value cases { - let x = box 0us; - let f = move |&:| drop(x); //~ cannot move + let x = box 0_usize; + let f = to_fn(move || drop(x)); //~ ERROR cannot move } { - let x = box 0us; - let f = move |&mut:| drop(x); //~ cannot move + let x = box 0_usize; + let f = to_fn_mut(move || drop(x)); //~ ERROR cannot move } { - let x = box 0us; - let f = move |:| drop(x); // this one is ok + let x = box 0_usize; + let f = to_fn_once(move || drop(x)); // this one is ok } } diff --git a/src/test/compile-fail/unboxed-closure-immutable-capture.rs b/src/test/compile-fail/unboxed-closure-immutable-capture.rs index ebdd3c3107..b40a91181a 100644 --- a/src/test/compile-fail/unboxed-closure-immutable-capture.rs +++ b/src/test/compile-fail/unboxed-closure-immutable-capture.rs @@ -17,15 +17,15 @@ fn set(x: &mut usize) { *x = 0; } fn main() { - let x = 0us; - move |&mut:| x = 1; //~ ERROR cannot assign - move |&mut:| set(&mut x); //~ ERROR cannot borrow - move |:| x = 1; //~ ERROR cannot assign - move |:| set(&mut x); //~ ERROR cannot borrow - |&mut:| x = 1; //~ ERROR cannot assign + let x = 0_usize; + move || x = 1; //~ ERROR cannot assign + move || set(&mut x); //~ ERROR cannot borrow + move || x = 1; //~ ERROR cannot assign + move || set(&mut x); //~ ERROR cannot borrow + || x = 1; //~ ERROR cannot assign // FIXME: this should be `cannot borrow` (issue #18330) - |&mut:| set(&mut x); //~ ERROR cannot assign - |:| x = 1; //~ ERROR cannot assign + || set(&mut x); //~ ERROR cannot assign + || x = 1; //~ ERROR cannot assign // FIXME: this should be `cannot borrow` (issue #18330) - |:| set(&mut x); //~ ERROR cannot assign + || set(&mut x); //~ ERROR cannot assign } diff --git a/src/test/compile-fail/unboxed-closure-region.rs b/src/test/compile-fail/unboxed-closure-region.rs index 9d96679869..59c8495371 100644 --- a/src/test/compile-fail/unboxed-closure-region.rs +++ b/src/test/compile-fail/unboxed-closure-region.rs @@ -14,7 +14,7 @@ // reference cannot escape the region of that variable. fn main() { let _f = { - let x = 0us; - |:| x //~ ERROR cannot infer an appropriate lifetime due to conflicting requirements + let x = 0_usize; + || x //~ ERROR cannot infer an appropriate lifetime due to conflicting requirements }; } diff --git a/src/test/compile-fail/unboxed-closure-sugar-default.rs b/src/test/compile-fail/unboxed-closure-sugar-default.rs index 0d9e406b08..831db98941 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-default.rs +++ b/src/test/compile-fail/unboxed-closure-sugar-default.rs @@ -14,24 +14,25 @@ #![feature(unboxed_closures)] #![allow(dead_code)] -trait Foo { - fn dummy(&self, t: T, u: U, v: V); +trait Foo { + type Output; + fn dummy(&self, t: T, v: V); } -trait Eq { } +trait Eq { fn same_types(&self, x: &X) -> bool { true } } impl Eq for X { } fn eq() where A : Eq { } fn test<'a,'b>() { // Parens are equivalent to omitting default in angle. - eq::< Foo<(isize,),()>, Foo(isize) >(); + eq::< Foo<(isize,),Output=()>, Foo(isize) >(); // In angle version, we supply something other than the default - eq::< Foo<(isize,),(),isize>, Foo(isize) >(); + eq::< Foo<(isize,),isize,Output=()>, Foo(isize) >(); //~^ ERROR not implemented // Supply default explicitly. - eq::< Foo<(isize,),(),(isize,)>, Foo(isize) >(); + eq::< Foo<(isize,),(isize,),Output=()>, Foo(isize) >(); } fn main() { } diff --git a/src/test/compile-fail/unboxed-closure-sugar-equiv.rs b/src/test/compile-fail/unboxed-closure-sugar-equiv.rs index 9dff0e9e01..6d315c1b7a 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-equiv.rs +++ b/src/test/compile-fail/unboxed-closure-sugar-equiv.rs @@ -16,41 +16,45 @@ #![feature(unboxed_closures)] #![allow(dead_code)] -trait Foo { - fn dummy(&self, t: T, u: U); +use std::marker::PhantomFn; + +trait Foo { + type Output; + fn dummy(&self, t: T, u: Self::Output); } -trait Eq { } +trait Eq : PhantomFn<(Self,X)> { } impl Eq for X { } fn eq>() { } fn test<'a,'b>() { // No errors expected: - eq::< Foo<(),()>, Foo() >(); - eq::< Foo<(isize,),()>, Foo(isize) >(); - eq::< Foo<(isize,usize),()>, Foo(isize,usize) >(); - eq::< Foo<(isize,usize),usize>, Foo(isize,usize) -> usize >(); - eq::< Foo<(&'a isize,&'b usize),usize>, Foo(&'a isize,&'b usize) -> usize >(); + eq::< Foo<(),Output=()>, Foo() >(); + eq::< Foo<(isize,),Output=()>, Foo(isize) >(); + eq::< Foo<(isize,usize),Output=()>, Foo(isize,usize) >(); + eq::< Foo<(isize,usize),Output=usize>, Foo(isize,usize) -> usize >(); + eq::< Foo<(&'a isize,&'b usize),Output=usize>, Foo(&'a isize,&'b usize) -> usize >(); // Test that anonymous regions in `()` form are equivalent // to fresh bound regions, and that we can intermingle // named and anonymous as we choose: - eq::< for<'x,'y> Foo<(&'x isize,&'y usize),usize>, + eq::< for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>, for<'x,'y> Foo(&'x isize,&'y usize) -> usize >(); - eq::< for<'x,'y> Foo<(&'x isize,&'y usize),usize>, + eq::< for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>, for<'x> Foo(&'x isize,&usize) -> usize >(); - eq::< for<'x,'y> Foo<(&'x isize,&'y usize),usize>, + eq::< for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>, for<'y> Foo(&isize,&'y usize) -> usize >(); - eq::< for<'x,'y> Foo<(&'x isize,&'y usize),usize>, + eq::< for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>, Foo(&isize,&usize) -> usize >(); // lifetime elision - eq::< for<'x> Foo<(&'x isize,), &'x isize>, + eq::< for<'x> Foo<(&'x isize,), Output=&'x isize>, Foo(&isize) -> &isize >(); // Errors expected: - eq::< Foo<(),()>, Foo(char) >(); - //~^ ERROR not implemented + eq::< Foo<(),Output=()>, + Foo(char) >(); + //~^^ ERROR not implemented } fn main() { } diff --git a/src/test/compile-fail/unboxed-closure-sugar-lifetime-elision.rs b/src/test/compile-fail/unboxed-closure-sugar-lifetime-elision.rs index 29429c708d..bd3530e6e3 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-lifetime-elision.rs +++ b/src/test/compile-fail/unboxed-closure-sugar-lifetime-elision.rs @@ -16,18 +16,21 @@ #![feature(unboxed_closures)] #![allow(dead_code)] -trait Foo { - fn dummy(&self, t: T, u: U); +use std::marker; + +trait Foo { + type Output; + fn dummy(&self, t: T); } -trait Eq { } +trait Eq : marker::PhantomFn<(Self, X)> { } impl Eq for X { } fn eq>() { } fn main() { - eq::< for<'a> Foo<(&'a isize,), &'a isize>, + eq::< for<'a> Foo<(&'a isize,), Output=&'a isize>, Foo(&isize) -> &isize >(); - eq::< for<'a> Foo<(&'a isize,), (&'a isize, &'a isize)>, + eq::< for<'a> Foo<(&'a isize,), Output=(&'a isize, &'a isize)>, Foo(&isize) -> (&isize, &isize) >(); let _: Foo(&isize, &usize) -> &usize; //~ ERROR missing lifetime specifier diff --git a/src/test/compile-fail/unboxed-closure-sugar-not-used-on-fn.rs b/src/test/compile-fail/unboxed-closure-sugar-not-used-on-fn.rs new file mode 100644 index 0000000000..1f0d5aae36 --- /dev/null +++ b/src/test/compile-fail/unboxed-closure-sugar-not-used-on-fn.rs @@ -0,0 +1,23 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + +// Test that the `Fn` traits require `()` form without a feature gate. + +fn bar1(x: &Fn<()>) { + //~^ ERROR angle-bracket notation is not stable when used with the `Fn` family +} + +fn bar2(x: &T) where T: Fn<()> { + //~^ ERROR angle-bracket notation is not stable when used with the `Fn` family +} + +fn main() { } + diff --git a/src/test/compile-fail/unboxed-closure-sugar-region.rs b/src/test/compile-fail/unboxed-closure-sugar-region.rs index c8dd33c11f..057b496bd4 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-region.rs +++ b/src/test/compile-fail/unboxed-closure-sugar-region.rs @@ -17,11 +17,12 @@ use std::marker; -trait Foo<'a,T,U> { - fn dummy(&'a self) -> &'a (T,U); +trait Foo<'a,T> { + type Output; + fn dummy(&'a self) -> &'a (T,Self::Output); } -trait Eq { } +trait Eq { fn is_of_eq_type(&self, x: &X) -> bool { true } } impl Eq for X { } fn eq>() { } @@ -29,16 +30,17 @@ fn same_type>(a: A, b: B) { } fn test<'a,'b>() { // Parens are equivalent to omitting default in angle. - eq::< Foo<(isize,),()>, Foo(isize) >(); + eq::< Foo<(isize,),Output=()>, Foo(isize) >(); // Here we specify 'static explicitly in angle-bracket version. // Parenthesized winds up getting inferred. - eq::< Foo<'static, (isize,),()>, Foo(isize) >(); + eq::< Foo<'static, (isize,),Output=()>, Foo(isize) >(); } -fn test2(x: &Foo<(isize,),()>, y: &Foo(isize)) { +fn test2(x: &Foo<(isize,),Output=()>, y: &Foo(isize)) { // Here, the omitted lifetimes are expanded to distinct things. same_type(x, y) //~ ERROR cannot infer + //~^ ERROR cannot infer } fn main() { } diff --git a/src/test/compile-fail/unboxed-closure-sugar-used-on-struct-1.rs b/src/test/compile-fail/unboxed-closure-sugar-used-on-struct-1.rs index a6184caf68..a3991a87b7 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-used-on-struct-1.rs +++ b/src/test/compile-fail/unboxed-closure-sugar-used-on-struct-1.rs @@ -11,13 +11,14 @@ // Test that parentheses form doesn't work with struct types appearing in local variables. -struct Bar { - f: A, r: R +struct Bar { + f: A } fn bar() { let x: Box = panic!(); //~^ ERROR parenthesized parameters may only be used with a trait + //~^^ ERROR associated type bindings are not allowed here } fn main() { } diff --git a/src/test/compile-fail/unboxed-closure-sugar-used-on-struct.rs b/src/test/compile-fail/unboxed-closure-sugar-used-on-struct.rs index d5fb505715..ad85cdcaa0 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-used-on-struct.rs +++ b/src/test/compile-fail/unboxed-closure-sugar-used-on-struct.rs @@ -10,12 +10,13 @@ // Test that parentheses form doesn't work with struct types appearing in argument types. -struct Bar { - f: A, r: R +struct Bar { + f: A } fn foo(b: Box) { //~^ ERROR parenthesized parameters may only be used with a trait + //~^^ ERROR associated type bindings are not allowed here } fn main() { } diff --git a/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs b/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs index d9efab974d..c9837da58e 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs +++ b/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs @@ -12,7 +12,7 @@ trait One { fn foo(&self) -> A; } -fn foo(_: &One()) //~ ERROR wrong number of type arguments +fn foo(_: &One()) //~ ERROR no associated type `Output` defined in `One<()>` {} fn main() { } diff --git a/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs b/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs index dcfcb7d477..9f0682df3f 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs +++ b/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs @@ -12,7 +12,9 @@ trait Three { fn dummy(&self) -> (A,B,C); } -fn foo(_: &Three()) //~ ERROR wrong number of type arguments +fn foo(_: &Three()) +//~^ ERROR wrong number of type arguments +//~| ERROR no associated type `Output` {} fn main() { } diff --git a/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters.rs b/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters.rs index a8ac62444a..40635cf3dd 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters.rs +++ b/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters.rs @@ -12,7 +12,9 @@ trait Zero { fn dummy(&self); } -fn foo(_: Zero()) //~ ERROR wrong number of type arguments +fn foo(_: Zero()) + //~^ ERROR wrong number of type arguments + //~| ERROR no associated type `Output` defined in `Zero` {} fn main() { } diff --git a/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs b/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs index b58e08355c..5810ffcf21 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs +++ b/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs @@ -13,7 +13,8 @@ trait Trait {} fn f isize>(x: F) {} -//~^ ERROR wrong number of type arguments: expected 0, found 2 +//~^ ERROR wrong number of type arguments: expected 0, found 1 +//~| ERROR no associated type `Output` fn main() {} diff --git a/src/test/compile-fail/unboxed-closures-borrow-conflict.rs b/src/test/compile-fail/unboxed-closures-borrow-conflict.rs index bb92e57d70..1191cfa260 100644 --- a/src/test/compile-fail/unboxed-closures-borrow-conflict.rs +++ b/src/test/compile-fail/unboxed-closures-borrow-conflict.rs @@ -14,7 +14,7 @@ // cause borrow conflicts. fn main() { - let mut x = 0us; - let f = |:| x += 1; + let mut x = 0_usize; + let f = || x += 1; let _y = x; //~ ERROR cannot use `x` because it was mutably borrowed } diff --git a/src/test/compile-fail/unboxed-closures-failed-recursive-fn-1.rs b/src/test/compile-fail/unboxed-closures-failed-recursive-fn-1.rs new file mode 100644 index 0000000000..7398e6f108 --- /dev/null +++ b/src/test/compile-fail/unboxed-closures-failed-recursive-fn-1.rs @@ -0,0 +1,33 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Various unsuccessful attempts to put the unboxed closure kind +// inference into an awkward position that might require fixed point +// iteration (basically where inferring the kind of a closure `c` +// would require knowing the kind of `c`). I currently believe this is +// impossible. + +fn a() { + // This case of recursion wouldn't even require fixed-point + // iteration, but it still doesn't work. The weird structure with + // the `Option` is to avoid giving any useful hints about the `Fn` + // kind via the expected type. + let mut factorial: Option u32>> = None; + + let f = |x: u32| -> u32 { + let g = factorial.as_ref().unwrap(); + if x == 0 {1} else {x * g(x-1)} + }; + + factorial = Some(Box::new(f)); + //~^ ERROR cannot assign to `factorial` because it is borrowed +} + +fn main() { } diff --git a/src/test/compile-fail/unboxed-closures-failed-recursive-fn-2.rs b/src/test/compile-fail/unboxed-closures-failed-recursive-fn-2.rs new file mode 100644 index 0000000000..f40c8fc747 --- /dev/null +++ b/src/test/compile-fail/unboxed-closures-failed-recursive-fn-2.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Various unsuccessful attempts to put the unboxed closure kind +// inference into an awkward position that might require fixed point +// iteration (basically where inferring the kind of a closure `c` +// would require knowing the kind of `c`). I currently believe this is +// impossible. + +fn a() { + let mut closure0 = None; + let vec = vec!(1, 2, 3); + + loop { + { + let closure1 = || { + match closure0.take() { + Some(c) => { + return c(); + //~^ ERROR the type of this value must be known in this context + } + None => { } + } + }; + closure1(); + } + + closure0 = || vec; + } +} + +fn main() { } diff --git a/src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs b/src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs index fc87ec9f95..bbafd5109e 100644 --- a/src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs +++ b/src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs @@ -18,7 +18,9 @@ use std::ops::{Fn,FnMut,FnOnce}; struct S; -impl FnMut<(isize,),isize> for S { +impl FnMut<(isize,)> for S { + type Output = isize; + extern "rust-call" fn call_mut(&mut self, (x,): (isize,)) -> isize { x * x } @@ -29,6 +31,8 @@ fn call_itisize>(f: &F, x: isize) -> isize { } fn main() { - let x = call_it(&S, 22); //~ ERROR not implemented + let x = call_it(&S, 22); + //~^ ERROR not implemented + //~| ERROR not implemented } diff --git a/src/test/compile-fail/unboxed-closures-infer-argument-types-two-region-pointers.rs b/src/test/compile-fail/unboxed-closures-infer-argument-types-two-region-pointers.rs index 525d0b3199..3dd5779914 100644 --- a/src/test/compile-fail/unboxed-closures-infer-argument-types-two-region-pointers.rs +++ b/src/test/compile-fail/unboxed-closures-infer-argument-types-two-region-pointers.rs @@ -23,7 +23,7 @@ fn doit(val: T, f: &F) } pub fn main() { - doit(0is, &|&: x, y| { + doit(0, &|x, y| { x.set(y); //~ ERROR cannot infer }); } diff --git a/src/test/compile-fail/unboxed-closures-infer-explicit-call-too-early.rs b/src/test/compile-fail/unboxed-closures-infer-explicit-call-too-early.rs new file mode 100644 index 0000000000..f993b8fa8c --- /dev/null +++ b/src/test/compile-fail/unboxed-closures-infer-explicit-call-too-early.rs @@ -0,0 +1,18 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(unboxed_closures)] + +fn main() { + let mut zero = || {}; + let () = zero.call_mut(()); + //~^ ERROR we have not yet inferred what kind of closure it is +} + diff --git a/src/test/compile-fail/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs b/src/test/compile-fail/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs new file mode 100644 index 0000000000..afbc141b5d --- /dev/null +++ b/src/test/compile-fail/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we are able to infer a suitable kind for this closure +// that is just called (`FnMut`). + +fn main() { + let mut counter = 0; + + // Here this must be inferred to FnMut so that it can mutate counter, + // but we forgot the mut. + let tick1 = || { + counter += 1; + }; + + // In turn, tick2 must be inferred to FnMut so that it can call + // tick1, but we forgot the mut. The error message we currently + // get seems... suboptimal. + let tick2 = || { //~ ERROR closure cannot assign to immutable local variable `tick1` + tick1(); + }; + + tick2(); //~ ERROR cannot borrow +} + diff --git a/src/test/compile-fail/unboxed-closures-infer-fnmut-missing-mut.rs b/src/test/compile-fail/unboxed-closures-infer-fnmut-missing-mut.rs new file mode 100644 index 0000000000..9e4ed30799 --- /dev/null +++ b/src/test/compile-fail/unboxed-closures-infer-fnmut-missing-mut.rs @@ -0,0 +1,18 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we are able to infer a suitable kind for this closure +// that is just called (`FnMut`). + +fn main() { + let mut counter = 0; + let tick = || counter += 1; + tick(); //~ ERROR cannot borrow immutable local variable `tick` as mutable +} diff --git a/src/test/compile-fail/unboxed-closures-infer-fnmut-move-missing-mut.rs b/src/test/compile-fail/unboxed-closures-infer-fnmut-move-missing-mut.rs new file mode 100644 index 0000000000..de17d25b4c --- /dev/null +++ b/src/test/compile-fail/unboxed-closures-infer-fnmut-move-missing-mut.rs @@ -0,0 +1,18 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we are able to infer a suitable kind for this closure +// that is just called (`FnMut`). + +fn main() { + let mut counter = 0; + let tick = move || counter += 1; + tick(); //~ ERROR cannot borrow immutable local variable `tick` as mutable +} diff --git a/src/test/compile-fail/unboxed-closures-infer-fnonce-call-twice.rs b/src/test/compile-fail/unboxed-closures-infer-fnonce-call-twice.rs new file mode 100644 index 0000000000..0050fbdde2 --- /dev/null +++ b/src/test/compile-fail/unboxed-closures-infer-fnonce-call-twice.rs @@ -0,0 +1,21 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we are able to infer a suitable kind for this closure +// that is just called (`FnMut`). + +use std::mem; + +fn main() { + let mut counter: Vec = Vec::new(); + let tick = || mem::drop(counter); + tick(); + tick(); //~ ERROR use of moved value: `tick` +} diff --git a/src/test/compile-fail/unboxed-closures-infer-fnonce-move-call-twice.rs b/src/test/compile-fail/unboxed-closures-infer-fnonce-move-call-twice.rs new file mode 100644 index 0000000000..f9709b8c59 --- /dev/null +++ b/src/test/compile-fail/unboxed-closures-infer-fnonce-move-call-twice.rs @@ -0,0 +1,21 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we are able to infer a suitable kind for this closure +// that is just called (`FnMut`). + +use std::mem; + +fn main() { + let mut counter: Vec = Vec::new(); + let tick = move || mem::drop(counter); + tick(); + tick(); //~ ERROR use of moved value: `tick` +} diff --git a/src/test/compile-fail/unboxed-closures-move-upvar-from-non-once-ref-closure.rs b/src/test/compile-fail/unboxed-closures-move-upvar-from-non-once-ref-closure.rs new file mode 100644 index 0000000000..e66610c149 --- /dev/null +++ b/src/test/compile-fail/unboxed-closures-move-upvar-from-non-once-ref-closure.rs @@ -0,0 +1,24 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that a by-ref `FnMut` closure gets an error when it tries to +// consume a value. + +fn call(f: F) where F : Fn() { + f(); +} + +fn main() { + let y = vec!(format!("World")); + call(|| { + y.into_iter(); + //~^ ERROR cannot move out of captured outer variable in an `Fn` closure + }); +} diff --git a/src/test/compile-fail/unboxed-closures-mutate-upvar.rs b/src/test/compile-fail/unboxed-closures-mutate-upvar.rs new file mode 100644 index 0000000000..650bb17bb7 --- /dev/null +++ b/src/test/compile-fail/unboxed-closures-mutate-upvar.rs @@ -0,0 +1,67 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we cannot mutate an outer variable that is not declared +// as `mut` through a closure. Also test that we CAN mutate a moved copy, +// unless this is a `Fn` closure. Issue #16749. + +#![feature(unboxed_closures)] + +use std::mem; + +fn to_fn>(f: F) -> F { f } +fn to_fn_mut>(f: F) -> F { f } + +fn a() { + let n = 0u8; + let mut f = to_fn_mut(|| { //~ ERROR closure cannot assign + n += 1; + }); +} + +fn b() { + let mut n = 0u8; + let mut f = to_fn_mut(|| { + n += 1; // OK + }); +} + +fn c() { + let n = 0u8; + let mut f = to_fn_mut(move || { + // If we just did a straight-forward desugaring, this would + // compile, but we do something a bit more subtle, and hence + // we get an error. + n += 1; //~ ERROR cannot assign + }); +} + +fn d() { + let mut n = 0u8; + let mut f = to_fn_mut(move || { + n += 1; // OK + }); +} + +fn e() { + let n = 0u8; + let mut f = to_fn(move || { + n += 1; //~ ERROR cannot assign + }); +} + +fn f() { + let mut n = 0u8; + let mut f = to_fn(move || { + n += 1; //~ ERROR cannot assign + }); +} + +fn main() { } diff --git a/src/test/compile-fail/unboxed-closures-mutated-upvar-from-fn-closure.rs b/src/test/compile-fail/unboxed-closures-mutated-upvar-from-fn-closure.rs new file mode 100644 index 0000000000..2345a86595 --- /dev/null +++ b/src/test/compile-fail/unboxed-closures-mutated-upvar-from-fn-closure.rs @@ -0,0 +1,24 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that a by-ref `FnMut` closure gets an error when it tries to +// mutate a value. + +fn call(f: F) where F : Fn() { + f(); +} + +fn main() { + let mut counter = 0_u32; + call(|| { + counter += 1; + //~^ ERROR cannot assign to data in a captured outer variable in an `Fn` closure + }); +} diff --git a/src/test/compile-fail/unboxed-closures-recursive-fn-using-fn-mut.rs b/src/test/compile-fail/unboxed-closures-recursive-fn-using-fn-mut.rs new file mode 100644 index 0000000000..713b64b134 --- /dev/null +++ b/src/test/compile-fail/unboxed-closures-recursive-fn-using-fn-mut.rs @@ -0,0 +1,48 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(core,unboxed_closures)] + +use std::marker::PhantomData; + +// A erroneous variant of `run-pass/unboxed_closures-infer-recursive-fn.rs` +// where we attempt to perform mutation in the recursive function. This fails to compile +// because it winds up requiring `FnMut` which enforces linearity. + +struct YCombinator { + func: F, + marker: PhantomData<(A,R)>, +} + +impl YCombinator { + fn new(f: F) -> YCombinator { + YCombinator { func: f, marker: PhantomData } + } +} + +impl R, A) -> R> FnMut<(A,)> for YCombinator { + type Output = R; + + extern "rust-call" fn call_mut(&mut self, (arg,): (A,)) -> R { + (self.func)(self, arg) + //~^ ERROR cannot borrow `*self` as mutable more than once at a time + } +} + +fn main() { + let mut counter = 0; + let factorial = |recur: &mut FnMut(u32) -> u32, arg: u32| -> u32 { + counter += 1; + if arg == 0 {1} else {arg * recur(arg-1)} + }; + let mut factorial: YCombinator<_,u32,u32> = YCombinator::new(factorial); + let mut r = factorial(10); + assert_eq!(3628800, r); +} diff --git a/src/test/compile-fail/unboxed-closures-static-call-wrong-trait.rs b/src/test/compile-fail/unboxed-closures-static-call-wrong-trait.rs index 22bfabf040..f430e9fc75 100644 --- a/src/test/compile-fail/unboxed-closures-static-call-wrong-trait.rs +++ b/src/test/compile-fail/unboxed-closures-static-call-wrong-trait.rs @@ -10,8 +10,10 @@ #![feature(unboxed_closures)] +fn to_fn_mut>(f: F) -> F { f } + fn main() { - let mut_ = |&mut: x| x; - mut_.call((0is, )); //~ ERROR does not implement any method in scope named `call` + let mut_ = to_fn_mut(|x| x); + mut_.call((0, )); //~ ERROR does not implement any method in scope named `call` } diff --git a/src/test/compile-fail/unboxed-closures-type-mismatch.rs b/src/test/compile-fail/unboxed-closures-type-mismatch.rs index f7ac2274ff..91182393ac 100644 --- a/src/test/compile-fail/unboxed-closures-type-mismatch.rs +++ b/src/test/compile-fail/unboxed-closures-type-mismatch.rs @@ -13,7 +13,7 @@ use std::ops::FnMut; pub fn main() { - let mut f = |&mut: x: isize, y: isize| -> isize { x + y }; - let z = f(1us, 2); //~ ERROR mismatched types + let mut f = |x: isize, y: isize| -> isize { x + y }; + let z = f(1_usize, 2); //~ ERROR mismatched types println!("{}", z); } diff --git a/src/test/compile-fail/unboxed-closures-unsafe-extern-fn.rs b/src/test/compile-fail/unboxed-closures-unsafe-extern-fn.rs index ab909717ca..23f7ee2b01 100644 --- a/src/test/compile-fail/unboxed-closures-unsafe-extern-fn.rs +++ b/src/test/compile-fail/unboxed-closures-unsafe-extern-fn.rs @@ -21,7 +21,9 @@ fn call_it_mutisize>(_: &mut F, _: isize) -> isize { 0 } fn call_it_onceisize>(_: F, _: isize) -> isize { 0 } fn a() { - let x = call_it(&square, 22); //~ ERROR not implemented + let x = call_it(&square, 22); + //~^ ERROR not implemented + //~| ERROR not implemented } fn b() { diff --git a/src/test/compile-fail/unboxed-closures-vtable-mismatch.rs b/src/test/compile-fail/unboxed-closures-vtable-mismatch.rs index 95673a5131..c2a2e5162a 100644 --- a/src/test/compile-fail/unboxed-closures-vtable-mismatch.rs +++ b/src/test/compile-fail/unboxed-closures-vtable-mismatch.rs @@ -12,13 +12,17 @@ use std::ops::FnMut; -fn call_it>(y: isize, mut f: F) -> isize { +fn to_fn_mut>(f: F) -> F { f } + +fn call_itisize>(y: isize, mut f: F) -> isize { f(2, y) } pub fn main() { - let f = |&mut: x: usize, y: isize| -> isize { (x as isize) + y }; - let z = call_it(3, f); //~ ERROR type mismatch + let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y }); + let z = call_it(3, f); + //~^ ERROR type mismatch + //~| ERROR type mismatch println!("{}", z); } diff --git a/src/test/compile-fail/unboxed-closures-wrong-abi.rs b/src/test/compile-fail/unboxed-closures-wrong-abi.rs index 4a0b55558c..96619bef36 100644 --- a/src/test/compile-fail/unboxed-closures-wrong-abi.rs +++ b/src/test/compile-fail/unboxed-closures-wrong-abi.rs @@ -21,7 +21,9 @@ fn call_it_mutisize>(_: &mut F, _: isize) -> isize { 0 } fn call_it_onceisize>(_: F, _: isize) -> isize { 0 } fn a() { - let x = call_it(&square, 22); //~ ERROR not implemented + let x = call_it(&square, 22); + //~^ ERROR not implemented + //~| ERROR not implemented } fn b() { diff --git a/src/test/compile-fail/unboxed-closures-wrong-arg-type-extern-fn.rs b/src/test/compile-fail/unboxed-closures-wrong-arg-type-extern-fn.rs index b2fdf79263..ebcbdbbc00 100644 --- a/src/test/compile-fail/unboxed-closures-wrong-arg-type-extern-fn.rs +++ b/src/test/compile-fail/unboxed-closures-wrong-arg-type-extern-fn.rs @@ -22,7 +22,9 @@ fn call_it_mutisize>(_: &mut F, _: isize) -> isize { 0 } fn call_it_onceisize>(_: F, _: isize) -> isize { 0 } fn a() { - let x = call_it(&square, 22); //~ ERROR not implemented + let x = call_it(&square, 22); + //~^ ERROR not implemented + //~| ERROR not implemented } fn b() { diff --git a/src/test/compile-fail/unique-pinned-nocopy.rs b/src/test/compile-fail/unique-pinned-nocopy.rs index 04eaa3d7ae..88535ee04f 100644 --- a/src/test/compile-fail/unique-pinned-nocopy.rs +++ b/src/test/compile-fail/unique-pinned-nocopy.rs @@ -10,7 +10,7 @@ #![feature(box_syntax)] -#[derive(Show)] +#[derive(Debug)] struct r { b: bool, } diff --git a/src/test/compile-fail/unique-unique-kind.rs b/src/test/compile-fail/unique-unique-kind.rs index 4b7f11b056..046337c33f 100644 --- a/src/test/compile-fail/unique-unique-kind.rs +++ b/src/test/compile-fail/unique-unique-kind.rs @@ -12,12 +12,11 @@ use std::rc::Rc; -fn f(_i: T) { +fn f(__isize: T) { } fn main() { - let i = box Rc::new(100is); + let i = box Rc::new(100); f(i); //~^ ERROR `core::marker::Send` is not implemented - //~^^ ERROR `core::marker::Send` is not implemented } diff --git a/src/test/compile-fail/unique-vec-res.rs b/src/test/compile-fail/unique-vec-res.rs index 4a84bb4c5a..91a41ad6a4 100644 --- a/src/test/compile-fail/unique-vec-res.rs +++ b/src/test/compile-fail/unique-vec-res.rs @@ -14,7 +14,7 @@ use std::cell::Cell; -#[derive(Show)] +#[derive(Debug)] struct r<'a> { i: &'a Cell, } @@ -28,7 +28,7 @@ impl<'a> Drop for r<'a> { } } -fn f(_i: Vec , _j: Vec ) { +fn f(__isize: Vec , _j: Vec ) { } fn clone(t: &T) -> T { t.clone() } diff --git a/src/test/compile-fail/unnecessary-private.rs b/src/test/compile-fail/unnecessary-private.rs index 6e6ffd23c4..964db6e9a4 100644 --- a/src/test/compile-fail/unnecessary-private.rs +++ b/src/test/compile-fail/unnecessary-private.rs @@ -1,4 +1,4 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -9,13 +9,14 @@ // except according to those terms. fn main() { + pub use std::uint; //~ ERROR: visibility has no effect pub struct A; //~ ERROR: visibility has no effect pub enum B {} //~ ERROR: visibility has no effect pub trait C { //~ ERROR: visibility has no effect - pub fn foo() {} //~ ERROR: visibility has no effect + pub fn foo(&self) {} //~ ERROR: visibility has no effect } impl A { - pub fn foo() {} //~ ERROR: visibility has no effect + pub fn foo(&self) {} //~ ERROR: visibility has no effect } struct D { diff --git a/src/test/compile-fail/unreachable-arm.rs b/src/test/compile-fail/unreachable-arm.rs index f403457efb..eb5ffeaf88 100644 --- a/src/test/compile-fail/unreachable-arm.rs +++ b/src/test/compile-fail/unreachable-arm.rs @@ -10,8 +10,9 @@ // error-pattern:unreachable pattern +#![feature(box_patterns)] #![feature(box_syntax)] enum foo { a(Box, isize), b(usize), } -fn main() { match foo::b(1us) { foo::b(_) | foo::a(box _, 1) => { } foo::a(_, 1) => { } } } +fn main() { match foo::b(1_usize) { foo::b(_) | foo::a(box _, 1) => { } foo::a(_, 1) => { } } } diff --git a/src/test/compile-fail/unreachable-code.rs b/src/test/compile-fail/unreachable-code.rs index d96578f2df..dd08eed5df 100644 --- a/src/test/compile-fail/unreachable-code.rs +++ b/src/test/compile-fail/unreachable-code.rs @@ -14,5 +14,5 @@ fn main() { loop{} - let a = 3is; //~ ERROR: unreachable statement + let a = 3; //~ ERROR: unreachable statement } diff --git a/src/test/compile-fail/unsendable-class.rs b/src/test/compile-fail/unsendable-class.rs index abd93fdfc6..f51eee3793 100644 --- a/src/test/compile-fail/unsendable-class.rs +++ b/src/test/compile-fail/unsendable-class.rs @@ -31,6 +31,5 @@ fn main() { let cat = "kitty".to_string(); let (tx, _) = channel(); //~^ ERROR `core::marker::Send` is not implemented - //~^^ ERROR `core::marker::Send` is not implemented tx.send(foo(42, Rc::new(cat))); } diff --git a/src/test/compile-fail/unsized-inherent-impl-self-type.rs b/src/test/compile-fail/unsized-inherent-impl-self-type.rs index 8740346a21..a03c76b12d 100644 --- a/src/test/compile-fail/unsized-inherent-impl-self-type.rs +++ b/src/test/compile-fail/unsized-inherent-impl-self-type.rs @@ -12,7 +12,7 @@ // impl - struct -struct S5; +struct S5(Y); impl S5 { //~ ERROR not implemented } diff --git a/src/test/compile-fail/unsized-trait-impl-self-type.rs b/src/test/compile-fail/unsized-trait-impl-self-type.rs index 3dd55b0ba7..08df1d9b7b 100644 --- a/src/test/compile-fail/unsized-trait-impl-self-type.rs +++ b/src/test/compile-fail/unsized-trait-impl-self-type.rs @@ -12,9 +12,10 @@ // impl - struct trait T3 { + fn foo(&self, z: &Z); } -struct S5; +struct S5(Y); impl T3 for S5 { //~ ERROR not implemented } diff --git a/src/test/compile-fail/unsized-trait-impl-trait-arg.rs b/src/test/compile-fail/unsized-trait-impl-trait-arg.rs index ac8043d685..4723dfeaeb 100644 --- a/src/test/compile-fail/unsized-trait-impl-trait-arg.rs +++ b/src/test/compile-fail/unsized-trait-impl-trait-arg.rs @@ -12,8 +12,9 @@ // impl - unbounded trait T2 { + fn foo(&self, z: Z); } -struct S4; +struct S4(Box); impl T2 for S4 { //~^ ERROR `core::marker::Sized` is not implemented for the type `X` } diff --git a/src/test/compile-fail/unsized3.rs b/src/test/compile-fail/unsized3.rs index 9d4cfe0f4a..de1cbab82b 100644 --- a/src/test/compile-fail/unsized3.rs +++ b/src/test/compile-fail/unsized3.rs @@ -10,6 +10,7 @@ // Test sized-ness checking in substitution within fn bodies.. +use std::marker; // Unbounded. fn f1(x: &X) { @@ -20,7 +21,9 @@ fn f2(x: &X) { } // Bounded. -trait T {} +trait T { + fn foo(&self) { } +} fn f3(x: &X) { f4::(x); //~^ ERROR the trait `core::marker::Sized` is not implemented @@ -55,12 +58,12 @@ fn f8(x1: &S, x2: &S) { // Test some tuples. fn f9(x1: Box>, x2: Box>) { - f5(&(*x1, 34is)); + f5(&(*x1, 34)); //~^ ERROR the trait `core::marker::Sized` is not implemented } fn f10(x1: Box>, x2: Box>) { - f5(&(32is, *x2)); + f5(&(32, *x2)); //~^ ERROR the trait `core::marker::Sized` is not implemented } diff --git a/src/test/compile-fail/unsized6.rs b/src/test/compile-fail/unsized6.rs index 21953d1bb0..f31a6ffdc0 100644 --- a/src/test/compile-fail/unsized6.rs +++ b/src/test/compile-fail/unsized6.rs @@ -10,8 +10,9 @@ // Test `?Sized` local variables. +use std::marker; -trait T {} +trait T : marker::MarkerTrait { } fn f1(x: &X) { let _: X; // <-- this is OK, no bindings created, no initializer. @@ -27,12 +28,12 @@ fn f2(x: &X) { fn f3(x1: Box, x2: Box, x3: Box) { let y: X = *x1; //~ERROR the trait `core::marker::Sized` is not implemented let y = *x2; //~ERROR the trait `core::marker::Sized` is not implemented - let (y, z) = (*x3, 4is); //~ERROR the trait `core::marker::Sized` is not implemented + let (y, z) = (*x3, 4); //~ERROR the trait `core::marker::Sized` is not implemented } fn f4(x1: Box, x2: Box, x3: Box) { let y: X = *x1; //~ERROR the trait `core::marker::Sized` is not implemented let y = *x2; //~ERROR the trait `core::marker::Sized` is not implemented - let (y, z) = (*x3, 4is); //~ERROR the trait `core::marker::Sized` is not implemented + let (y, z) = (*x3, 4); //~ERROR the trait `core::marker::Sized` is not implemented } fn g1(x: X) {} //~ERROR the trait `core::marker::Sized` is not implemented diff --git a/src/test/compile-fail/unsized7.rs b/src/test/compile-fail/unsized7.rs index 6fc547c0b8..6ea3d0720e 100644 --- a/src/test/compile-fail/unsized7.rs +++ b/src/test/compile-fail/unsized7.rs @@ -10,13 +10,17 @@ // Test sized-ness checking in substitution in impls. -trait T {} +use std::marker::MarkerTrait; + +trait T : MarkerTrait {} // I would like these to fail eventually. // impl - bounded trait T1 { + fn dummy(&self) -> Z; } -struct S3; + +struct S3(Box); impl T1 for S3 { //~^ ERROR `core::marker::Sized` is not implemented for the type `X` } diff --git a/src/test/compile-fail/unsupported-cast.rs b/src/test/compile-fail/unsupported-cast.rs index 205c912f5a..ca17c898ec 100644 --- a/src/test/compile-fail/unsupported-cast.rs +++ b/src/test/compile-fail/unsupported-cast.rs @@ -14,5 +14,5 @@ extern crate libc; fn main() { - println!("{}", 1.0 as *libc::FILE); // Can't cast float to foreign. + println!("{:?}", 1.0 as *const libc::FILE); // Can't cast float to foreign. } diff --git a/src/test/compile-fail/unused-attr.rs b/src/test/compile-fail/unused-attr.rs index 635ceec73a..af242b96a8 100644 --- a/src/test/compile-fail/unused-attr.rs +++ b/src/test/compile-fail/unused-attr.rs @@ -7,8 +7,10 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. + #![deny(unused_attributes)] #![allow(dead_code, unused_imports)] +#![feature(core, custom_attribute)] #![foo] //~ ERROR unused attribute @@ -50,9 +52,9 @@ struct Foo { #[foo] //~ ERROR unused attribute trait Baz { #[foo] //~ ERROR unused attribute - fn blah(); + fn blah(&self); #[foo] //~ ERROR unused attribute - fn blah2() {} + fn blah2(&self) {} } fn main() {} diff --git a/src/test/compile-fail/unused-mut-warning-captured-var.rs b/src/test/compile-fail/unused-mut-warning-captured-var.rs index aa5adb6a6b..d4dc58864a 100644 --- a/src/test/compile-fail/unused-mut-warning-captured-var.rs +++ b/src/test/compile-fail/unused-mut-warning-captured-var.rs @@ -11,7 +11,7 @@ #![forbid(unused_mut)] fn main() { - let mut x = 1is; + let mut x = 1; //~^ ERROR: variable does not need to be mutable - move|:| { println!("{}", x); }; + move|| { println!("{}", x); }; } diff --git a/src/test/compile-fail/use-mod.rs b/src/test/compile-fail/use-mod.rs index 493991835e..15640e386d 100644 --- a/src/test/compile-fail/use-mod.rs +++ b/src/test/compile-fail/use-mod.rs @@ -19,9 +19,6 @@ use foo::bar::{ use {self}; //~^ ERROR `self` import can only appear in an import list with a non-empty prefix -use foo::self; -//~^ ERROR `self` imports are only allowed within a { } list - mod foo { pub mod bar { pub struct Bar; diff --git a/src/test/compile-fail/useless-priv.rs b/src/test/compile-fail/useless-priv.rs index d8531f4543..b1120e5443 100644 --- a/src/test/compile-fail/useless-priv.rs +++ b/src/test/compile-fail/useless-priv.rs @@ -12,12 +12,14 @@ struct A { pub i: isize } pub enum C { pub Variant } //~ ERROR: unnecessary `pub` pub trait E { - pub fn foo() {} //~ ERROR: unnecessary visibility + pub fn foo(&self) {} //~ ERROR: unnecessary visibility +} +trait F { + pub fn foo(&self) {} //~ ERROR: unnecessary visibility } -trait F { pub fn foo() {} } //~ ERROR: unnecessary visibility impl E for A { - pub fn foo() {} //~ ERROR: unnecessary visibility + pub fn foo(&self) {} //~ ERROR: unnecessary visibility } fn main() {} diff --git a/src/test/compile-fail/useless-priv2.rs b/src/test/compile-fail/useless-priv2.rs index 7125a66b29..a404d09248 100644 --- a/src/test/compile-fail/useless-priv2.rs +++ b/src/test/compile-fail/useless-priv2.rs @@ -9,8 +9,10 @@ // except according to those terms. pub trait E { - pub fn foo(); //~ ERROR: unnecessary visibility + pub fn foo(&self); //~ ERROR: unnecessary visibility +} +trait F { + pub fn foo(&self); //~ ERROR: unnecessary visibility } -trait F { pub fn foo(); } //~ ERROR: unnecessary visibility fn main() {} diff --git a/src/test/compile-fail/variadic-ffi.rs b/src/test/compile-fail/variadic-ffi.rs index 702702990c..86271f670c 100644 --- a/src/test/compile-fail/variadic-ffi.rs +++ b/src/test/compile-fail/variadic-ffi.rs @@ -24,14 +24,18 @@ fn main() { foo(1); //~ ERROR: this function takes at least 2 parameters but 1 parameter was supplied let x: unsafe extern "C" fn(f: isize, x: u8) = foo; - //~^ ERROR: mismatched types: expected `unsafe extern "C" fn(isize, u8)` - // , found `unsafe extern "C" fn(isize, u8, ...)` - // (expected non-variadic fn, found variadic function) + //~^ ERROR: mismatched types + //~| expected `unsafe extern "C" fn(isize, u8)` + //~| found `unsafe extern "C" fn(isize, u8, ...)` + //~| expected non-variadic fn + //~| found variadic function let y: unsafe extern "C" fn(f: isize, x: u8, ...) = bar; - //~^ ERROR: mismatched types: expected `unsafe extern "C" fn(isize, u8, ...)` - // , found `extern "C" extern fn(isize, u8)` - // (expected variadic fn, found non-variadic function) + //~^ ERROR: mismatched types + //~| expected `unsafe extern "C" fn(isize, u8, ...)` + //~| found `extern "C" fn(isize, u8) {bar}` + //~| expected variadic fn + //~| found non-variadic function foo(1, 2, 3f32); //~ ERROR: can't pass an f32 to variadic function, cast to c_double foo(1, 2, true); //~ ERROR: can't pass bool to variadic function, cast to c_int diff --git a/src/test/compile-fail/variance-associated-types.rs b/src/test/compile-fail/variance-associated-types.rs new file mode 100644 index 0000000000..0ed0861d34 --- /dev/null +++ b/src/test/compile-fail/variance-associated-types.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that the variance computation considers types/regions that +// appear in projections to be invariant. + +#![feature(rustc_attrs)] + +trait Trait<'a> { + type Type; + + fn method(&'a self) { } +} + +#[rustc_variance] +struct Foo<'a, T : Trait<'a>> { //~ ERROR ItemVariances(types=[[+];[];[]], regions=[[-];[];[]]) + field: (T, &'a ()) +} + +#[rustc_variance] +struct Bar<'a, T : Trait<'a>> { //~ ERROR ItemVariances(types=[[o];[];[]], regions=[[o];[];[]]) + field: >::Type +} + +fn main() { } diff --git a/src/test/compile-fail/variance-contravariant-arg-object.rs b/src/test/compile-fail/variance-contravariant-arg-object.rs new file mode 100644 index 0000000000..3330e1d0d5 --- /dev/null +++ b/src/test/compile-fail/variance-contravariant-arg-object.rs @@ -0,0 +1,31 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(dead_code)] + +trait Get : 'static { + fn get(&self, t: T); +} + +fn get_min_from_max<'min, 'max>(v: Box>) + -> Box> + where 'max : 'min +{ + v //~ ERROR mismatched types +} + +fn get_max_from_min<'min, 'max, G>(v: Box>) + -> Box> + where 'max : 'min +{ + v +} + +fn main() { } diff --git a/src/test/compile-fail/variance-contravariant-arg-trait-match.rs b/src/test/compile-fail/variance-contravariant-arg-trait-match.rs new file mode 100644 index 0000000000..caaad4014a --- /dev/null +++ b/src/test/compile-fail/variance-contravariant-arg-trait-match.rs @@ -0,0 +1,31 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(dead_code)] + +trait Get { + fn get(&self, t: T); +} + +fn get_min_from_max<'min, 'max, G>() + where 'max : 'min, G : Get<&'max i32> +{ + impls_get::() //~ ERROR mismatched types +} + +fn get_max_from_min<'min, 'max, G>() + where 'max : 'min, G : Get<&'min i32> +{ + impls_get::() +} + +fn impls_get() where G : Get { } + +fn main() { } diff --git a/src/test/compile-fail/variance-contravariant-self-trait-match.rs b/src/test/compile-fail/variance-contravariant-self-trait-match.rs new file mode 100644 index 0000000000..013511ed51 --- /dev/null +++ b/src/test/compile-fail/variance-contravariant-self-trait-match.rs @@ -0,0 +1,31 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(dead_code)] + +trait Get { + fn get(&self); +} + +fn get_min_from_max<'min, 'max, G>() + where 'max : 'min, G : 'max, &'max G : Get +{ + impls_get::<&'min G>(); //~ ERROR mismatched types +} + +fn get_max_from_min<'min, 'max, G>() + where 'max : 'min, G : 'max, &'min G : Get +{ + impls_get::<&'max G>(); +} + +fn impls_get() where G : Get { } + +fn main() { } diff --git a/src/test/compile-fail/variance-covariant-arg-object.rs b/src/test/compile-fail/variance-covariant-arg-object.rs new file mode 100644 index 0000000000..828c987c08 --- /dev/null +++ b/src/test/compile-fail/variance-covariant-arg-object.rs @@ -0,0 +1,31 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(dead_code)] + +trait Get : 'static { + fn get(&self) -> T; +} + +fn get_min_from_max<'min, 'max>(v: Box>) + -> Box> + where 'max : 'min +{ + v +} + +fn get_max_from_min<'min, 'max, G>(v: Box>) + -> Box> + where 'max : 'min +{ + v //~ ERROR mismatched types +} + +fn main() { } diff --git a/src/test/compile-fail/variance-covariant-arg-trait-match.rs b/src/test/compile-fail/variance-covariant-arg-trait-match.rs new file mode 100644 index 0000000000..17761b9c0b --- /dev/null +++ b/src/test/compile-fail/variance-covariant-arg-trait-match.rs @@ -0,0 +1,31 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(dead_code)] + +trait Get { + fn get(&self) -> T; +} + +fn get_min_from_max<'min, 'max, G>() + where 'max : 'min, G : Get<&'max i32> +{ + impls_get::() +} + +fn get_max_from_min<'min, 'max, G>() + where 'max : 'min, G : Get<&'min i32> +{ + impls_get::() //~ ERROR mismatched types +} + +fn impls_get() where G : Get { } + +fn main() { } diff --git a/src/test/compile-fail/variance-covariant-self-trait-match.rs b/src/test/compile-fail/variance-covariant-self-trait-match.rs new file mode 100644 index 0000000000..4e94a3eeb4 --- /dev/null +++ b/src/test/compile-fail/variance-covariant-self-trait-match.rs @@ -0,0 +1,31 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(dead_code)] + +trait Get { + fn get() -> Self; +} + +fn get_min_from_max<'min, 'max, G>() + where 'max : 'min, G : 'max, &'max G : Get +{ + impls_get::<&'min G>(); +} + +fn get_max_from_min<'min, 'max, G>() + where 'max : 'min, G : 'max, &'min G : Get +{ + impls_get::<&'max G>(); //~ ERROR mismatched types +} + +fn impls_get() where G : Get { } + +fn main() { } diff --git a/src/test/compile-fail/variance-deprecated-markers.rs b/src/test/compile-fail/variance-deprecated-markers.rs new file mode 100644 index 0000000000..8f9d24cb13 --- /dev/null +++ b/src/test/compile-fail/variance-deprecated-markers.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that the deprecated markers still have their old effect. + +#![feature(rustc_attrs)] + +use std::marker; + +#[rustc_variance] +struct A(marker::CovariantType); //~ ERROR types=[[+];[];[]] + +#[rustc_variance] +struct B(marker::ContravariantType); //~ ERROR types=[[-];[];[]] + +#[rustc_variance] +struct C(marker::InvariantType); //~ ERROR types=[[o];[];[]] + +#[rustc_variance] +struct D<'a>(marker::CovariantLifetime<'a>); //~ ERROR regions=[[+];[];[]] + +#[rustc_variance] +struct E<'a>(marker::ContravariantLifetime<'a>); //~ ERROR regions=[[-];[];[]] + +#[rustc_variance] +struct F<'a>(marker::InvariantLifetime<'a>); //~ ERROR regions=[[o];[];[]] + +fn main() { } diff --git a/src/test/compile-fail/variance-invariant-arg-object.rs b/src/test/compile-fail/variance-invariant-arg-object.rs new file mode 100644 index 0000000000..9edb510b82 --- /dev/null +++ b/src/test/compile-fail/variance-invariant-arg-object.rs @@ -0,0 +1,31 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(dead_code)] + +trait Get : 'static { + fn get(&self, t: T) -> T; +} + +fn get_min_from_max<'min, 'max>(v: Box>) + -> Box> + where 'max : 'min +{ + v //~ ERROR mismatched types +} + +fn get_max_from_min<'min, 'max, G>(v: Box>) + -> Box> + where 'max : 'min +{ + v //~ ERROR mismatched types +} + +fn main() { } diff --git a/src/test/compile-fail/variance-invariant-arg-trait-match.rs b/src/test/compile-fail/variance-invariant-arg-trait-match.rs new file mode 100644 index 0000000000..45fed0b083 --- /dev/null +++ b/src/test/compile-fail/variance-invariant-arg-trait-match.rs @@ -0,0 +1,31 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(dead_code)] + +trait Get { + fn get(&self, t: T) -> T; +} + +fn get_min_from_max<'min, 'max, G>() + where 'max : 'min, G : Get<&'max i32> +{ + impls_get::() //~ ERROR mismatched types +} + +fn get_max_from_min<'min, 'max, G>() + where 'max : 'min, G : Get<&'min i32> +{ + impls_get::() //~ ERROR mismatched types +} + +fn impls_get() where G : Get { } + +fn main() { } diff --git a/src/test/compile-fail/variance-invariant-self-trait-match.rs b/src/test/compile-fail/variance-invariant-self-trait-match.rs new file mode 100644 index 0000000000..b46cd302ae --- /dev/null +++ b/src/test/compile-fail/variance-invariant-self-trait-match.rs @@ -0,0 +1,31 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(dead_code)] + +trait Get { + fn get(&self) -> Self; +} + +fn get_min_from_max<'min, 'max, G>() + where 'max : 'min, &'max G : Get +{ + impls_get::<&'min G>(); //~ ERROR mismatched types +} + +fn get_max_from_min<'min, 'max, G>() + where 'max : 'min, &'min G : Get +{ + impls_get::<&'max G>(); //~ ERROR mismatched types +} + +fn impls_get() where G : Get { } + +fn main() { } diff --git a/src/test/compile-fail/variance-issue-20533.rs b/src/test/compile-fail/variance-issue-20533.rs new file mode 100644 index 0000000000..0254f56bd1 --- /dev/null +++ b/src/test/compile-fail/variance-issue-20533.rs @@ -0,0 +1,54 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Regression test for issue #20533. At some point, only 1 out of the +// 3 errors below were being reported. + +use std::marker::PhantomData; + +fn foo<'a, T>(_x: &'a T) -> PhantomData<&'a ()> { + PhantomData +} + +struct Wrap(T); + +fn bar<'a, T>(_x: &'a T) -> Wrap> { + Wrap(PhantomData) +} + +struct Baked<'a>(PhantomData<&'a ()>); + +fn baz<'a, T>(_x: &'a T) -> Baked<'a> { + Baked(PhantomData) +} + +struct AffineU32(u32); + +fn main() { + { + let a = AffineU32(1_u32); + let x = foo(&a); + drop(a); //~ ERROR cannot move out of `a` + drop(x); + } + { + let a = AffineU32(1_u32); + let x = bar(&a); + drop(a); //~ ERROR cannot move out of `a` + drop(x); + } + { + let a = AffineU32(1_u32); + let x = baz(&a); + drop(a); //~ ERROR cannot move out of `a` + drop(x); + } +} + diff --git a/src/test/compile-fail/variance-object-types.rs b/src/test/compile-fail/variance-object-types.rs new file mode 100644 index 0000000000..2b7b05970d --- /dev/null +++ b/src/test/compile-fail/variance-object-types.rs @@ -0,0 +1,26 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that Cell is considered invariant with respect to its +// type. + +#![feature(rustc_attrs)] + +use std::cell::Cell; + +// For better or worse, associated types are invariant, and hence we +// get an invariant result for `'a`. +#[rustc_variance] +struct Foo<'a> { //~ ERROR regions=[[o];[];[]] + x: Box &'a i32 + 'static> +} + +fn main() { +} diff --git a/src/test/compile-fail/variance-regions-direct.rs b/src/test/compile-fail/variance-regions-direct.rs index 04389b67db..da4d6c7522 100644 --- a/src/test/compile-fail/variance-regions-direct.rs +++ b/src/test/compile-fail/variance-regions-direct.rs @@ -11,6 +11,8 @@ // Test that we correctly infer variance for region parameters in // various self-contained types. +#![feature(rustc_attrs)] + // Regions that just appear in normal spots are contravariant: #[rustc_variance] @@ -58,6 +60,7 @@ struct Test6<'a, 'b> { //~ ERROR regions=[[-, o];[];[]] #[rustc_variance] struct Test7<'a> { //~ ERROR regions=[[*];[];[]] + //~^ ERROR parameter `'a` is never used x: isize } diff --git a/src/test/compile-fail/variance-regions-indirect.rs b/src/test/compile-fail/variance-regions-indirect.rs index e2c7958b31..9beb90d0b2 100644 --- a/src/test/compile-fail/variance-regions-indirect.rs +++ b/src/test/compile-fail/variance-regions-indirect.rs @@ -12,8 +12,11 @@ // case that involve multiple intricate types. // Try enums too. +#![feature(rustc_attrs)] + #[rustc_variance] enum Base<'a, 'b, 'c:'b, 'd> { //~ ERROR regions=[[+, -, o, *];[];[]] + //~^ ERROR parameter `'d` is never used Test8A(extern "Rust" fn(&'a isize)), Test8B(&'b [isize]), Test8C(&'b mut &'c str), @@ -21,16 +24,19 @@ enum Base<'a, 'b, 'c:'b, 'd> { //~ ERROR regions=[[+, -, o, *];[];[]] #[rustc_variance] struct Derived1<'w, 'x:'y, 'y, 'z> { //~ ERROR regions=[[*, o, -, +];[];[]] + //~^ ERROR parameter `'w` is never used f: Base<'z, 'y, 'x, 'w> } #[rustc_variance] // Combine - and + to yield o struct Derived2<'a, 'b:'a, 'c> { //~ ERROR regions=[[o, o, *];[];[]] + //~^ ERROR parameter `'c` is never used f: Base<'a, 'a, 'b, 'c> } #[rustc_variance] // Combine + and o to yield o (just pay attention to 'a here) struct Derived3<'a:'b, 'b, 'c> { //~ ERROR regions=[[o, -, *];[];[]] + //~^ ERROR parameter `'c` is never used f: Base<'a, 'b, 'a, 'c> } diff --git a/src/test/run-pass/regions-infer-bivariance.rs b/src/test/compile-fail/variance-regions-unused-direct.rs similarity index 55% rename from src/test/run-pass/regions-infer-bivariance.rs rename to src/test/compile-fail/variance-regions-unused-direct.rs index a3288e2e1b..396e776520 100644 --- a/src/test/run-pass/regions-infer-bivariance.rs +++ b/src/test/compile-fail/variance-regions-unused-direct.rs @@ -8,21 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Test that a type whose lifetime parameters is never used is -// inferred to be bivariant. +// Test that disallow lifetime parameters that are unused. use std::marker; -struct Bivariant<'a>; +struct Bivariant<'a>; //~ ERROR parameter `'a` is never used -fn use1<'short,'long>(c: Bivariant<'short>, - _where:Option<&'short &'long ()>) { - let _: Bivariant<'long> = c; +struct Struct<'a, 'd> { //~ ERROR parameter `'d` is never used + field: &'a [i32] } -fn use2<'short,'long>(c: Bivariant<'long>, - _where:Option<&'short &'long ()>) { - let _: Bivariant<'short> = c; +trait Trait<'a, 'd> { //~ ERROR parameter `'d` is never used + fn method(&'a self); } -pub fn main() {} +fn main() {} diff --git a/src/test/compile-fail/variance-regions-unused-indirect.rs b/src/test/compile-fail/variance-regions-unused-indirect.rs new file mode 100644 index 0000000000..2d234ed7b5 --- /dev/null +++ b/src/test/compile-fail/variance-regions-unused-indirect.rs @@ -0,0 +1,21 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that disallow lifetime parameters that are unused. + +enum Foo<'a> { //~ ERROR parameter `'a` is never used + Foo1(Bar<'a>) +} + +enum Bar<'a> { //~ ERROR parameter `'a` is never used + Bar1(Foo<'a>) +} + +fn main() {} diff --git a/src/test/compile-fail/variance-trait-bounds.rs b/src/test/compile-fail/variance-trait-bounds.rs new file mode 100644 index 0000000000..88b50058b6 --- /dev/null +++ b/src/test/compile-fail/variance-trait-bounds.rs @@ -0,0 +1,65 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![deny(bivariance)] +#![allow(dead_code)] +#![feature(rustc_attrs)] + +// Check that bounds on type parameters (other than `Self`) do not +// influence variance. + +#[rustc_variance] +trait Getter { //~ ERROR types=[[+];[-];[]] + fn get(&self) -> T; +} + +#[rustc_variance] +trait Setter { //~ ERROR types=[[-];[-];[]] + fn get(&self, T); +} + +#[rustc_variance] +struct TestStruct> { //~ ERROR types=[[+, +];[];[]] + t: T, u: U +} + +#[rustc_variance] +enum TestEnum> {//~ ERROR types=[[*, +];[];[]] + //~^ ERROR parameter `U` is never used + Foo(T) +} + +#[rustc_variance] +trait TestTrait> { //~ ERROR types=[[-, +];[-];[]] + fn getter(&self, u: U) -> T; +} + +#[rustc_variance] +trait TestTrait2 : Getter { //~ ERROR types=[[+];[-];[]] +} + +#[rustc_variance] +trait TestTrait3 { //~ ERROR types=[[-];[-];[]] + fn getter>(&self); +} + +#[rustc_variance] +struct TestContraStruct> { //~ ERROR types=[[*, +];[];[]] + //~^ ERROR parameter `U` is never used + t: T +} + +#[rustc_variance] +struct TestBox+Setter> { //~ ERROR types=[[*, +];[];[]] + //~^ ERROR parameter `U` is never used + t: T +} + +pub fn main() { } diff --git a/src/test/compile-fail/variance-trait-object-bound.rs b/src/test/compile-fail/variance-trait-object-bound.rs index c61f2ff79c..f0ca1edd56 100644 --- a/src/test/compile-fail/variance-trait-object-bound.rs +++ b/src/test/compile-fail/variance-trait-object-bound.rs @@ -14,9 +14,11 @@ // // Issue #18262. +#![feature(rustc_attrs)] + use std::mem; -trait T { fn foo(); } +trait T { fn foo(&self); } #[rustc_variance] struct TOption<'a> { //~ ERROR regions=[[-];[];[]] diff --git a/src/test/compile-fail/variance-types-bounds.rs b/src/test/compile-fail/variance-types-bounds.rs new file mode 100644 index 0000000000..d53e4cd761 --- /dev/null +++ b/src/test/compile-fail/variance-types-bounds.rs @@ -0,0 +1,76 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we correctly infer variance for type parameters in +// various types and traits. + +#![feature(rustc_attrs)] + +#[rustc_variance] +struct TestImm { //~ ERROR types=[[+, +];[];[]] + x: A, + y: B, +} + +#[rustc_variance] +struct TestMut { //~ ERROR types=[[+, o];[];[]] + x: A, + y: &'static mut B, +} + +#[rustc_variance] +struct TestIndirect { //~ ERROR types=[[+, o];[];[]] + m: TestMut +} + +#[rustc_variance] +struct TestIndirect2 { //~ ERROR types=[[o, o];[];[]] + n: TestMut, + m: TestMut +} + +#[rustc_variance] +trait Getter { //~ ERROR types=[[+];[-];[]] + fn get(&self) -> A; +} + +#[rustc_variance] +trait Setter { //~ ERROR types=[[-];[o];[]] + fn set(&mut self, a: A); +} + +#[rustc_variance] +trait GetterSetter { //~ ERROR types=[[o];[o];[]] + fn get(&self) -> A; + fn set(&mut self, a: A); +} + +#[rustc_variance] +trait GetterInTypeBound { //~ ERROR types=[[-];[-];[]] + // Here, the use of `A` in the method bound *does* affect + // variance. Think of it as if the method requested a dictionary + // for `T:Getter`. Since this dictionary is an input, it is + // contravariant, and the Getter is covariant w/r/t A, yielding an + // overall contravariant result. + fn do_it>(&self); +} + +#[rustc_variance] +trait SetterInTypeBound { //~ ERROR types=[[+];[-];[]] + fn do_it>(&self); +} + +#[rustc_variance] +struct TestObject { //~ ERROR types=[[-, +];[];[]] + n: Box+Send>, + m: Box+Send>, +} + +fn main() {} diff --git a/src/test/compile-fail/variance-types.rs b/src/test/compile-fail/variance-types.rs new file mode 100644 index 0000000000..e407ebe345 --- /dev/null +++ b/src/test/compile-fail/variance-types.rs @@ -0,0 +1,52 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![deny(bivariance)] +#![allow(dead_code)] +#![feature(rustc_attrs)] + +use std::cell::Cell; + +// Check that a type parameter which is only used in a trait bound is +// not considered bivariant. + +#[rustc_variance] +struct InvariantMut<'a,A:'a,B:'a> { //~ ERROR types=[[o, o];[];[]], regions=[[-];[];[]] + t: &'a mut (A,B) +} + +#[rustc_variance] +struct InvariantCell { //~ ERROR types=[[o];[];[]] + t: Cell +} + +#[rustc_variance] +struct InvariantIndirect { //~ ERROR types=[[o];[];[]] + t: InvariantCell +} + +#[rustc_variance] +struct Covariant { //~ ERROR types=[[+];[];[]] + t: A, u: fn() -> A +} + +#[rustc_variance] +struct Contravariant { //~ ERROR types=[[-];[];[]] + t: fn(A) +} + +#[rustc_variance] +enum Enum { //~ ERROR types=[[+, -, o];[];[]] + Foo(Covariant), + Bar(Contravariant), + Zed(Covariant,Contravariant) +} + +pub fn main() { } diff --git a/src/test/compile-fail/variance-unused-region-param.rs b/src/test/compile-fail/variance-unused-region-param.rs new file mode 100644 index 0000000000..5f50422637 --- /dev/null +++ b/src/test/compile-fail/variance-unused-region-param.rs @@ -0,0 +1,17 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we report an error for unused type parameters in types. + +struct SomeStruct<'a> { x: u32 } //~ ERROR parameter `'a` is never used +enum SomeEnum<'a> { Nothing } //~ ERROR parameter `'a` is never used +trait SomeTrait<'a> { fn foo(&self); } //~ ERROR parameter `'a` is never used + +fn main() {} diff --git a/src/test/compile-fail/variance-unused-type-param.rs b/src/test/compile-fail/variance-unused-type-param.rs new file mode 100644 index 0000000000..2e867ec3c9 --- /dev/null +++ b/src/test/compile-fail/variance-unused-type-param.rs @@ -0,0 +1,36 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(dead_code)] + +// Test that we report an error for unused type parameters in types and traits, +// and that we offer a helpful suggestion. + +struct SomeStruct { x: u32 } +//~^ ERROR parameter `A` is never used +//~| HELP PhantomData + +enum SomeEnum { Nothing } +//~^ ERROR parameter `A` is never used +//~| HELP PhantomData + +trait SomeTrait { fn foo(&self); } +//~^ ERROR parameter `A` is never used +//~| HELP PhantomFn + +// Here T might *appear* used, but in fact it isn't. +enum ListCell { +//~^ ERROR parameter `T` is never used +//~| HELP PhantomData + Cons(Box>), + Nil +} + +fn main() {} diff --git a/src/test/compile-fail/variance-use-contravariant-struct-1.rs b/src/test/compile-fail/variance-use-contravariant-struct-1.rs new file mode 100644 index 0000000000..d2fd297875 --- /dev/null +++ b/src/test/compile-fail/variance-use-contravariant-struct-1.rs @@ -0,0 +1,26 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test various uses of structs with distint variances to make sure +// they permit lifetimes to be approximated as expected. + +#![feature(rustc_attrs)] + +struct SomeStruct(fn(T)); + +fn foo<'min,'max>(v: SomeStruct<&'max ()>) + -> SomeStruct<&'min ()> + where 'max : 'min +{ + v //~ ERROR mismatched types +} + +#[rustc_error] +fn main() { } diff --git a/src/test/compile-fail/variance-use-contravariant-struct-2.rs b/src/test/compile-fail/variance-use-contravariant-struct-2.rs new file mode 100644 index 0000000000..b38fd0e9ff --- /dev/null +++ b/src/test/compile-fail/variance-use-contravariant-struct-2.rs @@ -0,0 +1,27 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test various uses of structs with distint variances to make sure +// they permit lifetimes to be approximated as expected. + +#![allow(dead_code)] +#![feature(rustc_attrs)] + +struct SomeStruct(fn(T)); + +fn bar<'min,'max>(v: SomeStruct<&'min ()>) + -> SomeStruct<&'max ()> + where 'max : 'min +{ + v +} + +#[rustc_error] +fn main() { } //~ ERROR compilation successful diff --git a/src/test/compile-fail/variance-use-covariant-struct-1.rs b/src/test/compile-fail/variance-use-covariant-struct-1.rs new file mode 100644 index 0000000000..2631cfc05e --- /dev/null +++ b/src/test/compile-fail/variance-use-covariant-struct-1.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that a covariant struct does not permit the lifetime of a +// reference to be enlarged. + +struct SomeStruct(T); + +fn foo<'min,'max>(v: SomeStruct<&'min ()>) + -> SomeStruct<&'max ()> + where 'max : 'min +{ + v //~ ERROR mismatched types +} + +fn main() { } diff --git a/src/test/compile-fail/variance-use-covariant-struct-2.rs b/src/test/compile-fail/variance-use-covariant-struct-2.rs new file mode 100644 index 0000000000..d8e1a5f5f1 --- /dev/null +++ b/src/test/compile-fail/variance-use-covariant-struct-2.rs @@ -0,0 +1,26 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that a covariant struct permits the lifetime of a reference to +// be shortened. + +#![allow(dead_code)] +#![feature(rustc_attrs)] + +struct SomeStruct(T); + +fn foo<'min,'max>(v: SomeStruct<&'max ()>) + -> SomeStruct<&'min ()> + where 'max : 'min +{ + v +} + +#[rustc_error] fn main() { } //~ ERROR compilation successful diff --git a/src/test/compile-fail/variance-use-invariant-struct-1.rs b/src/test/compile-fail/variance-use-invariant-struct-1.rs new file mode 100644 index 0000000000..c89436b209 --- /dev/null +++ b/src/test/compile-fail/variance-use-invariant-struct-1.rs @@ -0,0 +1,33 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test various uses of structs with distint variances to make sure +// they permit lifetimes to be approximated as expected. + +#![feature(rustc_attrs)] + +struct SomeStruct(*mut T); + +fn foo<'min,'max>(v: SomeStruct<&'max ()>) + -> SomeStruct<&'min ()> + where 'max : 'min +{ + v //~ ERROR mismatched types +} + +fn bar<'min,'max>(v: SomeStruct<&'min ()>) + -> SomeStruct<&'max ()> + where 'max : 'min +{ + v //~ ERROR mismatched types +} + +#[rustc_error] +fn main() { } diff --git a/src/test/compile-fail/vec-must-not-hide-type-from-dropck.rs b/src/test/compile-fail/vec-must-not-hide-type-from-dropck.rs new file mode 100644 index 0000000000..6aaf51278a --- /dev/null +++ b/src/test/compile-fail/vec-must-not-hide-type-from-dropck.rs @@ -0,0 +1,135 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Checking that `Vec` cannot hide lifetimes within `T` when `T` +// implements `Drop` and might access methods of values that have +// since been deallocated. +// +// In this case, the values in question hold (non-zero) unique-ids +// that zero themselves out when dropped, and are wrapped in another +// type with a destructor that asserts that the ids it references are +// indeed non-zero (i.e., effectively checking that the id's are not +// dropped while there are still any outstanding references). +// +// However, the values in question are also formed into a +// cyclic-structure, ensuring that there is no way for all of the +// conditions above to be satisfied, meaning that if the dropck is +// sound, it should reject this code. + +#![feature(unsafe_destructor)] + +use std::cell::Cell; +use id::Id; + +mod s { + #![allow(unstable)] + use std::sync::atomic::{AtomicUint, ATOMIC_UINT_INIT, Ordering}; + + static S_COUNT: AtomicUint = ATOMIC_UINT_INIT; + + /// generates globally unique count (global across the current + /// process, that is) + pub fn next_count() -> usize { + S_COUNT.fetch_add(1, Ordering::SeqCst) + 1 + } +} + +mod id { + use s; + + /// Id represents a globally unique identifier (global across the + /// current process, that is). When dropped, it automatically + /// clears its `count` field, but leaves `orig_count` untouched, + /// so that if there are subsequent (erroneous) invocations of its + /// method (which is unsound), we can observe it by seeing that + /// the `count` is 0 while the `orig_count` is non-zero. + #[derive(Debug)] + pub struct Id { + orig_count: usize, + count: usize, + } + + impl Id { + /// Creates an `Id` with a globally unique count. + pub fn new() -> Id { + let c = s::next_count(); + println!("building Id {}", c); + Id { orig_count: c, count: c } + } + /// returns the `count` of self; should be non-zero if + /// everything is working. + pub fn count(&self) -> usize { + println!("Id::count on {} returns {}", self.orig_count, self.count); + self.count + } + } + + impl Drop for Id { + fn drop(&mut self) { + println!("dropping Id {}", self.count); + self.count = 0; + } + } +} + +trait HasId { + fn count(&self) -> usize; +} + +#[derive(Debug)] +struct CheckId { + v: T +} + +#[allow(non_snake_case)] +fn CheckId(t: T) -> CheckId { CheckId{ v: t } } + +#[unsafe_destructor] +impl Drop for CheckId { + fn drop(&mut self) { + assert!(self.v.count() > 0); + } +} + +#[derive(Debug)] +struct C<'a> { + id: Id, + v: Vec>>>>, +} + +impl<'a> HasId for Cell>> { + fn count(&self) -> usize { + match self.get() { + None => 1, + Some(c) => c.id.count(), + } + } +} + +impl<'a> C<'a> { + fn new() -> C<'a> { + C { id: Id::new(), v: Vec::new() } + } +} + +fn f() { + let (mut c1, mut c2); + c1 = C::new(); + c2 = C::new(); + + c1.v.push(CheckId(Cell::new(None))); + c2.v.push(CheckId(Cell::new(None))); + c1.v[0].v.set(Some(&c2)); //~ ERROR `c2` does not live long enough + c2.v[0].v.set(Some(&c1)); //~ ERROR `c1` does not live long enough +} + +fn main() { + f(); +} diff --git a/src/test/compile-fail/vec-mut-iter-borrow.rs b/src/test/compile-fail/vec-mut-iter-borrow.rs index 59c490f2ff..023ef72c45 100644 --- a/src/test/compile-fail/vec-mut-iter-borrow.rs +++ b/src/test/compile-fail/vec-mut-iter-borrow.rs @@ -11,7 +11,7 @@ fn main() { let mut xs: Vec = vec!(); - for x in xs.iter_mut() { - xs.push(1is) //~ ERROR cannot borrow `xs` + for x in &mut xs { + xs.push(1) //~ ERROR cannot borrow `xs` } } diff --git a/src/test/compile-fail/vec-res-add.rs b/src/test/compile-fail/vec-res-add.rs index 97a684b245..cf64486c9c 100644 --- a/src/test/compile-fail/vec-res-add.rs +++ b/src/test/compile-fail/vec-res-add.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(Show)] +#[derive(Debug)] struct r { i:isize } diff --git a/src/test/compile-fail/vec_refs_data_with_early_death.rs b/src/test/compile-fail/vec_refs_data_with_early_death.rs new file mode 100644 index 0000000000..a191b3e56c --- /dev/null +++ b/src/test/compile-fail/vec_refs_data_with_early_death.rs @@ -0,0 +1,31 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// This test is a simple example of code that violates the dropck +// rules: it pushes `&x` and `&y` into `v`, but the referenced data +// will be dropped before the vector itself is. + +// (In principle we know that `Vec` does not reference the data it +// owns from within its drop code, apart from calling drop on each +// element it owns; thus, for data like this, it seems like we could +// loosen the restrictions here if we wanted. But it also is not +// clear whether such loosening is terribly important.) + +fn main() { + let mut v = Vec::new(); + + let x: i8 = 3; + let y: i8 = 4; + + v.push(&x); //~ ERROR `x` does not live long enough + v.push(&y); //~ ERROR `y` does not live long enough + + assert_eq!(v.as_slice(), [&3, &4]); +} diff --git a/src/test/compile-fail/visible-private-types-generics.rs b/src/test/compile-fail/visible-private-types-generics.rs index 7ff18f8e08..1f2205b5c7 100644 --- a/src/test/compile-fail/visible-private-types-generics.rs +++ b/src/test/compile-fail/visible-private-types-generics.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Foo {} +trait Foo { + fn dummy(&self) { } +} pub fn f< T diff --git a/src/test/compile-fail/visible-private-types-supertrait.rs b/src/test/compile-fail/visible-private-types-supertrait.rs index dc6d446154..9d9eae4a07 100644 --- a/src/test/compile-fail/visible-private-types-supertrait.rs +++ b/src/test/compile-fail/visible-private-types-supertrait.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Foo {} +trait Foo { + fn dummy(&self) { } +} pub trait Bar : Foo {} //~ ERROR private trait in exported type diff --git a/src/test/compile-fail/vtable-res-trait-param.rs b/src/test/compile-fail/vtable-res-trait-param.rs index bbe88379aa..cc6ff2d8eb 100644 --- a/src/test/compile-fail/vtable-res-trait-param.rs +++ b/src/test/compile-fail/vtable-res-trait-param.rs @@ -23,11 +23,11 @@ impl TraitB for isize { } fn call_it(b: B) -> isize { - let y = 4us; + let y = 4_usize; b.gimme_an_a(y) //~ ERROR the trait `TraitA` is not implemented } fn main() { - let x = 3is; + let x = 3; assert_eq!(call_it(x), 22); } diff --git a/src/test/compile-fail/warn-path-statement.rs b/src/test/compile-fail/warn-path-statement.rs index 304900df77..892d82d093 100644 --- a/src/test/compile-fail/warn-path-statement.rs +++ b/src/test/compile-fail/warn-path-statement.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: -D path-statement +// compile-flags: -D path-statements fn main() { - let x = 10is; + let x = 10; x; //~ ERROR path statement with no effect } diff --git a/src/test/compile-fail/weak-lang-item.rs b/src/test/compile-fail/weak-lang-item.rs index baac192cbf..42df43934a 100644 --- a/src/test/compile-fail/weak-lang-item.rs +++ b/src/test/compile-fail/weak-lang-item.rs @@ -13,6 +13,7 @@ // error-pattern: language item required, but not found: `stack_exhausted` // error-pattern: language item required, but not found: `eh_personality` +#![feature(no_std)] #![no_std] extern crate core; diff --git a/src/test/compile-fail/where-clause-method-substituion.rs b/src/test/compile-fail/where-clause-method-substituion.rs index a5108f005d..bf614e6eb5 100644 --- a/src/test/compile-fail/where-clause-method-substituion.rs +++ b/src/test/compile-fail/where-clause-method-substituion.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Foo {} +trait Foo { + fn dummy(&self, t: T) { } +} trait Bar { fn method(&self) where A: Foo; diff --git a/src/test/compile-fail/where-clauses-not-parameter.rs b/src/test/compile-fail/where-clauses-not-parameter.rs index 5573464c5a..7968cc3709 100644 --- a/src/test/compile-fail/where-clauses-not-parameter.rs +++ b/src/test/compile-fail/where-clauses-not-parameter.rs @@ -21,7 +21,7 @@ fn test2() -> bool where Option : Eq {} #[derive(PartialEq)] //~^ ERROR cannot bound type `isize`, where clause bounds -enum Foo where isize : Eq { MkFoo } +enum Foo where isize : Eq { MkFoo(T) } //~^ ERROR cannot bound type `isize`, where clause bounds fn test3() -> bool where Option> : Eq {} @@ -31,7 +31,7 @@ fn test4() -> bool where Option> : Eq {} trait Baz where isize : Eq { //~^ ERROR cannot bound type `isize`, where clause bounds may only - fn baz() where String : Eq; //~ ERROR cannot bound type `collections::string::String` + fn baz(&self, t: T) where String : Eq; //~ ERROR cannot bound type `collections::string::String` //~^ ERROR cannot bound type `isize`, where clause } @@ -41,5 +41,5 @@ impl Baz for isize where isize : Eq { } fn main() { - equal(&0is, &0is); + equal(&0, &0); } diff --git a/src/test/compile-fail/where-for-self-2.rs b/src/test/compile-fail/where-for-self-2.rs new file mode 100644 index 0000000000..cd5240198b --- /dev/null +++ b/src/test/compile-fail/where-for-self-2.rs @@ -0,0 +1,33 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we can quantify lifetimes outside a constraint (i.e., including +// the self type) in a where clause. Specifically, test that implementing for a +// specific lifetime is not enough to satisify the `for<'a> ...` constraint, which +// should require *all* lifetimes. + +static X: &'static u32 = &42; + +trait Bar { + fn bar(&self); +} + +impl Bar for &'static u32 { + fn bar(&self) {} +} + +fn foo(x: &T) + where for<'a> &'a T: Bar +{} + +fn main() { + foo(&X); + //~^ error: `for<'a> Bar` is not implemented +} diff --git a/src/test/compile-fail/where-for-self.rs b/src/test/compile-fail/where-for-self.rs new file mode 100644 index 0000000000..8f447face4 --- /dev/null +++ b/src/test/compile-fail/where-for-self.rs @@ -0,0 +1,29 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we can quantify lifetimes outside a constraint (i.e., including +// the self type) in a where clause. Specifically, test that we cannot nest +// quantification in constraints (to be clear, there is no reason this should not +// we're testing we don't crash or do something stupid). + +trait Bar<'a> { + fn bar(&self); +} + +impl<'a, 'b> Bar<'b> for &'a u32 { + fn bar(&self) {} +} + +fn foo(x: &T) + where for<'a> &'a T: for<'b> Bar<'b> + //~^ error: nested quantification of lifetimes +{} + +fn main() {} diff --git a/src/test/compile-fail/while-let.rs b/src/test/compile-fail/while-let.rs index 45e0d0aaea..a70dcccd4e 100644 --- a/src/test/compile-fail/while-let.rs +++ b/src/test/compile-fail/while-let.rs @@ -20,16 +20,16 @@ fn macros() { }} } - foo!(a, 1is, { //~ ERROR irrefutable while-let + foo!(a, 1, { //~ ERROR irrefutable while-let println!("irrefutable pattern"); }); - bar!(a, 1is, { //~ ERROR irrefutable while-let + bar!(a, 1, { //~ ERROR irrefutable while-let println!("irrefutable pattern"); }); } pub fn main() { - while let a = 1is { //~ ERROR irrefutable while-let + while let a = 1 { //~ ERROR irrefutable while-let println!("irrefutable pattern"); } } diff --git a/src/test/compile-fail/wrong-mul-method-signature.rs b/src/test/compile-fail/wrong-mul-method-signature.rs index e6fbcf2d38..21c249c0e1 100644 --- a/src/test/compile-fail/wrong-mul-method-signature.rs +++ b/src/test/compile-fail/wrong-mul-method-signature.rs @@ -24,7 +24,7 @@ impl Mul for Vec1 { type Output = Vec1; fn mul(self, s: &f64) -> Vec1 { - //~^ ERROR: method `mul` has an incompatible type for trait: expected f64, found &-ptr + //~^ ERROR method `mul` has an incompatible type for trait Vec1 { x: self.x * *s } @@ -41,7 +41,7 @@ impl Mul for Vec2 { type Output = f64; fn mul(self, s: f64) -> Vec2 { - //~^ ERROR: method `mul` has an incompatible type for trait: expected struct Vec2, found f64 + //~^ ERROR method `mul` has an incompatible type for trait Vec2 { x: self.x * s, y: self.y * s @@ -60,7 +60,7 @@ impl Mul for Vec3 { type Output = i32; fn mul(self, s: f64) -> f64 { - //~^ ERROR: method `mul` has an incompatible type for trait: expected i32, found f64 + //~^ ERROR method `mul` has an incompatible type for trait s } } @@ -72,7 +72,15 @@ pub fn main() { let x: Vec2 = Vec2 { x: 1.0, y: 2.0 } * 2.0; // trait had reversed order //~^ ERROR mismatched types - //~^^ ERROR mismatched types + //~| expected `Vec2` + //~| found `_` + //~| expected struct `Vec2` + //~| found floating-point variable + //~| ERROR mismatched types + //~| expected `Vec2` + //~| found `f64` + //~| expected struct `Vec2` + //~| found f64 let x: i32 = Vec3 { x: 1.0, y: 2.0, z: 3.0 } * 2.0; } diff --git a/src/test/debuginfo/associated-types.rs b/src/test/debuginfo/associated-types.rs new file mode 100644 index 0000000000..26117e7a13 --- /dev/null +++ b/src/test/debuginfo/associated-types.rs @@ -0,0 +1,151 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// min-lldb-version: 310 + +// compile-flags:-g + +// === GDB TESTS =================================================================================== +// gdb-command:run + +// gdb-command:print arg +// gdb-check:$1 = {b = -1, b1 = 0} +// gdb-command:continue + +// gdb-command:print inferred +// gdb-check:$2 = 1 +// gdb-command:print explicitly +// gdb-check:$3 = 1 +// gdb-command:continue + +// gdb-command:print arg +// gdb-check:$4 = 2 +// gdb-command:continue + +// gdb-command:print arg +// gdb-check:$5 = {4, 5} +// gdb-command:continue + +// gdb-command:print a +// gdb-check:$6 = 6 +// gdb-command:print b +// gdb-check:$7 = 7 +// gdb-command:continue + +// gdb-command:print a +// gdb-check:$8 = 8 +// gdb-command:print b +// gdb-check:$9 = 9 +// gdb-command:continue + +// === LLDB TESTS ================================================================================== +// lldb-command:run + +// lldb-command:print arg +// lldb-check:[...]$0 = Struct { b: -1, b1: 0 } +// lldb-command:continue + +// lldb-command:print inferred +// lldb-check:[...]$1 = 1 +// lldb-command:print explicitly +// lldb-check:[...]$2 = 1 +// lldb-command:continue + +// lldb-command:print arg +// lldb-check:[...]$3 = 2 +// lldb-command:continue + +// lldb-command:print arg +// lldb-check:[...]$4 = (4, 5) +// lldb-command:continue + +// lldb-command:print a +// lldb-check:[...]$5 = 6 +// lldb-command:print b +// lldb-check:[...]$6 = 7 +// lldb-command:continue + +// lldb-command:print a +// lldb-check:[...]$7 = 8 +// lldb-command:print b +// lldb-check:[...]$8 = 9 +// lldb-command:continue + +#![allow(unused_variables)] +#![allow(dead_code)] +#![omit_gdb_pretty_printer_section] + +trait TraitWithAssocType { + type Type; + + fn get_value(&self) -> Self::Type; +} +impl TraitWithAssocType for i32 { + type Type = i64; + + fn get_value(&self) -> i64 { *self as i64 } +} + +struct Struct { + b: T, + b1: T::Type, +} + +enum Enum { + Variant1(T, T::Type), + Variant2(T::Type, T) +} + +fn assoc_struct(arg: Struct) { + zzz(); // #break +} + +fn assoc_local(x: T) { + let inferred = x.get_value(); + let explicitly: T::Type = x.get_value(); + + zzz(); // #break +} + +fn assoc_arg(arg: T::Type) { + zzz(); // #break +} + +fn assoc_return_value(arg: T) -> T::Type { + return arg.get_value(); +} + +fn assoc_tuple(arg: (T, T::Type)) { + zzz(); // #break +} + +fn assoc_enum(arg: Enum) { + + match arg { + Enum::Variant1(a, b) => { + zzz(); // #break + } + Enum::Variant2(a, b) => { + zzz(); // #break + } + } +} + +fn main() { + assoc_struct(Struct { b: -1i32, b1: 0i64 }); + assoc_local(1i32); + assoc_arg::(2i64); + assoc_return_value(3i32); + assoc_tuple((4i32, 5i64)); + assoc_enum(Enum::Variant1(6i32, 7i64)); + assoc_enum(Enum::Variant2(8i64, 9i32)); +} + +fn zzz() { () } diff --git a/src/test/debuginfo/basic-types-globals-metadata.rs b/src/test/debuginfo/basic-types-globals-metadata.rs index e9f801c5f0..30a70fe0b3 100644 --- a/src/test/debuginfo/basic-types-globals-metadata.rs +++ b/src/test/debuginfo/basic-types-globals-metadata.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -47,26 +46,26 @@ #![allow(dead_code)] #![omit_gdb_pretty_printer_section] - -static B: bool = false; -static I: int = -1; -static C: char = 'a'; -static I8: i8 = 68; -static I16: i16 = -16; -static I32: i32 = -32; -static I64: i64 = -64; -static U: uint = 1; -static U8: u8 = 100; -static U16: u16 = 16; -static U32: u32 = 32; -static U64: u64 = 64; -static F32: f32 = 2.5; -static F64: f64 = 3.5; +// 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 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 U8: u8 = 100; +static mut U16: u16 = 16; +static mut U32: u32 = 32; +static mut U64: u64 = 64; +static mut F32: f32 = 2.5; +static mut F64: f64 = 3.5; fn main() { _zzz(); // #break - let a = (B, I, C, I8, I16, I32, I64, U, U8, U16, U32, U64, F32, F64); + let a = unsafe { (B, I, C, I8, I16, I32, I64, U, U8, U16, U32, U64, F32, F64) }; } fn _zzz() {()} diff --git a/src/test/debuginfo/basic-types-globals.rs b/src/test/debuginfo/basic-types-globals.rs index a4d4ddfea5..cb89879481 100644 --- a/src/test/debuginfo/basic-types-globals.rs +++ b/src/test/debuginfo/basic-types-globals.rs @@ -14,7 +14,6 @@ // about UTF-32 character encoding and will print a rust char as only // its numerical value. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -52,25 +51,26 @@ #![allow(unused_variables)] #![omit_gdb_pretty_printer_section] -static B: bool = false; -static I: int = -1; -static C: char = 'a'; -static I8: i8 = 68; -static I16: i16 = -16; -static I32: i32 = -32; -static I64: i64 = -64; -static U: uint = 1; -static U8: u8 = 100; -static U16: u16 = 16; -static U32: u32 = 32; -static U64: u64 = 64; -static F32: f32 = 2.5; -static F64: f64 = 3.5; +// 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 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 U8: u8 = 100; +static mut U16: u16 = 16; +static mut U32: u32 = 32; +static mut U64: u64 = 64; +static mut F32: f32 = 2.5; +static mut F64: f64 = 3.5; fn main() { _zzz(); // #break - let a = (B, I, C, I8, I16, I32, I64, U, U8, U16, U32, U64, F32, F64); + let a = unsafe { (B, I, C, I8, I16, I32, I64, U, U8, U16, U32, U64, F32, F64) }; } fn _zzz() {()} diff --git a/src/test/debuginfo/basic-types-metadata.rs b/src/test/debuginfo/basic-types-metadata.rs index 5e2497043d..0134a058c9 100644 --- a/src/test/debuginfo/basic-types-metadata.rs +++ b/src/test/debuginfo/basic-types-metadata.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -67,7 +66,7 @@ fn main() { let f32: f32 = 2.5; let f64: f64 = 3.5; _zzz(); // #break - if 1i == 1 { _yyy(); } + if 1 == 1 { _yyy(); } } fn _zzz() {()} diff --git a/src/test/debuginfo/basic-types-mut-globals.rs b/src/test/debuginfo/basic-types-mut-globals.rs index bc8cdaf8ea..7f82878e08 100644 --- a/src/test/debuginfo/basic-types-mut-globals.rs +++ b/src/test/debuginfo/basic-types-mut-globals.rs @@ -14,7 +14,6 @@ // about UTF-32 character encoding and will print a rust char as only // its numerical value. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/basic-types.rs b/src/test/debuginfo/basic-types.rs index f61f49228c..95483c1678 100644 --- a/src/test/debuginfo/basic-types.rs +++ b/src/test/debuginfo/basic-types.rs @@ -14,7 +14,6 @@ // about UTF-32 character encoding and will print a rust char as only // its numerical value. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/borrowed-basic.rs b/src/test/debuginfo/borrowed-basic.rs index f4c31278cf..52e81b7e04 100644 --- a/src/test/debuginfo/borrowed-basic.rs +++ b/src/test/debuginfo/borrowed-basic.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // Gdb doesn't know about UTF-32 character encoding and will print a rust char as only // its numerical value. diff --git a/src/test/debuginfo/borrowed-c-style-enum.rs b/src/test/debuginfo/borrowed-c-style-enum.rs index c2da58f158..ecc70f4d77 100644 --- a/src/test/debuginfo/borrowed-c-style-enum.rs +++ b/src/test/debuginfo/borrowed-c-style-enum.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // compile-flags:-g // min-lldb-version: 310 diff --git a/src/test/debuginfo/borrowed-enum.rs b/src/test/debuginfo/borrowed-enum.rs index d54869888f..87e9e7fe2d 100644 --- a/src/test/debuginfo/borrowed-enum.rs +++ b/src/test/debuginfo/borrowed-enum.rs @@ -9,7 +9,6 @@ // except according to those terms. // ignore-tidy-linelength -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/borrowed-struct.rs b/src/test/debuginfo/borrowed-struct.rs index 53d2befc49..2cfc6855e5 100644 --- a/src/test/debuginfo/borrowed-struct.rs +++ b/src/test/debuginfo/borrowed-struct.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // compile-flags:-g // min-lldb-version: 310 diff --git a/src/test/debuginfo/borrowed-tuple.rs b/src/test/debuginfo/borrowed-tuple.rs index c7e5987fbc..768bcc9fc3 100644 --- a/src/test/debuginfo/borrowed-tuple.rs +++ b/src/test/debuginfo/borrowed-tuple.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/borrowed-unique-basic.rs b/src/test/debuginfo/borrowed-unique-basic.rs index fc186a0b5b..14a3d008f4 100644 --- a/src/test/debuginfo/borrowed-unique-basic.rs +++ b/src/test/debuginfo/borrowed-unique-basic.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // Gdb doesn't know about UTF-32 character encoding and will print a rust char as only diff --git a/src/test/debuginfo/box.rs b/src/test/debuginfo/box.rs index 0439e3dc34..0689a6bc45 100644 --- a/src/test/debuginfo/box.rs +++ b/src/test/debuginfo/box.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -36,8 +35,8 @@ #![omit_gdb_pretty_printer_section] fn main() { - let a = box 1i; - let b = box() (2i, 3.5f64); + let a = box 1; + let b = box() (2, 3.5f64); zzz(); // #break } diff --git a/src/test/debuginfo/boxed-struct.rs b/src/test/debuginfo/boxed-struct.rs index 6397efa0a9..972d6ab12e 100644 --- a/src/test/debuginfo/boxed-struct.rs +++ b/src/test/debuginfo/boxed-struct.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/by-value-non-immediate-argument.rs b/src/test/debuginfo/by-value-non-immediate-argument.rs index 8ac8d5970f..3efda1e2f6 100644 --- a/src/test/debuginfo/by-value-non-immediate-argument.rs +++ b/src/test/debuginfo/by-value-non-immediate-argument.rs @@ -9,7 +9,6 @@ // except according to those terms. // ignore-tidy-linelength -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/by-value-self-argument-in-trait-impl.rs b/src/test/debuginfo/by-value-self-argument-in-trait-impl.rs index 6907313370..2b2a9bf83f 100644 --- a/src/test/debuginfo/by-value-self-argument-in-trait-impl.rs +++ b/src/test/debuginfo/by-value-self-argument-in-trait-impl.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/c-style-enum-in-composite.rs b/src/test/debuginfo/c-style-enum-in-composite.rs index f2dfc63d52..c7a4daa42f 100644 --- a/src/test/debuginfo/c-style-enum-in-composite.rs +++ b/src/test/debuginfo/c-style-enum-in-composite.rs @@ -9,7 +9,6 @@ // except according to those terms. // ignore-tidy-linelength -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/c-style-enum.rs b/src/test/debuginfo/c-style-enum.rs index ad7c860c8b..2305d7bc5c 100644 --- a/src/test/debuginfo/c-style-enum.rs +++ b/src/test/debuginfo/c-style-enum.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/closure-in-generic-function.rs b/src/test/debuginfo/closure-in-generic-function.rs index f8b1256940..b92f5de21b 100644 --- a/src/test/debuginfo/closure-in-generic-function.rs +++ b/src/test/debuginfo/closure-in-generic-function.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -51,7 +50,7 @@ fn some_generic_fun(a: T1, b: T2) -> (T2, T1) { - let closure = |&: x, y| { + let closure = |x, y| { zzz(); // #break (y, x) }; @@ -60,8 +59,8 @@ fn some_generic_fun(a: T1, b: T2) -> (T2, T1) { } fn main() { - some_generic_fun(0.5f64, 10i); - some_generic_fun(&29i, box 110i); + some_generic_fun(0.5f64, 10); + some_generic_fun(&29, box 110); } fn zzz() { () } diff --git a/src/test/debuginfo/constant-in-match-pattern.rs b/src/test/debuginfo/constant-in-match-pattern.rs new file mode 100644 index 0000000000..487c69a85d --- /dev/null +++ b/src/test/debuginfo/constant-in-match-pattern.rs @@ -0,0 +1,92 @@ +// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// ignore-android: FIXME(#10381) +// min-lldb-version: 310 + +// compile-flags:-g + +#![allow(unused_variables)] +#![allow(dead_code)] +#![omit_gdb_pretty_printer_section] + +// This test makes sure that the compiler doesn't crash when trying to assign +// debug locations to 'constant' patterns in match expressions. + +const CONSTANT: u64 = 3; + +struct Struct { + a: isize, + b: usize, +} +const STRUCT: Struct = Struct { a: 1, b: 2 }; + +struct TupleStruct(u32); +const TUPLE_STRUCT: TupleStruct = TupleStruct(4); + +enum Enum { + Variant1(char), + Variant2 { a: u8 }, + Variant3 +} +const VARIANT1: Enum = Enum::Variant1('v'); +const VARIANT2: Enum = Enum::Variant2 { a: 2 }; +const VARIANT3: Enum = Enum::Variant3; + +const STRING: &'static str = "String"; + +fn main() { + + match 1 { + CONSTANT => {} + _ => {} + }; + + // if let 3 = CONSTANT {} + + match (Struct { a: 2, b: 2 }) { + STRUCT => {} + _ => {} + }; + + // if let STRUCT = STRUCT {} + + match TupleStruct(3) { + TUPLE_STRUCT => {} + _ => {} + }; + + // if let TupleStruct(4) = TUPLE_STRUCT {} + + match VARIANT3 { + VARIANT1 => {}, + VARIANT2 => {}, + VARIANT3 => {}, + _ => {} + }; + + match (VARIANT3, VARIANT2) { + (VARIANT1, VARIANT3) => {}, + (VARIANT2, VARIANT2) => {}, + (VARIANT3, VARIANT1) => {}, + _ => {} + }; + + // if let VARIANT1 = Enum::Variant3 {} + // if let VARIANT2 = Enum::Variant3 {} + // if let VARIANT3 = Enum::Variant3 {} + + match "abc" { + STRING => {}, + _ => {} + } + + if let STRING = "def" {} +} diff --git a/src/test/debuginfo/cross-crate-type-uniquing.rs b/src/test/debuginfo/cross-crate-type-uniquing.rs index 5a56722f0c..47365b2b9a 100644 --- a/src/test/debuginfo/cross-crate-type-uniquing.rs +++ b/src/test/debuginfo/cross-crate-type-uniquing.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // aux-build:cross_crate_debuginfo_type_uniquing.rs diff --git a/src/test/debuginfo/destructured-fn-argument.rs b/src/test/debuginfo/destructured-fn-argument.rs index 73289c56be..51cced2043 100644 --- a/src/test/debuginfo/destructured-fn-argument.rs +++ b/src/test/debuginfo/destructured-fn-argument.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -311,6 +310,7 @@ // lldb-command:continue #![allow(unused_variables)] +#![feature(box_patterns)] #![feature(box_syntax)] #![omit_gdb_pretty_printer_section] diff --git a/src/test/debuginfo/destructured-for-loop-variable.rs b/src/test/debuginfo/destructured-for-loop-variable.rs index 103bdc0355..9f0492f35a 100644 --- a/src/test/debuginfo/destructured-for-loop-variable.rs +++ b/src/test/debuginfo/destructured-for-loop-variable.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -153,6 +152,7 @@ // lldb-command:continue #![allow(unused_variables)] +#![feature(box_patterns)] #![feature(box_syntax)] #![omit_gdb_pretty_printer_section] @@ -170,14 +170,14 @@ fn main() { z: true }; - for &Struct { x, y, z } in [s].iter() { + for &Struct { x, y, z } in &[s] { zzz(); // #break } let tuple: (i8, u8, i16, u16, i32, u32, i64, u64, f32, f64) = (0x6f, 0x70, -113, 114, -115, 116, -117, 118, 119.5, 120.5); - for &(_i8, _u8, _i16, _u16, _i32, _u32, _i64, _u64, _f32, _f64) in [tuple].iter() { + for &(_i8, _u8, _i16, _u16, _i32, _u32, _i64, _u64, _f32, _f64) in &[tuple] { zzz(); // #break } @@ -202,7 +202,7 @@ fn main() { zzz(); // #break } - for i in range(1234, 1235i) { + for i in 1234..1235 { zzz(); // #break } @@ -215,7 +215,7 @@ fn main() { zzz(); // #break } - for simple_tuple_ident in vec![(34903493u32, 232323i64)].into_iter() { + for simple_tuple_ident in vec![(34903493u32, 232323i64)] { zzz(); // #break } } diff --git a/src/test/debuginfo/destructured-local.rs b/src/test/debuginfo/destructured-local.rs index 1fd598e18c..cf0ca0b67a 100644 --- a/src/test/debuginfo/destructured-local.rs +++ b/src/test/debuginfo/destructured-local.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -244,6 +243,7 @@ #![allow(unused_variables)] +#![feature(box_patterns)] #![feature(box_syntax)] #![omit_gdb_pretty_printer_section] @@ -278,7 +278,7 @@ fn main() { let Struct { a: k, b: l } = Struct { a: 12, b: 13 }; // ignored tuple element - let (m, _, n) = (14i, 15i, 16i); + let (m, _, n) = (14, 15, 16); // ignored struct field let Struct { b: o, .. } = Struct { a: 17, b: 18 }; @@ -291,25 +291,25 @@ fn main() { // complex nesting let ((u, v), ((w, (x, Struct { a: y, b: z})), Struct { a: ae, b: oe }), ue) = - ((25i, 26i), ((27i, (28i, Struct { a: 29, b: 30})), Struct { a: 31, b: 32 }), 33i); + ((25, 26), ((27, (28, Struct { a: 29, b: 30})), Struct { a: 31, b: 32 }), 33); // reference - let &aa = &(34i, 35i); + let &aa = &(34, 35); // reference - let &bb = &(36i, 37i); + let &bb = &(36, 37); // contained reference - let (&cc, _) = (&38i, 39i); + let (&cc, _) = (&38, 39); // unique pointer - let box dd = box() (40i, 41i, 42i); + let box dd = box() (40, 41, 42); // ref binding - let ref ee = (43i, 44i, 45i); + let ref ee = (43, 44, 45); // ref binding in tuple - let (ref ff, gg) = (46i, (47i, 48i)); + let (ref ff, gg) = (46, (47, 48)); // ref binding in struct let Struct { b: ref hh, .. } = Struct { a: 49, b: 50 }; diff --git a/src/test/debuginfo/evec-in-struct.rs b/src/test/debuginfo/evec-in-struct.rs index f623a32192..1a9b9f73cb 100644 --- a/src/test/debuginfo/evec-in-struct.rs +++ b/src/test/debuginfo/evec-in-struct.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/function-arg-initialization.rs b/src/test/debuginfo/function-arg-initialization.rs index 55c5c50406..9eadf3cc19 100644 --- a/src/test/debuginfo/function-arg-initialization.rs +++ b/src/test/debuginfo/function-arg-initialization.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // This test case checks if function arguments already have the correct value when breaking at the @@ -226,7 +225,7 @@ #![omit_gdb_pretty_printer_section] fn immediate_args(a: int, b: bool, c: f64) { - ::std::io::print("") // #break + ::std::old_io::print("") // #break } struct BigStruct { @@ -241,21 +240,21 @@ struct BigStruct { } fn non_immediate_args(a: BigStruct, b: BigStruct) { - ::std::io::print("") // #break + ::std::old_io::print("") // #break } fn binding(a: i64, b: u64, c: f64) { - let x = 0i; // #break - ::std::io::print("") + let x = 0; // #break + ::std::old_io::print("") } fn assignment(mut a: u64, b: u64, c: f64) { a = b; // #break - ::std::io::print("") + ::std::old_io::print("") } fn function_call(x: u64, y: u64, z: f64) { - std::io::stdio::print("Hi!") // #break + std::old_io::stdio::print("Hi!") // #break } fn identifier(x: u64, y: u64, z: f64) -> u64 { diff --git a/src/test/debuginfo/function-arguments.rs b/src/test/debuginfo/function-arguments.rs index 01136c1101..2ab3668abb 100644 --- a/src/test/debuginfo/function-arguments.rs +++ b/src/test/debuginfo/function-arguments.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/function-prologue-stepping-no-stack-check.rs b/src/test/debuginfo/function-prologue-stepping-no-stack-check.rs index e437e35db3..8d456f3343 100644 --- a/src/test/debuginfo/function-prologue-stepping-no-stack-check.rs +++ b/src/test/debuginfo/function-prologue-stepping-no-stack-check.rs @@ -249,7 +249,7 @@ #[no_stack_check] fn immediate_args(a: int, b: bool, c: f64) { - ::std::io::print(""); + ::std::old_io::print(""); } struct BigStruct { @@ -265,24 +265,24 @@ struct BigStruct { #[no_stack_check] fn non_immediate_args(a: BigStruct, b: BigStruct) { - ::std::io::print(""); + ::std::old_io::print(""); } #[no_stack_check] fn binding(a: i64, b: u64, c: f64) { - let x = 0i; - ::std::io::print(""); + let x = 0; + ::std::old_io::print(""); } #[no_stack_check] fn assignment(mut a: u64, b: u64, c: f64) { a = b; - ::std::io::print(""); + ::std::old_io::print(""); } #[no_stack_check] fn function_call(x: u64, y: u64, z: f64) { - std::io::stdio::print("Hi!") + std::old_io::stdio::print("Hi!") } #[no_stack_check] diff --git a/src/test/debuginfo/function-prologue-stepping-regular.rs b/src/test/debuginfo/function-prologue-stepping-regular.rs index 05ea357389..14433fbcd2 100644 --- a/src/test/debuginfo/function-prologue-stepping-regular.rs +++ b/src/test/debuginfo/function-prologue-stepping-regular.rs @@ -148,7 +148,7 @@ fn non_immediate_args(a: BigStruct, b: BigStruct) { } fn binding(a: i64, b: u64, c: f64) { - let x = 0i; + let x = 0; } fn assignment(mut a: u64, b: u64, c: f64) { @@ -156,7 +156,7 @@ fn assignment(mut a: u64, b: u64, c: f64) { } fn function_call(x: u64, y: u64, z: f64) { - std::io::stdio::print("Hi!") + std::old_io::stdio::print("Hi!") } fn identifier(x: u64, y: u64, z: f64) -> u64 { diff --git a/src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs b/src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs index 092cd9edc7..aa902a9b2d 100644 --- a/src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs +++ b/src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs @@ -13,6 +13,7 @@ // gdb-pretty-struct-and-enums.rs // ignore-windows failing on win32 bot +// ignore-freebsd: gdb package too new // ignore-tidy-linelength // ignore-lldb // ignore-android: FIXME(#10381) diff --git a/src/test/debuginfo/gdb-pretty-struct-and-enums.rs b/src/test/debuginfo/gdb-pretty-struct-and-enums.rs index 4b2628b2a1..d47dee14f5 100644 --- a/src/test/debuginfo/gdb-pretty-struct-and-enums.rs +++ b/src/test/debuginfo/gdb-pretty-struct-and-enums.rs @@ -9,6 +9,7 @@ // except according to those terms. // ignore-windows failing on win32 bot +// ignore-freebsd: output doesn't match // ignore-tidy-linelength // ignore-lldb // ignore-android: FIXME(#10381) @@ -138,7 +139,7 @@ fn main() { let mixed_enum_tuple_var = MixedEnumTupleVar(106, 107, false); let mixed_enum_struct_var = MixedEnumStructVar { field1: 108.5, field2: 109 }; - let some = Some(110u); + let some = Some(110_usize); let none: Option = None; let some_fat = Some("abc"); let none_fat: Option<&'static str> = None; diff --git a/src/test/debuginfo/generic-function.rs b/src/test/debuginfo/generic-function.rs index b2fdb708db..76b7a3e729 100644 --- a/src/test/debuginfo/generic-function.rs +++ b/src/test/debuginfo/generic-function.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -86,9 +85,9 @@ fn dup_tup(t0: &T0, t1: &T1) -> ((T0, T1), (T1, T0)) { fn main() { - let _ = dup_tup(&1i, &2.5f64); + let _ = dup_tup(&1, &2.5f64); let _ = dup_tup(&3.5f64, &4_u16); - let _ = dup_tup(&5i, &Struct { a: 6, b: 7.5 }); + let _ = dup_tup(&5, &Struct { a: 6, b: 7.5 }); } fn zzz() {()} diff --git a/src/test/debuginfo/generic-functions-nested.rs b/src/test/debuginfo/generic-functions-nested.rs index 0f3fd556f1..5f9236038b 100644 --- a/src/test/debuginfo/generic-functions-nested.rs +++ b/src/test/debuginfo/generic-functions-nested.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -74,7 +73,7 @@ #![omit_gdb_pretty_printer_section] fn outer(a: TA) { - inner(a.clone(), 1i); + inner(a.clone(), 1); inner(a.clone(), 2.5f64); fn inner(x: TX, y: TY) { @@ -83,7 +82,7 @@ fn outer(a: TA) { } fn main() { - outer(-1i); + outer(-1); outer(-2.5f64); } diff --git a/src/test/debuginfo/generic-method-on-generic-struct.rs b/src/test/debuginfo/generic-method-on-generic-struct.rs index 66cd73622f..8c4eeb27c0 100644 --- a/src/test/debuginfo/generic-method-on-generic-struct.rs +++ b/src/test/debuginfo/generic-method-on-generic-struct.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // compile-flags:-g // min-lldb-version: 310 @@ -115,6 +114,7 @@ #![feature(box_syntax)] #![omit_gdb_pretty_printer_section] +#[derive(Copy)] struct Struct { x: T } @@ -150,5 +150,3 @@ fn main() { fn zzz() {()} -impl Copy for Struct {} - diff --git a/src/test/debuginfo/generic-static-method-on-struct-and-enum.rs b/src/test/debuginfo/generic-static-method-on-struct-and-enum.rs index bf755d379a..eb1083f624 100644 --- a/src/test/debuginfo/generic-static-method-on-struct-and-enum.rs +++ b/src/test/debuginfo/generic-static-method-on-struct-and-enum.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -61,8 +60,8 @@ impl Enum { } fn main() { - Struct::static_method(1i, 2i); - Enum::static_method(-3i, 4.5f64, 5i); + Struct::static_method(1, 2); + Enum::static_method(-3, 4.5f64, 5); } fn zzz() {()} diff --git a/src/test/debuginfo/generic-struct-style-enum.rs b/src/test/debuginfo/generic-struct-style-enum.rs index 992e741791..455861b1ea 100644 --- a/src/test/debuginfo/generic-struct-style-enum.rs +++ b/src/test/debuginfo/generic-struct-style-enum.rs @@ -9,7 +9,6 @@ // except according to those terms. // ignore-tidy-linelength -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -76,7 +75,7 @@ fn main() { // 0b01011001 = 89 let case3: Regular = Case3 { a: 0, b: 6438275382588823897 }; - let univariant = TheOnlyCase { a: -1i }; + let univariant = TheOnlyCase { a: -1 }; zzz(); // #break } diff --git a/src/test/debuginfo/generic-struct.rs b/src/test/debuginfo/generic-struct.rs index a81230599f..15982f309c 100644 --- a/src/test/debuginfo/generic-struct.rs +++ b/src/test/debuginfo/generic-struct.rs @@ -9,7 +9,6 @@ // except according to those terms. // ignore-tidy-linelength -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -32,14 +31,14 @@ // lldb-command:run // lldb-command:print int_int -// lldb-check:[...]$0 = AGenericStruct { key: 0, value: 1 } +// lldb-check:[...]$0 = AGenericStruct { key: 0, value: 1 } // lldb-command:print int_float -// lldb-check:[...]$1 = AGenericStruct { key: 2, value: 3.5 } +// lldb-check:[...]$1 = AGenericStruct { key: 2, value: 3.5 } // lldb-command:print float_int -// lldb-check:[...]$2 = AGenericStruct { key: 4.5, value: 5 } +// lldb-check:[...]$2 = AGenericStruct { key: 4.5, value: 5 } // lldb-command:print float_int_float -// lldb-check:[...]$3 = AGenericStruct> { key: 6.5, value: AGenericStruct { key: 7, value: 8.5 } } +// lldb-check:[...]$3 = AGenericStruct> { key: 6.5, value: AGenericStruct { key: 7, value: 8.5 } } #![omit_gdb_pretty_printer_section] @@ -51,12 +50,12 @@ struct AGenericStruct { fn main() { - let int_int = AGenericStruct { key: 0i, value: 1i }; - let int_float = AGenericStruct { key: 2i, value: 3.5f64 }; - let float_int = AGenericStruct { key: 4.5f64, value: 5i }; + let int_int = AGenericStruct { key: 0, value: 1 }; + let int_float = AGenericStruct { key: 2, value: 3.5f64 }; + let float_int = AGenericStruct { key: 4.5f64, value: 5 }; let float_int_float = AGenericStruct { key: 6.5f64, - value: AGenericStruct { key: 7i, value: 8.5f64 }, + value: AGenericStruct { key: 7, value: 8.5f64 }, }; zzz(); // #break diff --git a/src/test/debuginfo/generic-tuple-style-enum.rs b/src/test/debuginfo/generic-tuple-style-enum.rs index f9dc9d1f05..da62e33555 100644 --- a/src/test/debuginfo/generic-tuple-style-enum.rs +++ b/src/test/debuginfo/generic-tuple-style-enum.rs @@ -9,7 +9,6 @@ // except according to those terms. // ignore-tidy-linelength -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/include_string.rs b/src/test/debuginfo/include_string.rs index 25719a8028..1dead6c273 100644 --- a/src/test/debuginfo/include_string.rs +++ b/src/test/debuginfo/include_string.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/issue11600.rs b/src/test/debuginfo/issue11600.rs index 5166400029..e93704cac3 100644 --- a/src/test/debuginfo/issue11600.rs +++ b/src/test/debuginfo/issue11600.rs @@ -17,7 +17,6 @@ fn main() { ::std::io::println(args[0]); } -// ignore-android: FIXME(#10381) // ignore-lldb // This test case checks whether compile unit names are set correctly, so that the correct default diff --git a/src/test/debuginfo/issue12886.rs b/src/test/debuginfo/issue12886.rs index c6acc9a31f..424ba50e3c 100644 --- a/src/test/debuginfo/issue12886.rs +++ b/src/test/debuginfo/issue12886.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // ignore-windows failing on 64-bit bots FIXME #17638 // ignore-lldb @@ -16,7 +15,7 @@ // gdb-command:run // gdb-command:next -// gdb-check:[...]34[...]s +// gdb-check:[...]33[...]s // gdb-command:continue #![omit_gdb_pretty_printer_section] diff --git a/src/test/debuginfo/issue13213.rs b/src/test/debuginfo/issue13213.rs index 474f34c4b4..a079ddbd0f 100644 --- a/src/test/debuginfo/issue13213.rs +++ b/src/test/debuginfo/issue13213.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // aux-build:issue13213aux.rs @@ -21,5 +20,5 @@ extern crate issue13213aux; // be available because they have been optimized out from the exporting crate. fn main() { let b: issue13213aux::S = issue13213aux::A; - ::std::io::println("Nothing to do here..."); + ::std::old_io::println("Nothing to do here..."); } diff --git a/src/test/debuginfo/issue14411.rs b/src/test/debuginfo/issue14411.rs index 0fc567f421..3b2d372117 100644 --- a/src/test/debuginfo/issue14411.rs +++ b/src/test/debuginfo/issue14411.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/issue7712.rs b/src/test/debuginfo/issue7712.rs index 94458a7fb4..124cdfb436 100644 --- a/src/test/debuginfo/issue7712.rs +++ b/src/test/debuginfo/issue7712.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags:--debuginfo=1 +// compile-flags:-C debuginfo=1 // min-lldb-version: 310 pub trait TraitWithDefaultMethod : Sized { diff --git a/src/test/debuginfo/lexical-scope-in-for-loop.rs b/src/test/debuginfo/lexical-scope-in-for-loop.rs index 3309ae13c9..dceb436310 100644 --- a/src/test/debuginfo/lexical-scope-in-for-loop.rs +++ b/src/test/debuginfo/lexical-scope-in-for-loop.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -90,15 +89,15 @@ fn main() { - let range = [1i, 2, 3]; + let range = [1, 2, 3]; - let x = 1000000i; // wan meeeljen doollaars! + let x = 1000000; // wan meeeljen doollaars! - for &x in range.iter() { + for &x in &range { zzz(); // #break sentinel(); - let x = -1i * x; + let x = -1 * x; zzz(); // #break sentinel(); diff --git a/src/test/debuginfo/lexical-scope-in-if.rs b/src/test/debuginfo/lexical-scope-in-if.rs index bc3a694524..08a762fc4e 100644 --- a/src/test/debuginfo/lexical-scope-in-if.rs +++ b/src/test/debuginfo/lexical-scope-in-if.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -138,8 +137,8 @@ fn main() { - let x = 999i; - let y = -1i; + let x = 999; + let y = -1; zzz(); // #break sentinel(); @@ -148,13 +147,13 @@ fn main() { zzz(); // #break sentinel(); - let x = 1001i; + let x = 1001; zzz(); // #break sentinel(); - let x = 1002i; - let y = 1003i; + let x = 1002; + let y = 1003; zzz(); // #break sentinel(); } else { @@ -170,8 +169,8 @@ fn main() { zzz(); // #break sentinel(); - let x = 1004i; - let y = 1005i; + let x = 1004; + let y = 1005; zzz(); // #break sentinel(); } diff --git a/src/test/debuginfo/lexical-scope-in-match.rs b/src/test/debuginfo/lexical-scope-in-match.rs index 37976ab399..c2cddd2576 100644 --- a/src/test/debuginfo/lexical-scope-in-match.rs +++ b/src/test/debuginfo/lexical-scope-in-match.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -135,13 +134,13 @@ struct Struct { fn main() { - let shadowed = 231i; - let not_shadowed = 232i; + let shadowed = 231; + let not_shadowed = 232; zzz(); // #break sentinel(); - match (233i, 234i) { + match (233, 234) { (shadowed, local_to_arm) => { zzz(); // #break @@ -149,7 +148,7 @@ fn main() { } } - match (235i, 236i) { + match (235, 236) { // with literal (235, shadowed) => { @@ -186,7 +185,7 @@ fn main() { _ => {} } - match (243i, 244i) { + match (243, 244) { (shadowed, ref local_to_arm) => { zzz(); // #break diff --git a/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs b/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs index b2617c5774..e097ec2adb 100644 --- a/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs +++ b/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs @@ -8,17 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 -// compile-flags:--debuginfo=1 +// compile-flags:-C debuginfo=1 // gdb-command:run // lldb-command:run // Nothing to do here really, just make sure it compiles. See issue #8513. fn main() { - let _ = |&:|(); - let _ = range(1u,3).map(|_| 5i); + let _ = ||(); + let _ = (1_usize..3).map(|_| 5); } diff --git a/src/test/debuginfo/lexical-scope-in-stack-closure.rs b/src/test/debuginfo/lexical-scope-in-stack-closure.rs index f2d0922166..6a909ced81 100644 --- a/src/test/debuginfo/lexical-scope-in-stack-closure.rs +++ b/src/test/debuginfo/lexical-scope-in-stack-closure.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -79,7 +78,7 @@ fn main() { zzz(); // #break sentinel(); - let closure = |&: x: int| { + let closure = |x: int| { zzz(); // #break sentinel(); diff --git a/src/test/debuginfo/lexical-scope-in-unconditional-loop.rs b/src/test/debuginfo/lexical-scope-in-unconditional-loop.rs index b295c6f37a..868cea29a7 100644 --- a/src/test/debuginfo/lexical-scope-in-unconditional-loop.rs +++ b/src/test/debuginfo/lexical-scope-in-unconditional-loop.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -136,7 +135,7 @@ fn main() { - let mut x = 0i; + let mut x = 0; loop { if x >= 2 { @@ -160,7 +159,7 @@ fn main() { zzz(); // #break sentinel(); - let x = -987i; + let x = -987; zzz(); // #break sentinel(); diff --git a/src/test/debuginfo/lexical-scope-in-unique-closure.rs b/src/test/debuginfo/lexical-scope-in-unique-closure.rs index be4085b63a..c0a5a31c9c 100644 --- a/src/test/debuginfo/lexical-scope-in-unique-closure.rs +++ b/src/test/debuginfo/lexical-scope-in-unique-closure.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -80,7 +79,7 @@ fn main() { zzz(); // #break sentinel(); - let unique_closure = |: x:int| { + let unique_closure = |x:int| { zzz(); // #break sentinel(); diff --git a/src/test/debuginfo/lexical-scope-in-while.rs b/src/test/debuginfo/lexical-scope-in-while.rs index c7a36ef9b8..b5f43e7d21 100644 --- a/src/test/debuginfo/lexical-scope-in-while.rs +++ b/src/test/debuginfo/lexical-scope-in-while.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -136,7 +135,7 @@ fn main() { - let mut x = 0i; + let mut x = 0; while x < 2 { zzz(); // #break @@ -156,7 +155,7 @@ fn main() { zzz(); // #break sentinel(); - let x = -987i; + let x = -987; zzz(); // #break sentinel(); diff --git a/src/test/debuginfo/lexical-scope-with-macro.rs b/src/test/debuginfo/lexical-scope-with-macro.rs index 2aa31969a4..1dd738c6d5 100644 --- a/src/test/debuginfo/lexical-scope-with-macro.rs +++ b/src/test/debuginfo/lexical-scope-with-macro.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -123,7 +122,7 @@ macro_rules! no_new_scope { macro_rules! new_scope { () => ({ - let a = 890242i; + let a = 890242; zzz(); // #break sentinel(); }) @@ -151,8 +150,8 @@ macro_rules! dup_expr { fn main() { - let a = trivial!(10i); - let b = no_new_scope!(33i); + let a = trivial!(10); + let b = no_new_scope!(33); zzz(); // #break sentinel(); @@ -162,12 +161,12 @@ fn main() { zzz(); // #break sentinel(); - shadow_within_macro!(100i); + shadow_within_macro!(100); zzz(); // #break sentinel(); - let c = dup_expr!(10i * 20); + let c = dup_expr!(10 * 20); zzz(); // #break sentinel(); diff --git a/src/test/debuginfo/lexical-scopes-in-block-expression.rs b/src/test/debuginfo/lexical-scopes-in-block-expression.rs index 2f8b11ac28..c1ec837a4b 100644 --- a/src/test/debuginfo/lexical-scopes-in-block-expression.rs +++ b/src/test/debuginfo/lexical-scopes-in-block-expression.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -364,8 +363,8 @@ fn a_function(x: int) -> int { fn main() { - let val = -1i; - let ten = 10i; + let val = -1; + let ten = 10; // surrounded by struct expression let point = Point { @@ -417,7 +416,7 @@ fn main() { sentinel(); val - }, 0i); + }, 0); zzz(); // #break sentinel(); @@ -492,7 +491,7 @@ fn main() { sentinel(); // index expression - let a_vector = [10i; 20]; + let a_vector = [10; 20]; let _ = a_vector[{ zzz(); // #break sentinel(); diff --git a/src/test/debuginfo/limited-debuginfo.rs b/src/test/debuginfo/limited-debuginfo.rs index 35889ff813..e51842992c 100644 --- a/src/test/debuginfo/limited-debuginfo.rs +++ b/src/test/debuginfo/limited-debuginfo.rs @@ -8,11 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // ignore-lldb -// compile-flags:--debuginfo=1 +// compile-flags:-C debuginfo=1 // Make sure functions have proper names // gdb-command:info functions @@ -47,8 +46,12 @@ fn zzz() {()} fn some_function(a: int, b: int) { let some_variable = Struct { a: 11, b: 22 }; - let some_other_variable = 23i; - zzz(); // #break + let some_other_variable = 23; + + for x in 0..1 { + zzz(); // #break + } } fn some_other_function(a: int, b: int) -> bool { true } + diff --git a/src/test/debuginfo/method-on-enum.rs b/src/test/debuginfo/method-on-enum.rs index 732e1d5c50..7ad668791d 100644 --- a/src/test/debuginfo/method-on-enum.rs +++ b/src/test/debuginfo/method-on-enum.rs @@ -9,7 +9,6 @@ // except according to those terms. // ignore-tidy-linelength -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -116,6 +115,7 @@ #![feature(box_syntax)] #![omit_gdb_pretty_printer_section] +#[derive(Copy)] enum Enum { Variant1 { x: u16, y: u16 }, Variant2 (u32) @@ -152,5 +152,3 @@ fn main() { fn zzz() {()} -impl Copy for Enum {} - diff --git a/src/test/debuginfo/method-on-generic-struct.rs b/src/test/debuginfo/method-on-generic-struct.rs index c1785951e2..6b56a7998c 100644 --- a/src/test/debuginfo/method-on-generic-struct.rs +++ b/src/test/debuginfo/method-on-generic-struct.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -116,6 +115,7 @@ #![feature(box_syntax)] #![omit_gdb_pretty_printer_section] +#[derive(Copy)] struct Struct { x: T } @@ -151,5 +151,3 @@ fn main() { fn zzz() {()} -impl Copy for Struct {} - diff --git a/src/test/debuginfo/method-on-struct.rs b/src/test/debuginfo/method-on-struct.rs index d88a32b847..e32288a8e7 100644 --- a/src/test/debuginfo/method-on-struct.rs +++ b/src/test/debuginfo/method-on-struct.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -116,6 +115,7 @@ #![feature(box_syntax)] #![omit_gdb_pretty_printer_section] +#[derive(Copy)] struct Struct { x: int } @@ -151,5 +151,3 @@ fn main() { fn zzz() {()} -impl Copy for Struct {} - diff --git a/src/test/debuginfo/method-on-trait.rs b/src/test/debuginfo/method-on-trait.rs index 5622d17225..6e9a695720 100644 --- a/src/test/debuginfo/method-on-trait.rs +++ b/src/test/debuginfo/method-on-trait.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -116,6 +115,7 @@ #![feature(box_syntax)] #![omit_gdb_pretty_printer_section] +#[derive(Copy)] struct Struct { x: int } @@ -157,5 +157,3 @@ fn main() { fn zzz() {()} -impl Copy for Struct {} - diff --git a/src/test/debuginfo/method-on-tuple-struct.rs b/src/test/debuginfo/method-on-tuple-struct.rs index 02f7808221..cee04e92c2 100644 --- a/src/test/debuginfo/method-on-tuple-struct.rs +++ b/src/test/debuginfo/method-on-tuple-struct.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -116,6 +115,7 @@ #![feature(box_syntax)] #![omit_gdb_pretty_printer_section] +#[derive(Copy)] struct TupleStruct(int, f64); impl TupleStruct { @@ -149,5 +149,3 @@ fn main() { fn zzz() {()} -impl Copy for TupleStruct {} - diff --git a/src/test/debuginfo/multi-byte-chars.rs b/src/test/debuginfo/multi-byte-chars.rs index cb7e26327c..f02e3f2a22 100644 --- a/src/test/debuginfo/multi-byte-chars.rs +++ b/src/test/debuginfo/multi-byte-chars.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -24,5 +23,5 @@ struct C { θ: u8 } fn main() { let x = C { θ: 0 }; - (|&: c: C| c.θ )(x); + (|c: C| c.θ )(x); } diff --git a/src/test/debuginfo/multiple-functions-equal-var-names.rs b/src/test/debuginfo/multiple-functions-equal-var-names.rs index cb21c13426..5fe0c13e5e 100644 --- a/src/test/debuginfo/multiple-functions-equal-var-names.rs +++ b/src/test/debuginfo/multiple-functions-equal-var-names.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -48,18 +47,18 @@ #![omit_gdb_pretty_printer_section] fn function_one() { - let abc = 10101i; + let abc = 10101; zzz(); // #break } fn function_two() { - let abc = 20202i; + let abc = 20202; zzz(); // #break } fn function_three() { - let abc = 30303i; + let abc = 30303; zzz(); // #break } diff --git a/src/test/debuginfo/multiple-functions.rs b/src/test/debuginfo/multiple-functions.rs index ef7c4ce204..3179a8050d 100644 --- a/src/test/debuginfo/multiple-functions.rs +++ b/src/test/debuginfo/multiple-functions.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -48,18 +47,18 @@ #![omit_gdb_pretty_printer_section] fn function_one() { - let a = 10101i; + let a = 10101; zzz(); // #break } fn function_two() { - let b = 20202i; + let b = 20202; zzz(); // #break } fn function_three() { - let c = 30303i; + let c = 30303; zzz(); // #break } diff --git a/src/test/debuginfo/name-shadowing-and-scope-nesting.rs b/src/test/debuginfo/name-shadowing-and-scope-nesting.rs index d248c7e981..5553d7e496 100644 --- a/src/test/debuginfo/name-shadowing-and-scope-nesting.rs +++ b/src/test/debuginfo/name-shadowing-and-scope-nesting.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -103,20 +102,20 @@ fn main() { zzz(); // #break sentinel(); - let x = 10i; + let x = 10; zzz(); // #break sentinel(); let x = 10.5f64; - let y = 20i; + let y = 20; zzz(); // #break sentinel(); { let x = true; - let y = 2220i; + let y = 2220; zzz(); // #break sentinel(); diff --git a/src/test/debuginfo/nil-enum.rs b/src/test/debuginfo/nil-enum.rs index f0eaf6acb6..44d7c2b1ad 100644 --- a/src/test/debuginfo/nil-enum.rs +++ b/src/test/debuginfo/nil-enum.rs @@ -11,7 +11,6 @@ // LLDB can't handle zero-sized values // ignore-lldb -// ignore-android: FIXME(#10381) // compile-flags:-g // gdb-command:run diff --git a/src/test/debuginfo/no-debug-attribute.rs b/src/test/debuginfo/no-debug-attribute.rs index dcc1928ae5..5b2045d59d 100644 --- a/src/test/debuginfo/no-debug-attribute.rs +++ b/src/test/debuginfo/no-debug-attribute.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // ignore-lldb // compile-flags:-g @@ -27,7 +26,7 @@ #![omit_gdb_pretty_printer_section] fn function_with_debuginfo() { - let abc = 10u; + let abc = 10_usize; return (); // #break } diff --git a/src/test/debuginfo/option-like-enum.rs b/src/test/debuginfo/option-like-enum.rs index 71c235c878..03336c3586 100644 --- a/src/test/debuginfo/option-like-enum.rs +++ b/src/test/debuginfo/option-like-enum.rs @@ -9,7 +9,6 @@ // except according to those terms. // ignore-tidy-linelength -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -36,6 +35,12 @@ // gdb-command:print void_droid_gdb->internals // gdb-check:$6 = (isize *) 0x0 +// gdb-command:print nested_non_zero_yep +// gdb-check:$7 = {RUST$ENCODED$ENUM$1$2$Nope = {10.5, {a = 10, b = 20, c = [...]}}} + +// gdb-command:print nested_non_zero_nope +// gdb-check:$8 = {RUST$ENCODED$ENUM$1$2$Nope = {[...], {a = [...], b = [...], c = 0x0}}} + // gdb-command:continue @@ -67,6 +72,12 @@ // lldb-command:print none_str // lldb-check:[...]$7 = None +// lldb-command:print nested_non_zero_yep +// lldb-check:[...]$8 = Yep(10.5, NestedNonZeroField { a: 10, b: 20, c: &[...] }) + +// lldb-command:print nested_non_zero_nope +// lldb-check:[...]$9 = Nope + #![omit_gdb_pretty_printer_section] @@ -102,15 +113,26 @@ struct NamedFieldsRepr<'a> { internals: &'a isize } +struct NestedNonZeroField<'a> { + a: u16, + b: u32, + c: &'a char, +} + +enum NestedNonZero<'a> { + Yep(f64, NestedNonZeroField<'a>), + Nope +} + fn main() { let some_str: Option<&'static str> = Some("abc"); let none_str: Option<&'static str> = None; - let some: Option<&u32> = Some(unsafe { std::mem::transmute(0x12345678u) }); + let some: Option<&u32> = Some(unsafe { std::mem::transmute(0x12345678_usize) }); let none: Option<&u32> = None; - let full = MoreFields::Full(454545, unsafe { std::mem::transmute(0x87654321u) }, 9988); + let full = MoreFields::Full(454545, unsafe { std::mem::transmute(0x87654321_usize) }, 9988); let empty = MoreFields::Empty; let empty_gdb: &MoreFieldsRepr = unsafe { std::mem::transmute(&MoreFields::Empty) }; @@ -118,12 +140,23 @@ fn main() { let droid = NamedFields::Droid { id: 675675, range: 10000001, - internals: unsafe { std::mem::transmute(0x43218765u) } + internals: unsafe { std::mem::transmute(0x43218765_usize) } }; let void_droid = NamedFields::Void; let void_droid_gdb: &NamedFieldsRepr = unsafe { std::mem::transmute(&NamedFields::Void) }; + let x = 'x'; + let nested_non_zero_yep = NestedNonZero::Yep( + 10.5, + NestedNonZeroField { + a: 10, + b: 20, + c: &x + }); + + let nested_non_zero_nope = NestedNonZero::Nope; + zzz(); // #break } diff --git a/src/test/debuginfo/packed-struct-with-destructor.rs b/src/test/debuginfo/packed-struct-with-destructor.rs index 84c0b8da02..8b2f34a990 100644 --- a/src/test/debuginfo/packed-struct-with-destructor.rs +++ b/src/test/debuginfo/packed-struct-with-destructor.rs @@ -9,7 +9,6 @@ // except according to those terms. // ignore-tidy-linelength -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/packed-struct.rs b/src/test/debuginfo/packed-struct.rs index 97e6ee7995..9f3b7baf83 100644 --- a/src/test/debuginfo/packed-struct.rs +++ b/src/test/debuginfo/packed-struct.rs @@ -9,7 +9,6 @@ // except according to those terms. // ignore-tidy-linelength -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/recursive-enum.rs b/src/test/debuginfo/recursive-enum.rs index 73a68893e9..ef1092efa1 100644 --- a/src/test/debuginfo/recursive-enum.rs +++ b/src/test/debuginfo/recursive-enum.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // ignore-lldb // compile-flags:-g diff --git a/src/test/debuginfo/recursive-struct.rs b/src/test/debuginfo/recursive-struct.rs index 2cbe9f4378..3b1979337d 100644 --- a/src/test/debuginfo/recursive-struct.rs +++ b/src/test/debuginfo/recursive-struct.rs @@ -9,7 +9,6 @@ // except according to those terms. // ignore-tidy-linelength -// ignore-android: FIXME(#10381) // ignore-lldb // compile-flags:-g diff --git a/src/test/debuginfo/self-in-default-method.rs b/src/test/debuginfo/self-in-default-method.rs index a1074e490f..cb2b04f4d8 100644 --- a/src/test/debuginfo/self-in-default-method.rs +++ b/src/test/debuginfo/self-in-default-method.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -115,6 +114,7 @@ #![feature(box_syntax)] #![omit_gdb_pretty_printer_section] +#[derive(Copy)] struct Struct { x: int } @@ -151,5 +151,3 @@ fn main() { fn zzz() {()} -impl Copy for Struct {} - diff --git a/src/test/debuginfo/self-in-generic-default-method.rs b/src/test/debuginfo/self-in-generic-default-method.rs index f0da6e2687..b96ec3b7b8 100644 --- a/src/test/debuginfo/self-in-generic-default-method.rs +++ b/src/test/debuginfo/self-in-generic-default-method.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -115,6 +114,7 @@ #![feature(box_syntax)] #![omit_gdb_pretty_printer_section] +#[derive(Copy)] struct Struct { x: int } @@ -152,5 +152,3 @@ fn main() { fn zzz() {()} -impl Copy for Struct {} - diff --git a/src/test/debuginfo/shadowed-argument.rs b/src/test/debuginfo/shadowed-argument.rs index c5c3664b07..4d74e6f108 100644 --- a/src/test/debuginfo/shadowed-argument.rs +++ b/src/test/debuginfo/shadowed-argument.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -65,13 +64,13 @@ fn a_function(x: bool, y: bool) { zzz(); // #break sentinel(); - let x = 10i; + let x = 10; zzz(); // #break sentinel(); let x = 10.5f64; - let y = 20i; + let y = 20; zzz(); // #break sentinel(); diff --git a/src/test/debuginfo/shadowed-variable.rs b/src/test/debuginfo/shadowed-variable.rs index f384b756da..630999677a 100644 --- a/src/test/debuginfo/shadowed-variable.rs +++ b/src/test/debuginfo/shadowed-variable.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -67,13 +66,13 @@ fn main() { zzz(); // #break sentinel(); - let x = 10i; + let x = 10; zzz(); // #break sentinel(); let x = 10.5f64; - let y = 20i; + let y = 20; zzz(); // #break sentinel(); diff --git a/src/test/debuginfo/simd.rs b/src/test/debuginfo/simd.rs index 4aaa3e0b75..161392c94c 100644 --- a/src/test/debuginfo/simd.rs +++ b/src/test/debuginfo/simd.rs @@ -11,7 +11,6 @@ // Need a fix for LLDB first... // ignore-lldb -// ignore-android: FIXME(#10381) // compile-flags:-g // gdb-command:run @@ -41,7 +40,6 @@ // gdb-command:continue -#![allow(unstable)] #![allow(unused_variables)] #![omit_gdb_pretty_printer_section] diff --git a/src/test/debuginfo/simple-lexical-scope.rs b/src/test/debuginfo/simple-lexical-scope.rs index 5981c18494..c1dae7a6d6 100644 --- a/src/test/debuginfo/simple-lexical-scope.rs +++ b/src/test/debuginfo/simple-lexical-scope.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -91,7 +90,7 @@ fn main() { zzz(); // #break sentinel(); - let x = 10i; + let x = 10; zzz(); // #break sentinel(); diff --git a/src/test/debuginfo/simple-struct.rs b/src/test/debuginfo/simple-struct.rs index 3015b16a0a..eee3cf5505 100644 --- a/src/test/debuginfo/simple-struct.rs +++ b/src/test/debuginfo/simple-struct.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/simple-tuple.rs b/src/test/debuginfo/simple-tuple.rs index 78184fab7d..75db47af24 100644 --- a/src/test/debuginfo/simple-tuple.rs +++ b/src/test/debuginfo/simple-tuple.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/static-method-on-struct-and-enum.rs b/src/test/debuginfo/static-method-on-struct-and-enum.rs index 59ee300b3e..48db69289c 100644 --- a/src/test/debuginfo/static-method-on-struct-and-enum.rs +++ b/src/test/debuginfo/static-method-on-struct-and-enum.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/struct-in-enum.rs b/src/test/debuginfo/struct-in-enum.rs index 6f801a7d58..b2971329cc 100644 --- a/src/test/debuginfo/struct-in-enum.rs +++ b/src/test/debuginfo/struct-in-enum.rs @@ -9,7 +9,6 @@ // except according to those terms. // ignore-tidy-linelength -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/struct-in-struct.rs b/src/test/debuginfo/struct-in-struct.rs index 3f819c92e1..8bccb041c9 100644 --- a/src/test/debuginfo/struct-in-struct.rs +++ b/src/test/debuginfo/struct-in-struct.rs @@ -9,7 +9,6 @@ // except according to those terms. // ignore-tidy-linelength -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/struct-style-enum.rs b/src/test/debuginfo/struct-style-enum.rs index f6d4627082..d522e9f891 100644 --- a/src/test/debuginfo/struct-style-enum.rs +++ b/src/test/debuginfo/struct-style-enum.rs @@ -9,7 +9,6 @@ // except according to those terms. // ignore-tidy-linelength -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/struct-with-destructor.rs b/src/test/debuginfo/struct-with-destructor.rs index 743f5ac5ff..4c2c9d06ae 100644 --- a/src/test/debuginfo/struct-with-destructor.rs +++ b/src/test/debuginfo/struct-with-destructor.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/trait-pointers.rs b/src/test/debuginfo/trait-pointers.rs index b95190f875..f74c9953f7 100644 --- a/src/test/debuginfo/trait-pointers.rs +++ b/src/test/debuginfo/trait-pointers.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/tuple-in-struct.rs b/src/test/debuginfo/tuple-in-struct.rs index 3d28490c0c..7da1ef2e11 100644 --- a/src/test/debuginfo/tuple-in-struct.rs +++ b/src/test/debuginfo/tuple-in-struct.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/tuple-in-tuple.rs b/src/test/debuginfo/tuple-in-tuple.rs index b1228f7a88..9b4c759ab0 100644 --- a/src/test/debuginfo/tuple-in-tuple.rs +++ b/src/test/debuginfo/tuple-in-tuple.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/tuple-struct.rs b/src/test/debuginfo/tuple-struct.rs index 0960ab5834..e679dac954 100644 --- a/src/test/debuginfo/tuple-struct.rs +++ b/src/test/debuginfo/tuple-struct.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/tuple-style-enum.rs b/src/test/debuginfo/tuple-style-enum.rs index f205f484f2..7c9760c3a5 100644 --- a/src/test/debuginfo/tuple-style-enum.rs +++ b/src/test/debuginfo/tuple-style-enum.rs @@ -9,7 +9,6 @@ // except according to those terms. // ignore-tidy-linelength -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/type-names.rs b/src/test/debuginfo/type-names.rs index 156e5f12ad..bf26fc23d3 100644 --- a/src/test/debuginfo/type-names.rs +++ b/src/test/debuginfo/type-names.rs @@ -177,10 +177,11 @@ #![omit_gdb_pretty_printer_section] use self::Enum1::{Variant1_1, Variant1_2}; +use std::marker::PhantomData; use std::ptr; struct Struct1; -struct GenericStruct; +struct GenericStruct(PhantomData<(T1,T2)>); enum Enum1 { Variant1_1, @@ -207,8 +208,8 @@ mod Mod1 { } } -trait Trait1 { } -trait Trait2 { } +trait Trait1 { fn dummy(&self) { } } +trait Trait2 { fn dummy(&self, _: T1, _:T2) { } } impl Trait1 for isize {} impl Trait2 for isize {} @@ -240,8 +241,10 @@ fn main() { // Structs let simple_struct = Struct1; - let generic_struct1: GenericStruct = GenericStruct; - let generic_struct2: GenericStruct usize> = GenericStruct; + let generic_struct1: GenericStruct = + GenericStruct(PhantomData); + let generic_struct2: GenericStruct usize> = + GenericStruct(PhantomData); let mod_struct = Mod1::Struct2; // Enums @@ -262,10 +265,10 @@ fn main() { // References let ref1 = (&Struct1, 0i32); - let ref2 = (&GenericStruct::, 0i32); + let ref2 = (&GenericStruct::(PhantomData), 0i32); let mut mut_struct1 = Struct1; - let mut mut_generic_struct = GenericStruct::; + let mut mut_generic_struct = GenericStruct::(PhantomData); let mut_ref1 = (&mut mut_struct1, 0i32); let mut_ref2 = (&mut mut_generic_struct, 0i32); @@ -280,41 +283,41 @@ fn main() { // Vectors let fixed_size_vec1 = ([Struct1, Struct1, Struct1], 0i16); - let fixed_size_vec2 = ([0u, 1u, 2u], 0i16); + let fixed_size_vec2 = ([0_usize, 1, 2], 0i16); - let vec1 = vec![0u, 2u, 3u]; - let slice1 = vec1.as_slice(); + let vec1 = vec![0_usize, 2, 3]; + let slice1 = &*vec1; let vec2 = vec![Mod1::Variant2_2(Struct1)]; - let slice2 = vec2.as_slice(); + let slice2 = &*vec2; // Trait Objects - let box_trait = (box 0i) as Box; - let ref_trait = &0i as &Trait1; - let mut mut_int1 = 0i; + let box_trait = (box 0) as Box; + let ref_trait = &0 as &Trait1; + let mut mut_int1 = 0; let mut_ref_trait = (&mut mut_int1) as &mut Trait1; - let generic_box_trait = (box 0i) as Box>; - let generic_ref_trait = (&0i) as &Trait2; + let generic_box_trait = (box 0) as Box>; + let generic_ref_trait = (&0) as &Trait2; - let mut generic_mut_ref_trait_impl = 0i; + let mut generic_mut_ref_trait_impl = 0; let generic_mut_ref_trait = (&mut generic_mut_ref_trait_impl) as &mut Trait2>; // Bare Functions - let rust_fn = (rust_fn, 0u); - let extern_c_fn = (extern_c_fn, 0u); - let unsafe_fn = (unsafe_fn, 0u); - let extern_stdcall_fn = (extern_stdcall_fn, 0u); + let rust_fn = (rust_fn, 0_usize); + let extern_c_fn = (extern_c_fn, 0_usize); + let unsafe_fn = (unsafe_fn, 0_usize); + let extern_stdcall_fn = (extern_stdcall_fn, 0_usize); - let rust_fn_with_return_value = (rust_fn_with_return_value, 0u); - let extern_c_fn_with_return_value = (extern_c_fn_with_return_value, 0u); - let unsafe_fn_with_return_value = (unsafe_fn_with_return_value, 0u); - let extern_stdcall_fn_with_return_value = (extern_stdcall_fn_with_return_value, 0u); + let rust_fn_with_return_value = (rust_fn_with_return_value, 0_usize); + let extern_c_fn_with_return_value = (extern_c_fn_with_return_value, 0_usize); + let unsafe_fn_with_return_value = (unsafe_fn_with_return_value, 0_usize); + let extern_stdcall_fn_with_return_value = (extern_stdcall_fn_with_return_value, 0_usize); - let generic_function_int = (generic_function::, 0u); - let generic_function_struct3 = (generic_function::, 0u); + let generic_function_int = (generic_function::, 0_usize); + let generic_function_struct3 = (generic_function::, 0_usize); - let variadic_function = (printf, 0u); + let variadic_function = (printf, 0_usize); // Closures // I (mw) am a bit unclear about the current state of closures, their @@ -322,8 +325,8 @@ fn main() { // how that maps to rustc's internal representation of these forms. // Once closures have reached their 1.0 form, the tests below should // probably be expanded. - let closure1 = (|&: x:isize| {}, 0u); - let closure2 = (|&: x:i8, y: f32| { (x as f32) + y }, 0u); + let closure1 = (|x:isize| {}, 0_usize); + let closure2 = (|x:i8, y: f32| { (x as f32) + y }, 0_usize); zzz(); // #break } diff --git a/src/test/debuginfo/unique-enum.rs b/src/test/debuginfo/unique-enum.rs index 08622b2dca..69b5797007 100644 --- a/src/test/debuginfo/unique-enum.rs +++ b/src/test/debuginfo/unique-enum.rs @@ -9,7 +9,6 @@ // except according to those terms. // ignore-tidy-linelength -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/unreachable-locals.rs b/src/test/debuginfo/unreachable-locals.rs index c15dcd1958..309848d6ce 100644 --- a/src/test/debuginfo/unreachable-locals.rs +++ b/src/test/debuginfo/unreachable-locals.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -26,7 +25,7 @@ fn after_return() { match (20i32, 'c') { (a, ref b) => {} } - for a in [111i32].iter() {} + for a in &[111i32] {} } fn after_panic() { @@ -36,7 +35,7 @@ fn after_panic() { match (20i32, 'c') { (a, ref b) => {} } - for a in [111i32].iter() {} + for a in &[111i32] {} } fn after_diverging_function() { @@ -46,7 +45,7 @@ fn after_diverging_function() { match (20i32, 'c') { (a, ref b) => {} } - for a in [111i32].iter() {} + for a in &[111i32] {} } fn after_break() { @@ -57,19 +56,19 @@ fn after_break() { match (20i32, 'c') { (a, ref b) => {} } - for a in [111i32].iter() {} + for a in &[111i32] {} } } fn after_continue() { - for _ in range(0, 10i32) { + for _ in 0..10i32 { break; let x = "0"; let (ref y,z) = (1i32, 2u32); match (20i32, 'c') { (a, ref b) => {} } - for a in [111i32].iter() {} + for a in &[111i32] {} } } diff --git a/src/test/debuginfo/var-captured-in-nested-closure.rs b/src/test/debuginfo/var-captured-in-nested-closure.rs index d7831c983c..9c9d82249e 100644 --- a/src/test/debuginfo/var-captured-in-nested-closure.rs +++ b/src/test/debuginfo/var-captured-in-nested-closure.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -101,10 +100,10 @@ fn main() { let struct_ref = &a_struct; let owned = box 6; - let mut closure = |&mut:| { + let mut closure = || { let closure_local = 8; - let mut nested_closure = |&mut:| { + let mut nested_closure = || { zzz(); // #break variable = constant + a_struct.a + struct_ref.a + *owned + closure_local; }; diff --git a/src/test/debuginfo/var-captured-in-sendable-closure.rs b/src/test/debuginfo/var-captured-in-sendable-closure.rs index 30a07ea46d..3c442c95e0 100644 --- a/src/test/debuginfo/var-captured-in-sendable-closure.rs +++ b/src/test/debuginfo/var-captured-in-sendable-closure.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -61,19 +60,19 @@ fn main() { let owned = box 5; - let closure = move |:| { + let closure = move || { zzz(); // #break do_something(&constant, &a_struct.a, &*owned); }; closure(); - let constant2 = 6u; + let constant2 = 6_usize; // The `self` argument of the following closure should be passed by value // to FnOnce::call_once(self, args), which gets translated a bit differently // than the regular case. Let's make sure this is supported too. - let immedate_env = move |:| { + let immedate_env = move || { zzz(); // #break return constant2; }; diff --git a/src/test/debuginfo/var-captured-in-stack-closure.rs b/src/test/debuginfo/var-captured-in-stack-closure.rs index 9daf6abba1..e3bd1eade7 100644 --- a/src/test/debuginfo/var-captured-in-stack-closure.rs +++ b/src/test/debuginfo/var-captured-in-stack-closure.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -94,7 +93,7 @@ fn main() { let owned = box 6; { - let mut first_closure = |&mut:| { + let mut first_closure = || { zzz(); // #break variable = constant + a_struct.a + struct_ref.a + *owned; }; @@ -103,7 +102,7 @@ fn main() { } { - let mut second_closure = |&mut:| { + let mut second_closure = || { zzz(); // #break variable = constant + a_struct.a + struct_ref.a + *owned; }; diff --git a/src/test/debuginfo/vec-slices.rs b/src/test/debuginfo/vec-slices.rs index 949dffaac0..3ceb3946f3 100644 --- a/src/test/debuginfo/vec-slices.rs +++ b/src/test/debuginfo/vec-slices.rs @@ -9,6 +9,7 @@ // except according to those terms. // ignore-android: FIXME(#10381) +// ignore-windows // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/vec.rs b/src/test/debuginfo/vec.rs index 92a490206b..f7bdf1bd3f 100644 --- a/src/test/debuginfo/vec.rs +++ b/src/test/debuginfo/vec.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android: FIXME(#10381) // min-lldb-version: 310 // compile-flags:-g @@ -34,7 +33,7 @@ static mut VECT: [i32; 3] = [1, 2, 3]; fn main() { - let a = [1i, 2, 3]; + let a = [1, 2, 3]; unsafe { VECT[0] = 4; diff --git a/src/test/compile-fail/array-old-syntax-1.rs b/src/test/parse-fail/array-old-syntax-1.rs similarity index 91% rename from src/test/compile-fail/array-old-syntax-1.rs rename to src/test/parse-fail/array-old-syntax-1.rs index 3b4810a86a..71c57fefc2 100644 --- a/src/test/compile-fail/array-old-syntax-1.rs +++ b/src/test/parse-fail/array-old-syntax-1.rs @@ -11,5 +11,5 @@ // Test that the old fixed length array syntax is a parsing error. fn main() { - let _x: [isize, ..3] = [0is, 1, 2]; //~ ERROR + let _x: [isize, ..3] = [0, 1, 2]; //~ ERROR } diff --git a/src/test/compile-fail/ascii-only-character-escape.rs b/src/test/parse-fail/ascii-only-character-escape.rs similarity index 100% rename from src/test/compile-fail/ascii-only-character-escape.rs rename to src/test/parse-fail/ascii-only-character-escape.rs diff --git a/src/test/compile-fail/associated-types-project-from-hrtb-explicit.rs b/src/test/parse-fail/associated-types-project-from-hrtb-explicit.rs similarity index 100% rename from src/test/compile-fail/associated-types-project-from-hrtb-explicit.rs rename to src/test/parse-fail/associated-types-project-from-hrtb-explicit.rs diff --git a/src/test/compile-fail/attr-bad-meta.rs b/src/test/parse-fail/attr-bad-meta.rs similarity index 100% rename from src/test/compile-fail/attr-bad-meta.rs rename to src/test/parse-fail/attr-bad-meta.rs diff --git a/src/test/compile-fail/attr-before-eof.rs b/src/test/parse-fail/attr-before-eof.rs similarity index 89% rename from src/test/compile-fail/attr-before-eof.rs rename to src/test/parse-fail/attr-before-eof.rs index 5fe88cafac..e34756229b 100644 --- a/src/test/compile-fail/attr-before-eof.rs +++ b/src/test/parse-fail/attr-before-eof.rs @@ -8,4 +8,4 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(Show)] //~ERROR expected item after attributes +#[derive(Debug)] //~ERROR expected item after attributes diff --git a/src/test/compile-fail/attr-before-ext.rs b/src/test/parse-fail/attr-before-ext.rs similarity index 100% rename from src/test/compile-fail/attr-before-ext.rs rename to src/test/parse-fail/attr-before-ext.rs diff --git a/src/test/compile-fail/attr-before-let.rs b/src/test/parse-fail/attr-before-let.rs similarity index 96% rename from src/test/compile-fail/attr-before-let.rs rename to src/test/parse-fail/attr-before-let.rs index acc9aa8a9a..b4a90e35c4 100644 --- a/src/test/compile-fail/attr-before-let.rs +++ b/src/test/parse-fail/attr-before-let.rs @@ -10,5 +10,5 @@ fn main() { #[attr] //~ ERROR expected item - let _i = 0; + let __isize = 0; } diff --git a/src/test/compile-fail/attr-before-stmt.rs b/src/test/parse-fail/attr-before-stmt.rs similarity index 100% rename from src/test/compile-fail/attr-before-stmt.rs rename to src/test/parse-fail/attr-before-stmt.rs diff --git a/src/test/compile-fail/attr-dangling-in-fn.rs b/src/test/parse-fail/attr-dangling-in-fn.rs similarity index 100% rename from src/test/compile-fail/attr-dangling-in-fn.rs rename to src/test/parse-fail/attr-dangling-in-fn.rs diff --git a/src/test/compile-fail/attr-dangling-in-mod.rs b/src/test/parse-fail/attr-dangling-in-mod.rs similarity index 100% rename from src/test/compile-fail/attr-dangling-in-mod.rs rename to src/test/parse-fail/attr-dangling-in-mod.rs diff --git a/src/test/compile-fail/attr.rs b/src/test/parse-fail/attr.rs similarity index 100% rename from src/test/compile-fail/attr.rs rename to src/test/parse-fail/attr.rs diff --git a/src/test/compile-fail/attrs-after-extern-mod.rs b/src/test/parse-fail/attrs-after-extern-mod.rs similarity index 100% rename from src/test/compile-fail/attrs-after-extern-mod.rs rename to src/test/parse-fail/attrs-after-extern-mod.rs diff --git a/src/test/compile-fail/bad-char-literals.rs b/src/test/parse-fail/bad-char-literals.rs similarity index 100% rename from src/test/compile-fail/bad-char-literals.rs rename to src/test/parse-fail/bad-char-literals.rs diff --git a/src/test/compile-fail/bad-lit-suffixes.rs b/src/test/parse-fail/bad-lit-suffixes.rs similarity index 100% rename from src/test/compile-fail/bad-lit-suffixes.rs rename to src/test/parse-fail/bad-lit-suffixes.rs diff --git a/src/test/compile-fail/bad-match.rs b/src/test/parse-fail/bad-match.rs similarity index 100% rename from src/test/compile-fail/bad-match.rs rename to src/test/parse-fail/bad-match.rs diff --git a/src/test/compile-fail/bad-name.rs b/src/test/parse-fail/bad-name.rs similarity index 100% rename from src/test/compile-fail/bad-name.rs rename to src/test/parse-fail/bad-name.rs diff --git a/src/test/compile-fail/bad-value-ident-false.rs b/src/test/parse-fail/bad-value-ident-false.rs similarity index 100% rename from src/test/compile-fail/bad-value-ident-false.rs rename to src/test/parse-fail/bad-value-ident-false.rs diff --git a/src/test/compile-fail/bad-value-ident-true.rs b/src/test/parse-fail/bad-value-ident-true.rs similarity index 100% rename from src/test/compile-fail/bad-value-ident-true.rs rename to src/test/parse-fail/bad-value-ident-true.rs diff --git a/src/test/compile-fail/better-expected.rs b/src/test/parse-fail/better-expected.rs similarity index 95% rename from src/test/compile-fail/better-expected.rs rename to src/test/parse-fail/better-expected.rs index 0d84a5e7d0..e07f4b8e54 100644 --- a/src/test/compile-fail/better-expected.rs +++ b/src/test/parse-fail/better-expected.rs @@ -9,5 +9,5 @@ // except according to those terms. fn main() { - let x: [isize 3]; //~ ERROR expected one of `(`, `+`, `::`, `;`, or `]`, found `3` + let x: [isize 3]; //~ ERROR expected one of `(`, `+`, `::`, `;`, `<`, or `]`, found `3` } diff --git a/src/test/compile-fail/bind-struct-early-modifiers.rs b/src/test/parse-fail/bind-struct-early-modifiers.rs similarity index 88% rename from src/test/compile-fail/bind-struct-early-modifiers.rs rename to src/test/parse-fail/bind-struct-early-modifiers.rs index 375f6c5d04..c358a21d12 100644 --- a/src/test/compile-fail/bind-struct-early-modifiers.rs +++ b/src/test/parse-fail/bind-struct-early-modifiers.rs @@ -11,7 +11,7 @@ fn main() { struct Foo { x: isize } match (Foo { x: 10 }) { - Foo { ref x: ref x } => {}, //~ ERROR unexpected `:` + Foo { ref x: ref x } => {}, //~ ERROR expected `,`, found `:` _ => {} } } diff --git a/src/test/compile-fail/byte-literals.rs b/src/test/parse-fail/byte-literals.rs similarity index 100% rename from src/test/compile-fail/byte-literals.rs rename to src/test/parse-fail/byte-literals.rs diff --git a/src/test/compile-fail/byte-string-literals.rs b/src/test/parse-fail/byte-string-literals.rs similarity index 100% rename from src/test/compile-fail/byte-string-literals.rs rename to src/test/parse-fail/byte-string-literals.rs diff --git a/src/test/compile-fail/circular_modules_hello.rs b/src/test/parse-fail/circular_modules_hello.rs similarity index 100% rename from src/test/compile-fail/circular_modules_hello.rs rename to src/test/parse-fail/circular_modules_hello.rs diff --git a/src/test/compile-fail/circular_modules_main.rs b/src/test/parse-fail/circular_modules_main.rs similarity index 100% rename from src/test/compile-fail/circular_modules_main.rs rename to src/test/parse-fail/circular_modules_main.rs diff --git a/src/test/compile-fail/class-implements-bad-trait.rs b/src/test/parse-fail/class-implements-bad-trait.rs similarity index 100% rename from src/test/compile-fail/class-implements-bad-trait.rs rename to src/test/parse-fail/class-implements-bad-trait.rs diff --git a/src/test/compile-fail/column-offset-1-based.rs b/src/test/parse-fail/column-offset-1-based.rs similarity index 100% rename from src/test/compile-fail/column-offset-1-based.rs rename to src/test/parse-fail/column-offset-1-based.rs diff --git a/src/test/compile-fail/doc-before-attr.rs b/src/test/parse-fail/doc-before-attr.rs similarity index 89% rename from src/test/compile-fail/doc-before-attr.rs rename to src/test/parse-fail/doc-before-attr.rs index 7ee7e196b6..bb44a6a8ab 100644 --- a/src/test/compile-fail/doc-before-attr.rs +++ b/src/test/parse-fail/doc-before-attr.rs @@ -9,4 +9,4 @@ // except according to those terms. /// hi -#[derive(Show)] //~ERROR expected item after attributes +#[derive(Debug)] //~ERROR expected item after attributes diff --git a/src/test/compile-fail/doc-before-eof.rs b/src/test/parse-fail/doc-before-eof.rs similarity index 100% rename from src/test/compile-fail/doc-before-eof.rs rename to src/test/parse-fail/doc-before-eof.rs diff --git a/src/test/compile-fail/doc-before-extern-rbrace.rs b/src/test/parse-fail/doc-before-extern-rbrace.rs similarity index 100% rename from src/test/compile-fail/doc-before-extern-rbrace.rs rename to src/test/parse-fail/doc-before-extern-rbrace.rs diff --git a/src/test/compile-fail/doc-before-macro.rs b/src/test/parse-fail/doc-before-macro.rs similarity index 100% rename from src/test/compile-fail/doc-before-macro.rs rename to src/test/parse-fail/doc-before-macro.rs diff --git a/src/test/compile-fail/doc-before-rbrace.rs b/src/test/parse-fail/doc-before-rbrace.rs similarity index 100% rename from src/test/compile-fail/doc-before-rbrace.rs rename to src/test/parse-fail/doc-before-rbrace.rs diff --git a/src/test/compile-fail/doc-before-semi.rs b/src/test/parse-fail/doc-before-semi.rs similarity index 100% rename from src/test/compile-fail/doc-before-semi.rs rename to src/test/parse-fail/doc-before-semi.rs diff --git a/src/test/compile-fail/duplicate-visibility.rs b/src/test/parse-fail/duplicate-visibility.rs similarity index 100% rename from src/test/compile-fail/duplicate-visibility.rs rename to src/test/parse-fail/duplicate-visibility.rs diff --git a/src/test/compile-fail/empty-impl-semicolon.rs b/src/test/parse-fail/empty-impl-semicolon.rs similarity index 83% rename from src/test/compile-fail/empty-impl-semicolon.rs rename to src/test/parse-fail/empty-impl-semicolon.rs index a598252f1b..70c7d42feb 100644 --- a/src/test/compile-fail/empty-impl-semicolon.rs +++ b/src/test/parse-fail/empty-impl-semicolon.rs @@ -8,4 +8,4 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -impl Foo; //~ ERROR expected one of `(`, `+`, `::`, or `{`, found `;` +impl Foo; //~ ERROR expected one of `(`, `+`, `::`, `<`, `for`, `where`, or `{`, found `;` diff --git a/src/test/compile-fail/extern-crate-as-no-string-help.rs b/src/test/parse-fail/extern-crate-as-no-string-help.rs similarity index 100% rename from src/test/compile-fail/extern-crate-as-no-string-help.rs rename to src/test/parse-fail/extern-crate-as-no-string-help.rs diff --git a/src/test/compile-fail/extern-expected-fn-or-brace.rs b/src/test/parse-fail/extern-expected-fn-or-brace.rs similarity index 100% rename from src/test/compile-fail/extern-expected-fn-or-brace.rs rename to src/test/parse-fail/extern-expected-fn-or-brace.rs diff --git a/src/test/compile-fail/extern-foreign-crate.rs b/src/test/parse-fail/extern-foreign-crate.rs similarity index 100% rename from src/test/compile-fail/extern-foreign-crate.rs rename to src/test/parse-fail/extern-foreign-crate.rs diff --git a/src/test/compile-fail/extern-no-fn.rs b/src/test/parse-fail/extern-no-fn.rs similarity index 85% rename from src/test/compile-fail/extern-no-fn.rs rename to src/test/parse-fail/extern-no-fn.rs index 164cbe5417..69e2f3ae60 100644 --- a/src/test/compile-fail/extern-no-fn.rs +++ b/src/test/parse-fail/extern-no-fn.rs @@ -8,9 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:unexpected token extern { - f(); + f(); //~ ERROR expected one of `fn`, `pub`, `static`, `unsafe`, or `}`, found `f` } fn main() { diff --git a/src/test/compile-fail/generic-non-trailing-defaults.rs b/src/test/parse-fail/generic-non-trailing-defaults.rs similarity index 100% rename from src/test/compile-fail/generic-non-trailing-defaults.rs rename to src/test/parse-fail/generic-non-trailing-defaults.rs diff --git a/src/test/compile-fail/import-from-path.rs b/src/test/parse-fail/import-from-path.rs similarity index 100% rename from src/test/compile-fail/import-from-path.rs rename to src/test/parse-fail/import-from-path.rs diff --git a/src/test/compile-fail/import-from-rename.rs b/src/test/parse-fail/import-from-rename.rs similarity index 100% rename from src/test/compile-fail/import-from-rename.rs rename to src/test/parse-fail/import-from-rename.rs diff --git a/src/test/compile-fail/import-glob-path.rs b/src/test/parse-fail/import-glob-path.rs similarity index 100% rename from src/test/compile-fail/import-glob-path.rs rename to src/test/parse-fail/import-glob-path.rs diff --git a/src/test/compile-fail/import-glob-rename.rs b/src/test/parse-fail/import-glob-rename.rs similarity index 100% rename from src/test/compile-fail/import-glob-rename.rs rename to src/test/parse-fail/import-glob-rename.rs diff --git a/src/test/compile-fail/int-literal-too-large-span.rs b/src/test/parse-fail/int-literal-too-large-span.rs similarity index 87% rename from src/test/compile-fail/int-literal-too-large-span.rs rename to src/test/parse-fail/int-literal-too-large-span.rs index 2aeaf6efaa..8a496c934b 100644 --- a/src/test/compile-fail/int-literal-too-large-span.rs +++ b/src/test/parse-fail/int-literal-too-large-span.rs @@ -11,7 +11,7 @@ // issue #17123 fn main() { - 100000000000000000000000000000000is //~ ERROR int literal is too large + 100000000000000000000000000000000 //~ ERROR int literal is too large ; // the span shouldn't point to this. } diff --git a/src/test/compile-fail/issue-10392-2.rs b/src/test/parse-fail/issue-10392-2.rs similarity index 100% rename from src/test/compile-fail/issue-10392-2.rs rename to src/test/parse-fail/issue-10392-2.rs diff --git a/src/test/compile-fail/issue-10392.rs b/src/test/parse-fail/issue-10392.rs similarity index 100% rename from src/test/compile-fail/issue-10392.rs rename to src/test/parse-fail/issue-10392.rs diff --git a/src/test/compile-fail/issue-10412.rs b/src/test/parse-fail/issue-10412.rs similarity index 100% rename from src/test/compile-fail/issue-10412.rs rename to src/test/parse-fail/issue-10412.rs diff --git a/src/test/compile-fail/issue-10636-1.rs b/src/test/parse-fail/issue-10636-1.rs similarity index 100% rename from src/test/compile-fail/issue-10636-1.rs rename to src/test/parse-fail/issue-10636-1.rs diff --git a/src/test/compile-fail/issue-10636-2.rs b/src/test/parse-fail/issue-10636-2.rs similarity index 100% rename from src/test/compile-fail/issue-10636-2.rs rename to src/test/parse-fail/issue-10636-2.rs diff --git a/src/test/compile-fail/issue-12560-1.rs b/src/test/parse-fail/issue-12560-1.rs similarity index 100% rename from src/test/compile-fail/issue-12560-1.rs rename to src/test/parse-fail/issue-12560-1.rs diff --git a/src/test/compile-fail/issue-14182.rs b/src/test/parse-fail/issue-14182.rs similarity index 100% rename from src/test/compile-fail/issue-14182.rs rename to src/test/parse-fail/issue-14182.rs diff --git a/src/test/compile-fail/issue-14303-enum.rs b/src/test/parse-fail/issue-14303-enum.rs similarity index 100% rename from src/test/compile-fail/issue-14303-enum.rs rename to src/test/parse-fail/issue-14303-enum.rs diff --git a/src/test/compile-fail/issue-14303-fn-def.rs b/src/test/parse-fail/issue-14303-fn-def.rs similarity index 100% rename from src/test/compile-fail/issue-14303-fn-def.rs rename to src/test/parse-fail/issue-14303-fn-def.rs diff --git a/src/test/compile-fail/issue-14303-fncall.rs b/src/test/parse-fail/issue-14303-fncall.rs similarity index 97% rename from src/test/compile-fail/issue-14303-fncall.rs rename to src/test/parse-fail/issue-14303-fncall.rs index 0ec64ba6a3..a7adaacc0a 100644 --- a/src/test/compile-fail/issue-14303-fncall.rs +++ b/src/test/parse-fail/issue-14303-fncall.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - range(0, 4) + (0..4) .map(|x| x * 2) .collect::>() //~^ ERROR lifetime parameters must be declared prior to type parameters diff --git a/src/test/compile-fail/issue-14303-impl.rs b/src/test/parse-fail/issue-14303-impl.rs similarity index 100% rename from src/test/compile-fail/issue-14303-impl.rs rename to src/test/parse-fail/issue-14303-impl.rs diff --git a/src/test/compile-fail/issue-14303-path.rs b/src/test/parse-fail/issue-14303-path.rs similarity index 100% rename from src/test/compile-fail/issue-14303-path.rs rename to src/test/parse-fail/issue-14303-path.rs diff --git a/src/test/compile-fail/issue-14303-struct.rs b/src/test/parse-fail/issue-14303-struct.rs similarity index 100% rename from src/test/compile-fail/issue-14303-struct.rs rename to src/test/parse-fail/issue-14303-struct.rs diff --git a/src/test/compile-fail/issue-14303-trait.rs b/src/test/parse-fail/issue-14303-trait.rs similarity index 100% rename from src/test/compile-fail/issue-14303-trait.rs rename to src/test/parse-fail/issue-14303-trait.rs diff --git a/src/test/compile-fail/issue-15914.rs b/src/test/parse-fail/issue-15914.rs similarity index 100% rename from src/test/compile-fail/issue-15914.rs rename to src/test/parse-fail/issue-15914.rs diff --git a/src/test/compile-fail/issue-1655.rs b/src/test/parse-fail/issue-1655.rs similarity index 100% rename from src/test/compile-fail/issue-1655.rs rename to src/test/parse-fail/issue-1655.rs diff --git a/src/test/compile-fail/issue-17383.rs b/src/test/parse-fail/issue-17383.rs similarity index 100% rename from src/test/compile-fail/issue-17383.rs rename to src/test/parse-fail/issue-17383.rs diff --git a/src/test/compile-fail/issue-17718-const-mut.rs b/src/test/parse-fail/issue-17718-const-mut.rs similarity index 100% rename from src/test/compile-fail/issue-17718-const-mut.rs rename to src/test/parse-fail/issue-17718-const-mut.rs diff --git a/src/test/compile-fail/issue-17904.rs b/src/test/parse-fail/issue-17904.rs similarity index 100% rename from src/test/compile-fail/issue-17904.rs rename to src/test/parse-fail/issue-17904.rs diff --git a/src/test/compile-fail/issue-1802-1.rs b/src/test/parse-fail/issue-1802-1.rs similarity index 100% rename from src/test/compile-fail/issue-1802-1.rs rename to src/test/parse-fail/issue-1802-1.rs diff --git a/src/test/compile-fail/issue-1802-2.rs b/src/test/parse-fail/issue-1802-2.rs similarity index 95% rename from src/test/compile-fail/issue-1802-2.rs rename to src/test/parse-fail/issue-1802-2.rs index c7aacdfc68..f6da2fc82c 100644 --- a/src/test/compile-fail/issue-1802-2.rs +++ b/src/test/parse-fail/issue-1802-2.rs @@ -10,5 +10,5 @@ // error-pattern:no valid digits found for number fn main() { - log(error, 0bu); + log(error, 0b_usize); } diff --git a/src/test/compile-fail/issue-19096.rs b/src/test/parse-fail/issue-19096.rs similarity index 95% rename from src/test/compile-fail/issue-19096.rs rename to src/test/parse-fail/issue-19096.rs index 7bc79463d3..90d2acbe58 100644 --- a/src/test/compile-fail/issue-19096.rs +++ b/src/test/parse-fail/issue-19096.rs @@ -9,6 +9,6 @@ // except according to those terms. fn main() { - let t = (42is, 42is); + let t = (42, 42); t.0::; //~ ERROR expected one of `.`, `;`, `}`, or an operator, found `::` } diff --git a/src/test/compile-fail/issue-19398.rs b/src/test/parse-fail/issue-19398.rs similarity index 100% rename from src/test/compile-fail/issue-19398.rs rename to src/test/parse-fail/issue-19398.rs diff --git a/src/test/parse-fail/issue-20711-2.rs b/src/test/parse-fail/issue-20711-2.rs new file mode 100644 index 0000000000..a6c4570c60 --- /dev/null +++ b/src/test/parse-fail/issue-20711-2.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Foo; + +impl Foo { + fn foo() {} + + #[stable(feature = "rust1", since = "1.0.0")] +} //~ ERROR expected one of `extern`, `fn`, `pub`, `type`, or `unsafe`, found `}` + +fn main() {} + diff --git a/src/test/parse-fail/issue-20711.rs b/src/test/parse-fail/issue-20711.rs new file mode 100644 index 0000000000..3b329d7823 --- /dev/null +++ b/src/test/parse-fail/issue-20711.rs @@ -0,0 +1,17 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Foo; + +impl Foo { + #[stable(feature = "rust1", since = "1.0.0")] +} //~ ERROR expected one of `extern`, `fn`, `pub`, `type`, or `unsafe`, found `}` + +fn main() {} diff --git a/src/test/parse-fail/issue-21153.rs b/src/test/parse-fail/issue-21153.rs new file mode 100644 index 0000000000..e2b6deb0ad --- /dev/null +++ b/src/test/parse-fail/issue-21153.rs @@ -0,0 +1,13 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +trait MyTrait: Iterator { + Item = T; //~ ERROR expected one of `extern`, `fn`, `pub`, `type`, or `unsafe`, found `Item` +} diff --git a/src/test/compile-fail/issue-2354-1.rs b/src/test/parse-fail/issue-2354-1.rs similarity index 100% rename from src/test/compile-fail/issue-2354-1.rs rename to src/test/parse-fail/issue-2354-1.rs diff --git a/src/test/compile-fail/issue-2354.rs b/src/test/parse-fail/issue-2354.rs similarity index 100% rename from src/test/compile-fail/issue-2354.rs rename to src/test/parse-fail/issue-2354.rs diff --git a/src/test/compile-fail/issue-3036.rs b/src/test/parse-fail/issue-3036.rs similarity index 100% rename from src/test/compile-fail/issue-3036.rs rename to src/test/parse-fail/issue-3036.rs diff --git a/src/test/compile-fail/issue-5544-a.rs b/src/test/parse-fail/issue-5544-a.rs similarity index 91% rename from src/test/compile-fail/issue-5544-a.rs rename to src/test/parse-fail/issue-5544-a.rs index 42a18ba5fb..95a4f36d17 100644 --- a/src/test/compile-fail/issue-5544-a.rs +++ b/src/test/parse-fail/issue-5544-a.rs @@ -9,6 +9,6 @@ // except according to those terms. fn main() { - let _i = 18446744073709551616; // 2^64 + let __isize = 18446744073709551616; // 2^64 //~^ ERROR int literal is too large } diff --git a/src/test/compile-fail/issue-5544-b.rs b/src/test/parse-fail/issue-5544-b.rs similarity index 91% rename from src/test/compile-fail/issue-5544-b.rs rename to src/test/parse-fail/issue-5544-b.rs index 1f166ec0d1..afff5984b4 100644 --- a/src/test/compile-fail/issue-5544-b.rs +++ b/src/test/parse-fail/issue-5544-b.rs @@ -9,6 +9,6 @@ // except according to those terms. fn main() { - let _i = 0xff_ffff_ffff_ffff_ffff_is; + let __isize = 0xff_ffff_ffff_ffff_ffff__isize; //~^ ERROR int literal is too large } diff --git a/src/test/compile-fail/issue-5806.rs b/src/test/parse-fail/issue-5806.rs similarity index 100% rename from src/test/compile-fail/issue-5806.rs rename to src/test/parse-fail/issue-5806.rs diff --git a/src/test/compile-fail/issue-6610.rs b/src/test/parse-fail/issue-6610.rs similarity index 100% rename from src/test/compile-fail/issue-6610.rs rename to src/test/parse-fail/issue-6610.rs diff --git a/src/test/compile-fail/issue-8537.rs b/src/test/parse-fail/issue-8537.rs similarity index 92% rename from src/test/compile-fail/issue-8537.rs rename to src/test/parse-fail/issue-8537.rs index dba9e751f7..52cf420a9f 100644 --- a/src/test/compile-fail/issue-8537.rs +++ b/src/test/parse-fail/issue-8537.rs @@ -9,7 +9,7 @@ // except according to those terms. pub extern - "invalid-abi" //~ ERROR illegal ABI + "invalid-ab_isize" //~ ERROR illegal ABI fn foo() {} fn main() {} diff --git a/src/test/compile-fail/keyword-abstract.rs b/src/test/parse-fail/keyword-abstract.rs similarity index 100% rename from src/test/compile-fail/keyword-abstract.rs rename to src/test/parse-fail/keyword-abstract.rs diff --git a/src/test/compile-fail/keyword-as-as-identifier.rs b/src/test/parse-fail/keyword-as-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-as-as-identifier.rs rename to src/test/parse-fail/keyword-as-as-identifier.rs diff --git a/src/test/compile-fail/keyword-break-as-identifier.rs b/src/test/parse-fail/keyword-break-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-break-as-identifier.rs rename to src/test/parse-fail/keyword-break-as-identifier.rs diff --git a/src/test/compile-fail/keyword-do-as-identifier.rs b/src/test/parse-fail/keyword-do-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-do-as-identifier.rs rename to src/test/parse-fail/keyword-do-as-identifier.rs diff --git a/src/test/compile-fail/keyword-else-as-identifier.rs b/src/test/parse-fail/keyword-else-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-else-as-identifier.rs rename to src/test/parse-fail/keyword-else-as-identifier.rs diff --git a/src/test/compile-fail/keyword-enum-as-identifier.rs b/src/test/parse-fail/keyword-enum-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-enum-as-identifier.rs rename to src/test/parse-fail/keyword-enum-as-identifier.rs diff --git a/src/test/compile-fail/keyword-extern-as-identifier.rs b/src/test/parse-fail/keyword-extern-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-extern-as-identifier.rs rename to src/test/parse-fail/keyword-extern-as-identifier.rs diff --git a/src/test/compile-fail/keyword-final.rs b/src/test/parse-fail/keyword-final.rs similarity index 100% rename from src/test/compile-fail/keyword-final.rs rename to src/test/parse-fail/keyword-final.rs diff --git a/src/test/compile-fail/keyword-fn-as-identifier.rs b/src/test/parse-fail/keyword-fn-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-fn-as-identifier.rs rename to src/test/parse-fail/keyword-fn-as-identifier.rs diff --git a/src/test/compile-fail/keyword-for-as-identifier.rs b/src/test/parse-fail/keyword-for-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-for-as-identifier.rs rename to src/test/parse-fail/keyword-for-as-identifier.rs diff --git a/src/test/compile-fail/keyword-if-as-identifier.rs b/src/test/parse-fail/keyword-if-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-if-as-identifier.rs rename to src/test/parse-fail/keyword-if-as-identifier.rs diff --git a/src/test/compile-fail/keyword-impl-as-identifier.rs b/src/test/parse-fail/keyword-impl-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-impl-as-identifier.rs rename to src/test/parse-fail/keyword-impl-as-identifier.rs diff --git a/src/test/compile-fail/keyword-let-as-identifier.rs b/src/test/parse-fail/keyword-let-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-let-as-identifier.rs rename to src/test/parse-fail/keyword-let-as-identifier.rs diff --git a/src/test/compile-fail/keyword-loop-as-identifier.rs b/src/test/parse-fail/keyword-loop-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-loop-as-identifier.rs rename to src/test/parse-fail/keyword-loop-as-identifier.rs diff --git a/src/test/compile-fail/keyword-match-as-identifier.rs b/src/test/parse-fail/keyword-match-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-match-as-identifier.rs rename to src/test/parse-fail/keyword-match-as-identifier.rs diff --git a/src/test/compile-fail/keyword-mod-as-identifier.rs b/src/test/parse-fail/keyword-mod-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-mod-as-identifier.rs rename to src/test/parse-fail/keyword-mod-as-identifier.rs diff --git a/src/test/compile-fail/keyword-mut-as-identifier.rs b/src/test/parse-fail/keyword-mut-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-mut-as-identifier.rs rename to src/test/parse-fail/keyword-mut-as-identifier.rs diff --git a/src/test/compile-fail/keyword-override.rs b/src/test/parse-fail/keyword-override.rs similarity index 100% rename from src/test/compile-fail/keyword-override.rs rename to src/test/parse-fail/keyword-override.rs diff --git a/src/test/compile-fail/keyword-priv-as-identifier.rs b/src/test/parse-fail/keyword-priv-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-priv-as-identifier.rs rename to src/test/parse-fail/keyword-priv-as-identifier.rs diff --git a/src/test/compile-fail/keyword-pub-as-identifier.rs b/src/test/parse-fail/keyword-pub-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-pub-as-identifier.rs rename to src/test/parse-fail/keyword-pub-as-identifier.rs diff --git a/src/test/compile-fail/keyword-ref-as-identifier.rs b/src/test/parse-fail/keyword-ref-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-ref-as-identifier.rs rename to src/test/parse-fail/keyword-ref-as-identifier.rs diff --git a/src/test/compile-fail/keyword-return-as-identifier.rs b/src/test/parse-fail/keyword-return-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-return-as-identifier.rs rename to src/test/parse-fail/keyword-return-as-identifier.rs diff --git a/src/test/compile-fail/keyword-self-as-identifier.rs b/src/test/parse-fail/keyword-self-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-self-as-identifier.rs rename to src/test/parse-fail/keyword-self-as-identifier.rs diff --git a/src/test/compile-fail/keyword-static-as-identifier.rs b/src/test/parse-fail/keyword-static-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-static-as-identifier.rs rename to src/test/parse-fail/keyword-static-as-identifier.rs diff --git a/src/test/compile-fail/keyword-struct-as-identifier.rs b/src/test/parse-fail/keyword-struct-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-struct-as-identifier.rs rename to src/test/parse-fail/keyword-struct-as-identifier.rs diff --git a/src/test/compile-fail/keyword-super-as-identifier.rs b/src/test/parse-fail/keyword-super-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-super-as-identifier.rs rename to src/test/parse-fail/keyword-super-as-identifier.rs diff --git a/src/test/compile-fail/keyword-super.rs b/src/test/parse-fail/keyword-super.rs similarity index 100% rename from src/test/compile-fail/keyword-super.rs rename to src/test/parse-fail/keyword-super.rs diff --git a/src/test/compile-fail/keyword-trait-as-identifier.rs b/src/test/parse-fail/keyword-trait-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-trait-as-identifier.rs rename to src/test/parse-fail/keyword-trait-as-identifier.rs diff --git a/src/test/compile-fail/keyword-type-as-identifier.rs b/src/test/parse-fail/keyword-type-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-type-as-identifier.rs rename to src/test/parse-fail/keyword-type-as-identifier.rs diff --git a/src/test/compile-fail/keyword-typeof.rs b/src/test/parse-fail/keyword-typeof.rs similarity index 100% rename from src/test/compile-fail/keyword-typeof.rs rename to src/test/parse-fail/keyword-typeof.rs diff --git a/src/test/compile-fail/keyword-unsafe-as-identifier.rs b/src/test/parse-fail/keyword-unsafe-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-unsafe-as-identifier.rs rename to src/test/parse-fail/keyword-unsafe-as-identifier.rs diff --git a/src/test/compile-fail/keyword-use-as-identifier.rs b/src/test/parse-fail/keyword-use-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-use-as-identifier.rs rename to src/test/parse-fail/keyword-use-as-identifier.rs diff --git a/src/test/compile-fail/keyword-while-as-identifier.rs b/src/test/parse-fail/keyword-while-as-identifier.rs similarity index 100% rename from src/test/compile-fail/keyword-while-as-identifier.rs rename to src/test/parse-fail/keyword-while-as-identifier.rs diff --git a/src/test/compile-fail/keyword.rs b/src/test/parse-fail/keyword.rs similarity index 100% rename from src/test/compile-fail/keyword.rs rename to src/test/parse-fail/keyword.rs diff --git a/src/test/compile-fail/keywords-followed-by-double-colon.rs b/src/test/parse-fail/keywords-followed-by-double-colon.rs similarity index 100% rename from src/test/compile-fail/keywords-followed-by-double-colon.rs rename to src/test/parse-fail/keywords-followed-by-double-colon.rs diff --git a/src/test/compile-fail/lex-bad-char-literals.rs b/src/test/parse-fail/lex-bad-char-literals.rs similarity index 100% rename from src/test/compile-fail/lex-bad-char-literals.rs rename to src/test/parse-fail/lex-bad-char-literals.rs diff --git a/src/test/compile-fail/lex-bad-numeric-literals.rs b/src/test/parse-fail/lex-bad-numeric-literals.rs similarity index 100% rename from src/test/compile-fail/lex-bad-numeric-literals.rs rename to src/test/parse-fail/lex-bad-numeric-literals.rs diff --git a/src/test/compile-fail/lex-bad-token.rs b/src/test/parse-fail/lex-bad-token.rs similarity index 100% rename from src/test/compile-fail/lex-bad-token.rs rename to src/test/parse-fail/lex-bad-token.rs diff --git a/src/test/compile-fail/lex-bare-cr-string-literal-doc-comment.rs b/src/test/parse-fail/lex-bare-cr-string-literal-doc-comment.rs similarity index 100% rename from src/test/compile-fail/lex-bare-cr-string-literal-doc-comment.rs rename to src/test/parse-fail/lex-bare-cr-string-literal-doc-comment.rs diff --git a/src/test/compile-fail/lifetime-no-keyword.rs b/src/test/parse-fail/lifetime-no-keyword.rs similarity index 100% rename from src/test/compile-fail/lifetime-no-keyword.rs rename to src/test/parse-fail/lifetime-no-keyword.rs diff --git a/src/test/compile-fail/lifetime-obsoleted-self.rs b/src/test/parse-fail/lifetime-obsoleted-self.rs similarity index 100% rename from src/test/compile-fail/lifetime-obsoleted-self.rs rename to src/test/parse-fail/lifetime-obsoleted-self.rs diff --git a/src/test/compile-fail/macro-attribute.rs b/src/test/parse-fail/macro-attribute.rs similarity index 100% rename from src/test/compile-fail/macro-attribute.rs rename to src/test/parse-fail/macro-attribute.rs diff --git a/src/test/compile-fail/macro-bad-delimiter-ident.rs b/src/test/parse-fail/macro-bad-delimiter-ident.rs similarity index 100% rename from src/test/compile-fail/macro-bad-delimiter-ident.rs rename to src/test/parse-fail/macro-bad-delimiter-ident.rs diff --git a/src/test/compile-fail/macro-keyword.rs b/src/test/parse-fail/macro-keyword.rs similarity index 100% rename from src/test/compile-fail/macro-keyword.rs rename to src/test/parse-fail/macro-keyword.rs diff --git a/src/test/compile-fail/macro-mismatched-delim-brace-paren.rs b/src/test/parse-fail/macro-mismatched-delim-brace-paren.rs similarity index 100% rename from src/test/compile-fail/macro-mismatched-delim-brace-paren.rs rename to src/test/parse-fail/macro-mismatched-delim-brace-paren.rs diff --git a/src/test/compile-fail/macro-mismatched-delim-paren-brace.rs b/src/test/parse-fail/macro-mismatched-delim-paren-brace.rs similarity index 100% rename from src/test/compile-fail/macro-mismatched-delim-paren-brace.rs rename to src/test/parse-fail/macro-mismatched-delim-paren-brace.rs diff --git a/src/test/compile-fail/macros-no-semicolon-items.rs b/src/test/parse-fail/macros-no-semicolon-items.rs similarity index 100% rename from src/test/compile-fail/macros-no-semicolon-items.rs rename to src/test/parse-fail/macros-no-semicolon-items.rs diff --git a/src/test/compile-fail/macros-no-semicolon.rs b/src/test/parse-fail/macros-no-semicolon.rs similarity index 100% rename from src/test/compile-fail/macros-no-semicolon.rs rename to src/test/parse-fail/macros-no-semicolon.rs diff --git a/src/test/compile-fail/match-arrows-block-then-binop.rs b/src/test/parse-fail/match-arrows-block-then-binop.rs similarity index 100% rename from src/test/compile-fail/match-arrows-block-then-binop.rs rename to src/test/parse-fail/match-arrows-block-then-binop.rs diff --git a/src/test/compile-fail/match-vec-invalid.rs b/src/test/parse-fail/match-vec-invalid.rs similarity index 100% rename from src/test/compile-fail/match-vec-invalid.rs rename to src/test/parse-fail/match-vec-invalid.rs diff --git a/src/test/compile-fail/mod_file_not_exist.rs b/src/test/parse-fail/mod_file_not_exist.rs similarity index 100% rename from src/test/compile-fail/mod_file_not_exist.rs rename to src/test/parse-fail/mod_file_not_exist.rs diff --git a/src/test/compile-fail/mod_file_with_path_attr.rs b/src/test/parse-fail/mod_file_with_path_attr.rs similarity index 100% rename from src/test/compile-fail/mod_file_with_path_attr.rs rename to src/test/parse-fail/mod_file_with_path_attr.rs diff --git a/src/test/compile-fail/multiline-comment-line-tracking.rs b/src/test/parse-fail/multiline-comment-line-tracking.rs similarity index 100% rename from src/test/compile-fail/multiline-comment-line-tracking.rs rename to src/test/parse-fail/multiline-comment-line-tracking.rs diff --git a/src/test/compile-fail/multitrait.rs b/src/test/parse-fail/multitrait.rs similarity index 83% rename from src/test/compile-fail/multitrait.rs rename to src/test/parse-fail/multitrait.rs index a0e210aed4..f182eb8fa5 100644 --- a/src/test/compile-fail/multitrait.rs +++ b/src/test/parse-fail/multitrait.rs @@ -12,7 +12,8 @@ struct S { y: isize } -impl Cmp, ToString for S { //~ ERROR: expected one of `(`, `+`, `::`, or `{`, found `,` +impl Cmp, ToString for S { +//~^ ERROR: expected one of `(`, `+`, `::`, `<`, `for`, `where`, or `{`, found `,` fn eq(&&other: S) { false } fn to_string(&self) -> String { "hi".to_string() } } diff --git a/src/test/compile-fail/mut-patterns.rs b/src/test/parse-fail/mut-patterns.rs similarity index 100% rename from src/test/compile-fail/mut-patterns.rs rename to src/test/parse-fail/mut-patterns.rs diff --git a/src/test/compile-fail/new-unicode-escapes-1.rs b/src/test/parse-fail/new-unicode-escapes-1.rs similarity index 100% rename from src/test/compile-fail/new-unicode-escapes-1.rs rename to src/test/parse-fail/new-unicode-escapes-1.rs diff --git a/src/test/compile-fail/new-unicode-escapes-2.rs b/src/test/parse-fail/new-unicode-escapes-2.rs similarity index 100% rename from src/test/compile-fail/new-unicode-escapes-2.rs rename to src/test/parse-fail/new-unicode-escapes-2.rs diff --git a/src/test/compile-fail/new-unicode-escapes-3.rs b/src/test/parse-fail/new-unicode-escapes-3.rs similarity index 100% rename from src/test/compile-fail/new-unicode-escapes-3.rs rename to src/test/parse-fail/new-unicode-escapes-3.rs diff --git a/src/test/compile-fail/new-unicode-escapes-4.rs b/src/test/parse-fail/new-unicode-escapes-4.rs similarity index 100% rename from src/test/compile-fail/new-unicode-escapes-4.rs rename to src/test/parse-fail/new-unicode-escapes-4.rs diff --git a/src/test/compile-fail/no-binary-float-literal.rs b/src/test/parse-fail/no-binary-float-literal.rs similarity index 100% rename from src/test/compile-fail/no-binary-float-literal.rs rename to src/test/parse-fail/no-binary-float-literal.rs diff --git a/src/test/compile-fail/no-hex-float-literal.rs b/src/test/parse-fail/no-hex-float-literal.rs similarity index 100% rename from src/test/compile-fail/no-hex-float-literal.rs rename to src/test/parse-fail/no-hex-float-literal.rs diff --git a/src/test/compile-fail/no-unsafe-self.rs b/src/test/parse-fail/no-unsafe-self.rs similarity index 100% rename from src/test/compile-fail/no-unsafe-self.rs rename to src/test/parse-fail/no-unsafe-self.rs diff --git a/src/test/compile-fail/non-str-meta.rs b/src/test/parse-fail/non-str-meta.rs similarity index 100% rename from src/test/compile-fail/non-str-meta.rs rename to src/test/parse-fail/non-str-meta.rs diff --git a/src/test/compile-fail/not-a-pred.rs b/src/test/parse-fail/not-a-pred.rs similarity index 100% rename from src/test/compile-fail/not-a-pred.rs rename to src/test/parse-fail/not-a-pred.rs diff --git a/src/test/compile-fail/obsolete-for-sized.rs b/src/test/parse-fail/obsolete-for-sized.rs similarity index 100% rename from src/test/compile-fail/obsolete-for-sized.rs rename to src/test/parse-fail/obsolete-for-sized.rs diff --git a/src/test/compile-fail/obsolete-proc.rs b/src/test/parse-fail/obsolete-proc.rs similarity index 100% rename from src/test/compile-fail/obsolete-proc.rs rename to src/test/parse-fail/obsolete-proc.rs diff --git a/src/test/compile-fail/omitted-arg-in-item-fn.rs b/src/test/parse-fail/omitted-arg-in-item-fn.rs similarity index 100% rename from src/test/compile-fail/omitted-arg-in-item-fn.rs rename to src/test/parse-fail/omitted-arg-in-item-fn.rs diff --git a/src/test/compile-fail/paamayim-nekudotayim.rs b/src/test/parse-fail/paamayim-nekudotayim.rs similarity index 100% rename from src/test/compile-fail/paamayim-nekudotayim.rs rename to src/test/parse-fail/paamayim-nekudotayim.rs diff --git a/src/test/compile-fail/parenthesized-box-expr-message.rs b/src/test/parse-fail/parenthesized-box-expr-message.rs similarity index 100% rename from src/test/compile-fail/parenthesized-box-expr-message.rs rename to src/test/parse-fail/parenthesized-box-expr-message.rs diff --git a/src/test/compile-fail/pat-range-bad-dots.rs b/src/test/parse-fail/pat-range-bad-dots.rs similarity index 83% rename from src/test/compile-fail/pat-range-bad-dots.rs rename to src/test/parse-fail/pat-range-bad-dots.rs index 7f67d7a5fb..c52fb8c9b6 100644 --- a/src/test/compile-fail/pat-range-bad-dots.rs +++ b/src/test/parse-fail/pat-range-bad-dots.rs @@ -9,8 +9,8 @@ // except according to those terms. pub fn main() { - match 22is { - 0 .. 3 => {} //~ ERROR expected one of `...`, `=>`, or `|`, found `..` + match 22 { + 0 .. 3 => {} //~ ERROR expected one of `...`, `=>`, `if`, or `|`, found `..` _ => {} } } diff --git a/src/test/compile-fail/pat-ref-enum.rs b/src/test/parse-fail/pat-ref-enum.rs similarity index 100% rename from src/test/compile-fail/pat-ref-enum.rs rename to src/test/parse-fail/pat-ref-enum.rs diff --git a/src/test/compile-fail/qquote-1.rs b/src/test/parse-fail/qquote-1.rs similarity index 100% rename from src/test/compile-fail/qquote-1.rs rename to src/test/parse-fail/qquote-1.rs diff --git a/src/test/compile-fail/qquote-2.rs b/src/test/parse-fail/qquote-2.rs similarity index 100% rename from src/test/compile-fail/qquote-2.rs rename to src/test/parse-fail/qquote-2.rs diff --git a/src/test/parse-fail/range-3.rs b/src/test/parse-fail/range-3.rs new file mode 100644 index 0000000000..78c575d33b --- /dev/null +++ b/src/test/parse-fail/range-3.rs @@ -0,0 +1,16 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test range syntax - syntax errors. + +pub fn main() { + let r = 1..2..3; + //~^ ERROR expected one of `.`, `;`, or an operator, found `..` +} diff --git a/src/test/compile-fail/issue-6977.rs b/src/test/parse-fail/range-4.rs similarity index 76% rename from src/test/compile-fail/issue-6977.rs rename to src/test/parse-fail/range-4.rs index c2bd810aba..a3e27fbbe9 100644 --- a/src/test/compile-fail/issue-6977.rs +++ b/src/test/parse-fail/range-4.rs @@ -8,8 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Trying to create a fixed-length vector with a negative size +// Test range syntax - syntax errors. -fn main() { - let _x = [0; -1]; //~ ERROR found negative integer +pub fn main() { + let r = ..1..2; + //~^ ERROR expected one of `.`, `;`, or an operator, found `..` } diff --git a/src/test/compile-fail/raw-byte-string-eof.rs b/src/test/parse-fail/raw-byte-string-eof.rs similarity index 100% rename from src/test/compile-fail/raw-byte-string-eof.rs rename to src/test/parse-fail/raw-byte-string-eof.rs diff --git a/src/test/compile-fail/raw-byte-string-literals.rs b/src/test/parse-fail/raw-byte-string-literals.rs similarity index 100% rename from src/test/compile-fail/raw-byte-string-literals.rs rename to src/test/parse-fail/raw-byte-string-literals.rs diff --git a/src/test/compile-fail/raw-str-delim.rs b/src/test/parse-fail/raw-str-delim.rs similarity index 100% rename from src/test/compile-fail/raw-str-delim.rs rename to src/test/parse-fail/raw-str-delim.rs diff --git a/src/test/compile-fail/raw-str-unbalanced.rs b/src/test/parse-fail/raw-str-unbalanced.rs similarity index 100% rename from src/test/compile-fail/raw-str-unbalanced.rs rename to src/test/parse-fail/raw-str-unbalanced.rs diff --git a/src/test/compile-fail/raw-str-unterminated.rs b/src/test/parse-fail/raw-str-unterminated.rs similarity index 100% rename from src/test/compile-fail/raw-str-unterminated.rs rename to src/test/parse-fail/raw-str-unterminated.rs diff --git a/src/test/compile-fail/regions-fn-bound.rs b/src/test/parse-fail/regions-fn-bound.rs similarity index 100% rename from src/test/compile-fail/regions-fn-bound.rs rename to src/test/parse-fail/regions-fn-bound.rs diff --git a/src/test/compile-fail/regions-infer-paramd-method.rs b/src/test/parse-fail/regions-infer-paramd-method.rs similarity index 100% rename from src/test/compile-fail/regions-infer-paramd-method.rs rename to src/test/parse-fail/regions-infer-paramd-method.rs diff --git a/src/test/compile-fail/regions-out-of-scope-slice.rs b/src/test/parse-fail/regions-out-of-scope-slice.rs similarity index 100% rename from src/test/compile-fail/regions-out-of-scope-slice.rs rename to src/test/parse-fail/regions-out-of-scope-slice.rs diff --git a/src/test/compile-fail/regions-trait-2.rs b/src/test/parse-fail/regions-trait-2.rs similarity index 100% rename from src/test/compile-fail/regions-trait-2.rs rename to src/test/parse-fail/regions-trait-2.rs diff --git a/src/test/compile-fail/regions-trait-3.rs b/src/test/parse-fail/regions-trait-3.rs similarity index 100% rename from src/test/compile-fail/regions-trait-3.rs rename to src/test/parse-fail/regions-trait-3.rs diff --git a/src/test/compile-fail/removed-syntax-closure-lifetime.rs b/src/test/parse-fail/removed-syntax-closure-lifetime.rs similarity index 93% rename from src/test/compile-fail/removed-syntax-closure-lifetime.rs rename to src/test/parse-fail/removed-syntax-closure-lifetime.rs index a07832d5bb..0cea87dba1 100644 --- a/src/test/compile-fail/removed-syntax-closure-lifetime.rs +++ b/src/test/parse-fail/removed-syntax-closure-lifetime.rs @@ -8,4 +8,4 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -type closure = Box; //~ ERROR expected one of `(`, `+`, `,`, `::`, or `>`, found `/` +type closure = Box; //~ ERROR expected one of `(`, `+`, `,`, `::`, `<`, or `>`, found `/` diff --git a/src/test/compile-fail/removed-syntax-enum-newtype.rs b/src/test/parse-fail/removed-syntax-enum-newtype.rs similarity index 86% rename from src/test/compile-fail/removed-syntax-enum-newtype.rs rename to src/test/parse-fail/removed-syntax-enum-newtype.rs index 3b45fd8128..b067cee03d 100644 --- a/src/test/compile-fail/removed-syntax-enum-newtype.rs +++ b/src/test/parse-fail/removed-syntax-enum-newtype.rs @@ -8,4 +8,4 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -enum e = isize; //~ ERROR expected one of `<` or `{`, found `=` +enum e = isize; //~ ERROR expected one of `<`, `where`, or `{`, found `=` diff --git a/src/test/compile-fail/removed-syntax-extern-const.rs b/src/test/parse-fail/removed-syntax-extern-const.rs similarity index 81% rename from src/test/compile-fail/removed-syntax-extern-const.rs rename to src/test/parse-fail/removed-syntax-extern-const.rs index 98eec0977e..a0e1d04a3d 100644 --- a/src/test/compile-fail/removed-syntax-extern-const.rs +++ b/src/test/parse-fail/removed-syntax-extern-const.rs @@ -9,5 +9,6 @@ // except according to those terms. extern { - const i: isize; //~ ERROR unexpected token: `const` + const i: isize; + //~^ ERROR expected one of `fn`, `pub`, `static`, `unsafe`, or `}`, found `const` } diff --git a/src/test/compile-fail/removed-syntax-field-let.rs b/src/test/parse-fail/removed-syntax-field-let.rs similarity index 100% rename from src/test/compile-fail/removed-syntax-field-let.rs rename to src/test/parse-fail/removed-syntax-field-let.rs diff --git a/src/test/compile-fail/removed-syntax-field-semicolon.rs b/src/test/parse-fail/removed-syntax-field-semicolon.rs similarity index 100% rename from src/test/compile-fail/removed-syntax-field-semicolon.rs rename to src/test/parse-fail/removed-syntax-field-semicolon.rs diff --git a/src/test/compile-fail/removed-syntax-fixed-vec.rs b/src/test/parse-fail/removed-syntax-fixed-vec.rs similarity index 94% rename from src/test/compile-fail/removed-syntax-fixed-vec.rs rename to src/test/parse-fail/removed-syntax-fixed-vec.rs index 0ca2380ef6..0e8e20b389 100644 --- a/src/test/compile-fail/removed-syntax-fixed-vec.rs +++ b/src/test/parse-fail/removed-syntax-fixed-vec.rs @@ -8,4 +8,4 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -type v = [isize * 3]; //~ ERROR expected one of `(`, `+`, `::`, `;`, or `]`, found `*` +type v = [isize * 3]; //~ ERROR expected one of `(`, `+`, `::`, `;`, `<`, or `]`, found `*` diff --git a/src/test/compile-fail/removed-syntax-fn-pure.rs b/src/test/parse-fail/removed-syntax-fn-pure.rs similarity index 100% rename from src/test/compile-fail/removed-syntax-fn-pure.rs rename to src/test/parse-fail/removed-syntax-fn-pure.rs diff --git a/src/test/compile-fail/removed-syntax-fn-sigil.rs b/src/test/parse-fail/removed-syntax-fn-sigil.rs similarity index 100% rename from src/test/compile-fail/removed-syntax-fn-sigil.rs rename to src/test/parse-fail/removed-syntax-fn-sigil.rs diff --git a/src/test/compile-fail/removed-syntax-larrow-init.rs b/src/test/parse-fail/removed-syntax-larrow-init.rs similarity index 100% rename from src/test/compile-fail/removed-syntax-larrow-init.rs rename to src/test/parse-fail/removed-syntax-larrow-init.rs diff --git a/src/test/compile-fail/removed-syntax-larrow-move.rs b/src/test/parse-fail/removed-syntax-larrow-move.rs similarity index 100% rename from src/test/compile-fail/removed-syntax-larrow-move.rs rename to src/test/parse-fail/removed-syntax-larrow-move.rs diff --git a/src/test/compile-fail/removed-syntax-mode.rs b/src/test/parse-fail/removed-syntax-mode.rs similarity index 100% rename from src/test/compile-fail/removed-syntax-mode.rs rename to src/test/parse-fail/removed-syntax-mode.rs diff --git a/src/test/compile-fail/removed-syntax-mut-vec-expr.rs b/src/test/parse-fail/removed-syntax-mut-vec-expr.rs similarity index 100% rename from src/test/compile-fail/removed-syntax-mut-vec-expr.rs rename to src/test/parse-fail/removed-syntax-mut-vec-expr.rs diff --git a/src/test/compile-fail/removed-syntax-mut-vec-ty.rs b/src/test/parse-fail/removed-syntax-mut-vec-ty.rs similarity index 87% rename from src/test/compile-fail/removed-syntax-mut-vec-ty.rs rename to src/test/parse-fail/removed-syntax-mut-vec-ty.rs index 0f67a1d04e..9a7570a92f 100644 --- a/src/test/compile-fail/removed-syntax-mut-vec-ty.rs +++ b/src/test/parse-fail/removed-syntax-mut-vec-ty.rs @@ -10,4 +10,4 @@ type v = [mut isize]; //~^ ERROR expected identifier, found keyword `mut` - //~^^ ERROR expected one of `(`, `+`, `::`, `;`, or `]`, found `isize` + //~^^ ERROR expected one of `(`, `+`, `::`, `;`, `<`, or `]`, found `isize` diff --git a/src/test/compile-fail/removed-syntax-ptr-lifetime.rs b/src/test/parse-fail/removed-syntax-ptr-lifetime.rs similarity index 94% rename from src/test/compile-fail/removed-syntax-ptr-lifetime.rs rename to src/test/parse-fail/removed-syntax-ptr-lifetime.rs index d94f2ec1e0..44c65d98c0 100644 --- a/src/test/compile-fail/removed-syntax-ptr-lifetime.rs +++ b/src/test/parse-fail/removed-syntax-ptr-lifetime.rs @@ -8,4 +8,4 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -type bptr = &lifetime/isize; //~ ERROR expected one of `(`, `+`, `::`, or `;`, found `/` +type bptr = &lifetime/isize; //~ ERROR expected one of `(`, `+`, `::`, `;`, or `<`, found `/` diff --git a/src/test/compile-fail/removed-syntax-record.rs b/src/test/parse-fail/removed-syntax-record.rs similarity index 100% rename from src/test/compile-fail/removed-syntax-record.rs rename to src/test/parse-fail/removed-syntax-record.rs diff --git a/src/test/compile-fail/removed-syntax-static-fn.rs b/src/test/parse-fail/removed-syntax-static-fn.rs similarity index 80% rename from src/test/compile-fail/removed-syntax-static-fn.rs rename to src/test/parse-fail/removed-syntax-static-fn.rs index e3e1cb0f3c..caf939e7b8 100644 --- a/src/test/compile-fail/removed-syntax-static-fn.rs +++ b/src/test/parse-fail/removed-syntax-static-fn.rs @@ -11,5 +11,6 @@ struct S; impl S { - static fn f() {} //~ ERROR expected `fn`, found `static` + static fn f() {} + //~^ ERROR expected one of `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found `static` } diff --git a/src/test/compile-fail/removed-syntax-uniq-mut-expr.rs b/src/test/parse-fail/removed-syntax-uniq-mut-expr.rs similarity index 100% rename from src/test/compile-fail/removed-syntax-uniq-mut-expr.rs rename to src/test/parse-fail/removed-syntax-uniq-mut-expr.rs diff --git a/src/test/compile-fail/removed-syntax-uniq-mut-ty.rs b/src/test/parse-fail/removed-syntax-uniq-mut-ty.rs similarity index 87% rename from src/test/compile-fail/removed-syntax-uniq-mut-ty.rs rename to src/test/parse-fail/removed-syntax-uniq-mut-ty.rs index c051059aee..d1c2fc69f5 100644 --- a/src/test/compile-fail/removed-syntax-uniq-mut-ty.rs +++ b/src/test/parse-fail/removed-syntax-uniq-mut-ty.rs @@ -10,4 +10,4 @@ type mut_box = Box; //~^ ERROR expected identifier, found keyword `mut` - //~^^ ERROR expected one of `(`, `+`, `,`, `::`, or `>`, found `isize` + //~^^ ERROR expected one of `(`, `+`, `,`, `::`, `<`, or `>`, found `isize` diff --git a/src/test/compile-fail/removed-syntax-with-1.rs b/src/test/parse-fail/removed-syntax-with-1.rs similarity index 100% rename from src/test/compile-fail/removed-syntax-with-1.rs rename to src/test/parse-fail/removed-syntax-with-1.rs diff --git a/src/test/compile-fail/removed-syntax-with-2.rs b/src/test/parse-fail/removed-syntax-with-2.rs similarity index 100% rename from src/test/compile-fail/removed-syntax-with-2.rs rename to src/test/parse-fail/removed-syntax-with-2.rs diff --git a/src/test/compile-fail/require-parens-for-chained-comparison.rs b/src/test/parse-fail/require-parens-for-chained-comparison.rs similarity index 67% rename from src/test/compile-fail/require-parens-for-chained-comparison.rs rename to src/test/parse-fail/require-parens-for-chained-comparison.rs index 7513815ad7..f2705f5833 100644 --- a/src/test/compile-fail/require-parens-for-chained-comparison.rs +++ b/src/test/parse-fail/require-parens-for-chained-comparison.rs @@ -12,12 +12,12 @@ fn f() {} fn main() { false == false == false; - //~^ ERROR: Chained comparison operators require parentheses + //~^ ERROR: chained comparison operators require parentheses false == 0 < 2; - //~^ ERROR: Chained comparison operators require parentheses + //~^ ERROR: chained comparison operators require parentheses f(); - //~^ ERROR: Chained comparison operators require parentheses - //~^^ HELP: Use ::< instead of < if you meant to specify type arguments. + //~^ ERROR: chained comparison operators require parentheses + //~^^ HELP: use `::<...>` instead of `<...>` } diff --git a/src/test/compile-fail/struct-literal-in-for.rs b/src/test/parse-fail/struct-literal-in-for.rs similarity index 100% rename from src/test/compile-fail/struct-literal-in-for.rs rename to src/test/parse-fail/struct-literal-in-for.rs diff --git a/src/test/compile-fail/struct-literal-in-if.rs b/src/test/parse-fail/struct-literal-in-if.rs similarity index 100% rename from src/test/compile-fail/struct-literal-in-if.rs rename to src/test/parse-fail/struct-literal-in-if.rs diff --git a/src/test/compile-fail/struct-literal-in-match-discriminant.rs b/src/test/parse-fail/struct-literal-in-match-discriminant.rs similarity index 87% rename from src/test/compile-fail/struct-literal-in-match-discriminant.rs rename to src/test/parse-fail/struct-literal-in-match-discriminant.rs index 8f50940806..e6948b7c7c 100644 --- a/src/test/compile-fail/struct-literal-in-match-discriminant.rs +++ b/src/test/parse-fail/struct-literal-in-match-discriminant.rs @@ -14,7 +14,7 @@ struct Foo { fn main() { match Foo { - x: 3 //~ ERROR expected one of `!`, `=>`, `@`, or `|`, found `:` + x: 3 //~ ERROR expected one of `!`, `=>`, `@`, `if`, or `|`, found `:` } { Foo { x: x diff --git a/src/test/compile-fail/struct-literal-in-while.rs b/src/test/parse-fail/struct-literal-in-while.rs similarity index 100% rename from src/test/compile-fail/struct-literal-in-while.rs rename to src/test/parse-fail/struct-literal-in-while.rs diff --git a/src/test/compile-fail/struct-no-fields-2.rs b/src/test/parse-fail/struct-no-fields-2.rs similarity index 100% rename from src/test/compile-fail/struct-no-fields-2.rs rename to src/test/parse-fail/struct-no-fields-2.rs diff --git a/src/test/compile-fail/struct-no-fields-3.rs b/src/test/parse-fail/struct-no-fields-3.rs similarity index 100% rename from src/test/compile-fail/struct-no-fields-3.rs rename to src/test/parse-fail/struct-no-fields-3.rs diff --git a/src/test/compile-fail/struct-no-fields-4.rs b/src/test/parse-fail/struct-no-fields-4.rs similarity index 100% rename from src/test/compile-fail/struct-no-fields-4.rs rename to src/test/parse-fail/struct-no-fields-4.rs diff --git a/src/test/compile-fail/struct-no-fields-5.rs b/src/test/parse-fail/struct-no-fields-5.rs similarity index 100% rename from src/test/compile-fail/struct-no-fields-5.rs rename to src/test/parse-fail/struct-no-fields-5.rs diff --git a/src/test/compile-fail/struct-no-fields-enumlike.rs b/src/test/parse-fail/struct-no-fields-enumlike.rs similarity index 100% rename from src/test/compile-fail/struct-no-fields-enumlike.rs rename to src/test/parse-fail/struct-no-fields-enumlike.rs diff --git a/src/test/compile-fail/struct-no-fields.rs b/src/test/parse-fail/struct-no-fields.rs similarity index 100% rename from src/test/compile-fail/struct-no-fields.rs rename to src/test/parse-fail/struct-no-fields.rs diff --git a/src/test/compile-fail/struct-variant-no-fields.rs b/src/test/parse-fail/struct-variant-no-fields.rs similarity index 100% rename from src/test/compile-fail/struct-variant-no-fields.rs rename to src/test/parse-fail/struct-variant-no-fields.rs diff --git a/src/test/compile-fail/struct-variant-no-pub.rs b/src/test/parse-fail/struct-variant-no-pub.rs similarity index 100% rename from src/test/compile-fail/struct-variant-no-pub.rs rename to src/test/parse-fail/struct-variant-no-pub.rs diff --git a/src/test/compile-fail/syntax-trait-polarity.rs b/src/test/parse-fail/syntax-trait-polarity.rs similarity index 100% rename from src/test/compile-fail/syntax-trait-polarity.rs rename to src/test/parse-fail/syntax-trait-polarity.rs diff --git a/src/test/compile-fail/tag-variant-disr-non-nullary.rs b/src/test/parse-fail/tag-variant-disr-non-nullary.rs similarity index 100% rename from src/test/compile-fail/tag-variant-disr-non-nullary.rs rename to src/test/parse-fail/tag-variant-disr-non-nullary.rs diff --git a/src/test/compile-fail/trailing-carriage-return-in-string.rs b/src/test/parse-fail/trailing-carriage-return-in-string.rs similarity index 100% rename from src/test/compile-fail/trailing-carriage-return-in-string.rs rename to src/test/parse-fail/trailing-carriage-return-in-string.rs diff --git a/src/test/compile-fail/trailing-plus-in-bounds.rs b/src/test/parse-fail/trailing-plus-in-bounds.rs similarity index 93% rename from src/test/compile-fail/trailing-plus-in-bounds.rs rename to src/test/parse-fail/trailing-plus-in-bounds.rs index 069c2e8879..e8f9ed4d2c 100644 --- a/src/test/compile-fail/trailing-plus-in-bounds.rs +++ b/src/test/parse-fail/trailing-plus-in-bounds.rs @@ -11,7 +11,7 @@ use std::fmt::Show; fn main() { - let x: Box = box 3is as Box; + let x: Box = box 3 as Box; //~^ ERROR at least one type parameter bound must be specified //~^^ ERROR at least one type parameter bound must be specified } diff --git a/src/test/compile-fail/trait-bounds-not-on-impl.rs b/src/test/parse-fail/trait-bounds-not-on-impl.rs similarity index 100% rename from src/test/compile-fail/trait-bounds-not-on-impl.rs rename to src/test/parse-fail/trait-bounds-not-on-impl.rs diff --git a/src/test/compile-fail/trait-keyword.rs b/src/test/parse-fail/trait-keyword.rs similarity index 100% rename from src/test/compile-fail/trait-keyword.rs rename to src/test/parse-fail/trait-keyword.rs diff --git a/src/test/compile-fail/type-parameters-in-field-exprs.rs b/src/test/parse-fail/type-parameters-in-field-exprs.rs similarity index 100% rename from src/test/compile-fail/type-parameters-in-field-exprs.rs rename to src/test/parse-fail/type-parameters-in-field-exprs.rs diff --git a/src/test/compile-fail/unbalanced-doublequote.rs b/src/test/parse-fail/unbalanced-doublequote.rs similarity index 100% rename from src/test/compile-fail/unbalanced-doublequote.rs rename to src/test/parse-fail/unbalanced-doublequote.rs diff --git a/src/test/compile-fail/unboxed-closure-sugar-used-on-struct-3.rs b/src/test/parse-fail/unboxed-closure-sugar-used-on-struct-3.rs similarity index 100% rename from src/test/compile-fail/unboxed-closure-sugar-used-on-struct-3.rs rename to src/test/parse-fail/unboxed-closure-sugar-used-on-struct-3.rs diff --git a/src/test/compile-fail/unsized.rs b/src/test/parse-fail/unsized.rs similarity index 100% rename from src/test/compile-fail/unsized.rs rename to src/test/parse-fail/unsized.rs diff --git a/src/test/compile-fail/unsized2.rs b/src/test/parse-fail/unsized2.rs similarity index 81% rename from src/test/compile-fail/unsized2.rs rename to src/test/parse-fail/unsized2.rs index 604f7ba325..b2eb2064ae 100644 --- a/src/test/compile-fail/unsized2.rs +++ b/src/test/parse-fail/unsized2.rs @@ -15,6 +15,6 @@ fn f() {} pub fn main() { f(); //~^ ERROR expected identifier, found keyword `type` - //~^^ ERROR: Chained comparison operators require parentheses - //~^^^ HELP: Use ::< instead of < if you meant to specify type arguments. + //~^^ ERROR: chained comparison + //~^^^ HELP: use `::< } diff --git a/src/test/parse-fail/use-as-where-use-ends-with-mod-sep.rs b/src/test/parse-fail/use-as-where-use-ends-with-mod-sep.rs new file mode 100644 index 0000000000..524fd01b94 --- /dev/null +++ b/src/test/parse-fail/use-as-where-use-ends-with-mod-sep.rs @@ -0,0 +1,12 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::any:: as foo; //~ ERROR expected identifier, found keyword `as` +//~^ ERROR: expected one of `::`, `;`, or `as`, found `foo` diff --git a/src/test/parse-fail/use-ends-with-mod-sep.rs b/src/test/parse-fail/use-ends-with-mod-sep.rs new file mode 100644 index 0000000000..a375a5962a --- /dev/null +++ b/src/test/parse-fail/use-ends-with-mod-sep.rs @@ -0,0 +1,11 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::any::; //~ ERROR expected identifier or `{` or `*`, found `;` diff --git a/src/test/run-make/dep-info-custom/bar.rs b/src/test/parse-fail/use-mod-4.rs similarity index 84% rename from src/test/run-make/dep-info-custom/bar.rs rename to src/test/parse-fail/use-mod-4.rs index 4c79f7e285..a8b551b537 100644 --- a/src/test/run-make/dep-info-custom/bar.rs +++ b/src/test/parse-fail/use-mod-4.rs @@ -8,4 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub fn bar() {} +use foo::self; +//~^ ERROR expected identifier, found keyword `self` + +fn main() {} + diff --git a/src/test/compile-fail/variadic-ffi-1.rs b/src/test/parse-fail/variadic-ffi-1.rs similarity index 100% rename from src/test/compile-fail/variadic-ffi-1.rs rename to src/test/parse-fail/variadic-ffi-1.rs diff --git a/src/test/compile-fail/variadic-ffi-3.rs b/src/test/parse-fail/variadic-ffi-3.rs similarity index 100% rename from src/test/compile-fail/variadic-ffi-3.rs rename to src/test/parse-fail/variadic-ffi-3.rs diff --git a/src/test/compile-fail/variadic-ffi-4.rs b/src/test/parse-fail/variadic-ffi-4.rs similarity index 100% rename from src/test/compile-fail/variadic-ffi-4.rs rename to src/test/parse-fail/variadic-ffi-4.rs diff --git a/src/test/compile-fail/virtual-structs.rs b/src/test/parse-fail/virtual-structs.rs similarity index 100% rename from src/test/compile-fail/virtual-structs.rs rename to src/test/parse-fail/virtual-structs.rs diff --git a/src/test/compile-fail/where-clauses-no-bounds-or-predicates.rs b/src/test/parse-fail/where-clauses-no-bounds-or-predicates.rs similarity index 100% rename from src/test/compile-fail/where-clauses-no-bounds-or-predicates.rs rename to src/test/parse-fail/where-clauses-no-bounds-or-predicates.rs diff --git a/src/test/pretty/attr-fn-inner.rs b/src/test/pretty/attr-fn-inner.rs index 65dcf90056..79964d2a7b 100644 --- a/src/test/pretty/attr-fn-inner.rs +++ b/src/test/pretty/attr-fn-inner.rs @@ -13,6 +13,8 @@ // preserved, and that the first outer item parsed in main is not // accidentally carried over to each inner function +#![feature(custom_attribute)] + fn main() { #![inner_attr] #[outer_attr] diff --git a/src/test/pretty/block-comment-wchar.pp b/src/test/pretty/block-comment-wchar.pp index fbdd15b606..5a55cb4e56 100644 --- a/src/test/pretty/block-comment-wchar.pp +++ b/src/test/pretty/block-comment-wchar.pp @@ -109,7 +109,7 @@ fn main() { '\u2000', '\u2001', '\u2002', '\u2003', '\u2004', '\u2005', '\u2006', '\u2007', '\u2008', '\u2009', '\u200A', '\u2028', '\u2029', '\u202F', '\u205F', '\u3000']; - for c in chars.iter() { + for c in &chars { let ws = c.is_whitespace(); println!("{} {}" , c , ws); } diff --git a/src/test/pretty/block-comment-wchar.rs b/src/test/pretty/block-comment-wchar.rs index cc5640ce82..c82bdcd8dc 100644 --- a/src/test/pretty/block-comment-wchar.rs +++ b/src/test/pretty/block-comment-wchar.rs @@ -103,7 +103,7 @@ fn main() { '\u2000', '\u2001', '\u2002', '\u2003', '\u2004', '\u2005', '\u2006', '\u2007', '\u2008', '\u2009', '\u200A', '\u2028', '\u2029', '\u202F', '\u205F', '\u3000']; - for c in chars.iter() { + for c in &chars { let ws = c.is_whitespace(); println!("{} {}", c , ws); } diff --git a/src/test/pretty/block-disambig.rs b/src/test/pretty/block-disambig.rs index db01bc94e3..c9cb72d8af 100644 --- a/src/test/pretty/block-disambig.rs +++ b/src/test/pretty/block-disambig.rs @@ -15,14 +15,13 @@ use std::cell::Cell; -fn test1() { let val = &0i; { } *val; } +fn test1() { let val = &0; { } *val; } -fn test2() -> int { let val = &0i; { } *val } +fn test2() -> int { let val = &0; { } *val } +#[derive(Copy)] struct S { eax: int } -impl Copy for S {} - fn test3() { let regs = &Cell::new(S {eax: 0}); match true { true => { } _ => { } } @@ -36,13 +35,13 @@ fn test5() -> (int, int) { { } (0, 1) } fn test6() -> bool { { } (true || false) && true } fn test7() -> uint { - let regs = &0i; + let regs = &0; match true { true => { } _ => { } } (*regs < 2) as uint } fn test8() -> int { - let val = &0i; + let val = &0; match true { true => { } _ => { } @@ -55,12 +54,12 @@ fn test8() -> int { } fn test9() { - let regs = &Cell::new(0i); + let regs = &Cell::new(0); match true { true => { } _ => { } } regs.set(regs.get() + 1); } fn test10() -> int { - let regs = vec!(0i); + let regs = vec!(0); match true { true => { } _ => { } } regs[0] } diff --git a/src/test/pretty/empty-impl.rs b/src/test/pretty/empty-impl.rs index f22f1b4095..f5205de5c1 100644 --- a/src/test/pretty/empty-impl.rs +++ b/src/test/pretty/empty-impl.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait X { } +trait X { fn dummy(&self) { } } impl X for uint { } -trait Y { } +trait Y { fn dummy(&self) { } } impl Y for uint { } diff --git a/src/test/pretty/empty-lines.rs b/src/test/pretty/empty-lines.rs index 3725ff8bb3..58f6ae960b 100644 --- a/src/test/pretty/empty-lines.rs +++ b/src/test/pretty/empty-lines.rs @@ -13,5 +13,5 @@ fn a() -> uint { - 1u + 1usize } diff --git a/src/test/pretty/fn-return.rs b/src/test/pretty/fn-return.rs new file mode 100644 index 0000000000..8a223296e5 --- /dev/null +++ b/src/test/pretty/fn-return.rs @@ -0,0 +1,17 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// pp-exact + +// Check that `fn f() -> () { }` does not print as `fn f() { }`. + +fn f() -> () { } + +fn main() { } diff --git a/src/test/pretty/for-comment.rs b/src/test/pretty/for-comment.rs index 2318e783b6..0f2a667e11 100644 --- a/src/test/pretty/for-comment.rs +++ b/src/test/pretty/for-comment.rs @@ -12,7 +12,7 @@ fn f(v: &[int]) -> int { let mut n = 0; - for e in v.iter() { + for e in v { n = *e; // This comment once triggered pretty printer bug } diff --git a/src/test/pretty/issue-4264.pp b/src/test/pretty/issue-4264.pp index dac6e628d1..83ee2bd08f 100644 --- a/src/test/pretty/issue-4264.pp +++ b/src/test/pretty/issue-4264.pp @@ -1,8 +1,9 @@ +#![feature(no_std)] #![no_std] -#[macro_use] -extern crate "std" as std; #[prelude_import] use std::prelude::v1::*; +#[macro_use] +extern crate "std" as std; // 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. @@ -19,18 +20,18 @@ use std::prelude::v1::*; // #4264 fixed-length vector types -pub fn foo(_: [isize; (3 as usize)]) { } +pub fn foo(_: [i32; (3 as usize)]) { } pub fn bar() { - const FOO: usize = ((5us as usize) - (4us as usize) as usize); + const FOO: usize = ((5 as usize) - (4 as usize) as usize); let _: [(); (FOO as usize)] = ([(() as ())] as [(); 1]); - let _: [(); (1us as usize)] = ([(() as ())] as [(); 1]); + let _: [(); (1usize as usize)] = ([(() as ())] as [(); 1]); let _ = - (((&((([(1is as isize), (2 as isize), (3 as isize)] as [isize; 3])) as - [isize; 3]) as &[isize; 3]) as *const _ as *const [isize; 3]) - as *const [isize; (3us as usize)] as *const [isize; 3]); + (((&((([(1 as i32), (2 as i32), (3 as i32)] as [i32; 3])) as [i32; 3]) + as &[i32; 3]) as *const _ as *const [i32; 3]) as + *const [i32; (3usize as usize)] as *const [i32; 3]); @@ -41,58 +42,55 @@ pub fn bar() { ((::std::fmt::format as - fn(core::fmt::Arguments<'_>) -> collections::string::String {std::fmt::format})(((::std::fmt::Arguments::new - as - fn(&[&str], &[core::fmt::Argument<'_>]) -> core::fmt::Arguments<'_> {core::fmt::Arguments<'a>::new})(({ - #[inline] - #[allow(dead_code)] - static __STATIC_FMTSTR: - &'static [&'static str] - = - (&([("test" + fn(core::fmt::Arguments<'_>) -> collections::string::String {collections::fmt::format})(((::std::fmt::Arguments::new_v1 + as + fn(&[&str], &[core::fmt::ArgumentV1<'_>]) -> core::fmt::Arguments<'_> {core::fmt::Arguments<'a>::new_v1})(({ + static __STATIC_FMTSTR: + &'static [&'static str] + = + (&([("test" + as + &'static str)] + as + [&'static str; 1]) + as + &'static [&'static str; 1]); + (__STATIC_FMTSTR + as + &'static [&'static str]) + } + as + &[&str]), + (&(match (() + as + ()) + { + () + => + ([] + as + [core::fmt::ArgumentV1<'_>; 0]), + } + as + [core::fmt::ArgumentV1<'_>; 0]) as - &'static str)] - as - [&'static str; 1]) - as - &'static [&'static str; 1]); - (__STATIC_FMTSTR - as - &'static [&'static str]) - } - as - &[&str]), - (&(match (() - as - ()) - { - () - => - ([] - as - [core::fmt::Argument<'_>; 0]), - } - as - [core::fmt::Argument<'_>; 0]) - as - &[core::fmt::Argument<'_>; 0])) - as - core::fmt::Arguments<'_>)) + &[core::fmt::ArgumentV1<'_>; 0])) + as + core::fmt::Arguments<'_>)) as collections::string::String); } -pub type Foo = [isize; (3us as usize)]; +pub type Foo = [i32; (3 as usize)]; pub struct Bar { - pub x: [isize; (3us as usize)], + pub x: [i32; (3 as usize)], } -pub struct TupleBar([isize; (4us as usize)]); -pub enum Baz { BazVariant([isize; (5us as usize)]), } +pub struct TupleBar([i32; (4 as usize)]); +pub enum Baz { BazVariant([i32; (5 as usize)]), } pub fn id(x: T) -> T { (x as T) } pub fn use_id() { let _ = - ((id::<[isize; (3us as usize)]> as - fn([isize; 3]) -> [isize; 3] {id})(([(1 as isize), (2 as isize), - (3 as isize)] as - [isize; 3])) as - [isize; 3]); + ((id::<[i32; (3 as usize)]> as + fn([i32; 3]) -> [i32; 3] {id})(([(1 as i32), (2 as i32), + (3 as i32)] as [i32; 3])) as + [i32; 3]); } fn main() { } diff --git a/src/test/pretty/issue-4264.rs b/src/test/pretty/issue-4264.rs index 75be2f23c2..3aa2f4826b 100644 --- a/src/test/pretty/issue-4264.rs +++ b/src/test/pretty/issue-4264.rs @@ -14,35 +14,35 @@ // #4264 fixed-length vector types -pub fn foo(_: [isize; 3]) {} +pub fn foo(_: [i32; 3]) {} pub fn bar() { - const FOO: usize = 5us - 4us; + const FOO: usize = 5 - 4; let _: [(); FOO] = [()]; - let _ : [(); 1us] = [()]; + let _ : [(); 1usize] = [()]; - let _ = &([1is,2,3]) as *const _ as *const [isize; 3us]; + let _ = &([1,2,3]) as *const _ as *const [i32; 3usize]; format!("test"); } -pub type Foo = [isize; 3us]; +pub type Foo = [i32; 3]; pub struct Bar { - pub x: [isize; 3us] + pub x: [i32; 3] } -pub struct TupleBar([isize; 4us]); +pub struct TupleBar([i32; 4]); pub enum Baz { - BazVariant([isize; 5us]) + BazVariant([i32; 5]) } pub fn id(x: T) -> T { x } pub fn use_id() { - let _ = id::<[isize; 3us]>([1,2,3]); + let _ = id::<[i32; 3]>([1,2,3]); } diff --git a/src/test/pretty/issue-929.rs b/src/test/pretty/issue-929.rs index 377f4669ff..75a6b91934 100644 --- a/src/test/pretty/issue-929.rs +++ b/src/test/pretty/issue-929.rs @@ -8,6 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn f() { if (1i == panic!()) { } else { } } +fn f() { if (1 == panic!()) { } else { } } fn main() { } diff --git a/src/test/pretty/match-block-expr.rs b/src/test/pretty/match-block-expr.rs index 44771a29bb..7751f155da 100644 --- a/src/test/pretty/match-block-expr.rs +++ b/src/test/pretty/match-block-expr.rs @@ -11,6 +11,6 @@ // pp-exact fn main() { - let x = match { 5i } { 1 => 5i, 2 => 6, _ => 7, }; + let x = match { 5 } { 1 => 5, 2 => 6, _ => 7, }; assert_eq!(x , 7); } diff --git a/src/test/pretty/match-naked-expr-medium.rs b/src/test/pretty/match-naked-expr-medium.rs index d2f8157ef6..39af19dbf6 100644 --- a/src/test/pretty/match-naked-expr-medium.rs +++ b/src/test/pretty/match-naked-expr-medium.rs @@ -11,7 +11,7 @@ // pp-exact fn main() { - let x = Some(3i); + let x = Some(3); let _y = match x { Some(_) => diff --git a/src/test/pretty/match-naked-expr.rs b/src/test/pretty/match-naked-expr.rs index 6b4f579f9c..02bbf667d9 100644 --- a/src/test/pretty/match-naked-expr.rs +++ b/src/test/pretty/match-naked-expr.rs @@ -11,7 +11,7 @@ // pp-exact fn main() { - let x = Some(3i); + let x = Some(3); let _y = match x { Some(_) => "some(_)".to_string(), diff --git a/src/test/pretty/path-type-bounds.rs b/src/test/pretty/path-type-bounds.rs index 382394b140..9e1f2aa8bf 100644 --- a/src/test/pretty/path-type-bounds.rs +++ b/src/test/pretty/path-type-bounds.rs @@ -11,7 +11,9 @@ // pp-exact -trait Tr { } +trait Tr { + fn dummy(&self) { } +} impl Tr for int { } fn foo<'a>(x: Box) -> Box { x } @@ -19,6 +21,6 @@ fn foo<'a>(x: Box) -> Box { x } fn main() { let x: Box; - Box::new(1i) as Box; + Box::new(1) as Box; } diff --git a/src/test/pretty/trait-polarity.rs b/src/test/pretty/trait-polarity.rs index 47c36ac7a4..7d3a921301 100644 --- a/src/test/pretty/trait-polarity.rs +++ b/src/test/pretty/trait-polarity.rs @@ -12,12 +12,8 @@ // pp-exact -trait UnsafeTrait { - fn foo(&self); -} +struct Test; -impl !UnsafeTrait for int { - fn foo(&self) { } -} +impl !Send for Test { } pub fn main() { } diff --git a/src/test/pretty/unary-op-disambig.rs b/src/test/pretty/unary-op-disambig.rs index 850904fe53..1592e010aa 100644 --- a/src/test/pretty/unary-op-disambig.rs +++ b/src/test/pretty/unary-op-disambig.rs @@ -18,10 +18,10 @@ fn block_nosemi() -> int { ({ 0 }) - 1 } fn if_semi() -> int { if true { f() } else { f() }; -1 } -fn if_nosemi() -> int { (if true { 0i } else { 0i }) - 1 } +fn if_nosemi() -> int { (if true { 0 } else { 0 }) - 1 } fn alt_semi() -> int { match true { true => { f() } _ => { } }; -1 } fn alt_no_semi() -> int { (match true { true => { 0 } _ => { 1 } }) - 1 } -fn stmt() { { f() }; -1i; } +fn stmt() { { f() }; -1; } diff --git a/src/test/pretty/vec-comments.pp b/src/test/pretty/vec-comments.pp index 401c63efbc..dc2dae1044 100644 --- a/src/test/pretty/vec-comments.pp +++ b/src/test/pretty/vec-comments.pp @@ -15,25 +15,25 @@ fn main() { let _v1 = [ // Comment - 0i, + 0, // Comment - 1i, + 1, // Comment - 2i]; + 2]; let _v2 = - [0i, // Comment - 1i, // Comment - 2i]; // Comment + [0, // Comment + 1, // Comment + 2]; // Comment let _v3 = [ /* Comment */ - 0i, + 0, /* Comment */ - 1i, + 1, /* Comment */ - 2i]; + 2]; let _v4 = - [0i, /* Comment */ - 1i, /* Comment */ - 2i]; /* Comment */ + [0, /* Comment */ + 1, /* Comment */ + 2]; /* Comment */ } diff --git a/src/test/pretty/vec-comments.rs b/src/test/pretty/vec-comments.rs index 401c63efbc..dc2dae1044 100644 --- a/src/test/pretty/vec-comments.rs +++ b/src/test/pretty/vec-comments.rs @@ -15,25 +15,25 @@ fn main() { let _v1 = [ // Comment - 0i, + 0, // Comment - 1i, + 1, // Comment - 2i]; + 2]; let _v2 = - [0i, // Comment - 1i, // Comment - 2i]; // Comment + [0, // Comment + 1, // Comment + 2]; // Comment let _v3 = [ /* Comment */ - 0i, + 0, /* Comment */ - 1i, + 1, /* Comment */ - 2i]; + 2]; let _v4 = - [0i, /* Comment */ - 1i, /* Comment */ - 2i]; /* Comment */ + [0, /* Comment */ + 1, /* Comment */ + 2]; /* Comment */ } diff --git a/src/test/run-fail/assert-as-macro.rs b/src/test/run-fail/assert-as-macro.rs index 59e79fe926..c52c11b1b9 100644 --- a/src/test/run-fail/assert-as-macro.rs +++ b/src/test/run-fail/assert-as-macro.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:assertion failed: 1is == 2 +// error-pattern:assertion failed: 1 == 2 fn main() { - assert!(1is == 2); + assert!(1 == 2); } diff --git a/src/test/run-fail/assert-eq-macro-panic.rs b/src/test/run-fail/assert-eq-macro-panic.rs index 4b1a420cb7..fd6d69efb4 100644 --- a/src/test/run-fail/assert-eq-macro-panic.rs +++ b/src/test/run-fail/assert-eq-macro-panic.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:assertion failed: `(left == right) && (right == left)` (left: `14i`, right: `15i`) +// error-pattern:assertion failed: `(left == right) && (right == left)` (left: `14`, right: `15`) fn main() { - assert_eq!(14i,15i); + assert_eq!(14,15); } diff --git a/src/test/run-fail/assert-macro-fmt.rs b/src/test/run-fail/assert-macro-fmt.rs index 223c60d6ae..78239a2217 100644 --- a/src/test/run-fail/assert-macro-fmt.rs +++ b/src/test/run-fail/assert-macro-fmt.rs @@ -11,5 +11,5 @@ // error-pattern:panicked at 'test-assert-fmt 42 rust' fn main() { - assert!(false, "test-assert-fmt {} {}", 42i, "rust"); + assert!(false, "test-assert-fmt {} {}", 42, "rust"); } diff --git a/src/test/run-fail/binop-panic.rs b/src/test/run-fail/binop-panic.rs index ac85b218ec..159c33198a 100644 --- a/src/test/run-fail/binop-panic.rs +++ b/src/test/run-fail/binop-panic.rs @@ -10,4 +10,4 @@ // error-pattern:quux fn my_err(s: String) -> ! { println!("{}", s); panic!("quux"); } -fn main() { 3u == my_err("bye".to_string()); } +fn main() { 3_usize == my_err("bye".to_string()); } diff --git a/src/test/run-fail/bounds-check-no-overflow.rs b/src/test/run-fail/bounds-check-no-overflow.rs index df9050e218..be4ad0781f 100644 --- a/src/test/run-fail/bounds-check-no-overflow.rs +++ b/src/test/run-fail/bounds-check-no-overflow.rs @@ -14,6 +14,6 @@ use std::uint; use std::mem::size_of; fn main() { - let xs = [1i, 2, 3]; + let xs = [1, 2, 3]; xs[uint::MAX / size_of::() + 1]; } diff --git a/src/test/run-fail/bug-2470-bounds-check-overflow-2.rs b/src/test/run-fail/bug-2470-bounds-check-overflow-2.rs index 0671284182..6dd329b729 100644 --- a/src/test/run-fail/bug-2470-bounds-check-overflow-2.rs +++ b/src/test/run-fail/bug-2470-bounds-check-overflow-2.rs @@ -14,14 +14,14 @@ use std::uint; fn main() { - let x = vec!(1u,2u,3u); + let x = vec!(1_usize,2_usize,3_usize); // This should cause a bounds-check panic, but may not if we do our // bounds checking by comparing a scaled index value to the vector's // length (in bytes), because the scaling of the index will cause it to // wrap around to a small number. - let idx = uint::MAX & !(uint::MAX >> 1u); + let idx = uint::MAX & !(uint::MAX >> 1_usize); println!("ov2 idx = 0x%x", idx); // This should panic. diff --git a/src/test/run-fail/bug-2470-bounds-check-overflow-3.rs b/src/test/run-fail/bug-2470-bounds-check-overflow-3.rs index 0cb73bc98a..ec7fde1710 100644 --- a/src/test/run-fail/bug-2470-bounds-check-overflow-3.rs +++ b/src/test/run-fail/bug-2470-bounds-check-overflow-3.rs @@ -15,7 +15,7 @@ use std::u64; #[cfg(target_arch="x86")] fn main() { - let x = vec!(1u,2u,3u); + let x = vec!(1_usize,2_usize,3_usize); // This should cause a bounds-check panic, but may not if we do our // bounds checking by truncating the index value to the size of the @@ -23,18 +23,18 @@ fn main() { // This test is only meaningful on 32-bit hosts. - let idx = u64::MAX & !(u64::MAX >> 1u); + let idx = u64::MAX & !(u64::MAX >> 1_usize); println!("ov3 idx = 0x%8.8x%8.8x", (idx >> 32) as uint, idx as uint); // This should panic. - println!("ov3 0x%x", x.as_slice()[idx]); + println!("ov3 0x%x", x[idx]); } #[cfg(any(target_arch="x86_64", target_arch = "aarch64"))] fn main() { // This version just panics anyways, for symmetry on 64-bit hosts. - let x = vec!(1u,2u,3u); - error!("ov3 0x%x", x.as_slice()[200]); + let x = vec!(1_usize,2_usize,3_usize); + error!("ov3 0x%x", x[200]); } diff --git a/src/test/run-fail/bug-2470-bounds-check-overflow.rs b/src/test/run-fail/bug-2470-bounds-check-overflow.rs index f8686d0dbb..e48d749d94 100644 --- a/src/test/run-fail/bug-2470-bounds-check-overflow.rs +++ b/src/test/run-fail/bug-2470-bounds-check-overflow.rs @@ -20,7 +20,7 @@ fn main() { // address of the 0th cell in the array (even though the index is // huge). - let x = vec!(1u,2u,3u); + let x = vec!(1_usize,2_usize,3_usize); let base = x.as_ptr() as uint; let idx = base / mem::size_of::(); diff --git a/src/test/run-fail/bug-811.rs b/src/test/run-fail/bug-811.rs index e46564f807..4ad8119728 100644 --- a/src/test/run-fail/bug-811.rs +++ b/src/test/run-fail/bug-811.rs @@ -9,6 +9,9 @@ // except according to those terms. // error-pattern:quux + +use std::marker::PhantomData; + fn test00_start(ch: chan_t, message: int) { send(ch, message); } type task_id = int; @@ -17,6 +20,7 @@ type port_id = int; struct chan_t { task: task_id, port: port_id, + marker: PhantomData<*mut T>, } fn send(_ch: chan_t, _data: T) { panic!(); } diff --git a/src/test/run-fail/die-macro-expr.rs b/src/test/run-fail/die-macro-expr.rs index 2014a108b3..f2253b7342 100644 --- a/src/test/run-fail/die-macro-expr.rs +++ b/src/test/run-fail/die-macro-expr.rs @@ -11,5 +11,5 @@ // error-pattern:test fn main() { - let _i: int = panic!("test"); + let __isize: int = panic!("test"); } diff --git a/src/test/run-fail/divide-by-zero.rs b/src/test/run-fail/divide-by-zero.rs index c58d30f272..de69b7b9fa 100644 --- a/src/test/run-fail/divide-by-zero.rs +++ b/src/test/run-fail/divide-by-zero.rs @@ -10,6 +10,6 @@ // error-pattern:attempted to divide by zero fn main() { - let y = 0i; - let _z = 1i / y; + let y = 0; + let _z = 1 / y; } diff --git a/src/test/run-fail/dst-raw-slice.rs b/src/test/run-fail/dst-raw-slice.rs index 39bf899a02..77cec8b632 100644 --- a/src/test/run-fail/dst-raw-slice.rs +++ b/src/test/run-fail/dst-raw-slice.rs @@ -12,7 +12,7 @@ // error-pattern:index out of bounds fn main() { - let a: *const [_] = &[1i, 2, 3]; + let a: *const [_] = &[1, 2, 3]; unsafe { let _b = (*a)[3]; } diff --git a/src/test/run-fail/explicit-panic-msg.rs b/src/test/run-fail/explicit-panic-msg.rs index ae6e72bdd4..c9c04e5f2d 100644 --- a/src/test/run-fail/explicit-panic-msg.rs +++ b/src/test/run-fail/explicit-panic-msg.rs @@ -13,7 +13,7 @@ // error-pattern:wooooo fn main() { - let mut a = 1i; - if 1i == 1 { a = 2; } + let mut a = 1; + if 1 == 1 { a = 2; } panic!(format!("woooo{}", "o")); } diff --git a/src/test/run-fail/expr-if-panic.rs b/src/test/run-fail/expr-if-panic.rs index f04c94a3bf..b6791271a1 100644 --- a/src/test/run-fail/expr-if-panic.rs +++ b/src/test/run-fail/expr-if-panic.rs @@ -10,4 +10,4 @@ // error-pattern:explicit panic -fn main() { let _x = if false { 0i } else if true { panic!() } else { 10i }; } +fn main() { let _x = if false { 0 } else if true { panic!() } else { 10 }; } diff --git a/src/test/run-fail/expr-match-panic.rs b/src/test/run-fail/expr-match-panic.rs index d5c005b702..3a6bd59b3a 100644 --- a/src/test/run-fail/expr-match-panic.rs +++ b/src/test/run-fail/expr-match-panic.rs @@ -10,4 +10,4 @@ // error-pattern:explicit panic -fn main() { let _x = match true { false => { 0i } true => { panic!() } }; } +fn main() { let _x = match true { false => { 0 } true => { panic!() } }; } diff --git a/src/test/run-fail/extern-panic.rs b/src/test/run-fail/extern-panic.rs index e7c6dcc2df..225ce5a741 100644 --- a/src/test/run-fail/extern-panic.rs +++ b/src/test/run-fail/extern-panic.rs @@ -26,10 +26,10 @@ mod rustrt { } extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t { - if data == 1u { + if data == 1_usize { data } else { - count(data - 1u) + count(data - 1u) + count(data - 1_usize) + count(data - 1_usize) } } @@ -41,9 +41,9 @@ fn count(n: uint) -> uint { } fn main() { - for _ in range(0, 10u) { + for _ in 0..10_usize { task::spawn(move|| { - let result = count(5u); + let result = count(5_usize); println!("result = %?", result); panic!(); }); diff --git a/src/test/run-fail/for-each-loop-panic.rs b/src/test/run-fail/for-each-loop-panic.rs index 472c8ae15b..a1a760c040 100644 --- a/src/test/run-fail/for-each-loop-panic.rs +++ b/src/test/run-fail/for-each-loop-panic.rs @@ -10,4 +10,4 @@ // error-pattern:moop -fn main() { for _ in range(0u, 10u) { panic!("moop"); } } +fn main() { for _ in 0_usize..10_usize { panic!("moop"); } } diff --git a/src/test/run-fail/if-check-panic.rs b/src/test/run-fail/if-check-panic.rs index 1ead81b009..19a57db5ec 100644 --- a/src/test/run-fail/if-check-panic.rs +++ b/src/test/run-fail/if-check-panic.rs @@ -10,9 +10,9 @@ // error-pattern:Number is odd fn even(x: uint) -> bool { - if x < 2u { + if x < 2_usize { return false; - } else if x == 2u { return true; } else { return even(x - 2u); } + } else if x == 2_usize { return true; } else { return even(x - 2_usize); } } fn foo(x: uint) { @@ -23,4 +23,4 @@ fn foo(x: uint) { } } -fn main() { foo(3u); } +fn main() { foo(3_usize); } diff --git a/src/test/run-fail/issue-12920.rs b/src/test/run-fail/issue-12920.rs index 8dbfc06152..cbc92c640d 100644 --- a/src/test/run-fail/issue-12920.rs +++ b/src/test/run-fail/issue-12920.rs @@ -11,5 +11,5 @@ // error-pattern:explicit panic pub fn main() { - panic!(); println!("{}", 1i); + panic!(); println!("{}", 1); } diff --git a/src/test/run-fail/issue-20971.rs b/src/test/run-fail/issue-20971.rs new file mode 100644 index 0000000000..818f0e1394 --- /dev/null +++ b/src/test/run-fail/issue-20971.rs @@ -0,0 +1,34 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Regression test for Issue #20971. + +// error-pattern:Hello, world! + +pub trait Parser { + type Input; + fn parse(&mut self, input: ::Input); +} + +impl Parser for () { + type Input = (); + fn parse(&mut self, input: ()) { + + } +} + +pub fn many() -> Box::Input> + 'static> { + panic!("Hello, world!") +} + +fn main() { + many() + .parse(()); +} diff --git a/src/test/run-fail/issue-3029.rs b/src/test/run-fail/issue-3029.rs index 0846ba2e71..4d048fe0fc 100644 --- a/src/test/run-fail/issue-3029.rs +++ b/src/test/run-fail/issue-3029.rs @@ -16,7 +16,7 @@ // error-pattern:so long fn main() { let mut x = Vec::new(); - let y = vec!(3i); + let y = vec!(3); panic!("so long"); x.extend(y.into_iter()); } diff --git a/src/test/run-fail/mod-zero.rs b/src/test/run-fail/mod-zero.rs index 5441505170..76d4de7ecb 100644 --- a/src/test/run-fail/mod-zero.rs +++ b/src/test/run-fail/mod-zero.rs @@ -10,6 +10,6 @@ // error-pattern:attempted remainder with a divisor of zero fn main() { - let y = 0i; - let _z = 1i % y; + let y = 0; + let _z = 1 % y; } diff --git a/src/test/run-fail/panic-macro-any.rs b/src/test/run-fail/panic-macro-any.rs index 231c57390b..ce6a5d46cc 100644 --- a/src/test/run-fail/panic-macro-any.rs +++ b/src/test/run-fail/panic-macro-any.rs @@ -14,5 +14,5 @@ #![feature(box_syntax)] fn main() { - panic!(box 413i as Box<::std::any::Any+Send>); + panic!(box 413 as Box<::std::any::Any+Send>); } diff --git a/src/test/run-fail/panic-macro-fmt.rs b/src/test/run-fail/panic-macro-fmt.rs index ac50f02cf3..50ad99c674 100644 --- a/src/test/run-fail/panic-macro-fmt.rs +++ b/src/test/run-fail/panic-macro-fmt.rs @@ -11,5 +11,5 @@ // error-pattern:panicked at 'test-fail-fmt 42 rust' fn main() { - panic!("test-fail-fmt {} {}", 42i, "rust"); + panic!("test-fail-fmt {} {}", 42, "rust"); } diff --git a/src/test/run-fail/panic-task-name-none.rs b/src/test/run-fail/panic-task-name-none.rs index 9beee3b184..3a5ac5a100 100644 --- a/src/test/run-fail/panic-task-name-none.rs +++ b/src/test/run-fail/panic-task-name-none.rs @@ -10,12 +10,11 @@ // error-pattern:thread '' panicked at 'test' -use std::thread::Thread; +use std::thread; fn main() { - let r: Result = Thread::scoped(move|| { + let r: Result<(),_> = thread::spawn(move|| { panic!("test"); - 1i }).join(); assert!(r.is_ok()); } diff --git a/src/test/run-fail/panic-task-name-owned.rs b/src/test/run-fail/panic-task-name-owned.rs index 714cec6fb3..8cab9e05f9 100644 --- a/src/test/run-fail/panic-task-name-owned.rs +++ b/src/test/run-fail/panic-task-name-owned.rs @@ -13,9 +13,9 @@ use std::thread::Builder; fn main() { - let r: Result = Builder::new().name("owned name".to_string()).scoped(move|| { + let r: () = Builder::new().name("owned name".to_string()).scoped(move|| { panic!("test"); - 1i - }).join(); - assert!(r.is_ok()); + () + }).unwrap().join(); + panic!(); } diff --git a/src/test/run-fail/panic.rs b/src/test/run-fail/panic.rs index dd4c58f176..7c6473ebfc 100644 --- a/src/test/run-fail/panic.rs +++ b/src/test/run-fail/panic.rs @@ -8,5 +8,5 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:1is == 2 -fn main() { assert!((1is == 2)); } +// error-pattern:1 == 2 +fn main() { assert!((1 == 2)); } diff --git a/src/test/run-fail/rt-set-exit-status-panic2.rs b/src/test/run-fail/rt-set-exit-status-panic2.rs index 446ef6f97e..775d38c8b3 100644 --- a/src/test/run-fail/rt-set-exit-status-panic2.rs +++ b/src/test/run-fail/rt-set-exit-status-panic2.rs @@ -12,7 +12,7 @@ #[macro_use] extern crate log; use std::os; -use std::thread::Thread; +use std::thread; struct r { x:int, @@ -35,7 +35,7 @@ fn r(x:int) -> r { fn main() { error!("whatever"); - let _t = Thread::spawn(move|| { + let _t = thread::spawn(move|| { let _i = r(5); }); panic!(); diff --git a/src/test/run-fail/task-spawn-barefn.rs b/src/test/run-fail/task-spawn-barefn.rs index d58148810d..406f7dbcb6 100644 --- a/src/test/run-fail/task-spawn-barefn.rs +++ b/src/test/run-fail/task-spawn-barefn.rs @@ -10,12 +10,12 @@ // error-pattern:Ensure that the child task runs by panicking -use std::thread::Thread; +use std::thread; fn main() { // the purpose of this test is to make sure that task::spawn() // works when provided with a bare function: - let r = Thread::scoped(startfn).join(); + let r = thread::spawn(startfn).join(); if r.is_err() { panic!() } diff --git a/src/test/run-fail/tls-exit-status.rs b/src/test/run-fail/tls-exit-status.rs index 5b44e37570..be619e3a82 100644 --- a/src/test/run-fail/tls-exit-status.rs +++ b/src/test/run-fail/tls-exit-status.rs @@ -11,9 +11,9 @@ // error-pattern:nonzero // exec-env:RUST_NEWRT=1 -use std::os; +use std::env; fn main() { - os::args(); + env::args(); panic!("please have a nonzero exit status"); } diff --git a/src/test/run-fail/unwind-interleaved.rs b/src/test/run-fail/unwind-interleaved.rs index 5012ded28b..91a33329a4 100644 --- a/src/test/run-fail/unwind-interleaved.rs +++ b/src/test/run-fail/unwind-interleaved.rs @@ -15,8 +15,8 @@ fn a() { } fn b() { panic!(); } fn main() { - let _x = vec!(0i); + let _x = vec!(0); a(); - let _y = vec!(0i); + let _y = vec!(0); b(); } diff --git a/src/test/run-fail/unwind-unique.rs b/src/test/run-fail/unwind-unique.rs index f39ded8f98..e1176b1bcd 100644 --- a/src/test/run-fail/unwind-unique.rs +++ b/src/test/run-fail/unwind-unique.rs @@ -18,6 +18,6 @@ fn failfn() { } fn main() { - box 0i; + box 0; failfn(); } diff --git a/src/test/run-make/alloc-extern-crates/Makefile b/src/test/run-make/alloc-extern-crates/Makefile new file mode 100644 index 0000000000..b8c5237855 --- /dev/null +++ b/src/test/run-make/alloc-extern-crates/Makefile @@ -0,0 +1,5 @@ +-include ../tools.mk + +all: + $(RUSTC) fakealloc.rs + $(RUSTC) ../../../liballoc/lib.rs --cfg feature=\"external_crate\" --extern external=$(TMPDIR)/$(shell $(RUSTC) --print file-names fakealloc.rs) diff --git a/src/test/run-make/alloc-extern-crates/fakealloc.rs b/src/test/run-make/alloc-extern-crates/fakealloc.rs new file mode 100644 index 0000000000..6d30956ab2 --- /dev/null +++ b/src/test/run-make/alloc-extern-crates/fakealloc.rs @@ -0,0 +1,36 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "rlib"] +#![feature(no_std, core)] +#![no_std] +extern crate core; + + +#[inline] +pub unsafe fn allocate(_size: usize, _align: usize) -> *mut u8 { 0 as *mut u8 } + +#[inline] +pub unsafe fn deallocate(_ptr: *mut u8, _old_size: usize, _align: usize) { } + +#[inline] +pub unsafe fn reallocate(_ptr: *mut u8, _old_size: usize, _size: usize, _align: usize) -> *mut u8 { + 0 as *mut u8 +} + +#[inline] +pub unsafe fn reallocate_inplace(_ptr: *mut u8, old_size: usize, _size: usize, + _align: usize) -> usize { old_size } + +#[inline] +pub fn usable_size(size: usize, _align: usize) -> usize { size } + +#[inline] +pub fn stats_print() { } diff --git a/src/llvm/test/tools/llvm-dwarfdump/ARM/lit.local.cfg b/src/test/run-make/allow-non-lint-warnings-cmdline/1 similarity index 100% rename from src/llvm/test/tools/llvm-dwarfdump/ARM/lit.local.cfg rename to src/test/run-make/allow-non-lint-warnings-cmdline/1 diff --git a/src/test/run-make/allow-non-lint-warnings-cmdline/Makefile b/src/test/run-make/allow-non-lint-warnings-cmdline/Makefile new file mode 100644 index 0000000000..961342591a --- /dev/null +++ b/src/test/run-make/allow-non-lint-warnings-cmdline/Makefile @@ -0,0 +1,12 @@ +-include ../tools.mk + +# Test that -A warnings makes the 'empty trait list for derive' warning go away +OUT=$(shell $(RUSTC) foo.rs -A warnings 2>&1 | grep "warning" ) + +all: foo + test -z '$(OUT)' + +# This is just to make sure the above command actually succeeds +foo: + $(RUSTC) foo.rs -A warnings + diff --git a/src/test/run-pass/export-non-interference.rs b/src/test/run-make/allow-non-lint-warnings-cmdline/foo.rs similarity index 78% rename from src/test/run-pass/export-non-interference.rs rename to src/test/run-make/allow-non-lint-warnings-cmdline/foo.rs index 94652e30fe..19ce5d0a7c 100644 --- a/src/test/run-pass/export-non-interference.rs +++ b/src/test/run-make/allow-non-lint-warnings-cmdline/foo.rs @@ -1,4 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// 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. // @@ -8,7 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -enum list_cell { cons(Box>), nil } +#[derive()] +#[derive(Copy)] +pub struct Foo; pub fn main() { } diff --git a/src/test/run-make/allow-warnings-cmdline-stability/1 b/src/test/run-make/allow-warnings-cmdline-stability/1 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/test/run-make/allow-warnings-cmdline-stability/Makefile b/src/test/run-make/allow-warnings-cmdline-stability/Makefile new file mode 100644 index 0000000000..64b7f58cae --- /dev/null +++ b/src/test/run-make/allow-warnings-cmdline-stability/Makefile @@ -0,0 +1,19 @@ +-include ../tools.mk + +# Test that -A warnings makes the 'empty trait list for derive' warning go away +DEP=$(shell $(RUSTC) bar.rs) +OUT=$(shell $(RUSTC) foo.rs -A warnings 2>&1 | grep "warning" ) + +all: foo bar + test -z '$(OUT)' + +# These are just to ensure that the above commands actually work +bar: + $(RUSTC) bar.rs + +foo: bar + $(RUSTC) foo.rs -A warnings + + + + diff --git a/src/test/run-make/allow-warnings-cmdline-stability/bar.rs b/src/test/run-make/allow-warnings-cmdline-stability/bar.rs new file mode 100644 index 0000000000..6a683d96b0 --- /dev/null +++ b/src/test/run-make/allow-warnings-cmdline-stability/bar.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "lib"] +#![feature(staged_api)] +#![staged_api] +#![unstable(feature = "test_feature")] + +pub fn baz() { } diff --git a/src/test/run-make/allow-warnings-cmdline-stability/foo.rs b/src/test/run-make/allow-warnings-cmdline-stability/foo.rs new file mode 100644 index 0000000000..fb23a21401 --- /dev/null +++ b/src/test/run-make/allow-warnings-cmdline-stability/foo.rs @@ -0,0 +1,13 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate bar; + +pub fn main() { bar::baz() } diff --git a/src/test/run-make/c-dynamic-dylib/cfoo.c b/src/test/run-make/c-dynamic-dylib/cfoo.c index 9fe07f82f9..113717a776 100644 --- a/src/test/run-make/c-dynamic-dylib/cfoo.c +++ b/src/test/run-make/c-dynamic-dylib/cfoo.c @@ -1 +1,2 @@ +// ignore-license int foo() { return 0; } diff --git a/src/test/run-make/c-dynamic-rlib/cfoo.c b/src/test/run-make/c-dynamic-rlib/cfoo.c index 9fe07f82f9..113717a776 100644 --- a/src/test/run-make/c-dynamic-rlib/cfoo.c +++ b/src/test/run-make/c-dynamic-rlib/cfoo.c @@ -1 +1,2 @@ +// ignore-license int foo() { return 0; } diff --git a/src/test/run-make/c-link-to-rust-dylib/bar.c b/src/test/run-make/c-link-to-rust-dylib/bar.c index bb4036b06e..5729d411c5 100644 --- a/src/test/run-make/c-link-to-rust-dylib/bar.c +++ b/src/test/run-make/c-link-to-rust-dylib/bar.c @@ -1,3 +1,4 @@ +// ignore-license void foo(); int main() { diff --git a/src/test/run-make/c-link-to-rust-staticlib/Makefile b/src/test/run-make/c-link-to-rust-staticlib/Makefile index 8a6d6e4dd6..477b85f362 100644 --- a/src/test/run-make/c-link-to-rust-staticlib/Makefile +++ b/src/test/run-make/c-link-to-rust-staticlib/Makefile @@ -1,9 +1,7 @@ -include ../tools.mk ifndef IS_WINDOWS -ifneq ($(shell uname),Darwin) - EXTRAFLAGS := -lm -lrt -ldl -lpthread -endif +EXTRAFLAGS := $(EXTRACFLAGS) endif # FIXME: ignore freebsd diff --git a/src/test/run-make/c-link-to-rust-staticlib/bar.c b/src/test/run-make/c-link-to-rust-staticlib/bar.c index bb4036b06e..5729d411c5 100644 --- a/src/test/run-make/c-link-to-rust-staticlib/bar.c +++ b/src/test/run-make/c-link-to-rust-staticlib/bar.c @@ -1,3 +1,4 @@ +// ignore-license void foo(); int main() { diff --git a/src/test/run-make/c-static-dylib/cfoo.c b/src/test/run-make/c-static-dylib/cfoo.c index 9fe07f82f9..113717a776 100644 --- a/src/test/run-make/c-static-dylib/cfoo.c +++ b/src/test/run-make/c-static-dylib/cfoo.c @@ -1 +1,2 @@ +// ignore-license int foo() { return 0; } diff --git a/src/test/run-make/c-static-rlib/cfoo.c b/src/test/run-make/c-static-rlib/cfoo.c index 9fe07f82f9..113717a776 100644 --- a/src/test/run-make/c-static-rlib/cfoo.c +++ b/src/test/run-make/c-static-rlib/cfoo.c @@ -1 +1,2 @@ +// ignore-license int foo() { return 0; } diff --git a/src/test/run-make/cannot-read-embedded-idents/create_and_compile.rs b/src/test/run-make/cannot-read-embedded-idents/create_and_compile.rs index 2d8fa352e2..89352a16d8 100644 --- a/src/test/run-make/cannot-read-embedded-idents/create_and_compile.rs +++ b/src/test/run-make/cannot-read-embedded-idents/create_and_compile.rs @@ -8,22 +8,22 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::os; -use std::io::{File, Command}; +use std::env; +use std::old_io::{File, Command}; // creates broken.rs, which has the Ident \x00name_0,ctxt_0\x00 // embedded within it, and then attempts to compile broken.rs with the // provided `rustc` fn main() { - let args = os::args(); - let rustc = args[1].as_slice(); - let tmpdir = Path::new(args[2].as_slice()); + let args: Vec = env::args().collect(); + let rustc = &args[1]; + let tmpdir = Path::new(&args[2]); let main_file = tmpdir.join("broken.rs"); let _ = File::create(&main_file).unwrap() .write_str("pub fn main() { - let \x00name_0,ctxt_0\x00 = 3i; + let \x00name_0,ctxt_0\x00 = 3; println!(\"{}\", \x00name_0,ctxt_0\x00); }"); @@ -31,14 +31,14 @@ fn main() { // can't exec it directly let result = Command::new("sh") .arg("-c") - .arg(format!("{} {}", - rustc, - main_file.as_str() - .unwrap()).as_slice()) + .arg(&format!("{} {}", + rustc, + main_file.as_str() + .unwrap())) .output().unwrap(); - let err = String::from_utf8_lossy(result.error.as_slice()); + let err = String::from_utf8_lossy(&result.error); // positive test so that this test will be updated when the // compiler changes. - assert!(err.as_slice().contains("unknown start of token")) + assert!(err.contains("unknown start of token")) } diff --git a/src/test/run-make/compiler-lookup-paths-2/Makefile b/src/test/run-make/compiler-lookup-paths-2/Makefile new file mode 100644 index 0000000000..bd7f62d5c2 --- /dev/null +++ b/src/test/run-make/compiler-lookup-paths-2/Makefile @@ -0,0 +1,8 @@ +-include ../tools.mk + +all: + mkdir -p $(TMPDIR)/a $(TMPDIR)/b + $(RUSTC) a.rs && mv $(TMPDIR)/liba.rlib $(TMPDIR)/a + $(RUSTC) b.rs -L $(TMPDIR)/a && mv $(TMPDIR)/libb.rlib $(TMPDIR)/b + $(RUSTC) c.rs -L crate=$(TMPDIR)/b -L dependency=$(TMPDIR)/a \ + && exit 1 || exit 0 diff --git a/src/librustc_driver/mod.rs b/src/test/run-make/compiler-lookup-paths-2/a.rs similarity index 82% rename from src/librustc_driver/mod.rs rename to src/test/run-make/compiler-lookup-paths-2/a.rs index 1fbbc9c052..e7572a5f61 100644 --- a/src/librustc_driver/mod.rs +++ b/src/test/run-make/compiler-lookup-paths-2/a.rs @@ -1,4 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// 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. // @@ -8,3 +8,4 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![crate_type = "lib"] diff --git a/src/test/run-make/compiler-lookup-paths-2/b.rs b/src/test/run-make/compiler-lookup-paths-2/b.rs new file mode 100644 index 0000000000..fee0da9b4c --- /dev/null +++ b/src/test/run-make/compiler-lookup-paths-2/b.rs @@ -0,0 +1,12 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "lib"] +extern crate a; diff --git a/src/test/run-make/test-shard-completeness/main.rs b/src/test/run-make/compiler-lookup-paths-2/c.rs similarity index 79% rename from src/test/run-make/test-shard-completeness/main.rs rename to src/test/run-make/compiler-lookup-paths-2/c.rs index 5eabd630b0..66fe51d109 100644 --- a/src/test/run-make/test-shard-completeness/main.rs +++ b/src/test/run-make/compiler-lookup-paths-2/c.rs @@ -1,4 +1,4 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// 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. // @@ -9,8 +9,5 @@ // except according to those terms. #![crate_type = "lib"] - -#[test] -fn test_1() { } -#[test] -fn test_2() { } +extern crate b; +extern crate a; diff --git a/src/test/run-make/crate-data-smoke/Makefile b/src/test/run-make/crate-data-smoke/Makefile index 093796e1dc..1afda45741 100644 --- a/src/test/run-make/crate-data-smoke/Makefile +++ b/src/test/run-make/crate-data-smoke/Makefile @@ -1,10 +1,10 @@ -include ../tools.mk all: - [ `$(RUSTC) --print-crate-name crate.rs` = "foo" ] - [ `$(RUSTC) --print-file-name crate.rs` = "$(call BIN,foo)" ] - [ `$(RUSTC) --print-file-name --crate-type=lib \ + [ `$(RUSTC) --print crate-name crate.rs` = "foo" ] + [ `$(RUSTC) --print file-names crate.rs` = "$(call BIN,foo)" ] + [ `$(RUSTC) --print file-names --crate-type=lib \ --test crate.rs` = "$(call BIN,foo)" ] - [ `$(RUSTC) --print-file-name --test lib.rs` = "$(call BIN,mylib)" ] - $(RUSTC) --print-file-name lib.rs - $(RUSTC) --print-file-name rlib.rs + [ `$(RUSTC) --print file-names --test lib.rs` = "$(call BIN,mylib)" ] + $(RUSTC) --print file-names lib.rs + $(RUSTC) --print file-names rlib.rs diff --git a/src/test/run-make/dep-info-custom/Makefile b/src/test/run-make/dep-info-custom/Makefile deleted file mode 100644 index efa6dfe981..0000000000 --- a/src/test/run-make/dep-info-custom/Makefile +++ /dev/null @@ -1,25 +0,0 @@ --include ../tools.mk - -# FIXME: ignore freebsd/windows -# (windows: see `../dep-info/Makefile`) -ifneq ($(shell uname),FreeBSD) -ifndef IS_WINDOWS -all: - $(RUSTC) --dep-info $(TMPDIR)/custom-deps-file.d --crate-type=lib lib.rs - sleep 1 - touch foo.rs - -rm -f $(TMPDIR)/done - $(MAKE) -drf Makefile.foo - rm $(TMPDIR)/done - pwd - $(MAKE) -drf Makefile.foo - rm $(TMPDIR)/done && exit 1 || exit 0 -else -all: - -endif - -else -all: - -endif diff --git a/src/test/run-make/dep-info-custom/Makefile.foo b/src/test/run-make/dep-info-custom/Makefile.foo deleted file mode 100644 index 88be7630e8..0000000000 --- a/src/test/run-make/dep-info-custom/Makefile.foo +++ /dev/null @@ -1,7 +0,0 @@ -LIB := $(shell $(RUSTC) --print file-names --crate-type=lib lib.rs) - -$(TMPDIR)/$(LIB): - $(RUSTC) --dep-info $(TMPDIR)/custom-deps-file.d --crate-type=lib lib.rs - touch $(TMPDIR)/done - --include $(TMPDIR)/custom-deps-file.d diff --git a/src/test/run-make/dep-info-spaces/Makefile b/src/test/run-make/dep-info-spaces/Makefile index 72dca3d3c9..eda8cb7008 100644 --- a/src/test/run-make/dep-info-spaces/Makefile +++ b/src/test/run-make/dep-info-spaces/Makefile @@ -5,7 +5,7 @@ ifneq ($(shell uname),FreeBSD) ifndef IS_WINDOWS all: - $(RUSTC) --dep-info $(TMPDIR)/custom-deps-file.d --crate-type=lib lib.rs + $(RUSTC) --emit link,dep-info --crate-type=lib lib.rs sleep 1 touch 'foo foo.rs' -rm -f $(TMPDIR)/done diff --git a/src/test/run-make/dep-info-spaces/Makefile.foo b/src/test/run-make/dep-info-spaces/Makefile.foo index 0e187565d6..2f4cc486d8 100644 --- a/src/test/run-make/dep-info-spaces/Makefile.foo +++ b/src/test/run-make/dep-info-spaces/Makefile.foo @@ -1,7 +1,7 @@ -LIB := $(shell $(RUSTC) --print-file-name --crate-type=lib lib.rs) +LIB := $(shell $(RUSTC) --print file-names --crate-type=lib lib.rs) $(TMPDIR)/$(LIB): - $(RUSTC) --dep-info $(TMPDIR)/custom-deps-file.d --crate-type=lib lib.rs + $(RUSTC) --emit link,dep-info --crate-type=lib lib.rs touch $(TMPDIR)/done --include $(TMPDIR)/custom-deps-file.d +-include $(TMPDIR)/lib.d diff --git a/src/test/run-make/dep-info/Makefile b/src/test/run-make/dep-info/Makefile index 6835ef34b0..a1828cd1f5 100644 --- a/src/test/run-make/dep-info/Makefile +++ b/src/test/run-make/dep-info/Makefile @@ -7,7 +7,7 @@ ifneq ($(shell uname),FreeBSD) ifndef IS_WINDOWS all: - $(RUSTC) --dep-info --crate-type=lib lib.rs + $(RUSTC) --emit dep-info,link --crate-type=lib lib.rs sleep 2 touch foo.rs -rm -f $(TMPDIR)/done diff --git a/src/test/run-make/duplicate-output-flavors/Makefile b/src/test/run-make/duplicate-output-flavors/Makefile index d40b6862a0..e33279966c 100644 --- a/src/test/run-make/duplicate-output-flavors/Makefile +++ b/src/test/run-make/duplicate-output-flavors/Makefile @@ -2,3 +2,4 @@ include ../tools.mk all: $(RUSTC) --crate-type=rlib foo.rs + $(RUSTC) --crate-type=rlib,rlib foo.rs diff --git a/src/test/run-make/error-found-staticlib-instead-crate/Makefile b/src/test/run-make/error-found-staticlib-instead-crate/Makefile new file mode 100644 index 0000000000..46be238563 --- /dev/null +++ b/src/test/run-make/error-found-staticlib-instead-crate/Makefile @@ -0,0 +1,5 @@ +-include ../tools.mk + +all: + $(RUSTC) foo.rs --crate-type staticlib + $(RUSTC) bar.rs 2>&1 | grep "error: found staticlib" diff --git a/src/test/run-make/error-found-staticlib-instead-crate/bar.rs b/src/test/run-make/error-found-staticlib-instead-crate/bar.rs new file mode 100644 index 0000000000..5ab3e5ee99 --- /dev/null +++ b/src/test/run-make/error-found-staticlib-instead-crate/bar.rs @@ -0,0 +1,15 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate foo; + +fn main() { + foo::foo(); +} diff --git a/src/test/run-make/dep-info-custom/foo.rs b/src/test/run-make/error-found-staticlib-instead-crate/foo.rs similarity index 86% rename from src/test/run-make/dep-info-custom/foo.rs rename to src/test/run-make/error-found-staticlib-instead-crate/foo.rs index 2661b1f4eb..222d98a12d 100644 --- a/src/test/run-make/dep-info-custom/foo.rs +++ b/src/test/run-make/error-found-staticlib-instead-crate/foo.rs @@ -1,4 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// 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. // diff --git a/src/test/run-make/error-writing-dependencies/Makefile b/src/test/run-make/error-writing-dependencies/Makefile index 9f91618bda..89fbfa0a1b 100644 --- a/src/test/run-make/error-writing-dependencies/Makefile +++ b/src/test/run-make/error-writing-dependencies/Makefile @@ -2,7 +2,7 @@ all: # Let's get a nice error message - $(RUSTC) foo.rs --dep-info foo/bar/baz 2>&1 | \ + $(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | \ grep "error writing dependencies" # Make sure the filename shows up - $(RUSTC) foo.rs --dep-info foo/bar/baz 2>&1 | grep "baz" + $(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | grep "baz" diff --git a/src/test/run-make/extern-flag-disambiguates/Makefile b/src/test/run-make/extern-flag-disambiguates/Makefile index 9b86bf9754..049b76c1b6 100644 --- a/src/test/run-make/extern-flag-disambiguates/Makefile +++ b/src/test/run-make/extern-flag-disambiguates/Makefile @@ -17,8 +17,10 @@ all: $(RUSTC) -C metadata=2 -C extra-filename=-2 a.rs $(RUSTC) b.rs --extern a=$(TMPDIR)/liba-1.rlib $(RUSTC) c.rs --extern a=$(TMPDIR)/liba-2.rlib + @echo before $(RUSTC) --cfg before d.rs --extern a=$(TMPDIR)/liba-1.rlib $(call RUN,d) + @echo after $(RUSTC) --cfg after d.rs --extern a=$(TMPDIR)/liba-1.rlib $(call RUN,d) diff --git a/src/test/run-make/extern-flag-disambiguates/a.rs b/src/test/run-make/extern-flag-disambiguates/a.rs index 11b9ba6fce..ac92aede78 100644 --- a/src/test/run-make/extern-flag-disambiguates/a.rs +++ b/src/test/run-make/extern-flag-disambiguates/a.rs @@ -11,6 +11,6 @@ #![crate_name = "a"] #![crate_type = "rlib"] -static FOO: uint = 3; +static FOO: usize = 3; -pub fn token() -> &'static uint { &FOO } +pub fn token() -> &'static usize { &FOO } diff --git a/src/test/run-make/extern-flag-disambiguates/b.rs b/src/test/run-make/extern-flag-disambiguates/b.rs index 3156cf0ba7..8ae238f5a4 100644 --- a/src/test/run-make/extern-flag-disambiguates/b.rs +++ b/src/test/run-make/extern-flag-disambiguates/b.rs @@ -13,7 +13,7 @@ extern crate a; -static FOO: uint = 3; +static FOO: usize = 3; -pub fn token() -> &'static uint { &FOO } -pub fn a_token() -> &'static uint { a::token() } +pub fn token() -> &'static usize { &FOO } +pub fn a_token() -> &'static usize { a::token() } diff --git a/src/test/run-make/extern-flag-disambiguates/c.rs b/src/test/run-make/extern-flag-disambiguates/c.rs index d3bbc762ef..6eccdf7e5c 100644 --- a/src/test/run-make/extern-flag-disambiguates/c.rs +++ b/src/test/run-make/extern-flag-disambiguates/c.rs @@ -13,7 +13,7 @@ extern crate a; -static FOO: uint = 3; +static FOO: usize = 3; -pub fn token() -> &'static uint { &FOO } -pub fn a_token() -> &'static uint { a::token() } +pub fn token() -> &'static usize { &FOO } +pub fn a_token() -> &'static usize { a::token() } diff --git a/src/test/run-make/extern-flag-disambiguates/d.rs b/src/test/run-make/extern-flag-disambiguates/d.rs index d850daffc3..90e1330d4a 100644 --- a/src/test/run-make/extern-flag-disambiguates/d.rs +++ b/src/test/run-make/extern-flag-disambiguates/d.rs @@ -13,7 +13,7 @@ extern crate b; extern crate c; #[cfg(after)] extern crate a; -fn t(a: &'static uint) -> uint { a as *const _ as uint } +fn t(a: &'static usize) -> usize { a as *const _ as usize } fn main() { assert!(t(a::token()) == t(b::a_token())); diff --git a/src/test/run-make/extern-fn-generic/test.c b/src/test/run-make/extern-fn-generic/test.c index f23dd1eb14..f9faef64af 100644 --- a/src/test/run-make/extern-fn-generic/test.c +++ b/src/test/run-make/extern-fn-generic/test.c @@ -1,16 +1,17 @@ +// ignore-license #include typedef struct TestStruct { - uint8_t x; - int32_t y; + uint8_t x; + int32_t y; } TestStruct; typedef int callback(TestStruct s); uint32_t call(callback *c) { - TestStruct s; - s.x = 'a'; - s.y = 3; + TestStruct s; + s.x = 'a'; + s.y = 3; - return c(s); + return c(s); } diff --git a/src/test/run-make/extern-fn-mangle/test.c b/src/test/run-make/extern-fn-mangle/test.c index 8d93917ade..1a9855dede 100644 --- a/src/test/run-make/extern-fn-mangle/test.c +++ b/src/test/run-make/extern-fn-mangle/test.c @@ -1,8 +1,9 @@ +// ignore-license #include uint32_t foo(); uint32_t bar(); uint32_t add() { - return foo() + bar(); + return foo() + bar(); } diff --git a/src/test/run-make/extern-fn-with-packed-struct/test.c b/src/test/run-make/extern-fn-with-packed-struct/test.c index c3456a64b9..121e48e84e 100644 --- a/src/test/run-make/extern-fn-with-packed-struct/test.c +++ b/src/test/run-make/extern-fn-with-packed-struct/test.c @@ -1,3 +1,4 @@ +// ignore-license // Pragma needed cause of gcc bug on windows: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991 #pragma pack(1) struct __attribute__((packed)) Foo { diff --git a/src/test/run-make/extern-fn-with-packed-struct/test.rs b/src/test/run-make/extern-fn-with-packed-struct/test.rs index b38db4c9eb..838ef33884 100644 --- a/src/test/run-make/extern-fn-with-packed-struct/test.rs +++ b/src/test/run-make/extern-fn-with-packed-struct/test.rs @@ -9,15 +9,13 @@ // except according to those terms. #[repr(packed)] -#[derive(PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] struct Foo { a: i8, b: i16, c: i8 } -impl Copy for Foo {} - #[link(name = "test", kind = "static")] extern { fn foo(f: Foo) -> Foo; diff --git a/src/test/run-make/extern-fn-with-union/test.c b/src/test/run-make/extern-fn-with-union/test.c index 86cb645372..8c87c23069 100644 --- a/src/test/run-make/extern-fn-with-union/test.c +++ b/src/test/run-make/extern-fn-with-union/test.c @@ -1,3 +1,4 @@ +// ignore-license #include #include diff --git a/src/test/run-make/extern-overrides-distribution/Makefile b/src/test/run-make/extern-overrides-distribution/Makefile new file mode 100644 index 0000000000..110db9f068 --- /dev/null +++ b/src/test/run-make/extern-overrides-distribution/Makefile @@ -0,0 +1,5 @@ +-include ../tools.mk + +all: + $(RUSTC) libc.rs + $(RUSTC) main.rs --extern libc=$(TMPDIR)/liblibc.rlib diff --git a/src/test/run-make/extern-overrides-distribution/libc.rs b/src/test/run-make/extern-overrides-distribution/libc.rs new file mode 100644 index 0000000000..a489d834a9 --- /dev/null +++ b/src/test/run-make/extern-overrides-distribution/libc.rs @@ -0,0 +1,13 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "lib"] + +pub fn foo() {} diff --git a/src/test/run-make/extern-overrides-distribution/main.rs b/src/test/run-make/extern-overrides-distribution/main.rs new file mode 100644 index 0000000000..92b353c892 --- /dev/null +++ b/src/test/run-make/extern-overrides-distribution/main.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate libc; + +fn main() { + libc::foo(); +} + diff --git a/src/test/run-make/graphviz-flowgraph/Makefile b/src/test/run-make/graphviz-flowgraph/Makefile index 0562e000e5..1533729de9 100644 --- a/src/test/run-make/graphviz-flowgraph/Makefile +++ b/src/test/run-make/graphviz-flowgraph/Makefile @@ -13,7 +13,7 @@ all: $(patsubst %.rs,$(TMPDIR)/%.check,$(FILES)) RUSTC_LIB=$(RUSTC) --crate-type=lib define FIND_LAST_BLOCK -LASTBLOCKNUM_$(1) := $(shell $(RUSTC_LIB) --pretty=expanded,identified $(1) \ +LASTBLOCKNUM_$(1) := $(shell $(RUSTC_LIB) -Z unstable-options --pretty=expanded,identified $(1) \ | grep block | tail -1 | sed -e 's@.*/\* block \([0-9]*\) \*/.*@\1@') @@ -28,7 +28,7 @@ $(TMPDIR)/%.pp: %.rs $(TMPDIR)/%.dot: %.rs $(eval $(call FIND_LAST_BLOCK,$<)) - $(RUSTC_LIB) -Z unstable-options --xpretty flowgraph=$(LASTBLOCKNUM_$<) $< -o $@.tmp + $(RUSTC_LIB) -Z unstable-options --xpretty flowgraph,unlabelled=$(LASTBLOCKNUM_$<) $< -o $@.tmp cat $@.tmp | sed -e 's@ (id=[0-9]*)@@g' \ -e 's@\[label=""\]@@' \ -e 's@digraph [a-zA-Z0-9_]* @digraph block @' \ diff --git a/src/test/run-make/graphviz-flowgraph/f01.dot-expected.dot b/src/test/run-make/graphviz-flowgraph/f01.dot-expected.dot index 694a06ed83..d924890b31 100644 --- a/src/test/run-make/graphviz-flowgraph/f01.dot-expected.dot +++ b/src/test/run-make/graphviz-flowgraph/f01.dot-expected.dot @@ -1,9 +1,9 @@ digraph block { N0[label="entry"]; N1[label="exit"]; - N2[label="expr 1is"]; - N3[label="stmt 1is;"]; - N4[label="block { 1is; }"]; + N2[label="expr 1"]; + N3[label="stmt 1;"]; + N4[label="block { 1; }"]; N0 -> N2; N2 -> N3; N3 -> N4; diff --git a/src/test/run-make/graphviz-flowgraph/f01.rs b/src/test/run-make/graphviz-flowgraph/f01.rs index 27b1980786..231aab69e5 100644 --- a/src/test/run-make/graphviz-flowgraph/f01.rs +++ b/src/test/run-make/graphviz-flowgraph/f01.rs @@ -9,5 +9,5 @@ // except according to those terms. pub fn lit_1() { - 1is; + 1; } diff --git a/src/test/run-make/graphviz-flowgraph/f03.dot-expected.dot b/src/test/run-make/graphviz-flowgraph/f03.dot-expected.dot index efa2c6404a..8b65007618 100644 --- a/src/test/run-make/graphviz-flowgraph/f03.dot-expected.dot +++ b/src/test/run-make/graphviz-flowgraph/f03.dot-expected.dot @@ -1,11 +1,11 @@ digraph block { N0[label="entry"]; N1[label="exit"]; - N2[label="expr 3is"]; + N2[label="expr 3"]; N3[label="expr 4"]; - N4[label="expr 3is + 4"]; - N5[label="stmt 3is + 4;"]; - N6[label="block { 3is + 4; }"]; + N4[label="expr 3 + 4"]; + N5[label="stmt 3 + 4;"]; + N6[label="block { 3 + 4; }"]; N0 -> N2; N2 -> N3; N3 -> N4; diff --git a/src/test/run-make/graphviz-flowgraph/f03.rs b/src/test/run-make/graphviz-flowgraph/f03.rs index c95dbcbb31..2dd71b623c 100644 --- a/src/test/run-make/graphviz-flowgraph/f03.rs +++ b/src/test/run-make/graphviz-flowgraph/f03.rs @@ -9,5 +9,5 @@ // except according to those terms. pub fn expr_add_3() { - 3is + 4; + 3 + 4; } diff --git a/src/test/run-make/graphviz-flowgraph/f04.dot-expected.dot b/src/test/run-make/graphviz-flowgraph/f04.dot-expected.dot index 1f375b767c..fde6cc2900 100644 --- a/src/test/run-make/graphviz-flowgraph/f04.dot-expected.dot +++ b/src/test/run-make/graphviz-flowgraph/f04.dot-expected.dot @@ -1,10 +1,10 @@ digraph block { N0[label="entry"]; N1[label="exit"]; - N2[label="expr 4is"]; + N2[label="expr 4"]; N3[label="local _x"]; - N4[label="stmt let _x = 4is;"]; - N5[label="block { let _x = 4is; }"]; + N4[label="stmt let _x = 4;"]; + N5[label="block { let _x = 4; }"]; N0 -> N2; N2 -> N3; N3 -> N4; diff --git a/src/test/run-make/graphviz-flowgraph/f04.rs b/src/test/run-make/graphviz-flowgraph/f04.rs index 552cb24c75..2a0ac8ac9e 100644 --- a/src/test/run-make/graphviz-flowgraph/f04.rs +++ b/src/test/run-make/graphviz-flowgraph/f04.rs @@ -9,5 +9,5 @@ // except according to those terms. pub fn pat_id_4() { - let _x = 4is; + let _x = 4; } diff --git a/src/test/run-make/graphviz-flowgraph/f05.dot-expected.dot b/src/test/run-make/graphviz-flowgraph/f05.dot-expected.dot index 8c9a930098..efd56cd0c7 100644 --- a/src/test/run-make/graphviz-flowgraph/f05.dot-expected.dot +++ b/src/test/run-make/graphviz-flowgraph/f05.dot-expected.dot @@ -1,14 +1,14 @@ digraph block { N0[label="entry"]; N1[label="exit"]; - N2[label="expr 5is"]; - N3[label="expr 55is"]; - N4[label="expr (5is, 55is)"]; + N2[label="expr 5"]; + N3[label="expr 55"]; + N4[label="expr (5, 55)"]; N5[label="local _x"]; N6[label="local _y"]; N7[label="pat (_x, _y)"]; - N8[label="stmt let (_x, _y) = (5is, 55is);"]; - N9[label="block { let (_x, _y) = (5is, 55is); }"]; + N8[label="stmt let (_x, _y) = (5, 55);"]; + N9[label="block { let (_x, _y) = (5, 55); }"]; N0 -> N2; N2 -> N3; N3 -> N4; diff --git a/src/test/run-make/graphviz-flowgraph/f05.rs b/src/test/run-make/graphviz-flowgraph/f05.rs index 09a45c9bd2..616d822bed 100644 --- a/src/test/run-make/graphviz-flowgraph/f05.rs +++ b/src/test/run-make/graphviz-flowgraph/f05.rs @@ -9,5 +9,5 @@ // except according to those terms. pub fn pat_tup_5() { - let (_x, _y) = (5is, 55is); + let (_x, _y) = (5, 55); } diff --git a/src/test/run-make/graphviz-flowgraph/f07.dot-expected.dot b/src/test/run-make/graphviz-flowgraph/f07.dot-expected.dot index da7d5759b7..bee4a120d5 100644 --- a/src/test/run-make/graphviz-flowgraph/f07.dot-expected.dot +++ b/src/test/run-make/graphviz-flowgraph/f07.dot-expected.dot @@ -1,12 +1,12 @@ digraph block { N0[label="entry"]; N1[label="exit"]; - N2[label="expr 7is"]; - N3[label="expr 77is"]; - N4[label="expr 777is"]; - N5[label="expr 7777is"]; - N6[label="expr [7is, 77is, 777is, 7777is]"]; - N7[label="expr match [7is, 77is, 777is, 7777is] { [x, y, ..] => x + y, }"]; + N2[label="expr 7"]; + N3[label="expr 77"]; + N4[label="expr 777"]; + N5[label="expr 7777"]; + N6[label="expr [7, 77, 777, 7777]"]; + N7[label="expr match [7, 77, 777, 7777] { [x, y, ..] => x + y, }"]; N8[label="(dummy_node)"]; N9[label="local x"]; N10[label="local y"]; @@ -15,8 +15,8 @@ digraph block { N13[label="expr x"]; N14[label="expr y"]; N15[label="expr x + y"]; - N16[label="stmt match [7is, 77is, 777is, 7777is] { [x, y, ..] => x + y, };"]; - N17[label="block { match [7is, 77is, 777is, 7777is] { [x, y, ..] => x + y, }; }"]; + N16[label="stmt match [7, 77, 777, 7777] { [x, y, ..] => x + y, };"]; + N17[label="block { match [7, 77, 777, 7777] { [x, y, ..] => x + y, }; }"]; N0 -> N2; N2 -> N3; N3 -> N4; diff --git a/src/test/run-make/graphviz-flowgraph/f07.rs b/src/test/run-make/graphviz-flowgraph/f07.rs index 8334f81c08..39f71d309f 100644 --- a/src/test/run-make/graphviz-flowgraph/f07.rs +++ b/src/test/run-make/graphviz-flowgraph/f07.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn pat_vec_7() { - match [7is, 77is, 777is, 7777is] { + match [7, 77, 777, 7777] { [x, y, ..] => x + y }; } diff --git a/src/test/run-make/graphviz-flowgraph/f08.dot-expected.dot b/src/test/run-make/graphviz-flowgraph/f08.dot-expected.dot index ac1972424d..da0120b7bd 100644 --- a/src/test/run-make/graphviz-flowgraph/f08.dot-expected.dot +++ b/src/test/run-make/graphviz-flowgraph/f08.dot-expected.dot @@ -1,21 +1,21 @@ digraph block { N0[label="entry"]; N1[label="exit"]; - N2[label="expr 8is"]; + N2[label="expr 8"]; N3[label="local x"]; - N4[label="stmt let x = 8is;"]; + N4[label="stmt let x = 8;"]; N5[label="local _y"]; N6[label="stmt let _y;"]; N7[label="expr x"]; - N8[label="expr 88is"]; - N9[label="expr x > 88is"]; - N10[label="expr 888is"]; + N8[label="expr 88"]; + N9[label="expr x > 88"]; + N10[label="expr 888"]; N11[label="expr _y"]; - N12[label="expr _y = 888is"]; - N13[label="stmt _y = 888is;"]; - N14[label="block { _y = 888is; }"]; - N15[label="expr if x > 88is { _y = 888is; }"]; - N16[label="block { let x = 8is; let _y; if x > 88is { _y = 888is; } }"]; + N12[label="expr _y = 888"]; + N13[label="stmt _y = 888;"]; + N14[label="block { _y = 888; }"]; + N15[label="expr if x > 88 { _y = 888; }"]; + N16[label="block { let x = 8; let _y; if x > 88 { _y = 888; } }"]; N0 -> N2; N2 -> N3; N3 -> N4; diff --git a/src/test/run-make/graphviz-flowgraph/f08.rs b/src/test/run-make/graphviz-flowgraph/f08.rs index ad96f30073..6ba7b03d54 100644 --- a/src/test/run-make/graphviz-flowgraph/f08.rs +++ b/src/test/run-make/graphviz-flowgraph/f08.rs @@ -9,8 +9,8 @@ // except according to those terms. pub fn expr_if_onearm_8() { - let x = 8is; let _y; - if x > 88is { - _y = 888is; + let x = 8; let _y; + if x > 88 { + _y = 888; } } diff --git a/src/test/run-make/graphviz-flowgraph/f09.dot-expected.dot b/src/test/run-make/graphviz-flowgraph/f09.dot-expected.dot index 0dc3ff14fb..c98d1b0bed 100644 --- a/src/test/run-make/graphviz-flowgraph/f09.dot-expected.dot +++ b/src/test/run-make/graphviz-flowgraph/f09.dot-expected.dot @@ -1,29 +1,29 @@ digraph block { N0[label="entry"]; N1[label="exit"]; - N2[label="expr 91is"]; + N2[label="expr 91"]; N3[label="local x"]; - N4[label="stmt let x = 91is;"]; + N4[label="stmt let x = 91;"]; N5[label="local _y"]; N6[label="stmt let _y;"]; N7[label="expr x"]; - N8[label="expr 92is"]; - N9[label="expr x > 92is"]; - N10[label="expr 93is"]; + N8[label="expr 92"]; + N9[label="expr x > 92"]; + N10[label="expr 93"]; N11[label="expr _y"]; - N12[label="expr _y = 93is"]; - N13[label="stmt _y = 93is;"]; - N14[label="block { _y = 93is; }"]; - N15[label="expr 94is"]; - N16[label="expr 95is"]; - N17[label="expr 94is + 95is"]; + N12[label="expr _y = 93"]; + N13[label="stmt _y = 93;"]; + N14[label="block { _y = 93; }"]; + N15[label="expr 94"]; + N16[label="expr 95"]; + N17[label="expr 94 + 95"]; N18[label="expr _y"]; - N19[label="expr _y = 94is + 95is"]; - N20[label="stmt _y = 94is + 95is;"]; - N21[label="block { _y = 94is + 95is; }"]; - N22[label="expr { _y = 94is + 95is; }"]; - N23[label="expr if x > 92is { _y = 93is; } else { _y = 94is + 95is; }"]; - N24[label="block {\l let x = 91is;\l let _y;\l if x > 92is { _y = 93is; } else { _y = 94is + 95is; }\l}\l"]; + N19[label="expr _y = 94 + 95"]; + N20[label="stmt _y = 94 + 95;"]; + N21[label="block { _y = 94 + 95; }"]; + N22[label="expr { _y = 94 + 95; }"]; + N23[label="expr if x > 92 { _y = 93; } else { _y = 94 + 95; }"]; + N24[label="block { let x = 91; let _y; if x > 92 { _y = 93; } else { _y = 94 + 95; } }"]; N0 -> N2; N2 -> N3; N3 -> N4; diff --git a/src/test/run-make/graphviz-flowgraph/f09.rs b/src/test/run-make/graphviz-flowgraph/f09.rs index 184772e7d5..a78ccb8a93 100644 --- a/src/test/run-make/graphviz-flowgraph/f09.rs +++ b/src/test/run-make/graphviz-flowgraph/f09.rs @@ -9,10 +9,10 @@ // except according to those terms. pub fn expr_if_twoarm_9() { - let x = 91is; let _y; - if x > 92is { - _y = 93is; + let x = 91; let _y; + if x > 92 { + _y = 93; } else { - _y = 94is+95is; + _y = 94+95; } } diff --git a/src/test/run-make/graphviz-flowgraph/f10.dot-expected.dot b/src/test/run-make/graphviz-flowgraph/f10.dot-expected.dot index 37606ddac7..516c39ef56 100644 --- a/src/test/run-make/graphviz-flowgraph/f10.dot-expected.dot +++ b/src/test/run-make/graphviz-flowgraph/f10.dot-expected.dot @@ -1,20 +1,20 @@ digraph block { N0[label="entry"]; N1[label="exit"]; - N2[label="expr 10is"]; + N2[label="expr 10"]; N3[label="local mut x"]; - N4[label="stmt let mut x = 10is;"]; + N4[label="stmt let mut x = 10;"]; N5[label="(dummy_node)"]; N6[label="expr x"]; - N7[label="expr 0is"]; - N8[label="expr x > 0is"]; - N9[label="expr while x > 0is { x -= 1is; }"]; - N10[label="expr 1is"]; + N7[label="expr 0"]; + N8[label="expr x > 0"]; + N9[label="expr while x > 0 { x -= 1; }"]; + N10[label="expr 1"]; N11[label="expr x"]; - N12[label="expr x -= 1is"]; - N13[label="stmt x -= 1is;"]; - N14[label="block { x -= 1is; }"]; - N15[label="block { let mut x = 10is; while x > 0is { x -= 1is; } }"]; + N12[label="expr x -= 1"]; + N13[label="stmt x -= 1;"]; + N14[label="block { x -= 1; }"]; + N15[label="block { let mut x = 10; while x > 0 { x -= 1; } }"]; N0 -> N2; N2 -> N3; N3 -> N4; diff --git a/src/test/run-make/graphviz-flowgraph/f10.rs b/src/test/run-make/graphviz-flowgraph/f10.rs index 456f740d46..0ca7cc5ee8 100644 --- a/src/test/run-make/graphviz-flowgraph/f10.rs +++ b/src/test/run-make/graphviz-flowgraph/f10.rs @@ -9,8 +9,8 @@ // except according to those terms. pub fn expr_while_10() { - let mut x = 10is; - while x > 0is { - x -= 1is; + let mut x = 10; + while x > 0 { + x -= 1; } } diff --git a/src/test/run-make/graphviz-flowgraph/f11.dot-expected.dot b/src/test/run-make/graphviz-flowgraph/f11.dot-expected.dot index 39a55f1a09..9b66fd581c 100644 --- a/src/test/run-make/graphviz-flowgraph/f11.dot-expected.dot +++ b/src/test/run-make/graphviz-flowgraph/f11.dot-expected.dot @@ -1,20 +1,20 @@ digraph block { N0[label="entry"]; N1[label="exit"]; - N2[label="expr 11is"]; + N2[label="expr 11"]; N3[label="local mut _x"]; - N4[label="stmt let mut _x = 11is;"]; + N4[label="stmt let mut _x = 11;"]; N5[label="(dummy_node)"]; - N6[label="expr loop { _x -= 1is; }"]; - N7[label="expr 1is"]; + N6[label="expr loop { _x -= 1; }"]; + N7[label="expr 1"]; N8[label="expr _x"]; - N9[label="expr _x -= 1is"]; - N10[label="stmt _x -= 1is;"]; - N11[label="block { _x -= 1is; }"]; - N12[label="stmt loop { _x -= 1is; }"]; + N9[label="expr _x -= 1"]; + N10[label="stmt _x -= 1;"]; + N11[label="block { _x -= 1; }"]; + N12[label="stmt loop { _x -= 1; }"]; N13[label="expr \"unreachable\""]; N14[label="stmt \"unreachable\";"]; - N15[label="block { let mut _x = 11is; loop { _x -= 1is; } \"unreachable\"; }"]; + N15[label="block { let mut _x = 11; loop { _x -= 1; } \"unreachable\"; }"]; N0 -> N2; N2 -> N3; N3 -> N4; diff --git a/src/test/run-make/graphviz-flowgraph/f11.rs b/src/test/run-make/graphviz-flowgraph/f11.rs index 65262f249b..d0f3452119 100644 --- a/src/test/run-make/graphviz-flowgraph/f11.rs +++ b/src/test/run-make/graphviz-flowgraph/f11.rs @@ -10,9 +10,9 @@ #[allow(unreachable_code)] pub fn expr_loop_11() { - let mut _x = 11is; + let mut _x = 11; loop { - _x -= 1is; + _x -= 1; } "unreachable"; } diff --git a/src/test/run-make/graphviz-flowgraph/f12.dot-expected.dot b/src/test/run-make/graphviz-flowgraph/f12.dot-expected.dot index e9cd07c035..071af6faf6 100644 --- a/src/test/run-make/graphviz-flowgraph/f12.dot-expected.dot +++ b/src/test/run-make/graphviz-flowgraph/f12.dot-expected.dot @@ -1,27 +1,27 @@ digraph block { N0[label="entry"]; N1[label="exit"]; - N2[label="expr 12is"]; + N2[label="expr 12"]; N3[label="local mut x"]; - N4[label="stmt let mut x = 12is;"]; + N4[label="stmt let mut x = 12;"]; N5[label="(dummy_node)"]; - N6[label="expr loop { x -= 1is; if x == 2is { break ; \"unreachable\"; } }"]; - N7[label="expr 1is"]; + N6[label="expr loop { x -= 1; if x == 2 { break ; \"unreachable\"; } }"]; + N7[label="expr 1"]; N8[label="expr x"]; - N9[label="expr x -= 1is"]; - N10[label="stmt x -= 1is;"]; + N9[label="expr x -= 1"]; + N10[label="stmt x -= 1;"]; N11[label="expr x"]; - N12[label="expr 2is"]; - N13[label="expr x == 2is"]; + N12[label="expr 2"]; + N13[label="expr x == 2"]; N14[label="expr break"]; N15[label="(dummy_node)"]; N16[label="stmt break ;"]; N17[label="expr \"unreachable\""]; N18[label="stmt \"unreachable\";"]; N19[label="block { break ; \"unreachable\"; }"]; - N20[label="expr if x == 2is { break ; \"unreachable\"; }"]; - N21[label="block { x -= 1is; if x == 2is { break ; \"unreachable\"; } }"]; - N22[label="block {\l let mut x = 12is;\l loop { x -= 1is; if x == 2is { break ; \"unreachable\"; } }\l}\l"]; + N20[label="expr if x == 2 { break ; \"unreachable\"; }"]; + N21[label="block { x -= 1; if x == 2 { break ; \"unreachable\"; } }"]; + N22[label="block { let mut x = 12; loop { x -= 1; if x == 2 { break ; \"unreachable\"; } } }"]; N0 -> N2; N2 -> N3; N3 -> N4; @@ -34,7 +34,7 @@ digraph block { N11 -> N12; N12 -> N13; N13 -> N14; - N14 -> N6[label="exiting scope_0 expr break,\lexiting scope_1 stmt break ;,\lexiting scope_2 block { break ; \"unreachable\"; },\lexiting scope_3 expr if x == 2is { break ; \"unreachable\"; },\lexiting scope_4 block { x -= 1is; if x == 2is { break ; \"unreachable\"; } }"]; + N14 -> N6; N15 -> N16; N16 -> N17; N17 -> N18; diff --git a/src/test/run-make/graphviz-flowgraph/f12.rs b/src/test/run-make/graphviz-flowgraph/f12.rs index 5651d73baf..90b146340b 100644 --- a/src/test/run-make/graphviz-flowgraph/f12.rs +++ b/src/test/run-make/graphviz-flowgraph/f12.rs @@ -10,9 +10,9 @@ #[allow(unreachable_code)] pub fn expr_loop_12() { - let mut x = 12is; + let mut x = 12; loop { - x -= 1is; - if x == 2is { break; "unreachable"; } + x -= 1; + if x == 2 { break; "unreachable"; } } } diff --git a/src/test/run-make/graphviz-flowgraph/f14.dot-expected.dot b/src/test/run-make/graphviz-flowgraph/f14.dot-expected.dot index ac1a631eb5..66250aa441 100644 --- a/src/test/run-make/graphviz-flowgraph/f14.dot-expected.dot +++ b/src/test/run-make/graphviz-flowgraph/f14.dot-expected.dot @@ -1,20 +1,20 @@ digraph block { N0[label="entry"]; N1[label="exit"]; - N2[label="expr 14is"]; + N2[label="expr 14"]; N3[label="local x"]; - N4[label="stmt let x = 14is;"]; + N4[label="stmt let x = 14;"]; N5[label="expr x"]; - N6[label="expr 1is"]; - N7[label="expr x > 1is"]; + N6[label="expr 1"]; + N7[label="expr x > 1"]; N8[label="expr return"]; N9[label="(dummy_node)"]; N10[label="stmt return;"]; N11[label="expr \"unreachable\""]; N12[label="stmt \"unreachable\";"]; N13[label="block { return; \"unreachable\"; }"]; - N14[label="expr if x > 1is { return; \"unreachable\"; }"]; - N15[label="block { let x = 14is; if x > 1is { return; \"unreachable\"; } }"]; + N14[label="expr if x > 1 { return; \"unreachable\"; }"]; + N15[label="block { let x = 14; if x > 1 { return; \"unreachable\"; } }"]; N0 -> N2; N2 -> N3; N3 -> N4; diff --git a/src/test/run-make/graphviz-flowgraph/f14.rs b/src/test/run-make/graphviz-flowgraph/f14.rs index adb7b193d1..98ff095c83 100644 --- a/src/test/run-make/graphviz-flowgraph/f14.rs +++ b/src/test/run-make/graphviz-flowgraph/f14.rs @@ -10,8 +10,8 @@ #[allow(unreachable_code)] pub fn expr_ret_14() { - let x = 14is; - if x > 1is { + let x = 14; + if x > 1 { return; "unreachable"; } diff --git a/src/test/run-make/graphviz-flowgraph/f15.dot-expected.dot b/src/test/run-make/graphviz-flowgraph/f15.dot-expected.dot index 7b01c60608..4c94630f4e 100644 --- a/src/test/run-make/graphviz-flowgraph/f15.dot-expected.dot +++ b/src/test/run-make/graphviz-flowgraph/f15.dot-expected.dot @@ -1,54 +1,54 @@ digraph block { N0[label="entry"]; N1[label="exit"]; - N2[label="expr 15is"]; + N2[label="expr 15"]; N3[label="local mut x"]; - N4[label="stmt let mut x = 15is;"]; - N5[label="expr 151is"]; + N4[label="stmt let mut x = 15;"]; + N5[label="expr 151"]; N6[label="local mut y"]; - N7[label="stmt let mut y = 151is;"]; + N7[label="stmt let mut y = 151;"]; N8[label="(dummy_node)"]; - N9[label="expr \'outer:\l loop {\l \'inner:\l loop {\l if x == 1is { break \'outer ; \"unreachable\"; }\l if y >= 2is { break ; \"unreachable\"; }\l y -= 3is;\l }\l y -= 4is;\l x -= 5is;\l }\l"]; + N9[label="expr \'outer:\l loop {\l \'inner:\l loop {\l if x == 1 { break \'outer ; \"unreachable\"; }\l if y >= 2 { break ; \"unreachable\"; }\l y -= 3;\l }\l y -= 4;\l x -= 5;\l }\l"]; N10[label="(dummy_node)"]; - N11[label="expr \'inner:\l loop {\l if x == 1is { break \'outer ; \"unreachable\"; }\l if y >= 2is { break ; \"unreachable\"; }\l y -= 3is;\l }\l"]; + N11[label="expr \'inner:\l loop {\l if x == 1 { break \'outer ; \"unreachable\"; }\l if y >= 2 { break ; \"unreachable\"; }\l y -= 3;\l }\l"]; N12[label="expr x"]; - N13[label="expr 1is"]; - N14[label="expr x == 1is"]; + N13[label="expr 1"]; + N14[label="expr x == 1"]; N15[label="expr break \'outer"]; N16[label="(dummy_node)"]; N17[label="stmt break \'outer ;"]; N18[label="expr \"unreachable\""]; N19[label="stmt \"unreachable\";"]; N20[label="block { break \'outer ; \"unreachable\"; }"]; - N21[label="expr if x == 1is { break \'outer ; \"unreachable\"; }"]; - N22[label="stmt if x == 1is { break \'outer ; \"unreachable\"; }"]; + N21[label="expr if x == 1 { break \'outer ; \"unreachable\"; }"]; + N22[label="stmt if x == 1 { break \'outer ; \"unreachable\"; }"]; N23[label="expr y"]; - N24[label="expr 2is"]; - N25[label="expr y >= 2is"]; + N24[label="expr 2"]; + N25[label="expr y >= 2"]; N26[label="expr break"]; N27[label="(dummy_node)"]; N28[label="stmt break ;"]; N29[label="expr \"unreachable\""]; N30[label="stmt \"unreachable\";"]; N31[label="block { break ; \"unreachable\"; }"]; - N32[label="expr if y >= 2is { break ; \"unreachable\"; }"]; - N33[label="stmt if y >= 2is { break ; \"unreachable\"; }"]; - N34[label="expr 3is"]; + N32[label="expr if y >= 2 { break ; \"unreachable\"; }"]; + N33[label="stmt if y >= 2 { break ; \"unreachable\"; }"]; + N34[label="expr 3"]; N35[label="expr y"]; - N36[label="expr y -= 3is"]; - N37[label="stmt y -= 3is;"]; - N38[label="block {\l if x == 1is { break \'outer ; \"unreachable\"; }\l if y >= 2is { break ; \"unreachable\"; }\l y -= 3is;\l}\l"]; - N39[label="stmt \'inner:\l loop {\l if x == 1is { break \'outer ; \"unreachable\"; }\l if y >= 2is { break ; \"unreachable\"; }\l y -= 3is;\l }\l"]; - N40[label="expr 4is"]; + N36[label="expr y -= 3"]; + N37[label="stmt y -= 3;"]; + N38[label="block {\l if x == 1 { break \'outer ; \"unreachable\"; }\l if y >= 2 { break ; \"unreachable\"; }\l y -= 3;\l}\l"]; + N39[label="stmt \'inner:\l loop {\l if x == 1 { break \'outer ; \"unreachable\"; }\l if y >= 2 { break ; \"unreachable\"; }\l y -= 3;\l }\l"]; + N40[label="expr 4"]; N41[label="expr y"]; - N42[label="expr y -= 4is"]; - N43[label="stmt y -= 4is;"]; - N44[label="expr 5is"]; + N42[label="expr y -= 4"]; + N43[label="stmt y -= 4;"]; + N44[label="expr 5"]; N45[label="expr x"]; - N46[label="expr x -= 5is"]; - N47[label="stmt x -= 5is;"]; - N48[label="block {\l \'inner:\l loop {\l if x == 1is { break \'outer ; \"unreachable\"; }\l if y >= 2is { break ; \"unreachable\"; }\l y -= 3is;\l }\l y -= 4is;\l x -= 5is;\l}\l"]; - N49[label="block {\l let mut x = 15is;\l let mut y = 151is;\l \'outer:\l loop {\l \'inner:\l loop {\l if x == 1is { break \'outer ; \"unreachable\"; }\l if y >= 2is { break ; \"unreachable\"; }\l y -= 3is;\l }\l y -= 4is;\l x -= 5is;\l }\l}\l"]; + N46[label="expr x -= 5"]; + N47[label="stmt x -= 5;"]; + N48[label="block {\l \'inner:\l loop {\l if x == 1 { break \'outer ; \"unreachable\"; }\l if y >= 2 { break ; \"unreachable\"; }\l y -= 3;\l }\l y -= 4;\l x -= 5;\l}\l"]; + N49[label="block {\l let mut x = 15;\l let mut y = 151;\l \'outer:\l loop {\l \'inner:\l loop {\l if x == 1 { break \'outer ; \"unreachable\"; }\l if y >= 2 { break ; \"unreachable\"; }\l y -= 3;\l }\l y -= 4;\l x -= 5;\l }\l}\l"]; N0 -> N2; N2 -> N3; N3 -> N4; @@ -61,7 +61,7 @@ digraph block { N12 -> N13; N13 -> N14; N14 -> N15; - N15 -> N9[label="exiting scope_0 expr break \'outer,\lexiting scope_1 stmt break \'outer ;,\lexiting scope_2 block { break \'outer ; \"unreachable\"; },\lexiting scope_3 expr if x == 1is { break \'outer ; \"unreachable\"; },\lexiting scope_4 stmt if x == 1is { break \'outer ; \"unreachable\"; },\lexiting scope_5 block {\l if x == 1is { break \'outer ; \"unreachable\"; }\l if y >= 2is { break ; \"unreachable\"; }\l y -= 3is;\l}\l,\lexiting scope_6 expr \'inner:\l loop {\l if x == 1is { break \'outer ; \"unreachable\"; }\l if y >= 2is { break ; \"unreachable\"; }\l y -= 3is;\l }\l,\lexiting scope_7 stmt \'inner:\l loop {\l if x == 1is { break \'outer ; \"unreachable\"; }\l if y >= 2is { break ; \"unreachable\"; }\l y -= 3is;\l }\l,\lexiting scope_8 block {\l \'inner:\l loop {\l if x == 1is { break \'outer ; \"unreachable\"; }\l if y >= 2is { break ; \"unreachable\"; }\l y -= 3is;\l }\l y -= 4is;\l x -= 5is;\l}\l"]; + N15 -> N9; N16 -> N17; N17 -> N18; N18 -> N19; @@ -73,7 +73,7 @@ digraph block { N23 -> N24; N24 -> N25; N25 -> N26; - N26 -> N11[label="exiting scope_0 expr break,\lexiting scope_1 stmt break ;,\lexiting scope_2 block { break ; \"unreachable\"; },\lexiting scope_3 expr if y >= 2is { break ; \"unreachable\"; },\lexiting scope_4 stmt if y >= 2is { break ; \"unreachable\"; },\lexiting scope_5 block {\l if x == 1is { break \'outer ; \"unreachable\"; }\l if y >= 2is { break ; \"unreachable\"; }\l y -= 3is;\l}\l"]; + N26 -> N11; N27 -> N28; N28 -> N29; N29 -> N30; diff --git a/src/test/run-make/graphviz-flowgraph/f15.rs b/src/test/run-make/graphviz-flowgraph/f15.rs index a1141eb676..056458e555 100644 --- a/src/test/run-make/graphviz-flowgraph/f15.rs +++ b/src/test/run-make/graphviz-flowgraph/f15.rs @@ -10,21 +10,21 @@ #[allow(unreachable_code)] pub fn expr_break_label_15() { - let mut x = 15is; - let mut y = 151is; + let mut x = 15; + let mut y = 151; 'outer: loop { 'inner: loop { - if x == 1is { + if x == 1 { break 'outer; "unreachable"; } - if y >= 2is { + if y >= 2 { break; "unreachable"; } - y -= 3is; + y -= 3; } - y -= 4is; - x -= 5is; + y -= 4; + x -= 5; } } diff --git a/src/test/run-make/graphviz-flowgraph/f16.dot-expected.dot b/src/test/run-make/graphviz-flowgraph/f16.dot-expected.dot index 2123185a08..d7d027cefb 100644 --- a/src/test/run-make/graphviz-flowgraph/f16.dot-expected.dot +++ b/src/test/run-make/graphviz-flowgraph/f16.dot-expected.dot @@ -1,57 +1,57 @@ digraph block { N0[label="entry"]; N1[label="exit"]; - N2[label="expr 16is"]; + N2[label="expr 16"]; N3[label="local mut x"]; - N4[label="stmt let mut x = 16is;"]; - N5[label="expr 16is"]; + N4[label="stmt let mut x = 16;"]; + N5[label="expr 16"]; N6[label="local mut y"]; - N7[label="stmt let mut y = 16is;"]; + N7[label="stmt let mut y = 16;"]; N8[label="(dummy_node)"]; - N9[label="expr \'outer:\l loop {\l \'inner:\l loop {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 1is { break ; \"unreachable\"; }\l y -= 1is;\l }\l y -= 1is;\l x -= 1is;\l }\l"]; + N9[label="expr \'outer:\l loop {\l \'inner:\l loop {\l if x == 1 { continue \'outer ; \"unreachable\"; }\l if y >= 1 { break ; \"unreachable\"; }\l y -= 1;\l }\l y -= 1;\l x -= 1;\l }\l"]; N10[label="(dummy_node)"]; - N11[label="expr \'inner:\l loop {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 1is { break ; \"unreachable\"; }\l y -= 1is;\l }\l"]; + N11[label="expr \'inner:\l loop {\l if x == 1 { continue \'outer ; \"unreachable\"; }\l if y >= 1 { break ; \"unreachable\"; }\l y -= 1;\l }\l"]; N12[label="expr x"]; - N13[label="expr 1is"]; - N14[label="expr x == 1is"]; + N13[label="expr 1"]; + N14[label="expr x == 1"]; N15[label="expr continue \'outer"]; N16[label="(dummy_node)"]; N17[label="stmt continue \'outer ;"]; N18[label="expr \"unreachable\""]; N19[label="stmt \"unreachable\";"]; N20[label="block { continue \'outer ; \"unreachable\"; }"]; - N21[label="expr if x == 1is { continue \'outer ; \"unreachable\"; }"]; - N22[label="stmt if x == 1is { continue \'outer ; \"unreachable\"; }"]; + N21[label="expr if x == 1 { continue \'outer ; \"unreachable\"; }"]; + N22[label="stmt if x == 1 { continue \'outer ; \"unreachable\"; }"]; N23[label="expr y"]; - N24[label="expr 1is"]; - N25[label="expr y >= 1is"]; + N24[label="expr 1"]; + N25[label="expr y >= 1"]; N26[label="expr break"]; N27[label="(dummy_node)"]; N28[label="stmt break ;"]; N29[label="expr \"unreachable\""]; N30[label="stmt \"unreachable\";"]; N31[label="block { break ; \"unreachable\"; }"]; - N32[label="expr if y >= 1is { break ; \"unreachable\"; }"]; - N33[label="stmt if y >= 1is { break ; \"unreachable\"; }"]; - N34[label="expr 1is"]; + N32[label="expr if y >= 1 { break ; \"unreachable\"; }"]; + N33[label="stmt if y >= 1 { break ; \"unreachable\"; }"]; + N34[label="expr 1"]; N35[label="expr y"]; - N36[label="expr y -= 1is"]; - N37[label="stmt y -= 1is;"]; - N38[label="block {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 1is { break ; \"unreachable\"; }\l y -= 1is;\l}\l"]; - N39[label="stmt \'inner:\l loop {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 1is { break ; \"unreachable\"; }\l y -= 1is;\l }\l"]; - N40[label="expr 1is"]; + N36[label="expr y -= 1"]; + N37[label="stmt y -= 1;"]; + N38[label="block {\l if x == 1 { continue \'outer ; \"unreachable\"; }\l if y >= 1 { break ; \"unreachable\"; }\l y -= 1;\l}\l"]; + N39[label="stmt \'inner:\l loop {\l if x == 1 { continue \'outer ; \"unreachable\"; }\l if y >= 1 { break ; \"unreachable\"; }\l y -= 1;\l }\l"]; + N40[label="expr 1"]; N41[label="expr y"]; - N42[label="expr y -= 1is"]; - N43[label="stmt y -= 1is;"]; - N44[label="expr 1is"]; + N42[label="expr y -= 1"]; + N43[label="stmt y -= 1;"]; + N44[label="expr 1"]; N45[label="expr x"]; - N46[label="expr x -= 1is"]; - N47[label="stmt x -= 1is;"]; - N48[label="block {\l \'inner:\l loop {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 1is { break ; \"unreachable\"; }\l y -= 1is;\l }\l y -= 1is;\l x -= 1is;\l}\l"]; - N49[label="stmt \'outer:\l loop {\l \'inner:\l loop {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 1is { break ; \"unreachable\"; }\l y -= 1is;\l }\l y -= 1is;\l x -= 1is;\l }\l"]; + N46[label="expr x -= 1"]; + N47[label="stmt x -= 1;"]; + N48[label="block {\l \'inner:\l loop {\l if x == 1 { continue \'outer ; \"unreachable\"; }\l if y >= 1 { break ; \"unreachable\"; }\l y -= 1;\l }\l y -= 1;\l x -= 1;\l}\l"]; + N49[label="stmt \'outer:\l loop {\l \'inner:\l loop {\l if x == 1 { continue \'outer ; \"unreachable\"; }\l if y >= 1 { break ; \"unreachable\"; }\l y -= 1;\l }\l y -= 1;\l x -= 1;\l }\l"]; N50[label="expr \"unreachable\""]; N51[label="stmt \"unreachable\";"]; - N52[label="block {\l let mut x = 16is;\l let mut y = 16is;\l \'outer:\l loop {\l \'inner:\l loop {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 1is { break ; \"unreachable\"; }\l y -= 1is;\l }\l y -= 1is;\l x -= 1is;\l }\l \"unreachable\";\l}\l"]; + N52[label="block {\l let mut x = 16;\l let mut y = 16;\l \'outer:\l loop {\l \'inner:\l loop {\l if x == 1 { continue \'outer ; \"unreachable\"; }\l if y >= 1 { break ; \"unreachable\"; }\l y -= 1;\l }\l y -= 1;\l x -= 1;\l }\l \"unreachable\";\l}\l"]; N0 -> N2; N2 -> N3; N3 -> N4; @@ -64,7 +64,7 @@ digraph block { N12 -> N13; N13 -> N14; N14 -> N15; - N15 -> N8[label="exiting scope_0 expr continue \'outer,\lexiting scope_1 stmt continue \'outer ;,\lexiting scope_2 block { continue \'outer ; \"unreachable\"; },\lexiting scope_3 expr if x == 1is { continue \'outer ; \"unreachable\"; },\lexiting scope_4 stmt if x == 1is { continue \'outer ; \"unreachable\"; },\lexiting scope_5 block {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 1is { break ; \"unreachable\"; }\l y -= 1is;\l}\l,\lexiting scope_6 expr \'inner:\l loop {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 1is { break ; \"unreachable\"; }\l y -= 1is;\l }\l,\lexiting scope_7 stmt \'inner:\l loop {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 1is { break ; \"unreachable\"; }\l y -= 1is;\l }\l,\lexiting scope_8 block {\l \'inner:\l loop {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 1is { break ; \"unreachable\"; }\l y -= 1is;\l }\l y -= 1is;\l x -= 1is;\l}\l"]; + N15 -> N8; N16 -> N17; N17 -> N18; N18 -> N19; @@ -76,7 +76,7 @@ digraph block { N23 -> N24; N24 -> N25; N25 -> N26; - N26 -> N11[label="exiting scope_0 expr break,\lexiting scope_1 stmt break ;,\lexiting scope_2 block { break ; \"unreachable\"; },\lexiting scope_3 expr if y >= 1is { break ; \"unreachable\"; },\lexiting scope_4 stmt if y >= 1is { break ; \"unreachable\"; },\lexiting scope_5 block {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 1is { break ; \"unreachable\"; }\l y -= 1is;\l}\l"]; + N26 -> N11; N27 -> N28; N28 -> N29; N29 -> N30; diff --git a/src/test/run-make/graphviz-flowgraph/f16.rs b/src/test/run-make/graphviz-flowgraph/f16.rs index 5d0e9f963a..e225b0080e 100644 --- a/src/test/run-make/graphviz-flowgraph/f16.rs +++ b/src/test/run-make/graphviz-flowgraph/f16.rs @@ -10,22 +10,22 @@ #[allow(unreachable_code)] pub fn expr_continue_label_16() { - let mut x = 16is; - let mut y = 16is; + let mut x = 16; + let mut y = 16; 'outer: loop { 'inner: loop { - if x == 1is { + if x == 1 { continue 'outer; "unreachable"; } - if y >= 1is { + if y >= 1 { break; "unreachable"; } - y -= 1is; + y -= 1; } - y -= 1is; - x -= 1is; + y -= 1; + x -= 1; } "unreachable"; } diff --git a/src/test/run-make/graphviz-flowgraph/f17.dot-expected.dot b/src/test/run-make/graphviz-flowgraph/f17.dot-expected.dot index 7941b4f7ce..f87b70a71c 100644 --- a/src/test/run-make/graphviz-flowgraph/f17.dot-expected.dot +++ b/src/test/run-make/graphviz-flowgraph/f17.dot-expected.dot @@ -1,13 +1,13 @@ digraph block { N0[label="entry"]; N1[label="exit"]; - N2[label="expr 1is"]; - N3[label="expr 7is"]; - N4[label="expr 17is"]; - N5[label="expr [1is, 7is, 17is]"]; + N2[label="expr 1"]; + N3[label="expr 7"]; + N4[label="expr 17"]; + N5[label="expr [1, 7, 17]"]; N6[label="local _v"]; - N7[label="stmt let _v = [1is, 7is, 17is];"]; - N8[label="block { let _v = [1is, 7is, 17is]; }"]; + N7[label="stmt let _v = [1, 7, 17];"]; + N8[label="block { let _v = [1, 7, 17]; }"]; N0 -> N2; N2 -> N3; N3 -> N4; diff --git a/src/test/run-make/graphviz-flowgraph/f17.rs b/src/test/run-make/graphviz-flowgraph/f17.rs index de9b3bd567..23f5bb8a1e 100644 --- a/src/test/run-make/graphviz-flowgraph/f17.rs +++ b/src/test/run-make/graphviz-flowgraph/f17.rs @@ -9,5 +9,5 @@ // except according to those terms. pub fn expr_vec_17() { - let _v = [1is, 7is, 17is]; + let _v = [1, 7, 17]; } diff --git a/src/test/run-make/graphviz-flowgraph/f20.dot-expected.dot b/src/test/run-make/graphviz-flowgraph/f20.dot-expected.dot index c9e4b41c81..b4ec986ef2 100644 --- a/src/test/run-make/graphviz-flowgraph/f20.dot-expected.dot +++ b/src/test/run-make/graphviz-flowgraph/f20.dot-expected.dot @@ -1,17 +1,17 @@ digraph block { N0[label="entry"]; N1[label="exit"]; - N2[label="expr 2us"]; - N3[label="expr 0us"]; - N4[label="expr 20us"]; - N5[label="expr [2us, 0us, 20us]"]; + N2[label="expr 2usize"]; + N3[label="expr 0usize"]; + N4[label="expr 20usize"]; + N5[label="expr [2usize, 0usize, 20usize]"]; N6[label="local v"]; - N7[label="stmt let v = [2us, 0us, 20us];"]; + N7[label="stmt let v = [2usize, 0usize, 20usize];"]; N8[label="expr v"]; - N9[label="expr 20us"]; - N10[label="expr v[20us]"]; - N11[label="stmt v[20us];"]; - N12[label="block { let v = [2us, 0us, 20us]; v[20us]; }"]; + N9[label="expr 20usize"]; + N10[label="expr v[20usize]"]; + N11[label="stmt v[20usize];"]; + N12[label="block { let v = [2usize, 0usize, 20usize]; v[20usize]; }"]; N0 -> N2; N2 -> N3; N3 -> N4; diff --git a/src/test/run-make/graphviz-flowgraph/f20.rs b/src/test/run-make/graphviz-flowgraph/f20.rs index 3ca55cb521..d65de18b54 100644 --- a/src/test/run-make/graphviz-flowgraph/f20.rs +++ b/src/test/run-make/graphviz-flowgraph/f20.rs @@ -9,6 +9,6 @@ // except according to those terms. pub fn expr_index_20() { - let v = [2us, 0us, 20us]; - v[20us]; + let v = [2_usize, 0_usize, 20_usize]; + v[20_usize]; } diff --git a/src/test/run-make/graphviz-flowgraph/f21.dot-expected.dot b/src/test/run-make/graphviz-flowgraph/f21.dot-expected.dot index e7a2cf2ff7..796bf4910c 100644 --- a/src/test/run-make/graphviz-flowgraph/f21.dot-expected.dot +++ b/src/test/run-make/graphviz-flowgraph/f21.dot-expected.dot @@ -1,52 +1,52 @@ digraph block { N0[label="entry"]; N1[label="exit"]; - N2[label="expr 15is"]; + N2[label="expr 15"]; N3[label="local mut x"]; - N4[label="stmt let mut x = 15is;"]; - N5[label="expr 151is"]; + N4[label="stmt let mut x = 15;"]; + N5[label="expr 151"]; N6[label="local mut y"]; - N7[label="stmt let mut y = 151is;"]; + N7[label="stmt let mut y = 151;"]; N8[label="(dummy_node)"]; - N9[label="expr \'outer:\l loop {\l \'inner:\l loop {\l if x == 1is { break \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l y -= 3is;\l x -= 5is;\l }\l \"unreachable\";\l }\l"]; + N9[label="expr \'outer:\l loop {\l \'inner:\l loop {\l if x == 1 { break \'outer ; \"unreachable\"; }\l if y >= 2 { return; \"unreachable\"; }\l y -= 3;\l x -= 5;\l }\l \"unreachable\";\l }\l"]; N10[label="(dummy_node)"]; - N11[label="expr \'inner:\l loop {\l if x == 1is { break \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l y -= 3is;\l x -= 5is;\l }\l"]; + N11[label="expr \'inner:\l loop {\l if x == 1 { break \'outer ; \"unreachable\"; }\l if y >= 2 { return; \"unreachable\"; }\l y -= 3;\l x -= 5;\l }\l"]; N12[label="expr x"]; - N13[label="expr 1is"]; - N14[label="expr x == 1is"]; + N13[label="expr 1"]; + N14[label="expr x == 1"]; N15[label="expr break \'outer"]; N16[label="(dummy_node)"]; N17[label="stmt break \'outer ;"]; N18[label="expr \"unreachable\""]; N19[label="stmt \"unreachable\";"]; N20[label="block { break \'outer ; \"unreachable\"; }"]; - N21[label="expr if x == 1is { break \'outer ; \"unreachable\"; }"]; - N22[label="stmt if x == 1is { break \'outer ; \"unreachable\"; }"]; + N21[label="expr if x == 1 { break \'outer ; \"unreachable\"; }"]; + N22[label="stmt if x == 1 { break \'outer ; \"unreachable\"; }"]; N23[label="expr y"]; - N24[label="expr 2is"]; - N25[label="expr y >= 2is"]; + N24[label="expr 2"]; + N25[label="expr y >= 2"]; N26[label="expr return"]; N27[label="(dummy_node)"]; N28[label="stmt return;"]; N29[label="expr \"unreachable\""]; N30[label="stmt \"unreachable\";"]; N31[label="block { return; \"unreachable\"; }"]; - N32[label="expr if y >= 2is { return; \"unreachable\"; }"]; - N33[label="stmt if y >= 2is { return; \"unreachable\"; }"]; - N34[label="expr 3is"]; + N32[label="expr if y >= 2 { return; \"unreachable\"; }"]; + N33[label="stmt if y >= 2 { return; \"unreachable\"; }"]; + N34[label="expr 3"]; N35[label="expr y"]; - N36[label="expr y -= 3is"]; - N37[label="stmt y -= 3is;"]; - N38[label="expr 5is"]; + N36[label="expr y -= 3"]; + N37[label="stmt y -= 3;"]; + N38[label="expr 5"]; N39[label="expr x"]; - N40[label="expr x -= 5is"]; - N41[label="stmt x -= 5is;"]; - N42[label="block {\l if x == 1is { break \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l y -= 3is;\l x -= 5is;\l}\l"]; - N43[label="stmt \'inner:\l loop {\l if x == 1is { break \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l y -= 3is;\l x -= 5is;\l }\l"]; + N40[label="expr x -= 5"]; + N41[label="stmt x -= 5;"]; + N42[label="block {\l if x == 1 { break \'outer ; \"unreachable\"; }\l if y >= 2 { return; \"unreachable\"; }\l y -= 3;\l x -= 5;\l}\l"]; + N43[label="stmt \'inner:\l loop {\l if x == 1 { break \'outer ; \"unreachable\"; }\l if y >= 2 { return; \"unreachable\"; }\l y -= 3;\l x -= 5;\l }\l"]; N44[label="expr \"unreachable\""]; N45[label="stmt \"unreachable\";"]; - N46[label="block {\l \'inner:\l loop {\l if x == 1is { break \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l y -= 3is;\l x -= 5is;\l }\l \"unreachable\";\l}\l"]; - N47[label="block {\l let mut x = 15is;\l let mut y = 151is;\l \'outer:\l loop {\l \'inner:\l loop {\l if x == 1is { break \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l y -= 3is;\l x -= 5is;\l }\l \"unreachable\";\l }\l}\l"]; + N46[label="block {\l \'inner:\l loop {\l if x == 1 { break \'outer ; \"unreachable\"; }\l if y >= 2 { return; \"unreachable\"; }\l y -= 3;\l x -= 5;\l }\l \"unreachable\";\l}\l"]; + N47[label="block {\l let mut x = 15;\l let mut y = 151;\l \'outer:\l loop {\l \'inner:\l loop {\l if x == 1 { break \'outer ; \"unreachable\"; }\l if y >= 2 { return; \"unreachable\"; }\l y -= 3;\l x -= 5;\l }\l \"unreachable\";\l }\l}\l"]; N0 -> N2; N2 -> N3; N3 -> N4; @@ -59,7 +59,7 @@ digraph block { N12 -> N13; N13 -> N14; N14 -> N15; - N15 -> N9[label="exiting scope_0 expr break \'outer,\lexiting scope_1 stmt break \'outer ;,\lexiting scope_2 block { break \'outer ; \"unreachable\"; },\lexiting scope_3 expr if x == 1is { break \'outer ; \"unreachable\"; },\lexiting scope_4 stmt if x == 1is { break \'outer ; \"unreachable\"; },\lexiting scope_5 block {\l if x == 1is { break \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l y -= 3is;\l x -= 5is;\l}\l,\lexiting scope_6 expr \'inner:\l loop {\l if x == 1is { break \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l y -= 3is;\l x -= 5is;\l }\l,\lexiting scope_7 stmt \'inner:\l loop {\l if x == 1is { break \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l y -= 3is;\l x -= 5is;\l }\l,\lexiting scope_8 block {\l \'inner:\l loop {\l if x == 1is { break \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l y -= 3is;\l x -= 5is;\l }\l \"unreachable\";\l}\l"]; + N15 -> N9; N16 -> N17; N17 -> N18; N18 -> N19; @@ -71,7 +71,7 @@ digraph block { N23 -> N24; N24 -> N25; N25 -> N26; - N26 -> N1[label="exiting scope_0 expr \'inner:\l loop {\l if x == 1is { break \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l y -= 3is;\l x -= 5is;\l }\l,\lexiting scope_1 expr \'outer:\l loop {\l \'inner:\l loop {\l if x == 1is { break \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l y -= 3is;\l x -= 5is;\l }\l \"unreachable\";\l }\l"]; + N26 -> N1; N27 -> N28; N28 -> N29; N29 -> N30; diff --git a/src/test/run-make/graphviz-flowgraph/f21.rs b/src/test/run-make/graphviz-flowgraph/f21.rs index 25e93f6511..70083ed831 100644 --- a/src/test/run-make/graphviz-flowgraph/f21.rs +++ b/src/test/run-make/graphviz-flowgraph/f21.rs @@ -10,20 +10,20 @@ #[allow(unreachable_code)] pub fn expr_break_label_21() { - let mut x = 15is; - let mut y = 151is; + let mut x = 15; + let mut y = 151; 'outer: loop { 'inner: loop { - if x == 1is { + if x == 1 { break 'outer; "unreachable"; } - if y >= 2is { + if y >= 2 { return; "unreachable"; } - y -= 3is; - x -= 5is; + y -= 3; + x -= 5; } "unreachable"; } diff --git a/src/test/run-make/graphviz-flowgraph/f22.dot-expected.dot b/src/test/run-make/graphviz-flowgraph/f22.dot-expected.dot index edd39b40b3..9e8049f074 100644 --- a/src/test/run-make/graphviz-flowgraph/f22.dot-expected.dot +++ b/src/test/run-make/graphviz-flowgraph/f22.dot-expected.dot @@ -1,55 +1,55 @@ digraph block { N0[label="entry"]; N1[label="exit"]; - N2[label="expr 15is"]; + N2[label="expr 15"]; N3[label="local mut x"]; - N4[label="stmt let mut x = 15is;"]; - N5[label="expr 151is"]; + N4[label="stmt let mut x = 15;"]; + N5[label="expr 151"]; N6[label="local mut y"]; - N7[label="stmt let mut y = 151is;"]; + N7[label="stmt let mut y = 151;"]; N8[label="(dummy_node)"]; - N9[label="expr \'outer:\l loop {\l \'inner:\l loop {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l x -= 1is;\l y -= 3is;\l }\l \"unreachable\";\l }\l"]; + N9[label="expr \'outer:\l loop {\l \'inner:\l loop {\l if x == 1 { continue \'outer ; \"unreachable\"; }\l if y >= 2 { return; \"unreachable\"; }\l x -= 1;\l y -= 3;\l }\l \"unreachable\";\l }\l"]; N10[label="(dummy_node)"]; - N11[label="expr \'inner:\l loop {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l x -= 1is;\l y -= 3is;\l }\l"]; + N11[label="expr \'inner:\l loop {\l if x == 1 { continue \'outer ; \"unreachable\"; }\l if y >= 2 { return; \"unreachable\"; }\l x -= 1;\l y -= 3;\l }\l"]; N12[label="expr x"]; - N13[label="expr 1is"]; - N14[label="expr x == 1is"]; + N13[label="expr 1"]; + N14[label="expr x == 1"]; N15[label="expr continue \'outer"]; N16[label="(dummy_node)"]; N17[label="stmt continue \'outer ;"]; N18[label="expr \"unreachable\""]; N19[label="stmt \"unreachable\";"]; N20[label="block { continue \'outer ; \"unreachable\"; }"]; - N21[label="expr if x == 1is { continue \'outer ; \"unreachable\"; }"]; - N22[label="stmt if x == 1is { continue \'outer ; \"unreachable\"; }"]; + N21[label="expr if x == 1 { continue \'outer ; \"unreachable\"; }"]; + N22[label="stmt if x == 1 { continue \'outer ; \"unreachable\"; }"]; N23[label="expr y"]; - N24[label="expr 2is"]; - N25[label="expr y >= 2is"]; + N24[label="expr 2"]; + N25[label="expr y >= 2"]; N26[label="expr return"]; N27[label="(dummy_node)"]; N28[label="stmt return;"]; N29[label="expr \"unreachable\""]; N30[label="stmt \"unreachable\";"]; N31[label="block { return; \"unreachable\"; }"]; - N32[label="expr if y >= 2is { return; \"unreachable\"; }"]; - N33[label="stmt if y >= 2is { return; \"unreachable\"; }"]; - N34[label="expr 1is"]; + N32[label="expr if y >= 2 { return; \"unreachable\"; }"]; + N33[label="stmt if y >= 2 { return; \"unreachable\"; }"]; + N34[label="expr 1"]; N35[label="expr x"]; - N36[label="expr x -= 1is"]; - N37[label="stmt x -= 1is;"]; - N38[label="expr 3is"]; + N36[label="expr x -= 1"]; + N37[label="stmt x -= 1;"]; + N38[label="expr 3"]; N39[label="expr y"]; - N40[label="expr y -= 3is"]; - N41[label="stmt y -= 3is;"]; - N42[label="block {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l x -= 1is;\l y -= 3is;\l}\l"]; - N43[label="stmt \'inner:\l loop {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l x -= 1is;\l y -= 3is;\l }\l"]; + N40[label="expr y -= 3"]; + N41[label="stmt y -= 3;"]; + N42[label="block {\l if x == 1 { continue \'outer ; \"unreachable\"; }\l if y >= 2 { return; \"unreachable\"; }\l x -= 1;\l y -= 3;\l}\l"]; + N43[label="stmt \'inner:\l loop {\l if x == 1 { continue \'outer ; \"unreachable\"; }\l if y >= 2 { return; \"unreachable\"; }\l x -= 1;\l y -= 3;\l }\l"]; N44[label="expr \"unreachable\""]; N45[label="stmt \"unreachable\";"]; - N46[label="block {\l \'inner:\l loop {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l x -= 1is;\l y -= 3is;\l }\l \"unreachable\";\l}\l"]; - N47[label="stmt \'outer:\l loop {\l \'inner:\l loop {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l x -= 1is;\l y -= 3is;\l }\l \"unreachable\";\l }\l"]; + N46[label="block {\l \'inner:\l loop {\l if x == 1 { continue \'outer ; \"unreachable\"; }\l if y >= 2 { return; \"unreachable\"; }\l x -= 1;\l y -= 3;\l }\l \"unreachable\";\l}\l"]; + N47[label="stmt \'outer:\l loop {\l \'inner:\l loop {\l if x == 1 { continue \'outer ; \"unreachable\"; }\l if y >= 2 { return; \"unreachable\"; }\l x -= 1;\l y -= 3;\l }\l \"unreachable\";\l }\l"]; N48[label="expr \"unreachable\""]; N49[label="stmt \"unreachable\";"]; - N50[label="block {\l let mut x = 15is;\l let mut y = 151is;\l \'outer:\l loop {\l \'inner:\l loop {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l x -= 1is;\l y -= 3is;\l }\l \"unreachable\";\l }\l \"unreachable\";\l}\l"]; + N50[label="block {\l let mut x = 15;\l let mut y = 151;\l \'outer:\l loop {\l \'inner:\l loop {\l if x == 1 { continue \'outer ; \"unreachable\"; }\l if y >= 2 { return; \"unreachable\"; }\l x -= 1;\l y -= 3;\l }\l \"unreachable\";\l }\l \"unreachable\";\l}\l"]; N0 -> N2; N2 -> N3; N3 -> N4; @@ -62,7 +62,7 @@ digraph block { N12 -> N13; N13 -> N14; N14 -> N15; - N15 -> N8[label="exiting scope_0 expr continue \'outer,\lexiting scope_1 stmt continue \'outer ;,\lexiting scope_2 block { continue \'outer ; \"unreachable\"; },\lexiting scope_3 expr if x == 1is { continue \'outer ; \"unreachable\"; },\lexiting scope_4 stmt if x == 1is { continue \'outer ; \"unreachable\"; },\lexiting scope_5 block {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l x -= 1is;\l y -= 3is;\l}\l,\lexiting scope_6 expr \'inner:\l loop {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l x -= 1is;\l y -= 3is;\l }\l,\lexiting scope_7 stmt \'inner:\l loop {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l x -= 1is;\l y -= 3is;\l }\l,\lexiting scope_8 block {\l \'inner:\l loop {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l x -= 1is;\l y -= 3is;\l }\l \"unreachable\";\l}\l"]; + N15 -> N8; N16 -> N17; N17 -> N18; N18 -> N19; @@ -74,7 +74,7 @@ digraph block { N23 -> N24; N24 -> N25; N25 -> N26; - N26 -> N1[label="exiting scope_0 expr \'inner:\l loop {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l x -= 1is;\l y -= 3is;\l }\l,\lexiting scope_1 expr \'outer:\l loop {\l \'inner:\l loop {\l if x == 1is { continue \'outer ; \"unreachable\"; }\l if y >= 2is { return; \"unreachable\"; }\l x -= 1is;\l y -= 3is;\l }\l \"unreachable\";\l }\l"]; + N26 -> N1; N27 -> N28; N28 -> N29; N29 -> N30; diff --git a/src/test/run-make/graphviz-flowgraph/f22.rs b/src/test/run-make/graphviz-flowgraph/f22.rs index 6de703a42f..b35aac9ec4 100644 --- a/src/test/run-make/graphviz-flowgraph/f22.rs +++ b/src/test/run-make/graphviz-flowgraph/f22.rs @@ -10,20 +10,20 @@ #[allow(unreachable_code)] pub fn expr_break_label_21() { - let mut x = 15is; - let mut y = 151is; + let mut x = 15; + let mut y = 151; 'outer: loop { 'inner: loop { - if x == 1is { + if x == 1 { continue 'outer; "unreachable"; } - if y >= 2is { + if y >= 2 { return; "unreachable"; } - x -= 1is; - y -= 3is; + x -= 1; + y -= 3; } "unreachable"; } diff --git a/src/test/run-make/graphviz-flowgraph/f23.dot-expected.dot b/src/test/run-make/graphviz-flowgraph/f23.dot-expected.dot index 2b5c5cdff4..b3f285049c 100644 --- a/src/test/run-make/graphviz-flowgraph/f23.dot-expected.dot +++ b/src/test/run-make/graphviz-flowgraph/f23.dot-expected.dot @@ -1,57 +1,57 @@ digraph block { N0[label="entry"]; N1[label="exit"]; - N2[label="expr 23is"]; + N2[label="expr 23"]; N3[label="local mut x"]; - N4[label="stmt let mut x = 23is;"]; - N5[label="expr 23is"]; + N4[label="stmt let mut x = 23;"]; + N5[label="expr 23"]; N6[label="local mut y"]; - N7[label="stmt let mut y = 23is;"]; - N8[label="expr 23is"]; + N7[label="stmt let mut y = 23;"]; + N8[label="expr 23"]; N9[label="local mut z"]; - N10[label="stmt let mut z = 23is;"]; + N10[label="stmt let mut z = 23;"]; N11[label="(dummy_node)"]; N12[label="expr x"]; - N13[label="expr 0is"]; - N14[label="expr x > 0is"]; - N15[label="expr while x > 0is {\l x -= 1is;\l while y > 0is {\l y -= 1is;\l while z > 0is { z -= 1is; }\l if x > 10is { return; \"unreachable\"; }\l }\l}\l"]; - N16[label="expr 1is"]; + N13[label="expr 0"]; + N14[label="expr x > 0"]; + N15[label="expr while x > 0 {\l x -= 1;\l while y > 0 {\l y -= 1;\l while z > 0 { z -= 1; }\l if x > 10 { return; \"unreachable\"; }\l }\l}\l"]; + N16[label="expr 1"]; N17[label="expr x"]; - N18[label="expr x -= 1is"]; - N19[label="stmt x -= 1is;"]; + N18[label="expr x -= 1"]; + N19[label="stmt x -= 1;"]; N20[label="(dummy_node)"]; N21[label="expr y"]; - N22[label="expr 0is"]; - N23[label="expr y > 0is"]; - N24[label="expr while y > 0is {\l y -= 1is;\l while z > 0is { z -= 1is; }\l if x > 10is { return; \"unreachable\"; }\l}\l"]; - N25[label="expr 1is"]; + N22[label="expr 0"]; + N23[label="expr y > 0"]; + N24[label="expr while y > 0 {\l y -= 1;\l while z > 0 { z -= 1; }\l if x > 10 { return; \"unreachable\"; }\l}\l"]; + N25[label="expr 1"]; N26[label="expr y"]; - N27[label="expr y -= 1is"]; - N28[label="stmt y -= 1is;"]; + N27[label="expr y -= 1"]; + N28[label="stmt y -= 1;"]; N29[label="(dummy_node)"]; N30[label="expr z"]; - N31[label="expr 0is"]; - N32[label="expr z > 0is"]; - N33[label="expr while z > 0is { z -= 1is; }"]; - N34[label="expr 1is"]; + N31[label="expr 0"]; + N32[label="expr z > 0"]; + N33[label="expr while z > 0 { z -= 1; }"]; + N34[label="expr 1"]; N35[label="expr z"]; - N36[label="expr z -= 1is"]; - N37[label="stmt z -= 1is;"]; - N38[label="block { z -= 1is; }"]; - N39[label="stmt while z > 0is { z -= 1is; }"]; + N36[label="expr z -= 1"]; + N37[label="stmt z -= 1;"]; + N38[label="block { z -= 1; }"]; + N39[label="stmt while z > 0 { z -= 1; }"]; N40[label="expr x"]; - N41[label="expr 10is"]; - N42[label="expr x > 10is"]; + N41[label="expr 10"]; + N42[label="expr x > 10"]; N43[label="expr return"]; N44[label="(dummy_node)"]; N45[label="stmt return;"]; N46[label="expr \"unreachable\""]; N47[label="stmt \"unreachable\";"]; N48[label="block { return; \"unreachable\"; }"]; - N49[label="expr if x > 10is { return; \"unreachable\"; }"]; - N50[label="block {\l y -= 1is;\l while z > 0is { z -= 1is; }\l if x > 10is { return; \"unreachable\"; }\l}\l"]; - N51[label="block {\l x -= 1is;\l while y > 0is {\l y -= 1is;\l while z > 0is { z -= 1is; }\l if x > 10is { return; \"unreachable\"; }\l }\l}\l"]; - N52[label="block {\l let mut x = 23is;\l let mut y = 23is;\l let mut z = 23is;\l while x > 0is {\l x -= 1is;\l while y > 0is {\l y -= 1is;\l while z > 0is { z -= 1is; }\l if x > 10is { return; \"unreachable\"; }\l }\l }\l}\l"]; + N49[label="expr if x > 10 { return; \"unreachable\"; }"]; + N50[label="block { y -= 1; while z > 0 { z -= 1; } if x > 10 { return; \"unreachable\"; } }"]; + N51[label="block {\l x -= 1;\l while y > 0 {\l y -= 1;\l while z > 0 { z -= 1; }\l if x > 10 { return; \"unreachable\"; }\l }\l}\l"]; + N52[label="block {\l let mut x = 23;\l let mut y = 23;\l let mut z = 23;\l while x > 0 {\l x -= 1;\l while y > 0 {\l y -= 1;\l while z > 0 { z -= 1; }\l if x > 10 { return; \"unreachable\"; }\l }\l }\l}\l"]; N0 -> N2; N2 -> N3; N3 -> N4; @@ -95,7 +95,7 @@ digraph block { N40 -> N41; N41 -> N42; N42 -> N43; - N43 -> N1[label="exiting scope_0 expr while y > 0is {\l y -= 1is;\l while z > 0is { z -= 1is; }\l if x > 10is { return; \"unreachable\"; }\l}\l,\lexiting scope_1 expr while x > 0is {\l x -= 1is;\l while y > 0is {\l y -= 1is;\l while z > 0is { z -= 1is; }\l if x > 10is { return; \"unreachable\"; }\l }\l}\l"]; + N43 -> N1; N44 -> N45; N45 -> N46; N46 -> N47; diff --git a/src/test/run-make/graphviz-flowgraph/f23.rs b/src/test/run-make/graphviz-flowgraph/f23.rs index 6ffa183890..52341a3fbd 100644 --- a/src/test/run-make/graphviz-flowgraph/f23.rs +++ b/src/test/run-make/graphviz-flowgraph/f23.rs @@ -10,19 +10,19 @@ #[allow(unreachable_code)] pub fn expr_while_23() { - let mut x = 23is; - let mut y = 23is; - let mut z = 23is; + let mut x = 23; + let mut y = 23; + let mut z = 23; - while x > 0is { - x -= 1is; + while x > 0 { + x -= 1; - while y > 0is { - y -= 1is; + while y > 0 { + y -= 1; - while z > 0is { z -= 1is; } + while z > 0 { z -= 1; } - if x > 10is { + if x > 10 { return; "unreachable"; } diff --git a/src/test/run-make/graphviz-flowgraph/f24.dot-expected.dot b/src/test/run-make/graphviz-flowgraph/f24.dot-expected.dot index ee3fe7ced6..43b3295bf3 100644 --- a/src/test/run-make/graphviz-flowgraph/f24.dot-expected.dot +++ b/src/test/run-make/graphviz-flowgraph/f24.dot-expected.dot @@ -1,81 +1,81 @@ digraph block { N0[label="entry"]; N1[label="exit"]; - N2[label="expr 24is"]; + N2[label="expr 24"]; N3[label="local mut x"]; - N4[label="stmt let mut x = 24is;"]; - N5[label="expr 24is"]; + N4[label="stmt let mut x = 24;"]; + N5[label="expr 24"]; N6[label="local mut y"]; - N7[label="stmt let mut y = 24is;"]; - N8[label="expr 24is"]; + N7[label="stmt let mut y = 24;"]; + N8[label="expr 24"]; N9[label="local mut z"]; - N10[label="stmt let mut z = 24is;"]; + N10[label="stmt let mut z = 24;"]; N11[label="(dummy_node)"]; - N12[label="expr loop {\l if x == 0is { break ; \"unreachable\"; }\l x -= 1is;\l loop {\l if y == 0is { break ; \"unreachable\"; }\l y -= 1is;\l loop { if z == 0is { break ; \"unreachable\"; } z -= 1is; }\l if x > 10is { return; \"unreachable\"; }\l }\l}\l"]; + N12[label="expr loop {\l if x == 0 { break ; \"unreachable\"; }\l x -= 1;\l loop {\l if y == 0 { break ; \"unreachable\"; }\l y -= 1;\l loop { if z == 0 { break ; \"unreachable\"; } z -= 1; }\l if x > 10 { return; \"unreachable\"; }\l }\l}\l"]; N13[label="expr x"]; - N14[label="expr 0is"]; - N15[label="expr x == 0is"]; + N14[label="expr 0"]; + N15[label="expr x == 0"]; N16[label="expr break"]; N17[label="(dummy_node)"]; N18[label="stmt break ;"]; N19[label="expr \"unreachable\""]; N20[label="stmt \"unreachable\";"]; N21[label="block { break ; \"unreachable\"; }"]; - N22[label="expr if x == 0is { break ; \"unreachable\"; }"]; - N23[label="stmt if x == 0is { break ; \"unreachable\"; }"]; - N24[label="expr 1is"]; + N22[label="expr if x == 0 { break ; \"unreachable\"; }"]; + N23[label="stmt if x == 0 { break ; \"unreachable\"; }"]; + N24[label="expr 1"]; N25[label="expr x"]; - N26[label="expr x -= 1is"]; - N27[label="stmt x -= 1is;"]; + N26[label="expr x -= 1"]; + N27[label="stmt x -= 1;"]; N28[label="(dummy_node)"]; - N29[label="expr loop {\l if y == 0is { break ; \"unreachable\"; }\l y -= 1is;\l loop { if z == 0is { break ; \"unreachable\"; } z -= 1is; }\l if x > 10is { return; \"unreachable\"; }\l}\l"]; + N29[label="expr loop {\l if y == 0 { break ; \"unreachable\"; }\l y -= 1;\l loop { if z == 0 { break ; \"unreachable\"; } z -= 1; }\l if x > 10 { return; \"unreachable\"; }\l}\l"]; N30[label="expr y"]; - N31[label="expr 0is"]; - N32[label="expr y == 0is"]; + N31[label="expr 0"]; + N32[label="expr y == 0"]; N33[label="expr break"]; N34[label="(dummy_node)"]; N35[label="stmt break ;"]; N36[label="expr \"unreachable\""]; N37[label="stmt \"unreachable\";"]; N38[label="block { break ; \"unreachable\"; }"]; - N39[label="expr if y == 0is { break ; \"unreachable\"; }"]; - N40[label="stmt if y == 0is { break ; \"unreachable\"; }"]; - N41[label="expr 1is"]; + N39[label="expr if y == 0 { break ; \"unreachable\"; }"]; + N40[label="stmt if y == 0 { break ; \"unreachable\"; }"]; + N41[label="expr 1"]; N42[label="expr y"]; - N43[label="expr y -= 1is"]; - N44[label="stmt y -= 1is;"]; + N43[label="expr y -= 1"]; + N44[label="stmt y -= 1;"]; N45[label="(dummy_node)"]; - N46[label="expr loop { if z == 0is { break ; \"unreachable\"; } z -= 1is; }"]; + N46[label="expr loop { if z == 0 { break ; \"unreachable\"; } z -= 1; }"]; N47[label="expr z"]; - N48[label="expr 0is"]; - N49[label="expr z == 0is"]; + N48[label="expr 0"]; + N49[label="expr z == 0"]; N50[label="expr break"]; N51[label="(dummy_node)"]; N52[label="stmt break ;"]; N53[label="expr \"unreachable\""]; N54[label="stmt \"unreachable\";"]; N55[label="block { break ; \"unreachable\"; }"]; - N56[label="expr if z == 0is { break ; \"unreachable\"; }"]; - N57[label="stmt if z == 0is { break ; \"unreachable\"; }"]; - N58[label="expr 1is"]; + N56[label="expr if z == 0 { break ; \"unreachable\"; }"]; + N57[label="stmt if z == 0 { break ; \"unreachable\"; }"]; + N58[label="expr 1"]; N59[label="expr z"]; - N60[label="expr z -= 1is"]; - N61[label="stmt z -= 1is;"]; - N62[label="block { if z == 0is { break ; \"unreachable\"; } z -= 1is; }"]; - N63[label="stmt loop { if z == 0is { break ; \"unreachable\"; } z -= 1is; }"]; + N60[label="expr z -= 1"]; + N61[label="stmt z -= 1;"]; + N62[label="block { if z == 0 { break ; \"unreachable\"; } z -= 1; }"]; + N63[label="stmt loop { if z == 0 { break ; \"unreachable\"; } z -= 1; }"]; N64[label="expr x"]; - N65[label="expr 10is"]; - N66[label="expr x > 10is"]; + N65[label="expr 10"]; + N66[label="expr x > 10"]; N67[label="expr return"]; N68[label="(dummy_node)"]; N69[label="stmt return;"]; N70[label="expr \"unreachable\""]; N71[label="stmt \"unreachable\";"]; N72[label="block { return; \"unreachable\"; }"]; - N73[label="expr if x > 10is { return; \"unreachable\"; }"]; - N74[label="block {\l if y == 0is { break ; \"unreachable\"; }\l y -= 1is;\l loop { if z == 0is { break ; \"unreachable\"; } z -= 1is; }\l if x > 10is { return; \"unreachable\"; }\l}\l"]; - N75[label="block {\l if x == 0is { break ; \"unreachable\"; }\l x -= 1is;\l loop {\l if y == 0is { break ; \"unreachable\"; }\l y -= 1is;\l loop { if z == 0is { break ; \"unreachable\"; } z -= 1is; }\l if x > 10is { return; \"unreachable\"; }\l }\l}\l"]; - N76[label="block {\l let mut x = 24is;\l let mut y = 24is;\l let mut z = 24is;\l loop {\l if x == 0is { break ; \"unreachable\"; }\l x -= 1is;\l loop {\l if y == 0is { break ; \"unreachable\"; }\l y -= 1is;\l loop { if z == 0is { break ; \"unreachable\"; } z -= 1is; }\l if x > 10is { return; \"unreachable\"; }\l }\l }\l}\l"]; + N73[label="expr if x > 10 { return; \"unreachable\"; }"]; + N74[label="block {\l if y == 0 { break ; \"unreachable\"; }\l y -= 1;\l loop { if z == 0 { break ; \"unreachable\"; } z -= 1; }\l if x > 10 { return; \"unreachable\"; }\l}\l"]; + N75[label="block {\l if x == 0 { break ; \"unreachable\"; }\l x -= 1;\l loop {\l if y == 0 { break ; \"unreachable\"; }\l y -= 1;\l loop { if z == 0 { break ; \"unreachable\"; } z -= 1; }\l if x > 10 { return; \"unreachable\"; }\l }\l}\l"]; + N76[label="block {\l let mut x = 24;\l let mut y = 24;\l let mut z = 24;\l loop {\l if x == 0 { break ; \"unreachable\"; }\l x -= 1;\l loop {\l if y == 0 { break ; \"unreachable\"; }\l y -= 1;\l loop { if z == 0 { break ; \"unreachable\"; } z -= 1; }\l if x > 10 { return; \"unreachable\"; }\l }\l }\l}\l"]; N0 -> N2; N2 -> N3; N3 -> N4; @@ -90,7 +90,7 @@ digraph block { N13 -> N14; N14 -> N15; N15 -> N16; - N16 -> N12[label="exiting scope_0 expr break,\lexiting scope_1 stmt break ;,\lexiting scope_2 block { break ; \"unreachable\"; },\lexiting scope_3 expr if x == 0is { break ; \"unreachable\"; },\lexiting scope_4 stmt if x == 0is { break ; \"unreachable\"; },\lexiting scope_5 block {\l if x == 0is { break ; \"unreachable\"; }\l x -= 1is;\l loop {\l if y == 0is { break ; \"unreachable\"; }\l y -= 1is;\l loop { if z == 0is { break ; \"unreachable\"; } z -= 1is; }\l if x > 10is { return; \"unreachable\"; }\l }\l}\l"]; + N16 -> N12; N17 -> N18; N18 -> N19; N19 -> N20; @@ -107,7 +107,7 @@ digraph block { N30 -> N31; N31 -> N32; N32 -> N33; - N33 -> N29[label="exiting scope_0 expr break,\lexiting scope_1 stmt break ;,\lexiting scope_2 block { break ; \"unreachable\"; },\lexiting scope_3 expr if y == 0is { break ; \"unreachable\"; },\lexiting scope_4 stmt if y == 0is { break ; \"unreachable\"; },\lexiting scope_5 block {\l if y == 0is { break ; \"unreachable\"; }\l y -= 1is;\l loop { if z == 0is { break ; \"unreachable\"; } z -= 1is; }\l if x > 10is { return; \"unreachable\"; }\l}\l"]; + N33 -> N29; N34 -> N35; N35 -> N36; N36 -> N37; @@ -124,7 +124,7 @@ digraph block { N47 -> N48; N48 -> N49; N49 -> N50; - N50 -> N46[label="exiting scope_0 expr break,\lexiting scope_1 stmt break ;,\lexiting scope_2 block { break ; \"unreachable\"; },\lexiting scope_3 expr if z == 0is { break ; \"unreachable\"; },\lexiting scope_4 stmt if z == 0is { break ; \"unreachable\"; },\lexiting scope_5 block { if z == 0is { break ; \"unreachable\"; } z -= 1is; }"]; + N50 -> N46; N51 -> N52; N52 -> N53; N53 -> N54; @@ -143,7 +143,7 @@ digraph block { N64 -> N65; N65 -> N66; N66 -> N67; - N67 -> N1[label="exiting scope_0 expr loop {\l if y == 0is { break ; \"unreachable\"; }\l y -= 1is;\l loop { if z == 0is { break ; \"unreachable\"; } z -= 1is; }\l if x > 10is { return; \"unreachable\"; }\l}\l,\lexiting scope_1 expr loop {\l if x == 0is { break ; \"unreachable\"; }\l x -= 1is;\l loop {\l if y == 0is { break ; \"unreachable\"; }\l y -= 1is;\l loop { if z == 0is { break ; \"unreachable\"; } z -= 1is; }\l if x > 10is { return; \"unreachable\"; }\l }\l}\l"]; + N67 -> N1; N68 -> N69; N69 -> N70; N70 -> N71; diff --git a/src/test/run-make/graphviz-flowgraph/f24.rs b/src/test/run-make/graphviz-flowgraph/f24.rs index ebaf7f2810..f796d660a1 100644 --- a/src/test/run-make/graphviz-flowgraph/f24.rs +++ b/src/test/run-make/graphviz-flowgraph/f24.rs @@ -10,24 +10,24 @@ #[allow(unreachable_code)] pub fn expr_while_24() { - let mut x = 24is; - let mut y = 24is; - let mut z = 24is; + let mut x = 24; + let mut y = 24; + let mut z = 24; loop { - if x == 0is { break; "unreachable"; } - x -= 1is; + if x == 0 { break; "unreachable"; } + x -= 1; loop { - if y == 0is { break; "unreachable"; } - y -= 1is; + if y == 0 { break; "unreachable"; } + y -= 1; loop { - if z == 0is { break; "unreachable"; } - z -= 1is; + if z == 0 { break; "unreachable"; } + z -= 1; } - if x > 10is { + if x > 10 { return; "unreachable"; } diff --git a/src/test/run-make/graphviz-flowgraph/f25.dot-expected.dot b/src/test/run-make/graphviz-flowgraph/f25.dot-expected.dot index 82799c724b..50fdffb781 100644 --- a/src/test/run-make/graphviz-flowgraph/f25.dot-expected.dot +++ b/src/test/run-make/graphviz-flowgraph/f25.dot-expected.dot @@ -1,81 +1,81 @@ digraph block { N0[label="entry"]; N1[label="exit"]; - N2[label="expr 25is"]; + N2[label="expr 25"]; N3[label="local mut x"]; - N4[label="stmt let mut x = 25is;"]; - N5[label="expr 25is"]; + N4[label="stmt let mut x = 25;"]; + N5[label="expr 25"]; N6[label="local mut y"]; - N7[label="stmt let mut y = 25is;"]; - N8[label="expr 25is"]; + N7[label="stmt let mut y = 25;"]; + N8[label="expr 25"]; N9[label="local mut z"]; - N10[label="stmt let mut z = 25is;"]; + N10[label="stmt let mut z = 25;"]; N11[label="(dummy_node)"]; - N12[label="expr \'a:\l loop {\l if x == 0is { break ; \"unreachable\"; }\l x -= 1is;\l \'a:\l loop {\l if y == 0is { break ; \"unreachable\"; }\l y -= 1is;\l \'a: loop { if z == 0is { break ; \"unreachable\"; } z -= 1is; }\l if x > 10is { continue \'a ; \"unreachable\"; }\l }\l }\l"]; + N12[label="expr \'a:\l loop {\l if x == 0 { break ; \"unreachable\"; }\l x -= 1;\l \'a:\l loop {\l if y == 0 { break ; \"unreachable\"; }\l y -= 1;\l \'a: loop { if z == 0 { break ; \"unreachable\"; } z -= 1; }\l if x > 10 { continue \'a ; \"unreachable\"; }\l }\l }\l"]; N13[label="expr x"]; - N14[label="expr 0is"]; - N15[label="expr x == 0is"]; + N14[label="expr 0"]; + N15[label="expr x == 0"]; N16[label="expr break"]; N17[label="(dummy_node)"]; N18[label="stmt break ;"]; N19[label="expr \"unreachable\""]; N20[label="stmt \"unreachable\";"]; N21[label="block { break ; \"unreachable\"; }"]; - N22[label="expr if x == 0is { break ; \"unreachable\"; }"]; - N23[label="stmt if x == 0is { break ; \"unreachable\"; }"]; - N24[label="expr 1is"]; + N22[label="expr if x == 0 { break ; \"unreachable\"; }"]; + N23[label="stmt if x == 0 { break ; \"unreachable\"; }"]; + N24[label="expr 1"]; N25[label="expr x"]; - N26[label="expr x -= 1is"]; - N27[label="stmt x -= 1is;"]; + N26[label="expr x -= 1"]; + N27[label="stmt x -= 1;"]; N28[label="(dummy_node)"]; - N29[label="expr \'a:\l loop {\l if y == 0is { break ; \"unreachable\"; }\l y -= 1is;\l \'a: loop { if z == 0is { break ; \"unreachable\"; } z -= 1is; }\l if x > 10is { continue \'a ; \"unreachable\"; }\l }\l"]; + N29[label="expr \'a:\l loop {\l if y == 0 { break ; \"unreachable\"; }\l y -= 1;\l \'a: loop { if z == 0 { break ; \"unreachable\"; } z -= 1; }\l if x > 10 { continue \'a ; \"unreachable\"; }\l }\l"]; N30[label="expr y"]; - N31[label="expr 0is"]; - N32[label="expr y == 0is"]; + N31[label="expr 0"]; + N32[label="expr y == 0"]; N33[label="expr break"]; N34[label="(dummy_node)"]; N35[label="stmt break ;"]; N36[label="expr \"unreachable\""]; N37[label="stmt \"unreachable\";"]; N38[label="block { break ; \"unreachable\"; }"]; - N39[label="expr if y == 0is { break ; \"unreachable\"; }"]; - N40[label="stmt if y == 0is { break ; \"unreachable\"; }"]; - N41[label="expr 1is"]; + N39[label="expr if y == 0 { break ; \"unreachable\"; }"]; + N40[label="stmt if y == 0 { break ; \"unreachable\"; }"]; + N41[label="expr 1"]; N42[label="expr y"]; - N43[label="expr y -= 1is"]; - N44[label="stmt y -= 1is;"]; + N43[label="expr y -= 1"]; + N44[label="stmt y -= 1;"]; N45[label="(dummy_node)"]; - N46[label="expr \'a: loop { if z == 0is { break ; \"unreachable\"; } z -= 1is; }"]; + N46[label="expr \'a: loop { if z == 0 { break ; \"unreachable\"; } z -= 1; }"]; N47[label="expr z"]; - N48[label="expr 0is"]; - N49[label="expr z == 0is"]; + N48[label="expr 0"]; + N49[label="expr z == 0"]; N50[label="expr break"]; N51[label="(dummy_node)"]; N52[label="stmt break ;"]; N53[label="expr \"unreachable\""]; N54[label="stmt \"unreachable\";"]; N55[label="block { break ; \"unreachable\"; }"]; - N56[label="expr if z == 0is { break ; \"unreachable\"; }"]; - N57[label="stmt if z == 0is { break ; \"unreachable\"; }"]; - N58[label="expr 1is"]; + N56[label="expr if z == 0 { break ; \"unreachable\"; }"]; + N57[label="stmt if z == 0 { break ; \"unreachable\"; }"]; + N58[label="expr 1"]; N59[label="expr z"]; - N60[label="expr z -= 1is"]; - N61[label="stmt z -= 1is;"]; - N62[label="block { if z == 0is { break ; \"unreachable\"; } z -= 1is; }"]; - N63[label="stmt \'a: loop { if z == 0is { break ; \"unreachable\"; } z -= 1is; }"]; + N60[label="expr z -= 1"]; + N61[label="stmt z -= 1;"]; + N62[label="block { if z == 0 { break ; \"unreachable\"; } z -= 1; }"]; + N63[label="stmt \'a: loop { if z == 0 { break ; \"unreachable\"; } z -= 1; }"]; N64[label="expr x"]; - N65[label="expr 10is"]; - N66[label="expr x > 10is"]; + N65[label="expr 10"]; + N66[label="expr x > 10"]; N67[label="expr continue \'a"]; N68[label="(dummy_node)"]; N69[label="stmt continue \'a ;"]; N70[label="expr \"unreachable\""]; N71[label="stmt \"unreachable\";"]; N72[label="block { continue \'a ; \"unreachable\"; }"]; - N73[label="expr if x > 10is { continue \'a ; \"unreachable\"; }"]; - N74[label="block {\l if y == 0is { break ; \"unreachable\"; }\l y -= 1is;\l \'a: loop { if z == 0is { break ; \"unreachable\"; } z -= 1is; }\l if x > 10is { continue \'a ; \"unreachable\"; }\l}\l"]; - N75[label="block {\l if x == 0is { break ; \"unreachable\"; }\l x -= 1is;\l \'a:\l loop {\l if y == 0is { break ; \"unreachable\"; }\l y -= 1is;\l \'a: loop { if z == 0is { break ; \"unreachable\"; } z -= 1is; }\l if x > 10is { continue \'a ; \"unreachable\"; }\l }\l}\l"]; - N76[label="block {\l let mut x = 25is;\l let mut y = 25is;\l let mut z = 25is;\l \'a:\l loop {\l if x == 0is { break ; \"unreachable\"; }\l x -= 1is;\l \'a:\l loop {\l if y == 0is { break ; \"unreachable\"; }\l y -= 1is;\l \'a:\l loop {\l if z == 0is { break ; \"unreachable\"; }\l z -= 1is;\l }\l if x > 10is { continue \'a ; \"unreachable\"; }\l }\l }\l}\l"]; + N73[label="expr if x > 10 { continue \'a ; \"unreachable\"; }"]; + N74[label="block {\l if y == 0 { break ; \"unreachable\"; }\l y -= 1;\l \'a: loop { if z == 0 { break ; \"unreachable\"; } z -= 1; }\l if x > 10 { continue \'a ; \"unreachable\"; }\l}\l"]; + N75[label="block {\l if x == 0 { break ; \"unreachable\"; }\l x -= 1;\l \'a:\l loop {\l if y == 0 { break ; \"unreachable\"; }\l y -= 1;\l \'a: loop { if z == 0 { break ; \"unreachable\"; } z -= 1; }\l if x > 10 { continue \'a ; \"unreachable\"; }\l }\l}\l"]; + N76[label="block {\l let mut x = 25;\l let mut y = 25;\l let mut z = 25;\l \'a:\l loop {\l if x == 0 { break ; \"unreachable\"; }\l x -= 1;\l \'a:\l loop {\l if y == 0 { break ; \"unreachable\"; }\l y -= 1;\l \'a: loop { if z == 0 { break ; \"unreachable\"; } z -= 1; }\l if x > 10 { continue \'a ; \"unreachable\"; }\l }\l }\l}\l"]; N0 -> N2; N2 -> N3; N3 -> N4; @@ -90,7 +90,7 @@ digraph block { N13 -> N14; N14 -> N15; N15 -> N16; - N16 -> N12[label="exiting scope_0 expr break,\lexiting scope_1 stmt break ;,\lexiting scope_2 block { break ; \"unreachable\"; },\lexiting scope_3 expr if x == 0is { break ; \"unreachable\"; },\lexiting scope_4 stmt if x == 0is { break ; \"unreachable\"; },\lexiting scope_5 block {\l if x == 0is { break ; \"unreachable\"; }\l x -= 1is;\l \'a:\l loop {\l if y == 0is { break ; \"unreachable\"; }\l y -= 1is;\l \'a: loop { if z == 0is { break ; \"unreachable\"; } z -= 1is; }\l if x > 10is { continue \'a ; \"unreachable\"; }\l }\l}\l"]; + N16 -> N12; N17 -> N18; N18 -> N19; N19 -> N20; @@ -107,7 +107,7 @@ digraph block { N30 -> N31; N31 -> N32; N32 -> N33; - N33 -> N29[label="exiting scope_0 expr break,\lexiting scope_1 stmt break ;,\lexiting scope_2 block { break ; \"unreachable\"; },\lexiting scope_3 expr if y == 0is { break ; \"unreachable\"; },\lexiting scope_4 stmt if y == 0is { break ; \"unreachable\"; },\lexiting scope_5 block {\l if y == 0is { break ; \"unreachable\"; }\l y -= 1is;\l \'a: loop { if z == 0is { break ; \"unreachable\"; } z -= 1is; }\l if x > 10is { continue \'a ; \"unreachable\"; }\l}\l"]; + N33 -> N29; N34 -> N35; N35 -> N36; N36 -> N37; @@ -124,7 +124,7 @@ digraph block { N47 -> N48; N48 -> N49; N49 -> N50; - N50 -> N46[label="exiting scope_0 expr break,\lexiting scope_1 stmt break ;,\lexiting scope_2 block { break ; \"unreachable\"; },\lexiting scope_3 expr if z == 0is { break ; \"unreachable\"; },\lexiting scope_4 stmt if z == 0is { break ; \"unreachable\"; },\lexiting scope_5 block { if z == 0is { break ; \"unreachable\"; } z -= 1is; }"]; + N50 -> N46; N51 -> N52; N52 -> N53; N53 -> N54; @@ -143,7 +143,7 @@ digraph block { N64 -> N65; N65 -> N66; N66 -> N67; - N67 -> N28[label="exiting scope_0 expr continue \'a,\lexiting scope_1 stmt continue \'a ;,\lexiting scope_2 block { continue \'a ; \"unreachable\"; },\lexiting scope_3 expr if x > 10is { continue \'a ; \"unreachable\"; },\lexiting scope_4 block {\l if y == 0is { break ; \"unreachable\"; }\l y -= 1is;\l \'a: loop { if z == 0is { break ; \"unreachable\"; } z -= 1is; }\l if x > 10is { continue \'a ; \"unreachable\"; }\l}\l"]; + N67 -> N28; N68 -> N69; N69 -> N70; N70 -> N71; diff --git a/src/test/run-make/graphviz-flowgraph/f25.rs b/src/test/run-make/graphviz-flowgraph/f25.rs index 8896a85478..2ee2e48fd1 100644 --- a/src/test/run-make/graphviz-flowgraph/f25.rs +++ b/src/test/run-make/graphviz-flowgraph/f25.rs @@ -10,24 +10,24 @@ #[allow(unreachable_code)] pub fn expr_while_25() { - let mut x = 25is; - let mut y = 25is; - let mut z = 25is; + let mut x = 25; + let mut y = 25; + let mut z = 25; 'a: loop { - if x == 0is { break; "unreachable"; } - x -= 1is; + if x == 0 { break; "unreachable"; } + x -= 1; 'a: loop { - if y == 0is { break; "unreachable"; } - y -= 1is; + if y == 0 { break; "unreachable"; } + y -= 1; 'a: loop { - if z == 0is { break; "unreachable"; } - z -= 1is; + if z == 0 { break; "unreachable"; } + z -= 1; } - if x > 10is { + if x > 10 { continue 'a; "unreachable"; } diff --git a/src/test/run-make/interdependent-c-libraries/bar.c b/src/test/run-make/interdependent-c-libraries/bar.c index 812c975352..c761f029ef 100644 --- a/src/test/run-make/interdependent-c-libraries/bar.c +++ b/src/test/run-make/interdependent-c-libraries/bar.c @@ -1,3 +1,4 @@ +// ignore-license void foo(); void bar() { foo(); } diff --git a/src/test/run-make/interdependent-c-libraries/foo.c b/src/test/run-make/interdependent-c-libraries/foo.c index 85e6cd8c39..2895ad473b 100644 --- a/src/test/run-make/interdependent-c-libraries/foo.c +++ b/src/test/run-make/interdependent-c-libraries/foo.c @@ -1 +1,2 @@ +// ignore-license void foo() {} diff --git a/src/test/run-make/issue-12446/foo.c b/src/test/run-make/issue-12446/foo.c index a58cd8bb7c..186a0046e8 100644 --- a/src/test/run-make/issue-12446/foo.c +++ b/src/test/run-make/issue-12446/foo.c @@ -1 +1,2 @@ +// ignore-license void some_c_symbol() {} diff --git a/src/test/run-make/issue-15460/foo.c b/src/test/run-make/issue-15460/foo.c index 85e6cd8c39..2895ad473b 100644 --- a/src/test/run-make/issue-15460/foo.c +++ b/src/test/run-make/issue-15460/foo.c @@ -1 +1,2 @@ +// ignore-license void foo() {} diff --git a/src/test/run-make/issue-19371/foo.rs b/src/test/run-make/issue-19371/foo.rs index 8a0c14d2d7..c96210896f 100644 --- a/src/test/run-make/issue-19371/foo.rs +++ b/src/test/run-make/issue-19371/foo.rs @@ -14,7 +14,7 @@ extern crate syntax; use rustc::session::{build_session, Session}; use rustc::session::config::{basic_options, build_configuration, Input, OutputTypeExe}; -use rustc_driver::driver::{compile_input}; +use rustc_driver::driver::{compile_input, CompileController}; use syntax::diagnostics::registry::Registry; fn main() { @@ -22,15 +22,15 @@ fn main() { fn main() {} "#; - let args = std::os::args(); + let args: Vec = std::env::args().collect(); if args.len() < 4 { panic!("expected rustc path"); } - let tmpdir = Path::new(args[1].as_slice()); + let tmpdir = Path::new(&args[1]); - let mut sysroot = Path::new(args[3].as_slice()); + let mut sysroot = Path::new(&args[3]); sysroot.pop(); sysroot.pop(); @@ -44,7 +44,7 @@ fn basic_sess(sysroot: Path) -> Session { opts.output_types = vec![OutputTypeExe]; opts.maybe_sysroot = Some(sysroot); - let descriptions = Registry::new(&rustc::DIAGNOSTICS); + let descriptions = Registry::new(&rustc::diagnostics::DIAGNOSTICS); let sess = build_session(opts, None, descriptions); sess } @@ -52,11 +52,13 @@ fn basic_sess(sysroot: Path) -> Session { fn compile(code: String, output: Path, sysroot: Path) { let sess = basic_sess(sysroot); let cfg = build_configuration(&sess); + let control = CompileController::basic(); compile_input(sess, cfg, &Input::Str(code), &None, &Some(output), - None); + None, + control); } diff --git a/src/test/run-make/issue-22131/Makefile b/src/test/run-make/issue-22131/Makefile new file mode 100644 index 0000000000..0f927320c4 --- /dev/null +++ b/src/test/run-make/issue-22131/Makefile @@ -0,0 +1,7 @@ +-include ../tools.mk + +all: foo.rs + $(RUSTC) --cfg 'feature="bar"' --crate-type lib foo.rs + $(HOST_RPATH_ENV) $(RUSTDOC) --test --cfg 'feature="bar"' \ + -L $(TMPDIR) foo.rs |\ + grep --quiet 'test foo_0 ... ok' diff --git a/src/test/run-make/issue-22131/foo.rs b/src/test/run-make/issue-22131/foo.rs new file mode 100644 index 0000000000..0b1f1291df --- /dev/null +++ b/src/test/run-make/issue-22131/foo.rs @@ -0,0 +1,17 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name="foo"] + +/// ```rust +/// assert_eq!(foo::foo(), 1); +/// ``` +#[cfg(feature = "bar")] +pub fn foo() -> i32 { 1 } diff --git a/src/test/run-make/issue-7349/Makefile b/src/test/run-make/issue-7349/Makefile index f24933cac0..50dc63b1de 100644 --- a/src/test/run-make/issue-7349/Makefile +++ b/src/test/run-make/issue-7349/Makefile @@ -7,5 +7,5 @@ all: $(RUSTC) foo.rs --emit=llvm-ir - [ "$$(grep -c 8675309 "$(TMPDIR)/foo.ll")" -eq "1" ] - [ "$$(grep -c 11235813 "$(TMPDIR)/foo.ll")" -eq "1" ] + [ "$$(grep -c 'ret i32 8675309' "$(TMPDIR)/foo.ll")" -eq "1" ] + [ "$$(grep -c 'ret i32 11235813' "$(TMPDIR)/foo.ll")" -eq "1" ] diff --git a/src/test/run-make/issue-7349/foo.rs b/src/test/run-make/issue-7349/foo.rs index 870d174927..3a2ced80ef 100644 --- a/src/test/run-make/issue-7349/foo.rs +++ b/src/test/run-make/issue-7349/foo.rs @@ -10,14 +10,14 @@ fn outer() { #[allow(dead_code)] - fn inner() -> uint { + fn inner() -> u32 { 8675309 } } extern "C" fn outer_foreign() { #[allow(dead_code)] - fn inner() -> uint { + fn inner() -> u32 { 11235813 } } diff --git a/src/test/run-make/link-path-order/correct.c b/src/test/run-make/link-path-order/correct.c index 3064af952f..a595939f92 100644 --- a/src/test/run-make/link-path-order/correct.c +++ b/src/test/run-make/link-path-order/correct.c @@ -1 +1,2 @@ +// ignore-license int should_return_one() { return 1; } diff --git a/src/test/run-make/link-path-order/wrong.c b/src/test/run-make/link-path-order/wrong.c index 64275b3ad6..c53e7e3c48 100644 --- a/src/test/run-make/link-path-order/wrong.c +++ b/src/test/run-make/link-path-order/wrong.c @@ -1 +1,2 @@ +// ignore-license int should_return_one() { return 0; } diff --git a/src/test/run-make/linkage-attr-on-static/foo.c b/src/test/run-make/linkage-attr-on-static/foo.c index 78a6934f57..d7d33ea12e 100644 --- a/src/test/run-make/linkage-attr-on-static/foo.c +++ b/src/test/run-make/linkage-attr-on-static/foo.c @@ -1,3 +1,4 @@ +// ignore-license #include extern int32_t BAZ; diff --git a/src/test/run-make/lto-smoke-c/bar.c b/src/test/run-make/lto-smoke-c/bar.c index bb4036b06e..5729d411c5 100644 --- a/src/test/run-make/lto-smoke-c/bar.c +++ b/src/test/run-make/lto-smoke-c/bar.c @@ -1,3 +1,4 @@ +// ignore-license void foo(); int main() { diff --git a/src/test/run-make/manual-link/bar.c b/src/test/run-make/manual-link/bar.c index e425999867..3c167b45af 100644 --- a/src/test/run-make/manual-link/bar.c +++ b/src/test/run-make/manual-link/bar.c @@ -1 +1,2 @@ +// ignore-license void bar() {} diff --git a/src/test/run-make/manual-link/foo.c b/src/test/run-make/manual-link/foo.c index e425999867..3c167b45af 100644 --- a/src/test/run-make/manual-link/foo.c +++ b/src/test/run-make/manual-link/foo.c @@ -1 +1,2 @@ +// ignore-license void bar() {} diff --git a/src/test/run-make/mismatching-target-triples/bar.rs b/src/test/run-make/mismatching-target-triples/bar.rs index ed15e5d880..8695ab58e5 100755 --- a/src/test/run-make/mismatching-target-triples/bar.rs +++ b/src/test/run-make/mismatching-target-triples/bar.rs @@ -7,5 +7,6 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(no_std)] #![no_std] extern crate foo; diff --git a/src/test/run-make/mismatching-target-triples/foo.rs b/src/test/run-make/mismatching-target-triples/foo.rs index 8afa43710d..afd4f298a9 100755 --- a/src/test/run-make/mismatching-target-triples/foo.rs +++ b/src/test/run-make/mismatching-target-triples/foo.rs @@ -7,5 +7,6 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(no_std)] #![no_std] #![crate_type = "lib"] diff --git a/src/test/run-make/no-duplicate-libs/bar.c b/src/test/run-make/no-duplicate-libs/bar.c index 330d914a01..a7b02a2f10 100644 --- a/src/test/run-make/no-duplicate-libs/bar.c +++ b/src/test/run-make/no-duplicate-libs/bar.c @@ -1,3 +1,4 @@ +// ignore-license extern void foo(); void bar() { foo(); } diff --git a/src/test/run-make/no-duplicate-libs/bar.rs b/src/test/run-make/no-duplicate-libs/bar.rs index 1183475610..0bec614818 100644 --- a/src/test/run-make/no-duplicate-libs/bar.rs +++ b/src/test/run-make/no-duplicate-libs/bar.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(lang_items, no_std)] #![no_std] -#![feature(lang_items)] #![crate_type = "dylib"] extern crate libc; diff --git a/src/test/run-make/no-duplicate-libs/foo.c b/src/test/run-make/no-duplicate-libs/foo.c index 85e6cd8c39..2895ad473b 100644 --- a/src/test/run-make/no-duplicate-libs/foo.c +++ b/src/test/run-make/no-duplicate-libs/foo.c @@ -1 +1,2 @@ +// ignore-license void foo() {} diff --git a/src/test/run-make/no-duplicate-libs/foo.rs b/src/test/run-make/no-duplicate-libs/foo.rs index 61a2a51da0..9e8afdc569 100644 --- a/src/test/run-make/no-duplicate-libs/foo.rs +++ b/src/test/run-make/no-duplicate-libs/foo.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(lang_items, no_std)] #![no_std] -#![feature(lang_items)] #![crate_type = "dylib"] extern crate libc; diff --git a/src/test/run-make/no-stack-check/Makefile b/src/test/run-make/no-stack-check/Makefile index 561056d719..5fce35e2be 100644 --- a/src/test/run-make/no-stack-check/Makefile +++ b/src/test/run-make/no-stack-check/Makefile @@ -1,6 +1,7 @@ -include ../tools.mk ifndef IS_WINDOWS +ifneq ($(UNAME),OpenBSD) all: $(RUSTC) -O --emit asm attr.rs ! grep -q morestack $(TMPDIR)/attr.s @@ -9,6 +10,10 @@ all: $(RUSTC) -O --emit asm -C no-stack-check flag.rs ! grep -q morestack $(TMPDIR)/flag.s else +# On OpenBSD, morestack isn't used as the segmented stacks are disabled +all: +endif +else # On Windows we use __chkstk and it only appears in functions with large allocations, # so this test wouldn't be reliable. all: diff --git a/src/test/run-make/pretty-expanded-hygiene/Makefile b/src/test/run-make/pretty-expanded-hygiene/Makefile index 1176344643..136d7643ad 100644 --- a/src/test/run-make/pretty-expanded-hygiene/Makefile +++ b/src/test/run-make/pretty-expanded-hygiene/Makefile @@ -3,7 +3,8 @@ REPLACEMENT := s/[0-9][0-9]*\#[0-9][0-9]*/$(shell date)/g all: - $(RUSTC) -o $(TMPDIR)/input.out --pretty expanded,hygiene input.rs + $(RUSTC) -o $(TMPDIR)/input.out -Z unstable-options \ + --pretty expanded,hygiene input.rs # the name/ctxt numbers are very internals-dependent and thus # change relatively frequently, and testing for their exact values diff --git a/src/test/run-make/pretty-expanded-hygiene/input.pp.rs b/src/test/run-make/pretty-expanded-hygiene/input.pp.rs index 6febe2ff7c..6aff4c9b3d 100755 --- a/src/test/run-make/pretty-expanded-hygiene/input.pp.rs +++ b/src/test/run-make/pretty-expanded-hygiene/input.pp.rs @@ -9,6 +9,7 @@ // except according to those terms. // minimal junk +#![feature(no_std)] #![no_std] diff --git a/src/test/run-make/pretty-expanded-hygiene/input.rs b/src/test/run-make/pretty-expanded-hygiene/input.rs index c31b67b804..a46fa12ac0 100755 --- a/src/test/run-make/pretty-expanded-hygiene/input.rs +++ b/src/test/run-make/pretty-expanded-hygiene/input.rs @@ -9,6 +9,7 @@ // except according to those terms. // minimal junk +#![feature(no_std)] #![no_std] macro_rules! foo { diff --git a/src/test/run-make/pretty-expanded/Makefile b/src/test/run-make/pretty-expanded/Makefile index dda441ae3d..7a8dc8d871 100644 --- a/src/test/run-make/pretty-expanded/Makefile +++ b/src/test/run-make/pretty-expanded/Makefile @@ -1,4 +1,5 @@ -include ../tools.mk all: - $(RUSTC) -o $(TMPDIR)/input.expanded.rs --pretty=expanded input.rs + $(RUSTC) -o $(TMPDIR)/input.expanded.rs -Z unstable-options \ + --pretty=expanded input.rs diff --git a/src/test/run-make/pretty-print-path-suffix/Makefile b/src/test/run-make/pretty-print-path-suffix/Makefile index f58a6527ac..9f0c3f5120 100644 --- a/src/test/run-make/pretty-print-path-suffix/Makefile +++ b/src/test/run-make/pretty-print-path-suffix/Makefile @@ -1,9 +1,9 @@ -include ../tools.mk all: - $(RUSTC) -o $(TMPDIR)/foo.out --pretty normal=foo input.rs - $(RUSTC) -o $(TMPDIR)/nest_foo.out --pretty normal=nest::foo input.rs - $(RUSTC) -o $(TMPDIR)/foo_method.out --pretty normal=foo_method input.rs + $(RUSTC) -o $(TMPDIR)/foo.out -Z unstable-options --pretty normal=foo input.rs + $(RUSTC) -o $(TMPDIR)/nest_foo.out -Z unstable-options --pretty normal=nest::foo input.rs + $(RUSTC) -o $(TMPDIR)/foo_method.out -Z unstable-options --pretty normal=foo_method input.rs diff -u $(TMPDIR)/foo.out foo.pp diff -u $(TMPDIR)/nest_foo.out nest_foo.pp diff -u $(TMPDIR)/foo_method.out foo_method.pp diff --git a/src/test/run-make/pretty-print-to-file/Makefile b/src/test/run-make/pretty-print-to-file/Makefile index 1c1242ada8..8909dee11f 100644 --- a/src/test/run-make/pretty-print-to-file/Makefile +++ b/src/test/run-make/pretty-print-to-file/Makefile @@ -1,5 +1,5 @@ -include ../tools.mk all: - $(RUSTC) -o $(TMPDIR)/input.out --pretty=normal input.rs + $(RUSTC) -o $(TMPDIR)/input.out --pretty=normal -Z unstable-options input.rs diff -u $(TMPDIR)/input.out input.pp diff --git a/src/test/run-make/rustdoc-assoc-types/Makefile b/src/test/run-make/rustdoc-assoc-types/Makefile new file mode 100644 index 0000000000..74fca83f5f --- /dev/null +++ b/src/test/run-make/rustdoc-assoc-types/Makefile @@ -0,0 +1,5 @@ +-include ../tools.mk + +all: lib.rs + $(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc lib.rs + $(HTMLDOCCK) $(TMPDIR)/doc lib.rs diff --git a/src/test/run-make/rustdoc-assoc-types/lib.rs b/src/test/run-make/rustdoc-assoc-types/lib.rs new file mode 100644 index 0000000000..3e6e0ad560 --- /dev/null +++ b/src/test/run-make/rustdoc-assoc-types/lib.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] + +// @has lib/trait.Index.html +pub trait Index { + // @has - '//*[@id="associatedtype.Output"]//code' 'type Output: ?Sized' + type Output: ?Sized; + // @has - '//*[@id="tymethod.index"]//code' \ + // "fn index<'a>(&'a self, index: I) -> &'a Self::Output" + fn index<'a>(&'a self, index: I) -> &'a Self::Output; +} diff --git a/src/test/run-make/rustdoc-extern-method/Makefile b/src/test/run-make/rustdoc-extern-method/Makefile new file mode 100644 index 0000000000..c87684f59e --- /dev/null +++ b/src/test/run-make/rustdoc-extern-method/Makefile @@ -0,0 +1,8 @@ +-include ../tools.mk + +all: foo.rs bar.rs + $(HOST_RPATH_ENV) $(RUSTC) foo.rs + $(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs + $(HOST_RPATH_ENV) $(RUSTDOC) -L $(TMPDIR) -w html -o $(TMPDIR)/doc bar.rs + $(HTMLDOCCK) $(TMPDIR)/doc bar.rs + diff --git a/src/test/run-make/rustdoc-extern-method/bar.rs b/src/test/run-make/rustdoc-extern-method/bar.rs new file mode 100644 index 0000000000..672090c13a --- /dev/null +++ b/src/test/run-make/rustdoc-extern-method/bar.rs @@ -0,0 +1,24 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate foo; + +// @has bar/trait.Foo.html //pre "pub trait Foo" +// @has - '//*[@id="tymethod.foo"]//code' 'extern "rust-call" fn foo' +// @has - '//*[@id="tymethod.foo_"]//code' 'extern "rust-call" fn foo_' +pub use foo::Foo; + +// @has bar/trait.Bar.html //pre "pub trait Bar" +pub trait Bar { + // @has - '//*[@id="tymethod.bar"]//code' 'extern "rust-call" fn bar' + extern "rust-call" fn bar(&self, _: ()); + // @has - '//*[@id="method.bar_"]//code' 'extern "rust-call" fn bar_' + extern "rust-call" fn bar_(&self, _: ()) { } +} diff --git a/src/test/run-make/rustdoc-extern-method/foo.rs b/src/test/run-make/rustdoc-extern-method/foo.rs new file mode 100644 index 0000000000..fc5f03e8bd --- /dev/null +++ b/src/test/run-make/rustdoc-extern-method/foo.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] + +pub trait Foo { + extern "rust-call" fn foo(&self, _: ()) -> i32; + extern "rust-call" fn foo_(&self, _: ()) -> i32 { 0 } +} diff --git a/src/test/run-make/rustdoc-ffi/Makefile b/src/test/run-make/rustdoc-ffi/Makefile new file mode 100644 index 0000000000..c312efe12f --- /dev/null +++ b/src/test/run-make/rustdoc-ffi/Makefile @@ -0,0 +1,8 @@ +-include ../tools.mk + +all: lib.rs + $(HOST_RPATH_ENV) $(RUSTC) lib.rs + $(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc lib.rs + $(HOST_RPATH_ENV) $(RUSTDOC) -L $(TMPDIR) -w html -o $(TMPDIR)/doc user.rs + $(HTMLDOCCK) $(TMPDIR)/doc lib.rs + $(HTMLDOCCK) $(TMPDIR)/doc user.rs diff --git a/src/test/run-make/rustdoc-ffi/lib.rs b/src/test/run-make/rustdoc-ffi/lib.rs new file mode 100644 index 0000000000..e06dbe76db --- /dev/null +++ b/src/test/run-make/rustdoc-ffi/lib.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] + +extern "C" { + // @has lib/fn.foreigner.html //pre 'pub unsafe fn foreigner(cold_as_ice: u32)' + pub fn foreigner(cold_as_ice: u32); +} diff --git a/src/test/run-make/rustdoc-ffi/user.rs b/src/test/run-make/rustdoc-ffi/user.rs new file mode 100644 index 0000000000..09d7a7c536 --- /dev/null +++ b/src/test/run-make/rustdoc-ffi/user.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] + +extern crate lib; + +// @has user/fn.foreigner.html //pre 'pub unsafe fn foreigner(cold_as_ice: u32)' +pub use lib::foreigner; diff --git a/src/test/run-make/rustdoc-hidden-line/Makefile b/src/test/run-make/rustdoc-hidden-line/Makefile index bc7e4e5863..3ac7b6d2fa 100644 --- a/src/test/run-make/rustdoc-hidden-line/Makefile +++ b/src/test/run-make/rustdoc-hidden-line/Makefile @@ -7,8 +7,7 @@ all: @echo $(RUSTDOC) $(HOST_RPATH_ENV) $(RUSTDOC) --test foo.rs $(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs - cp verify.sh $(TMPDIR) - $(call RUN,verify.sh) $(TMPDIR) + $(HTMLDOCCK) $(TMPDIR)/doc foo.rs else all: diff --git a/src/test/run-make/rustdoc-hidden-line/foo.rs b/src/test/run-make/rustdoc-hidden-line/foo.rs index 78dcaebda4..3906d9ee8a 100644 --- a/src/test/run-make/rustdoc-hidden-line/foo.rs +++ b/src/test/run-make/rustdoc-hidden-line/foo.rs @@ -30,3 +30,6 @@ /// } /// ``` pub fn foo() {} + +// @!has foo/fn.foo.html invisible +// @matches - //pre "#\[derive\(PartialEq\)\] // Bar" diff --git a/src/test/run-make/rustdoc-hidden-line/verify.sh b/src/test/run-make/rustdoc-hidden-line/verify.sh deleted file mode 100755 index 9f28b55b13..0000000000 --- a/src/test/run-make/rustdoc-hidden-line/verify.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -file="$1/doc/foo/fn.foo.html" - -grep -v 'invisible' $file && -grep '#.*\[.*derive.*(.*Eq.*).*\].*//.*Bar' $file - -exit $? diff --git a/src/test/run-make/rustdoc-json/foo.rs b/src/test/run-make/rustdoc-json/foo.rs index d57a7164cd..3bd56c1419 100644 --- a/src/test/run-make/rustdoc-json/foo.rs +++ b/src/test/run-make/rustdoc-json/foo.rs @@ -21,5 +21,5 @@ pub mod bar { } /// *wow* - pub trait Doge { } + pub trait Doge { fn dummy(&self) { } } } diff --git a/src/test/run-make/rustdoc-must-use/Makefile b/src/test/run-make/rustdoc-must-use/Makefile new file mode 100644 index 0000000000..74fca83f5f --- /dev/null +++ b/src/test/run-make/rustdoc-must-use/Makefile @@ -0,0 +1,5 @@ +-include ../tools.mk + +all: lib.rs + $(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc lib.rs + $(HTMLDOCCK) $(TMPDIR)/doc lib.rs diff --git a/src/test/run-make/rustdoc-must-use/lib.rs b/src/test/run-make/rustdoc-must-use/lib.rs new file mode 100644 index 0000000000..cef79d4536 --- /dev/null +++ b/src/test/run-make/rustdoc-must-use/lib.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] + +// @has lib/struct.Struct.html //pre '#[must_use]' +#[must_use] +pub struct Struct { + field: i32, +} + +// @has lib/enum.Enum.html //pre '#[must_use = "message"]' +#[must_use = "message"] +pub enum Enum { + Variant(i32), +} diff --git a/src/test/run-make/rustdoc-negative-impl/Makefile b/src/test/run-make/rustdoc-negative-impl/Makefile new file mode 100644 index 0000000000..1316ee256e --- /dev/null +++ b/src/test/run-make/rustdoc-negative-impl/Makefile @@ -0,0 +1,6 @@ +-include ../tools.mk + +all: foo.rs + $(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs + $(HTMLDOCCK) $(TMPDIR)/doc foo.rs + diff --git a/src/test/run-make/rustdoc-negative-impl/foo.rs b/src/test/run-make/rustdoc-negative-impl/foo.rs new file mode 100644 index 0000000000..6c56bcc9be --- /dev/null +++ b/src/test/run-make/rustdoc-negative-impl/foo.rs @@ -0,0 +1,22 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(optin_builtin_traits)] + +// @matches foo/struct.Alpha.html '//pre' "pub struct Alpha" +pub struct Alpha; +// @matches foo/struct.Bravo.html '//pre' "pub struct Bravo" +pub struct Bravo(B); + +// @matches foo/struct.Alpha.html '//*[@class="impl"]//code' "impl !Send for Alpha" +impl !Send for Alpha {} + +// @matches foo/struct.Bravo.html '//*[@class="impl"]//code' "impl !Send for Bravo" +impl !Send for Bravo {} diff --git a/src/test/run-make/rustdoc-search-index/Makefile b/src/test/run-make/rustdoc-search-index/Makefile index 1248f144a8..e7e8f0c35a 100644 --- a/src/test/run-make/rustdoc-search-index/Makefile +++ b/src/test/run-make/rustdoc-search-index/Makefile @@ -7,9 +7,7 @@ source=index.rs all: $(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc $(source) - cp $(source) $(TMPDIR) - cp verify.sh $(TMPDIR) - $(call RUN,verify.sh) $(TMPDIR) + $(HTMLDOCCK) $(TMPDIR)/doc $(source) else all: diff --git a/src/test/run-make/rustdoc-search-index/index.rs b/src/test/run-make/rustdoc-search-index/index.rs index 019d77f1b1..42469a21f2 100644 --- a/src/test/run-make/rustdoc-search-index/index.rs +++ b/src/test/run-make/rustdoc-search-index/index.rs @@ -10,20 +10,17 @@ #![crate_name = "rustdoc_test"] -// In: Foo +// @has search-index.js Foo pub use private::Foo; mod private { pub struct Foo; impl Foo { - // In: test_method - pub fn test_method() {} - // Out: priv_method - fn priv_method() {} + pub fn test_method() {} // @has - test_method + fn priv_method() {} // @!has - priv_method } pub trait PrivateTrait { - // Out: priv_method - fn trait_method() {} + fn trait_method(&self) {} // @!has - priv_method } } diff --git a/src/test/run-make/rustdoc-search-index/verify.sh b/src/test/run-make/rustdoc-search-index/verify.sh deleted file mode 100755 index af5033adf6..0000000000 --- a/src/test/run-make/rustdoc-search-index/verify.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -source="$1/index.rs" -index="$1/doc/search-index.js" - -if ! [ -e $index ] -then - echo "Could not find the search index (looked for $index)" - exit 1 -fi - -ins=$(grep -o 'In: .*' $source | sed 's/In: \(.*\)/\1/g') -outs=$(grep -o 'Out: .*' $source | sed 's/Out: \(.*\)/\1/g') - -for p in $ins -do - if ! grep -q $p $index - then - echo "'$p' was erroneously excluded from search index." - exit 1 - fi -done - -for p in $outs -do - if grep -q $p $index - then - echo "'$p' was erroneously included in search index." - exit 1 - fi -done - -exit 0 diff --git a/src/test/run-make/rustdoc-smoke/Makefile b/src/test/run-make/rustdoc-smoke/Makefile index de013ab28a..7a1ad761b3 100644 --- a/src/test/run-make/rustdoc-smoke/Makefile +++ b/src/test/run-make/rustdoc-smoke/Makefile @@ -1,5 +1,4 @@ -include ../tools.mk all: $(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs - cp verify.sh $(TMPDIR) - $(call RUN,verify.sh) $(TMPDIR) + $(HTMLDOCCK) $(TMPDIR)/doc foo.rs diff --git a/src/test/run-make/rustdoc-smoke/foo.rs b/src/test/run-make/rustdoc-smoke/foo.rs index 499bcaff4d..f6b73021be 100644 --- a/src/test/run-make/rustdoc-smoke/foo.rs +++ b/src/test/run-make/rustdoc-smoke/foo.rs @@ -8,22 +8,29 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// @has foo/index.html #![crate_name = "foo"] //! Very docs +// @has foo/bar/index.html pub mod bar { /// So correct + // @has foo/bar/baz/index.html pub mod baz { /// Much detail + // @has foo/bar/baz/fn.baz.html pub fn baz() { } } /// *wow* - pub trait Doge { } + // @has foo/bar/trait.Doge.html + pub trait Doge { fn dummy(&self) { } } + // @has foo/bar/struct.Foo.html pub struct Foo { x: int, y: uint } + // @has foo/bar/fn.prawns.html pub fn prawns((a, b): (int, uint), Foo { x, y }: Foo) { } } diff --git a/src/test/run-make/rustdoc-smoke/verify.sh b/src/test/run-make/rustdoc-smoke/verify.sh deleted file mode 100755 index 18f3939794..0000000000 --- a/src/test/run-make/rustdoc-smoke/verify.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# $1 is the TMPDIR - -dirs="doc doc/foo doc/foo/bar doc/foo/bar/baz doc/src doc/src/foo" - -for dir in $dirs; do if [ ! -d $1/$dir ]; then - echo "$1/$dir is not a directory!" - exit 1 -fi done - -files="doc/foo/index.html doc/foo/bar/index.html doc/foo/bar/baz/fn.baz.html doc/foo/bar/trait.Doge.html doc/src/foo/foo.rs.html" - -for file in $files; do if [ ! -f $1/$file ]; then - echo "$1/$file is not a file!" - exit 1 -fi done diff --git a/src/test/run-make/rustdoc-viewpath-self/Makefile b/src/test/run-make/rustdoc-viewpath-self/Makefile new file mode 100644 index 0000000000..1316ee256e --- /dev/null +++ b/src/test/run-make/rustdoc-viewpath-self/Makefile @@ -0,0 +1,6 @@ +-include ../tools.mk + +all: foo.rs + $(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs + $(HTMLDOCCK) $(TMPDIR)/doc foo.rs + diff --git a/src/test/run-make/rustdoc-viewpath-self/foo.rs b/src/test/run-make/rustdoc-viewpath-self/foo.rs new file mode 100644 index 0000000000..6fd47d84c3 --- /dev/null +++ b/src/test/run-make/rustdoc-viewpath-self/foo.rs @@ -0,0 +1,26 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod io { + pub trait Reader { fn dummy(&self) { } } +} + +pub enum Maybe { + Just(A), + Nothing +} + +// @has foo/prelude/index.html +pub mod prelude { + // @has foo/prelude/index.html '//code' 'pub use io::{self, Reader}' + #[doc(no_inline)] pub use io::{self, Reader}; + // @has foo/prelude/index.html '//code' 'pub use Maybe::{self, Just, Nothing}' + #[doc(no_inline)] pub use Maybe::{self, Just, Nothing}; +} diff --git a/src/test/run-make/rustdoc-where/Makefile b/src/test/run-make/rustdoc-where/Makefile index 864d594cf9..1316ee256e 100644 --- a/src/test/run-make/rustdoc-where/Makefile +++ b/src/test/run-make/rustdoc-where/Makefile @@ -1,6 +1,6 @@ -include ../tools.mk -all: verify.sh foo.rs +all: foo.rs $(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs - cp verify.sh $(TMPDIR) - $(call RUN,verify.sh) $(TMPDIR) + $(HTMLDOCCK) $(TMPDIR)/doc foo.rs + diff --git a/src/test/run-make/rustdoc-where/foo.rs b/src/test/run-make/rustdoc-where/foo.rs index 7e6df7f011..91a7e1c9fd 100644 --- a/src/test/run-make/rustdoc-where/foo.rs +++ b/src/test/run-make/rustdoc-where/foo.rs @@ -8,19 +8,35 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub trait MyTrait {} +pub trait MyTrait { fn dummy(&self) { } } -pub struct Alpha where A: MyTrait; -pub trait Bravo where B: MyTrait {} +// @has foo/struct.Alpha.html '//pre' "pub struct Alpha where A: MyTrait" +pub struct Alpha(A) where A: MyTrait; +// @has foo/trait.Bravo.html '//pre' "pub trait Bravo where B: MyTrait" +pub trait Bravo where B: MyTrait { fn get(&self, B: B); } +// @has foo/fn.charlie.html '//pre' "pub fn charlie() where C: MyTrait" pub fn charlie() where C: MyTrait {} -pub struct Delta; +pub struct Delta(D); + +// @has foo/struct.Delta.html '//*[@class="impl"]//code' \ +// "impl Delta where D: MyTrait" impl Delta where D: MyTrait { pub fn delta() {} } -pub struct Echo; +pub struct Echo(E); + +// @has foo/struct.Echo.html '//*[@class="impl"]//code' \ +// "impl MyTrait for Echo where E: MyTrait" +// @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//code' \ +// "impl MyTrait for Echo where E: MyTrait" impl MyTrait for Echo where E: MyTrait {} -pub enum Foxtrot {} +pub enum Foxtrot { Foxtrot1(F) } + +// @has foo/enum.Foxtrot.html '//*[@class="impl"]//code' \ +// "impl MyTrait for Foxtrot where F: MyTrait" +// @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//code' \ +// "impl MyTrait for Foxtrot where F: MyTrait" impl MyTrait for Foxtrot where F: MyTrait {} diff --git a/src/test/run-make/rustdoc-where/verify.sh b/src/test/run-make/rustdoc-where/verify.sh deleted file mode 100755 index 1d49823101..0000000000 --- a/src/test/run-make/rustdoc-where/verify.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -set -e - -# $1 is the TMPDIR -DOC=$1/doc/foo - -grep "Alpha.*where.*A:.*MyTrait" $DOC/struct.Alpha.html > /dev/null -echo "Alpha" -grep "Bravo.*where.*B:.*MyTrait" $DOC/trait.Bravo.html > /dev/null -echo "Bravo" -grep "charlie.*where.*C:.*MyTrait" $DOC/fn.charlie.html > /dev/null -echo "Charlie" -grep "impl.*Delta.*where.*D:.*MyTrait" $DOC/struct.Delta.html > /dev/null -echo "Delta" -grep "impl.*MyTrait.*for.*Echo.*where.*E:.*MyTrait" $DOC/struct.Echo.html > /dev/null -echo "Echo" -grep "impl.*MyTrait.*for.*Foxtrot.*where.*F:.*MyTrait" $DOC/enum.Foxtrot.html > /dev/null -echo "Foxtrot" - -# check "Implementors" section of MyTrait -grep "impl.*MyTrait.*for.*Echo.*where.*E:.*MyTrait" $DOC/trait.MyTrait.html > /dev/null -grep "impl.*MyTrait.*for.*Foxtrot.*where.*F:.*MyTrait" $DOC/trait.MyTrait.html > /dev/null -echo "Implementors OK" diff --git a/src/test/run-make/save-analysis/SameDir.rs b/src/test/run-make/save-analysis/SameDir.rs new file mode 100644 index 0000000000..fe70ac1ede --- /dev/null +++ b/src/test/run-make/save-analysis/SameDir.rs @@ -0,0 +1,15 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// sub-module in the same directory as the main crate file + +pub struct SameStruct { + pub name: String +} diff --git a/src/test/run-make/save-analysis/SameDir3.rs b/src/test/run-make/save-analysis/SameDir3.rs new file mode 100644 index 0000000000..315f900868 --- /dev/null +++ b/src/test/run-make/save-analysis/SameDir3.rs @@ -0,0 +1,13 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn hello(x: isize) { + println!("macro {} :-(", x); +} diff --git a/src/test/run-make/save-analysis/SubDir/mod.rs b/src/test/run-make/save-analysis/SubDir/mod.rs new file mode 100644 index 0000000000..23b7d8bbf0 --- /dev/null +++ b/src/test/run-make/save-analysis/SubDir/mod.rs @@ -0,0 +1,40 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// sub-module in a sub-directory + +use sub::sub2 as msalias; +use sub::sub2; +use std::old_io::stdio::println; + +static yy: usize = 25; + +mod sub { + pub mod sub2 { + use std::old_io::stdio::println; + pub mod sub3 { + use std::old_io::stdio::println; + pub fn hello() { + println("hello from module 3"); + } + } + pub fn hello() { + println("hello from a module"); + } + + pub struct nested_struct { + pub field2: u32, + } + } +} + +pub struct SubStruct { + pub name: String +} diff --git a/src/test/run-make/save-analysis/foo.rs b/src/test/run-make/save-analysis/foo.rs index c72d685b31..38381da367 100644 --- a/src/test/run-make/save-analysis/foo.rs +++ b/src/test/run-make/save-analysis/foo.rs @@ -1,4 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// 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. // @@ -8,53 +8,332 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![ crate_name = "test" ] +#![allow(unstable)] #![feature(box_syntax)] -struct Foo { - f: int +extern crate graphviz; +// A simple rust project + +extern crate "flate" as myflate; + +use std::collections::{HashMap,HashSet}; +use std::cell::RefCell; +use std::old_io::stdio::println; + + +use sub::sub2 as msalias; +use sub::sub2; +use sub::sub2::nested_struct as sub_struct; +use std::num::Float; +use std::num::cast; +use std::num::{from_int,from_i8,from_i32}; + +use std::mem::size_of; + +static uni: &'static str = "Les Miséééééééérables"; +static yy: usize = 25; + +static bob: Option<&'static [isize]> = None; + +// buglink test - see issue #1337. + +fn test_alias(i: Option<::Item>) { + let s = sub_struct{ field2: 45u32, }; + + // import tests + fn foo(x: &Float) {} + let _: Option = from_i32(45); + + let x = 42_usize; + + myflate::deflate_bytes(&[]); + + let x = (3, 4_usize); + let y = x.1; +} + +struct TupStruct(int, int, Box); + +fn test_tup_struct(x: TupStruct) -> int { + x.1 +} + +mod sub { + pub mod sub2 { + use std::old_io::stdio::println; + pub mod sub3 { + use std::old_io::stdio::println; + pub fn hello() { + println("hello from module 3"); + } + } + pub fn hello() { + println("hello from a module"); + } + + pub struct nested_struct { + pub field2: u32, + } + + pub enum nested_enum { + Nest2 = 2, + Nest3 = 3 + } + } +} + +pub mod SameDir; +pub mod SubDir; + +#[path = "SameDir3.rs"] +pub mod SameDir2; + +struct nofields; + +#[derive(Clone)] +struct some_fields { + field1: u32, +} + +type SF = some_fields; + +trait SuperTrait { + fn dummy(&self) { } +} + +trait SomeTrait: SuperTrait { + fn Method(&self, x: u32) -> u32; + + fn prov(&self, x: u32) -> u32 { + println(&x.to_string()); + 42 + } + fn provided_method(&self) -> u32 { + 42 + } +} + +trait SubTrait: SomeTrait { + fn stat2(x: &Self) -> u32 { + 32 + } +} + +impl SomeTrait for some_fields { + fn Method(&self, x: u32) -> u32 { + println(&x.to_string()); + self.field1 + } +} + +impl SuperTrait for some_fields { +} + +impl SubTrait for some_fields {} + +impl some_fields { + fn stat(x: u32) -> u32 { + println(&x.to_string()); + 42 + } + fn stat2(x: &some_fields) -> u32 { + 42 + } + + fn align_to(&mut self) { + } + + fn test(&mut self) { + self.align_to::(); + } } -impl Foo { - fn bar(&self) -> int { - println!("f is {}", self.f); - self.f +impl SuperTrait for nofields { +} +impl SomeTrait for nofields { + fn Method(&self, x: u32) -> u32 { + self.Method(x); + 43 + } + + fn provided_method(&self) -> u32 { + 21 } } -trait Tr { - fn tar(&self, x: Box) -> Foo; +impl SubTrait for nofields {} + +impl SuperTrait for (Box, Box) {} + +fn f_with_params(x: &T) { + x.Method(41); } -impl Tr for Foo { - fn tar(&self, x: Box) -> Foo { - Foo{ f: self.f + x.f } +type MyType = Box; + +enum SomeEnum<'a> { + Ints(isize, isize), + Floats(f64, f64), + Strings(&'a str, &'a str, &'a str), + MyTypes(MyType, MyType) +} + +#[derive(Copy)] +enum SomeOtherEnum { + SomeConst1, + SomeConst2, + SomeConst3 +} + +enum SomeStructEnum { + EnumStruct{a:isize, b:isize}, + EnumStruct2{f1:MyType, f2:MyType}, + EnumStruct3{f1:MyType, f2:MyType, f3:SomeEnum<'static>} +} + +fn matchSomeEnum(val: SomeEnum) { + match val { + SomeEnum::Ints(int1, int2) => { println(&(int1+int2).to_string()); } + SomeEnum::Floats(float1, float2) => { println(&(float2*float1).to_string()); } + SomeEnum::Strings(_, _, s3) => { println(s3); } + SomeEnum::MyTypes(mt1, mt2) => { + println(&(mt1.field1 - mt2.field1).to_string()); + } } } -trait Tr2 { - fn squid(&self, y: &Y, z: Self) -> Box; +fn matchSomeStructEnum(se: SomeStructEnum) { + match se { + SomeStructEnum::EnumStruct{a:a, ..} => println(&a.to_string()), + SomeStructEnum::EnumStruct2{f1:f1, f2:f_2} => println(&f_2.field1.to_string()), + SomeStructEnum::EnumStruct3{f1, ..} => println(&f1.field1.to_string()), + } } -impl Tr2 for Foo { - fn squid(&self, y: &Foo, z: Foo) -> Box { - box Foo { f: y.f + z.f + self.f } + +fn matchSomeStructEnum2(se: SomeStructEnum) { + use SomeStructEnum::*; + match se { + EnumStruct{a: ref aaa, ..} => println(&aaa.to_string()), + EnumStruct2{f1, f2: f2} => println(&f1.field1.to_string()), + EnumStruct3{f1, f3: SomeEnum::Ints(_, _), f2} => println(&f1.field1.to_string()), + _ => {}, } } -enum En { - Var1, - Var2, - Var3(int, int, Foo) +fn matchSomeOtherEnum(val: SomeOtherEnum) { + use SomeOtherEnum::{SomeConst2, SomeConst3}; + match val { + SomeOtherEnum::SomeConst1 => { println("I'm const1."); } + SomeConst2 | SomeConst3 => { println("I'm const2 or const3."); } + } } -fn main() { - let x = Foo { f: 237 }; - let _f = x.bar(); - let en = En::Var2; +fn hello((z, a) : (u32, String), ex: X) { + SameDir2::hello(43); + + println(&yy.to_string()); + let (x, y): (u32, u32) = (5, 3); + println(&x.to_string()); + println(&z.to_string()); + let x: u32 = x; + println(&x.to_string()); + let x = "hello"; + println(x); + + let x = 32.0f32; + let _ = (x + ((x * x) + 1.0).sqrt()).ln(); - let _ = match en { - En::Var1 => x.bar(), - En::Var2 => 34, - En::Var3(x, y, f) => f.bar() + let s: Box = box some_fields {field1: 43}; + let s2: Box = box some_fields {field1: 43}; + let s3 = box nofields; + + s.Method(43); + s3.Method(43); + s2.Method(43); + + ex.prov(43); + + let y: u32 = 56; + // static method on struct + let r = some_fields::stat(y); + // trait static method, calls override + let r = SubTrait::stat2(&*s2); + // trait static method, calls default + let r = SubTrait::stat2(&*s3); + + let s4 = s3 as Box; + s4.Method(43); + + s4.provided_method(); + s2.prov(45); + + let closure = |x: u32, s: &SomeTrait| { + s.Method(23); + return x + y; + }; + + let z = closure(10, &*s); +} + +pub struct blah { + used_link_args: RefCell<[&'static str; 0]>, +} + +fn main() { // foo + let s = box some_fields {field1: 43}; + hello((43, "a".to_string()), *s); + sub::sub2::hello(); + sub2::sub3::hello(); + + let h = sub2::sub3::hello; + h(); + + // utf8 chars + let ut = "Les Miséééééééérables"; + + // For some reason, this pattern of macro_rules foiled our generated code + // avoiding strategy. + macro_rules! variable_str(($name:expr) => ( + some_fields { + field1: $name, + } + )); + let vs = variable_str!(32); + + let mut candidates: RefCell> = RefCell::new(HashMap::new()); + let _ = blah { + used_link_args: RefCell::new([]), }; + let s1 = nofields; + let s2 = SF { field1: 55}; + let s3: some_fields = some_fields{ field1: 55}; + let s4: msalias::nested_struct = sub::sub2::nested_struct{ field2: 55}; + let s4: msalias::nested_struct = sub2::nested_struct{ field2: 55}; + println(&s2.field1.to_string()); + let s5: MyType = box some_fields{ field1: 55}; + let s = SameDir::SameStruct{name: "Bob".to_string()}; + let s = SubDir::SubStruct{name:"Bob".to_string()}; + let s6: SomeEnum = SomeEnum::MyTypes(box s2.clone(), s5); + let s7: SomeEnum = SomeEnum::Strings("one", "two", "three"); + matchSomeEnum(s6); + matchSomeEnum(s7); + let s8: SomeOtherEnum = SomeOtherEnum::SomeConst2; + matchSomeOtherEnum(s8); + let s9: SomeStructEnum = + SomeStructEnum::EnumStruct2{f1: box some_fields{field1:10}, f2: box s2}; + matchSomeStructEnum(s9); +} + +impl Iterator for nofields { + type Item = (usize, usize); + + fn next(&mut self) -> Option<(usize, usize)> { + panic!() + } + + fn size_hint(&self) -> (usize, Option) { + panic!() + } } diff --git a/src/test/run-make/simd-ffi/Makefile b/src/test/run-make/simd-ffi/Makefile new file mode 100644 index 0000000000..68a6a5fbfe --- /dev/null +++ b/src/test/run-make/simd-ffi/Makefile @@ -0,0 +1,33 @@ +-include ../tools.mk + +# construct a fairly exhaustive list of platforms that we +# support. These ones don't follow a pattern +TARGETS=arm-linux-androideabi arm-unknown-linux-gnueabihf arm-unknown-linux-gnueabi + +# these ones do, each OS lists the architectures it supports +LINUX=aarch64 i686 x86_64 mips mipsel +WINDOWS=i686 x86_64 +# fails with: failed to get iphonesimulator SDK path: no such file or directory +#IOS=i386 aarch64 armv7 +DARWIN=i686 x86_64 + +$(foreach arch,$(LINUX),$(eval TARGETS += $(arch)-unknown-linux-gnu)) +$(foreach arch,$(WINDOWS),$(eval TARGETS += $(arch)-pc-windows-gnu)) +#$(foreach arch,$(IOS),$(eval TARGETS += $(arch)-apple-ios)) +$(foreach arch,$(DARWIN),$(eval TARGETS += $(arch)-apple-darwin)) + +all: $(TARGETS) + +define MK_TARGETS +# compile the rust file to the given target, but only to asm and IR +# form, to avoid having to have an appropriate linker. +# +# we need some features because the integer SIMD instructions are not +# enabled by-default for i686 and ARM; these features will be invalid +# on some platforms, but LLVM just prints a warning so that's fine for +# now. +$(1): simd.rs + $$(RUSTC) --target=$(1) --emit=llvm-ir,asm simd.rs -C target-feature='+neon,+sse2' +endef + +$(foreach targetxxx,$(TARGETS),$(eval $(call MK_TARGETS,$(targetxxx)))) diff --git a/src/test/run-make/simd-ffi/simd.rs b/src/test/run-make/simd-ffi/simd.rs new file mode 100755 index 0000000000..f418d5d1fb --- /dev/null +++ b/src/test/run-make/simd-ffi/simd.rs @@ -0,0 +1,86 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// ensures that public symbols are not removed completely +#![crate_type = "lib"] +// we can compile to a variety of platforms, because we don't need +// cross-compiled standard libraries. +#![feature(no_std)] +#![no_std] + +#![feature(simd, simd_ffi, link_llvm_intrinsics, lang_items)] + + +#[repr(C)] +#[derive(Copy)] +#[simd] +pub struct f32x4(f32, f32, f32, f32); + + +extern { + #[link_name = "llvm.sqrt.v4f32"] + fn vsqrt(x: f32x4) -> f32x4; +} + +pub fn foo(x: f32x4) -> f32x4 { + unsafe {vsqrt(x)} +} + +#[repr(C)] +#[derive(Copy)] +#[simd] +pub struct i32x4(i32, i32, i32, i32); + + +extern { + // _mm_sll_epi32 + #[cfg(any(target_arch = "x86", + target_arch = "x86-64"))] + #[link_name = "llvm.x86.sse2.psll.d"] + fn integer(a: i32x4, b: i32x4) -> i32x4; + + // vmaxq_s32 + #[cfg(any(target_arch = "arm"))] + #[link_name = "llvm.arm.neon.vmaxs.v4i32"] + fn integer(a: i32x4, b: i32x4) -> i32x4; + // vmaxq_s32 + #[cfg(any(target_arch = "aarch64"))] + #[link_name = "llvm.aarch64.neon.maxs.v4i32"] + fn integer(a: i32x4, b: i32x4) -> i32x4; + + // just some substitute foreign symbol, not an LLVM intrinsic; so + // we still get type checking, but not as detailed as (ab)using + // LLVM. + #[cfg(not(any(target_arch = "x86", + target_arch = "x86-64", + target_arch = "arm", + target_arch = "aarch64")))] + fn integer(a: i32x4, b: i32x4) -> i32x4; +} + +pub fn bar(a: i32x4, b: i32x4) -> i32x4 { + unsafe {integer(a, b)} +} + +#[lang = "sized"] +pub trait Sized : PhantomFn {} + +#[lang = "copy"] +pub trait Copy : PhantomFn {} + +#[lang="phantom_fn"] +pub trait PhantomFn { } +impl PhantomFn for U { } + +mod core { + pub mod marker { + pub use Copy; + } +} diff --git a/src/test/run-make/static-unwinding/lib.rs b/src/test/run-make/static-unwinding/lib.rs index c3fa1a68e1..12c72d54c0 100644 --- a/src/test/run-make/static-unwinding/lib.rs +++ b/src/test/run-make/static-unwinding/lib.rs @@ -10,7 +10,7 @@ #![crate_type = "rlib"] -pub static mut statik: int = 0; +pub static mut statik: isize = 0; struct A; impl Drop for A { diff --git a/src/test/run-make/static-unwinding/main.rs b/src/test/run-make/static-unwinding/main.rs index bd88cb19aa..d325f54d36 100644 --- a/src/test/run-make/static-unwinding/main.rs +++ b/src/test/run-make/static-unwinding/main.rs @@ -10,9 +10,9 @@ extern crate lib; -use std::thread::Thread; +use std::thread; -static mut statik: int = 0; +static mut statik: isize = 0; struct A; impl Drop for A { @@ -22,10 +22,9 @@ impl Drop for A { } fn main() { - Thread::scoped(move|| { + thread::spawn(move|| { let _a = A; lib::callback(|| panic!()); - 1i }).join().err().unwrap(); unsafe { diff --git a/src/test/run-make/symbols-are-reasonable/Makefile b/src/test/run-make/symbols-are-reasonable/Makefile index 42a72f7ca3..89f610dee1 100644 --- a/src/test/run-make/symbols-are-reasonable/Makefile +++ b/src/test/run-make/symbols-are-reasonable/Makefile @@ -10,6 +10,6 @@ OUT=$(TMPDIR)/lib.s all: $(RUSTC) lib.rs --emit=asm --crate-type=staticlib # just check for symbol declarations with the names we're expecting. - grep 'str[0-9]\+:' $(OUT) - grep 'binary[0-9]\+:' $(OUT) - grep 'vtable[0-9]\+' $(OUT) + grep 'str[0-9][0-9]*:' $(OUT) + grep 'binary[0-9][0-9]*:' $(OUT) + grep 'vtable[0-9][0-9]*' $(OUT) diff --git a/src/test/run-make/symbols-are-reasonable/lib.rs b/src/test/run-make/symbols-are-reasonable/lib.rs index 7cfebb31b2..e1f36ecda5 100644 --- a/src/test/run-make/symbols-are-reasonable/lib.rs +++ b/src/test/run-make/symbols-are-reasonable/lib.rs @@ -11,10 +11,10 @@ pub static X: &'static str = "foobarbaz"; pub static Y: &'static [u8] = include_bytes!("lib.rs"); -trait Foo {} +trait Foo { fn dummy(&self) { } } impl Foo for uint {} pub fn dummy() { // force the vtable to be created - let _x = &1u as &Foo; + let _x = &1_usize as &Foo; } diff --git a/src/test/run-make/target-specs/Makefile b/src/test/run-make/target-specs/Makefile index a352bc3a8c..db2b253a6f 100644 --- a/src/test/run-make/target-specs/Makefile +++ b/src/test/run-make/target-specs/Makefile @@ -1,11 +1,11 @@ -include ../tools.mk all: $(RUSTC) foo.rs --target=my-awesome-platform.json --crate-type=lib --emit=asm - grep --quiet --invert-match morestack < $(TMPDIR)/foo.s + grep -q -v morestack < $(TMPDIR)/foo.s $(RUSTC) foo.rs --target=my-invalid-platform.json 2>&1 | grep --quiet "Error loading target specification" $(RUSTC) foo.rs --target=my-incomplete-platform.json 2>&1 | grep 'Field llvm-target' RUST_TARGET_PATH=. $(RUSTC) foo.rs --target=my-awesome-platform --crate-type=lib --emit=asm RUST_TARGET_PATH=. $(RUSTC) foo.rs --target=x86_64-unknown-linux-gnu --crate-type=lib --emit=asm # The built-in target *should* override the one we have here, and thus we # should have morestack - grep --quiet morestack < $(TMPDIR)/foo.s + grep -q morestack < $(TMPDIR)/foo.s diff --git a/src/test/run-make/target-specs/foo.rs b/src/test/run-make/target-specs/foo.rs index fd112034f4..acda8705b1 100644 --- a/src/test/run-make/target-specs/foo.rs +++ b/src/test/run-make/target-specs/foo.rs @@ -8,14 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(lang_items)] +#![feature(lang_items, no_std)] #![no_std] +#[lang="phantom_fn"] +trait PhantomFn { } +impl PhantomFn for U { } + #[lang="copy"] -trait Copy { } +trait Copy : PhantomFn { } #[lang="sized"] -trait Sized { } +trait Sized : PhantomFn { } #[lang="start"] fn start(_main: *const u8, _argc: int, _argv: *const *const u8) -> int { 0 } diff --git a/src/test/run-make/target-specs/my-awesome-platform.json b/src/test/run-make/target-specs/my-awesome-platform.json index f5f622bbcd..d7cf7131d7 100644 --- a/src/test/run-make/target-specs/my-awesome-platform.json +++ b/src/test/run-make/target-specs/my-awesome-platform.json @@ -2,7 +2,7 @@ "data-layout": "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32", "llvm-target": "i686-unknown-linux-gnu", "target-endian": "little", - "target-word-size": "32", + "target-pointer-width": "32", "arch": "x86", "os": "linux", "morestack": false diff --git a/src/test/run-make/target-specs/my-incomplete-platform.json b/src/test/run-make/target-specs/my-incomplete-platform.json index 5005a9ff83..053f2dd633 100644 --- a/src/test/run-make/target-specs/my-incomplete-platform.json +++ b/src/test/run-make/target-specs/my-incomplete-platform.json @@ -1,7 +1,7 @@ { "data-layout": "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32", "target-endian": "little", - "target-word-size": "32", + "target-pointer-width": "32", "arch": "x86", "os": "foo", "morestack": false diff --git a/src/test/run-make/target-specs/x86_64-unknown-linux-gnu.json b/src/test/run-make/target-specs/x86_64-unknown-linux-gnu.json index 5e0f0f40e6..688bbe46bf 100644 --- a/src/test/run-make/target-specs/x86_64-unknown-linux-gnu.json +++ b/src/test/run-make/target-specs/x86_64-unknown-linux-gnu.json @@ -3,7 +3,7 @@ "data-layout": "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128", "llvm-target": "x86_64-unknown-linux-gnu", "target-endian": "little", - "target-word-size": "64", + "target-pointer-width": "64", "arch": "x86_64", "os": "linux", "morestack": false diff --git a/src/test/run-make/test-shard-completeness/Makefile b/src/test/run-make/test-shard-completeness/Makefile deleted file mode 100644 index 16ab12a825..0000000000 --- a/src/test/run-make/test-shard-completeness/Makefile +++ /dev/null @@ -1,7 +0,0 @@ --include ../tools.mk - -all: - # Running all the shards should hit every test - $(RUSTC) --test main.rs - $(call RUN,main) --test-shard 1.2 | grep "test_1 ... ok" - $(call RUN,main) --test-shard 2.2 | grep "test_2 ... ok" diff --git a/src/test/run-make/tools.mk b/src/test/run-make/tools.mk index f502761881..23c422bc7a 100644 --- a/src/test/run-make/tools.mk +++ b/src/test/run-make/tools.mk @@ -5,8 +5,10 @@ HOST_RPATH_ENV = \ TARGET_RPATH_ENV = \ $(LD_LIB_PATH_ENVVAR)="$(TMPDIR):$(TARGET_RPATH_DIR):$($(LD_LIB_PATH_ENVVAR))" -RUSTC := $(HOST_RPATH_ENV) $(RUSTC) --out-dir $(TMPDIR) -L $(TMPDIR) +BARE_RUSTC := $(HOST_RPATH_ENV) $(RUSTC) +RUSTC := $(BARE_RUSTC) --out-dir $(TMPDIR) -L $(TMPDIR) CC := $(CC) -L $(TMPDIR) +HTMLDOCCK := $(PYTHON) $(S)/src/etc/htmldocck.py # This is the name of the binary we will generate and run; use this # e.g. for `$(CC) -o $(RUN_BINFILE)`. @@ -51,17 +53,21 @@ endif # Extra flags needed to compile a working executable with the standard library ifdef IS_WINDOWS - EXTRACFLAGS := + EXTRACFLAGS := -lws2_32 -luserenv else ifeq ($(shell uname),Darwin) else ifeq ($(shell uname),FreeBSD) EXTRACFLAGS := -lm -lpthread -lgcc_s +else +ifeq ($(shell uname),OpenBSD) + EXTRACFLAGS := -lm -lpthread else EXTRACFLAGS := -lm -lrt -ldl -lpthread endif endif endif +endif REMOVE_DYLIBS = rm $(TMPDIR)/$(call DYLIB_GLOB,$(1)) REMOVE_RLIBS = rm $(TMPDIR)/$(call RLIB_GLOB,$(1)) diff --git a/src/test/run-make/unicode-input/multiple_files.rs b/src/test/run-make/unicode-input/multiple_files.rs index 88d8f10e70..ce3e69918f 100644 --- a/src/test/run-make/unicode-input/multiple_files.rs +++ b/src/test/run-make/unicode-input/multiple_files.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::{char, os}; -use std::io::{File, Command}; +use std::{char, env}; +use std::old_io::{File, Command}; use std::rand::{thread_rng, Rng}; // creates unicode_input_multiple_files_{main,chars}.rs, where the @@ -33,9 +33,9 @@ fn random_char() -> char { } fn main() { - let args = os::args(); - let rustc = args[1].as_slice(); - let tmpdir = Path::new(args[2].as_slice()); + let args: Vec = env::args().collect(); + let rustc = &args[1]; + let tmpdir = Path::new(&args[2]); let main_file = tmpdir.join("unicode_input_multiple_files_main.rs"); { @@ -43,11 +43,11 @@ fn main() { .write_str("mod unicode_input_multiple_files_chars;"); } - for _ in range(0u, 100) { + for _ in 0..100 { { let randoms = tmpdir.join("unicode_input_multiple_files_chars.rs"); let mut w = File::create(&randoms).unwrap(); - for _ in range(0u, 30) { + for _ in 0..30 { let _ = w.write_char(random_char()); } } @@ -56,15 +56,15 @@ fn main() { // can't exec it directly let result = Command::new("sh") .arg("-c") - .arg(format!("{} {}", - rustc, - main_file.as_str() - .unwrap()).as_slice()) + .arg(&format!("{} {}", + rustc, + main_file.as_str() + .unwrap())) .output().unwrap(); - let err = String::from_utf8_lossy(result.error.as_slice()); + let err = String::from_utf8_lossy(&result.error); // positive test so that this test will be updated when the // compiler changes. - assert!(err.as_slice().contains("expected item, found")) + assert!(err.contains("expected item, found")) } } diff --git a/src/test/run-make/unicode-input/span_length.rs b/src/test/run-make/unicode-input/span_length.rs index ae63839945..ef6c799336 100644 --- a/src/test/run-make/unicode-input/span_length.rs +++ b/src/test/run-make/unicode-input/span_length.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::io::{File, Command}; +use std::old_io::{File, Command}; use std::iter::repeat; use std::rand::{thread_rng, Rng}; -use std::{char, os}; +use std::{char, env}; // creates a file with `fn main() { }` and checks the // compiler emits a span of the appropriate length (for the @@ -33,36 +33,68 @@ fn random_char() -> char { } fn main() { - let args = os::args(); - let rustc = args[1].as_slice(); - let tmpdir = Path::new(args[2].as_slice()); + let args: Vec = env::args().collect(); + let rustc = &args[1]; + let tmpdir = Path::new(&args[2]); let main_file = tmpdir.join("span_main.rs"); - for _ in range(0u, 100) { - let n = thread_rng().gen_range(3u, 20); + for _ in 0..100 { + let n = thread_rng().gen_range(3, 20); { let _ = write!(&mut File::create(&main_file).unwrap(), "#![feature(non_ascii_idents)] fn main() {{ {} }}", // random string of length n - range(0, n).map(|_| random_char()).collect::()); + (0..n).map(|_| random_char()).collect::()); } // rustc is passed to us with --out-dir and -L etc., so we // can't exec it directly let result = Command::new("sh") .arg("-c") - .arg(format!("{} {}", - rustc, - main_file.as_str() - .unwrap()).as_slice()) + .arg(&format!("{} {}", + rustc, + main_file.as_str() + .unwrap())) .output().unwrap(); - let err = String::from_utf8_lossy(result.error.as_slice()); + let err = String::from_utf8_lossy(&result.error); // the span should end the line (e.g no extra ~'s) let expected_span = format!("^{}\n", repeat("~").take(n - 1) .collect::()); - assert!(err.as_slice().contains(expected_span.as_slice())); + assert!(err.contains(&expected_span)); } + + // Test multi-column characters and tabs + { + let _ = write!(&mut File::create(&main_file).unwrap(), + r#"extern "路濫狼á́́" fn foo() {{}} extern "路濫狼á́" fn bar() {{}}"#); + } + + // Extra characters. Every line is preceded by `filename:lineno ` + let offset = main_file.as_str().unwrap().len() + 3; + + let result = Command::new("sh") + .arg("-c") + .arg(format!("{} {}", + rustc, + main_file.as_str() + .unwrap()).as_slice()) + .output().unwrap(); + + let err = String::from_utf8_lossy(result.error.as_slice()); + + // Test both the length of the snake and the leading spaces up to it + + // First snake is 8 ~s long, with 7 preceding spaces (excluding file name/line offset) + let expected_span = format!("\n{}^{}\n", + repeat(" ").take(offset + 7).collect::(), + repeat("~").take(8).collect::()); + assert!(err.contains(expected_span.as_slice())); + // Second snake is 8 ~s long, with 36 preceding spaces + let expected_span = format!("\n{}^{}\n", + repeat(" ").take(offset + 36).collect::(), + repeat("~").take(8).collect::()); + assert!(err.contains(expected_span.as_slice())); } diff --git a/src/test/run-make/use-extern-for-plugins/Makefile b/src/test/run-make/use-extern-for-plugins/Makefile new file mode 100644 index 0000000000..f8abc5019b --- /dev/null +++ b/src/test/run-make/use-extern-for-plugins/Makefile @@ -0,0 +1,18 @@ +-include ../tools.mk + +ifneq ($(findstring BSD,$(UNAME)),BSD) +HOST := $(shell $(RUSTC) -vV | grep 'host:' | sed 's/host: //') +ifeq ($(findstring i686,$(HOST)),i686) +TARGET := $(subst i686,x86_64,$(HOST)) +else +TARGET := $(subst x86_64,i686,$(HOST)) +endif + +all: + $(RUSTC) foo.rs -C extra-filename=-host + $(RUSTC) bar.rs -C extra-filename=-targ --target $(TARGET) + $(RUSTC) baz.rs --extern a=$(TMPDIR)/liba-targ.rlib --target $(TARGET) +else +# FreeBSD & OpenBSD support only x86_64 architecture for now +all: +endif diff --git a/src/test/run-make/use-extern-for-plugins/bar.rs b/src/test/run-make/use-extern-for-plugins/bar.rs new file mode 100644 index 0000000000..f279893b77 --- /dev/null +++ b/src/test/run-make/use-extern-for-plugins/bar.rs @@ -0,0 +1,19 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(no_std)] +#![no_std] +#![crate_type = "lib"] +#![crate_name = "a"] + +#[macro_export] +macro_rules! bar { + () => () +} diff --git a/src/test/run-make/use-extern-for-plugins/baz.rs b/src/test/run-make/use-extern-for-plugins/baz.rs new file mode 100644 index 0000000000..89d6c6bc58 --- /dev/null +++ b/src/test/run-make/use-extern-for-plugins/baz.rs @@ -0,0 +1,18 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(no_std)] +#![no_std] +#![crate_type = "lib"] + +#[macro_use] +extern crate a; + +bar!(); diff --git a/src/test/run-make/use-extern-for-plugins/foo.rs b/src/test/run-make/use-extern-for-plugins/foo.rs new file mode 100644 index 0000000000..554c0fe032 --- /dev/null +++ b/src/test/run-make/use-extern-for-plugins/foo.rs @@ -0,0 +1,19 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(no_std)] +#![no_std] +#![crate_type = "lib"] +#![crate_name = "a"] + +#[macro_export] +macro_rules! foo { + () => () +} diff --git a/src/test/run-pass-fulldeps/compiler-calls.rs b/src/test/run-pass-fulldeps/compiler-calls.rs new file mode 100644 index 0000000000..9e164522d7 --- /dev/null +++ b/src/test/run-pass-fulldeps/compiler-calls.rs @@ -0,0 +1,81 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that the CompilerCalls interface to the compiler works. + +// ignore-android + +#![feature(rustc_private)] +#![feature(core)] + +extern crate getopts; +extern crate rustc; +extern crate rustc_driver; +extern crate syntax; + +use rustc::session::Session; +use rustc::session::config::{self, Input}; +use rustc_driver::{driver, CompilerCalls, Compilation}; +use syntax::diagnostics; + + +struct TestCalls { + count: u32 +} + +impl<'a> CompilerCalls<'a> for TestCalls { + fn early_callback(&mut self, + _: &getopts::Matches, + _: &diagnostics::registry::Registry) + -> Compilation { + self.count *= 2; + Compilation::Continue + } + + fn late_callback(&mut self, + _: &getopts::Matches, + _: &Session, + _: &Input, + _: &Option, + _: &Option) + -> Compilation { + self.count *= 3; + Compilation::Stop + } + + fn some_input(&mut self, input: Input, input_path: Option) -> (Input, Option) { + self.count *= 5; + (input, input_path) + } + + fn no_input(&mut self, + _: &getopts::Matches, + _: &config::Options, + _: &Option, + _: &Option, + _: &diagnostics::registry::Registry) + -> Option<(Input, Option)> { + panic!("This shouldn't happen"); + } + + fn build_controller(&mut self, _: &Session) -> driver::CompileController<'a> { + panic!("This shouldn't be called"); + } +} + + +fn main() { + let mut tc = TestCalls { count: 1 }; + // we should never get use this filename, but lets make sure they are valid args. + let args = vec!["compiler-calls".to_string(), "foo.rs".to_string()]; + rustc_driver::run_compiler(args.as_slice(), &mut tc); + assert!(tc.count == 30); +} + diff --git a/src/test/run-pass-fulldeps/issue-16992.rs b/src/test/run-pass-fulldeps/issue-16992.rs index 563b839496..9e3ad8ee28 100644 --- a/src/test/run-pass-fulldeps/issue-16992.rs +++ b/src/test/run-pass-fulldeps/issue-16992.rs @@ -19,8 +19,8 @@ use syntax::ext::base::ExtCtxt; #[allow(dead_code)] fn foobar(cx: &mut ExtCtxt) { - quote_expr!(cx, 1i); - quote_expr!(cx, 2i); + quote_expr!(cx, 1); + quote_expr!(cx, 2); } fn main() { } diff --git a/src/test/run-pass-fulldeps/issue_16723_multiple_items_syntax_ext.rs b/src/test/run-pass-fulldeps/issue_16723_multiple_items_syntax_ext.rs index 11e7da7702..c1ffeb7c8e 100644 --- a/src/test/run-pass-fulldeps/issue_16723_multiple_items_syntax_ext.rs +++ b/src/test/run-pass-fulldeps/issue_16723_multiple_items_syntax_ext.rs @@ -9,11 +9,9 @@ // except according to those terms. // ignore-stage1 -// ignore-android // aux-build:issue_16723_multiple_items_syntax_ext.rs #![feature(plugin)] - -#[plugin] #[no_link] extern crate issue_16723_multiple_items_syntax_ext; +#![plugin(issue_16723_multiple_items_syntax_ext)] multiple_items!(); diff --git a/src/test/run-pass-fulldeps/lint-group-plugin.rs b/src/test/run-pass-fulldeps/lint-group-plugin.rs index 7615b25f9e..1a639cdb9d 100644 --- a/src/test/run-pass-fulldeps/lint-group-plugin.rs +++ b/src/test/run-pass-fulldeps/lint-group-plugin.rs @@ -13,9 +13,7 @@ // ignore-pretty #![feature(plugin)] - -#[plugin] #[no_link] -extern crate lint_group_plugin_test; +#![plugin(lint_group_plugin_test)] fn lintme() { } //~ WARNING item is named 'lintme' fn pleaselintme() { } //~ WARNING item is named 'pleaselintme' diff --git a/src/test/run-pass-fulldeps/lint-plugin-cmdline-allow.rs b/src/test/run-pass-fulldeps/lint-plugin-cmdline-allow.rs index 7144d2b0f1..204312064b 100644 --- a/src/test/run-pass-fulldeps/lint-plugin-cmdline-allow.rs +++ b/src/test/run-pass-fulldeps/lint-plugin-cmdline-allow.rs @@ -13,9 +13,7 @@ // compile-flags: -A test-lint #![feature(plugin)] - -#[plugin] #[no_link] -extern crate lint_plugin_test; +#![plugin(lint_plugin_test)] fn lintme() { } diff --git a/src/test/run-pass-fulldeps/lint-plugin.rs b/src/test/run-pass-fulldeps/lint-plugin.rs index d11242f4fe..8311e188f9 100644 --- a/src/test/run-pass-fulldeps/lint-plugin.rs +++ b/src/test/run-pass-fulldeps/lint-plugin.rs @@ -13,9 +13,7 @@ // ignore-pretty #![feature(plugin)] - -#[plugin] #[no_link] -extern crate lint_plugin_test; +#![plugin(lint_plugin_test)] fn lintme() { } //~ WARNING item is named 'lintme' diff --git a/src/test/run-pass-fulldeps/macro-crate-does-hygiene-work.rs b/src/test/run-pass-fulldeps/macro-crate-does-hygiene-work.rs index a8762234ad..8ed47fe1f6 100644 --- a/src/test/run-pass-fulldeps/macro-crate-does-hygiene-work.rs +++ b/src/test/run-pass-fulldeps/macro-crate-does-hygiene-work.rs @@ -15,14 +15,12 @@ // uses `quote_expr!` to rearrange it should be hygiene-preserving. #![feature(plugin)] - -#[plugin] #[no_link] -extern crate macro_crate_test; +#![plugin(macro_crate_test)] fn main() { - let x = 3i; + let x = 3; assert_eq!(3, identity!(x)); assert_eq!(6, identity!(x+x)); - let x = 4i; + let x = 4; assert_eq!(4, identity!(x)); } diff --git a/src/test/run-pass-fulldeps/macro-crate-outlive-expansion-phase.rs b/src/test/run-pass-fulldeps/macro-crate-outlive-expansion-phase.rs index d943cf0457..9573d0c8c4 100644 --- a/src/test/run-pass-fulldeps/macro-crate-outlive-expansion-phase.rs +++ b/src/test/run-pass-fulldeps/macro-crate-outlive-expansion-phase.rs @@ -12,8 +12,6 @@ // ignore-stage1 #![feature(plugin)] - -#[plugin] #[no_link] -extern crate plugin_crate_outlive_expansion_phase; +#![plugin(plugin_crate_outlive_expansion_phase)] pub fn main() {} diff --git a/src/test/run-pass-fulldeps/macro-crate.rs b/src/test/run-pass-fulldeps/macro-crate.rs index 4ffb8a3f74..58ccd79b71 100644 --- a/src/test/run-pass-fulldeps/macro-crate.rs +++ b/src/test/run-pass-fulldeps/macro-crate.rs @@ -1,4 +1,4 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -12,20 +12,45 @@ // ignore-stage1 #![feature(plugin)] +#![plugin(macro_crate_test)] -#[macro_use] #[plugin] #[no_link] +#[macro_use] #[no_link] extern crate macro_crate_test; #[into_foo] -#[derive(PartialEq, Clone, Show)] +#[derive(PartialEq, Clone, Debug)] fn foo() -> AFakeTypeThatHadBetterGoAway {} +#[into_multi_foo] +#[derive(PartialEq, Clone, Debug)] +fn foo() -> AnotherFakeTypeThatHadBetterGoAway {} + +trait Qux { + #[into_multi_foo] + fn bar(); +} + +impl Qux for i32 { + #[into_multi_foo] + fn bar() {} +} + +impl Qux for u8 {} + pub fn main() { assert_eq!(1, make_a_1!()); assert_eq!(2, exported_macro!()); assert_eq!(Foo::Bar, Foo::Bar); test(None::); + + assert_eq!(Foo2::Bar2, Foo2::Bar2); + test(None::); + + let x = 10i32; + assert_eq!(x.foo(), 42); + let x = 10u8; + assert_eq!(x.foo(), 0); } fn test(_: Option) {} diff --git a/src/test/run-pass-fulldeps/plugin-args-1.rs b/src/test/run-pass-fulldeps/plugin-args-1.rs index 5a91f603f9..4d4f9092bc 100644 --- a/src/test/run-pass-fulldeps/plugin-args-1.rs +++ b/src/test/run-pass-fulldeps/plugin-args-1.rs @@ -12,11 +12,8 @@ // ignore-stage1 #![feature(plugin)] - -#[no_link] -#[plugin] -extern crate plugin_args; +#![plugin(plugin_args)] fn main() { - assert_eq!(plugin_args!(), "#[plugin]"); + assert_eq!(plugin_args!(), ""); } diff --git a/src/test/run-pass-fulldeps/plugin-args-2.rs b/src/test/run-pass-fulldeps/plugin-args-2.rs index d0ac22a529..4da566aec4 100644 --- a/src/test/run-pass-fulldeps/plugin-args-2.rs +++ b/src/test/run-pass-fulldeps/plugin-args-2.rs @@ -12,11 +12,8 @@ // ignore-stage1 #![feature(plugin)] - -#[no_link] -#[plugin()] -extern crate plugin_args; +#![plugin(plugin_args())] fn main() { - assert_eq!(plugin_args!(), "#[plugin()]"); + assert_eq!(plugin_args!(), ""); } diff --git a/src/test/run-pass-fulldeps/plugin-args-3.rs b/src/test/run-pass-fulldeps/plugin-args-3.rs index 7cac8ac57e..0a064933ae 100644 --- a/src/test/run-pass-fulldeps/plugin-args-3.rs +++ b/src/test/run-pass-fulldeps/plugin-args-3.rs @@ -12,11 +12,8 @@ // ignore-stage1 #![feature(plugin)] - -#[no_link] -#[plugin(hello(there), how(are="you"))] -extern crate plugin_args; +#![plugin(plugin_args(hello(there), how(are="you")))] fn main() { - assert_eq!(plugin_args!(), "#[plugin(hello(there), how(are = \"you\"))]"); + assert_eq!(plugin_args!(), "hello(there), how(are = \"you\")"); } diff --git a/src/test/run-pass-fulldeps/plugin-lib-ok-in-plugin.rs b/src/test/run-pass-fulldeps/plugin-lib-ok-in-plugin.rs new file mode 100644 index 0000000000..c612ee7565 --- /dev/null +++ b/src/test/run-pass-fulldeps/plugin-lib-ok-in-plugin.rs @@ -0,0 +1,26 @@ +// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:macro_crate_test.rs +// aux-build:plugin_with_plugin_lib.rs +// ignore-stage1 +// ignore-cross-compile +// +// macro_crate_test will not compile on a cross-compiled target because +// libsyntax is not compiled for it. + +#![deny(plugin_as_library)] +#![feature(plugin)] +#![plugin(macro_crate_test)] +#![plugin(plugin_with_plugin_lib)] + +fn main() { + assert_eq!(1, make_a_1!()); +} diff --git a/src/test/run-pass-fulldeps/plugin-link-does-resolve.rs b/src/test/run-pass-fulldeps/plugin-plus-extern-crate.rs similarity index 85% rename from src/test/run-pass-fulldeps/plugin-link-does-resolve.rs rename to src/test/run-pass-fulldeps/plugin-plus-extern-crate.rs index 518d02e3d7..d1ce83f267 100644 --- a/src/test/run-pass-fulldeps/plugin-link-does-resolve.rs +++ b/src/test/run-pass-fulldeps/plugin-plus-extern-crate.rs @@ -1,4 +1,4 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -15,9 +15,10 @@ // macro_crate_test will not compile on a cross-compiled target because // libsyntax is not compiled for it. +#![allow(plugin_as_library)] #![feature(plugin)] +#![plugin(macro_crate_test)] -#[plugin] extern crate macro_crate_test; fn main() { diff --git a/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs b/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs index 2d5bbd43e8..848ea738ed 100644 --- a/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs +++ b/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs @@ -19,7 +19,7 @@ extern crate syntax; use syntax::ext::base::ExtCtxt; fn test(cx: &mut ExtCtxt) { - let foo = 10i; + let foo = 10; let _e = quote_expr!(cx, $foo); } diff --git a/src/test/run-pass-fulldeps/roman-numerals-macro.rs b/src/test/run-pass-fulldeps/roman-numerals-macro.rs index d76766094e..81f5c64962 100644 --- a/src/test/run-pass-fulldeps/roman-numerals-macro.rs +++ b/src/test/run-pass-fulldeps/roman-numerals-macro.rs @@ -12,9 +12,7 @@ // ignore-stage1 #![feature(plugin)] - -#[plugin] #[no_link] -extern crate roman_numerals; +#![plugin(roman_numerals)] pub fn main() { assert_eq!(rn!(MMXV), 2015); diff --git a/src/test/run-pass-fulldeps/syntax-extension-with-dll-deps.rs b/src/test/run-pass-fulldeps/syntax-extension-with-dll-deps.rs index 1c74c8ad08..b7570eb092 100644 --- a/src/test/run-pass-fulldeps/syntax-extension-with-dll-deps.rs +++ b/src/test/run-pass-fulldeps/syntax-extension-with-dll-deps.rs @@ -8,14 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:syntax-extension-with-dll-deps-1.rs -// aux-build:syntax-extension-with-dll-deps-2.rs +// aux-build:syntax_extension_with_dll_deps_1.rs +// aux-build:syntax_extension_with_dll_deps_2.rs // ignore-stage1 #![feature(plugin)] - -#[plugin] #[no_link] -extern crate "syntax-extension-with-dll-deps-2" as extension; +#![plugin(syntax_extension_with_dll_deps_2)] fn main() { foo!(); diff --git a/src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs b/src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs index 195055f12d..aecec44f6f 100644 --- a/src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs +++ b/src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs @@ -25,7 +25,7 @@ impl Drop for Foo { } -trait Trait {} +trait Trait { fn dummy(&self) { } } impl Trait for Foo {} pub fn main() { diff --git a/src/test/run-pass-valgrind/cleanup-stdin.rs b/src/test/run-pass-valgrind/cleanup-stdin.rs index 21160553f7..c16f1f4c84 100644 --- a/src/test/run-pass-valgrind/cleanup-stdin.rs +++ b/src/test/run-pass-valgrind/cleanup-stdin.rs @@ -9,5 +9,5 @@ // except according to those terms. fn main() { - let _ = std::io::stdin(); + let _ = std::old_io::stdin(); } diff --git a/src/test/run-pass-valgrind/dst-dtor-1.rs b/src/test/run-pass-valgrind/dst-dtor-1.rs index 47e2a18a99..c49a684de9 100644 --- a/src/test/run-pass-valgrind/dst-dtor-1.rs +++ b/src/test/run-pass-valgrind/dst-dtor-1.rs @@ -19,7 +19,7 @@ impl Drop for Foo { } } -trait Trait {} +trait Trait { fn dummy(&self) { } } impl Trait for Foo {} struct Fat { diff --git a/src/test/run-pass/alias-uninit-value.rs b/src/test/run-pass/alias-uninit-value.rs index fc8c04598e..b1bebf0b3e 100644 --- a/src/test/run-pass/alias-uninit-value.rs +++ b/src/test/run-pass/alias-uninit-value.rs @@ -17,7 +17,7 @@ enum sty { ty_nil, } struct RawT {struct_: sty, cname: Option, hash: uint} fn mk_raw_ty(st: sty, cname: Option) -> RawT { - return RawT {struct_: st, cname: cname, hash: 0u}; + return RawT {struct_: st, cname: cname, hash: 0_usize}; } pub fn main() { mk_raw_ty(sty::ty_nil, None::); } diff --git a/src/test/run-pass/arr_cycle.rs b/src/test/run-pass/arr_cycle.rs new file mode 100644 index 0000000000..80434f36b4 --- /dev/null +++ b/src/test/run-pass/arr_cycle.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::cell::Cell; + +#[derive(Show)] +struct B<'a> { + a: [Cell>>; 2] +} + +impl<'a> B<'a> { + fn new() -> B<'a> { + B { a: [Cell::new(None), Cell::new(None)] } + } +} + +fn f() { + let (b1, b2, b3); + b1 = B::new(); + b2 = B::new(); + b3 = B::new(); + b1.a[0].set(Some(&b2)); + b1.a[1].set(Some(&b3)); + b2.a[0].set(Some(&b2)); + b2.a[1].set(Some(&b3)); + b3.a[0].set(Some(&b1)); + b3.a[1].set(Some(&b2)); +} + +fn main() { + f(); +} diff --git a/src/test/run-pass/asm-in-out-operand.rs b/src/test/run-pass/asm-in-out-operand.rs index ce0fcad40e..3ac8e4d0ee 100644 --- a/src/test/run-pass/asm-in-out-operand.rs +++ b/src/test/run-pass/asm-in-out-operand.rs @@ -14,7 +14,7 @@ unsafe fn next_power_of_2(n: u32) -> u32 { let mut tmp = n; asm!("dec $0" : "+rm"(tmp) :: "cc"); - let mut shift = 1u; + let mut shift = 1_usize; while shift <= 16 { asm!( "shr %cl, $2 @@ -42,7 +42,7 @@ pub fn main() { "shl $2, $1 add $3, $1 mov $1, $0" - : "=r"(x), "+r"(y) : "i"(3u), "ir"(7u) : "cc" + : "=r"(x), "+r"(y) : "i"(3_usize), "ir"(7_usize) : "cc" ); } assert_eq!(x, 47); diff --git a/src/test/run-pass/asm-out-assign.rs b/src/test/run-pass/asm-out-assign.rs index f785390846..0f6fec133d 100644 --- a/src/test/run-pass/asm-out-assign.rs +++ b/src/test/run-pass/asm-out-assign.rs @@ -15,7 +15,7 @@ pub fn main() { let x: int; unsafe { // Treat the output as initialization. - asm!("mov $1, $0" : "=r"(x) : "r"(5u)); + asm!("mov $1, $0" : "=r"(x) : "r"(5_usize)); } assert_eq!(x, 5); diff --git a/src/test/run-pass/assert-eq-macro-success.rs b/src/test/run-pass/assert-eq-macro-success.rs index 089e1b8c5c..e55a2d39cb 100644 --- a/src/test/run-pass/assert-eq-macro-success.rs +++ b/src/test/run-pass/assert-eq-macro-success.rs @@ -11,11 +11,11 @@ #![allow(unknown_features)] #![feature(box_syntax)] -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct Point { x : int } pub fn main() { - assert_eq!(14i,14i); + assert_eq!(14,14); assert_eq!("abc".to_string(),"abc".to_string()); assert_eq!(box Point{x:34},box Point{x:34}); assert_eq!(&Point{x:34},&Point{x:34}); diff --git a/src/test/run-pass/assignability-trait.rs b/src/test/run-pass/assignability-trait.rs index b7e3480c07..57c5051160 100644 --- a/src/test/run-pass/assignability-trait.rs +++ b/src/test/run-pass/assignability-trait.rs @@ -47,7 +47,7 @@ pub fn main() { assert_eq!(length(x.clone()), x.len()); // Call a parameterized function, with type arguments that require // a borrow - assert_eq!(length::(x.as_slice()), x.len()); + assert_eq!(length::(&*x), x.len()); // Now try it with a type that *needs* to be borrowed let z = [0,1,2,3]; diff --git a/src/test/run-pass/associated-types-basic.rs b/src/test/run-pass/associated-types-basic.rs index 3314b61320..f5521f7da8 100644 --- a/src/test/run-pass/associated-types-basic.rs +++ b/src/test/run-pass/associated-types-basic.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Foo { +use std::marker::MarkerTrait; + +trait Foo : MarkerTrait { type T; } diff --git a/src/test/run-pass/associated-types-binding-in-trait.rs b/src/test/run-pass/associated-types-binding-in-trait.rs new file mode 100644 index 0000000000..b47b0109bd --- /dev/null +++ b/src/test/run-pass/associated-types-binding-in-trait.rs @@ -0,0 +1,44 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test a case where the associated type binding (to `bool`, in this +// case) is derived from the trait definition. Issue #21636. + +use std::vec; + +pub trait BitIter { + type Iter: Iterator; + fn bit_iter(self) -> ::Iter; +} + +impl BitIter for Vec { + type Iter = vec::IntoIter; + fn bit_iter(self) -> ::Iter { + self.into_iter() + } +} + +fn count(arg: T) -> usize + where T: BitIter +{ + let mut sum = 0; + for i in arg.bit_iter() { + if i { + sum += 1; + } + } + sum +} + +fn main() { + let v = vec![true, false, true]; + let c = count(v); + assert_eq!(c, 2); +} diff --git a/src/test/run-pass/associated-types-binding-in-where-clause.rs b/src/test/run-pass/associated-types-binding-in-where-clause.rs index caf7d31a5f..2f9a0b328b 100644 --- a/src/test/run-pass/associated-types-binding-in-where-clause.rs +++ b/src/test/run-pass/associated-types-binding-in-where-clause.rs @@ -37,7 +37,7 @@ fn foo_uint>(x: I) -> uint { } pub fn main() { - let a = 42i; + let a = 42; foo_uint(a); let a = 'a'; diff --git a/src/test/run-pass/associated-types-bound.rs b/src/test/run-pass/associated-types-bound.rs index c34a19e1d8..9f97d69ce3 100644 --- a/src/test/run-pass/associated-types-bound.rs +++ b/src/test/run-pass/associated-types-bound.rs @@ -8,44 +8,44 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Test equality constraints on associated types in a where clause. +// Test equality constrai32s on associated types in a where clause. -pub trait ToInt { - fn to_int(&self) -> int; +pub trait ToI32 { + fn to_i32(&self) -> i32; } -impl ToInt for int { - fn to_int(&self) -> int { *self } +impl ToI32 for i32 { + fn to_i32(&self) -> i32 { *self } } -impl ToInt for uint { - fn to_int(&self) -> int { *self as int } +impl ToI32 for u32 { + fn to_i32(&self) -> i32 { *self as i32 } } -pub trait GetToInt +pub trait GetToI32 { - type R : ToInt; + type R : ToI32; - fn get(&self) -> ::R; + fn get(&self) -> ::R; } -impl GetToInt for int { - type R = int; - fn get(&self) -> int { *self } +impl GetToI32 for i32 { + type R = i32; + fn get(&self) -> i32 { *self } } -impl GetToInt for uint { - type R = uint; - fn get(&self) -> uint { *self } +impl GetToI32 for u32 { + type R = u32; + fn get(&self) -> u32 { *self } } -fn foo(g: G) -> int - where G : GetToInt +fn foo(g: G) -> i32 + where G : GetToI32 { - ToInt::to_int(&g.get()) + ToI32::to_i32(&g.get()) } pub fn main() { - assert_eq!(foo(22i), 22i); - assert_eq!(foo(22u), 22i); + assert_eq!(foo(22i32), 22); + assert_eq!(foo(22u32), 22); } diff --git a/src/test/run-pass/associated-types-cc.rs b/src/test/run-pass/associated-types-cc.rs index 58aa351ba9..948192f4fc 100644 --- a/src/test/run-pass/associated-types-cc.rs +++ b/src/test/run-pass/associated-types-cc.rs @@ -22,5 +22,5 @@ fn foo(b: B) -> ::T { } fn main() { - println!("{}", foo(3i)); + println!("{}", foo(3)); } diff --git a/src/test/run-pass/associated-types-conditional-dispatch.rs b/src/test/run-pass/associated-types-conditional-dispatch.rs index 6d59161ff9..aa65b0ed10 100644 --- a/src/test/run-pass/associated-types-conditional-dispatch.rs +++ b/src/test/run-pass/associated-types-conditional-dispatch.rs @@ -14,6 +14,7 @@ // `Target=[A]`, then the impl marked with `(*)` is seen to conflict // with all the others. +use std::marker::PhantomData; use std::ops::Deref; pub trait MyEq { @@ -36,12 +37,13 @@ impl<'a, A, B, Lhs> MyEq<[B; 0]> for Lhs where A: MyEq, Lhs: Deref { fn eq(&self, other: &[B; 0]) -> bool { - MyEq::eq(&**self, other.as_slice()) + MyEq::eq(&**self, other) } } struct DerefWithHelper { - pub helper: H + pub helper: H, + pub marker: PhantomData, } trait Helper { @@ -63,7 +65,8 @@ impl> Deref for DerefWithHelper { } pub fn check(x: T, y: T) -> bool { - let d: DerefWithHelper, T> = DerefWithHelper { helper: Some(x) }; + let d: DerefWithHelper, T> = DerefWithHelper { helper: Some(x), + marker: PhantomData }; d.eq(&y) } diff --git a/src/test/run-pass/associated-types-constant-type.rs b/src/test/run-pass/associated-types-constant-type.rs index 68b49af0d3..57e9230336 100644 --- a/src/test/run-pass/associated-types-constant-type.rs +++ b/src/test/run-pass/associated-types-constant-type.rs @@ -35,5 +35,5 @@ fn get(x: int) -> ::Opposite { fn main() { let x = get(22); - assert_eq!(22u, x); + assert_eq!(22_usize, x); } diff --git a/src/test/run-pass/associated-types-duplicate-binding-in-env-hrtb.rs b/src/test/run-pass/associated-types-duplicate-binding-in-env-hrtb.rs new file mode 100644 index 0000000000..8b7ea61dc7 --- /dev/null +++ b/src/test/run-pass/associated-types-duplicate-binding-in-env-hrtb.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Check that we do not report ambiguities when equivalent predicates +// (modulo bound lifetime names) appears in the environment +// twice. Issue #21965. + +fn foo(t: T) -> i32 + where T : for<'a> Fn(&'a u8) -> i32, + T : for<'b> Fn(&'b u8) -> i32, +{ + t(&3) +} + +fn main() { +} diff --git a/src/test/run-pass/associated-types-duplicate-binding-in-env.rs b/src/test/run-pass/associated-types-duplicate-binding-in-env.rs new file mode 100644 index 0000000000..62ac218795 --- /dev/null +++ b/src/test/run-pass/associated-types-duplicate-binding-in-env.rs @@ -0,0 +1,27 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Check that we do not report ambiguities when the same predicate +// appears in the environment twice. Issue #21965. + +trait Foo { + type B; + + fn get() -> Self::B; +} + +fn foo() -> () + where T : Foo, T : Foo +{ + ::get() +} + +fn main() { +} diff --git a/src/test/run-pass/associated-types-enum-field-named.rs b/src/test/run-pass/associated-types-enum-field-named.rs new file mode 100644 index 0000000000..a499aa6733 --- /dev/null +++ b/src/test/run-pass/associated-types-enum-field-named.rs @@ -0,0 +1,43 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test associated types appearing in struct-like enum variants. + +use self::VarValue::*; + +pub trait UnifyKey { + type Value; + fn to_index(&self) -> usize; +} + +pub enum VarValue { + Redirect { to: K }, + Root { value: K::Value, rank: usize }, +} + +fn get<'a,K:UnifyKey>,V>(table: &'a Vec>, key: &K) -> &'a Option { + match table[key.to_index()] { + VarValue::Redirect { to: ref k } => get(table, k), + VarValue::Root { value: ref v, rank: _ } => v, + } +} + +impl UnifyKey for usize { + type Value = Option; + fn to_index(&self) -> usize { *self } +} + +fn main() { + let table = vec![/* 0 */ Redirect { to: 1 }, + /* 1 */ Redirect { to: 3 }, + /* 2 */ Root { value: Some('x'), rank: 0 }, + /* 3 */ Redirect { to: 2 }]; + assert_eq!(get(&table, &0), &Some('x')); +} diff --git a/src/test/run-pass/associated-types-enum-field-numbered.rs b/src/test/run-pass/associated-types-enum-field-numbered.rs new file mode 100644 index 0000000000..e710c53327 --- /dev/null +++ b/src/test/run-pass/associated-types-enum-field-numbered.rs @@ -0,0 +1,43 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test associated types appearing in tuple-like enum variants. + +use self::VarValue::*; + +pub trait UnifyKey { + type Value; + fn to_index(&self) -> usize; +} + +pub enum VarValue { + Redirect(K), + Root(K::Value, usize), +} + +fn get<'a,K:UnifyKey>,V>(table: &'a Vec>, key: &K) -> &'a Option { + match table[key.to_index()] { + VarValue::Redirect(ref k) => get(table, k), + VarValue::Root(ref v, _) => v, + } +} + +impl UnifyKey for usize { + type Value = Option; + fn to_index(&self) -> usize { *self } +} + +fn main() { + let table = vec![/* 0 */ Redirect(1), + /* 1 */ Redirect(3), + /* 2 */ Root(Some('x'), 0), + /* 3 */ Redirect(2)]; + assert_eq!(get(&table, &0), &Some('x')); +} diff --git a/src/test/run-pass/associated-types-issue-20220.rs b/src/test/run-pass/associated-types-issue-20220.rs new file mode 100644 index 0000000000..a253fbde56 --- /dev/null +++ b/src/test/run-pass/associated-types-issue-20220.rs @@ -0,0 +1,36 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test references to `Self::Item` in the trait. Issue #20220. + +use std::vec; + +trait IntoIteratorX { + type Item; + type IntoIter: Iterator; + + fn into_iter_x(self) -> Self::IntoIter; +} + +impl IntoIteratorX for Vec { + type Item = T; + type IntoIter = vec::IntoIter; + + fn into_iter_x(self) -> vec::IntoIter { + self.into_iter() + } +} + +fn main() { + let vec = vec![1, 2, 3]; + for (i, e) in vec.into_iter().enumerate() { + assert_eq!(i+1, e); + } +} diff --git a/src/test/run-pass/associated-types-issue-20371.rs b/src/test/run-pass/associated-types-issue-20371.rs index d35b7331d4..40ef7f3531 100644 --- a/src/test/run-pass/associated-types-issue-20371.rs +++ b/src/test/run-pass/associated-types-issue-20371.rs @@ -11,6 +11,8 @@ // Test that we are able to have an impl that defines an associated type // before the actual trait. +use std::marker::MarkerTrait; + impl X for f64 { type Y = int; } -trait X {type Y; } +trait X : MarkerTrait { type Y; } fn main() {} diff --git a/src/test/run-pass/associated-types-issue-21212.rs b/src/test/run-pass/associated-types-issue-21212.rs new file mode 100644 index 0000000000..3c91577362 --- /dev/null +++ b/src/test/run-pass/associated-types-issue-21212.rs @@ -0,0 +1,29 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Regression test for #21212: an overflow occurred during trait +// checking where normalizing `Self::Input` led to normalizing the +// where clauses in the environment which in turn required normalizing +// `Self::Input`. + +pub trait Parser { + type Input; + + fn parse(input: ::Input) { + panic!() + } +} + +impl

(&self, n: uint, pred: P) -> SplitsN> where P: FnMut(&T) -> bool { + fn splitn2

(&self, n: u32, pred: P) -> SplitsN> where P: FnMut(&T) -> bool { SliceExt2::split2(self, pred); loop {} } diff --git a/src/test/run-pass/associated-types-normalize-in-bounds.rs b/src/test/run-pass/associated-types-normalize-in-bounds.rs index 742bab0578..94cfcb8365 100644 --- a/src/test/run-pass/associated-types-normalize-in-bounds.rs +++ b/src/test/run-pass/associated-types-normalize-in-bounds.rs @@ -11,15 +11,17 @@ // Test that we normalize associated types that appear in bounds; if // we didn't, the call to `self.split2()` fails to type check. -struct Splits<'a, T, P>; -struct SplitsN; +use std::marker::PhantomData; + +struct Splits<'a, T, P>(PhantomData<(&'a(),T,P)>); +struct SplitsN(PhantomData); trait SliceExt2 { type Item; fn split2<'a, P>(&'a self, pred: P) -> Splits<'a, Self::Item, P> where P: FnMut(&Self::Item) -> bool; - fn splitn2<'a, P>(&'a self, n: uint, pred: P) -> SplitsN> + fn splitn2<'a, P>(&'a self, n: usize, pred: P) -> SplitsN> where P: FnMut(&Self::Item) -> bool; } @@ -30,7 +32,7 @@ impl SliceExt2 for [T] { loop {} } - fn splitn2

(&self, n: uint, pred: P) -> SplitsN> where P: FnMut(&T) -> bool { + fn splitn2

(&self, n: usize, pred: P) -> SplitsN> where P: FnMut(&T) -> bool { self.split2(pred); loop {} } diff --git a/src/test/run-pass/associated-types-normalize-unifield-struct.rs b/src/test/run-pass/associated-types-normalize-unifield-struct.rs new file mode 100644 index 0000000000..2288e19aae --- /dev/null +++ b/src/test/run-pass/associated-types-normalize-unifield-struct.rs @@ -0,0 +1,34 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Regression test for issue #21010: Normalize associated types in +// various special paths in the `type_is_immediate` function. + + +pub trait OffsetState: Sized {} +pub trait Offset { + type State: OffsetState; + fn dummy(&self) { } +} + +#[derive(Copy)] pub struct X; +impl Offset for X { type State = Y; } + +#[derive(Copy)] pub struct Y; +impl OffsetState for Y {} + +pub fn now() -> DateTime { from_utc(Y) } + +pub struct DateTime { pub offset: Off::State } +pub fn from_utc(offset: Off::State) -> DateTime { DateTime { offset: offset } } + +pub fn main() { + let _x = now(); +} diff --git a/src/test/run-pass/associated-types-projection-from-known-type-in-impl.rs b/src/test/run-pass/associated-types-projection-from-known-type-in-impl.rs index 0a1a8589de..c65d2db9b0 100644 --- a/src/test/run-pass/associated-types-projection-from-known-type-in-impl.rs +++ b/src/test/run-pass/associated-types-projection-from-known-type-in-impl.rs @@ -13,6 +13,8 @@ trait Int { type T; + + fn dummy(&self) { } } trait NonZero diff --git a/src/test/run-pass/associated-types-projection-in-object-type.rs b/src/test/run-pass/associated-types-projection-in-object-type.rs new file mode 100644 index 0000000000..a9c34a605c --- /dev/null +++ b/src/test/run-pass/associated-types-projection-in-object-type.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Corrected regression test for #20831. The original did not compile. +// When fixed, it revealed another problem concerning projections that +// appear in associated type bindings in object types, which were not +// being properly flagged. + +use std::ops::{Shl, Shr}; +use std::cell::RefCell; + +pub trait Subscriber { + type Input; + + fn dummy(&self) { } +} + +pub trait Publisher<'a> { + type Output; + fn subscribe(&mut self, Box + 'a>); +} + +pub trait Processor<'a> : Subscriber + Publisher<'a> { } + +impl<'a, P> Processor<'a> for P where P : Subscriber + Publisher<'a> { } + +struct MyStruct<'a> { + sub: Box + 'a> +} + +impl<'a> Publisher<'a> for MyStruct<'a> { + type Output = u64; + fn subscribe(&mut self, t : Box + 'a>) { + self.sub = t; + } +} + +fn main() {} diff --git a/src/test/run-pass/associated-types-projection-in-supertrait.rs b/src/test/run-pass/associated-types-projection-in-supertrait.rs index e6fec675b0..4d2358fae2 100644 --- a/src/test/run-pass/associated-types-projection-in-supertrait.rs +++ b/src/test/run-pass/associated-types-projection-in-supertrait.rs @@ -14,6 +14,8 @@ trait A { type TA; + + fn dummy(&self) { } } trait B diff --git a/src/test/run-pass/associated-types-projection-in-where-clause.rs b/src/test/run-pass/associated-types-projection-in-where-clause.rs new file mode 100644 index 0000000000..3f3f4fbd1d --- /dev/null +++ b/src/test/run-pass/associated-types-projection-in-where-clause.rs @@ -0,0 +1,36 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test a where clause that uses a non-normalized projection type. + +trait Int +{ + type T; + + fn dummy(&self) { } +} + +trait NonZero +{ + fn non_zero(self) -> bool; +} + +fn foo,J>(t: I) -> bool + where ::T : NonZero + // ^~~~~~~~~~~~~ canonical form is just J +{ + bar::() +} + +fn bar() -> bool { true } + +fn main () +{ +} diff --git a/src/test/run-pass/associated-types-ref-in-struct-literal.rs b/src/test/run-pass/associated-types-ref-in-struct-literal.rs index b51d44a0c2..67fe11d8fe 100644 --- a/src/test/run-pass/associated-types-ref-in-struct-literal.rs +++ b/src/test/run-pass/associated-types-ref-in-struct-literal.rs @@ -12,6 +12,8 @@ pub trait Foo { type Bar; + + fn dummy(&self) { } } impl Foo for int { @@ -24,6 +26,6 @@ struct Thing { } fn main() { - let thing = Thing{a: 1i, b: 2i}; + let thing = Thing{a: 1, b: 2}; assert_eq!(thing.a + 1, thing.b); } diff --git a/src/test/run-pass/associated-types-resolve-lifetime.rs b/src/test/run-pass/associated-types-resolve-lifetime.rs index e7a8061a34..a4b0b1a6e0 100644 --- a/src/test/run-pass/associated-types-resolve-lifetime.rs +++ b/src/test/run-pass/associated-types-resolve-lifetime.rs @@ -15,6 +15,8 @@ trait Get { trait Trait<'a> { type T: 'static; type U: Get<&'a int>; + + fn dummy(&'a self) { } } fn main() {} diff --git a/src/test/run-pass/associated-types-return.rs b/src/test/run-pass/associated-types-return.rs index b9b6d14f8a..fe24ab6bbe 100644 --- a/src/test/run-pass/associated-types-return.rs +++ b/src/test/run-pass/associated-types-return.rs @@ -42,11 +42,11 @@ fn foo2(x: I) -> ::A { } pub fn main() { - let a = 42i; - assert!(foo2(a) == 42u); + let a = 42; + assert!(foo2(a) == 42_usize); let a = Bar; - assert!(foo2(a) == 43i); + assert!(foo2(a) == 43); let a = 'a'; foo1(a); diff --git a/src/test/run-pass/associated-types-stream.rs b/src/test/run-pass/associated-types-stream.rs new file mode 100644 index 0000000000..ef7fbe87b3 --- /dev/null +++ b/src/test/run-pass/associated-types-stream.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test references to the trait `Stream` in the bounds for associated +// types defined on `Stream`. Issue #20551. + +trait Stream { + type Car; + type Cdr: Stream; + + fn car(&self) -> Self::Car; + fn cdr(self) -> Self::Cdr; +} + +impl Stream for () { + type Car = (); + type Cdr = (); + fn car(&self) -> () { () } + fn cdr(self) -> () { self } +} + +impl Stream for (T, U) + where T : Clone, U : Stream +{ + type Car = T; + type Cdr = U; + fn car(&self) -> T { self.0.clone() } + fn cdr(self) -> U { self.1 } +} + +fn main() { + let p = (22, (44, (66, ()))); + assert_eq!(p.car(), 22); + + let p = p.cdr(); + assert_eq!(p.car(), 44); + + let p = p.cdr(); + assert_eq!(p.car(), 66); +} diff --git a/src/test/run-pass/associated-types-struct-field-named.rs b/src/test/run-pass/associated-types-struct-field-named.rs new file mode 100644 index 0000000000..8667f6c843 --- /dev/null +++ b/src/test/run-pass/associated-types-struct-field-named.rs @@ -0,0 +1,43 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we correctly normalize the type of a struct field +// which has an associated type. + +pub trait UnifyKey { + type Value; + + fn dummy(&self) { } +} + +pub struct Node { + pub key: K, + pub value: K::Value, +} + +fn foo>,V : Clone>(node: &Node) -> Option { + node.value.clone() +} + +impl UnifyKey for i32 { + type Value = Option; +} + +impl UnifyKey for u32 { + type Value = Option; +} + +pub fn main() { + let node: Node = Node { key: 1, value: Some(22) }; + assert_eq!(foo(&node), Some(22_u32)); + + let node: Node = Node { key: 1, value: Some(22) }; + assert_eq!(foo(&node), Some(22_i32)); +} diff --git a/src/test/run-pass/associated-types-struct-field-numbered.rs b/src/test/run-pass/associated-types-struct-field-numbered.rs new file mode 100644 index 0000000000..9503f78a71 --- /dev/null +++ b/src/test/run-pass/associated-types-struct-field-numbered.rs @@ -0,0 +1,40 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we correctly normalize the type of a struct field +// which has an associated type. + +pub trait UnifyKey { + type Value; + + fn dummy(&self) { } +} + +pub struct Node(K, K::Value); + +fn foo>,V : Clone>(node: &Node) -> Option { + node.1.clone() +} + +impl UnifyKey for i32 { + type Value = Option; +} + +impl UnifyKey for u32 { + type Value = Option; +} + +pub fn main() { + let node: Node = Node(1, Some(22)); + assert_eq!(foo(&node), Some(22_u32)); + + let node: Node = Node(1, Some(22)); + assert_eq!(foo(&node), Some(22_i32)); +} diff --git a/src/test/run-pass/associated-types-sugar-path.rs b/src/test/run-pass/associated-types-sugar-path.rs index 880554b61b..c068065ac6 100644 --- a/src/test/run-pass/associated-types-sugar-path.rs +++ b/src/test/run-pass/associated-types-sugar-path.rs @@ -31,8 +31,9 @@ pub fn bar(a: T, x: T::A) -> T::A { // Using a type via an impl. trait C { fn f(); + fn g(&self) { } } -struct B; +struct B(X); impl C for B { fn f() { let x: T::A = panic!(); @@ -40,5 +41,5 @@ impl C for B { } pub fn main() { - let z: uint = bar(2i, 4u); + let z: uint = bar(2, 4_usize); } diff --git a/src/test/run-pass/astconv-cycle-between-trait-and-type.rs b/src/test/run-pass/astconv-cycle-between-trait-and-type.rs new file mode 100644 index 0000000000..0c6d91eda2 --- /dev/null +++ b/src/test/run-pass/astconv-cycle-between-trait-and-type.rs @@ -0,0 +1,36 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we are able to successfully compile a setup where a trait +// (`Trait1`) references a struct (`SomeType`) which in turn +// carries a predicate that references the trait (`u32 : Trait1`, +// substituted). + +#![allow(dead_code)] + +trait Trait1 : Trait2> { + fn dumb(&self) { } +} + +trait Trait2 { + fn dumber(&self, _: A) { } +} + +struct SomeType + where A : Trait1 +{ + a: A +} + +impl Trait1 for u32 { } + +impl Trait2> for u32 { } + +fn main() { } diff --git a/src/test/run-pass/attr-before-view-item.rs b/src/test/run-pass/attr-before-view-item.rs index 2a65fd9d8a..951a716879 100644 --- a/src/test/run-pass/attr-before-view-item.rs +++ b/src/test/run-pass/attr-before-view-item.rs @@ -10,6 +10,8 @@ // error-pattern:expected item +#![feature(custom_attribute)] + #[foo = "bar"] extern crate test; diff --git a/src/test/run-pass/attr-before-view-item2.rs b/src/test/run-pass/attr-before-view-item2.rs index 5b8e62de6b..ad8ce608bd 100644 --- a/src/test/run-pass/attr-before-view-item2.rs +++ b/src/test/run-pass/attr-before-view-item2.rs @@ -10,6 +10,8 @@ // error-pattern:expected item +#![feature(custom_attribute)] + mod m { #[foo = "bar"] extern crate test; diff --git a/src/test/run-pass/attr-main-2.rs b/src/test/run-pass/attr-main-2.rs index 2f5e72491b..fd0ae0729a 100644 --- a/src/test/run-pass/attr-main-2.rs +++ b/src/test/run-pass/attr-main-2.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(main)] pub fn main() { panic!() diff --git a/src/test/run-pass/attr-main.rs b/src/test/run-pass/attr-main.rs index cf8940b4d5..29b504bed5 100644 --- a/src/test/run-pass/attr-main.rs +++ b/src/test/run-pass/attr-main.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(main)] #[main] fn foo() { diff --git a/src/test/run-pass/attr-mix-new.rs b/src/test/run-pass/attr-mix-new.rs index 55ca75b4b7..7980937ce2 100644 --- a/src/test/run-pass/attr-mix-new.rs +++ b/src/test/run-pass/attr-mix-new.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. #![allow(unused_attribute)] +#![feature(custom_attribute)] #[foo(bar)] mod foo { diff --git a/src/test/run-pass/attr-no-drop-flag-size.rs b/src/test/run-pass/attr-no-drop-flag-size.rs index b3fb162790..bd79991784 100644 --- a/src/test/run-pass/attr-no-drop-flag-size.rs +++ b/src/test/run-pass/attr-no-drop-flag-size.rs @@ -9,6 +9,7 @@ // except according to those terms. #![feature(unsafe_destructor)] +#![feature(unsafe_no_drop_flag)] use std::mem::size_of; diff --git a/src/test/run-pass/attr-start.rs b/src/test/run-pass/attr-start.rs index 3bea7e8480..2bf0940420 100644 --- a/src/test/run-pass/attr-start.rs +++ b/src/test/run-pass/attr-start.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(start)] #[start] fn start(_argc: int, _argv: *const *const u8) -> int { diff --git a/src/test/run-pass/attr.rs b/src/test/run-pass/attr.rs index 2f30eb8154..129d69b6e6 100644 --- a/src/test/run-pass/attr.rs +++ b/src/test/run-pass/attr.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(main)] + #[main] fn foo() { } diff --git a/src/test/run-pass/auto-encode.rs b/src/test/run-pass/auto-encode.rs index 9b030de998..7c126fc420 100644 --- a/src/test/run-pass/auto-encode.rs +++ b/src/test/run-pass/auto-encode.rs @@ -35,7 +35,7 @@ fn test_rbml<'a, 'b, A: let mut rbml_w = EBwriter::Encoder::new(&mut wr); a1.encode(&mut rbml_w); - let d: serialize::rbml::Doc<'a> = EBDoc::new(&wr[]); + let d: serialize::rbml::Doc<'a> = EBDoc::new(&wr); let mut decoder: EBReader::Decoder<'a> = EBreader::Decoder::new(d); let a2: A = Decodable::decode(&mut decoder); assert!(*a1 == a2); @@ -131,19 +131,19 @@ enum Quark { enum CLike { A, B, C } pub fn main() { - let a = &Plus(@Minus(@Val(3u), @Val(10u)), @Plus(@Val(22u), @Val(5u))); + let a = &Plus(@Minus(@Val(3_usize), @Val(10_usize)), @Plus(@Val(22_usize), @Val(5_usize))); test_rbml(a); - let a = &Spanned {lo: 0u, hi: 5u, node: 22u}; + let a = &Spanned {lo: 0_usize, hi: 5_usize, node: 22_usize}; test_rbml(a); - let a = &Point {x: 3u, y: 5u}; + let a = &Point {x: 3_usize, y: 5_usize}; test_rbml(a); - let a = &Top(22u); + let a = &Top(22_usize); test_rbml(a); - let a = &Bottom(222u); + let a = &Bottom(222_usize); test_rbml(a); let a = &A; diff --git a/src/test/run-pass/auto-instantiate.rs b/src/test/run-pass/auto-instantiate.rs index 3c1e1f7658..cd4c66cb32 100644 --- a/src/test/run-pass/auto-instantiate.rs +++ b/src/test/run-pass/auto-instantiate.rs @@ -8,13 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(Show)] +#[derive(Debug)] struct Pair { a: T, b: U } struct Triple { x: int, y: int, z: int } fn f(x: T, y: U) -> Pair { return Pair {a: x, b: y}; } pub fn main() { - println!("{}", f(Triple {x: 3, y: 4, z: 5}, 4i).a.x); - println!("{}", f(5i, 6i).a); + println!("{}", f(Triple {x: 3, y: 4, z: 5}, 4).a.x); + println!("{}", f(5, 6).a); } diff --git a/src/test/run-pass/auto-loop.rs b/src/test/run-pass/auto-loop.rs index 88884dfeb5..2cc7451e13 100644 --- a/src/test/run-pass/auto-loop.rs +++ b/src/test/run-pass/auto-loop.rs @@ -9,9 +9,9 @@ // except according to those terms. pub fn main() { - let mut sum = 0i; + let mut sum = 0; let xs = vec!(1, 2, 3, 4, 5); - for x in xs.iter() { + for x in &xs { sum += *x; } assert_eq!(sum, 15); diff --git a/src/test/run-pass/auto-ref-sliceable.rs b/src/test/run-pass/auto-ref-sliceable.rs index fd3ede07e2..652f21c2ae 100644 --- a/src/test/run-pass/auto-ref-sliceable.rs +++ b/src/test/run-pass/auto-ref-sliceable.rs @@ -20,7 +20,7 @@ impl Pushable for Vec { } pub fn main() { - let mut v = vec!(1i); + let mut v = vec!(1); v.push_val(2); v.push_val(3); assert_eq!(v, vec!(1, 2, 3)); diff --git a/src/test/run-pass/autoderef-method-on-trait.rs b/src/test/run-pass/autoderef-method-on-trait.rs index 876fc123f4..9e88eb6da6 100644 --- a/src/test/run-pass/autoderef-method-on-trait.rs +++ b/src/test/run-pass/autoderef-method-on-trait.rs @@ -16,10 +16,10 @@ trait double { } impl double for uint { - fn double(self: Box) -> uint { *self * 2u } + fn double(self: Box) -> uint { *self * 2_usize } } pub fn main() { - let x = box() (box 3u as Box); - assert_eq!(x.double(), 6u); + let x = box() (box 3_usize as Box); + assert_eq!(x.double(), 6_usize); } diff --git a/src/test/run-pass/autoderef-method-priority.rs b/src/test/run-pass/autoderef-method-priority.rs index f5d5c81117..67dd25ddc5 100644 --- a/src/test/run-pass/autoderef-method-priority.rs +++ b/src/test/run-pass/autoderef-method-priority.rs @@ -20,10 +20,10 @@ impl double for uint { } impl double for Box { - fn double(self) -> uint { *self * 2u } + fn double(self) -> uint { *self * 2_usize } } pub fn main() { - let x = box 3u; - assert_eq!(x.double(), 6u); + let x = box 3_usize; + assert_eq!(x.double(), 6_usize); } diff --git a/src/test/run-pass/autoderef-method-twice-but-not-thrice.rs b/src/test/run-pass/autoderef-method-twice-but-not-thrice.rs index 282cf62190..6437c78161 100644 --- a/src/test/run-pass/autoderef-method-twice-but-not-thrice.rs +++ b/src/test/run-pass/autoderef-method-twice-but-not-thrice.rs @@ -16,10 +16,10 @@ trait double { } impl double for Box { - fn double(self: Box>) -> uint { **self * 2u } + fn double(self: Box>) -> uint { **self * 2_usize } } pub fn main() { - let x = box box box box box 3u; - assert_eq!(x.double(), 6u); + let x = box box box box box 3_usize; + assert_eq!(x.double(), 6_usize); } diff --git a/src/test/run-pass/autoderef-method-twice.rs b/src/test/run-pass/autoderef-method-twice.rs index eb44e3b52b..8cbc151f0c 100644 --- a/src/test/run-pass/autoderef-method-twice.rs +++ b/src/test/run-pass/autoderef-method-twice.rs @@ -16,10 +16,10 @@ trait double { } impl double for uint { - fn double(self: Box) -> uint { *self * 2u } + fn double(self: Box) -> uint { *self * 2_usize } } pub fn main() { - let x = box box 3u; - assert_eq!(x.double(), 6u); + let x = box box 3_usize; + assert_eq!(x.double(), 6_usize); } diff --git a/src/test/run-pass/autoderef-method.rs b/src/test/run-pass/autoderef-method.rs index 4bbb17c6dd..c8fa3c9fd5 100644 --- a/src/test/run-pass/autoderef-method.rs +++ b/src/test/run-pass/autoderef-method.rs @@ -16,10 +16,10 @@ trait double { } impl double for uint { - fn double(self: Box) -> uint { *self * 2u } + fn double(self: Box) -> uint { *self * 2_usize } } pub fn main() { - let x = box 3u; - assert_eq!(x.double(), 6u); + let x = box 3_usize; + assert_eq!(x.double(), 6_usize); } diff --git a/src/test/run-pass/autoref-intermediate-types-issue-3585.rs b/src/test/run-pass/autoref-intermediate-types-issue-3585.rs index e026ac9dcb..87157b9334 100644 --- a/src/test/run-pass/autoref-intermediate-types-issue-3585.rs +++ b/src/test/run-pass/autoref-intermediate-types-issue-3585.rs @@ -29,6 +29,6 @@ impl Foo for uint { } pub fn main() { - let x = box 3u; + let x = box 3_usize; assert_eq!(x.foo(), "box 3".to_string()); } diff --git a/src/test/run-pass/backtrace.rs b/src/test/run-pass/backtrace.rs index da5fa19f81..6f76322cb7 100644 --- a/src/test/run-pass/backtrace.rs +++ b/src/test/run-pass/backtrace.rs @@ -12,27 +12,32 @@ // ignore-windows FIXME #13259 #![feature(unboxed_closures)] +#![feature(unsafe_destructor)] -use std::os; -use std::io::process::Command; -use std::finally::Finally; +use std::env; +use std::old_io::process::Command; use std::str; +use std::ops::{Drop, FnMut, FnOnce}; #[inline(never)] fn foo() { - let _v = vec![1i, 2, 3]; - if os::getenv("IS_TEST").is_some() { + let _v = vec![1, 2, 3]; + if env::var_os("IS_TEST").is_some() { panic!() } } #[inline(never)] fn double() { - (|&mut:| { - panic!("once"); - }).finally(|| { - panic!("twice"); - }) + struct Double; + + impl Drop for Double { + fn drop(&mut self) { panic!("twice") } + } + + let _d = Double; + + panic!("once"); } fn runtest(me: &str) { @@ -43,7 +48,7 @@ fn runtest(me: &str) { let p = template.clone().arg("fail").env("RUST_BACKTRACE", "1").spawn().unwrap(); let out = p.wait_with_output().unwrap(); assert!(!out.status.success()); - let s = str::from_utf8(out.error.as_slice()).unwrap(); + let s = str::from_utf8(&out.error).unwrap(); assert!(s.contains("stack backtrace") && s.contains("foo::h"), "bad output: {}", s); @@ -51,7 +56,7 @@ fn runtest(me: &str) { let p = template.clone().arg("fail").spawn().unwrap(); let out = p.wait_with_output().unwrap(); assert!(!out.status.success()); - let s = str::from_utf8(out.error.as_slice()).unwrap(); + let s = str::from_utf8(&out.error).unwrap(); assert!(!s.contains("stack backtrace") && !s.contains("foo::h"), "bad output2: {}", s); @@ -59,7 +64,7 @@ fn runtest(me: &str) { let p = template.clone().arg("double-fail").spawn().unwrap(); let out = p.wait_with_output().unwrap(); assert!(!out.status.success()); - let s = str::from_utf8(out.error.as_slice()).unwrap(); + let s = str::from_utf8(&out.error).unwrap(); // loosened the following from double::h to double:: due to // spurious failures on mac, 32bit, optimized assert!(s.contains("stack backtrace") && s.contains("double::"), @@ -70,23 +75,22 @@ fn runtest(me: &str) { .env("RUST_BACKTRACE", "1").spawn().unwrap(); let out = p.wait_with_output().unwrap(); assert!(!out.status.success()); - let s = str::from_utf8(out.error.as_slice()).unwrap(); + let s = str::from_utf8(&out.error).unwrap(); let mut i = 0; - for _ in range(0i, 2) { - i += s.slice_from(i + 10).find_str("stack backtrace").unwrap() + 10; + for _ in 0..2 { + i += s[i + 10..].find_str("stack backtrace").unwrap() + 10; } - assert!(s.slice_from(i + 10).find_str("stack backtrace").is_none(), + assert!(s[i + 10..].find_str("stack backtrace").is_none(), "bad output4: {}", s); } fn main() { - let args = os::args(); - let args = args.as_slice(); - if args.len() >= 2 && args[1].as_slice() == "fail" { + let args: Vec = env::args().collect(); + if args.len() >= 2 && args[1] == "fail" { foo(); - } else if args.len() >= 2 && args[1].as_slice() == "double-fail" { + } else if args.len() >= 2 && args[1] == "double-fail" { double(); } else { - runtest(args[0].as_slice()); + runtest(&args[0]); } } diff --git a/src/test/run-pass/bare-fn-implements-fn-mut.rs b/src/test/run-pass/bare-fn-implements-fn-mut.rs index 9d104afd64..758776298e 100644 --- a/src/test/run-pass/bare-fn-implements-fn-mut.rs +++ b/src/test/run-pass/bare-fn-implements-fn-mut.rs @@ -12,7 +12,7 @@ use std::ops::FnMut; -fn call_f>(mut f: F) { +fn call_f(mut f: F) { f(); } @@ -20,19 +20,19 @@ fn f() { println!("hello"); } -fn call_g>(mut g: G, x: String, y: String) +fn call_g String>(mut g: G, x: String, y: String) -> String { g(x, y) } fn g(mut x: String, y: String) -> String { - x.push_str(y.as_slice()); + x.push_str(&y); x } fn main() { call_f(f); - assert_eq!(call_g(g, "foo".to_string(), "bar".to_string()).as_slice(), + assert_eq!(call_g(g, "foo".to_string(), "bar".to_string()), "foobar"); } diff --git a/src/test/run-pass/binary-minus-without-space.rs b/src/test/run-pass/binary-minus-without-space.rs index 8235b91273..dc3b142f23 100644 --- a/src/test/run-pass/binary-minus-without-space.rs +++ b/src/test/run-pass/binary-minus-without-space.rs @@ -11,6 +11,6 @@ // Check that issue #954 stays fixed pub fn main() { - match -1i { -1 => {}, _ => panic!("wat") } - assert_eq!(1i-1, 0i); + match -1 { -1 => {}, _ => panic!("wat") } + assert_eq!(1-1, 0); } diff --git a/src/test/run-pass/binops.rs b/src/test/run-pass/binops.rs index dc92910c92..b36eb4bf2f 100644 --- a/src/test/run-pass/binops.rs +++ b/src/test/run-pass/binops.rs @@ -44,9 +44,9 @@ fn test_bool() { fn test_ptr() { unsafe { - let p1: *const u8 = ::std::mem::transmute(0u); - let p2: *const u8 = ::std::mem::transmute(0u); - let p3: *const u8 = ::std::mem::transmute(1u); + let p1: *const u8 = ::std::mem::transmute(0_usize); + let p2: *const u8 = ::std::mem::transmute(0_usize); + let p3: *const u8 = ::std::mem::transmute(1_usize); assert_eq!(p1, p2); assert!(p1 != p3); @@ -59,7 +59,7 @@ fn test_ptr() { } } -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct p { x: int, y: int, diff --git a/src/test/run-pass/bitv-perf-test.rs b/src/test/run-pass/bitv-perf-test.rs index 325f6dec76..7bb9f042fe 100644 --- a/src/test/run-pass/bitv-perf-test.rs +++ b/src/test/run-pass/bitv-perf-test.rs @@ -13,14 +13,14 @@ #![feature(box_syntax)] extern crate collections; -use std::collections::Bitv; +use std::collections::BitVec; fn bitv_test() { - let mut v1 = box Bitv::from_elem(31, false); - let v2 = box Bitv::from_elem(31, true); + let mut v1 = box BitVec::from_elem(31, false); + let v2 = box BitVec::from_elem(31, true); v1.union(&*v2); } pub fn main() { - for _ in range(0i, 10000) { bitv_test(); } + for _ in 0..10000 { bitv_test(); } } diff --git a/src/test/run-pass/bitwise.rs b/src/test/run-pass/bitwise.rs index 251804e214..8418681b6b 100644 --- a/src/test/run-pass/bitwise.rs +++ b/src/test/run-pass/bitwise.rs @@ -11,12 +11,12 @@ #[cfg(any(target_arch = "x86", target_arch = "arm"))] fn target() { - assert_eq!(-1000 as uint >> 3u, 536870787u); + assert_eq!(-1000 as uint >> 3_usize, 536870787_usize); } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))] fn target() { - assert_eq!(-1000 as uint >> 3u, 2305843009213693827u); + assert_eq!(-1000 as uint >> 3_usize, 2305843009213693827_usize); } fn general() { @@ -29,12 +29,12 @@ fn general() { println!("{}", b); assert_eq!(b, 1); assert_eq!(a, 2); - assert_eq!(!0xf0i & 0xff, 0xf); - assert_eq!(0xf0i | 0xf, 0xff); - assert_eq!(0xfi << 4, 0xf0); - assert_eq!(0xf0i >> 4, 0xf); - assert_eq!(-16i >> 2, -4); - assert_eq!(0b1010_1010i | 0b0101_0101, 0xff); + assert_eq!(!0xf0_isize & 0xff, 0xf); + assert_eq!(0xf0_isize | 0xf, 0xff); + assert_eq!(0xf_isize << 4, 0xf0); + assert_eq!(0xf0_isize >> 4, 0xf); + assert_eq!(-16 >> 2, -4); + assert_eq!(0b1010_1010_isize | 0b0101_0101, 0xff); } pub fn main() { diff --git a/src/test/run-pass/blind-item-mixed-crate-use-item.rs b/src/test/run-pass/blind-item-mixed-crate-use-item.rs new file mode 100644 index 0000000000..80c73e5e60 --- /dev/null +++ b/src/test/run-pass/blind-item-mixed-crate-use-item.rs @@ -0,0 +1,33 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:blind-item-mixed-crate-use-item-foo.rs +// aux-build:blind-item-mixed-crate-use-item-foo2.rs + +mod m { + pub fn f(_: T, _: (), _: ()) { } + pub fn g(_: T, _: (), _: ()) { } +} + +const BAR: () = (); +struct Data; +use m::f; +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; + + f(Data, BAR, foo::X); + g(Data2, BAR2, foo2::Y); +} diff --git a/src/test/run-pass/blind-item-mixed-use-item.rs b/src/test/run-pass/blind-item-mixed-use-item.rs new file mode 100644 index 0000000000..a3dad01acf --- /dev/null +++ b/src/test/run-pass/blind-item-mixed-use-item.rs @@ -0,0 +1,27 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +mod m { + pub fn f(_: T, _: ()) { } + pub fn g(_: T, _: ()) { } +} + +const BAR: () = (); +struct Data; +use m::f; + +fn main() { + const BAR2: () = (); + struct Data2; + use m::g; + + f(Data, BAR); + g(Data2, BAR2); +} diff --git a/src/test/run-pass/block-arg-call-as.rs b/src/test/run-pass/block-arg-call-as.rs index 6c54f33fbe..d319aaa2f8 100644 --- a/src/test/run-pass/block-arg-call-as.rs +++ b/src/test/run-pass/block-arg-call-as.rs @@ -13,6 +13,6 @@ fn asBlock(f: F) -> uint where F: FnOnce() -> uint { } pub fn main() { - let x = asBlock(|| 22u); - assert_eq!(x, 22u); + let x = asBlock(|| 22_usize); + assert_eq!(x, 22_usize); } diff --git a/src/test/run-pass/block-arg.rs b/src/test/run-pass/block-arg.rs index d017a0dbf9..2f530331a2 100644 --- a/src/test/run-pass/block-arg.rs +++ b/src/test/run-pass/block-arg.rs @@ -13,7 +13,7 @@ pub fn main() { let v = vec!(-1.0f64, 0.0, 1.0, 2.0, 3.0); // Statement form does not require parentheses: - for i in v.iter() { + for i in &v { println!("{}", *i); } diff --git a/src/test/run-pass/block-expr-precedence.rs b/src/test/run-pass/block-expr-precedence.rs index 31d0d52f8b..ace372dd2d 100644 --- a/src/test/run-pass/block-expr-precedence.rs +++ b/src/test/run-pass/block-expr-precedence.rs @@ -58,9 +58,9 @@ pub fn main() { let num = 12; - assert_eq!(if (true) { 12i } else { 12 } - num, 0); - assert_eq!(12i - if (true) { 12i } else { 12 }, 0); - if (true) { 12i; } {-num}; - if (true) { 12i; }; {-num}; - if (true) { 12i; };;; -num; + assert_eq!(if (true) { 12 } else { 12 } - num, 0); + assert_eq!(12 - if (true) { 12 } else { 12 }, 0); + if (true) { 12; } {-num}; + if (true) { 12; }; {-num}; + if (true) { 12; };;; -num; } diff --git a/src/test/run-pass/block-fn-coerce.rs b/src/test/run-pass/block-fn-coerce.rs index fe52b1a693..f3c874a5af 100644 --- a/src/test/run-pass/block-fn-coerce.rs +++ b/src/test/run-pass/block-fn-coerce.rs @@ -13,6 +13,6 @@ fn force(f: F) -> int where F: FnOnce() -> int { return f(); } pub fn main() { fn f() -> int { return 7; } assert_eq!(force(f), 7); - let g = {|&:|force(f)}; + let g = {||force(f)}; assert_eq!(g(), 7); } diff --git a/src/test/run-pass/block-iter-1.rs b/src/test/run-pass/block-iter-1.rs index 972bde5f29..d5d26f42ef 100644 --- a/src/test/run-pass/block-iter-1.rs +++ b/src/test/run-pass/block-iter-1.rs @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn iter_vec(v: Vec , mut f: F) where F: FnMut(&T) { for x in v.iter() { f(x); } } +fn iter_vec(v: Vec , mut f: F) where F: FnMut(&T) { for x in &v { f(x); } } pub fn main() { - let v = vec!(1i, 2, 3, 4, 5, 6, 7); - let mut odds = 0i; + let v = vec![1i32, 2, 3, 4, 5, 6, 7]; + let mut odds = 0i32; iter_vec(v, |i| { if *i % 2 == 1 { odds += 1; diff --git a/src/test/run-pass/block-iter-2.rs b/src/test/run-pass/block-iter-2.rs index 1032fb486a..8c079ca4b0 100644 --- a/src/test/run-pass/block-iter-2.rs +++ b/src/test/run-pass/block-iter-2.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn iter_vec(v: Vec, mut f: F) where F: FnMut(&T) { for x in v.iter() { f(x); } } +fn iter_vec(v: Vec, mut f: F) where F: FnMut(&T) { for x in &v { f(x); } } pub fn main() { - let v = vec!(1i, 2, 3, 4, 5); + let v = vec![1i32, 2, 3, 4, 5]; let mut sum = 0; iter_vec(v.clone(), |i| { iter_vec(v.clone(), |j| { diff --git a/src/test/run-pass/bool.rs b/src/test/run-pass/bool.rs index b3c4802530..edf6b397ff 100644 --- a/src/test/run-pass/bool.rs +++ b/src/test/run-pass/bool.rs @@ -53,9 +53,9 @@ fn main() { assert_eq!(!false, true); let s = false.to_string(); - assert_eq!(s.as_slice(), "false"); + assert_eq!(s, "false"); let s = true.to_string(); - assert_eq!(s.as_slice(), "true"); + assert_eq!(s, "true"); assert!(true > false); assert!(!(false > true)); diff --git a/src/test/run-pass/borrow-by-val-method-receiver.rs b/src/test/run-pass/borrow-by-val-method-receiver.rs index e6632fddad..4cc39b4b5d 100644 --- a/src/test/run-pass/borrow-by-val-method-receiver.rs +++ b/src/test/run-pass/borrow-by-val-method-receiver.rs @@ -19,5 +19,5 @@ impl<'a> Foo for &'a [int] { pub fn main() { let items = vec!( 3, 5, 1, 2, 4 ); - items.as_slice().foo(); + items.foo(); } diff --git a/src/test/run-pass/borrow-tuple-fields.rs b/src/test/run-pass/borrow-tuple-fields.rs index a151a837f7..2e5688d8b7 100644 --- a/src/test/run-pass/borrow-tuple-fields.rs +++ b/src/test/run-pass/borrow-tuple-fields.rs @@ -11,13 +11,13 @@ struct Foo(int, int); fn main() { - let x = (1i, 2i); + let x = (1, 2); let a = &x.0; let b = &x.0; assert_eq!(*a, 1); assert_eq!(*b, 1); - let mut x = (1i, 2i); + let mut x = (1, 2); { let a = &x.0; let b = &mut x.1; @@ -28,13 +28,13 @@ fn main() { assert_eq!(x.1, 5); - let x = Foo(1i, 2i); + let x = Foo(1, 2); let a = &x.0; let b = &x.0; assert_eq!(*a, 1); assert_eq!(*b, 1); - let mut x = Foo(1i, 2i); + let mut x = Foo(1, 2); { let a = &x.0; let b = &mut x.1; diff --git a/src/test/run-pass/borrowck-binding-mutbl.rs b/src/test/run-pass/borrowck-binding-mutbl.rs index 6624136544..34ad2b2def 100644 --- a/src/test/run-pass/borrowck-binding-mutbl.rs +++ b/src/test/run-pass/borrowck-binding-mutbl.rs @@ -19,7 +19,7 @@ pub fn main() { match x { F {f: ref mut v} => { - impure(v.as_slice()); + impure(v); } } } diff --git a/src/test/run-pass/borrowck-closures-two-imm.rs b/src/test/run-pass/borrowck-closures-two-imm.rs index 33e4294366..c907778339 100644 --- a/src/test/run-pass/borrowck-closures-two-imm.rs +++ b/src/test/run-pass/borrowck-closures-two-imm.rs @@ -14,31 +14,31 @@ // that the main function can read the variable too while // the closures are in scope. Issue #6801. -fn a() -> int { - let mut x = 3i; +fn a() -> i32 { + let mut x = 3i32; x += 1; - let c1 = |&:| x * 4; - let c2 = |&:| x * 5; + let c1 = || x * 4; + let c2 = || x * 5; c1() * c2() * x } -fn get(x: &int) -> int { +fn get(x: &i32) -> i32 { *x * 4 } -fn b() -> int { - let mut x = 3; +fn b() -> i32 { + let mut x = 3i32; x += 1; - let c1 = |&:| get(&x); - let c2 = |&:| get(&x); + let c1 = || get(&x); + let c2 = || get(&x); c1() * c2() * x } -fn c() -> int { - let mut x = 3; +fn c() -> i32 { + let mut x = 3i32; x += 1; - let c1 = |&:| x * 5; - let c2 = |&:| get(&x); + let c1 = || x * 5; + let c2 = || get(&x); c1() * c2() * x } diff --git a/src/test/run-pass/borrowck-fixed-length-vecs.rs b/src/test/run-pass/borrowck-fixed-length-vecs.rs index 71c8936570..ee561fdb0b 100644 --- a/src/test/run-pass/borrowck-fixed-length-vecs.rs +++ b/src/test/run-pass/borrowck-fixed-length-vecs.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let x = [22i]; + let x = [22]; let y = &x[0]; assert_eq!(*y, 22); } diff --git a/src/test/run-pass/borrowck-freeze-frozen-mut.rs b/src/test/run-pass/borrowck-freeze-frozen-mut.rs index 21f5d0e6c1..30a921c9bd 100644 --- a/src/test/run-pass/borrowck-freeze-frozen-mut.rs +++ b/src/test/run-pass/borrowck-freeze-frozen-mut.rs @@ -19,7 +19,7 @@ fn get<'a, T>(ms: &'a MutSlice<'a, T>, index: uint) -> &'a T { } pub fn main() { - let mut data = [1i, 2, 3]; + let mut data = [1, 2, 3]; { let slice = MutSlice { data: &mut data }; slice.data[0] += 4; diff --git a/src/test/run-pass/borrowck-macro-interaction-issue-6304.rs b/src/test/run-pass/borrowck-macro-interaction-issue-6304.rs index 49483e4009..ae5734a09b 100644 --- a/src/test/run-pass/borrowck-macro-interaction-issue-6304.rs +++ b/src/test/run-pass/borrowck-macro-interaction-issue-6304.rs @@ -11,6 +11,7 @@ // Check that we do not ICE when compiling this // macro, which reuses the expression `$id` +#![feature(box_patterns)] #![feature(box_syntax)] struct Foo { diff --git a/src/test/run-pass/borrowck-move-by-capture-ok.rs b/src/test/run-pass/borrowck-move-by-capture-ok.rs index 773780ffb0..1be57674fa 100644 --- a/src/test/run-pass/borrowck-move-by-capture-ok.rs +++ b/src/test/run-pass/borrowck-move-by-capture-ok.rs @@ -14,7 +14,7 @@ pub fn main() { let bar = box 3; - let h = |:| -> int *bar; + let h = || -> int *bar; assert_eq!(h(), 3); } diff --git a/src/test/run-pass/borrowck-mut-uniq.rs b/src/test/run-pass/borrowck-mut-uniq.rs index 4416c57e34..2dbaec8fbb 100644 --- a/src/test/run-pass/borrowck-mut-uniq.rs +++ b/src/test/run-pass/borrowck-mut-uniq.rs @@ -13,7 +13,7 @@ use std::mem::swap; -#[derive(Show)] +#[derive(Debug)] struct Ints {sum: Box, values: Vec } fn add_int(x: &mut Ints, v: int) { @@ -26,7 +26,7 @@ fn add_int(x: &mut Ints, v: int) { fn iter_ints(x: &Ints, mut f: F) -> bool where F: FnMut(&int) -> bool { let l = x.values.len(); - range(0u, l).all(|i| f(&x.values[i])) + (0_usize..l).all(|i| f(&x.values[i])) } pub fn main() { diff --git a/src/test/run-pass/borrowck-mut-vec-as-imm-slice.rs b/src/test/run-pass/borrowck-mut-vec-as-imm-slice.rs index 05dffe9168..092d7c1317 100644 --- a/src/test/run-pass/borrowck-mut-vec-as-imm-slice.rs +++ b/src/test/run-pass/borrowck-mut-vec-as-imm-slice.rs @@ -11,12 +11,12 @@ fn want_slice(v: &[int]) -> int { let mut sum = 0; - for i in v.iter() { sum += *i; } + for i in v { sum += *i; } sum } fn has_mut_vec(v: Vec ) -> int { - want_slice(v.as_slice()) + want_slice(&v) } pub fn main() { diff --git a/src/test/run-pass/borrowck-pat-reassign-no-binding.rs b/src/test/run-pass/borrowck-pat-reassign-no-binding.rs index 6136bc90fd..4ccbf6b5b0 100644 --- a/src/test/run-pass/borrowck-pat-reassign-no-binding.rs +++ b/src/test/run-pass/borrowck-pat-reassign-no-binding.rs @@ -14,7 +14,7 @@ pub fn main() { None => { // It is ok to reassign x here, because there is in // fact no outstanding loan of x! - x = Some(0i); + x = Some(0); } Some(_) => { } } diff --git a/src/test/run-pass/borrowck-trait-lifetime.rs b/src/test/run-pass/borrowck-trait-lifetime.rs index b39f03a93c..a2b0fa5663 100644 --- a/src/test/run-pass/borrowck-trait-lifetime.rs +++ b/src/test/run-pass/borrowck-trait-lifetime.rs @@ -12,8 +12,11 @@ // to the same lifetime on a trait succeeds. See issue #10766. #![allow(dead_code)] + +use std::marker; + fn main() { - trait T {} + trait T { fn foo(&self) {} } fn f<'a, V: T>(v: &'a V) -> &'a T { v as &'a T diff --git a/src/test/run-pass/borrowck-univariant-enum.rs b/src/test/run-pass/borrowck-univariant-enum.rs index df4106c984..d95594119b 100644 --- a/src/test/run-pass/borrowck-univariant-enum.rs +++ b/src/test/run-pass/borrowck-univariant-enum.rs @@ -11,12 +11,11 @@ use std::cell::Cell; +#[derive(Copy)] enum newtype { newvar(int) } -impl Copy for newtype {} - pub fn main() { // Test that borrowck treats enums with a single variant diff --git a/src/test/run-pass/borrowed-ptr-pattern-2.rs b/src/test/run-pass/borrowed-ptr-pattern-2.rs index 75b54b1af8..efd932933d 100644 --- a/src/test/run-pass/borrowed-ptr-pattern-2.rs +++ b/src/test/run-pass/borrowed-ptr-pattern-2.rs @@ -9,7 +9,7 @@ // except according to those terms. fn foo(s: &String) -> bool { - match s.as_slice() { + match &**s { "kitty" => true, _ => false } diff --git a/src/test/run-pass/borrowed-ptr-pattern-infallible.rs b/src/test/run-pass/borrowed-ptr-pattern-infallible.rs index 55ae6d3beb..e57c001ea0 100644 --- a/src/test/run-pass/borrowed-ptr-pattern-infallible.rs +++ b/src/test/run-pass/borrowed-ptr-pattern-infallible.rs @@ -10,7 +10,7 @@ pub fn main() { - let (&x, &y) = (&3i, &'a'); + let (&x, &y) = (&3, &'a'); assert_eq!(x, 3); assert_eq!(y, 'a'); } diff --git a/src/test/run-pass/borrowed-ptr-pattern.rs b/src/test/run-pass/borrowed-ptr-pattern.rs index 3636d4d769..7ccb40c8e7 100644 --- a/src/test/run-pass/borrowed-ptr-pattern.rs +++ b/src/test/run-pass/borrowed-ptr-pattern.rs @@ -15,6 +15,6 @@ fn foo(x: &T) -> T{ } pub fn main() { - assert_eq!(foo(&3i), 3i); + assert_eq!(foo(&3), 3); assert_eq!(foo(&'a'), 'a'); } diff --git a/src/test/run-pass/break.rs b/src/test/run-pass/break.rs index 89745bd167..6498c4b461 100644 --- a/src/test/run-pass/break.rs +++ b/src/test/run-pass/break.rs @@ -9,13 +9,13 @@ // except according to those terms. pub fn main() { - let mut i = 0i; + let mut i = 0; while i < 20 { i += 1; if i == 10 { break; } } assert_eq!(i, 10); loop { i += 1; if i == 20 { break; } } assert_eq!(i, 20); - let xs = [1i, 2, 3, 4, 5, 6]; - for x in xs.iter() { + let xs = [1, 2, 3, 4, 5, 6]; + for x in &xs { if *x == 3 { break; } assert!((*x <= 3)); } i = 0; @@ -25,8 +25,8 @@ pub fn main() { i += 1; if i % 2 == 0 { continue; } assert!((i % 2 != 0)); if i >= 10 { break; } } - let ys = vec!(1i, 2, 3, 4, 5, 6); - for x in ys.iter() { + let ys = vec!(1, 2, 3, 4, 5, 6); + for x in &ys { if *x % 2 == 0 { continue; } assert!((*x % 2 != 0)); } diff --git a/src/test/run-pass/bug-7183-generics.rs b/src/test/run-pass/bug-7183-generics.rs index bf8d303f34..a3bb02d1d0 100644 --- a/src/test/run-pass/bug-7183-generics.rs +++ b/src/test/run-pass/bug-7183-generics.rs @@ -34,11 +34,11 @@ impl Speak for Option { pub fn main() { - assert_eq!(3i.hi(), "hello: 3".to_string()); - assert_eq!(Some(Some(3i)).hi(), + assert_eq!(3.hi(), "hello: 3".to_string()); + assert_eq!(Some(Some(3)).hi(), "something!something!hello: 3".to_string()); assert_eq!(None::.hi(), "hello - none".to_string()); assert_eq!(Some(None::).hi(), "something!hello - none".to_string()); - assert_eq!(Some(3i).hi(), "something!hello: 3".to_string()); + assert_eq!(Some(3).hi(), "something!hello: 3".to_string()); } diff --git a/src/test/run-pass/bug-7295.rs b/src/test/run-pass/bug-7295.rs index ea711d78dd..143ebfdabf 100644 --- a/src/test/run-pass/bug-7295.rs +++ b/src/test/run-pass/bug-7295.rs @@ -9,10 +9,10 @@ // except according to those terms. pub trait Foo { - fn func1(&self, t: U); + fn func1(&self, t: U, w: T); - fn func2(&self, t: U) { - self.func1(t); + fn func2(&self, t: U, w: T) { + self.func1(t, w); } } diff --git a/src/test/run-pass/builtin-superkinds-capabilities-transitive.rs b/src/test/run-pass/builtin-superkinds-capabilities-transitive.rs index 365670db6f..379ac12a95 100644 --- a/src/test/run-pass/builtin-superkinds-capabilities-transitive.rs +++ b/src/test/run-pass/builtin-superkinds-capabilities-transitive.rs @@ -22,12 +22,12 @@ trait Foo : Bar { } impl Foo for T { } impl Bar for T { } -fn foo(val: T, chan: Sender) { +fn foo(val: T, chan: Sender) { chan.send(val).unwrap(); } pub fn main() { let (tx, rx) = channel(); - foo(31337i, tx); - assert!(rx.recv().unwrap() == 31337i); + foo(31337, tx); + assert!(rx.recv().unwrap() == 31337); } diff --git a/src/test/run-pass/builtin-superkinds-capabilities-xc.rs b/src/test/run-pass/builtin-superkinds-capabilities-xc.rs index 126088d7f9..cd019c21a3 100644 --- a/src/test/run-pass/builtin-superkinds-capabilities-xc.rs +++ b/src/test/run-pass/builtin-superkinds-capabilities-xc.rs @@ -25,12 +25,12 @@ struct X(T); impl RequiresShare for X { } impl RequiresRequiresShareAndSend for X { } -fn foo(val: T, chan: Sender) { +fn foo(val: T, chan: Sender) { chan.send(val).unwrap(); } pub fn main() { let (tx, rx): (Sender>, Receiver>) = channel(); - foo(X(31337i), tx); - assert!(rx.recv().unwrap() == X(31337i)); + foo(X(31337), tx); + assert!(rx.recv().unwrap() == X(31337)); } diff --git a/src/test/run-pass/builtin-superkinds-capabilities.rs b/src/test/run-pass/builtin-superkinds-capabilities.rs index 7f4a2398f5..dc61508eec 100644 --- a/src/test/run-pass/builtin-superkinds-capabilities.rs +++ b/src/test/run-pass/builtin-superkinds-capabilities.rs @@ -18,12 +18,12 @@ trait Foo : Send { } impl Foo for T { } -fn foo(val: T, chan: Sender) { +fn foo(val: T, chan: Sender) { chan.send(val).unwrap(); } pub fn main() { let (tx, rx): (Sender, Receiver) = channel(); - foo(31337i, tx); - assert!(rx.recv().unwrap() == 31337i); + foo(31337, tx); + assert!(rx.recv().unwrap() == 31337); } diff --git a/src/test/run-pass/builtin-superkinds-in-metadata.rs b/src/test/run-pass/builtin-superkinds-in-metadata.rs index 382caa83c6..7eaed91012 100644 --- a/src/test/run-pass/builtin-superkinds-in-metadata.rs +++ b/src/test/run-pass/builtin-superkinds-in-metadata.rs @@ -16,11 +16,11 @@ extern crate trait_superkinds_in_metadata; use trait_superkinds_in_metadata::{RequiresRequiresShareAndSend, RequiresShare}; use trait_superkinds_in_metadata::{RequiresCopy}; +use std::marker; +#[derive(Copy)] struct X(T); -impl Copy for X {} - impl RequiresShare for X { } impl RequiresRequiresShareAndSend for X { } diff --git a/src/test/run-pass/builtin-superkinds-phantom-typaram.rs b/src/test/run-pass/builtin-superkinds-phantom-typaram.rs index 7e1b282193..964c28dc94 100644 --- a/src/test/run-pass/builtin-superkinds-phantom-typaram.rs +++ b/src/test/run-pass/builtin-superkinds-phantom-typaram.rs @@ -12,10 +12,12 @@ // super-builtin-kind of a trait, if the type parameter is never used, // the type can implement the trait anyway. +use std::marker; + trait Foo : Send { } -struct X(()); +struct X { marker: marker::PhantomData } -impl Foo for X { } +impl Foo for X { } pub fn main() { } diff --git a/src/test/run-pass/builtin-superkinds-self-type.rs b/src/test/run-pass/builtin-superkinds-self-type.rs index d0db2542cc..1d05a7baa5 100644 --- a/src/test/run-pass/builtin-superkinds-self-type.rs +++ b/src/test/run-pass/builtin-superkinds-self-type.rs @@ -13,16 +13,16 @@ use std::sync::mpsc::{Sender, channel}; -trait Foo : Send + Sized { +trait Foo : Send + Sized + 'static { fn foo(self, tx: Sender) { tx.send(self).unwrap(); } } -impl Foo for T { } +impl Foo for T { } pub fn main() { let (tx, rx) = channel(); - 1193182i.foo(tx); - assert!(rx.recv().unwrap() == 1193182i); + 1193182.foo(tx); + assert!(rx.recv().unwrap() == 1193182); } diff --git a/src/test/run-pass/byte-literals.rs b/src/test/run-pass/byte-literals.rs index ee8a58a0d3..874dbdc662 100644 --- a/src/test/run-pass/byte-literals.rs +++ b/src/test/run-pass/byte-literals.rs @@ -52,10 +52,10 @@ pub fn main() { } let buf = vec!(97u8, 98, 99, 100); - assert_eq!(match buf.slice(0, 3) { - b"def" => 1u, - b"abc" => 2u, - _ => 3u + assert_eq!(match &buf[0..3] { + b"def" => 1_usize, + b"abc" => 2_usize, + _ => 3_usize }, 2); let expected: &[_] = &[97u8, 92u8, 110u8]; diff --git a/src/test/run-pass/c-stack-returning-int64.rs b/src/test/run-pass/c-stack-returning-int64.rs index 22c322b86c..6246ee9c6c 100644 --- a/src/test/run-pass/c-stack-returning-int64.rs +++ b/src/test/run-pass/c-stack-returning-int64.rs @@ -24,12 +24,12 @@ mod mlibc { } fn atol(s: String) -> int { - let c = CString::from_slice(s.as_bytes()); + let c = CString::new(s).unwrap(); unsafe { mlibc::atol(c.as_ptr()) as int } } fn atoll(s: String) -> i64 { - let c = CString::from_slice(s.as_bytes()); + let c = CString::new(s).unwrap(); unsafe { mlibc::atoll(c.as_ptr()) as i64 } } diff --git a/src/test/run-pass/capture-clauses-boxed-closures.rs b/src/test/run-pass/capture-clauses-boxed-closures.rs index 6e8ed4fd5a..1a85797fa6 100644 --- a/src/test/run-pass/capture-clauses-boxed-closures.rs +++ b/src/test/run-pass/capture-clauses-boxed-closures.rs @@ -9,14 +9,14 @@ // except according to those terms. fn each(x: &[T], mut f: F) where F: FnMut(&T) { - for val in x.iter() { + for val in x { f(val) } } fn main() { - let mut sum = 0u; - let elems = [ 1u, 2, 3, 4, 5 ]; + let mut sum = 0_usize; + let elems = [ 1_usize, 2, 3, 4, 5 ]; each(&elems, |val| sum += *val); assert_eq!(sum, 15); } diff --git a/src/test/run-pass/capture-clauses-unboxed-closures.rs b/src/test/run-pass/capture-clauses-unboxed-closures.rs index cd40e2a784..dd417f1a9e 100644 --- a/src/test/run-pass/capture-clauses-unboxed-closures.rs +++ b/src/test/run-pass/capture-clauses-unboxed-closures.rs @@ -11,14 +11,14 @@ #![feature(unboxed_closures)] fn each<'a,T,F:FnMut(&'a T)>(x: &'a [T], mut f: F) { - for val in x.iter() { + for val in x { f(val) } } fn main() { - let mut sum = 0u; - let elems = [ 1u, 2, 3, 4, 5 ]; - each(&elems, |&mut: val: &uint| sum += *val); + let mut sum = 0_usize; + let elems = [ 1_usize, 2, 3, 4, 5 ]; + each(&elems, |val: &uint| sum += *val); assert_eq!(sum, 15); } diff --git a/src/test/run-pass/capturing-logging.rs b/src/test/run-pass/capturing-logging.rs index 00673bee8b..70cc0463a6 100644 --- a/src/test/run-pass/capturing-logging.rs +++ b/src/test/run-pass/capturing-logging.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android (FIXME #11419) // exec-env:RUST_LOG=info #![allow(unknown_features)] @@ -20,7 +19,7 @@ extern crate log; use log::{set_logger, Logger, LogRecord}; use std::sync::mpsc::channel; use std::fmt; -use std::io::{ChanReader, ChanWriter}; +use std::old_io::{ChanReader, ChanWriter}; use std::thread::Thread; struct MyWriter(ChanWriter); @@ -41,6 +40,6 @@ fn main() { info!("info"); }); let s = r.read_to_string().unwrap(); - assert!(s.as_slice().contains("info")); - assert!(!s.as_slice().contains("debug")); + assert!(s.contains("info")); + assert!(!s.contains("debug")); } diff --git a/src/test/run-pass/cci_borrow.rs b/src/test/run-pass/cci_borrow.rs index ef5ee5aa3b..00c600ed00 100644 --- a/src/test/run-pass/cci_borrow.rs +++ b/src/test/run-pass/cci_borrow.rs @@ -17,8 +17,8 @@ extern crate cci_borrow_lib; use cci_borrow_lib::foo; pub fn main() { - let p = box 22u; + let p = box 22_usize; let r = foo(&*p); println!("r={}", r); - assert_eq!(r, 22u); + assert_eq!(r, 22_usize); } diff --git a/src/test/run-pass/cci_impl_exe.rs b/src/test/run-pass/cci_impl_exe.rs index 8a291febb6..c4b55b9962 100644 --- a/src/test/run-pass/cci_impl_exe.rs +++ b/src/test/run-pass/cci_impl_exe.rs @@ -17,7 +17,7 @@ pub fn main() { //let bt0 = sys::frame_address(); //println!("%?", bt0); - 3u.to(10u, |i| { + 3_usize.to(10_usize, |i| { println!("{}", i); //let bt1 = sys::frame_address(); diff --git a/src/test/run-pass/cci_iter_exe.rs b/src/test/run-pass/cci_iter_exe.rs index 7191d5078b..e4b26ba74b 100644 --- a/src/test/run-pass/cci_iter_exe.rs +++ b/src/test/run-pass/cci_iter_exe.rs @@ -15,7 +15,7 @@ extern crate cci_iter_lib; pub fn main() { //let bt0 = sys::rusti::frame_address(1u32); //println!("%?", bt0); - cci_iter_lib::iter(&[1i, 2, 3], |i| { + cci_iter_lib::iter(&[1, 2, 3], |i| { println!("{}", *i); //assert!(bt0 == sys::rusti::frame_address(2u32)); }) diff --git a/src/test/run-pass/cci_no_inline_exe.rs b/src/test/run-pass/cci_no_inline_exe.rs index 2f02fc9acb..2040bd7ad7 100644 --- a/src/test/run-pass/cci_no_inline_exe.rs +++ b/src/test/run-pass/cci_no_inline_exe.rs @@ -21,7 +21,7 @@ pub fn main() { // actually working. //let bt0 = sys::frame_address(); //println!("%?", bt0); - iter(vec!(1u, 2u, 3u), |i| { + iter(vec!(1_usize, 2_usize, 3_usize), |i| { println!("{}", i); //let bt1 = sys::frame_address(); diff --git a/src/test/run-pass/cell-does-not-clone.rs b/src/test/run-pass/cell-does-not-clone.rs index 6455f1e4bb..ea1d0b625f 100644 --- a/src/test/run-pass/cell-does-not-clone.rs +++ b/src/test/run-pass/cell-does-not-clone.rs @@ -10,6 +10,7 @@ use std::cell::Cell; +#[derive(Copy)] struct Foo { x: int } @@ -24,8 +25,6 @@ impl Clone for Foo { } } -impl Copy for Foo {} - pub fn main() { let x = Cell::new(Foo { x: 22 }); let _y = x.get(); diff --git a/src/test/run-pass/cfg-attr-cfg.rs b/src/test/run-pass/cfg-attr-cfg.rs new file mode 100644 index 0000000000..09ab701948 --- /dev/null +++ b/src/test/run-pass/cfg-attr-cfg.rs @@ -0,0 +1,15 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// main is conditionally compiled, but the conditional compilation +// is conditional too! + +#[cfg_attr(foo, cfg(bar))] +fn main() { } diff --git a/src/test/run-pass/cfg-attr-crate.rs b/src/test/run-pass/cfg-attr-crate.rs new file mode 100644 index 0000000000..e6bd8afad2 --- /dev/null +++ b/src/test/run-pass/cfg-attr-crate.rs @@ -0,0 +1,15 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// https://github.com/rust-lang/rust/issues/21833#issuecomment-72353044 + +#![cfg_attr(not_used, no_std)] + +fn main() { } diff --git a/src/test/run-pass/cfg_attr.rs b/src/test/run-pass/cfg_attr.rs index 7e508d91c8..9bef7f7042 100644 --- a/src/test/run-pass/cfg_attr.rs +++ b/src/test/run-pass/cfg_attr.rs @@ -10,44 +10,44 @@ // compile-flags:--cfg set1 --cfg set2 #![allow(dead_code)] -use std::fmt::Show; +use std::fmt::Debug; -struct NotShowable; +struct NotDebugable; -#[cfg_attr(set1, derive(Show))] +#[cfg_attr(set1, derive(Debug))] struct Set1; -#[cfg_attr(notset, derive(Show))] -struct Notset(NotShowable); +#[cfg_attr(notset, derive(Debug))] +struct Notset(NotDebugable); -#[cfg_attr(not(notset), derive(Show))] +#[cfg_attr(not(notset), derive(Debug))] struct NotNotset; -#[cfg_attr(not(set1), derive(Show))] -struct NotSet1(NotShowable); +#[cfg_attr(not(set1), derive(Debug))] +struct NotSet1(NotDebugable); -#[cfg_attr(all(set1, set2), derive(Show))] +#[cfg_attr(all(set1, set2), derive(Debug))] struct AllSet1Set2; -#[cfg_attr(all(set1, notset), derive(Show))] -struct AllSet1Notset(NotShowable); +#[cfg_attr(all(set1, notset), derive(Debug))] +struct AllSet1Notset(NotDebugable); -#[cfg_attr(any(set1, notset), derive(Show))] +#[cfg_attr(any(set1, notset), derive(Debug))] struct AnySet1Notset; -#[cfg_attr(any(notset, notset2), derive(Show))] -struct AnyNotsetNotset2(NotShowable); +#[cfg_attr(any(notset, notset2), derive(Debug))] +struct AnyNotsetNotset2(NotDebugable); -#[cfg_attr(all(not(notset), any(set1, notset)), derive(Show))] +#[cfg_attr(all(not(notset), any(set1, notset)), derive(Debug))] struct Complex; -#[cfg_attr(any(notset, not(any(set1, notset))), derive(Show))] -struct ComplexNot(NotShowable); +#[cfg_attr(any(notset, not(any(set1, notset))), derive(Debug))] +struct ComplexNot(NotDebugable); -#[cfg_attr(any(target_endian = "little", target_endian = "big"), derive(Show))] +#[cfg_attr(any(target_endian = "little", target_endian = "big"), derive(Debug))] struct KeyValue; -fn is_show() {} +fn is_show() {} fn main() { is_show::(); diff --git a/src/test/run-pass/check-static-recursion-foreign.rs b/src/test/run-pass/check-static-recursion-foreign.rs index 9acc0b3a3c..4e05c263a4 100644 --- a/src/test/run-pass/check-static-recursion-foreign.rs +++ b/src/test/run-pass/check-static-recursion-foreign.rs @@ -11,6 +11,9 @@ // Static recursion check shouldn't fail when given a foreign item (#18279) // aux-build:check_static_recursion_foreign_helper.rs + +#![feature(custom_attribute)] + extern crate check_static_recursion_foreign_helper; extern crate libc; diff --git a/src/test/run-pass/class-attributes-1.rs b/src/test/run-pass/class-attributes-1.rs index 28081e5292..5dc2747218 100644 --- a/src/test/run-pass/class-attributes-1.rs +++ b/src/test/run-pass/class-attributes-1.rs @@ -10,6 +10,7 @@ // pp-exact - Make sure we actually print the attributes #![allow(unused_attribute)] +#![feature(custom_attribute)] struct cat { name: String, diff --git a/src/test/run-pass/class-attributes-2.rs b/src/test/run-pass/class-attributes-2.rs index bd62f83844..cc1b15bcb8 100644 --- a/src/test/run-pass/class-attributes-2.rs +++ b/src/test/run-pass/class-attributes-2.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. #![allow(unused_attribute)] +#![feature(custom_attribute)] struct cat { name: String, diff --git a/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs b/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs index e6cae99067..9a388c9bc2 100644 --- a/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs +++ b/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs @@ -25,6 +25,6 @@ fn print_out(thing: Box, expected: String) { } pub fn main() { - let nyan: Box = box cat(0u, 2, "nyan".to_string()) as Box; + let nyan: Box = box cat(0_usize, 2, "nyan".to_string()) as Box; print_out(nyan, "nyan".to_string()); } diff --git a/src/test/run-pass/class-cast-to-trait-multiple-types.rs b/src/test/run-pass/class-cast-to-trait-multiple-types.rs index ecbbb3199b..4f1654e603 100644 --- a/src/test/run-pass/class-cast-to-trait-multiple-types.rs +++ b/src/test/run-pass/class-cast-to-trait-multiple-types.rs @@ -22,11 +22,11 @@ struct dog { impl dog { fn bark(&mut self) -> int { println!("Woof {} {}", self.barks, self.volume); - self.barks += 1u; - if self.barks % 3u == 0u { + self.barks += 1_usize; + if self.barks % 3_usize == 0_usize { self.volume += 1; } - if self.barks % 10u == 0u { + if self.barks % 10_usize == 0_usize { self.volume -= 2; } println!("Grrr {} {}", self.barks, self.volume); @@ -43,7 +43,7 @@ impl noisy for dog { fn dog() -> dog { dog { volume: 0, - barks: 0u + barks: 0_usize } } @@ -70,8 +70,8 @@ impl cat { impl cat { fn meow(&mut self) -> uint { println!("Meow"); - self.meows += 1u; - if self.meows % 5u == 0u { + self.meows += 1_usize; + if self.meows % 5_usize == 0_usize { self.how_hungry += 1; } self.meows @@ -88,14 +88,14 @@ fn cat(in_x: uint, in_y: int, in_name: String) -> cat { fn annoy_neighbors(critter: &mut noisy) { - for _i in range(0u, 10) { critter.speak(); } + for _i in 0_usize..10 { critter.speak(); } } pub fn main() { - let mut nyan: cat = cat(0u, 2, "nyan".to_string()); + let mut nyan: cat = cat(0_usize, 2, "nyan".to_string()); let mut whitefang: dog = dog(); annoy_neighbors(&mut nyan); annoy_neighbors(&mut whitefang); - assert_eq!(nyan.meow_count(), 10u); + assert_eq!(nyan.meow_count(), 10_usize); assert_eq!(whitefang.volume, 1); } diff --git a/src/test/run-pass/class-cast-to-trait.rs b/src/test/run-pass/class-cast-to-trait.rs index 85764f8cbb..476594c270 100644 --- a/src/test/run-pass/class-cast-to-trait.rs +++ b/src/test/run-pass/class-cast-to-trait.rs @@ -42,8 +42,8 @@ impl cat { impl cat { fn meow(&mut self) { println!("Meow"); - self.meows += 1u; - if self.meows % 5u == 0u { + self.meows += 1_usize; + if self.meows % 5_usize == 0_usize { self.how_hungry += 1; } } @@ -59,7 +59,7 @@ fn cat(in_x : uint, in_y : int, in_name: String) -> cat { pub fn main() { - let mut nyan = cat(0u, 2, "nyan".to_string()); + let mut nyan = cat(0_usize, 2, "nyan".to_string()); let mut nyan: &mut noisy = &mut nyan; nyan.speak(); } diff --git a/src/test/run-pass/class-dtor.rs b/src/test/run-pass/class-dtor.rs index 8ee382eaa3..14247ad775 100644 --- a/src/test/run-pass/class-dtor.rs +++ b/src/test/run-pass/class-dtor.rs @@ -21,7 +21,7 @@ impl Drop for cat { fn cat(done: extern fn(uint)) -> cat { cat { - meows: 0u, + meows: 0_usize, done: done } } diff --git a/src/test/run-pass/class-exports.rs b/src/test/run-pass/class-exports.rs index 80f8ed9363..4c7d0e6951 100644 --- a/src/test/run-pass/class-exports.rs +++ b/src/test/run-pass/class-exports.rs @@ -27,7 +27,7 @@ mod kitty { pub fn cat(in_name: String) -> cat { cat { name: in_name, - meows: 0u + meows: 0_usize } } } diff --git a/src/test/run-pass/class-impl-very-parameterized-trait.rs b/src/test/run-pass/class-impl-very-parameterized-trait.rs index 629cf7c4ef..c3ced512af 100644 --- a/src/test/run-pass/class-impl-very-parameterized-trait.rs +++ b/src/test/run-pass/class-impl-very-parameterized-trait.rs @@ -11,11 +11,9 @@ use std::cmp; -#[derive(Show)] +#[derive(Copy, Debug)] enum cat_type { tuxedo, tabby, tortoiseshell } -impl Copy for cat_type {} - impl cmp::PartialEq for cat_type { fn eq(&self, other: &cat_type) -> bool { ((*self) as uint) == ((*other) as uint) @@ -105,11 +103,11 @@ impl cat { pub fn main() { let mut nyan: cat = cat::new(0, 2, "nyan".to_string()); - for _ in range(1u, 5) { nyan.speak(); } + for _ in 1_usize..5 { nyan.speak(); } assert!(*nyan.find(&1).unwrap() == "nyan".to_string()); assert_eq!(nyan.find(&10), None); let mut spotty: cat = cat::new(2, 57, cat_type::tuxedo); - for _ in range(0u, 6) { spotty.speak(); } + for _ in 0_usize..6 { spotty.speak(); } assert_eq!(spotty.len(), 8); assert!((spotty.contains_key(&2))); assert_eq!(spotty.get(&3), &cat_type::tuxedo); diff --git a/src/test/run-pass/class-implement-trait-cross-crate.rs b/src/test/run-pass/class-implement-trait-cross-crate.rs index 8c36174d5f..bd05221b8c 100644 --- a/src/test/run-pass/class-implement-trait-cross-crate.rs +++ b/src/test/run-pass/class-implement-trait-cross-crate.rs @@ -40,8 +40,8 @@ impl noisy for cat { impl cat { fn meow(&mut self) { println!("Meow"); - self.meows += 1u; - if self.meows % 5u == 0u { + self.meows += 1_usize; + if self.meows % 5_usize == 0_usize { self.how_hungry += 1; } } @@ -57,9 +57,9 @@ fn cat(in_x : uint, in_y : int, in_name: String) -> cat { pub fn main() { - let mut nyan = cat(0u, 2, "nyan".to_string()); + let mut nyan = cat(0_usize, 2, "nyan".to_string()); nyan.eat(); assert!((!nyan.eat())); - for _ in range(1u, 10u) { nyan.speak(); }; + for _ in 1_usize..10_usize { nyan.speak(); }; assert!((nyan.eat())); } diff --git a/src/test/run-pass/class-implement-traits.rs b/src/test/run-pass/class-implement-traits.rs index cf08cd2709..87e6e5f675 100644 --- a/src/test/run-pass/class-implement-traits.rs +++ b/src/test/run-pass/class-implement-traits.rs @@ -24,8 +24,8 @@ struct cat { impl cat { fn meow(&mut self) { println!("Meow"); - self.meows += 1u; - if self.meows % 5u == 0u { + self.meows += 1_usize; + if self.meows % 5_usize == 0_usize { self.how_hungry += 1; } } @@ -62,10 +62,10 @@ fn make_speak(mut c: C) { } pub fn main() { - let mut nyan = cat(0u, 2, "nyan".to_string()); + let mut nyan = cat(0_usize, 2, "nyan".to_string()); nyan.eat(); assert!((!nyan.eat())); - for _ in range(1u, 10u) { + for _ in 1_usize..10_usize { make_speak(nyan.clone()); } } diff --git a/src/test/run-pass/class-method-cross-crate.rs b/src/test/run-pass/class-method-cross-crate.rs index e05ed750b5..47cc500e44 100644 --- a/src/test/run-pass/class-method-cross-crate.rs +++ b/src/test/run-pass/class-method-cross-crate.rs @@ -13,8 +13,8 @@ extern crate cci_class_2; use cci_class_2::kitties::cat; pub fn main() { - let nyan : cat = cat(52u, 99); - let kitty = cat(1000u, 2); + let nyan : cat = cat(52_usize, 99); + let kitty = cat(1000_usize, 2); assert_eq!(nyan.how_hungry, 99); assert_eq!(kitty.how_hungry, 2); nyan.speak(); diff --git a/src/test/run-pass/class-methods-cross-crate.rs b/src/test/run-pass/class-methods-cross-crate.rs index 4ff2870077..d62a726dcd 100644 --- a/src/test/run-pass/class-methods-cross-crate.rs +++ b/src/test/run-pass/class-methods-cross-crate.rs @@ -13,10 +13,10 @@ extern crate cci_class_3; use cci_class_3::kitties::cat; pub fn main() { - let mut nyan : cat = cat(52u, 99); - let kitty = cat(1000u, 2); + let mut nyan : cat = cat(52_usize, 99); + let kitty = cat(1000_usize, 2); assert_eq!(nyan.how_hungry, 99); assert_eq!(kitty.how_hungry, 2); nyan.speak(); - assert_eq!(nyan.meow_count(), 53u); + assert_eq!(nyan.meow_count(), 53_usize); } diff --git a/src/test/run-pass/class-methods.rs b/src/test/run-pass/class-methods.rs index 25a2009bb9..18fb03ec93 100644 --- a/src/test/run-pass/class-methods.rs +++ b/src/test/run-pass/class-methods.rs @@ -15,7 +15,7 @@ struct cat { } impl cat { - pub fn speak(&mut self) { self.meows += 1u; } + pub fn speak(&mut self) { self.meows += 1_usize; } pub fn meow_count(&mut self) -> uint { self.meows } } @@ -27,10 +27,10 @@ fn cat(in_x: uint, in_y: int) -> cat { } pub fn main() { - let mut nyan: cat = cat(52u, 99); - let kitty = cat(1000u, 2); + let mut nyan: cat = cat(52_usize, 99); + let kitty = cat(1000_usize, 2); assert_eq!(nyan.how_hungry, 99); assert_eq!(kitty.how_hungry, 2); nyan.speak(); - assert_eq!(nyan.meow_count(), 53u); + assert_eq!(nyan.meow_count(), 53_usize); } diff --git a/src/test/run-pass/class-poly-methods-cross-crate.rs b/src/test/run-pass/class-poly-methods-cross-crate.rs index 94c78522df..edbbc4f5b3 100644 --- a/src/test/run-pass/class-poly-methods-cross-crate.rs +++ b/src/test/run-pass/class-poly-methods-cross-crate.rs @@ -13,12 +13,12 @@ extern crate cci_class_6; use cci_class_6::kitties::cat; pub fn main() { - let mut nyan : cat = cat::(52u, 99, vec!('p')); - let mut kitty = cat(1000u, 2, vec!("tabby".to_string())); + let mut nyan : cat = cat::(52_usize, 99, vec!('p')); + let mut kitty = cat(1000_usize, 2, vec!("tabby".to_string())); assert_eq!(nyan.how_hungry, 99); assert_eq!(kitty.how_hungry, 2); - nyan.speak(vec!(1u,2u,3u)); - assert_eq!(nyan.meow_count(), 55u); + nyan.speak(vec!(1_usize,2_usize,3_usize)); + assert_eq!(nyan.meow_count(), 55_usize); kitty.speak(vec!("meow".to_string(), "mew".to_string(), "purr".to_string(), "chirp".to_string())); - assert_eq!(kitty.meow_count(), 1004u); + assert_eq!(kitty.meow_count(), 1004_usize); } diff --git a/src/test/run-pass/class-poly-methods.rs b/src/test/run-pass/class-poly-methods.rs index d94547a4dd..b529b0a077 100644 --- a/src/test/run-pass/class-poly-methods.rs +++ b/src/test/run-pass/class-poly-methods.rs @@ -32,12 +32,12 @@ fn cat(in_x : uint, in_y : int, in_info: Vec ) -> cat { } pub fn main() { - let mut nyan : cat = cat::(52u, 99, vec!(9)); - let mut kitty = cat(1000u, 2, vec!("tabby".to_string())); + let mut nyan : cat = cat::(52_usize, 99, vec!(9)); + let mut kitty = cat(1000_usize, 2, vec!("tabby".to_string())); assert_eq!(nyan.how_hungry, 99); assert_eq!(kitty.how_hungry, 2); - nyan.speak(vec!(1i,2,3)); - assert_eq!(nyan.meow_count(), 55u); + nyan.speak(vec!(1,2,3)); + assert_eq!(nyan.meow_count(), 55_usize); kitty.speak(vec!("meow".to_string(), "mew".to_string(), "purr".to_string(), "chirp".to_string())); - assert_eq!(kitty.meow_count(), 1004u); + assert_eq!(kitty.meow_count(), 1004_usize); } diff --git a/src/test/run-pass/class-separate-impl.rs b/src/test/run-pass/class-separate-impl.rs index c2fa98a66d..575c32baea 100644 --- a/src/test/run-pass/class-separate-impl.rs +++ b/src/test/run-pass/class-separate-impl.rs @@ -39,8 +39,8 @@ impl cat { impl cat { fn meow(&mut self) { println!("Meow"); - self.meows += 1u; - if self.meows % 5u == 0u { + self.meows += 1_usize; + if self.meows % 5_usize == 0_usize { self.how_hungry += 1; } } @@ -67,6 +67,6 @@ fn print_out(thing: Box, expected: String) { } pub fn main() { - let nyan: Box = box cat(0u, 2, "nyan".to_string()) as Box; + let nyan: Box = box cat(0_usize, 2, "nyan".to_string()) as Box; print_out(nyan, "nyan".to_string()); } diff --git a/src/test/run-pass/class-typarams.rs b/src/test/run-pass/class-typarams.rs index 9d4e73da81..b56a749d33 100644 --- a/src/test/run-pass/class-typarams.rs +++ b/src/test/run-pass/class-typarams.rs @@ -8,26 +8,29 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::marker::PhantomData; + struct cat { meows : uint, - how_hungry : int, + m: PhantomData } impl cat { - pub fn speak(&mut self) { self.meows += 1u; } + pub fn speak(&mut self) { self.meows += 1_usize; } pub fn meow_count(&mut self) -> uint { self.meows } } fn cat(in_x : uint, in_y : int) -> cat { cat { meows: in_x, - how_hungry: in_y + how_hungry: in_y, + m: PhantomData } } pub fn main() { - let _nyan : cat = cat::(52u, 99); - // let mut kitty = cat(1000u, 2); + let _nyan : cat = cat::(52_usize, 99); + // let mut kitty = cat(1000_usize, 2); } diff --git a/src/test/run-pass/classes-cross-crate.rs b/src/test/run-pass/classes-cross-crate.rs index 61ed0016d0..aae17abcc5 100644 --- a/src/test/run-pass/classes-cross-crate.rs +++ b/src/test/run-pass/classes-cross-crate.rs @@ -13,9 +13,9 @@ extern crate cci_class_4; use cci_class_4::kitties::cat; pub fn main() { - let mut nyan = cat(0u, 2, "nyan".to_string()); + let mut nyan = cat(0_usize, 2, "nyan".to_string()); nyan.eat(); assert!((!nyan.eat())); - for _ in range(1u, 10u) { nyan.speak(); }; + for _ in 1_usize..10_usize { nyan.speak(); }; assert!((nyan.eat())); } diff --git a/src/test/run-pass/classes-simple-cross-crate.rs b/src/test/run-pass/classes-simple-cross-crate.rs index f6f742fb1d..8037d77807 100644 --- a/src/test/run-pass/classes-simple-cross-crate.rs +++ b/src/test/run-pass/classes-simple-cross-crate.rs @@ -13,8 +13,8 @@ extern crate cci_class; use cci_class::kitties::cat; pub fn main() { - let nyan : cat = cat(52u, 99); - let kitty = cat(1000u, 2); + let nyan : cat = cat(52_usize, 99); + let kitty = cat(1000_usize, 2); assert_eq!(nyan.how_hungry, 99); assert_eq!(kitty.how_hungry, 2); } diff --git a/src/test/run-pass/classes-simple-method.rs b/src/test/run-pass/classes-simple-method.rs index 6f21afff12..b15d6544fe 100644 --- a/src/test/run-pass/classes-simple-method.rs +++ b/src/test/run-pass/classes-simple-method.rs @@ -26,8 +26,8 @@ fn cat(in_x : uint, in_y : int) -> cat { } pub fn main() { - let mut nyan : cat = cat(52u, 99); - let kitty = cat(1000u, 2); + let mut nyan : cat = cat(52_usize, 99); + let kitty = cat(1000_usize, 2); assert_eq!(nyan.how_hungry, 99); assert_eq!(kitty.how_hungry, 2); nyan.speak(); diff --git a/src/test/run-pass/classes-simple.rs b/src/test/run-pass/classes-simple.rs index 496efc2172..9bf8df3ce4 100644 --- a/src/test/run-pass/classes-simple.rs +++ b/src/test/run-pass/classes-simple.rs @@ -22,8 +22,8 @@ fn cat(in_x : uint, in_y : int) -> cat { } pub fn main() { - let nyan : cat = cat(52u, 99); - let kitty = cat(1000u, 2); + let nyan : cat = cat(52_usize, 99); + let kitty = cat(1000_usize, 2); assert_eq!(nyan.how_hungry, 99); assert_eq!(kitty.how_hungry, 2); } diff --git a/src/test/run-pass/classes.rs b/src/test/run-pass/classes.rs index 5d1296cf46..4fabca491b 100644 --- a/src/test/run-pass/classes.rs +++ b/src/test/run-pass/classes.rs @@ -33,8 +33,8 @@ impl cat { impl cat { fn meow(&mut self) { println!("Meow"); - self.meows += 1u; - if self.meows % 5u == 0u { + self.meows += 1_usize; + if self.meows % 5_usize == 0_usize { self.how_hungry += 1; } } @@ -49,9 +49,9 @@ fn cat(in_x : uint, in_y : int, in_name: String) -> cat { } pub fn main() { - let mut nyan = cat(0u, 2, "nyan".to_string()); + let mut nyan = cat(0_usize, 2, "nyan".to_string()); nyan.eat(); assert!((!nyan.eat())); - for _ in range(1u, 10u) { nyan.speak(); }; + for _ in 1_usize..10_usize { nyan.speak(); }; assert!((nyan.eat())); } diff --git a/src/test/run-pass/cleanup-rvalue-for-scope.rs b/src/test/run-pass/cleanup-rvalue-for-scope.rs index 8969cca261..f69a0332cc 100644 --- a/src/test/run-pass/cleanup-rvalue-for-scope.rs +++ b/src/test/run-pass/cleanup-rvalue-for-scope.rs @@ -61,7 +61,7 @@ impl Drop for AddFlags { pub fn main() { // The array containing [AddFlags] should not be dropped until // after the for loop: - for x in [AddFlags(1)].iter() { + for x in &[AddFlags(1)] { check_flags(0); } check_flags(1); diff --git a/src/test/run-pass/cleanup-rvalue-scopes.rs b/src/test/run-pass/cleanup-rvalue-scopes.rs index bbfe0e6a18..b5bf35a700 100644 --- a/src/test/run-pass/cleanup-rvalue-scopes.rs +++ b/src/test/run-pass/cleanup-rvalue-scopes.rs @@ -12,6 +12,7 @@ // statement or end of block, as appropriate given the temporary // lifetime rules. +#![feature(box_patterns)] #![feature(box_syntax)] use std::ops::Drop; @@ -110,7 +111,7 @@ pub fn main() { end_of_block!(ref _x, AddFlags(1)); end_of_block!(AddFlags { bits: ref _x }, AddFlags(1)); end_of_block!(&AddFlags { bits }, &AddFlags(1)); - end_of_block!((_, ref _y), (AddFlags(1), 22i)); + end_of_block!((_, ref _y), (AddFlags(1), 22)); end_of_block!(box ref _x, box AddFlags(1)); end_of_block!(box _x, box AddFlags(1)); end_of_block!(_, { { check_flags(0); &AddFlags(1) } }); @@ -120,7 +121,7 @@ pub fn main() { // LHS does not create a ref binding, so temporary lives as long // as statement, and we do not move the AddFlags out: end_of_stmt!(_, AddFlags(1)); - end_of_stmt!((_, _), (AddFlags(1), 22i)); + end_of_stmt!((_, _), (AddFlags(1), 22)); // `&` operator appears inside an arg to a function, // so it is not prolonged: diff --git a/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs b/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs index 04ab0d881a..96ae7e3d33 100644 --- a/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs +++ b/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs @@ -27,7 +27,7 @@ #![allow(unknown_features)] #![feature(box_syntax)] -use std::thread::Thread; +use std::thread; enum Conzabble { Bickwick(Foo) @@ -44,9 +44,9 @@ fn get_bar(x: uint) -> Vec { vec!(x * 2) } pub fn fails() { let x = 2; let mut y = Vec::new(); - y.push(box Conzabble::Bickwick(do_it(get_bar(x).as_slice()))); + y.push(box Conzabble::Bickwick(do_it(&get_bar(x)))); } pub fn main() { - Thread::scoped(fails).join(); + thread::spawn(fails).join(); } diff --git a/src/test/run-pass/cleanup-shortcircuit.rs b/src/test/run-pass/cleanup-shortcircuit.rs index 7dd46e7b01..59f63a79c3 100644 --- a/src/test/run-pass/cleanup-shortcircuit.rs +++ b/src/test/run-pass/cleanup-shortcircuit.rs @@ -20,11 +20,10 @@ // Test that cleanups for the RHS of shortcircuiting operators work. -use std::os; +use std::env; pub fn main() { - let args = os::args(); - let args = args.as_slice(); + let args: Vec = env::args().collect(); // Here, the rvalue `"signal".to_string()` requires cleanup. Older versions // of the code had a problem that the cleanup scope for this @@ -32,7 +31,7 @@ pub fn main() { // expression was never evaluated, we wound up trying to clean // uninitialized memory. - if args.len() >= 2 && args[1].as_slice() == "signal" { + if args.len() >= 2 && args[1] == "signal" { // Raise a segfault. unsafe { *(0 as *mut int) = 0; } } diff --git a/src/test/run-pass/closure-inference.rs b/src/test/run-pass/closure-inference.rs index 893003dd99..3bd0273216 100644 --- a/src/test/run-pass/closure-inference.rs +++ b/src/test/run-pass/closure-inference.rs @@ -9,11 +9,11 @@ // except according to those terms. -fn foo(i: int) -> int { i + 1 } +fn foo(i: isize) -> isize { i + 1 } fn apply(f: F, v: A) -> A where F: FnOnce(A) -> A { f(v) } pub fn main() { - let f = {|: i| foo(i)}; + let f = {|i| foo(i)}; assert_eq!(apply(f, 2), 3); } diff --git a/src/test/run-pass/closure-inference2.rs b/src/test/run-pass/closure-inference2.rs index 03b10b881f..fa16ea0014 100644 --- a/src/test/run-pass/closure-inference2.rs +++ b/src/test/run-pass/closure-inference2.rs @@ -11,7 +11,7 @@ // Test a rather underspecified example: pub fn main() { - let f = {|&: i| i}; - assert_eq!(f(2i), 2i); - assert_eq!(f(5i), 5i); + let f = {|i| i}; + assert_eq!(f(2), 2); + assert_eq!(f(5), 5); } diff --git a/src/test/run-pass/closure-reform.rs b/src/test/run-pass/closure-reform.rs index a2e7d7bd7e..a4495c3c68 100644 --- a/src/test/run-pass/closure-reform.rs +++ b/src/test/run-pass/closure-reform.rs @@ -14,7 +14,7 @@ #![feature(unboxed_closures)] use std::mem; -use std::io::stdio::println; +use std::old_io::stdio::println; fn call_it(f: F) where F : FnOnce(String) -> String diff --git a/src/test/run-pass/coerce-expect-unsized.rs b/src/test/run-pass/coerce-expect-unsized.rs index 3964d54f86..ee19d9e69b 100644 --- a/src/test/run-pass/coerce-expect-unsized.rs +++ b/src/test/run-pass/coerce-expect-unsized.rs @@ -11,7 +11,7 @@ #![allow(unknown_features)] #![feature(box_syntax)] -use std::fmt::Show; +use std::fmt::Debug; // Check that coercions apply at the pointer level and don't cause // rvalue expressions to be unsized. See #20169 for more information. @@ -21,13 +21,21 @@ pub fn main() { let _: Box<[int]> = box if true { [1, 2, 3] } else { [1, 3, 4] }; let _: Box<[int]> = box match true { true => [1, 2, 3], false => [1, 3, 4] }; let _: Box _> = box { |x| (x as u8) }; - let _: Box = box if true { false } else { true }; - let _: Box = box match true { true => 'a', false => 'b' }; + let _: Box = box if true { false } else { true }; + let _: Box = box 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 _: &Show = &if true { false } else { true }; - let _: &Show = &match true { true => 'a', false => 'b' }; + 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 _> = Box::new(|x| (x as u8)); + + let _: Vec _>> = vec![ + Box::new(|x| (x as u8)), + box |x| (x as i16 as u8), + ]; } diff --git a/src/test/run-pass/coerce-match-calls.rs b/src/test/run-pass/coerce-match-calls.rs index 0ff28b471a..34c9875f1d 100644 --- a/src/test/run-pass/coerce-match-calls.rs +++ b/src/test/run-pass/coerce-match-calls.rs @@ -13,9 +13,9 @@ use std::boxed::Box; pub fn main() { - let _: Box<[int]> = if true { Box::new([1i, 2, 3]) } else { Box::new([1i]) }; + let _: Box<[int]> = if true { Box::new([1, 2, 3]) } else { Box::new([1]) }; - let _: Box<[int]> = match true { true => Box::new([1i, 2, 3]), false => Box::new([1i]) }; + let _: Box<[int]> = 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; diff --git a/src/test/run-pass/coerce-match.rs b/src/test/run-pass/coerce-match.rs index 0992ee97d0..098a08b078 100644 --- a/src/test/run-pass/coerce-match.rs +++ b/src/test/run-pass/coerce-match.rs @@ -14,9 +14,9 @@ #![feature(box_syntax)] pub fn main() { - let _: Box<[int]> = if true { box [1i, 2, 3] } else { box [1i] }; + let _: Box<[int]> = if true { box [1, 2, 3] } else { box [1] }; - let _: Box<[int]> = match true { true => box [1i, 2, 3], false => box [1i] }; + let _: Box<[int]> = match true { true => box [1, 2, 3], false => box [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; diff --git a/src/test/run-pass/coerce-overloaded-autoderef.rs b/src/test/run-pass/coerce-overloaded-autoderef.rs new file mode 100644 index 0000000000..ec8d58616d --- /dev/null +++ b/src/test/run-pass/coerce-overloaded-autoderef.rs @@ -0,0 +1,69 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::rc::Rc; + +// Examples from the "deref coercions" RFC, at rust-lang/rfcs#241. + +fn use_ref(_: &T) {} +fn use_mut(_: &mut T) {} + +fn use_rc(t: Rc) { + use_ref(&*t); // what you have to write today + use_ref(&t); // what you'd be able to write + use_ref(&&&&&&t); + use_ref(&mut &&&&&t); + use_ref(&&&mut &&&t); +} + +fn use_mut_box(mut t: &mut Box) { + use_mut(&mut *t); // what you have to write today + use_mut(t); // what you'd be able to write + use_mut(&mut &mut &mut t); + + use_ref(&*t); // what you have to write today + use_ref(t); // what you'd be able to write + use_ref(&&&&&&t); + use_ref(&mut &&&&&t); + use_ref(&&&mut &&&t); +} + +fn use_nested(t: &Box) { + use_ref(&**t); // what you have to write today + use_ref(t); // what you'd be able to write (note: recursive deref) + use_ref(&&&&&&t); + use_ref(&mut &&&&&t); + use_ref(&&&mut &&&t); +} + +fn use_slice(_: &[u8]) {} +fn use_slice_mut(_: &mut [u8]) {} + +fn use_vec(mut v: Vec) { + use_slice_mut(&mut v[..]); // what you have to write today + use_slice_mut(&mut v); // what you'd be able to write + use_slice_mut(&mut &mut &mut v); + + use_slice(&v[..]); // what you have to write today + use_slice(&v); // what you'd be able to write + use_slice(&&&&&&v); + use_slice(&mut &&&&&v); + use_slice(&&&mut &&&v); +} + +fn use_vec_ref(v: &Vec) { + use_slice(&v[..]); // what you have to write today + use_slice(v); // what you'd be able to write + use_slice(&&&&&&v); + use_slice(&mut &&&&&v); + use_slice(&&&mut &&&v); +} + +pub fn main() {} diff --git a/src/test/run-pass/coerce-reborrow-imm-vec-arg.rs b/src/test/run-pass/coerce-reborrow-imm-vec-arg.rs index f6abfda03e..b6b30e2fe9 100644 --- a/src/test/run-pass/coerce-reborrow-imm-vec-arg.rs +++ b/src/test/run-pass/coerce-reborrow-imm-vec-arg.rs @@ -10,7 +10,7 @@ fn sum(x: &[int]) -> int { let mut sum = 0; - for y in x.iter() { sum += *y; } + for y in x { sum += *y; } return sum; } diff --git a/src/test/run-pass/coerce-reborrow-imm-vec-rcvr.rs b/src/test/run-pass/coerce-reborrow-imm-vec-rcvr.rs index 646eed5de7..ade18a7125 100644 --- a/src/test/run-pass/coerce-reborrow-imm-vec-rcvr.rs +++ b/src/test/run-pass/coerce-reborrow-imm-vec-rcvr.rs @@ -18,7 +18,7 @@ fn bip(v: &[uint]) -> Vec { } pub fn main() { - let mut the_vec = vec!(1u, 2, 3, 100); - assert_eq!(the_vec.clone(), bar(the_vec.as_mut_slice())); - assert_eq!(the_vec.clone(), bip(the_vec.as_slice())); + let mut the_vec = vec!(1_usize, 2, 3, 100); + assert_eq!(the_vec.clone(), bar(&mut the_vec)); + assert_eq!(the_vec.clone(), bip(&the_vec)); } diff --git a/src/test/run-pass/coerce-reborrow-mut-vec-arg.rs b/src/test/run-pass/coerce-reborrow-mut-vec-arg.rs index 10d747bf41..f87f2e07c9 100644 --- a/src/test/run-pass/coerce-reborrow-mut-vec-arg.rs +++ b/src/test/run-pass/coerce-reborrow-mut-vec-arg.rs @@ -21,6 +21,6 @@ fn bar(v: &mut [uint]) { pub fn main() { let mut the_vec = vec!(1, 2, 3, 100); - bar(the_vec.as_mut_slice()); + bar(&mut the_vec); assert_eq!(the_vec, vec!(100, 3, 2, 1)); } diff --git a/src/test/run-pass/coerce-reborrow-mut-vec-rcvr.rs b/src/test/run-pass/coerce-reborrow-mut-vec-rcvr.rs index 6820aa4d18..4f97e6a208 100644 --- a/src/test/run-pass/coerce-reborrow-mut-vec-rcvr.rs +++ b/src/test/run-pass/coerce-reborrow-mut-vec-rcvr.rs @@ -17,6 +17,6 @@ fn bar(v: &mut [uint]) { pub fn main() { let mut the_vec = vec!(1, 2, 3, 100); - bar(the_vec.as_mut_slice()); + bar(&mut the_vec); assert_eq!(the_vec, vec!(100, 3, 2, 1)); } diff --git a/src/test/run-pass/coerce-unify-return.rs b/src/test/run-pass/coerce-unify-return.rs new file mode 100644 index 0000000000..eeba9042f7 --- /dev/null +++ b/src/test/run-pass/coerce-unify-return.rs @@ -0,0 +1,26 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Check that coercions unify the expected return type of a polymorphic +// function call, instead of leaving the type variables as they were. + +struct Foo; +impl Foo { + fn foo(self, x: T) -> Option { Some(x) } +} + +pub fn main() { + let _: Option = Some(main); + let _: Option = Foo.foo(main); + + // The same two cases, with implicit type variables made explicit. + let _: Option = Some::<_>(main); + let _: Option = Foo.foo::<_>(main); +} diff --git a/src/test/compile-fail/coherence-bigint-int.rs b/src/test/run-pass/coherence-bigint-int.rs similarity index 92% rename from src/test/compile-fail/coherence-bigint-int.rs rename to src/test/run-pass/coherence-bigint-int.rs index 684773098c..baf2f57206 100644 --- a/src/test/compile-fail/coherence-bigint-int.rs +++ b/src/test/run-pass/coherence-bigint-int.rs @@ -15,6 +15,6 @@ use lib::Remote1; pub struct BigInt; -impl Remote1 for isize { } //~ ERROR E0117 +impl Remote1 for isize { } fn main() { } diff --git a/src/test/compile-fail/coherence-bigint-vecint.rs b/src/test/run-pass/coherence-bigint-vecint.rs similarity index 91% rename from src/test/compile-fail/coherence-bigint-vecint.rs rename to src/test/run-pass/coherence-bigint-vecint.rs index 28747674b8..cdc5bc1171 100644 --- a/src/test/compile-fail/coherence-bigint-vecint.rs +++ b/src/test/run-pass/coherence-bigint-vecint.rs @@ -15,6 +15,6 @@ use lib::Remote1; pub struct BigInt; -impl Remote1 for Vec { } //~ ERROR E0117 +impl Remote1 for Vec { } fn main() { } diff --git a/src/test/compile-fail/deriving-span-Rand-enum-struct-variant.rs b/src/test/run-pass/coherence-cow-1.rs similarity index 63% rename from src/test/compile-fail/deriving-span-Rand-enum-struct-variant.rs rename to src/test/run-pass/coherence-cow-1.rs index 4d3542c586..b380372b40 100644 --- a/src/test/compile-fail/deriving-span-Rand-enum-struct-variant.rs +++ b/src/test/run-pass/coherence-cow-1.rs @@ -8,18 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' +// aux-build:coherence-lib.rs -extern crate rand; +// Test that it's ok for T to appear first in the self-type, as long +// as it's covered somewhere. +extern crate "coherence-lib" as lib; +use lib::{Remote,Pair}; -struct Error; +pub struct Cover(T); -#[derive(Rand)] -enum Enum { - A { - x: Error //~ ERROR - } -} +impl Remote for Pair> { } -fn main() {} +fn main() { } diff --git a/src/test/run-pass/coherence-cow-2.rs b/src/test/run-pass/coherence-cow-2.rs new file mode 100644 index 0000000000..93e507c0d6 --- /dev/null +++ b/src/test/run-pass/coherence-cow-2.rs @@ -0,0 +1,23 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:coherence-lib.rs + +// Test that it's ok for T to appear second in the self-type, as long +// as it's covered somewhere. + +extern crate "coherence-lib" as lib; +use lib::{Remote,Pair}; + +pub struct Cover(T); + +impl Remote for Pair,T> { } + +fn main() { } diff --git a/src/test/run-pass/coherence-impl-in-fn.rs b/src/test/run-pass/coherence-impl-in-fn.rs index df0012e07e..6edd7390f0 100644 --- a/src/test/run-pass/coherence-impl-in-fn.rs +++ b/src/test/run-pass/coherence-impl-in-fn.rs @@ -9,8 +9,8 @@ // except according to those terms. pub fn main() { + #[derive(Copy)] enum x { foo } - impl Copy for x {} impl ::std::cmp::PartialEq for x { fn eq(&self, other: &x) -> bool { (*self) as int == (*other) as int diff --git a/src/test/run-pass/coherence-negative-impls-safe.rs b/src/test/run-pass/coherence-negative-impls-safe.rs new file mode 100644 index 0000000000..7844ef3fac --- /dev/null +++ b/src/test/run-pass/coherence-negative-impls-safe.rs @@ -0,0 +1,19 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(optin_builtin_traits)] + +use std::marker::Send; + +struct TestType; + +impl !Send for TestType {} + +fn main() {} diff --git a/src/test/run-pass/coherence-where-clause.rs b/src/test/run-pass/coherence-where-clause.rs index 99c475b720..9f980e161b 100644 --- a/src/test/run-pass/coherence-where-clause.rs +++ b/src/test/run-pass/coherence-where-clause.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::fmt::Show; +use std::fmt::Debug; use std::default::Default; trait MyTrait { @@ -23,25 +23,23 @@ impl MyTrait for T } } -#[derive(Clone,Show,PartialEq)] +#[derive(Clone, Copy, Debug, PartialEq)] struct MyType { dummy: uint } -impl Copy for MyType {} - impl MyTrait for MyType { fn get(&self) -> MyType { (*self).clone() } } fn test_eq(m: M, n: M) -where M : MyTrait + Show + PartialEq +where M : MyTrait + Debug + PartialEq { assert_eq!(m.get(), n); } pub fn main() { - test_eq(0u, 0u); + test_eq(0_usize, 0_usize); let value = MyType { dummy: 256 + 22 }; test_eq(value, value); diff --git a/src/test/run-pass/colorful-write-macros.rs b/src/test/run-pass/colorful-write-macros.rs index ca7f761b80..841aaa94e9 100644 --- a/src/test/run-pass/colorful-write-macros.rs +++ b/src/test/run-pass/colorful-write-macros.rs @@ -11,7 +11,7 @@ // no-pretty-expanded #![allow(unused_must_use, dead_code, deprecated)] -use std::io::MemWriter; +use std::old_io::MemWriter; use std::fmt; struct Foo<'a> { @@ -21,7 +21,7 @@ struct Foo<'a> { struct Bar; -impl fmt::Writer for Bar { +impl fmt::Write for Bar { fn write_str(&mut self, _: &str) -> fmt::Result { Ok(()) } @@ -39,7 +39,7 @@ fn main() { let mut s = Bar; { - use std::fmt::Writer; + use std::fmt::Write; write!(&mut s, "test"); } } diff --git a/src/test/run-pass/complex.rs b/src/test/run-pass/complex.rs index 34292453ec..f8c8ac20d7 100644 --- a/src/test/run-pass/complex.rs +++ b/src/test/run-pass/complex.rs @@ -35,8 +35,8 @@ fn foo(x: int) -> int { } pub fn main() { - let x: int = 2i + 2; + let x: int = 2 + 2; println!("{}", x); println!("hello, world"); - println!("{}", 10i); + println!("{}", 10); } diff --git a/src/test/run-pass/concat.rs b/src/test/run-pass/concat.rs index d78f948edc..b0c3a5922b 100644 --- a/src/test/run-pass/concat.rs +++ b/src/test/run-pass/concat.rs @@ -15,12 +15,12 @@ pub fn main() { assert_eq!(concat!("qux", "quux",).to_string(), "quxquux".to_string()); assert_eq!( - concat!(1, 2i, 3u, 4f32, 4.0, 'a', true), + concat!(1, 2, 3_usize, 4f32, 4.0, 'a', true), "12344.0atrue" ); assert!(match "12344.0atrue" { - concat!(1, 2i, 3u, 4f32, 4.0, 'a', true) => true, + concat!(1, 2, 3_usize, 4f32, 4.0, 'a', true) => true, _ => false }) } diff --git a/src/test/run-pass/const-adt-align-mismatch.rs b/src/test/run-pass/const-adt-align-mismatch.rs new file mode 100644 index 0000000000..5377d9a62b --- /dev/null +++ b/src/test/run-pass/const-adt-align-mismatch.rs @@ -0,0 +1,28 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::mem; + +#[derive(PartialEq, Show)] +enum Foo { + A(u32), + Bar([u16; 4]), + C +} + +// NOTE(eddyb) Don't make this a const, needs to be a static +// so it is always instantiated as a LLVM constant value. +static FOO: Foo = Foo::C; + +fn main() { + assert_eq!(FOO, Foo::C); + assert_eq!(mem::size_of::(), 12); + assert_eq!(mem::min_align_of::(), 4); +} diff --git a/src/test/run-pass/const-binops.rs b/src/test/run-pass/const-binops.rs index 11590ceb19..1268fc4e43 100644 --- a/src/test/run-pass/const-binops.rs +++ b/src/test/run-pass/const-binops.rs @@ -52,27 +52,27 @@ static V: int = 1 << 3; static W: int = 1024 >> 4; static X: uint = 1024 >> 4; -static Y: bool = 1i == 1; +static Y: bool = 1 == 1; static Z: bool = 1.0f64 == 1.0; -static AA: bool = 1i <= 2; -static AB: bool = -1i <= 2; +static AA: bool = 1 <= 2; +static AB: bool = -1 <= 2; static AC: bool = 1.0f64 <= 2.0; -static AD: bool = 1i < 2; -static AE: bool = -1i < 2; +static AD: bool = 1 < 2; +static AE: bool = -1 < 2; static AF: bool = 1.0f64 < 2.0; -static AG: bool = 1i != 2; -static AH: bool = -1i != 2; +static AG: bool = 1 != 2; +static AH: bool = -1 != 2; static AI: bool = 1.0f64 != 2.0; -static AJ: bool = 2i >= 1; -static AK: bool = 2i >= -2; +static AJ: bool = 2 >= 1; +static AK: bool = 2 >= -2; static AL: bool = 1.0f64 >= -2.0; -static AM: bool = 2i > 1; -static AN: bool = 2i > -2; +static AM: bool = 2 > 1; +static AN: bool = 2 > -2; static AO: bool = 1.0f64 > -2.0; pub fn main() { diff --git a/src/test/run-pass/const-block.rs b/src/test/run-pass/const-block.rs index 84acd3c4ec..cdb96e5dcb 100644 --- a/src/test/run-pass/const-block.rs +++ b/src/test/run-pass/const-block.rs @@ -14,7 +14,7 @@ use std::marker::Sync; struct Foo { - a: uint, + a: usize, b: *const () } @@ -24,27 +24,24 @@ fn foo(a: T) -> T { a } -static BLOCK_INTEGRAL: uint = { 1 }; +static BLOCK_INTEGRAL: usize = { 1 }; static BLOCK_EXPLICIT_UNIT: () = { () }; static BLOCK_IMPLICIT_UNIT: () = { }; static BLOCK_FLOAT: f64 = { 1.0 }; -static BLOCK_ENUM: Option = { Some(100) }; +static BLOCK_ENUM: Option = { Some(100) }; static BLOCK_STRUCT: Foo = { Foo { a: 12, b: 0 as *const () } }; -static BLOCK_UNSAFE: uint = unsafe { 1000 }; +static BLOCK_UNSAFE: usize = unsafe { 1000 }; -// FIXME: #13970 -// static BLOCK_FN_INFERRED: fn(uint) -> uint = { foo }; +static BLOCK_FN_INFERRED: fn(usize) -> usize = { foo }; -// FIXME: #13971 -// static BLOCK_FN: fn(uint) -> uint = { foo:: }; +static BLOCK_FN: fn(usize) -> usize = { foo:: }; -// FIXME: #13972 -// static BLOCK_ENUM_CONSTRUCTOR: fn(uint) -> Option = { Some }; +static BLOCK_ENUM_CONSTRUCTOR: fn(usize) -> Option = { Some }; -// FIXME: #13973 -// static BLOCK_UNSAFE_SAFE_PTR: &'static int = unsafe { &*(0xdeadbeef as *int) }; -// static BLOCK_UNSAFE_SAFE_PTR_2: &'static int = unsafe { -// static X: *int = 0xdeadbeef as *int; +// FIXME #13972 +// static BLOCK_UNSAFE_SAFE_PTR: &'static isize = unsafe { &*(0xdeadbeef as *const isize) }; +// static BLOCK_UNSAFE_SAFE_PTR_2: &'static isize = unsafe { +// const X: *const isize = 0xdeadbeef as *const isize; // &*X // }; @@ -57,17 +54,10 @@ pub fn main() { assert_eq!(BLOCK_STRUCT.b, 0 as *const ()); assert_eq!(BLOCK_ENUM, Some(100)); assert_eq!(BLOCK_UNSAFE, 1000); - - // FIXME: #13970 - // assert_eq!(BLOCK_FN_INFERRED(300), 300); - - // FIXME: #13971 - // assert_eq!(BLOCK_FN(300), 300); - - // FIXME: #13972 - // assert_eq!(BLOCK_ENUM_CONSTRUCTOR(200), Some(200)); - - // FIXME: #13973 - // assert_eq!(BLOCK_UNSAFE_SAFE_PTR as *int as uint, 0xdeadbeef_u); - // assert_eq!(BLOCK_UNSAFE_SAFE_PTR_2 as *int as uint, 0xdeadbeef_u); + assert_eq!(BLOCK_FN_INFERRED(300), 300); + assert_eq!(BLOCK_FN(300), 300); + assert_eq!(BLOCK_ENUM_CONSTRUCTOR(200), Some(200)); + // FIXME #13972 + // assert_eq!(BLOCK_UNSAFE_SAFE_PTR as *const isize as usize, 0xdeadbeef_us); + // assert_eq!(BLOCK_UNSAFE_SAFE_PTR_2 as *const isize as usize, 0xdeadbeef_us); } diff --git a/src/test/run-pass/const-bound.rs b/src/test/run-pass/const-bound.rs index 3a6973fe61..93a7d3e1c3 100644 --- a/src/test/run-pass/const-bound.rs +++ b/src/test/run-pass/const-bound.rs @@ -23,7 +23,7 @@ pub fn main() { foo("hi".to_string()); foo(~[1, 2, 3]); foo(F{field: 42}); - foo((1, 2u)); + foo((1, 2_usize)); foo(@1);*/ - foo(box 1i); + foo(box 1); } diff --git a/src/test/run-pass/const-expr-in-vec-repeat.rs b/src/test/run-pass/const-expr-in-vec-repeat.rs index d692f3a87e..0b097c0b06 100644 --- a/src/test/run-pass/const-expr-in-vec-repeat.rs +++ b/src/test/run-pass/const-expr-in-vec-repeat.rs @@ -13,6 +13,6 @@ pub fn main() { const FOO: uint = 2; - let _v = [0i; FOO*3*2/2]; + let _v = [0; FOO*3*2/2]; } diff --git a/src/test/run-pass/const-nullary-univariant-enum.rs b/src/test/run-pass/const-nullary-univariant-enum.rs index 9a1a5de936..86b194f2eb 100644 --- a/src/test/run-pass/const-nullary-univariant-enum.rs +++ b/src/test/run-pass/const-nullary-univariant-enum.rs @@ -8,12 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[derive(Copy)] enum Foo { Bar = 0xDEADBEE } -impl Copy for Foo {} - static X: Foo = Foo::Bar; pub fn main() { diff --git a/src/test/run-pass/const-polymorphic-paths.rs b/src/test/run-pass/const-polymorphic-paths.rs index 28b346c9ed..dce12030f7 100644 --- a/src/test/run-pass/const-polymorphic-paths.rs +++ b/src/test/run-pass/const-polymorphic-paths.rs @@ -10,9 +10,11 @@ #![feature(macro_rules)] -use std::collections::Bitv; +use std::borrow::{Cow, IntoCow}; +use std::collections::BitVec; use std::default::Default; use std::iter::FromIterator; +use std::ops::Add; use std::option::IntoIter as OptionIter; use std::rand::Rand; use std::rand::XorShiftRng as DummyRng; @@ -28,6 +30,11 @@ fn u8_as_i8(x: u8) -> i8 { x as i8 } fn odd(x: uint) -> bool { x % 2 == 1 } fn dummy_rng() -> DummyRng { DummyRng::new_unseeded() } +trait Size: Sized { + fn size() -> uint { std::mem::size_of::() } +} +impl Size for T {} + macro_rules! tests { ($($expr:expr, $ty:ty, ($($test:expr),*);)+) => (pub fn main() {$({ const C: $ty = $expr; @@ -56,8 +63,8 @@ tests! { Vec::<()>::new, fn() -> Vec<()>, (); Vec::with_capacity, fn(uint) -> Vec<()>, (5); Vec::<()>::with_capacity, fn(uint) -> Vec<()>, (5); - Bitv::from_fn, fn(uint, fn(uint) -> bool) -> Bitv, (5, odd); - Bitv::from_fn:: bool>, fn(uint, fn(uint) -> bool) -> Bitv, (5, odd); + BitVec::from_fn, fn(uint, fn(uint) -> bool) -> BitVec, (5, odd); + BitVec::from_fn:: bool>, fn(uint, fn(uint) -> bool) -> BitVec, (5, odd); // Inherent non-static method. Vec::map_in_place, fn(Vec, fn(u8) -> i8) -> Vec, (vec![b'f', b'o', b'o'], u8_as_i8); @@ -70,14 +77,31 @@ tests! { // , (vec![b'f', b'o', b'o'], u8_as_i8); // Trait static methods. - // FIXME qualified path expressions aka UFCS i.e. ::method. + ::size, fn() -> uint, (); Default::default, fn() -> int, (); + ::default, fn() -> int, (); Rand::rand, fn(&mut DummyRng) -> int, (&mut dummy_rng()); + ::rand, fn(&mut DummyRng) -> int, (&mut dummy_rng()); Rand::rand::, fn(&mut DummyRng) -> int, (&mut dummy_rng()); + ::rand::, fn(&mut DummyRng) -> int, (&mut dummy_rng()); // Trait non-static methods. Clone::clone, fn(&int) -> int, (&5); + ::clone, fn(&int) -> int, (&5); FromIterator::from_iter, fn(OptionIter) -> Vec, (Some(5).into_iter()); - FromIterator::from_iter::>, fn(OptionIter) -> Vec - , (Some(5).into_iter()); + as FromIterator<_>>::from_iter, fn(OptionIter) -> Vec, + (Some(5).into_iter()); + as FromIterator<_>>::from_iter, fn(OptionIter) -> Vec, + (Some(5).into_iter()); + FromIterator::from_iter::>, fn(OptionIter) -> Vec, + (Some(5).into_iter()); + as FromIterator<_>>::from_iter::>, fn(OptionIter) -> Vec, + (Some(5).into_iter()); + Add::add, fn(i32, i32) -> i32, (5, 6); + >::add, fn(i32, i32) -> i32, (5, 6); + >::add, fn(i32, i32) -> i32, (5, 6); + >::into_cow, fn(String) -> Cow<'static, str>, + ("foo".to_string()); + >::into_cow, fn(String) -> Cow<'static, str>, + ("foo".to_string()); } diff --git a/src/test/run-pass/const-struct.rs b/src/test/run-pass/const-struct.rs index b2073a8ff2..27c514160c 100644 --- a/src/test/run-pass/const-struct.rs +++ b/src/test/run-pass/const-struct.rs @@ -10,7 +10,7 @@ use std::cmp; -#[derive(Show)] +#[derive(Debug)] struct foo { a: int, b: int, c: int } impl cmp::PartialEq for foo { diff --git a/src/test/run-pass/const-vec-of-fns.rs b/src/test/run-pass/const-vec-of-fns.rs index f21f7d1903..4b07b1d3b0 100644 --- a/src/test/run-pass/const-vec-of-fns.rs +++ b/src/test/run-pass/const-vec-of-fns.rs @@ -22,8 +22,8 @@ static mut closures: &'static mut [S] = &mut [S(f as fn()), S(f as fn())]; pub fn main() { unsafe { - for &bare_fn in bare_fns.iter() { bare_fn() } - for closure in closures.iter_mut() { + for &bare_fn in bare_fns { bare_fn() } + for closure in &mut *closures { let S(ref mut closure) = *closure; (*closure)() } diff --git a/src/test/run-pass/consts-in-patterns.rs b/src/test/run-pass/consts-in-patterns.rs index 87b7fcad38..e8f4948a16 100644 --- a/src/test/run-pass/consts-in-patterns.rs +++ b/src/test/run-pass/consts-in-patterns.rs @@ -12,11 +12,11 @@ const FOO: int = 10; const BAR: int = 3; pub fn main() { - let x: int = 3i; + let x: int = 3; let y = match x { - FOO => 1i, - BAR => 2i, - _ => 3i + FOO => 1, + BAR => 2, + _ => 3 }; assert_eq!(y, 2); } diff --git a/src/test/run-pass/copy-out-of-array-1.rs b/src/test/run-pass/copy-out-of-array-1.rs new file mode 100644 index 0000000000..2b57c1ea0d --- /dev/null +++ b/src/test/run-pass/copy-out-of-array-1.rs @@ -0,0 +1,28 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Ensure that we can copy out of a fixed-size array. +// +// (Compare with compile-fail/move-out-of-array-1.rs) + +struct C { _x: u8 } + +impl Copy for C { } + +fn main() { + fn d() -> C { C { _x: 0 } } + + let _d1 = foo([d(), d(), d(), d()], 1); + let _d3 = foo([d(), d(), d(), d()], 3); +} + +fn foo(a: [C; 4], i: usize) -> C { + a[i] +} diff --git a/src/test/run-pass/core-run-destroy.rs b/src/test/run-pass/core-run-destroy.rs index eeb044e560..88d5b74708 100644 --- a/src/test/run-pass/core-run-destroy.rs +++ b/src/test/run-pass/core-run-destroy.rs @@ -19,7 +19,7 @@ extern crate libc; -use std::io::{Process, Command, timer}; +use std::old_io::{Process, Command, timer}; use std::time::Duration; use std::str; use std::sync::mpsc::channel; @@ -56,8 +56,8 @@ fn test_destroy_twice() { } pub fn test_destroy_actually_kills(force: bool) { - use std::io::process::{Command, ProcessOutput, ExitStatus, ExitSignal}; - use std::io::timer; + use std::old_io::process::{Command, ProcessOutput, ExitStatus, ExitSignal}; + use std::old_io::timer; use libc; use std::str; diff --git a/src/test/run-pass/crate-leading-sep.rs b/src/test/run-pass/crate-leading-sep.rs index b2956f4e22..d8b3371325 100644 --- a/src/test/run-pass/crate-leading-sep.rs +++ b/src/test/run-pass/crate-leading-sep.rs @@ -10,5 +10,5 @@ fn main() { use ::std::mem; - mem::drop(2u); + mem::drop(2_usize); } diff --git a/src/test/run-pass/crate-name-attr-used.rs b/src/test/run-pass/crate-name-attr-used.rs index 95c7d33126..f04a760e5f 100644 --- a/src/test/run-pass/crate-name-attr-used.rs +++ b/src/test/run-pass/crate-name-attr-used.rs @@ -8,7 +8,7 @@ // 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-attribute +// compile-flags:--crate-name crate-name-attr-used -F unused-attributes #![crate_name = "crate-name-attr-used"] diff --git a/src/test/run-pass/deref-lval.rs b/src/test/run-pass/deref-lval.rs index ead0683b87..41c74250b3 100644 --- a/src/test/run-pass/deref-lval.rs +++ b/src/test/run-pass/deref-lval.rs @@ -14,7 +14,7 @@ use std::cell::Cell; pub fn main() { - let x = box Cell::new(5i); - x.set(1000i); + let x = box Cell::new(5); + x.set(1000); println!("{}", x.get()); } diff --git a/src/test/run-pass/deref-rc.rs b/src/test/run-pass/deref-rc.rs index 03697875d5..fbb8a3a172 100644 --- a/src/test/run-pass/deref-rc.rs +++ b/src/test/run-pass/deref-rc.rs @@ -11,6 +11,6 @@ use std::rc::Rc; fn main() { - let x = Rc::new([1i, 2, 3, 4]); + let x = Rc::new([1, 2, 3, 4]); assert!(*x == [1, 2, 3, 4]); } diff --git a/src/test/run-pass/derive-no-std.rs b/src/test/run-pass/derive-no-std.rs new file mode 100644 index 0000000000..d3034c2d48 --- /dev/null +++ b/src/test/run-pass/derive-no-std.rs @@ -0,0 +1,41 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(no_std)] +#![no_std] + +extern crate core; +extern crate rand; +extern crate "serialize" as rustc_serialize; +extern crate collections; + +// Issue #16803 + +#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord, + Debug, Default, Copy)] +struct Foo { + x: u32, +} + +#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord, + Debug, Copy)] +enum Bar { + Qux, + Quux(u32), +} + +#[derive(FromPrimitive)] +enum Baz { A=0, B=5, } + +fn main() { + Foo { x: 0 }; + Bar::Quux(3); + Baz::A; +} diff --git a/src/test/run-pass/deriving-clone-generic-enum.rs b/src/test/run-pass/deriving-clone-generic-enum.rs index e8e65dcb8a..e174ffae75 100644 --- a/src/test/run-pass/deriving-clone-generic-enum.rs +++ b/src/test/run-pass/deriving-clone-generic-enum.rs @@ -16,5 +16,5 @@ enum E { } pub fn main() { - let _ = E::A::(1i).clone(); + let _ = E::A::(1).clone(); } diff --git a/src/test/run-pass/deriving-clone-generic-struct.rs b/src/test/run-pass/deriving-clone-generic-struct.rs index d340fe9d3f..329c7dab3e 100644 --- a/src/test/run-pass/deriving-clone-generic-struct.rs +++ b/src/test/run-pass/deriving-clone-generic-struct.rs @@ -16,5 +16,5 @@ struct S { } pub fn main() { - let _ = S { foo: (), bar: (), baz: 1i }.clone(); + let _ = S { foo: (), bar: (), baz: 1 }.clone(); } diff --git a/src/test/run-pass/deriving-clone-generic-tuple-struct.rs b/src/test/run-pass/deriving-clone-generic-tuple-struct.rs index ecf1fdc6e5..bb07b08859 100644 --- a/src/test/run-pass/deriving-clone-generic-tuple-struct.rs +++ b/src/test/run-pass/deriving-clone-generic-tuple-struct.rs @@ -12,5 +12,5 @@ struct S(T, ()); pub fn main() { - let _ = S(1i, ()).clone(); + let _ = S(1, ()).clone(); } diff --git a/src/test/run-pass/deriving-cmp-generic-enum.rs b/src/test/run-pass/deriving-cmp-generic-enum.rs index 04cb3b7c07..b3194d5820 100644 --- a/src/test/run-pass/deriving-cmp-generic-enum.rs +++ b/src/test/run-pass/deriving-cmp-generic-enum.rs @@ -19,10 +19,10 @@ enum E { pub fn main() { let e0 = E::E0; - let e11 = E::E1(1i); - let e12 = E::E1(2i); - let e21 = E::E2(1i, 1i); - let e22 = E::E2(1i, 2i); + let e11 = E::E1(1); + let e12 = E::E1(2); + let e21 = E::E2(1, 1); + let e22 = E::E2(1, 2); // in order for both PartialOrd and Ord let es = [e0, e11, e12, e21, e22]; diff --git a/src/test/run-pass/deriving-cmp-generic-struct-enum.rs b/src/test/run-pass/deriving-cmp-generic-struct-enum.rs index dbac7fa5bc..8b54536f3a 100644 --- a/src/test/run-pass/deriving-cmp-generic-struct-enum.rs +++ b/src/test/run-pass/deriving-cmp-generic-struct-enum.rs @@ -19,15 +19,15 @@ enum ES { pub fn main() { let (es11, es12, es21, es22) = (ES::ES1 { - x: 1i + x: 1 }, ES::ES1 { - x: 2i + x: 2 }, ES::ES2 { - x: 1i, - y: 1i + x: 1, + y: 1 }, ES::ES2 { - x: 1i, - y: 2i + x: 1, + y: 2 }); // in order for both PartialOrd and Ord diff --git a/src/test/run-pass/deriving-cmp-generic-struct.rs b/src/test/run-pass/deriving-cmp-generic-struct.rs index cd2cbb2d0a..86887c3411 100644 --- a/src/test/run-pass/deriving-cmp-generic-struct.rs +++ b/src/test/run-pass/deriving-cmp-generic-struct.rs @@ -17,8 +17,8 @@ struct S { } pub fn main() { - let s1 = S {x: 1i, y: 1i}; - let s2 = S {x: 1i, y: 2i}; + let s1 = S {x: 1, y: 1}; + let s2 = S {x: 1, y: 2}; // in order for both PartialOrd and Ord let ss = [s1, s2]; diff --git a/src/test/run-pass/deriving-cmp-generic-tuple-struct.rs b/src/test/run-pass/deriving-cmp-generic-tuple-struct.rs index 0a45b73755..c7d7f8ded8 100644 --- a/src/test/run-pass/deriving-cmp-generic-tuple-struct.rs +++ b/src/test/run-pass/deriving-cmp-generic-tuple-struct.rs @@ -15,8 +15,8 @@ struct TS(T,T); pub fn main() { - let ts1 = TS(1i, 1i); - let ts2 = TS(1i, 2i); + let ts1 = TS(1, 1); + let ts2 = TS(1, 2); // in order for both PartialOrd and Ord let tss = [ts1, ts2]; diff --git a/src/test/run-pass/deriving-encodable-decodable-box.rs b/src/test/run-pass/deriving-encodable-decodable-box.rs index 1a204fa3e2..838d05cf0d 100644 --- a/src/test/run-pass/deriving-encodable-decodable-box.rs +++ b/src/test/run-pass/deriving-encodable-decodable-box.rs @@ -24,7 +24,7 @@ struct A { fn main() { let obj = A { foo: box [true, false] }; - let s = json::encode(&obj); - let obj2: A = json::decode(s.as_slice()).unwrap(); + let s = json::encode(&obj).unwrap(); + let obj2: A = json::decode(&s).unwrap(); assert!(obj.foo == obj2.foo); } diff --git a/src/test/run-pass/deriving-encodable-decodable-cell-refcell.rs b/src/test/run-pass/deriving-encodable-decodable-cell-refcell.rs index 3b2c1d9f27..7d581927c3 100644 --- a/src/test/run-pass/deriving-encodable-decodable-cell-refcell.rs +++ b/src/test/run-pass/deriving-encodable-decodable-cell-refcell.rs @@ -35,8 +35,8 @@ fn main() { foo: Cell::new(true), bar: RefCell::new( A { baz: 2 } ) }; - let s = json::encode(&obj); - let obj2: B = json::decode(s.as_slice()).unwrap(); + let s = json::encode(&obj).unwrap(); + let obj2: B = json::decode(&s).unwrap(); assert!(obj.foo.get() == obj2.foo.get()); assert!(obj.bar.borrow().baz == obj2.bar.borrow().baz); } diff --git a/src/test/run-pass/deriving-encodable-decodable.rs b/src/test/run-pass/deriving-encodable-decodable.rs index 01814e8eab..ea43163775 100644 --- a/src/test/run-pass/deriving-encodable-decodable.rs +++ b/src/test/run-pass/deriving-encodable-decodable.rs @@ -59,7 +59,7 @@ fn roundtrip<'a, T: Rand + Eq + Encodable> + let mut w = Vec::new(); let mut e = Encoder::new(&mut w); obj.encode(&mut e); - let doc = rbml::Doc::new(&w[]); + let doc = rbml::Doc::new(&w); let mut dec = Decoder::new(doc); let obj2 = Decodable::decode(&mut dec); assert!(obj == obj2); @@ -71,7 +71,7 @@ pub fn main() { roundtrip::(); roundtrip::(); - for _ in range(0, 20) { + for _ in 0..20 { roundtrip::(); roundtrip::(); roundtrip::>(); diff --git a/src/test/run-pass/deriving-global.rs b/src/test/run-pass/deriving-global.rs index 849733ecc1..6777cbdab9 100644 --- a/src/test/run-pass/deriving-global.rs +++ b/src/test/run-pass/deriving-global.rs @@ -20,21 +20,21 @@ mod submod { #[derive(PartialEq, PartialOrd, Eq, Ord, Hash, Clone, - Show, Rand, + Debug, Rand, Encodable, Decodable)] enum A { A1(uint), A2(int) } #[derive(PartialEq, PartialOrd, Eq, Ord, Hash, Clone, - Show, Rand, + Debug, Rand, Encodable, Decodable)] struct B { x: uint, y: int } #[derive(PartialEq, PartialOrd, Eq, Ord, Hash, Clone, - Show, Rand, + Debug, Rand, Encodable, Decodable)] struct C(uint, int); diff --git a/src/test/run-pass/deriving-hash.rs b/src/test/run-pass/deriving-hash.rs index 02ab7e5db5..5fe7c8bb94 100644 --- a/src/test/run-pass/deriving-hash.rs +++ b/src/test/run-pass/deriving-hash.rs @@ -17,7 +17,7 @@ struct Person { phone: uint, } -fn hash>(t: &T) -> u64 { +fn hash(t: &T) -> u64 { std::hash::hash::(t) } diff --git a/src/test/run-pass/deriving-in-fn.rs b/src/test/run-pass/deriving-in-fn.rs index cd79f84b7c..bf2c2b01e6 100644 --- a/src/test/run-pass/deriving-in-fn.rs +++ b/src/test/run-pass/deriving-in-fn.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - #[derive(Show)] + #[derive(Debug)] struct Foo { foo: int, } diff --git a/src/test/run-pass/deriving-meta-multiple.rs b/src/test/run-pass/deriving-meta-multiple.rs index f45dce9da6..62ec2f8e59 100644 --- a/src/test/run-pass/deriving-meta-multiple.rs +++ b/src/test/run-pass/deriving-meta-multiple.rs @@ -20,7 +20,7 @@ struct Foo { baz: int } -fn hash>(_t: &T) {} +fn hash(_t: &T) {} pub fn main() { let a = Foo {bar: 4, baz: -3}; diff --git a/src/test/run-pass/deriving-meta.rs b/src/test/run-pass/deriving-meta.rs index d6a2fad08e..82cf9db323 100644 --- a/src/test/run-pass/deriving-meta.rs +++ b/src/test/run-pass/deriving-meta.rs @@ -17,7 +17,7 @@ struct Foo { baz: int } -fn hash>(_t: &T) {} +fn hash(_t: &T) {} pub fn main() { let a = Foo {bar: 4, baz: -3}; diff --git a/src/test/run-pass/deriving-primitive.rs b/src/test/run-pass/deriving-primitive.rs index 7ea9f6f19a..eb3cb30594 100644 --- a/src/test/run-pass/deriving-primitive.rs +++ b/src/test/run-pass/deriving-primitive.rs @@ -11,7 +11,7 @@ use std::num::FromPrimitive; use std::int; -#[derive(PartialEq, FromPrimitive, Show)] +#[derive(PartialEq, FromPrimitive, Debug)] enum A { Foo = int::MAX, Bar = 1, diff --git a/src/test/run-pass/deriving-rand.rs b/src/test/run-pass/deriving-rand.rs index f1396efedf..d6e5fedf18 100644 --- a/src/test/run-pass/deriving-rand.rs +++ b/src/test/run-pass/deriving-rand.rs @@ -31,7 +31,7 @@ enum D { pub fn main() { // check there's no segfaults - for _ in range(0i, 20) { + for _ in 0..20 { rand::random::(); rand::random::(); rand::random::(); diff --git a/src/test/run-pass/deriving-show-2.rs b/src/test/run-pass/deriving-show-2.rs index 8465f521e4..acd07bc98d 100644 --- a/src/test/run-pass/deriving-show-2.rs +++ b/src/test/run-pass/deriving-show-2.rs @@ -10,39 +10,39 @@ use std::fmt; -#[derive(Show)] +#[derive(Debug)] enum A {} -#[derive(Show)] +#[derive(Debug)] enum B { B1, B2, B3 } -#[derive(Show)] +#[derive(Debug)] enum C { C1(int), C2(B), C3(String) } -#[derive(Show)] +#[derive(Debug)] enum D { D1{ a: int } } -#[derive(Show)] +#[derive(Debug)] struct E; -#[derive(Show)] +#[derive(Debug)] struct F(int); -#[derive(Show)] +#[derive(Debug)] struct G(int, int); -#[derive(Show)] +#[derive(Debug)] struct H { a: int } -#[derive(Show)] +#[derive(Debug)] struct I { a: int, b: int } -#[derive(Show)] +#[derive(Debug)] struct J(Custom); struct Custom; -impl fmt::Show for Custom { +impl fmt::Debug for Custom { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "yay") } } -trait ToShow { +trait ToDebug { fn to_show(&self) -> String; } -impl ToShow for T { +impl ToDebug for T { fn to_show(&self) -> String { format!("{:?}", self) } @@ -51,12 +51,12 @@ impl ToShow for T { pub fn main() { assert_eq!(B::B1.to_show(), "B1".to_string()); assert_eq!(B::B2.to_show(), "B2".to_string()); - assert_eq!(C::C1(3).to_show(), "C1(3i)".to_string()); + assert_eq!(C::C1(3).to_show(), "C1(3)".to_string()); assert_eq!(C::C2(B::B2).to_show(), "C2(B2)".to_string()); - assert_eq!(D::D1{ a: 2 }.to_show(), "D1 { a: 2i }".to_string()); + assert_eq!(D::D1{ a: 2 }.to_show(), "D1 { a: 2 }".to_string()); assert_eq!(E.to_show(), "E".to_string()); - assert_eq!(F(3).to_show(), "F(3i)".to_string()); - assert_eq!(G(3, 4).to_show(), "G(3i, 4i)".to_string()); - assert_eq!(I{ a: 2, b: 4 }.to_show(), "I { a: 2i, b: 4i }".to_string()); + assert_eq!(F(3).to_show(), "F(3)".to_string()); + assert_eq!(G(3, 4).to_show(), "G(3, 4)".to_string()); + assert_eq!(I{ a: 2, b: 4 }.to_show(), "I { a: 2, b: 4 }".to_string()); assert_eq!(J(Custom).to_show(), "J(yay)".to_string()); } diff --git a/src/test/run-pass/deriving-show.rs b/src/test/run-pass/deriving-show.rs index 99c73dd94a..7986b97685 100644 --- a/src/test/run-pass/deriving-show.rs +++ b/src/test/run-pass/deriving-show.rs @@ -8,16 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(Show)] +#[derive(Debug)] struct Unit; -#[derive(Show)] +#[derive(Debug)] struct Tuple(int, uint); -#[derive(Show)] +#[derive(Debug)] struct Struct { x: int, y: uint } -#[derive(Show)] +#[derive(Debug)] enum Enum { Nullary, Variant(int, uint), @@ -32,9 +32,9 @@ macro_rules! t { pub fn main() { t!(Unit, "Unit"); - t!(Tuple(1, 2), "Tuple(1i, 2u)"); - t!(Struct { x: 1, y: 2 }, "Struct { x: 1i, y: 2u }"); + t!(Tuple(1, 2), "Tuple(1, 2)"); + t!(Struct { x: 1, y: 2 }, "Struct { x: 1, y: 2 }"); t!(Enum::Nullary, "Nullary"); - t!(Enum::Variant(1, 2), "Variant(1i, 2u)"); - t!(Enum::StructVariant { x: 1, y: 2 }, "StructVariant { x: 1i, y: 2u }"); + t!(Enum::Variant(1, 2), "Variant(1, 2)"); + t!(Enum::StructVariant { x: 1, y: 2 }, "StructVariant { x: 1, y: 2 }"); } diff --git a/src/test/run-pass/deriving-via-extension-c-enum.rs b/src/test/run-pass/deriving-via-extension-c-enum.rs index d6594290b2..92ffd82d90 100644 --- a/src/test/run-pass/deriving-via-extension-c-enum.rs +++ b/src/test/run-pass/deriving-via-extension-c-enum.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] enum Foo { Bar, Baz, diff --git a/src/test/run-pass/deriving-via-extension-enum.rs b/src/test/run-pass/deriving-via-extension-enum.rs index 5d009655fc..9761a87d4a 100644 --- a/src/test/run-pass/deriving-via-extension-enum.rs +++ b/src/test/run-pass/deriving-via-extension-enum.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] enum Foo { Bar(int, int), Baz(f64, f64) diff --git a/src/test/run-pass/deriving-via-extension-struct-empty.rs b/src/test/run-pass/deriving-via-extension-struct-empty.rs index d3c1c468f7..9c929940eb 100644 --- a/src/test/run-pass/deriving-via-extension-struct-empty.rs +++ b/src/test/run-pass/deriving-via-extension-struct-empty.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct Foo; pub fn main() { diff --git a/src/test/run-pass/deriving-via-extension-struct-like-enum-variant.rs b/src/test/run-pass/deriving-via-extension-struct-like-enum-variant.rs index 5e60818731..ed92a3baab 100644 --- a/src/test/run-pass/deriving-via-extension-struct-like-enum-variant.rs +++ b/src/test/run-pass/deriving-via-extension-struct-like-enum-variant.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] enum S { X { x: int, y: int }, Y diff --git a/src/test/run-pass/deriving-via-extension-struct-tuple.rs b/src/test/run-pass/deriving-via-extension-struct-tuple.rs index a8a06244b2..9319a4f752 100644 --- a/src/test/run-pass/deriving-via-extension-struct-tuple.rs +++ b/src/test/run-pass/deriving-via-extension-struct-tuple.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct Foo(int, int, String); pub fn main() { diff --git a/src/test/run-pass/deriving-via-extension-struct.rs b/src/test/run-pass/deriving-via-extension-struct.rs index 86a0ec15c8..e32e080cac 100644 --- a/src/test/run-pass/deriving-via-extension-struct.rs +++ b/src/test/run-pass/deriving-via-extension-struct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct Foo { x: int, y: int, diff --git a/src/test/run-pass/deriving-via-extension-type-params.rs b/src/test/run-pass/deriving-via-extension-type-params.rs index 266c51d1b6..890b4e6978 100644 --- a/src/test/run-pass/deriving-via-extension-type-params.rs +++ b/src/test/run-pass/deriving-via-extension-type-params.rs @@ -9,7 +9,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(PartialEq, Hash, Show)] +#[derive(PartialEq, Hash, Debug)] struct Foo { x: int, y: T, diff --git a/src/test/run-pass/destructure-array-1.rs b/src/test/run-pass/destructure-array-1.rs new file mode 100644 index 0000000000..43271162c1 --- /dev/null +++ b/src/test/run-pass/destructure-array-1.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Ensure that we can do a destructuring bind of a fixed-size array, +// even when the element type has a destructor. + +struct D { x: u8 } + +impl Drop for D { fn drop(&mut self) { } } + +fn main() { + fn d(x: u8) -> D { D { x: x } } + + let d1 = foo([d(1), d(2), d(3), d(4)], 1); + let d3 = foo([d(5), d(6), d(7), d(8)], 3); + assert_eq!(d1.x, 2); + assert_eq!(d3.x, 8); +} + +fn foo([a, b, c, d]: [D; 4], i: usize) -> D { + match i { + 0 => a, + 1 => b, + 2 => c, + 3 => d, + _ => panic!("unmatched"), + } +} diff --git a/src/test/run-pass/double-ref.rs b/src/test/run-pass/double-ref.rs index 656b9164df..8018f681f3 100644 --- a/src/test/run-pass/double-ref.rs +++ b/src/test/run-pass/double-ref.rs @@ -9,33 +9,33 @@ // except according to those terms. fn check_expr() { - let _: & uint = &1u; - let _: & & uint = &&1u; - let _: & & & uint = &&&1u; - let _: & & & uint = & &&1u; - let _: & & & & uint = &&&&1u; - let _: & & & & uint = & &&&1u; - let _: & & & & & uint = &&&&&1u; + let _: & uint = &1_usize; + let _: & & uint = &&1_usize; + let _: & & & uint = &&&1_usize; + let _: & & & uint = & &&1_usize; + let _: & & & & uint = &&&&1_usize; + let _: & & & & uint = & &&&1_usize; + let _: & & & & & uint = &&&&&1_usize; } fn check_ty() { - let _: &uint = & 1u; - let _: &&uint = & & 1u; - let _: &&&uint = & & & 1u; - let _: & &&uint = & & & 1u; - let _: &&&&uint = & & & & 1u; - let _: & &&&uint = & & & & 1u; - let _: &&&&&uint = & & & & & 1u; + let _: &uint = & 1_usize; + let _: &&uint = & & 1_usize; + let _: &&&uint = & & & 1_usize; + let _: & &&uint = & & & 1_usize; + let _: &&&&uint = & & & & 1_usize; + let _: & &&&uint = & & & & 1_usize; + let _: &&&&&uint = & & & & & 1_usize; } fn check_pat() { - let &_ = & 1u; - let &&_ = & & 1u; - let &&&_ = & & & 1u; - let & &&_ = & & & 1u; - let &&&&_ = & & & & 1u; - let & &&&_ = & & & & 1u; - let &&&&&_ = & & & & & 1u; + let &_ = & 1_usize; + let &&_ = & & 1_usize; + let &&&_ = & & & 1_usize; + let & &&_ = & & & 1_usize; + let &&&&_ = & & & & 1_usize; + let & &&&_ = & & & & 1_usize; + let &&&&&_ = & & & & & 1_usize; } pub fn main() {} diff --git a/src/test/run-pass/drop-trait-enum.rs b/src/test/run-pass/drop-trait-enum.rs index 9bfb3572ab..f94da9fc74 100644 --- a/src/test/run-pass/drop-trait-enum.rs +++ b/src/test/run-pass/drop-trait-enum.rs @@ -11,10 +11,10 @@ #![allow(unknown_features)] #![feature(box_syntax)] -use std::thread::Thread; +use std::thread; use std::sync::mpsc::{channel, Sender}; -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] enum Message { Dropped, DestructorRan @@ -62,26 +62,29 @@ pub fn main() { let (sender, receiver) = channel(); { - let v = Foo::NestedVariant(box 42u, SendOnDrop { sender: sender.clone() }, sender); + let v = Foo::NestedVariant(box 42_usize, SendOnDrop { sender: sender.clone() }, sender); } assert_eq!(receiver.recv().unwrap(), Message::DestructorRan); assert_eq!(receiver.recv().unwrap(), Message::Dropped); assert_eq!(receiver.recv().ok(), None); let (sender, receiver) = channel(); - let _t = Thread::scoped(move|| { + let t = thread::spawn(move|| { let v = Foo::FailingVariant { on_drop: SendOnDrop { sender: sender } }; }); assert_eq!(receiver.recv().unwrap(), Message::Dropped); assert_eq!(receiver.recv().ok(), None); + drop(t.join()); let (sender, receiver) = channel(); - let _t = { - Thread::scoped(move|| { - let mut v = Foo::NestedVariant(box 42u, SendOnDrop { + let t = { + thread::spawn(move|| { + let mut v = Foo::NestedVariant(box 42usize, SendOnDrop { sender: sender.clone() }, sender.clone()); - v = Foo::NestedVariant(box 42u, SendOnDrop { sender: sender.clone() }, sender.clone()); + v = Foo::NestedVariant(box 42_usize, + SendOnDrop { sender: sender.clone() }, + sender.clone()); v = Foo::SimpleVariant(sender.clone()); v = Foo::FailingVariant { on_drop: SendOnDrop { sender: sender } }; }) @@ -93,4 +96,5 @@ pub fn main() { assert_eq!(receiver.recv().unwrap(), Message::DestructorRan); assert_eq!(receiver.recv().unwrap(), Message::Dropped); assert_eq!(receiver.recv().ok(), None); + drop(t.join()); } diff --git a/src/test/run-pass/drop-trait-generic.rs b/src/test/run-pass/drop-trait-generic.rs index 9a93873f53..4ba3aa70df 100644 --- a/src/test/run-pass/drop-trait-generic.rs +++ b/src/test/run-pass/drop-trait-generic.rs @@ -22,5 +22,5 @@ impl ::std::ops::Drop for S { } pub fn main() { - let _x = S { x: 1i }; + let _x = S { x: 1 }; } diff --git a/src/test/run-pass/drop-with-type-ascription-1.rs b/src/test/run-pass/drop-with-type-ascription-1.rs index 8c0c0afa94..f9fcf8ced2 100644 --- a/src/test/run-pass/drop-with-type-ascription-1.rs +++ b/src/test/run-pass/drop-with-type-ascription-1.rs @@ -10,7 +10,7 @@ fn main() { let foo = "hello".to_string(); - let foo: Vec<&str> = foo.as_slice().words().collect(); + let foo: Vec<&str> = foo.words().collect(); let invalid_string = &foo[0]; assert_eq!(*invalid_string, "hello"); } diff --git a/src/test/run-pass/drop-with-type-ascription-2.rs b/src/test/run-pass/drop-with-type-ascription-2.rs index f55f47bbc5..f3d79f0c7d 100644 --- a/src/test/run-pass/drop-with-type-ascription-2.rs +++ b/src/test/run-pass/drop-with-type-ascription-2.rs @@ -10,7 +10,7 @@ fn main() { let args = vec!("foobie", "asdf::asdf"); - let arr: Vec<&str> = args[1].as_slice().split_str("::").collect(); + let arr: Vec<&str> = args[1].split_str("::").collect(); assert_eq!(arr[0], "asdf"); assert_eq!(arr[0], "asdf"); } diff --git a/src/test/run-pass/dropck_tarena_sound_drop.rs b/src/test/run-pass/dropck_tarena_sound_drop.rs new file mode 100644 index 0000000000..ad71f72586 --- /dev/null +++ b/src/test/run-pass/dropck_tarena_sound_drop.rs @@ -0,0 +1,51 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Check that a arena (TypedArena) can carry elements whose drop +// methods might access borrowed data, as long as the borrowed data +// has lifetime that strictly outlives the arena itself. +// +// Compare against compile-fail/dropck_tarena_unsound_drop.rs, which +// shows a similar setup, but restricts `f` so that the struct `C<'a>` +// is force-fed a lifetime equal to that of the borrowed arena. + +#![allow(unstable)] +#![feature(unsafe_destructor)] + +extern crate arena; + +use arena::TypedArena; + +trait HasId { fn count(&self) -> usize; } + +struct CheckId { v: T } + +// In the code below, the impl of HasId for `&'a usize` does not +// actually access the borrowed data, but the point is that the +// interface to CheckId does not (and cannot) know that, and therefore +// when encountering the a value V of type CheckId, we must +// conservatively force the type S to strictly outlive V. +#[unsafe_destructor] +impl Drop for CheckId { + fn drop(&mut self) { + assert!(self.v.count() > 0); + } +} + +struct C<'a> { _v: CheckId<&'a usize>, } + +impl<'a> HasId for &'a usize { fn count(&self) -> usize { 1 } } + +fn f<'a, 'b>(_arena: &'a TypedArena>) {} + +fn main() { + let arena: TypedArena = TypedArena::new(); + f(&arena); +} diff --git a/src/test/run-pass/dst-coercions.rs b/src/test/run-pass/dst-coercions.rs index dbad546ce1..30ed0b8e40 100644 --- a/src/test/run-pass/dst-coercions.rs +++ b/src/test/run-pass/dst-coercions.rs @@ -11,7 +11,7 @@ // Test coercions involving DST and/or raw pointers struct S; -trait T {} +trait T { fn dummy(&self) { } } impl T for S {} pub fn main() { diff --git a/src/test/run-pass/dst-index.rs b/src/test/run-pass/dst-index.rs index dfb28fc934..0c7ecfceff 100644 --- a/src/test/run-pass/dst-index.rs +++ b/src/test/run-pass/dst-index.rs @@ -12,7 +12,7 @@ // work and don't ICE. use std::ops::Index; -use std::fmt::Show; +use std::fmt::Debug; struct S; @@ -27,16 +27,16 @@ impl Index for S { struct T; impl Index for T { - type Output = Show + 'static; + type Output = Debug + 'static; - fn index<'a>(&'a self, idx: &uint) -> &'a (Show + 'static) { + fn index<'a>(&'a self, idx: &uint) -> &'a (Debug + 'static) { static X: uint = 42; - &X as &(Show + 'static) + &X as &(Debug + 'static) } } fn main() { assert_eq!(&S[0], "hello"); &T[0]; - // let x = &x as &Show; + // let x = &x as &Debug; } diff --git a/src/test/run-pass/dst-raw.rs b/src/test/run-pass/dst-raw.rs index d3d2e3581a..226025cd80 100644 --- a/src/test/run-pass/dst-raw.rs +++ b/src/test/run-pass/dst-raw.rs @@ -45,7 +45,7 @@ pub fn main() { assert!(r == 42); // raw slice - let a: *const [_] = &[1i, 2, 3]; + let a: *const [_] = &[1, 2, 3]; unsafe { let b = (*a)[2]; assert!(b == 3); @@ -54,7 +54,7 @@ pub fn main() { } // raw slice with explicit cast - let a = &[1i, 2, 3] as *const [_]; + let a = &[1, 2, 3] as *const [_]; unsafe { let b = (*a)[2]; assert!(b == 3); @@ -63,7 +63,7 @@ pub fn main() { } // raw DST struct with slice - let c: *const Foo<[_]> = &Foo {f: [1i, 2, 3]}; + let c: *const Foo<[_]> = &Foo {f: [1, 2, 3]}; unsafe { let b = (&*c).f[0]; assert!(b == 1); @@ -86,7 +86,7 @@ pub fn main() { }; assert!(r == 42); - let a: *mut [_] = &mut [1i, 2, 3]; + let a: *mut [_] = &mut [1, 2, 3]; unsafe { let b = (*a)[2]; assert!(b == 3); @@ -94,7 +94,7 @@ pub fn main() { assert!(len == 3); } - let a = &mut [1i, 2, 3] as *mut [_]; + let a = &mut [1, 2, 3] as *mut [_]; unsafe { let b = (*a)[2]; assert!(b == 3); @@ -102,7 +102,7 @@ pub fn main() { assert!(len == 3); } - let c: *mut Foo<[_]> = &mut Foo {f: [1i, 2, 3]}; + let c: *mut Foo<[_]> = &mut Foo {f: [1, 2, 3]}; unsafe { let b = (&*c).f[0]; assert!(b == 1); diff --git a/src/test/run-pass/dst-struct-sole.rs b/src/test/run-pass/dst-struct-sole.rs index c7f37da157..74f4b9e923 100644 --- a/src/test/run-pass/dst-struct-sole.rs +++ b/src/test/run-pass/dst-struct-sole.rs @@ -30,11 +30,9 @@ fn foo2(x: &Fat<[T]>) { assert!(x.ptr[1].to_bar() == bar); } -#[derive(PartialEq,Eq)] +#[derive(Copy, PartialEq, Eq)] struct Bar; -impl Copy for Bar {} - trait ToBar { fn to_bar(&self) -> Bar; } diff --git a/src/test/run-pass/dst-struct.rs b/src/test/run-pass/dst-struct.rs index b2092e745a..ee5193adbc 100644 --- a/src/test/run-pass/dst-struct.rs +++ b/src/test/run-pass/dst-struct.rs @@ -49,11 +49,9 @@ fn foo3(x: &Fat>) { } -#[derive(PartialEq,Eq)] +#[derive(Copy, PartialEq, Eq)] struct Bar; -impl Copy for Bar {} - trait ToBar { fn to_bar(&self) -> Bar; } @@ -117,7 +115,7 @@ pub fn main() { foo3(f5); // Box. - let f1 = box [1i, 2, 3]; + let f1 = box [1, 2, 3]; assert!((*f1)[1] == 2); let f2: Box<[int]> = f1; assert!((*f2)[1] == 2); diff --git a/src/test/run-pass/dst-trait.rs b/src/test/run-pass/dst-trait.rs index 627d197879..fd1c7247e3 100644 --- a/src/test/run-pass/dst-trait.rs +++ b/src/test/run-pass/dst-trait.rs @@ -17,18 +17,14 @@ struct Fat { ptr: T } -#[derive(PartialEq,Eq)] +#[derive(Copy, PartialEq, Eq)] struct Bar; -impl Copy for Bar {} - -#[derive(PartialEq,Eq)] +#[derive(Copy, PartialEq, Eq)] struct Bar1 { f: int } -impl Copy for Bar1 {} - trait ToBar { fn to_bar(&self) -> Bar; fn to_val(&self) -> int; diff --git a/src/test/run-pass/early-ret-binop-add.rs b/src/test/run-pass/early-ret-binop-add.rs index b9efdeb3be..97e873e9af 100644 --- a/src/test/run-pass/early-ret-binop-add.rs +++ b/src/test/run-pass/early-ret-binop-add.rs @@ -8,5 +8,5 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn wsucc(n: int) -> int { 0i + { return n + 1 } } +fn wsucc(n: int) -> int { 0 + { return n + 1 } } pub fn main() { } diff --git a/src/test/run-pass/early-vtbl-resolution.rs b/src/test/run-pass/early-vtbl-resolution.rs index 70030c66ca..89fee7358a 100644 --- a/src/test/run-pass/early-vtbl-resolution.rs +++ b/src/test/run-pass/early-vtbl-resolution.rs @@ -19,5 +19,5 @@ fn foo_func>(x: B) -> Option { x.foo() } struct A { a: int } pub fn main() { - let _x: Option = foo_func(0i); + let _x: Option = foo_func(0); } diff --git a/src/test/run-pass/else-if.rs b/src/test/run-pass/else-if.rs index 63f32ae702..476d3f42d6 100644 --- a/src/test/run-pass/else-if.rs +++ b/src/test/run-pass/else-if.rs @@ -11,20 +11,20 @@ pub fn main() { - if 1i == 2 { + if 1 == 2 { assert!((false)); - } else if 2i == 3 { + } else if 2 == 3 { assert!((false)); - } else if 3i == 4 { assert!((false)); } else { assert!((true)); } - if 1i == 2 { assert!((false)); } else if 2i == 2 { assert!((true)); } - if 1i == 2 { + } else if 3 == 4 { assert!((false)); } else { assert!((true)); } + if 1 == 2 { assert!((false)); } else if 2 == 2 { assert!((true)); } + if 1 == 2 { assert!((false)); - } else if 2i == 2 { - if 1i == 1 { + } else if 2 == 2 { + if 1 == 1 { assert!((true)); - } else { if 2i == 1 { assert!((false)); } else { assert!((false)); } } + } else { if 2 == 1 { assert!((false)); } else { assert!((false)); } } } - if 1i == 2 { + if 1 == 2 { assert!((false)); - } else { if 1i == 2 { assert!((false)); } else { assert!((true)); } } + } else { if 1 == 2 { assert!((false)); } else { assert!((true)); } } } diff --git a/src/test/run-pass/empty-tag.rs b/src/test/run-pass/empty-tag.rs index d920174644..95af729e5e 100644 --- a/src/test/run-pass/empty-tag.rs +++ b/src/test/run-pass/empty-tag.rs @@ -8,11 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(Show)] +#[derive(Copy, Debug)] enum chan { chan_t, } -impl Copy for chan {} - impl PartialEq for chan { fn eq(&self, other: &chan) -> bool { ((*self) as uint) == ((*other) as uint) @@ -25,6 +23,6 @@ fn wrapper3(i: chan) { } pub fn main() { - let wrapped = {|&:|wrapper3(chan::chan_t)}; + let wrapped = {||wrapper3(chan::chan_t)}; wrapped(); } diff --git a/src/test/run-pass/enum-discrim-width-stuff.rs b/src/test/run-pass/enum-discrim-width-stuff.rs index 73559af79d..0242e53aa8 100644 --- a/src/test/run-pass/enum-discrim-width-stuff.rs +++ b/src/test/run-pass/enum-discrim-width-stuff.rs @@ -12,13 +12,12 @@ macro_rules! check { ($m:ident, $t:ty, $v:expr) => {{ mod $m { use std::mem::size_of; - #[derive(Show)] + #[derive(Copy, Debug)] enum E { V = $v, A = 0 } static C: E = E::V; - impl Copy for E {} pub fn check() { assert_eq!(size_of::(), size_of::<$t>()); assert_eq!(E::V as $t, $v as $t); diff --git a/src/test/run-pass/enum-null-pointer-opt.rs b/src/test/run-pass/enum-null-pointer-opt.rs index 797c26556a..023376ce47 100644 --- a/src/test/run-pass/enum-null-pointer-opt.rs +++ b/src/test/run-pass/enum-null-pointer-opt.rs @@ -16,7 +16,7 @@ use std::mem::size_of; use std::rc::Rc; use std::sync::Arc; -trait Trait {} +trait Trait { fn dummy(&self) { } } fn main() { // Functions diff --git a/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs b/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs index 8171365720..468e5f5f4b 100644 --- a/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs +++ b/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs @@ -19,8 +19,8 @@ enum List { Nil, Cons(X, Box>) } pub fn main() { - match List::Cons(10i, box List::Nil) { - List::Cons(10i, _) => {} + match List::Cons(10, box List::Nil) { + List::Cons(10, _) => {} List::Nil => {} _ => panic!() } diff --git a/src/test/run-pass/enum-vec-initializer.rs b/src/test/run-pass/enum-vec-initializer.rs index d436916c27..86a998100b 100644 --- a/src/test/run-pass/enum-vec-initializer.rs +++ b/src/test/run-pass/enum-vec-initializer.rs @@ -16,9 +16,9 @@ const BAR:uint = Flopsy::Bunny as uint; const BAR2:uint = BAR; pub fn main() { - let _v = [0i; Flopsy::Bunny as uint]; - let _v = [0i; BAR]; - let _v = [0i; BAR2]; + let _v = [0; Flopsy::Bunny as uint]; + let _v = [0; BAR]; + let _v = [0; BAR2]; const BAR3:uint = BAR2; - let _v = [0i; BAR3]; + let _v = [0; BAR3]; } diff --git a/src/test/run-pass/env-home-dir.rs b/src/test/run-pass/env-home-dir.rs new file mode 100644 index 0000000000..0e1ab73c02 --- /dev/null +++ b/src/test/run-pass/env-home-dir.rs @@ -0,0 +1,49 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::env::*; + +#[cfg(unix)] +fn main() { + let oldhome = var("HOME"); + + set_var("HOME", "/home/MountainView"); + assert!(home_dir() == Some(Path::new("/home/MountainView"))); + + remove_var("HOME"); + if cfg!(target_os = "android") { + assert!(home_dir().is_none()); + } else { + assert!(home_dir().is_some()); + } +} + +#[cfg(windows)] +fn main() { + let oldhome = var("HOME"); + let olduserprofile = var("USERPROFILE"); + + remove_var("HOME"); + remove_var("USERPROFILE"); + + assert!(home_dir().is_some()); + + set_var("HOME", "/home/MountainView"); + assert!(home_dir() == Some(Path::new("/home/MountainView"))); + + remove_var("HOME"); + + set_var("USERPROFILE", "/home/MountainView"); + assert!(home_dir() == Some(Path::new("/home/MountainView"))); + + set_var("HOME", "/home/MountainView"); + set_var("USERPROFILE", "/home/PaloAlto"); + assert!(home_dir() == Some(Path::new("/home/MountainView"))); +} diff --git a/src/test/run-pass/env-vars.rs b/src/test/run-pass/env-vars.rs new file mode 100644 index 0000000000..659e5b3a8c --- /dev/null +++ b/src/test/run-pass/env-vars.rs @@ -0,0 +1,22 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::env::*; + +fn main() { + for (k, v) in vars_os() { + let v2 = var_os(&k); + // MingW seems to set some funky environment variables like + // "=C:=C:\MinGW\msys\1.0\bin" and "!::=::\" that are returned + // from vars() but not visible from var(). + assert!(v2.is_none() || v2.as_ref().map(|s| &**s) == Some(&*v), + "bad vars->var transition: {:?} {:?} {:?}", k, v, v2); + } +} diff --git a/src/test/run-pass/exec-env.rs b/src/test/run-pass/exec-env.rs index 8775cb6da2..a71016fd88 100644 --- a/src/test/run-pass/exec-env.rs +++ b/src/test/run-pass/exec-env.rs @@ -10,8 +10,8 @@ // exec-env:TEST_EXEC_ENV=22 -use std::os; +use std::env; pub fn main() { - assert_eq!(os::getenv("TEST_EXEC_ENV"), Some("22".to_string())); + assert_eq!(env::var("TEST_EXEC_ENV"), Ok("22".to_string())); } diff --git a/src/test/run-pass/explicit-i-suffix.rs b/src/test/run-pass/explicit-i-suffix.rs index 45cfee76fb..96c58b106f 100644 --- a/src/test/run-pass/explicit-i-suffix.rs +++ b/src/test/run-pass/explicit-i-suffix.rs @@ -9,11 +9,11 @@ // except according to those terms. pub fn main() { - let x: int = 8i; - let y = 9i; + let x: int = 8; + let y = 9; x + y; - let q: int = -8i; - let r = -9i; + let q: int = -8; + let r = -9; q + r; } diff --git a/src/test/run-pass/explicit-self-closures.rs b/src/test/run-pass/explicit-self-closures.rs index c7e5681c0c..ef9dc377bc 100644 --- a/src/test/run-pass/explicit-self-closures.rs +++ b/src/test/run-pass/explicit-self-closures.rs @@ -16,7 +16,7 @@ struct Box { impl Box { pub fn set_many(&mut self, xs: &[uint]) { - for x in xs.iter() { self.x = *x; } + for x in xs { self.x = *x; } } } diff --git a/src/test/run-pass/explicit-self-generic.rs b/src/test/run-pass/explicit-self-generic.rs index a2aaaa235e..382c5c58e9 100644 --- a/src/test/run-pass/explicit-self-generic.rs +++ b/src/test/run-pass/explicit-self-generic.rs @@ -11,26 +11,23 @@ #![allow(unknown_features)] #![feature(box_syntax)] +#[derive(Copy)] struct LM { resize_at: uint, size: uint } -impl Copy for LM {} - enum HashMap { - HashMap_(LM) + HashMap_(LM, Vec<(K,V)>) } -impl Copy for HashMap {} - fn linear_map() -> HashMap { HashMap::HashMap_(LM{ resize_at: 32, - size: 0}) + size: 0}, Vec::new()) } impl HashMap { pub fn len(&mut self) -> uint { match *self { - HashMap::HashMap_(l) => l.size + HashMap::HashMap_(ref l, _) => l.size } } } diff --git a/src/test/run-pass/exponential-notation.rs b/src/test/run-pass/exponential-notation.rs index 1fb434f7d7..bfe22712de 100644 --- a/src/test/run-pass/exponential-notation.rs +++ b/src/test/run-pass/exponential-notation.rs @@ -19,18 +19,18 @@ macro_rules! t { pub fn main() { // Basic usage - t!(to_string(1.2345678e-5f64, 10u, true, SignNeg, DigMax(6), ExpDec, false), + t!(to_string(1.2345678e-5f64, 10, true, SignNeg, DigMax(6), ExpDec, false), "1.234568e-5"); // Hexadecimal output - t!(to_string(7.281738281250e+01f64, 16u, true, SignAll, DigMax(6), ExpBin, false), + t!(to_string(7.281738281250e+01f64, 16, true, SignAll, DigMax(6), ExpBin, false), "+1.2345p+6"); - t!(to_string(-1.777768135071e-02f64, 16u, true, SignAll, DigMax(6), ExpBin, false), + t!(to_string(-1.777768135071e-02f64, 16, true, SignAll, DigMax(6), ExpBin, false), "-1.2345p-6"); // Some denormals - t!(to_string(4.9406564584124654e-324f64, 10u, true, SignNeg, DigMax(6), ExpBin, false), + t!(to_string(4.9406564584124654e-324f64, 10, true, SignNeg, DigMax(6), ExpBin, false), "1p-1074"); - t!(to_string(2.2250738585072009e-308f64, 10u, true, SignNeg, DigMax(6), ExpBin, false), + t!(to_string(2.2250738585072009e-308f64, 10, true, SignNeg, DigMax(6), ExpBin, false), "1p-1022"); } diff --git a/src/test/run-pass/export-unexported-dep.rs b/src/test/run-pass/export-unexported-dep.rs index 48e9d9dea2..807d28feb6 100644 --- a/src/test/run-pass/export-unexported-dep.rs +++ b/src/test/run-pass/export-unexported-dep.rs @@ -13,10 +13,9 @@ mod foo { // not exported + #[derive(Copy)] enum t { t1, t2, } - impl Copy for t {} - impl PartialEq for t { fn eq(&self, other: &t) -> bool { ((*self) as uint) == ((*other) as uint) diff --git a/src/test/run-pass/expr-block-unique.rs b/src/test/run-pass/expr-block-unique.rs index d934ce677d..d10b209965 100644 --- a/src/test/run-pass/expr-block-unique.rs +++ b/src/test/run-pass/expr-block-unique.rs @@ -12,4 +12,4 @@ #![allow(unknown_features)] #![feature(box_syntax)] -pub fn main() { let x = { box 100i }; assert!((*x == 100)); } +pub fn main() { let x = { box 100 }; assert!((*x == 100)); } diff --git a/src/test/run-pass/expr-block.rs b/src/test/run-pass/expr-block.rs index 7af9e79050..ee1d955b0d 100644 --- a/src/test/run-pass/expr-block.rs +++ b/src/test/run-pass/expr-block.rs @@ -20,7 +20,7 @@ struct RS { v1: int, v2: int } fn test_rec() { let rs = { RS {v1: 10, v2: 20} }; assert!((rs.v2 == 20)); } fn test_filled_with_stuff() { - let rs = { let mut a = 0i; while a < 10 { a += 1; } a }; + let rs = { let mut a = 0; while a < 10 { a += 1; } a }; assert_eq!(rs, 10); } diff --git a/src/test/run-pass/expr-copy.rs b/src/test/run-pass/expr-copy.rs index 6e9ba4f8f4..6c6c508574 100644 --- a/src/test/run-pass/expr-copy.rs +++ b/src/test/run-pass/expr-copy.rs @@ -13,10 +13,9 @@ fn f(arg: &mut A) { arg.a = 100; } +#[derive(Copy)] struct A { a: int } -impl Copy for A {} - pub fn main() { let mut x = A {a: 10}; f(&mut x); diff --git a/src/test/run-pass/expr-empty-ret.rs b/src/test/run-pass/expr-empty-ret.rs index 7b08251967..afc7dfaf9b 100644 --- a/src/test/run-pass/expr-empty-ret.rs +++ b/src/test/run-pass/expr-empty-ret.rs @@ -12,7 +12,7 @@ fn f() { let _x = match true { - true => { 10i } + true => { 10 } false => { return } }; } diff --git a/src/test/run-pass/expr-fn.rs b/src/test/run-pass/expr-fn.rs index 8172c16abf..0ea1f3fcda 100644 --- a/src/test/run-pass/expr-fn.rs +++ b/src/test/run-pass/expr-fn.rs @@ -22,7 +22,7 @@ fn test_vec() { fn test_generic() { fn f(t: T) -> T { t } - assert_eq!(f(10i), 10); + assert_eq!(f(10), 10); } fn test_alt() { diff --git a/src/test/run-pass/expr-if-panic-all.rs b/src/test/run-pass/expr-if-panic-all.rs index 0dd7ddc3f8..52ccee0581 100644 --- a/src/test/run-pass/expr-if-panic-all.rs +++ b/src/test/run-pass/expr-if-panic-all.rs @@ -12,7 +12,7 @@ // expression results in panic. pub fn main() { let _x = if true { - 10i + 10 } else { if true { panic!() } else { panic!() } }; diff --git a/src/test/run-pass/expr-if-panic.rs b/src/test/run-pass/expr-if-panic.rs index aa4240c60f..87c7954fa4 100644 --- a/src/test/run-pass/expr-if-panic.rs +++ b/src/test/run-pass/expr-if-panic.rs @@ -9,18 +9,18 @@ // except according to those terms. fn test_if_panic() { - let x = if false { panic!() } else { 10i }; + let x = if false { panic!() } else { 10 }; assert!((x == 10)); } fn test_else_panic() { - let x = if true { 10i } else { panic!() }; - assert_eq!(x, 10i); + let x = if true { 10 } else { panic!() }; + assert_eq!(x, 10); } fn test_elseif_panic() { - let x = if false { 0i } else if false { panic!() } else { 10i }; - assert_eq!(x, 10i); + let x = if false { 0 } else if false { panic!() } else { 10 }; + assert_eq!(x, 10); } pub fn main() { test_if_panic(); test_else_panic(); test_elseif_panic(); } diff --git a/src/test/run-pass/expr-if-struct.rs b/src/test/run-pass/expr-if-struct.rs index 62994068a9..ee2c071504 100644 --- a/src/test/run-pass/expr-if-struct.rs +++ b/src/test/run-pass/expr-if-struct.rs @@ -14,20 +14,17 @@ // Tests for if as expressions returning nominal types +#[derive(Copy)] struct I { i: int } -impl Copy for I {} - fn test_rec() { let rs = if true { I {i: 100} } else { I {i: 101} }; assert_eq!(rs.i, 100); } -#[derive(Show)] +#[derive(Copy, Debug)] enum mood { happy, sad, } -impl Copy for mood {} - impl PartialEq for mood { fn eq(&self, other: &mood) -> bool { ((*self) as uint) == ((*other) as uint) diff --git a/src/test/run-pass/expr-if-unique.rs b/src/test/run-pass/expr-if-unique.rs index 5294d05401..317e543493 100644 --- a/src/test/run-pass/expr-if-unique.rs +++ b/src/test/run-pass/expr-if-unique.rs @@ -15,8 +15,8 @@ // Tests for if as expressions returning boxed types fn test_box() { - let rs = if true { box 100i } else { box 101i }; - assert_eq!(*rs, 100i); + let rs = if true { box 100 } else { box 101 }; + assert_eq!(*rs, 100); } pub fn main() { test_box(); } diff --git a/src/test/run-pass/expr-match-panic-all.rs b/src/test/run-pass/expr-match-panic-all.rs index 3b33c18bbb..3a8955917d 100644 --- a/src/test/run-pass/expr-match-panic-all.rs +++ b/src/test/run-pass/expr-match-panic-all.rs @@ -16,7 +16,7 @@ pub fn main() { let _x = match true { - true => { 10i } + true => { 10 } false => { match true { true => { panic!() } false => { panic!() } } } }; } diff --git a/src/test/run-pass/expr-match-panic.rs b/src/test/run-pass/expr-match-panic.rs index d8ee21dfdc..da24d4c57c 100644 --- a/src/test/run-pass/expr-match-panic.rs +++ b/src/test/run-pass/expr-match-panic.rs @@ -15,8 +15,8 @@ fn test_simple() { } fn test_box() { - let r = match true { true => { vec!(10i) } false => { panic!() } }; - assert_eq!(r[0], 10i); + let r = match true { true => { vec!(10) } false => { panic!() } }; + assert_eq!(r[0], 10); } pub fn main() { test_simple(); test_box(); } diff --git a/src/test/run-pass/expr-match-struct.rs b/src/test/run-pass/expr-match-struct.rs index 8512cf63cd..e4ce71200b 100644 --- a/src/test/run-pass/expr-match-struct.rs +++ b/src/test/run-pass/expr-match-struct.rs @@ -13,20 +13,17 @@ // Tests for match as expressions resulting in struct types +#[derive(Copy)] struct R { i: int } -impl Copy for R {} - fn test_rec() { let rs = match true { true => R {i: 100}, _ => panic!() }; assert_eq!(rs.i, 100); } -#[derive(Show)] +#[derive(Copy, Debug)] enum mood { happy, sad, } -impl Copy for mood {} - impl PartialEq for mood { fn eq(&self, other: &mood) -> bool { ((*self) as uint) == ((*other) as uint) diff --git a/src/test/run-pass/expr-match-unique.rs b/src/test/run-pass/expr-match-unique.rs index 7958f4927d..57ccfe1d5e 100644 --- a/src/test/run-pass/expr-match-unique.rs +++ b/src/test/run-pass/expr-match-unique.rs @@ -13,8 +13,8 @@ // Tests for match as expressions resulting in boxed types fn test_box() { - let res = match true { true => { box 100i }, _ => panic!() }; - assert_eq!(*res, 100i); + let res = match true { true => { box 100 }, _ => panic!() }; + assert_eq!(*res, 100); } pub fn main() { test_box(); } diff --git a/src/test/run-pass/exterior.rs b/src/test/run-pass/exterior.rs index 2ca5f430a2..bba8cbdb83 100644 --- a/src/test/run-pass/exterior.rs +++ b/src/test/run-pass/exterior.rs @@ -11,10 +11,9 @@ use std::cell::Cell; +#[derive(Copy)] struct Point {x: int, y: int, z: int} -impl Copy for Point {} - fn f(p: &Cell) { assert!((p.get().z == 12)); p.set(Point {x: 10, y: 11, z: 13}); diff --git a/src/test/run-pass/extern-pass-TwoU16s.rs b/src/test/run-pass/extern-pass-TwoU16s.rs index a38fe6d6d5..1f48dc3bcf 100644 --- a/src/test/run-pass/extern-pass-TwoU16s.rs +++ b/src/test/run-pass/extern-pass-TwoU16s.rs @@ -11,13 +11,11 @@ // Test a foreign function that accepts and returns a struct // by value. -#[derive(PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] pub struct TwoU16s { one: u16, two: u16 } -impl Copy for TwoU16s {} - #[link(name = "rust_test_helpers")] extern { pub fn rust_dbg_extern_identity_TwoU16s(v: TwoU16s) -> TwoU16s; diff --git a/src/test/run-pass/extern-pass-TwoU32s.rs b/src/test/run-pass/extern-pass-TwoU32s.rs index 30b035d56b..171e2a647c 100644 --- a/src/test/run-pass/extern-pass-TwoU32s.rs +++ b/src/test/run-pass/extern-pass-TwoU32s.rs @@ -11,13 +11,11 @@ // Test a foreign function that accepts and returns a struct // by value. -#[derive(PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] pub struct TwoU32s { one: u32, two: u32 } -impl Copy for TwoU32s {} - #[link(name = "rust_test_helpers")] extern { pub fn rust_dbg_extern_identity_TwoU32s(v: TwoU32s) -> TwoU32s; diff --git a/src/test/run-pass/extern-pass-TwoU64s.rs b/src/test/run-pass/extern-pass-TwoU64s.rs index 8ca05f09a9..83555f6bb1 100644 --- a/src/test/run-pass/extern-pass-TwoU64s.rs +++ b/src/test/run-pass/extern-pass-TwoU64s.rs @@ -11,13 +11,11 @@ // Test a foreign function that accepts and returns a struct // by value. -#[derive(PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] pub struct TwoU64s { one: u64, two: u64 } -impl Copy for TwoU64s {} - #[link(name = "rust_test_helpers")] extern { pub fn rust_dbg_extern_identity_TwoU64s(v: TwoU64s) -> TwoU64s; diff --git a/src/test/run-pass/extern-pass-TwoU8s.rs b/src/test/run-pass/extern-pass-TwoU8s.rs index 42a1ce7887..d2b13445e6 100644 --- a/src/test/run-pass/extern-pass-TwoU8s.rs +++ b/src/test/run-pass/extern-pass-TwoU8s.rs @@ -11,13 +11,11 @@ // Test a foreign function that accepts and returns a struct // by value. -#[derive(PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] pub struct TwoU8s { one: u8, two: u8 } -impl Copy for TwoU8s {} - #[link(name = "rust_test_helpers")] extern { pub fn rust_dbg_extern_identity_TwoU8s(v: TwoU8s) -> TwoU8s; diff --git a/src/test/run-pass/extern-rust.rs b/src/test/run-pass/extern-rust.rs new file mode 100644 index 0000000000..8ba39a2451 --- /dev/null +++ b/src/test/run-pass/extern-rust.rs @@ -0,0 +1,19 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[repr(C)] +pub struct Foo(u32); + +// ICE trigger, bad handling of differing types between rust and external ABIs +pub extern fn bar() -> Foo { + Foo(0) +} + +fn main() {} diff --git a/src/test/run-pass/extern-stress.rs b/src/test/run-pass/extern-stress.rs index c3e04177cc..b9e08e47b3 100644 --- a/src/test/run-pass/extern-stress.rs +++ b/src/test/run-pass/extern-stress.rs @@ -41,7 +41,7 @@ fn count(n: libc::uintptr_t) -> libc::uintptr_t { } pub fn main() { - range(0u, 100).map(|_| { + (0_usize..100).map(|_| { Thread::scoped(move|| { assert_eq!(count(5), 16); }) diff --git a/src/test/run-pass/extern-yield.rs b/src/test/run-pass/extern-yield.rs index f5e91b9de6..80428d787f 100644 --- a/src/test/run-pass/extern-yield.rs +++ b/src/test/run-pass/extern-yield.rs @@ -38,7 +38,7 @@ fn count(n: libc::uintptr_t) -> libc::uintptr_t { } pub fn main() { - range(0, 10u).map(|i| { + (0..10_usize).map(|i| { Thread::scoped(move|| { let result = count(5); println!("result = {}", result); diff --git a/src/test/run-pass/fat-arrow-match.rs b/src/test/run-pass/fat-arrow-match.rs index 929d1c8e63..004e6d48e3 100644 --- a/src/test/run-pass/fat-arrow-match.rs +++ b/src/test/run-pass/fat-arrow-match.rs @@ -17,8 +17,8 @@ enum color { pub fn main() { println!("{}", match color::red { - color::red => { 1i } - color::green => { 2i } - color::blue => { 3i } + color::red => { 1 } + color::green => { 2 } + color::blue => { 3 } }); } diff --git a/src/test/run-pass/fixed_length_copy.rs b/src/test/run-pass/fixed_length_copy.rs index dc34cec7fa..bbd7b9130e 100644 --- a/src/test/run-pass/fixed_length_copy.rs +++ b/src/test/run-pass/fixed_length_copy.rs @@ -9,8 +9,8 @@ // except according to those terms. pub fn main() { - let arr = [1i,2i,3i]; + let arr = [1,2,3]; let arr2 = arr; - assert_eq!(arr[1], 2i); - assert_eq!(arr2[2], 3i); + assert_eq!(arr[1], 2); + assert_eq!(arr2[2], 3); } diff --git a/src/test/run-pass/fn-pattern-expected-type-2.rs b/src/test/run-pass/fn-pattern-expected-type-2.rs index 8590c8b90b..4e2c8facaf 100644 --- a/src/test/run-pass/fn-pattern-expected-type-2.rs +++ b/src/test/run-pass/fn-pattern-expected-type-2.rs @@ -10,7 +10,7 @@ pub fn main() { let v : &[(int,int)] = &[ (1, 2), (3, 4), (5, 6) ]; - for &(x, y) in v.iter() { + for &(x, y) in v { println!("{}", y); println!("{}", x); } diff --git a/src/test/run-pass/fn-pattern-expected-type.rs b/src/test/run-pass/fn-pattern-expected-type.rs index 24bf1f94d8..3e81ca5125 100644 --- a/src/test/run-pass/fn-pattern-expected-type.rs +++ b/src/test/run-pass/fn-pattern-expected-type.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let f = |&: (x, y): (int, int)| { + let f = |(x, y): (int, int)| { assert_eq!(x, 1); assert_eq!(y, 2); }; diff --git a/src/test/run-pass/fn-type-infer.rs b/src/test/run-pass/fn-type-infer.rs index ae22ff5cce..3441789119 100644 --- a/src/test/run-pass/fn-type-infer.rs +++ b/src/test/run-pass/fn-type-infer.rs @@ -12,7 +12,7 @@ pub fn main() { // We should be able to type infer inside of ||s. - let _f = |&:| { - let i = 10i; + let _f = || { + let i = 10; }; } diff --git a/src/test/run-pass/for-destruct.rs b/src/test/run-pass/for-destruct.rs index 7cc8b22e06..7a9b8a45b2 100644 --- a/src/test/run-pass/for-destruct.rs +++ b/src/test/run-pass/for-destruct.rs @@ -11,7 +11,7 @@ struct Pair { x: int, y: int } pub fn main() { - for elt in (vec!(Pair {x: 10, y: 20}, Pair {x: 30, y: 0})).iter() { + for elt in &(vec!(Pair {x: 10, y: 20}, Pair {x: 30, y: 0})) { assert_eq!(elt.x + elt.y, 30); } } diff --git a/src/test/run-pass/for-loop-goofiness.rs b/src/test/run-pass/for-loop-goofiness.rs index 73f4cdd252..7754751120 100644 --- a/src/test/run-pass/for-loop-goofiness.rs +++ b/src/test/run-pass/for-loop-goofiness.rs @@ -16,8 +16,8 @@ enum BogusOption { type Iterator = int; pub fn main() { - let x = [ 3i, 3, 3 ]; - for i in x.iter() { + let x = [ 3, 3, 3 ]; + for i in &x { assert_eq!(*i, 3); } } diff --git a/src/test/compile-fail/unboxed-closures-wrong-trait.rs b/src/test/run-pass/for-loop-into-iterator.rs similarity index 67% rename from src/test/compile-fail/unboxed-closures-wrong-trait.rs rename to src/test/run-pass/for-loop-into-iterator.rs index e4255d0024..7564efbd9e 100644 --- a/src/test/compile-fail/unboxed-closures-wrong-trait.rs +++ b/src/test/run-pass/for-loop-into-iterator.rs @@ -8,15 +8,20 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(lang_items, overloaded_calls, unboxed_closures)] - -fn c isize>(f: F) -> isize { - f(5, 6) -} +// Test that for loops can do what RFC #235 claims fn main() { - let z: isize = 7; - assert_eq!(c(|&mut: x: isize, y| x + y + z), 10); - //~^ ERROR not implemented -} + let mut v = vec![1]; + for x in &v { + assert_eq!(x, &1); + } + + for x in &mut v { + assert_eq!(x, &mut 1); + } + + for x in v { + assert_eq!(x, 1); + } +} diff --git a/src/test/run-pass/for-loop-no-std.rs b/src/test/run-pass/for-loop-no-std.rs new file mode 100644 index 0000000000..30c2aec33a --- /dev/null +++ b/src/test/run-pass/for-loop-no-std.rs @@ -0,0 +1,25 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(lang_items, start, no_std)] +#![no_std] + +extern crate "std" as other; + +#[macro_use] extern crate core; +#[macro_use] extern crate collections; + +use core::slice::SliceExt; + +#[start] +fn start(_argc: int, _argv: *const *const u8) -> int { + for _ in [1,2,3].iter() { } + 0 +} diff --git a/src/test/run-pass/for-loop-panic.rs b/src/test/run-pass/for-loop-panic.rs index d157da3139..d2de1ed8c7 100644 --- a/src/test/run-pass/for-loop-panic.rs +++ b/src/test/run-pass/for-loop-panic.rs @@ -9,4 +9,4 @@ // except according to those terms. -pub fn main() { let x: Vec = Vec::new(); for _ in x.iter() { panic!("moop"); } } +pub fn main() { let x: Vec = Vec::new(); for _ in &x { panic!("moop"); } } diff --git a/src/test/run-pass/foreach-external-iterators-break.rs b/src/test/run-pass/foreach-external-iterators-break.rs index 5f7770e97a..25d625e27f 100644 --- a/src/test/run-pass/foreach-external-iterators-break.rs +++ b/src/test/run-pass/foreach-external-iterators-break.rs @@ -9,9 +9,9 @@ // except according to those terms. pub fn main() { - let x = [1i; 100]; - let mut y = 0i; - for i in x.iter() { + let x = [1; 100]; + let mut y = 0; + for i in &x[..] { if y > 10 { break; } diff --git a/src/test/run-pass/foreach-external-iterators-hashmap-break-restart.rs b/src/test/run-pass/foreach-external-iterators-hashmap-break-restart.rs index 4305ae9569..a4988bf016 100644 --- a/src/test/run-pass/foreach-external-iterators-hashmap-break-restart.rs +++ b/src/test/run-pass/foreach-external-iterators-hashmap-break-restart.rs @@ -18,8 +18,8 @@ use std::collections::HashMap; pub fn main() { let mut h = HashMap::new(); - let kvs = [(1i, 10i), (2i, 20i), (3i, 30i)]; - for &(k,v) in kvs.iter() { + let kvs = [(1, 10), (2, 20), (3, 30)]; + for &(k,v) in &kvs { h.insert(k,v); } let mut x = 0; @@ -27,7 +27,7 @@ pub fn main() { let mut i = h.iter(); - for (&k,&v) in i { + for (&k,&v) in i.by_ref() { x += k; y += v; break; diff --git a/src/test/run-pass/foreach-external-iterators-hashmap.rs b/src/test/run-pass/foreach-external-iterators-hashmap.rs index ab20f9f977..ed4328d94f 100644 --- a/src/test/run-pass/foreach-external-iterators-hashmap.rs +++ b/src/test/run-pass/foreach-external-iterators-hashmap.rs @@ -14,13 +14,13 @@ use std::collections::HashMap; pub fn main() { let mut h = HashMap::new(); - let kvs = [(1i, 10i), (2i, 20i), (3i, 30i)]; - for &(k,v) in kvs.iter() { + let kvs = [(1, 10), (2, 20), (3, 30)]; + for &(k,v) in &kvs { h.insert(k,v); } - let mut x = 0i; - let mut y = 0i; - for (&k,&v) in h.iter() { + let mut x = 0; + let mut y = 0; + for (&k,&v) in &h { x += k; y += v; } diff --git a/src/test/run-pass/foreach-external-iterators-loop.rs b/src/test/run-pass/foreach-external-iterators-loop.rs index d8c6dd6a93..d9abed5012 100644 --- a/src/test/run-pass/foreach-external-iterators-loop.rs +++ b/src/test/run-pass/foreach-external-iterators-loop.rs @@ -9,8 +9,8 @@ // except according to those terms. pub fn main() { - let x = [1i; 100]; - let mut y = 0i; + let x = [1; 100]; + let mut y = 0; for (n,i) in x.iter().enumerate() { if n < 10 { continue; diff --git a/src/test/run-pass/foreach-external-iterators-nested.rs b/src/test/run-pass/foreach-external-iterators-nested.rs index 20ea9c440a..3817e1b0ed 100644 --- a/src/test/run-pass/foreach-external-iterators-nested.rs +++ b/src/test/run-pass/foreach-external-iterators-nested.rs @@ -9,12 +9,12 @@ // except according to those terms. pub fn main() { - let x = [1i; 100]; - let y = [2i; 100]; - let mut p = 0i; - let mut q = 0i; - for i in x.iter() { - for j in y.iter() { + let x = [1; 100]; + let y = [2; 100]; + let mut p = 0; + let mut q = 0; + for i in &x[..] { + for j in &y[..] { p += *j; } q += *i + p; diff --git a/src/test/run-pass/foreach-external-iterators.rs b/src/test/run-pass/foreach-external-iterators.rs index 0ac642cc44..8403a1669f 100644 --- a/src/test/run-pass/foreach-external-iterators.rs +++ b/src/test/run-pass/foreach-external-iterators.rs @@ -9,9 +9,9 @@ // except according to those terms. pub fn main() { - let x = [1i; 100]; - let mut y = 0i; - for i in x.iter() { + let x = [1; 100]; + let mut y = 0; + for i in &x[..] { y += *i } assert!(y == 100); diff --git a/src/test/run-pass/foreign-call-no-runtime.rs b/src/test/run-pass/foreign-call-no-runtime.rs index c1df9d53ad..3f226a1985 100644 --- a/src/test/run-pass/foreign-call-no-runtime.rs +++ b/src/test/run-pass/foreign-call-no-runtime.rs @@ -11,7 +11,7 @@ extern crate libc; use std::mem; -use std::thread::Thread; +use std::thread; #[link(name = "rust_test_helpers")] extern { @@ -21,9 +21,9 @@ extern { pub fn main() { unsafe { - Thread::scoped(move|| { - let i = &100i; - rust_dbg_call(callback, mem::transmute(i)); + thread::spawn(move|| { + let i = 100; + rust_dbg_call(callback, mem::transmute(&i)); }).join(); } } @@ -31,6 +31,6 @@ pub fn main() { extern fn callback(data: libc::uintptr_t) { unsafe { let data: *const int = mem::transmute(data); - assert_eq!(*data, 100i); + assert_eq!(*data, 100); } } diff --git a/src/test/run-pass/foreign-fn-linkname.rs b/src/test/run-pass/foreign-fn-linkname.rs index dff1a1eaa0..24b711328a 100644 --- a/src/test/run-pass/foreign-fn-linkname.rs +++ b/src/test/run-pass/foreign-fn-linkname.rs @@ -24,7 +24,7 @@ mod mlibc { fn strlen(str: String) -> uint { // C string is terminated with a zero - let s = CString::from_slice(str.as_bytes()); + let s = CString::new(str).unwrap(); unsafe { mlibc::my_strlen(s.as_ptr()) as uint } @@ -32,5 +32,5 @@ fn strlen(str: String) -> uint { pub fn main() { let len = strlen("Rust".to_string()); - assert_eq!(len, 4u); + assert_eq!(len, 4_usize); } diff --git a/src/test/run-pass/foreign-fn-with-byval.rs b/src/test/run-pass/foreign-fn-with-byval.rs index 5d6815fc3c..09317abce9 100644 --- a/src/test/run-pass/foreign-fn-with-byval.rs +++ b/src/test/run-pass/foreign-fn-with-byval.rs @@ -8,14 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[derive(Copy)] pub struct S { x: u64, y: u64, z: u64, } -impl Copy for S {} - #[link(name = "rust_test_helpers")] extern { pub fn get_x(x: S) -> u64; diff --git a/src/test/run-pass/format-no-std.rs b/src/test/run-pass/format-no-std.rs new file mode 100644 index 0000000000..a15a176c22 --- /dev/null +++ b/src/test/run-pass/format-no-std.rs @@ -0,0 +1,36 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(lang_items, start, no_std)] +#![no_std] + +extern crate "std" as other; + +#[macro_use] extern crate core; +#[macro_use] extern crate collections; + +use collections::string::ToString; + +#[start] +fn start(_argc: int, _argv: *const *const u8) -> int { + let s = format!("{}", 1_isize); + assert_eq!(s, "1".to_string()); + + let s = format!("test"); + assert_eq!(s, "test".to_string()); + + let s = format!("{test}", test=3_isize); + assert_eq!(s, "3".to_string()); + + let s = format!("hello {}", "world"); + assert_eq!(s, "hello world".to_string()); + + 0 +} diff --git a/src/test/run-pass/func-arg-ref-pattern.rs b/src/test/run-pass/func-arg-ref-pattern.rs index 9e94bca96f..5d44a9461b 100644 --- a/src/test/run-pass/func-arg-ref-pattern.rs +++ b/src/test/run-pass/func-arg-ref-pattern.rs @@ -15,6 +15,7 @@ // pattern. #![allow(unknown_features)] +#![feature(box_patterns)] #![feature(box_syntax)] fn getaddr(box ref x: Box) -> *const uint { diff --git a/src/test/run-pass/functional-struct-upd.rs b/src/test/run-pass/functional-struct-upd.rs index 5f2ebc6cbe..8c686aba5f 100644 --- a/src/test/run-pass/functional-struct-upd.rs +++ b/src/test/run-pass/functional-struct-upd.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(Show)] +#[derive(Debug)] struct Foo { x: int, y: int diff --git a/src/test/run-pass/generic-alias-unique.rs b/src/test/run-pass/generic-alias-unique.rs index 34b7f15e4c..db468ba180 100644 --- a/src/test/run-pass/generic-alias-unique.rs +++ b/src/test/run-pass/generic-alias-unique.rs @@ -14,7 +14,7 @@ fn id(t: T) -> T { return t; } pub fn main() { - let expected = box 100i; + let expected = box 100; let actual = id::>(expected.clone()); println!("{}", *actual); assert_eq!(*expected, *actual); diff --git a/src/test/run-pass/generic-default-type-params-cross-crate.rs b/src/test/run-pass/generic-default-type-params-cross-crate.rs index ed8c6e7325..bf02b82d1a 100644 --- a/src/test/run-pass/generic-default-type-params-cross-crate.rs +++ b/src/test/run-pass/generic-default-type-params-cross-crate.rs @@ -12,13 +12,13 @@ extern crate default_type_params_xc; -struct Vec; +struct Vec(Option<(T,A)>); struct Foo; fn main() { - let _a = Vec::; - let _b = Vec::; - let _c = default_type_params_xc::FakeVec::; - let _d = default_type_params_xc::FakeVec::; + let _a = Vec::(None); + let _b = Vec::(None); + let _c = default_type_params_xc::FakeVec:: { f: None }; + let _d = default_type_params_xc::FakeVec:: { f: None }; } diff --git a/src/test/run-pass/generic-default-type-params.rs b/src/test/run-pass/generic-default-type-params.rs index 5ec478d39e..e7ef1d42f5 100644 --- a/src/test/run-pass/generic-default-type-params.rs +++ b/src/test/run-pass/generic-default-type-params.rs @@ -47,10 +47,10 @@ fn default_foo(x: Foo) { assert_eq!(x.baz(), (1, 'a')); } -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct BazHelper(T); -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] // Ensure that we can use previous type parameters in defaults. struct Baz, V = Option>(T, U, V); diff --git a/src/test/run-pass/generic-fn-unique.rs b/src/test/run-pass/generic-fn-unique.rs index be83cb04f2..6599aa7412 100644 --- a/src/test/run-pass/generic-fn-unique.rs +++ b/src/test/run-pass/generic-fn-unique.rs @@ -13,4 +13,4 @@ fn f(x: Box) -> Box { return x; } -pub fn main() { let x = f(box 3i); println!("{}", *x); } +pub fn main() { let x = f(box 3); println!("{}", *x); } diff --git a/src/test/run-pass/generic-fn.rs b/src/test/run-pass/generic-fn.rs index a341bfe22e..8da8c68084 100644 --- a/src/test/run-pass/generic-fn.rs +++ b/src/test/run-pass/generic-fn.rs @@ -12,10 +12,9 @@ fn id(x: T) -> T { return x; } +#[derive(Copy)] struct Triple {x: int, y: int, z: int} -impl Copy for Triple {} - pub fn main() { let mut x = 62; let mut y = 63; diff --git a/src/test/run-pass/generic-ivec-leak.rs b/src/test/run-pass/generic-ivec-leak.rs index 48b61bf745..eb0546063f 100644 --- a/src/test/run-pass/generic-ivec-leak.rs +++ b/src/test/run-pass/generic-ivec-leak.rs @@ -10,4 +10,4 @@ enum wrapper { wrapped(T), } -pub fn main() { let _w = wrapper::wrapped(vec!(1i, 2, 3, 4, 5)); } +pub fn main() { let _w = wrapper::wrapped(vec!(1, 2, 3, 4, 5)); } diff --git a/src/test/run-pass/generic-newtype-struct.rs b/src/test/run-pass/generic-newtype-struct.rs index f87e11cbb6..4e3c820405 100644 --- a/src/test/run-pass/generic-newtype-struct.rs +++ b/src/test/run-pass/generic-newtype-struct.rs @@ -11,5 +11,5 @@ struct S(T); pub fn main() { - let _s = S(2i); + let _s = S(2); } diff --git a/src/test/run-pass/generic-static-methods.rs b/src/test/run-pass/generic-static-methods.rs index f992847e4e..7f84efcdd5 100644 --- a/src/test/run-pass/generic-static-methods.rs +++ b/src/test/run-pass/generic-static-methods.rs @@ -16,7 +16,7 @@ trait vec_utils { impl vec_utils for Vec { fn map_(x: &Vec , mut f: F) -> Vec where F: FnMut(&T) -> U { let mut r = Vec::new(); - for elt in x.iter() { + for elt in x { r.push(f(elt)); } r @@ -24,5 +24,5 @@ impl vec_utils for Vec { } pub fn main() { - assert_eq!(vec_utils::map_(&vec!(1i,2i,3i), |&x| x+1), vec!(2i,3i,4i)); + assert_eq!(vec_utils::map_(&vec!(1,2,3), |&x| x+1), vec!(2,3,4)); } diff --git a/src/test/run-pass/generic-tag-local.rs b/src/test/run-pass/generic-tag-local.rs index cd8b13421c..24c31ab4ee 100644 --- a/src/test/run-pass/generic-tag-local.rs +++ b/src/test/run-pass/generic-tag-local.rs @@ -12,4 +12,4 @@ enum clam { a(T), } -pub fn main() { let _c = clam::a(3i); } +pub fn main() { let _c = clam::a(3); } diff --git a/src/test/run-pass/generic-tup.rs b/src/test/run-pass/generic-tup.rs index dc9a90f702..cd0e344b89 100644 --- a/src/test/run-pass/generic-tup.rs +++ b/src/test/run-pass/generic-tup.rs @@ -11,7 +11,7 @@ fn get_third(t: (T, T, T)) -> T { let (_, _, x) = t; return x; } pub fn main() { - println!("{}", get_third((1i, 2i, 3i))); - assert_eq!(get_third((1i, 2i, 3i)), 3); + println!("{}", get_third((1, 2, 3))); + assert_eq!(get_third((1, 2, 3)), 3); assert_eq!(get_third((5u8, 6u8, 7u8)), 7u8); } diff --git a/src/test/run-pass/getopts_ref.rs b/src/test/run-pass/getopts_ref.rs index a3df98afcb..3c89900fe4 100644 --- a/src/test/run-pass/getopts_ref.rs +++ b/src/test/run-pass/getopts_ref.rs @@ -16,7 +16,7 @@ pub fn main() { let args = Vec::new(); let opts = vec!(optopt("b", "", "something", "SMTHNG")); - match getopts(args.as_slice(), opts.as_slice()) { + match getopts(&args, &opts) { Ok(ref m) => assert!(!m.opt_present("b")), Err(ref f) => panic!("{}", *f) diff --git a/src/test/run-pass/guards-not-exhaustive.rs b/src/test/run-pass/guards-not-exhaustive.rs index b1bc40b662..addd6a6383 100644 --- a/src/test/run-pass/guards-not-exhaustive.rs +++ b/src/test/run-pass/guards-not-exhaustive.rs @@ -8,10 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[derive(Copy)] enum Q { R(Option) } -impl Copy for Q {} - fn xyzzy(q: Q) -> uint { match q { Q::R(S) if S.is_some() => { 0 } diff --git a/src/test/run-pass/guards.rs b/src/test/run-pass/guards.rs index 0157423863..188106ec10 100644 --- a/src/test/run-pass/guards.rs +++ b/src/test/run-pass/guards.rs @@ -8,20 +8,19 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[derive(Copy)] struct Pair { x: int, y: int } -impl Copy for Pair {} - pub fn main() { let a: int = - match 10i { x if x < 7 => { 1i } x if x < 11 => { 2i } 10 => { 3i } _ => { 4i } }; + match 10 { x if x < 7 => { 1 } x if x < 11 => { 2 } 10 => { 3 } _ => { 4 } }; assert_eq!(a, 2); let b: int = match (Pair {x: 10, y: 20}) { - x if x.x < 5 && x.y < 5 => { 1i } - Pair {x: x, y: y} if x == 10 && y == 20 => { 2i } - Pair {x: _x, y: _y} => { 3i } + x if x.x < 5 && x.y < 5 => { 1 } + Pair {x: x, y: y} if x == 10 && y == 20 => { 2 } + Pair {x: _x, y: _y} => { 3 } }; assert_eq!(b, 2); } diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index 0e82ad4378..677038af9a 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -35,7 +35,7 @@ mod map_reduce { enum ctrl_proto { find_reducer(Vec, Sender), mapper_done, } fn start_mappers(ctrl: Sender, inputs: Vec) { - for i in inputs.iter() { + for i in &inputs { let ctrl = ctrl.clone(); let i = i.clone(); Thread::spawn(move|| map_task(ctrl.clone(), i.clone()) ); @@ -84,8 +84,7 @@ mod map_reduce { ctrl_proto::mapper_done => { num_mappers -= 1; } ctrl_proto::find_reducer(k, cc) => { let mut c; - match reducers.get(&str::from_utf8( - k.as_slice()).unwrap().to_string()) { + match reducers.get(&str::from_utf8(&k).unwrap().to_string()) { Some(&_c) => { c = _c; } None => { c = 0; } } diff --git a/src/test/run-pass/hrtb-opt-in-copy.rs b/src/test/run-pass/hrtb-opt-in-copy.rs index 8eaf8427bf..7b16bb867e 100644 --- a/src/test/run-pass/hrtb-opt-in-copy.rs +++ b/src/test/run-pass/hrtb-opt-in-copy.rs @@ -18,7 +18,7 @@ #![allow(dead_code)] -use std::marker; +use std::marker::PhantomData; #[derive(Copy)] struct Foo { x: T } @@ -26,13 +26,12 @@ struct Foo { x: T } type Ty<'tcx> = &'tcx TyS<'tcx>; enum TyS<'tcx> { - Boop(marker::InvariantLifetime<'tcx>) + Boop(PhantomData<*mut &'tcx ()>) } +#[derive(Copy)] enum Bar<'tcx> { Baz(Foo>) } -impl<'tcx> Copy for Bar<'tcx> { } - fn main() { } diff --git a/src/test/run-pass/hrtb-parse.rs b/src/test/run-pass/hrtb-parse.rs index 41b7c0fae0..d5307c0910 100644 --- a/src/test/run-pass/hrtb-parse.rs +++ b/src/test/run-pass/hrtb-parse.rs @@ -22,23 +22,23 @@ trait Get { // Parse HRTB with explicit `for` in a where-clause: fn foo00(t: T) - where T : for<'a> Get<&'a int, &'a int> + where T : for<'a> Get<&'a i32, &'a i32> { } -fn foo01 Get<&'a int, &'a int>>(t: T) +fn foo01 Get<&'a i32, &'a i32>>(t: T) { } // Parse HRTB with explicit `for` in various sorts of types: -fn foo10(t: Box Get>) { } -fn foo11(t: Box Get(int) -> int>) { } +fn foo10(t: Box Get>) { } +fn foo11(t: Box Fn(i32) -> i32>) { } -fn foo20(t: for<'a> fn(int) -> int) { } -fn foo21(t: for<'a> unsafe fn(int) -> int) { } -fn foo22(t: for<'a> extern "C" fn(int) -> int) { } -fn foo23(t: for<'a> unsafe extern "C" fn(int) -> int) { } +fn foo20(t: for<'a> fn(i32) -> i32) { } +fn foo21(t: for<'a> unsafe fn(i32) -> i32) { } +fn foo22(t: for<'a> extern "C" fn(i32) -> i32) { } +fn foo23(t: for<'a> unsafe extern "C" fn(i32) -> i32) { } fn main() { } diff --git a/src/test/run-pass/hrtb-precedence-of-plus.rs b/src/test/run-pass/hrtb-precedence-of-plus.rs index 1d1e744ef0..b59e7b67d4 100644 --- a/src/test/run-pass/hrtb-precedence-of-plus.rs +++ b/src/test/run-pass/hrtb-precedence-of-plus.rs @@ -17,7 +17,7 @@ // cause a compilation error. Issue #18772. fn adder(y: int) -> Box int + 'static> { - box move |&: x| y + x + box move |x| y + x } fn main() {} diff --git a/src/test/run-pass/hrtb-trait-object-paren-notation.rs b/src/test/run-pass/hrtb-trait-object-paren-notation.rs index e17e0ae218..1b62a8e809 100644 --- a/src/test/run-pass/hrtb-trait-object-paren-notation.rs +++ b/src/test/run-pass/hrtb-trait-object-paren-notation.rs @@ -16,7 +16,7 @@ trait FnLike { fn call(&self, arg: A) -> R; } -type FnObject<'b> = for<'a> FnLike(&'a int) -> (&'a int) + 'b; +type FnObject<'b> = for<'a> FnLike<(&'a i32,), &'a i32> + 'b; struct Identity; diff --git a/src/test/run-pass/hrtb-unboxed-closure-trait.rs b/src/test/run-pass/hrtb-unboxed-closure-trait.rs index fea628177d..c34e1a4862 100644 --- a/src/test/run-pass/hrtb-unboxed-closure-trait.rs +++ b/src/test/run-pass/hrtb-unboxed-closure-trait.rs @@ -18,5 +18,5 @@ fn foo(f: F) { } fn main() { - foo(|&: x: &int| println!("{}", *x)); + foo(|x: &int| println!("{}", *x)); } diff --git a/src/test/run-pass/huge-largest-array.rs b/src/test/run-pass/huge-largest-array.rs index e1b0c11536..5083bd2320 100644 --- a/src/test/run-pass/huge-largest-array.rs +++ b/src/test/run-pass/huge-largest-array.rs @@ -10,12 +10,12 @@ use std::mem::size_of; -#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))] +#[cfg(target_pointer_width = "32")] pub fn main() { assert_eq!(size_of::<[u8; (1 << 31) - 1]>(), (1 << 31) - 1); } -#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))] +#[cfg(target_pointer_width = "64")] pub fn main() { assert_eq!(size_of::<[u8; (1 << 47) - 1]>(), (1 << 47) - 1); } diff --git a/src/test/run-pass/hygiene-dodging-1.rs b/src/test/run-pass/hygiene-dodging-1.rs index eb81f82a14..3969394a26 100644 --- a/src/test/run-pass/hygiene-dodging-1.rs +++ b/src/test/run-pass/hygiene-dodging-1.rs @@ -14,7 +14,7 @@ mod x { pub fn main(){ // should *not* shadow the module x: - let x = 9i; + let x = 9; // use it to avoid warnings: x+3; assert_eq!(x::g(),14); diff --git a/src/test/run-pass/hygienic-labels-in-let.rs b/src/test/run-pass/hygienic-labels-in-let.rs index 17c0299cf4..cca0e5b163 100644 --- a/src/test/run-pass/hygienic-labels-in-let.rs +++ b/src/test/run-pass/hygienic-labels-in-let.rs @@ -20,19 +20,19 @@ macro_rules! loop_x { macro_rules! while_true { ($e: expr) => { // $e shouldn't be able to interact with this 'x - 'x: while 1i + 1 == 2 { $e } + 'x: while 1 + 1 == 2 { $e } } } macro_rules! run_once { ($e: expr) => { // ditto - 'x: for _ in range(0i, 1) { $e } + 'x: for _ in 0..1 { $e } } } pub fn main() { - let mut i = 0i; + let mut i = 0; let j: int = { 'x: loop { @@ -42,35 +42,35 @@ pub fn main() { } i + 1 }; - assert_eq!(j, 1i); + assert_eq!(j, 1); let k: int = { - 'x: for _ in range(0i, 1) { + 'x: for _ in 0..1 { // ditto loop_x!(break 'x); i += 1; } i + 1 }; - assert_eq!(k, 1i); + assert_eq!(k, 1); let l: int = { - 'x: for _ in range(0i, 1) { + 'x: for _ in 0..1 { // ditto while_true!(break 'x); i += 1; } i + 1 }; - assert_eq!(l, 1i); + assert_eq!(l, 1); let n: int = { - 'x: for _ in range(0i, 1) { + 'x: for _ in 0..1 { // ditto run_once!(continue 'x); i += 1; } i + 1 }; - assert_eq!(n, 1i); + assert_eq!(n, 1); } diff --git a/src/test/run-pass/hygienic-labels.rs b/src/test/run-pass/hygienic-labels.rs index e899a1adb7..0d8da2a934 100644 --- a/src/test/run-pass/hygienic-labels.rs +++ b/src/test/run-pass/hygienic-labels.rs @@ -18,19 +18,19 @@ macro_rules! loop_x { macro_rules! run_once { ($e: expr) => { // ditto - 'x: for _ in range(0i, 1) { $e } + 'x: for _ in 0..1 { $e } } } macro_rules! while_x { ($e: expr) => { // ditto - 'x: while 1i + 1 == 2 { $e } + 'x: while 1 + 1 == 2 { $e } } } pub fn main() { - 'x: for _ in range(0i, 1) { + 'x: for _ in 0..1 { // this 'x should refer to the outer loop, lexically loop_x!(break 'x); panic!("break doesn't act hygienically inside for loop"); @@ -42,12 +42,12 @@ pub fn main() { panic!("break doesn't act hygienically inside infinite loop"); } - 'x: while 1i + 1 == 2 { + 'x: while 1 + 1 == 2 { while_x!(break 'x); panic!("break doesn't act hygienically inside infinite while loop"); } - 'x: for _ in range(0i, 1) { + 'x: for _ in 0..1 { // ditto run_once!(continue 'x); panic!("continue doesn't act hygienically inside for loop"); diff --git a/src/test/run-pass/if-check.rs b/src/test/run-pass/if-check.rs index 660a6147d0..d2a1a3c71a 100644 --- a/src/test/run-pass/if-check.rs +++ b/src/test/run-pass/if-check.rs @@ -9,9 +9,9 @@ // except according to those terms. fn even(x: uint) -> bool { - if x < 2u { + if x < 2_usize { return false; - } else if x == 2u { return true; } else { return even(x - 2u); } + } else if x == 2_usize { return true; } else { return even(x - 2_usize); } } fn foo(x: uint) { @@ -22,4 +22,4 @@ fn foo(x: uint) { } } -pub fn main() { foo(2u); } +pub fn main() { foo(2_usize); } diff --git a/src/test/run-pass/if-let.rs b/src/test/run-pass/if-let.rs index 4dff2ea55f..2d2f77b099 100644 --- a/src/test/run-pass/if-let.rs +++ b/src/test/run-pass/if-let.rs @@ -9,9 +9,9 @@ // except according to those terms. pub fn main() { - let x = Some(3i); + let x = Some(3); if let Some(y) = x { - assert_eq!(y, 3i); + assert_eq!(y, 3); } else { panic!("if-let panicked"); } @@ -23,18 +23,18 @@ pub fn main() { let clause: uint; if let None = Some("test") { clause = 1; - } else if 4u > 5 { + } else if 4_usize > 5 { clause = 2; } else if let Ok(()) = Err::<(),&'static str>("test") { clause = 3; } else { clause = 4; } - assert_eq!(clause, 4u); + assert_eq!(clause, 4_usize); - if 3i > 4 { + if 3 > 4 { panic!("bad math"); - } else if let 1 = 2i { + } else if let 1 = 2 { panic!("bad pattern match"); } @@ -44,22 +44,22 @@ pub fn main() { Three(String, int) } - let foo = Foo::Three("three".to_string(), 42i); + let foo = Foo::Three("three".to_string(), 42); if let Foo::One = foo { panic!("bad pattern match"); } else if let Foo::Two(_x) = foo { panic!("bad pattern match"); } else if let Foo::Three(s, _) = foo { - assert_eq!(s.as_slice(), "three"); + assert_eq!(s, "three"); } else { panic!("bad else"); } if false { panic!("wat"); - } else if let a@Foo::Two(_) = Foo::Two(42u) { + } else if let a@Foo::Two(_) = Foo::Two(42_usize) { if let Foo::Two(b) = a { - assert_eq!(b, 42u); + assert_eq!(b, 42_usize); } else { panic!("panic in nested if-let"); } diff --git a/src/test/run-pass/ifmt.rs b/src/test/run-pass/ifmt.rs index dbc23a63bb..ab83fb90d3 100644 --- a/src/test/run-pass/ifmt.rs +++ b/src/test/run-pass/ifmt.rs @@ -32,14 +32,14 @@ impl fmt::UpperHex for B { f.write_str("adios") } } -impl fmt::String for C { +impl fmt::Display for C { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.pad_integral(true, "☃", "123") } } macro_rules! t { - ($a:expr, $b:expr) => { assert_eq!($a.as_slice(), $b) } + ($a:expr, $b:expr) => { assert_eq!($a, $b) } } pub fn main() { @@ -59,34 +59,34 @@ pub fn main() { // At least exercise all the formats t!(format!("{}", true), "true"); t!(format!("{}", '☃'), "☃"); - t!(format!("{}", 10i), "10"); - t!(format!("{}", 10u), "10"); + t!(format!("{}", 10), "10"); + t!(format!("{}", 10_usize), "10"); t!(format!("{:?}", '☃'), "'\\u{2603}'"); - t!(format!("{:?}", 10i), "10i"); - t!(format!("{:?}", 10u), "10u"); + t!(format!("{:?}", 10), "10"); + t!(format!("{:?}", 10_usize), "10"); t!(format!("{:?}", "true"), "\"true\""); t!(format!("{:?}", "foo\nbar"), "\"foo\\nbar\""); - t!(format!("{:o}", 10u), "12"); - t!(format!("{:x}", 10u), "a"); - t!(format!("{:X}", 10u), "A"); + t!(format!("{:o}", 10_usize), "12"); + t!(format!("{:x}", 10_usize), "a"); + t!(format!("{:X}", 10_usize), "A"); t!(format!("{}", "foo"), "foo"); t!(format!("{}", "foo".to_string()), "foo"); - t!(format!("{:p}", 0x1234 as *const int), "0x1234"); - t!(format!("{:p}", 0x1234 as *mut int), "0x1234"); + t!(format!("{:p}", 0x1234 as *const isize), "0x1234"); + t!(format!("{:p}", 0x1234 as *mut isize), "0x1234"); t!(format!("{:x}", A), "aloha"); t!(format!("{:X}", B), "adios"); t!(format!("foo {} ☃☃☃☃☃☃", "bar"), "foo bar ☃☃☃☃☃☃"); - t!(format!("{1} {0}", 0i, 1i), "1 0"); - t!(format!("{foo} {bar}", foo=0i, bar=1i), "0 1"); - t!(format!("{foo} {1} {bar} {0}", 0i, 1i, foo=2i, bar=3i), "2 1 3 0"); + t!(format!("{1} {0}", 0, 1), "1 0"); + t!(format!("{foo} {bar}", foo=0, bar=1), "0 1"); + t!(format!("{foo} {1} {bar} {0}", 0, 1, foo=2, bar=3), "2 1 3 0"); t!(format!("{} {0}", "a"), "a a"); - t!(format!("{foo_bar}", foo_bar=1i), "1"); - t!(format!("{}", 5i + 5i), "10"); + t!(format!("{foo_bar}", foo_bar=1), "1"); + t!(format!("{}", 5 + 5), "10"); t!(format!("{:#4}", C), "☃123"); // FIXME(#20676) - // let a: &fmt::Show = &1i; - // t!(format!("{:?}", a), "1i"); + // let a: &fmt::Debug = &1; + // t!(format!("{:?}", a), "1"); // Formatting strings and their arguments @@ -146,14 +146,14 @@ pub fn main() { test_order(); // make sure that format! doesn't move out of local variables - let a = box 3i; + let a = box 3; format!("{}", a); format!("{}", a); // make sure that format! doesn't cause spurious unused-unsafe warnings when // it's inside of an outer unsafe block unsafe { - let a: int = ::std::mem::transmute(3u); + let a: isize = ::std::mem::transmute(3_usize); format!("{}", a); } @@ -165,14 +165,14 @@ pub fn main() { } // Basic test to make sure that we can invoke the `write!` macro with an -// io::Writer instance. +// fmt::Write instance. fn test_write() { - use std::fmt::Writer; + use std::fmt::Write; let mut buf = String::new(); - write!(&mut buf, "{}", 3i); + write!(&mut buf, "{}", 3); { let w = &mut buf; - write!(w, "{foo}", foo=4i); + write!(w, "{foo}", foo=4); write!(w, "{}", "hello"); writeln!(w, "{}", "line"); writeln!(w, "{foo}", foo="bar"); @@ -194,13 +194,13 @@ fn test_print() { // Just make sure that the macros are defined, there's not really a lot that we // can do with them just yet (to test the output) fn test_format_args() { - use std::fmt::Writer; + use std::fmt::Write; let mut buf = String::new(); { let w = &mut buf; - write!(w, "{}", format_args!("{}", 1i)); + write!(w, "{}", format_args!("{}", 1)); write!(w, "{}", format_args!("test")); - write!(w, "{}", format_args!("{test}", test=3i)); + write!(w, "{}", format_args!("{test}", test=3)); } let s = buf; t!(s, "1test3"); @@ -214,8 +214,8 @@ fn test_format_args() { fn test_order() { // Make sure format!() arguments are always evaluated in a left-to-right // ordering - fn foo() -> int { - static mut FOO: int = 0; + fn foo() -> isize { + static mut FOO: isize = 0; unsafe { FOO += 1; FOO diff --git a/src/test/run-pass/ignore-all-the-things.rs b/src/test/run-pass/ignore-all-the-things.rs index 1c87b6dad8..65fc24ae74 100644 --- a/src/test/run-pass/ignore-all-the-things.rs +++ b/src/test/run-pass/ignore-all-the-things.rs @@ -23,28 +23,28 @@ pub fn main() { //let (a, b, ..) = (5, 5, 5, 5); //let (.., c, d) = (5, 5, 5, 5); let Bar{b: b, ..} = Bar{a: 5, b: 5, c: 5, d: 5}; - match [5i, 5, 5, 5] { + match [5, 5, 5, 5] { [..] => { } } - match [5i, 5, 5, 5] { + match [5, 5, 5, 5] { [a, ..] => { } } - match [5i, 5, 5, 5] { + match [5, 5, 5, 5] { [.., b] => { } } - match [5i, 5, 5, 5] { + match [5, 5, 5, 5] { [a, .., b] => { } } - match [5i, 5, 5] { + match [5, 5, 5] { [..] => { } } - match [5i, 5, 5] { + match [5, 5, 5] { [a, ..] => { } } - match [5i, 5, 5] { + match [5, 5, 5] { [.., a] => { } } - match [5i, 5, 5] { + match [5, 5, 5] { [a, .., b] => { } } } diff --git a/src/test/run-pass/import-glob-crate.rs b/src/test/run-pass/import-glob-crate.rs index 24d90741bb..f7874cc56f 100644 --- a/src/test/run-pass/import-glob-crate.rs +++ b/src/test/run-pass/import-glob-crate.rs @@ -14,7 +14,7 @@ use std::mem::*; pub fn main() { assert_eq!(size_of::(), 1); - let (mut x, mut y) = (1i, 2i); + let (mut x, mut y) = (1, 2); swap(&mut x, &mut y); assert_eq!(x, 2); assert_eq!(y, 1); diff --git a/src/test/run-pass/import-in-block.rs b/src/test/run-pass/import-in-block.rs index 3c28354ded..4567651e89 100644 --- a/src/test/run-pass/import-in-block.rs +++ b/src/test/run-pass/import-in-block.rs @@ -10,11 +10,11 @@ pub fn main() { use std::mem::replace; - let mut x = 5i; + let mut x = 5; replace(&mut x, 6); { use std::mem::*; - let mut y = 6i; + let mut y = 6; swap(&mut x, &mut y); } } diff --git a/src/test/run-pass/import4.rs b/src/test/run-pass/import4.rs index 0639d73208..44f6b6140f 100644 --- a/src/test/run-pass/import4.rs +++ b/src/test/run-pass/import4.rs @@ -16,4 +16,4 @@ mod zed { pub fn bar() { println!("bar"); } } -pub fn main() { let _zed = 42i; bar(); } +pub fn main() { let _zed = 42; bar(); } diff --git a/src/test/run-pass/inconsistent-lifetime-mismatch.rs b/src/test/run-pass/inconsistent-lifetime-mismatch.rs index b30583c666..d87b59537d 100644 --- a/src/test/run-pass/inconsistent-lifetime-mismatch.rs +++ b/src/test/run-pass/inconsistent-lifetime-mismatch.rs @@ -15,7 +15,7 @@ fn bad(a: &str, b: &str) { } fn good(a: &str, b: &str) { - foo(&[a.as_slice(), b.as_slice()]); + foo(&[a, b]); } fn main() {} diff --git a/src/test/run-pass/infer-container-across-object-cast.rs b/src/test/run-pass/infer-container-across-object-cast.rs new file mode 100644 index 0000000000..979e76b1ff --- /dev/null +++ b/src/test/run-pass/infer-container-across-object-cast.rs @@ -0,0 +1,59 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Given ` as Box`, we should be able to infer that a +// `Box<_>` is the expected type. + +trait Foo { fn foo(&self) -> u32; } +impl Foo for u32 { fn foo(&self) -> u32 { *self } } + +// (another impl to ensure trait-matching cannot just choose from a singleton set) +impl Foo for () { fn foo(&self) -> u32 { -176 } } + +trait Boxed { fn make() -> Self; } +impl Boxed for Box { fn make() -> Self { Box::new(7) } } + +// (another impl to ensure trait-matching cannot just choose from a singleton set) +impl Boxed for () { fn make() -> Self { () } } + +fn boxed_foo() { + let b7 = Boxed::make() as Box; + assert_eq!(b7.foo(), 7); +} + +trait Refed<'a,T> { fn make(&'a T) -> Self; } +impl<'a> Refed<'a, u32> for &'a u32 { fn make(x: &'a u32) -> Self { x } } + +// (another impl to ensure trait-matching cannot just choose from a singleton set) +impl<'a,'b> Refed<'a, ()> for &'b () { fn make(_: &'a ()) -> Self { static U: () = (); &U } } + +fn refed_foo() { + let a = 8; + let b7 = Refed::make(&a) as &Foo; + assert_eq!(b7.foo(), 8); +} + +fn check_subtyping_works() { + fn inner<'short, 'long:'short>(_s: &'short u32, + l: &'long u32) -> &'short (Foo+'short) { + Refed::make(l) as &Foo + } + + let a = 9; + let b = 10; + let r = inner(&b, &a); + assert_eq!(r.foo(), 9); +} + +pub fn main() { + boxed_foo(); + refed_foo(); + check_subtyping_works(); +} diff --git a/src/test/run-pass/inferred-suffix-in-pattern-range.rs b/src/test/run-pass/inferred-suffix-in-pattern-range.rs index a104ee6baa..be561dfffa 100644 --- a/src/test/run-pass/inferred-suffix-in-pattern-range.rs +++ b/src/test/run-pass/inferred-suffix-in-pattern-range.rs @@ -9,14 +9,14 @@ // except according to those terms. pub fn main() { - let x = 2i; + let x = 2; let x_message = match x { 0 ... 1 => { "not many".to_string() } _ => { "lots".to_string() } }; assert_eq!(x_message, "lots".to_string()); - let y = 2i; + let y = 2; let y_message = match y { 0 ... 1 => { "not many".to_string() } _ => { "lots".to_string() } diff --git a/src/test/run-pass/init-large-type.rs b/src/test/run-pass/init-large-type.rs new file mode 100644 index 0000000000..8ee6054f8b --- /dev/null +++ b/src/test/run-pass/init-large-type.rs @@ -0,0 +1,30 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Makes sure that zero-initializing large types is reasonably fast, +// Doing it incorrectly causes massive slowdown in LLVM during +// optimisation. + +#![feature(intrinsics)] + +use std::thread::Thread; + +extern "rust-intrinsic" { + pub fn init() -> T; +} + +const SIZE: usize = 1024 * 1024; + +fn main() { + // do the test in a new thread to avoid (spurious?) stack overflows + let _ = Thread::scoped(|| { + let _memory: [u8; SIZE] = unsafe { init() }; + }).join(); +} diff --git a/src/test/run-pass/init-res-into-things.rs b/src/test/run-pass/init-res-into-things.rs index eeae3f35cf..ee793359fb 100644 --- a/src/test/run-pass/init-res-into-things.rs +++ b/src/test/run-pass/init-res-into-things.rs @@ -37,7 +37,7 @@ fn r(i: &Cell) -> r { } fn test_rec() { - let i = &Cell::new(0i); + let i = &Cell::new(0); { let _a = BoxR {x: r(i)}; } @@ -49,7 +49,7 @@ fn test_tag() { t0(r<'a>), } - let i = &Cell::new(0i); + let i = &Cell::new(0); { let _a = t::t0(r(i)); } @@ -57,15 +57,15 @@ fn test_tag() { } fn test_tup() { - let i = &Cell::new(0i); + let i = &Cell::new(0); { - let _a = (r(i), 0i); + let _a = (r(i), 0); } assert_eq!(i.get(), 1); } fn test_unique() { - let i = &Cell::new(0i); + let i = &Cell::new(0); { let _a = box r(i); } @@ -73,7 +73,7 @@ fn test_unique() { } fn test_unique_rec() { - let i = &Cell::new(0i); + let i = &Cell::new(0); { let _a = box BoxR { x: r(i) diff --git a/src/test/run-pass/inner-static.rs b/src/test/run-pass/inner-static.rs index f9b430c155..e4026a8fd0 100644 --- a/src/test/run-pass/inner-static.rs +++ b/src/test/run-pass/inner-static.rs @@ -13,9 +13,9 @@ extern crate inner_static; pub fn main() { - let a = inner_static::A::<()>; - let b = inner_static::B::<()>; - let c = inner_static::test::A::<()>; + let a = inner_static::A::<()> { v: () }; + let b = inner_static::B::<()> { v: () }; + let c = inner_static::test::A::<()> { v: () }; assert_eq!(a.bar(), 2); assert_eq!(b.bar(), 4); assert_eq!(c.bar(), 6); diff --git a/src/test/run-pass/integer-literal-radix.rs b/src/test/run-pass/integer-literal-radix.rs index b1a92f7044..ea8825d22d 100644 --- a/src/test/run-pass/integer-literal-radix.rs +++ b/src/test/run-pass/integer-literal-radix.rs @@ -9,12 +9,12 @@ // except according to those terms. pub fn main() { - let a = 0xBEEFi; - let b = 0o755i; - let c = 0b10101i; - let d = -0xBEEFi; - let e = -0o755i; - let f = -0b10101i; + let a = 0xBEEF_isize; + let b = 0o755_isize; + let c = 0b10101_isize; + let d = -0xBEEF_isize; + let e = -0o755_isize; + let f = -0b10101_isize; assert_eq!(a, 48879); assert_eq!(b, 493); diff --git a/src/test/run-pass/into-iterator-type-inference-shift.rs b/src/test/run-pass/into-iterator-type-inference-shift.rs new file mode 100644 index 0000000000..26a0abc76a --- /dev/null +++ b/src/test/run-pass/into-iterator-type-inference-shift.rs @@ -0,0 +1,41 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// 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 +// propagation yet, and so we just saw a type variable, yielding an +// error. + +use std::u8; + +trait IntoIterator { + type Iter: Iterator; + + fn into_iter(self) -> Self::Iter; +} + +impl IntoIterator for I where I: Iterator { + type Iter = I; + + fn into_iter(self) -> I { + self + } +} + +fn desugared_for_loop_bad(byte: u8) -> u8 { + let mut result = 0; + let mut x = IntoIterator::into_iter(range(0, u8::BITS)); + let mut y = Iterator::next(&mut x); + let mut z = y.unwrap(); + byte >> z; + 1 +} + +fn main() {} diff --git a/src/test/run-pass/intrinsic-alignment.rs b/src/test/run-pass/intrinsic-alignment.rs index 52fcaf5c3a..f852bac404 100644 --- a/src/test/run-pass/intrinsic-alignment.rs +++ b/src/test/run-pass/intrinsic-alignment.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(intrinsics)] +#![feature(intrinsics, main)] mod rusti { extern "rust-intrinsic" { @@ -20,14 +20,15 @@ mod rusti { #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", - target_os = "dragonfly"))] + target_os = "dragonfly", + target_os = "openbsd"))] mod m { #[main] #[cfg(target_arch = "x86")] pub fn main() { unsafe { - assert_eq!(::rusti::pref_align_of::(), 8u); - assert_eq!(::rusti::min_align_of::(), 4u); + assert_eq!(::rusti::pref_align_of::(), 8_usize); + assert_eq!(::rusti::min_align_of::(), 4_usize); } } @@ -35,8 +36,8 @@ mod m { #[cfg(any(target_arch = "x86_64", target_arch = "arm", target_arch = "aarch64"))] pub fn main() { unsafe { - assert_eq!(::rusti::pref_align_of::(), 8u); - assert_eq!(::rusti::min_align_of::(), 8u); + assert_eq!(::rusti::pref_align_of::(), 8_usize); + assert_eq!(::rusti::min_align_of::(), 8_usize); } } } @@ -47,8 +48,8 @@ mod m { #[cfg(target_arch = "x86")] pub fn main() { unsafe { - assert_eq!(::rusti::pref_align_of::(), 8u); - assert_eq!(::rusti::min_align_of::(), 8u); + assert_eq!(::rusti::pref_align_of::(), 8_usize); + assert_eq!(::rusti::min_align_of::(), 8_usize); } } @@ -56,8 +57,8 @@ mod m { #[cfg(target_arch = "x86_64")] pub fn main() { unsafe { - assert_eq!(::rusti::pref_align_of::(), 8u); - assert_eq!(::rusti::min_align_of::(), 8u); + assert_eq!(::rusti::pref_align_of::(), 8_usize); + assert_eq!(::rusti::min_align_of::(), 8_usize); } } } @@ -65,11 +66,11 @@ mod m { #[cfg(target_os = "android")] mod m { #[main] - #[cfg(target_arch = "arm")] + #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] pub fn main() { unsafe { - assert_eq!(::rusti::pref_align_of::(), 8u); - assert_eq!(::rusti::min_align_of::(), 8u); + assert_eq!(::rusti::pref_align_of::(), 8_usize); + assert_eq!(::rusti::min_align_of::(), 8_usize); } } } diff --git a/src/test/run-pass/intrinsic-atomics.rs b/src/test/run-pass/intrinsic-atomics.rs index 0644fbbc99..d3f62f9d04 100644 --- a/src/test/run-pass/intrinsic-atomics.rs +++ b/src/test/run-pass/intrinsic-atomics.rs @@ -40,7 +40,7 @@ mod rusti { pub fn main() { unsafe { - let mut x = box 1i; + let mut x = box 1; assert_eq!(rusti::atomic_load(&*x), 1); *x = 5; diff --git a/src/test/run-pass/intrinsic-move-val.rs b/src/test/run-pass/intrinsic-move-val.rs index fb04f67e38..0daf661c2f 100644 --- a/src/test/run-pass/intrinsic-move-val.rs +++ b/src/test/run-pass/intrinsic-move-val.rs @@ -23,7 +23,7 @@ mod rusti { pub fn main() { unsafe { - let x = box 1i; + let x = box 1; let mut y = rusti::init(); let mut z: *const uint = transmute(&x); rusti::move_val_init(&mut y, x); diff --git a/src/test/run-pass/issue-10396.rs b/src/test/run-pass/issue-10396.rs index 308783f0d4..b487608d4e 100644 --- a/src/test/run-pass/issue-10396.rs +++ b/src/test/run-pass/issue-10396.rs @@ -8,13 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(Show)] +#[derive(Debug)] enum Foo<'s> { V(&'s str) } fn f(arr: &[&Foo]) { - for &f in arr.iter() { + for &f in arr { println!("{:?}", f); } } diff --git a/src/test/run-pass/issue-10456.rs b/src/test/run-pass/issue-10456.rs index b714d87f4e..da73c4b27a 100644 --- a/src/test/run-pass/issue-10456.rs +++ b/src/test/run-pass/issue-10456.rs @@ -14,7 +14,9 @@ pub trait Bar { fn bar(&self); } -pub trait Baz {} +pub trait Baz { + fn baz(&self) { } +} impl Bar for T { fn bar(&self) {} diff --git a/src/test/run-pass/issue-10626.rs b/src/test/run-pass/issue-10626.rs index b06799444f..29e4801d0a 100644 --- a/src/test/run-pass/issue-10626.rs +++ b/src/test/run-pass/issue-10626.rs @@ -12,23 +12,22 @@ // Make sure that if a process doesn't have its stdio/stderr descriptors set up // that we don't die in a large ball of fire -use std::os; -use std::io::process; +use std::env; +use std::old_io::process; pub fn main () { - let args = os::args(); - let args = args.as_slice(); - if args.len() > 1 && args[1].as_slice() == "child" { - for _ in range(0i, 1000i) { + let args: Vec = env::args().collect(); + if args.len() > 1 && args[1] == "child" { + for _ in 0..1000 { println!("hello?"); } - for _ in range(0i, 1000i) { + for _ in 0..1000 { println!("hello?"); } return; } - let mut p = process::Command::new(args[0].as_slice()); + let mut p = process::Command::new(&args[0]); p.arg("child").stdout(process::Ignored).stderr(process::Ignored); println!("{:?}", p.spawn().unwrap().wait()); } diff --git a/src/test/run-pass/issue-10638.rs b/src/test/run-pass/issue-10638.rs index a4ef77df31..bc77b4c534 100644 --- a/src/test/run-pass/issue-10638.rs +++ b/src/test/run-pass/issue-10638.rs @@ -13,6 +13,6 @@ pub fn main() { ////////////////// still not a doc comment /////**** nope, me neither */ /*** And neither am I! */ - 5i; + 5; /*****! certainly not I */ } diff --git a/src/test/run-pass/issue-10683.rs b/src/test/run-pass/issue-10683.rs index 26ee65fa56..a01d2e6f1a 100644 --- a/src/test/run-pass/issue-10683.rs +++ b/src/test/run-pass/issue-10683.rs @@ -13,7 +13,7 @@ use std::ascii::AsciiExt; static NAME: &'static str = "hello world"; fn main() { - match NAME.to_ascii_lowercase().as_slice() { + match &*NAME.to_ascii_lowercase() { "foo" => {} _ => {} } diff --git a/src/test/run-pass/issue-10718.rs b/src/test/run-pass/issue-10718.rs index 71b4cbe933..c3ec3fc40e 100644 --- a/src/test/run-pass/issue-10718.rs +++ b/src/test/run-pass/issue-10718.rs @@ -15,6 +15,6 @@ fn f(p: F) { } pub fn main() { - let p = |:| (); + let p = || (); f(p); } diff --git a/src/test/run-pass/issue-10734.rs b/src/test/run-pass/issue-10734.rs index 1c267f4833..a6af2327c9 100644 --- a/src/test/run-pass/issue-10734.rs +++ b/src/test/run-pass/issue-10734.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(unsafe_no_drop_flag)] + static mut drop_count: uint = 0; #[unsafe_no_drop_flag] diff --git a/src/test/run-pass/issue-10802.rs b/src/test/run-pass/issue-10802.rs index de2b4c51e5..174a69e113 100644 --- a/src/test/run-pass/issue-10802.rs +++ b/src/test/run-pass/issue-10802.rs @@ -29,7 +29,7 @@ impl Drop for DroppableEnum { } } -trait MyTrait { } +trait MyTrait { fn dummy(&self) { } } impl MyTrait for Box {} impl MyTrait for Box {} diff --git a/src/test/run-pass/issue-10902.rs b/src/test/run-pass/issue-10902.rs index 324a1701b2..7fab6662ee 100644 --- a/src/test/run-pass/issue-10902.rs +++ b/src/test/run-pass/issue-10902.rs @@ -9,7 +9,7 @@ // except according to those terms. pub mod two_tuple { - pub trait T {} + pub trait T { fn dummy(&self) { } } pub struct P<'a>(&'a (T + 'a), &'a (T + 'a)); pub fn f<'a>(car: &'a T, cdr: &'a T) -> P<'a> { P(car, cdr) @@ -17,7 +17,7 @@ pub mod two_tuple { } pub mod two_fields { - pub trait T {} + pub trait T { fn dummy(&self) { } } pub struct P<'a> { car: &'a (T + 'a), cdr: &'a (T + 'a) } pub fn f<'a>(car: &'a T, cdr: &'a T) -> P<'a> { P{ car: car, cdr: cdr } diff --git a/src/test/run-pass/issue-11205.rs b/src/test/run-pass/issue-11205.rs index 194208620a..1325b51a54 100644 --- a/src/test/run-pass/issue-11205.rs +++ b/src/test/run-pass/issue-11205.rs @@ -12,7 +12,7 @@ #![allow(unknown_features)] #![feature(box_syntax)] -trait Foo {} +trait Foo { fn dummy(&self) { } } impl Foo for int {} fn foo(_: [&Foo; 2]) {} fn foos(_: &[&Foo]) {} @@ -22,45 +22,45 @@ fn bar(_: [Box; 2]) {} fn bars(_: &[Box]) {} fn main() { - let x: [&Foo; 2] = [&1i, &2i]; + let x: [&Foo; 2] = [&1, &2]; foo(x); - foo([&1i, &2i]); + foo([&1, &2]); - let r = &1i; + let r = &1; let x: [&Foo; 2] = [r; 2]; foo(x); - foo([&1i; 2]); + foo([&1; 2]); - let x: &[&Foo] = &[&1i, &2i]; + let x: &[&Foo] = &[&1, &2]; foos(x); - foos(&[&1i, &2i]); + foos(&[&1, &2]); - let x: &[&Foo] = &[&1i, &2i]; - let r = &1i; + let x: &[&Foo] = &[&1, &2]; + let r = &1; foog(x, &[r]); - let x: [Box; 2] = [box 1i, box 2i]; + let x: [Box; 2] = [box 1, box 2]; bar(x); - bar([box 1i, box 2i]); + bar([box 1, box 2]); - let x: &[Box] = &[box 1i, box 2i]; + let x: &[Box] = &[box 1, box 2]; bars(x); - bars(&[box 1i, box 2i]); + bars(&[box 1, box 2]); - let x: &[Box] = &[box 1i, box 2i]; - foog(x, &[box 1i]); + let x: &[Box] = &[box 1, box 2]; + foog(x, &[box 1]); struct T<'a> { t: [&'a (Foo+'a); 2] } let _n = T { - t: [&1i, &2i] + t: [&1, &2] }; - let r = &1i; + let r = &1; let _n = T { t: [r; 2] }; - let x: [&Foo; 2] = [&1i, &2i]; + let x: [&Foo; 2] = [&1, &2]; let _n = T { t: x }; @@ -69,14 +69,14 @@ fn main() { t: &'b [&'b (Foo+'b)] } let _n = F { - t: &[&1i, &2i] + t: &[&1, &2] }; - let r = &1i; + let r = &1; let r: [&Foo; 2] = [r; 2]; let _n = F { t: &r }; - let x: [&Foo; 2] = [&1i, &2i]; + let x: [&Foo; 2] = [&1, &2]; let _n = F { t: &x }; @@ -85,9 +85,9 @@ fn main() { t: &'a [Box] } let _n = M { - t: &[box 1i, box 2i] + t: &[box 1, box 2] }; - let x: [Box; 2] = [box 1i, box 2i]; + let x: [Box; 2] = [box 1, box 2]; let _n = M { t: &x }; diff --git a/src/test/run-pass/issue-11225-1.rs b/src/test/run-pass/issue-11225-1.rs index 7d1c93fe9a..a45d129ade 100644 --- a/src/test/run-pass/issue-11225-1.rs +++ b/src/test/run-pass/issue-11225-1.rs @@ -13,5 +13,5 @@ extern crate "issue-11225-1" as foo; pub fn main() { - foo::foo(1i); + foo::foo(1); } diff --git a/src/test/run-pass/issue-11225-2.rs b/src/test/run-pass/issue-11225-2.rs index 7f36c38283..f07957b30e 100644 --- a/src/test/run-pass/issue-11225-2.rs +++ b/src/test/run-pass/issue-11225-2.rs @@ -13,5 +13,5 @@ extern crate "issue-11225-2" as foo; pub fn main() { - foo::foo(1i); + foo::foo(1); } diff --git a/src/test/run-pass/issue-11384.rs b/src/test/run-pass/issue-11384.rs index a511149b05..26634fabf5 100644 --- a/src/test/run-pass/issue-11384.rs +++ b/src/test/run-pass/issue-11384.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Common {} +trait Common { fn dummy(&self) { } } impl<'t, T> Common for (T, &'t T) {} diff --git a/src/test/run-pass/issue-11552.rs b/src/test/run-pass/issue-11552.rs index f47f1e0601..b99a5b7ab3 100644 --- a/src/test/run-pass/issue-11552.rs +++ b/src/test/run-pass/issue-11552.rs @@ -9,6 +9,7 @@ // except according to those terms. #![allow(unknown_features)] +#![feature(box_patterns)] #![feature(box_syntax)] #[derive(Clone)] diff --git a/src/test/run-pass/issue-11612.rs b/src/test/run-pass/issue-11612.rs index fa25d25df0..3c69377b37 100644 --- a/src/test/run-pass/issue-11612.rs +++ b/src/test/run-pass/issue-11612.rs @@ -12,7 +12,7 @@ // We weren't updating the auto adjustments with all the resolved // type information after type check. -trait A {} +trait A { fn dummy(&self) { } } struct B<'a, T:'a> { f: &'a T diff --git a/src/test/run-pass/issue-11677.rs b/src/test/run-pass/issue-11677.rs index 6fa4505869..7cccac4483 100644 --- a/src/test/run-pass/issue-11677.rs +++ b/src/test/run-pass/issue-11677.rs @@ -14,13 +14,18 @@ // this code used to cause an ICE -trait X {} +use std::marker; + +trait X { + fn dummy(&self) -> T { panic!() } +} struct S {f: Box+'static>, g: Box+'static>} struct F; -impl X for F {} +impl X for F { +} fn main() { S {f: box F, g: box F}; diff --git a/src/test/run-pass/issue-11736.rs b/src/test/run-pass/issue-11736.rs index bc4ceb38de..b901e95ff5 100644 --- a/src/test/run-pass/issue-11736.rs +++ b/src/test/run-pass/issue-11736.rs @@ -10,15 +10,15 @@ extern crate collections; -use std::collections::Bitv; +use std::collections::BitVec; use std::num::Float; fn main() { // Generate sieve of Eratosthenes for n up to 1e6 - let n = 1000000u; - let mut sieve = Bitv::from_elem(n+1, true); + let n = 1000000_usize; + let mut sieve = BitVec::from_elem(n+1, true); let limit: uint = (n as f32).sqrt() as uint; - for i in range(2, limit+1) { + for i in 2..limit+1 { if sieve[i] { let mut j = 0; while i*i + j*i <= n { @@ -27,7 +27,7 @@ fn main() { } } } - for i in range(2, n+1) { + for i in 2..n+1 { if sieve[i] { } } diff --git a/src/test/run-pass/issue-11869.rs b/src/test/run-pass/issue-11869.rs index c75d02c632..12a6d9a82c 100644 --- a/src/test/run-pass/issue-11869.rs +++ b/src/test/run-pass/issue-11869.rs @@ -13,7 +13,7 @@ struct A { } fn borrow<'a>(binding: &'a A) -> &'a str { - match binding.a.as_slice() { + match &*binding.a { "in" => "in_", "ref" => "ref_", ident => ident diff --git a/src/test/run-pass/issue-11881.rs b/src/test/run-pass/issue-11881.rs index d0d8a8589a..10d694957f 100644 --- a/src/test/run-pass/issue-11881.rs +++ b/src/test/run-pass/issue-11881.rs @@ -13,9 +13,9 @@ extern crate rbml; extern crate serialize; -use std::io; +use std::old_io; use std::fmt; -use std::io::{IoResult, SeekStyle}; +use std::old_io::{IoResult, SeekStyle}; use std::slice; use serialize::{Encodable, Encoder}; diff --git a/src/test/run-pass/issue-11958.rs b/src/test/run-pass/issue-11958.rs index 13177880c5..00613f35f1 100644 --- a/src/test/run-pass/issue-11958.rs +++ b/src/test/run-pass/issue-11958.rs @@ -19,6 +19,6 @@ use std::thunk::Thunk; pub fn main() { - let mut x = 1i; + let mut x = 1i32; let _thunk = Thunk::new(move|| { x = 2; }); } diff --git a/src/test/run-pass/issue-1257.rs b/src/test/run-pass/issue-1257.rs index ad3a050dde..7d5bd9d6a7 100644 --- a/src/test/run-pass/issue-1257.rs +++ b/src/test/run-pass/issue-1257.rs @@ -10,7 +10,7 @@ pub fn main () { let mut line = "".to_string(); - let mut i = 0i; + let mut i = 0; while line != "exit".to_string() { line = if i == 9 { "exit".to_string() } else { "notexit".to_string() }; i += 1; diff --git a/src/test/run-pass/issue-12582.rs b/src/test/run-pass/issue-12582.rs index ab2abc094f..4009d17139 100644 --- a/src/test/run-pass/issue-12582.rs +++ b/src/test/run-pass/issue-12582.rs @@ -11,10 +11,10 @@ // ignore-lexer-test FIXME #15877 pub fn main() { - let x = 1i; - let y = 2i; + let x = 1; + let y = 2; - assert_eq!(3i, match (x, y) { + assert_eq!(3, match (x, y) { (1, 1) => 1, (2, 2) => 2, (1...2, 2) => 3, @@ -22,7 +22,7 @@ pub fn main() { }); // nested tuple - assert_eq!(3i, match ((x, y),) { + assert_eq!(3, match ((x, y),) { ((1, 1),) => 1, ((2, 2),) => 2, ((1...2, 2),) => 3, diff --git a/src/test/run-pass/issue-12684.rs b/src/test/run-pass/issue-12684.rs index a6a4d21e8f..e66b5d21e1 100644 --- a/src/test/run-pass/issue-12684.rs +++ b/src/test/run-pass/issue-12684.rs @@ -9,14 +9,14 @@ // except according to those terms. use std::time::Duration; -use std::thread::Thread; +use std::thread; fn main() { - Thread::scoped(move|| customtask()).join().ok().unwrap(); + thread::spawn(move|| customtask()).join().ok().unwrap(); } fn customtask() { - let mut timer = std::io::timer::Timer::new().unwrap(); + let mut timer = std::old_io::timer::Timer::new().unwrap(); let periodic = timer.periodic(Duration::milliseconds(10)); periodic.recv(); } diff --git a/src/test/run-pass/issue-12699.rs b/src/test/run-pass/issue-12699.rs index 2dc2518160..b55d647775 100644 --- a/src/test/run-pass/issue-12699.rs +++ b/src/test/run-pass/issue-12699.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::io::timer; +use std::old_io::timer; use std::time::Duration; fn main() { diff --git a/src/test/run-pass/issue-12744.rs b/src/test/run-pass/issue-12744.rs index ec929a9c79..2f7ba315aa 100644 --- a/src/test/run-pass/issue-12744.rs +++ b/src/test/run-pass/issue-12744.rs @@ -12,6 +12,6 @@ #![feature(box_syntax)] fn main() { - fn test() -> Box { box 1i } + fn test() -> Box { box 1 } println!("{:?}", test()) } diff --git a/src/test/run-pass/issue-12860.rs b/src/test/run-pass/issue-12860.rs index 8a95723c73..a05cc9c0f7 100644 --- a/src/test/run-pass/issue-12860.rs +++ b/src/test/run-pass/issue-12860.rs @@ -13,15 +13,13 @@ extern crate collections; use std::collections::HashSet; -#[derive(PartialEq, Eq, Hash)] +#[derive(Copy, PartialEq, Eq, Hash)] struct XYZ { x: int, y: int, z: int } -impl Copy for XYZ {} - fn main() { let mut connected = HashSet::new(); let mut border = HashSet::new(); diff --git a/src/test/run-pass/issue-12909.rs b/src/test/run-pass/issue-12909.rs index dfdf979fce..b7dc98b92e 100644 --- a/src/test/run-pass/issue-12909.rs +++ b/src/test/run-pass/issue-12909.rs @@ -15,7 +15,7 @@ fn copy(&x: &T) -> T { } fn main() { - let arr = [(1i, 1u), (2, 2), (3, 3)]; + let arr = [(1, 1_usize), (2, 2), (3, 3)]; let v1: Vec<&_> = arr.iter().collect(); let v2: Vec<_> = arr.iter().map(copy).collect(); diff --git a/src/test/run-pass/issue-13027.rs b/src/test/run-pass/issue-13027.rs index 1f61da2f42..056c86b01f 100644 --- a/src/test/run-pass/issue-13027.rs +++ b/src/test/run-pass/issue-13027.rs @@ -29,99 +29,99 @@ pub fn main() { } fn lit_shadow_range() { - assert_eq!(2i, match 1i { - 1 if false => 1i, + assert_eq!(2, match 1 { + 1 if false => 1, 1...2 => 2, _ => 3 }); - let x = 0i; - assert_eq!(2i, match x+1 { - 0 => 0i, + let x = 0; + assert_eq!(2, match x+1 { + 0 => 0, 1 if false => 1, 1...2 => 2, _ => 3 }); - assert_eq!(2i, match val() { - 1 if false => 1i, + assert_eq!(2, match val() { + 1 if false => 1, 1...2 => 2, _ => 3 }); - assert_eq!(2i, match CONST { - 0 => 0i, + assert_eq!(2, match CONST { + 0 => 0, 1 if false => 1, 1...2 => 2, _ => 3 }); // value is out of the range of second arm, should match wildcard pattern - assert_eq!(3i, match 3i { - 1 if false => 1i, + assert_eq!(3, match 3 { + 1 if false => 1, 1...2 => 2, _ => 3 }); } fn range_shadow_lit() { - assert_eq!(2i, match 1i { - 1...2 if false => 1i, + assert_eq!(2, match 1 { + 1...2 if false => 1, 1 => 2, _ => 3 }); - let x = 0i; - assert_eq!(2i, match x+1 { - 0 => 0i, + let x = 0; + assert_eq!(2, match x+1 { + 0 => 0, 1...2 if false => 1, 1 => 2, _ => 3 }); - assert_eq!(2i, match val() { - 1...2 if false => 1i, + assert_eq!(2, match val() { + 1...2 if false => 1, 1 => 2, _ => 3 }); - assert_eq!(2i, match CONST { - 0 => 0i, + assert_eq!(2, match CONST { + 0 => 0, 1...2 if false => 1, 1 => 2, _ => 3 }); // ditto - assert_eq!(3i, match 3i { - 1...2 if false => 1i, + assert_eq!(3, match 3 { + 1...2 if false => 1, 1 => 2, _ => 3 }); } fn range_shadow_range() { - assert_eq!(2i, match 1i { - 0...2 if false => 1i, + assert_eq!(2, match 1 { + 0...2 if false => 1, 1...3 => 2, _ => 3, }); - let x = 0i; - assert_eq!(2i, match x+1 { + let x = 0; + assert_eq!(2, match x+1 { 100 => 0, 0...2 if false => 1, 1...3 => 2, _ => 3, }); - assert_eq!(2i, match val() { + assert_eq!(2, match val() { 0...2 if false => 1, 1...3 => 2, _ => 3, }); - assert_eq!(2i, match CONST { + assert_eq!(2, match CONST { 100 => 0, 0...2 if false => 1, 1...3 => 2, @@ -129,16 +129,16 @@ fn range_shadow_range() { }); // ditto - assert_eq!(3i, match 5i { - 0...2 if false => 1i, + assert_eq!(3, match 5 { + 0...2 if false => 1, 1...3 => 2, _ => 3, }); } fn multi_pats_shadow_lit() { - assert_eq!(2i, match 1i { - 100 => 0i, + assert_eq!(2, match 1 { + 100 => 0, 0 | 1...10 if false => 1, 1 => 2, _ => 3, @@ -146,8 +146,8 @@ fn multi_pats_shadow_lit() { } fn multi_pats_shadow_range() { - assert_eq!(2i, match 1i { - 100 => 0i, + assert_eq!(2, match 1 { + 100 => 0, 0 | 1...10 if false => 1, 1...3 => 2, _ => 3, @@ -155,8 +155,8 @@ fn multi_pats_shadow_range() { } fn lit_shadow_multi_pats() { - assert_eq!(2i, match 1i { - 100 => 0i, + assert_eq!(2, match 1 { + 100 => 0, 1 if false => 1, 0 | 1...10 => 2, _ => 3, @@ -164,8 +164,8 @@ fn lit_shadow_multi_pats() { } fn range_shadow_multi_pats() { - assert_eq!(2i, match 1i { - 100 => 0i, + assert_eq!(2, match 1 { + 100 => 0, 1...3 if false => 1, 0 | 1...10 => 2, _ => 3, @@ -179,10 +179,10 @@ fn misc() { // This test basically mimics how trace_macros! macro is implemented, // which is a rare combination of vector patterns, multiple wild-card // patterns and guard functions. - let r = match [Foo::Bar(0, false)].as_slice() { - [Foo::Bar(_, pred)] if pred => 1i, - [Foo::Bar(_, pred)] if !pred => 2i, - _ => 0i, + let r = match [Foo::Bar(0, false)] { + [Foo::Bar(_, pred)] if pred => 1, + [Foo::Bar(_, pred)] if !pred => 2, + _ => 0, }; - assert_eq!(2i, r); + assert_eq!(2, r); } diff --git a/src/test/run-pass/issue-13105.rs b/src/test/run-pass/issue-13105.rs index 7fab36bd64..64807dc44e 100644 --- a/src/test/run-pass/issue-13105.rs +++ b/src/test/run-pass/issue-13105.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Foo { +use std::marker::MarkerTrait; + +trait Foo : MarkerTrait { fn quux(u8) {} } diff --git a/src/test/run-pass/issue-13304.rs b/src/test/run-pass/issue-13304.rs index 11003c6fc5..4a7d6be55a 100644 --- a/src/test/run-pass/issue-13304.rs +++ b/src/test/run-pass/issue-13304.rs @@ -10,14 +10,13 @@ // ignore-fast -use std::os; -use std::io; +use std::env; +use std::old_io; use std::str; fn main() { - let args = os::args(); - let args = args.as_slice(); - if args.len() > 1 && args[1].as_slice() == "child" { + let args: Vec = env::args().collect(); + if args.len() > 1 && args[1] == "child" { child(); } else { parent(); @@ -25,19 +24,19 @@ fn main() { } fn parent() { - let args = os::args(); - let args = args.as_slice(); - let mut p = io::process::Command::new(args[0].as_slice()) + let args: Vec = env::args().collect(); + let mut p = old_io::process::Command::new(&args[0]) .arg("child").spawn().unwrap(); p.stdin.as_mut().unwrap().write_str("test1\ntest2\ntest3").unwrap(); let out = p.wait_with_output().unwrap(); assert!(out.status.success()); - let s = str::from_utf8(out.output.as_slice()).unwrap(); + let s = str::from_utf8(&out.output).unwrap(); assert_eq!(s, "test1\n\ntest2\n\ntest3\n"); } fn child() { - for line in io::stdin().lock().lines() { + let mut stdin = old_io::stdin(); + for line in stdin.lock().lines() { println!("{}", line.unwrap()); } } diff --git a/src/test/run-pass/issue-13323.rs b/src/test/run-pass/issue-13323.rs index 75d3c6f334..44167ad209 100644 --- a/src/test/run-pass/issue-13323.rs +++ b/src/test/run-pass/issue-13323.rs @@ -21,7 +21,7 @@ impl StrWrap { } fn get_s<'a>(&'a self) -> &'a str { - self.s.as_slice() + &self.s } } diff --git a/src/test/run-pass/issue-13352.rs b/src/test/run-pass/issue-13352.rs index 46a81301dc..a834371203 100644 --- a/src/test/run-pass/issue-13352.rs +++ b/src/test/run-pass/issue-13352.rs @@ -18,5 +18,5 @@ fn main() { foo(loop { unsafe { libc::exit(0 as libc::c_int); } }); - 2u + (loop {}); + 2_usize + (loop {}); } diff --git a/src/test/run-pass/issue-13434.rs b/src/test/run-pass/issue-13434.rs index 35e487539f..5d7a84d80d 100644 --- a/src/test/run-pass/issue-13434.rs +++ b/src/test/run-pass/issue-13434.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(Show)] +#[derive(Debug)] struct MyStruct; trait Repro { @@ -26,5 +26,5 @@ fn do_stuff(r: R) -> String { } pub fn main() { - assert_eq!("MyStruct".to_string(), do_stuff(|: s: MyStruct| format!("{:?}", s))); + assert_eq!("MyStruct".to_string(), do_stuff(|s: MyStruct| format!("{:?}", s))); } diff --git a/src/test/run-pass/issue-13494.rs b/src/test/run-pass/issue-13494.rs index bef0ff5fc2..95562d75c3 100644 --- a/src/test/run-pass/issue-13494.rs +++ b/src/test/run-pass/issue-13494.rs @@ -24,8 +24,8 @@ fn main() { let (tx, rx) = channel(); let _t = Thread::spawn(move|| { helper(rx) }); let (snd, rcv) = channel::(); - for _ in range(1i, 100000i) { - snd.send(1i).unwrap(); + for _ in 1..100000 { + snd.send(1).unwrap(); let (tx2, rx2) = channel(); tx.send(tx2).unwrap(); select! { diff --git a/src/test/run-pass/issue-13507-2.rs b/src/test/run-pass/issue-13507-2.rs index 4d150e7a68..1c0283070a 100644 --- a/src/test/run-pass/issue-13507-2.rs +++ b/src/test/run-pass/issue-13507-2.rs @@ -12,7 +12,7 @@ extern crate issue13507; use issue13507::testtypes; -use std::intrinsics::TypeId; +use std::any::TypeId; pub fn type_ids() -> Vec { let mut ids = vec!(); diff --git a/src/test/run-pass/issue-13655.rs b/src/test/run-pass/issue-13655.rs index 6fdaac9920..81a8b29461 100644 --- a/src/test/run-pass/issue-13655.rs +++ b/src/test/run-pass/issue-13655.rs @@ -13,7 +13,8 @@ use std::ops::Fn; struct Foo(T); -impl Fn<(), T> for Foo { +impl Fn<()> for Foo { + type Output = T; extern "rust-call" fn call(&self, _: ()) -> T { match *self { Foo(t) => t diff --git a/src/test/run-pass/issue-13867.rs b/src/test/run-pass/issue-13867.rs index 00ff837b98..960884c4aa 100644 --- a/src/test/run-pass/issue-13867.rs +++ b/src/test/run-pass/issue-13867.rs @@ -18,39 +18,39 @@ enum Foo { fn main() { let r = match (Foo::FooNullary, 'a') { - (Foo::FooUint(..), 'a'...'z') => 1i, - (Foo::FooNullary, 'x') => 2i, + (Foo::FooUint(..), 'a'...'z') => 1, + (Foo::FooNullary, 'x') => 2, _ => 0 }; assert_eq!(r, 0); let r = match (Foo::FooUint(0), 'a') { - (Foo::FooUint(1), 'a'...'z') => 1i, - (Foo::FooUint(..), 'x') => 2i, - (Foo::FooNullary, 'a') => 3i, + (Foo::FooUint(1), 'a'...'z') => 1, + (Foo::FooUint(..), 'x') => 2, + (Foo::FooNullary, 'a') => 3, _ => 0 }; assert_eq!(r, 0); let r = match ('a', Foo::FooUint(0)) { - ('a'...'z', Foo::FooUint(1)) => 1i, - ('x', Foo::FooUint(..)) => 2i, - ('a', Foo::FooNullary) => 3i, + ('a'...'z', Foo::FooUint(1)) => 1, + ('x', Foo::FooUint(..)) => 2, + ('a', Foo::FooNullary) => 3, _ => 0 }; assert_eq!(r, 0); let r = match ('a', 'a') { - ('a'...'z', 'b') => 1i, - ('x', 'a'...'z') => 2i, + ('a'...'z', 'b') => 1, + ('x', 'a'...'z') => 2, _ => 0 }; assert_eq!(r, 0); let r = match ('a', 'a') { - ('a'...'z', 'b') => 1i, - ('x', 'a'...'z') => 2i, - ('a', 'a') => 3i, + ('a'...'z', 'b') => 1, + ('x', 'a'...'z') => 2, + ('a', 'a') => 3, _ => 0 }; assert_eq!(r, 3); diff --git a/src/test/run-pass/issue-14021.rs b/src/test/run-pass/issue-14021.rs index 509459a2ab..e850ecbba6 100644 --- a/src/test/run-pass/issue-14021.rs +++ b/src/test/run-pass/issue-14021.rs @@ -15,14 +15,14 @@ extern crate serialize; use serialize::{Encodable, Decodable}; use serialize::json; -#[derive(Encodable, Decodable, PartialEq, Show)] +#[derive(Encodable, Decodable, PartialEq, Debug)] struct UnitLikeStruct; pub fn main() { let obj = UnitLikeStruct; - let json_str: String = json::encode(&obj); + let json_str: String = json::encode(&obj).unwrap(); - let json_object = json::from_str(json_str.as_slice()); + let json_object = json::from_str(&json_str); let mut decoder = json::Decoder::new(json_object.unwrap()); let mut decoded_obj: UnitLikeStruct = Decodable::decode(&mut decoder).unwrap(); diff --git a/src/test/run-pass/issue-14308.rs b/src/test/run-pass/issue-14308.rs index 82a1a16ba5..0e4b4a2c9c 100644 --- a/src/test/run-pass/issue-14308.rs +++ b/src/test/run-pass/issue-14308.rs @@ -13,12 +13,12 @@ struct B; fn main() { let x = match A(3) { - A(..) => 1i + A(..) => 1 }; assert_eq!(x, 1); let x = match A(4) { - A(1) => 1i, - A(..) => 2i + A(1) => 1, + A(..) => 2 }; assert_eq!(x, 2); @@ -26,7 +26,7 @@ fn main() { // There's no particularly good reason to support this, but it's currently allowed, // and this makes sure it doesn't ICE or break LLVM. let x = match B { - B(..) => 3i + B(..) => 3 }; assert_eq!(x, 3); } diff --git a/src/test/run-pass/issue-14393.rs b/src/test/run-pass/issue-14393.rs index e97021b486..6c9c7e2fd3 100644 --- a/src/test/run-pass/issue-14393.rs +++ b/src/test/run-pass/issue-14393.rs @@ -9,8 +9,8 @@ // except according to those terms. fn main() { - match ("", 1u) { - (_, 42u) => (), + match ("", 1_usize) { + (_, 42_usize) => (), ("", _) => (), _ => () } diff --git a/src/test/run-pass/issue-14399.rs b/src/test/run-pass/issue-14399.rs index 7e533c2cf8..db7eacce9d 100644 --- a/src/test/run-pass/issue-14399.rs +++ b/src/test/run-pass/issue-14399.rs @@ -19,7 +19,7 @@ #[derive(Clone)] struct B1; -trait A {} +trait A { fn foo(&self) {} } impl A for B1 {} fn main() { diff --git a/src/test/run-pass/issue-14456.rs b/src/test/run-pass/issue-14456.rs index f5fdf8704e..723db9485c 100644 --- a/src/test/run-pass/issue-14456.rs +++ b/src/test/run-pass/issue-14456.rs @@ -9,14 +9,14 @@ // except according to those terms. -use std::io::process; -use std::io::Command; -use std::io; -use std::os; +use std::old_io::process; +use std::old_io::Command; +use std::old_io; +use std::env; fn main() { - let args = os::args(); - if args.len() > 1 && args[1].as_slice() == "child" { + let args: Vec = env::args().collect(); + if args.len() > 1 && args[1] == "child" { return child() } @@ -25,14 +25,15 @@ fn main() { } fn child() { - io::stdout().write_line("foo").unwrap(); - io::stderr().write_line("bar").unwrap(); - assert_eq!(io::stdin().lock().read_line().err().unwrap().kind, io::EndOfFile); + old_io::stdout().write_line("foo").unwrap(); + old_io::stderr().write_line("bar").unwrap(); + let mut stdin = old_io::stdin(); + assert_eq!(stdin.lock().read_line().err().unwrap().kind, old_io::EndOfFile); } fn test() { - let args = os::args(); - let mut p = Command::new(args[0].as_slice()).arg("child") + let args: Vec = env::args().collect(); + let mut p = Command::new(&args[0]).arg("child") .stdin(process::Ignored) .stdout(process::Ignored) .stderr(process::Ignored) diff --git a/src/test/run-pass/issue-14589.rs b/src/test/run-pass/issue-14589.rs index d9763baa82..71d88ee621 100644 --- a/src/test/run-pass/issue-14589.rs +++ b/src/test/run-pass/issue-14589.rs @@ -17,17 +17,18 @@ fn main() { send::>(box Output(0)); Test::>::foo(box Output(0)); - Test::>.send(box Output(0)); + Test::>::new().send(box Output(0)); } fn send(_: T) {} -struct Test; +struct Test { marker: std::marker::PhantomData } impl Test { + fn new() -> Test { Test { marker: ::std::marker::PhantomData } } fn foo(_: T) {} fn send(&self, _: T) {} } -trait Foo {} +trait Foo { fn dummy(&self) { }} struct Output(int); impl Foo for Output {} diff --git a/src/test/run-pass/issue-1460.rs b/src/test/run-pass/issue-1460.rs index 2091a5437c..44465fe5f8 100644 --- a/src/test/run-pass/issue-1460.rs +++ b/src/test/run-pass/issue-1460.rs @@ -10,5 +10,5 @@ pub fn main() { - {|&: i| if 1i == i { }}; + {|i| if 1 == i { }}; } diff --git a/src/test/run-pass/issue-14865.rs b/src/test/run-pass/issue-14865.rs index 53af0c8635..c322346c2a 100644 --- a/src/test/run-pass/issue-14865.rs +++ b/src/test/run-pass/issue-14865.rs @@ -15,14 +15,14 @@ enum X { fn main() { let x = match X::Foo(42) { - X::Foo(..) => 1i, + X::Foo(..) => 1, _ if true => 0, X::Bar(..) => panic!("Oh dear") }; assert_eq!(x, 1); let x = match X::Foo(42) { - _ if true => 0i, + _ if true => 0, X::Foo(..) => 1, X::Bar(..) => panic!("Oh dear") }; diff --git a/src/test/run-pass/issue-14901.rs b/src/test/run-pass/issue-14901.rs index e41754fd1b..abb15dae00 100644 --- a/src/test/run-pass/issue-14901.rs +++ b/src/test/run-pass/issue-14901.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::io::Reader; +use std::old_io::Reader; enum Wrapper<'a> { WrapReader(&'a (Reader + 'a)) diff --git a/src/test/run-pass/issue-14919.rs b/src/test/run-pass/issue-14919.rs index 4d05b98147..933e7e40f0 100644 --- a/src/test/run-pass/issue-14919.rs +++ b/src/test/run-pass/issue-14919.rs @@ -58,6 +58,6 @@ fn match_indices<'a, M, T: IntoMatcher<'a, M>>(s: &'a str, from: T) -> MatchIndi fn main() { let s = "abcbdef"; - match_indices(s, |&mut: c: char| c == 'b') + match_indices(s, |c: char| c == 'b') .collect::>(); } diff --git a/src/test/run-pass/issue-14936.rs b/src/test/run-pass/issue-14936.rs index a441729e2d..ace1f00b02 100644 --- a/src/test/run-pass/issue-14936.rs +++ b/src/test/run-pass/issue-14936.rs @@ -31,7 +31,7 @@ macro_rules! demo { } assert_eq!((x,y), (1,1)); let b: &[_] = &["out", "in"]; - assert_eq!(history.as_slice(), b); + assert_eq!(history, b); } } } diff --git a/src/test/run-pass/issue-14940.rs b/src/test/run-pass/issue-14940.rs index d815620c96..ed0e3bddbe 100644 --- a/src/test/run-pass/issue-14940.rs +++ b/src/test/run-pass/issue-14940.rs @@ -8,16 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::os; -use std::io::{stdio, Command}; +use std::env; +use std::old_io::{stdio, Command}; fn main() { - let args = os::args(); + let mut args = env::args(); if args.len() > 1 { let mut out = stdio::stdout(); out.write(&['a' as u8; 128 * 1024]).unwrap(); } else { - let out = Command::new(args[0].as_slice()).arg("child").output(); + let out = Command::new(&args.next().unwrap()).arg("child").output(); let out = out.unwrap(); assert!(out.status.success()); } diff --git a/src/test/run-pass/issue-14958.rs b/src/test/run-pass/issue-14958.rs index 1ffd349a65..6335f79be6 100644 --- a/src/test/run-pass/issue-14958.rs +++ b/src/test/run-pass/issue-14958.rs @@ -10,11 +10,12 @@ #![feature(unboxed_closures)] -trait Foo {} +trait Foo { fn dummy(&self) { }} struct Bar; -impl<'a> std::ops::Fn<(&'a (Foo+'a),), ()> for Bar { +impl<'a> std::ops::Fn<(&'a (Foo+'a),)> for Bar { + type Output = (); extern "rust-call" fn call(&self, _: (&'a Foo,)) {} } diff --git a/src/test/run-pass/issue-14959.rs b/src/test/run-pass/issue-14959.rs index 99472bb361..53d0f7dae0 100644 --- a/src/test/run-pass/issue-14959.rs +++ b/src/test/run-pass/issue-14959.rs @@ -12,8 +12,8 @@ use std::ops::Fn; -trait Response {} -trait Request {} +trait Response { fn dummy(&self) { } } +trait Request { fn dummy(&self) { } } trait Ingot { fn enter(&mut self, _: &mut R, _: &mut S, a: &mut Alloy) -> Status; } @@ -21,7 +21,7 @@ trait Ingot { #[allow(dead_code)] struct HelloWorld; -struct SendFile<'a>; +struct SendFile; struct Alloy; enum Status { Continue @@ -33,7 +33,9 @@ impl Alloy { } } -impl<'a, 'b> Fn<(&'b mut (Response+'b),),()> for SendFile<'a> { +impl<'b> Fn<(&'b mut (Response+'b),)> for SendFile { + type Output = (); + extern "rust-call" fn call(&self, (_res,): (&'b mut (Response+'b),)) {} } diff --git a/src/test/run-pass/issue-15080.rs b/src/test/run-pass/issue-15080.rs index 76b8463a41..9752b01e52 100644 --- a/src/test/run-pass/issue-15080.rs +++ b/src/test/run-pass/issue-15080.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - let mut x: &[_] = &[1i, 2, 3, 4]; + let mut x: &[_] = &[1, 2, 3, 4]; let mut result = vec!(); loop { diff --git a/src/test/run-pass/issue-15149.rs b/src/test/run-pass/issue-15149.rs index 57dc6fd75f..aa176d5b0f 100644 --- a/src/test/run-pass/issue-15149.rs +++ b/src/test/run-pass/issue-15149.rs @@ -1,3 +1,5 @@ +// no-prefer-dynamic + // 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. @@ -8,33 +10,57 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::io::{TempDir, Command, fs}; -use std::os; +use std::slice::SliceExt; +use std::old_io::{fs, USER_RWX}; +use std::process; +use std::env; +use std::old_path::BytesContainer; +use std::rand::random; fn main() { // If we're the child, make sure we were invoked correctly - let args = os::args(); - if args.len() > 1 && args[1].as_slice() == "child" { - return assert_eq!(args[0].as_slice(), "mytest"); + let args: Vec = env::args().collect(); + if args.len() > 1 && args[1] == "child" { + // FIXME: This should check the whole `args[0]` instead of just + // 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)[])); } test(); } fn test() { - // If we're the parent, copy our own binary to a tempr directory, and then - // make it executable. - let dir = TempDir::new("mytest").unwrap(); - let me = os::self_exe_name().unwrap(); - let dest = dir.path().join(format!("mytest{}", os::consts::EXE_SUFFIX)); - fs::copy(&me, &dest).unwrap(); - - // Append the temp directory to our own PATH. - let mut path = os::split_paths(os::getenv("PATH").unwrap_or(String::new())); - path.push(dir.path().clone()); - let path = os::join_paths(path.as_slice()).unwrap(); - - Command::new("mytest").env("PATH", path.as_slice()) - .arg("child") - .spawn().unwrap(); + // If we're the parent, copy our own binary to a new directory. + let my_path = env::current_exe().unwrap(); + let my_dir = my_path.dir_path(); + + let random_u32: u32 = random(); + let child_dir = Path::new(my_dir.join(format!("issue-15149-child-{}", + random_u32))); + fs::mkdir(&child_dir, USER_RWX).unwrap(); + + let child_path = child_dir.join(format!("mytest{}", + env::consts::EXE_SUFFIX)); + fs::copy(&my_path, &child_path).unwrap(); + + // Append the new directory to our own PATH. + let path = { + let mut paths: Vec<_> = env::split_paths(&env::var_os("PATH").unwrap()).collect(); + paths.push(child_dir.clone()); + env::join_paths(paths.iter()).unwrap() + }; + + let child_output = process::Command::new("mytest").env("PATH", &path) + .arg("child") + .output().unwrap(); + + assert!(child_output.status.success(), + format!("child assertion failed\n child stdout:\n {}\n child stderr:\n {}", + child_output.stdout.container_as_str().unwrap(), + child_output.stderr.container_as_str().unwrap())); + + fs::rmdir_recursive(&child_dir).unwrap(); + } diff --git a/src/test/run-pass/issue-15189.rs b/src/test/run-pass/issue-15189.rs index 6d1813f8aa..24340ac3f1 100644 --- a/src/test/run-pass/issue-15189.rs +++ b/src/test/run-pass/issue-15189.rs @@ -15,7 +15,7 @@ macro_rules! third { } fn main() { - let x = vec!(10u,11u,12u,13u); + let x = vec!(10_usize,11_usize,12_usize,13_usize); let t = third!(x); - assert_eq!(t,12u); + assert_eq!(t,12_usize); } diff --git a/src/test/run-pass/issue-15221.rs b/src/test/run-pass/issue-15221.rs index e3c102e01e..49e5b14aff 100644 --- a/src/test/run-pass/issue-15221.rs +++ b/src/test/run-pass/issue-15221.rs @@ -17,7 +17,7 @@ macro_rules! outer { } fn main() { - let outer!(g1) = 13i; + let outer!(g1) = 13; g1; } diff --git a/src/test/run-pass/issue-15571.rs b/src/test/run-pass/issue-15571.rs index 6b273b5786..ab9554f65d 100644 --- a/src/test/run-pass/issue-15571.rs +++ b/src/test/run-pass/issue-15571.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] fn match_on_local() { - let mut foo = Some(box 5i); + let mut foo = Some(box 5); match foo { None => {}, Some(x) => { @@ -22,7 +22,7 @@ fn match_on_local() { println!("'{}'", foo.unwrap()); } -fn match_on_arg(mut foo: Option>) { +fn match_on_arg(mut foo: Option>) { match foo { None => {} Some(x) => { @@ -33,7 +33,7 @@ fn match_on_arg(mut foo: Option>) { } fn match_on_binding() { - match Some(box 7i) { + match Some(box 7) { mut foo => { match foo { None => {}, @@ -47,8 +47,8 @@ fn match_on_binding() { } fn match_on_upvar() { - let mut foo = Some(box 8i); - let f = move|:| { + let mut foo = Some(box 8i32); + let f = move|| { match foo { None => {}, Some(x) => { @@ -62,7 +62,7 @@ fn match_on_upvar() { fn main() { match_on_local(); - match_on_arg(Some(box 6i)); + match_on_arg(Some(box 6)); match_on_binding(); match_on_upvar(); } diff --git a/src/test/run-pass/issue-15673.rs b/src/test/run-pass/issue-15673.rs index e66788a2c0..a6b8a04eeb 100644 --- a/src/test/run-pass/issue-15673.rs +++ b/src/test/run-pass/issue-15673.rs @@ -11,5 +11,5 @@ use std::iter::AdditiveIterator; fn main() { let x: [u64; 3] = [1, 2, 3]; - assert_eq!(6, range(0, 3).map(|i| x[i]).sum()); + assert_eq!(6, (0_usize..3).map(|i| x[i]).sum()); } diff --git a/src/test/run-pass/issue-15734.rs b/src/test/run-pass/issue-15734.rs index e404f5fa11..e66ac8ff53 100644 --- a/src/test/run-pass/issue-15734.rs +++ b/src/test/run-pass/issue-15734.rs @@ -53,12 +53,12 @@ impl> Index for Row { } fn main() { - let m = Mat::new(vec!(1u, 2, 3, 4, 5, 6), 3); + let m = Mat::new(vec!(1_usize, 2, 3, 4, 5, 6), 3); let r = m.row(1); assert!(r.index(&2) == &6); assert!(r[2] == 6); - assert!(r[2u] == 6u); + assert!(r[2_usize] == 6_usize); assert!(6 == r[2]); let e = r[2]; diff --git a/src/test/run-pass/issue-15763.rs b/src/test/run-pass/issue-15763.rs index 283ea25b6f..7bfd8e0ab7 100644 --- a/src/test/run-pass/issue-15763.rs +++ b/src/test/run-pass/issue-15763.rs @@ -11,7 +11,7 @@ #![allow(unknown_features)] #![feature(box_syntax)] -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct Bar { x: int } @@ -21,7 +21,7 @@ impl Drop for Bar { } } -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct Foo { x: Bar, a: int @@ -87,12 +87,12 @@ fn main() { assert_eq!(cc().unwrap(), 3); assert_eq!(dd().unwrap(), 3); - let i = box 32i as Box; + let i = box 32 as Box; assert_eq!(i.aaa(), 3); - let i = box 32i as Box; + let i = box 32 as Box; assert_eq!(i.bbb(), 3); - let i = box 32i as Box; + let i = box 32 as Box; assert_eq!(i.ccc().unwrap(), 3); - let i = box 32i as Box; + let i = box 32 as Box; assert_eq!(i.ddd().unwrap(), 3); } diff --git a/src/test/run-pass/issue-15858.rs b/src/test/run-pass/issue-15858.rs index c75c672546..6a4f78442d 100644 --- a/src/test/run-pass/issue-15858.rs +++ b/src/test/run-pass/issue-15858.rs @@ -12,21 +12,21 @@ static mut DROP_RAN: bool = false; -trait Bar<'b> { +trait Bar { fn do_something(&mut self); } -struct BarImpl<'b>; +struct BarImpl; -impl<'b> Bar<'b> for BarImpl<'b> { +impl Bar for BarImpl { fn do_something(&mut self) {} } -struct Foo; +struct Foo(B); #[unsafe_destructor] -impl<'b, B: Bar<'b>> Drop for Foo { +impl Drop for Foo { fn drop(&mut self) { unsafe { DROP_RAN = true; @@ -37,7 +37,7 @@ impl<'b, B: Bar<'b>> Drop for Foo { fn main() { { - let _x: Foo = Foo; + let _x: Foo = Foo(BarImpl); } unsafe { assert_eq!(DROP_RAN, true); diff --git a/src/test/run-pass/issue-15881-model-lexer-dotdotdot.rs b/src/test/run-pass/issue-15881-model-lexer-dotdotdot.rs new file mode 100644 index 0000000000..18e1918aea --- /dev/null +++ b/src/test/run-pass/issue-15881-model-lexer-dotdotdot.rs @@ -0,0 +1,43 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// +// regression test for the model lexer handling the DOTDOTDOT syntax (#15877) + +pub fn main() { + match 5_usize { + 1_usize...5_usize => {} + _ => panic!("should match range"), + } + match 5_usize { + 6_usize...7_usize => panic!("shouldn't match range"), + _ => {} + } + match 5_usize { + 1_usize => panic!("should match non-first range"), + 2_usize...6_usize => {} + _ => panic!("math is broken") + } + match 'c' { + 'a'...'z' => {} + _ => panic!("should suppport char ranges") + } + match -3_isize { + -7...5 => {} + _ => panic!("should match signed range") + } + match 3.0f64 { + 1.0...5.0 => {} + _ => panic!("should match float range") + } + match -1.5f64 { + -3.6...3.6 => {} + _ => panic!("should match negative float range") + } +} diff --git a/src/test/run-pass/issue-15924.rs b/src/test/run-pass/issue-15924.rs index db9f1cc9df..88b250af1c 100644 --- a/src/test/run-pass/issue-15924.rs +++ b/src/test/run-pass/issue-15924.rs @@ -28,5 +28,5 @@ impl Drop for Foo { } fn main() { - let _ = Foo { v: 10i }; + let _ = Foo { v: 10 }; } diff --git a/src/test/run-pass/issue-16256.rs b/src/test/run-pass/issue-16256.rs index e7422e233a..48ea3a9329 100644 --- a/src/test/run-pass/issue-16256.rs +++ b/src/test/run-pass/issue-16256.rs @@ -10,5 +10,5 @@ fn main() { let mut buf = Vec::new(); - |&mut: c: u8| buf.push(c); + |c: u8| buf.push(c); } diff --git a/src/test/run-pass/issue-16272.rs b/src/test/run-pass/issue-16272.rs index 8c3d765b5e..3bab78ab0d 100644 --- a/src/test/run-pass/issue-16272.rs +++ b/src/test/run-pass/issue-16272.rs @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::io::{process, Command}; -use std::os; +use std::old_io::{process, Command}; +use std::env; fn main() { - let len = os::args().len(); + let len = env::args().len(); if len == 1 { test(); @@ -22,7 +22,7 @@ fn main() { } fn test() { - let status = Command::new(os::self_exe_name().unwrap()) + let status = Command::new(env::current_exe().unwrap()) .arg("foo").arg("") .stdout(process::InheritFd(1)) .stderr(process::InheritFd(2)) diff --git a/src/test/run-pass/issue-16530.rs b/src/test/run-pass/issue-16530.rs new file mode 100644 index 0000000000..7e3b796235 --- /dev/null +++ b/src/test/run-pass/issue-16530.rs @@ -0,0 +1,18 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::hash::{SipHasher, hash}; + +#[derive(Hash)] +struct Empty; + +pub fn main() { + assert!(hash::<_, SipHasher>(&Empty) == hash::<_, SipHasher>(&Empty)); +} diff --git a/src/test/run-pass/issue-16560.rs b/src/test/run-pass/issue-16560.rs index 6b03a499f1..9448e60593 100644 --- a/src/test/run-pass/issue-16560.rs +++ b/src/test/run-pass/issue-16560.rs @@ -10,17 +10,17 @@ #![feature(unboxed_closures)] -use std::thread::Thread; +use std::thread; use std::mem; fn main() { let y = 0u8; - let closure = move |&: x| y + x; + let closure = move |x| y + x; // Check that both closures are capturing by value assert_eq!(1, mem::size_of_val(&closure)); - Thread::scoped(move|| { + thread::spawn(move|| { let ok = closure; }).join().ok().unwrap(); } diff --git a/src/test/run-pass/issue-16596.rs b/src/test/run-pass/issue-16596.rs index e01de3a326..1ba7b142e5 100644 --- a/src/test/run-pass/issue-16596.rs +++ b/src/test/run-pass/issue-16596.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait MatrixRow {} +trait MatrixRow { fn dummy(&self) { }} struct Mat; diff --git a/src/test/run-pass/issue-16597-empty.rs b/src/test/run-pass/issue-16597-empty.rs index c51e33c010..a6a1c5f16b 100644 --- a/src/test/run-pass/issue-16597-empty.rs +++ b/src/test/run-pass/issue-16597-empty.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags:--test +// no-pretty-expanded // This verifies that the test generation doesn't crash when we have // no tests - for more information, see PR #16892. diff --git a/src/test/run-pass/issue-16643.rs b/src/test/run-pass/issue-16643.rs index b118c9573c..4e57c55c5f 100644 --- a/src/test/run-pass/issue-16643.rs +++ b/src/test/run-pass/issue-16643.rs @@ -13,5 +13,5 @@ extern crate "issue-16643" as i; pub fn main() { - i::TreeBuilder::.process_token(); + i::TreeBuilder { h: 3u }.process_token(); } diff --git a/src/test/run-pass/issue-16648.rs b/src/test/run-pass/issue-16648.rs index 7ddb20811a..0b58df56b6 100644 --- a/src/test/run-pass/issue-16648.rs +++ b/src/test/run-pass/issue-16648.rs @@ -9,12 +9,12 @@ // except according to those terms. fn main() { - let x: (int, &[int]) = (2i, &[1i, 2i]); + let x: (int, &[int]) = (2, &[1, 2]); assert_eq!(match x { (0, [_, _]) => 0, (1, _) => 1, (2, [_, _]) => 2, (2, _) => 3, _ => 4 - }, 2i); + }, 2); } diff --git a/src/test/run-pass/issue-16668.rs b/src/test/run-pass/issue-16668.rs index 75b1e11ddc..daf09047be 100644 --- a/src/test/run-pass/issue-16668.rs +++ b/src/test/run-pass/issue-16668.rs @@ -15,13 +15,13 @@ #![feature(unboxed_closures)] struct Parser<'a, I, O> { - parse: Box> + 'a> + parse: Box Result + 'a> } -impl<'a, I, O: 'a> Parser<'a, I, O> { +impl<'a, I: 'a, O: 'a> Parser<'a, I, O> { fn compose(mut self, mut rhs: Parser<'a, O, K>) -> Parser<'a, I, K> { Parser { - parse: box move |&mut: x: I| { + parse: box move |x: I| { match (self.parse)(x) { Ok(r) => (rhs.parse)(r), Err(e) => Err(e) diff --git a/src/test/run-pass/issue-16671.rs b/src/test/run-pass/issue-16671.rs index e25b3e8e89..b06c4923c1 100644 --- a/src/test/run-pass/issue-16671.rs +++ b/src/test/run-pass/issue-16671.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android seems to block forever #![forbid(warnings)] @@ -18,11 +17,11 @@ // A var moved into a proc, that has a mutable loan path should // not trigger a misleading unused_mut warning. -use std::thread::Thread; +use std::thread; pub fn main() { - let mut stdin = std::io::stdin(); - Thread::spawn(move|| { + let mut stdin = std::old_io::stdin(); + thread::spawn(move|| { let _ = stdin.read_to_end(); }); } diff --git a/src/test/run-pass/issue-16739.rs b/src/test/run-pass/issue-16739.rs index cb6f068cf4..389baecafd 100644 --- a/src/test/run-pass/issue-16739.rs +++ b/src/test/run-pass/issue-16739.rs @@ -15,27 +15,30 @@ // Test that unboxing shim for calling rust-call ABI methods through a // trait box works and does not cause an ICE. -struct Foo { foo: uint } +struct Foo { foo: u32 } -impl FnMut<(), uint> for Foo { - extern "rust-call" fn call_mut(&mut self, _: ()) -> uint { self.foo } +impl FnMut<()> for Foo { + type Output = u32; + extern "rust-call" fn call_mut(&mut self, _: ()) -> u32 { self.foo } } -impl FnMut<(uint,), uint> for Foo { - extern "rust-call" fn call_mut(&mut self, (x,): (uint,)) -> uint { self.foo + x } +impl FnMut<(u32,)> for Foo { + type Output = u32; + extern "rust-call" fn call_mut(&mut self, (x,): (u32,)) -> u32 { self.foo + x } } -impl FnMut<(uint, uint), uint> for Foo { - extern "rust-call" fn call_mut(&mut self, (x, y): (uint, uint)) -> uint { self.foo + x + y } +impl FnMut<(u32,u32)> for Foo { + type Output = u32; + extern "rust-call" fn call_mut(&mut self, (x, y): (u32, u32)) -> u32 { self.foo + x + y } } fn main() { - let mut f = box Foo { foo: 42 } as Box>; + let mut f = box Foo { foo: 42 } as Box u32>; assert_eq!(f.call_mut(()), 42); - let mut f = box Foo { foo: 40 } as Box>; + let mut f = box Foo { foo: 40 } as Box u32>; assert_eq!(f.call_mut((2,)), 42); - let mut f = box Foo { foo: 40 } as Box>; + let mut f = box Foo { foo: 40 } as Box u32>; assert_eq!(f.call_mut((1, 1)), 42); } diff --git a/src/test/run-pass/issue-16774.rs b/src/test/run-pass/issue-16774.rs index 175e218881..2666130224 100644 --- a/src/test/run-pass/issue-16774.rs +++ b/src/test/run-pass/issue-16774.rs @@ -10,6 +10,7 @@ #![allow(unknown_features)] #![feature(box_syntax)] +#![feature(box_patterns)] #![feature(unboxed_closures)] use std::ops::{Deref, DerefMut}; @@ -45,9 +46,9 @@ impl DerefMut for X { fn main() { { - let mut test = X(box 5i); + let mut test = X(box 5); { - let mut change = |&mut:| { *test = 10 }; + let mut change = || { *test = 10 }; change(); } assert_eq!(*test, 10); diff --git a/src/test/run-pass/issue-16783.rs b/src/test/run-pass/issue-16783.rs index cb12d138a5..c2bcbe045c 100644 --- a/src/test/run-pass/issue-16783.rs +++ b/src/test/run-pass/issue-16783.rs @@ -10,5 +10,5 @@ pub fn main() { let x = [1, 2, 3]; - let y = x.as_slice(); + let y = x; } diff --git a/src/test/run-pass/issue-17068.rs b/src/test/run-pass/issue-17068.rs index dfbe740622..a0e6f2c9be 100644 --- a/src/test/run-pass/issue-17068.rs +++ b/src/test/run-pass/issue-17068.rs @@ -11,7 +11,7 @@ // Test that regionck creates the right region links in the pattern // binding of a for loop fn foo<'a>(v: &'a [uint]) -> &'a uint { - for &ref x in v.iter() { return x; } + for &ref x in v { return x; } unreachable!() } diff --git a/src/test/run-pass/issue-17074.rs b/src/test/run-pass/issue-17074.rs index d35c3a587c..d367e0e908 100644 --- a/src/test/run-pass/issue-17074.rs +++ b/src/test/run-pass/issue-17074.rs @@ -17,6 +17,6 @@ fn main() { assert_eq!(match 1 { X => unreachable!(), Y => unreachable!(), - _ => 1i + _ => 1 }, 1); } diff --git a/src/test/run-pass/issue-17121.rs b/src/test/run-pass/issue-17121.rs index f53bedc6da..2f0b8c9f19 100644 --- a/src/test/run-pass/issue-17121.rs +++ b/src/test/run-pass/issue-17121.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::io::BufReader; -use std::io::BufferedReader; -use std::io::File; -use std::io::IoResult; +use std::old_io::BufReader; +use std::old_io::BufferedReader; +use std::old_io::File; +use std::old_io::IoResult; struct Lexer { diff --git a/src/test/run-pass/issue-17216.rs b/src/test/run-pass/issue-17216.rs index e48d7b0756..ce5a0aa96e 100644 --- a/src/test/run-pass/issue-17216.rs +++ b/src/test/run-pass/issue-17216.rs @@ -25,7 +25,9 @@ fn main() { let mut dropped = false; { let leak = Leak { dropped: &mut dropped }; - for ((), leaked) in Some(((),leak)).into_iter() {} + // FIXME(#21721) "hack" used to be () but that can cause + // certain LLVM versions to abort during optimizations. + for (_, leaked) in Some(("hack", leak)).into_iter() {} } assert!(dropped); diff --git a/src/test/run-pass/issue-17322.rs b/src/test/run-pass/issue-17322.rs index b50bf442b5..dd1cfb5e34 100644 --- a/src/test/run-pass/issue-17322.rs +++ b/src/test/run-pass/issue-17322.rs @@ -11,13 +11,13 @@ #![allow(unknown_features)] #![feature(box_syntax)] -use std::io; +use std::old_io; fn f(wr: &mut Writer) { wr.write_str("hello").ok().expect("failed"); } fn main() { - let mut wr = box io::stdout() as Box; + let mut wr = box old_io::stdout() as Box; f(&mut wr); } diff --git a/src/test/run-pass/issue-17503.rs b/src/test/run-pass/issue-17503.rs index 65bf088786..a071224999 100644 --- a/src/test/run-pass/issue-17503.rs +++ b/src/test/run-pass/issue-17503.rs @@ -13,7 +13,7 @@ fn main() { let ss: &&[int] = &s; let sss: &&&[int] = &ss; - println!("{:?}", &s[0..3]); + println!("{:?}", &s[..3]); println!("{:?}", &ss[3..]); println!("{:?}", &sss[2..4]); } diff --git a/src/test/run-pass/issue-17662.rs b/src/test/run-pass/issue-17662.rs index 34bcfeb10d..7bd41cc5b5 100644 --- a/src/test/run-pass/issue-17662.rs +++ b/src/test/run-pass/issue-17662.rs @@ -12,12 +12,14 @@ extern crate "issue-17662" as i; -struct Bar<'a>; +use std::marker; + +struct Bar<'a> { m: marker::PhantomData<&'a ()> } impl<'a> i::Foo<'a, uint> for Bar<'a> { - fn foo(&self) -> uint { 5u } + fn foo(&self) -> uint { 5_usize } } pub fn main() { - assert_eq!(i::foo(&Bar), 5); + assert_eq!(i::foo(&Bar { m: marker::PhantomData }), 5); } diff --git a/src/test/run-pass/issue-17718.rs b/src/test/run-pass/issue-17718.rs index 44cf0dd8b8..e4782e2892 100644 --- a/src/test/run-pass/issue-17718.rs +++ b/src/test/run-pass/issue-17718.rs @@ -12,10 +12,10 @@ extern crate "issue-17718" as other; -use std::sync::atomic::{AtomicUint, ATOMIC_UINT_INIT, Ordering}; +use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; const C1: uint = 1; -const C2: AtomicUint = ATOMIC_UINT_INIT; +const C2: AtomicUsize = ATOMIC_USIZE_INIT; const C3: fn() = foo; const C4: uint = C1 * C1 + C1 / C1; const C5: &'static uint = &C4; @@ -25,7 +25,7 @@ const C6: uint = { }; static S1: uint = 3; -static S2: AtomicUint = ATOMIC_UINT_INIT; +static S2: AtomicUsize = ATOMIC_USIZE_INIT; mod test { static A: uint = 4; diff --git a/src/test/run-pass/issue-17732.rs b/src/test/run-pass/issue-17732.rs index b4bd55da59..de9611f259 100644 --- a/src/test/run-pass/issue-17732.rs +++ b/src/test/run-pass/issue-17732.rs @@ -10,8 +10,9 @@ trait Person { type string; + fn dummy(&self) { } } -struct Someone; +struct Someone(std::marker::PhantomData

); fn main() {} diff --git a/src/test/run-pass/issue-17734.rs b/src/test/run-pass/issue-17734.rs index e58fbe0b4c..3cff16409c 100644 --- a/src/test/run-pass/issue-17734.rs +++ b/src/test/run-pass/issue-17734.rs @@ -21,6 +21,6 @@ fn main() { // There is currently no safe way to construct a `Box`, so improvise let box_arr: Box<[u8]> = box ['h' as u8, 'e' as u8, 'l' as u8, 'l' as u8, 'o' as u8]; let box_str: Box = unsafe { std::mem::transmute(box_arr) }; - assert_eq!(box_str.as_slice(), "hello"); + assert_eq!(&*box_str, "hello"); f(box_str); } diff --git a/src/test/run-pass/issue-17771.rs b/src/test/run-pass/issue-17771.rs index 1e9550acef..2f1b0342b8 100644 --- a/src/test/run-pass/issue-17771.rs +++ b/src/test/run-pass/issue-17771.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Aaa {} +trait Aaa { fn dummy(&self) { } } impl<'a> Aaa for &'a mut (Aaa + 'a) {} diff --git a/src/test/run-pass/issue-17816.rs b/src/test/run-pass/issue-17816.rs index d9d2c77139..a976eccf89 100644 --- a/src/test/run-pass/issue-17816.rs +++ b/src/test/run-pass/issue-17816.rs @@ -10,9 +10,11 @@ #![feature(unboxed_closures)] +use std::marker::PhantomData; + fn main() { - struct Symbol<'a, F: Fn(Vec<&'a str>) -> &'a str> { function: F } - let f = |&: x: Vec<&str>| -> &str "foobar"; - let sym = Symbol { function: f }; + struct Symbol<'a, F: Fn(Vec<&'a str>) -> &'a str> { function: F, marker: PhantomData<&'a ()> } + let f = |x: Vec<&str>| -> &str "foobar"; + let sym = Symbol { function: f, marker: PhantomData }; (sym.function)(vec![]); } diff --git a/src/test/run-pass/issue-17877.rs b/src/test/run-pass/issue-17877.rs index 827e6a10ab..a7d9e6a4be 100644 --- a/src/test/run-pass/issue-17877.rs +++ b/src/test/run-pass/issue-17877.rs @@ -10,12 +10,12 @@ fn main() { assert_eq!(match [0u8; 1024] { - _ => 42u, - }, 42u); + _ => 42_usize, + }, 42_usize); assert_eq!(match [0u8; 1024] { - [1, _..] => 0u, - [0, _..] => 1u, - _ => 2u - }, 1u); + [1, _..] => 0_usize, + [0, _..] => 1_usize, + _ => 2_usize + }, 1_usize); } diff --git a/src/test/run-pass/issue-17897.rs b/src/test/run-pass/issue-17897.rs index da6c83142e..3774aaa190 100644 --- a/src/test/run-pass/issue-17897.rs +++ b/src/test/run-pass/issue-17897.rs @@ -17,5 +17,5 @@ fn action(cb: Thunk) -> uint { } pub fn main() { - println!("num: {}", action(Thunk::with_arg(move |:u| u))); + println!("num: {}", action(Thunk::with_arg(move |u| u))); } diff --git a/src/test/run-pass/issue-17904.rs b/src/test/run-pass/issue-17904.rs index 3ce347d67e..58a0872a57 100644 --- a/src/test/run-pass/issue-17904.rs +++ b/src/test/run-pass/issue-17904.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct Foo where T: Copy; +// Test that we can parse where clauses on various forms of tuple +// structs. + struct Bar(T) where T: Copy; struct Bleh(T, U) where T: Copy, U: Sized; struct Baz where T: Copy { diff --git a/src/test/run-pass/issue-18188.rs b/src/test/run-pass/issue-18188.rs index a2152db688..a4b09eb08e 100644 --- a/src/test/run-pass/issue-18188.rs +++ b/src/test/run-pass/issue-18188.rs @@ -14,13 +14,13 @@ use std::thunk::Thunk; pub trait Promisable: Send + Sync {} impl Promisable for T {} -pub fn propagate(action: F) -> Thunk, Result> +pub fn propagate<'a, T, E, F, G>(action: F) -> Thunk<'a,Result, Result> where - T: Promisable + Clone, - E: Promisable + Clone, - F: FnOnce(&T) -> Result + Send, - G: FnOnce(Result) -> Result { - Thunk::with_arg(move |: result: Result| { + T: Promisable + Clone + 'a, + E: Promisable + Clone + 'a, + F: FnOnce(&T) -> Result + Send + 'a, + G: FnOnce(Result) -> Result + 'a { + Thunk::with_arg(move |result: Result| { match result { Ok(ref t) => action(t), Err(ref e) => Err(e.clone()), diff --git a/src/test/run-pass/issue-18232.rs b/src/test/run-pass/issue-18232.rs index 15cf5870d4..67b3239d35 100644 --- a/src/test/run-pass/issue-18232.rs +++ b/src/test/run-pass/issue-18232.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct Cursor<'a>; +struct Cursor<'a>(::std::marker::PhantomData<&'a ()>); trait CursorNavigator { fn init_cursor<'a, 'b:'a>(&'a self, cursor: &mut Cursor<'b>) -> bool; @@ -23,7 +23,7 @@ impl CursorNavigator for SimpleNavigator { } fn main() { - let mut c = Cursor; + let mut c = Cursor(::std::marker::PhantomData); let n = SimpleNavigator; n.init_cursor(&mut c); } diff --git a/src/test/run-pass/issue-18352.rs b/src/test/run-pass/issue-18352.rs index 7878d698e5..e5532b4550 100644 --- a/src/test/run-pass/issue-18352.rs +++ b/src/test/run-pass/issue-18352.rs @@ -11,7 +11,7 @@ const X: &'static str = "12345"; fn test(s: String) -> bool { - match s.as_slice() { + match &*s { X => true, _ => false } diff --git a/src/test/run-pass/issue-18425.rs b/src/test/run-pass/issue-18425.rs index 6d223923ac..ec7481ead0 100644 --- a/src/test/run-pass/issue-18425.rs +++ b/src/test/run-pass/issue-18425.rs @@ -15,5 +15,5 @@ #![feature(box_syntax)] fn main() { - let _ = [box 1u; 1]; + let _ = [box 1_usize; 1]; } diff --git a/src/test/run-pass/issue-18539.rs b/src/test/run-pass/issue-18539.rs index 90e20e30d1..ce56f3e8d7 100644 --- a/src/test/run-pass/issue-18539.rs +++ b/src/test/run-pass/issue-18539.rs @@ -19,5 +19,5 @@ fn uint_to_foo(_: uint) -> Foo { #[allow(unused_must_use)] fn main() { - range(0u, 10).map(uint_to_foo); + (0_usize..10).map(uint_to_foo); } diff --git a/src/test/run-pass/issue-18619.rs b/src/test/run-pass/issue-18619.rs index a885513611..6b6296b0bd 100644 --- a/src/test/run-pass/issue-18619.rs +++ b/src/test/run-pass/issue-18619.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::io::FileType; +use std::old_io::FileType; pub fn main() { let _ = FileType::RegularFile.clone(); diff --git a/src/test/run-pass/issue-18652.rs b/src/test/run-pass/issue-18652.rs index ef2c15c748..8f560258d9 100644 --- a/src/test/run-pass/issue-18652.rs +++ b/src/test/run-pass/issue-18652.rs @@ -17,5 +17,5 @@ fn main() { let x = 2u8; let y = 3u8; - assert_eq!((move |:| x + y)(), 5); + assert_eq!((move || x + y)(), 5); } diff --git a/src/test/run-pass/issue-18661.rs b/src/test/run-pass/issue-18661.rs index 6a2f73a787..bb2907241c 100644 --- a/src/test/run-pass/issue-18661.rs +++ b/src/test/run-pass/issue-18661.rs @@ -20,7 +20,7 @@ pub fn inside(c: F) { // Use different number of type parameters and closure type to trigger // an obvious ICE when param environments are mixed up pub fn outside() { - inside(|&:| {}); + inside(|| {}); } fn main() { diff --git a/src/test/run-pass/issue-18685.rs b/src/test/run-pass/issue-18685.rs index be6dd58313..698b61e575 100644 --- a/src/test/run-pass/issue-18685.rs +++ b/src/test/run-pass/issue-18685.rs @@ -17,7 +17,7 @@ trait Tr { fn foo(&self); fn bar(&self) { - (|:| { self.foo() })() + (|| { self.foo() })() } } diff --git a/src/test/run-pass/issue-18711.rs b/src/test/run-pass/issue-18711.rs index 6a04e68af0..0338a4eff2 100644 --- a/src/test/run-pass/issue-18711.rs +++ b/src/test/run-pass/issue-18711.rs @@ -17,5 +17,5 @@ extern crate "issue-18711" as issue; fn main() { - (|:| issue::inner(()))(); + (|| issue::inner(()))(); } diff --git a/src/test/run-pass/issue-18767.rs b/src/test/run-pass/issue-18767.rs index 6ba5906708..2f23b8028e 100644 --- a/src/test/run-pass/issue-18767.rs +++ b/src/test/run-pass/issue-18767.rs @@ -12,7 +12,7 @@ // and doesn't ICE. fn main() { - for &&x in Some(&0u).iter() { + for &&x in Some(&0_usize).iter() { assert_eq!(x, 0) } } diff --git a/src/test/run-pass/issue-18906.rs b/src/test/run-pass/issue-18906.rs index 11ffb4198d..16dd84315e 100644 --- a/src/test/run-pass/issue-18906.rs +++ b/src/test/run-pass/issue-18906.rs @@ -24,7 +24,7 @@ fn bar(k: &K, q: &Q) where K: Borrow, Q: Foo { q.foo(k.borrow()) } -struct MyTree; +struct MyTree(K); impl MyTree { // This caused a failure in #18906 diff --git a/src/test/run-pass/issue-19100.rs b/src/test/run-pass/issue-19100.rs index 0ebd3ae8d9..26eacd682e 100644 --- a/src/test/run-pass/issue-19100.rs +++ b/src/test/run-pass/issue-19100.rs @@ -8,13 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[derive(Copy)] enum Foo { Bar, Baz } -impl Copy for Foo {} - impl Foo { fn foo(&self) { match self { diff --git a/src/test/run-pass/issue-19121.rs b/src/test/run-pass/issue-19121.rs index d95f74ef2a..222f67af43 100644 --- a/src/test/run-pass/issue-19121.rs +++ b/src/test/run-pass/issue-19121.rs @@ -13,6 +13,8 @@ trait Foo { type A; + + fn dummy(&self) { } } fn bar(x: &Foo) {} diff --git a/src/test/run-pass/issue-19129-2.rs b/src/test/run-pass/issue-19129-2.rs index d6b3a1908b..cf0f48e025 100644 --- a/src/test/run-pass/issue-19129-2.rs +++ b/src/test/run-pass/issue-19129-2.rs @@ -11,7 +11,7 @@ trait Trait { type Output; - fn method() -> bool { false } + fn method(&self, i: Input) -> bool { false } } fn main() {} diff --git a/src/test/run-pass/issue-19135.rs b/src/test/run-pass/issue-19135.rs index c90880ff12..5e6dd567d6 100644 --- a/src/test/run-pass/issue-19135.rs +++ b/src/test/run-pass/issue-19135.rs @@ -10,13 +10,15 @@ #![feature(unboxed_closures)] -#[derive(Show)] -struct LifetimeStruct<'a>; +use std::marker::PhantomData; + +#[derive(Debug)] +struct LifetimeStruct<'a>(PhantomData<&'a ()>); fn main() { - takes_hrtb_closure(|&mut: lts| println!("{:?}", lts)); + takes_hrtb_closure(|lts| println!("{:?}", lts)); } fn takes_hrtb_closureFnMut(LifetimeStruct<'a>)>(mut f: F) { - f(LifetimeStruct); + f(LifetimeStruct(PhantomData)); } diff --git a/src/test/run-pass/issue-19244.rs b/src/test/run-pass/issue-19244.rs index 3ee5ce9bff..9af4d30c4f 100644 --- a/src/test/run-pass/issue-19244.rs +++ b/src/test/run-pass/issue-19244.rs @@ -13,8 +13,8 @@ const STRUCT: MyStruct = MyStruct { field: 42 }; const TUP: (uint,) = (43,); fn main() { - let a = [0i; STRUCT.field]; - let b = [0i; TUP.0]; + let a = [0; STRUCT.field]; + let b = [0; TUP.0]; assert!(a.len() == 42); assert!(b.len() == 43); diff --git a/src/test/run-pass/issue-19358.rs b/src/test/run-pass/issue-19358.rs index 3609348217..8b5269ab92 100644 --- a/src/test/run-pass/issue-19358.rs +++ b/src/test/run-pass/issue-19358.rs @@ -8,14 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Trait {} +trait Trait { fn dummy(&self) { } } -#[derive(Show)] +#[derive(Debug)] struct Foo { foo: T, } -#[derive(Show)] +#[derive(Debug)] struct Bar where T: Trait { bar: T, } @@ -23,7 +23,7 @@ struct Bar where T: Trait { impl Trait for int {} fn main() { - let a = Foo { foo: 12i }; - let b = Bar { bar: 12i }; + let a = Foo { foo: 12 }; + let b = Bar { bar: 12 }; println!("{:?} {:?}", a, b); } diff --git a/src/test/run-pass/issue-19367.rs b/src/test/run-pass/issue-19367.rs index 7db84d518f..d5bb6ebb7d 100644 --- a/src/test/run-pass/issue-19367.rs +++ b/src/test/run-pass/issue-19367.rs @@ -16,7 +16,7 @@ struct S { // on field of struct or tuple which we reassign in the match body. fn main() { - let mut a = (0i, Some("right".to_string())); + let mut a = (0, Some("right".to_string())); let b = match a.1 { Some(v) => { a.1 = Some("wrong".to_string()); diff --git a/src/test/run-pass/issue-19398.rs b/src/test/run-pass/issue-19398.rs index 1196162568..e603167b26 100644 --- a/src/test/run-pass/issue-19398.rs +++ b/src/test/run-pass/issue-19398.rs @@ -9,11 +9,11 @@ // except according to those terms. trait T { - unsafe extern "Rust" fn foo(); + unsafe extern "Rust" fn foo(&self); } impl T for () { - unsafe extern "Rust" fn foo() {} + unsafe extern "Rust" fn foo(&self) {} } fn main() {} diff --git a/src/test/run-pass/issue-19479.rs b/src/test/run-pass/issue-19479.rs index 91bc645b2d..38a7af3a69 100644 --- a/src/test/run-pass/issue-19479.rs +++ b/src/test/run-pass/issue-19479.rs @@ -8,12 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Base {} +trait Base { + fn dummy(&self) { } +} trait AssocA { type X: Base; + fn dummy(&self) { } } trait AssocB { type Y: Base; + fn dummy(&self) { } } impl AssocB for T { type Y = ::X; diff --git a/src/test/run-pass/issue-19499.rs b/src/test/run-pass/issue-19499.rs new file mode 100644 index 0000000000..0578db8f85 --- /dev/null +++ b/src/test/run-pass/issue-19499.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Regression test for issue #19499. Due to incorrect caching of trait +// results for closures with upvars whose types were not fully +// computed, this rather bizarre little program (along with many more +// reasonable examples) let to ambiguity errors about not being able +// to infer sufficient type information. + +fn main() { + let n = 0; + let it = Some(1_usize).into_iter().inspect(|_| {n;}); +} diff --git a/src/test/run-pass/issue-19631.rs b/src/test/run-pass/issue-19631.rs index 43116f6364..7bb0d055b8 100644 --- a/src/test/run-pass/issue-19631.rs +++ b/src/test/run-pass/issue-19631.rs @@ -10,6 +10,7 @@ trait PoolManager { type C; + fn dummy(&self) { } } struct InnerPool { diff --git a/src/test/run-pass/issue-19632.rs b/src/test/run-pass/issue-19632.rs index 01a073a688..4339339d74 100644 --- a/src/test/run-pass/issue-19632.rs +++ b/src/test/run-pass/issue-19632.rs @@ -10,6 +10,7 @@ trait PoolManager { type C; + fn dummy(&self) { } } struct InnerPool { diff --git a/src/test/run-pass/issue-20055-box-trait.rs b/src/test/run-pass/issue-20055-box-trait.rs new file mode 100644 index 0000000000..572a0d8252 --- /dev/null +++ b/src/test/run-pass/issue-20055-box-trait.rs @@ -0,0 +1,50 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// See Issues #20055 and #21695. + +// We are checking here that the temporaries `Box<[i8, k]>`, for `k` +// in 1, 2, 3, 4, that are induced by the match expression are +// properly handled, in that only *one* will be initialized by +// whichever arm is run, and subsequently dropped at the end of the +// statement surrounding the `match`. + +trait Boo { + fn dummy(&self) { } +} + +impl Boo for [i8; 1] { } +impl Boo for [i8; 2] { } +impl Boo for [i8; 3] { } +impl Boo for [i8; 4] { } + +pub fn foo(box_1: fn () -> Box<[i8; 1]>, + box_2: fn () -> Box<[i8; 2]>, + box_3: fn () -> Box<[i8; 3]>, + box_4: fn () -> Box<[i8; 4]>, + ) { + println!("Hello World 1"); + let _: Box = match 3 { + 1 => box_1(), + 2 => box_2(), + 3 => box_3(), + _ => box_4(), + }; + println!("Hello World 2"); +} + +pub fn main() { + fn box_1() -> Box<[i8; 1]> { Box::new( [1i8; 1] ) } + fn box_2() -> Box<[i8; 2]> { Box::new( [1i8; 2] ) } + fn box_3() -> Box<[i8; 3]> { Box::new( [1i8; 3] ) } + fn box_4() -> Box<[i8; 4]> { Box::new( [1i8; 4] ) } + + foo(box_1, box_2, box_3, box_4); +} diff --git a/src/test/run-pass/issue-20055-box-unsized-array.rs b/src/test/run-pass/issue-20055-box-unsized-array.rs new file mode 100644 index 0000000000..f751be6f13 --- /dev/null +++ b/src/test/run-pass/issue-20055-box-unsized-array.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Issue #2005: Check that boxed fixed-size arrays are properly +// accounted for (namely, only deallocated if they were actually +// created) when they appear as temporaries in unused arms of a match +// expression. + +pub fn foo(box_1: fn () -> Box<[i8; 1]>, + box_2: fn () -> Box<[i8; 20]>, + box_3: fn () -> Box<[i8; 300]>, + box_4: fn () -> Box<[i8; 4000]>, + ) { + println!("Hello World 1"); + let _: Box<[i8]> = match 3 { + 1 => box_1(), + 2 => box_2(), + 3 => box_3(), + _ => box_4(), + }; + println!("Hello World 2"); +} + +pub fn main() { + fn box_1() -> Box<[i8; 1]> { Box::new( [1i8] ) } + fn box_2() -> Box<[i8; 20]> { Box::new( [1i8; 20] ) } + fn box_3() -> Box<[i8; 300]> { Box::new( [1i8; 300] ) } + fn box_4() -> Box<[i8; 4000]> { Box::new( [1i8; 4000] ) } + + foo(box_1, box_2, box_3, box_4); +} diff --git a/src/test/run-pass/issue-20091.rs b/src/test/run-pass/issue-20091.rs index d653843ba0..4d20e6360a 100644 --- a/src/test/run-pass/issue-20091.rs +++ b/src/test/run-pass/issue-20091.rs @@ -10,12 +10,12 @@ // ignore-windows currently windows requires UTF-8 for spawning processes -use std::io::Command; -use std::os; +use std::old_io::Command; +use std::env; fn main() { - if os::args().len() == 1 { - assert!(Command::new(os::self_exe_name().unwrap()).arg(b"\xff") + if env::args().len() == 1 { + assert!(Command::new(env::current_exe().unwrap()).arg(b"\xff") .status().unwrap().success()) } } diff --git a/src/test/run-pass/issue-20343.rs b/src/test/run-pass/issue-20343.rs new file mode 100644 index 0000000000..2f9e8feed2 --- /dev/null +++ b/src/test/run-pass/issue-20343.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Regression test for Issue #20343. + +#![deny(dead_code)] + +struct B { b: u32 } +struct C; +struct D; + +trait T { fn dummy(&self, a: A) { } } +impl T for () {} + +impl B { + // test for unused code in arguments + fn foo(B { b }: B) -> u32 { b } + + // test for unused code in return type + fn bar() -> C { unsafe { ::std::mem::transmute(()) } } + + // test for unused code in generics + fn baz>() {} +} + +pub fn main() { + let b = B { b: 3 }; + B::foo(b); + B::bar(); + B::baz::<()>(); +} diff --git a/src/test/run-pass/issue-20414.rs b/src/test/run-pass/issue-20414.rs new file mode 100644 index 0000000000..92865c419b --- /dev/null +++ b/src/test/run-pass/issue-20414.rs @@ -0,0 +1,27 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +trait Trait { + fn method(self) -> int; +} + +struct Wrapper { + field: T +} + +impl<'a, T> Trait for &'a Wrapper where &'a T: Trait { + fn method(self) -> int { + let r: &'a T = &self.field; + Trait::method(r); // these should both work + r.method() + } +} + +fn main() {} diff --git a/src/test/run-pass/issue-20454.rs b/src/test/run-pass/issue-20454.rs new file mode 100644 index 0000000000..fbc4cca800 --- /dev/null +++ b/src/test/run-pass/issue-20454.rs @@ -0,0 +1,19 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::thread; + +fn main() { + thread::Thread::spawn(move || { // no need for -> () + loop { + println!("hello"); + } + }); +} diff --git a/src/test/run-pass/issue-20575.rs b/src/test/run-pass/issue-20575.rs new file mode 100644 index 0000000000..f83150b951 --- /dev/null +++ b/src/test/run-pass/issue-20575.rs @@ -0,0 +1,19 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that overloaded calls work with zero arity closures + +#![feature(box_syntax)] + +fn main() { + let functions: [Box Option<()>>; 1] = [box || None]; + + let _: Option> = functions.iter().map(|f| (*f)()).collect(); +} diff --git a/src/test/run-pass/issue-20644.rs b/src/test/run-pass/issue-20644.rs index f74b09a3d2..0d482548cc 100644 --- a/src/test/run-pass/issue-20644.rs +++ b/src/test/run-pass/issue-20644.rs @@ -16,7 +16,7 @@ use std::iter; use std::os; -use std::io::File; +use std::old_io::File; #[allow(unused)] pub fn parse_summary(_: R, _: &Path) { diff --git a/src/test/run-pass/issue-20676.rs b/src/test/run-pass/issue-20676.rs new file mode 100644 index 0000000000..01a2322ae9 --- /dev/null +++ b/src/test/run-pass/issue-20676.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Regression test for #20676. Error was that we didn't support +// UFCS-style calls to a method in `Trait` where `Self` was bound to a +// trait object of type `Trait`. See also `ufcs-trait-object.rs`. + +use std::fmt; + +fn main() { + let a: &fmt::Debug = &1_i32; + format!("{:?}", a); +} diff --git a/src/test/run-pass/issue-2074.rs b/src/test/run-pass/issue-2074.rs index 120ada96c1..5f2805ed35 100644 --- a/src/test/run-pass/issue-2074.rs +++ b/src/test/run-pass/issue-2074.rs @@ -11,11 +11,11 @@ #![allow(non_camel_case_types)] pub fn main() { - let one = |&:| { + let one = || { enum r { a }; r::a as uint }; - let two = |&:| { + let two = || { enum r { a }; r::a as uint }; diff --git a/src/test/run-pass/issue-20763-1.rs b/src/test/run-pass/issue-20763-1.rs new file mode 100644 index 0000000000..97c06ac982 --- /dev/null +++ b/src/test/run-pass/issue-20763-1.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +trait T0 { + type O; + fn dummy(&self) { } +} + +struct S(A); +impl T0 for S { type O = A; } + +trait T1: T0 { + // this looks okay but as we see below, `f` is unusable + fn m0::O) -> bool>(self, f: F) -> bool; +} + +// complains about the bounds on F here not being required by the trait +impl T1 for S { + fn m0 bool>(self, f: F) -> bool { f(self.0) } +} + +// // complains about mismatched types: as T0>::O vs. A +// impl T1 for S +// { +// fn m0::O) -> bool>(self, f: F) -> bool { f(self.0) } +// } + +fn main() { } diff --git a/src/test/run-pass/issue-20763-2.rs b/src/test/run-pass/issue-20763-2.rs new file mode 100644 index 0000000000..d970176357 --- /dev/null +++ b/src/test/run-pass/issue-20763-2.rs @@ -0,0 +1,30 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +trait T0 { + type O; + fn dummy(&self) { } +} + +struct S(A); +impl T0 for S { type O = A; } + +trait T1: T0 { + // this looks okay but as we see below, `f` is unusable + fn m0::O) -> bool>(self, f: F) -> bool; +} + +// complains about mismatched types: as T0>::O vs. A +impl T1 for S +{ + fn m0::O) -> bool>(self, f: F) -> bool { f(self.0) } +} + +fn main() { } diff --git a/src/test/run-pass/issue-20797.rs b/src/test/run-pass/issue-20797.rs new file mode 100644 index 0000000000..049e08d2b9 --- /dev/null +++ b/src/test/run-pass/issue-20797.rs @@ -0,0 +1,94 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// ignore-android +// ignore-windows + +// Regression test for #20797. + +use std::default::Default; +use std::old_io::IoResult; +use std::old_io::fs; +use std::old_io::fs::PathExtensions; + +/// A strategy for acquiring more subpaths to walk. +pub trait Strategy { + type P: PathExtensions; + /// Get additional subpaths from a given path. + fn get_more(&self, item: &Self::P) -> IoResult>; + /// Determine whether a path should be walked further. + /// This is run against each item from `get_more()`. + fn prune(&self, p: &Self::P) -> bool; +} + +/// The basic fully-recursive strategy. Nothing is pruned. +#[derive(Copy, Default)] +pub struct Recursive; + +impl Strategy for Recursive { + type P = Path; + fn get_more(&self, p: &Path) -> IoResult> { fs::readdir(p) } + + fn prune(&self, _: &Path) -> bool { false } +} + +/// A directory walker of `P` using strategy `S`. +pub struct Subpaths { + stack: Vec, + strategy: S, +} + +impl Subpaths { + /// Create a directory walker with a root path and strategy. + pub fn new(p: &S::P, strategy: S) -> IoResult> { + let stack = try!(strategy.get_more(p)); + Ok(Subpaths { stack: stack, strategy: strategy }) + } +} + +impl Subpaths { + /// Create a directory walker with a root path and a default strategy. + pub fn walk(p: &S::P) -> IoResult> { + Subpaths::new(p, Default::default()) + } +} + +impl Default for Subpaths { + fn default() -> Subpaths { + Subpaths { stack: Vec::new(), strategy: Default::default() } + } +} + +impl Iterator for Subpaths { + type Item = S::P; + fn next (&mut self) -> Option { + let mut opt_path = self.stack.pop(); + while opt_path.is_some() && self.strategy.prune(opt_path.as_ref().unwrap()) { + opt_path = self.stack.pop(); + } + match opt_path { + Some(path) => { + if PathExtensions::is_dir(&path) { + let result = self.strategy.get_more(&path); + match result { + Ok(dirs) => { self.stack.extend(dirs.into_iter()); }, + Err(..) => { } + } + } + Some(path) + } + None => None, + } + } +} + +fn main() { + let mut walker: Subpaths = Subpaths::walk(&Path::new("/home")).unwrap(); +} diff --git a/src/test/run-pass/issue-20823.rs b/src/test/run-pass/issue-20823.rs new file mode 100644 index 0000000000..561b619547 --- /dev/null +++ b/src/test/run-pass/issue-20823.rs @@ -0,0 +1,17 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: --test +// no-pretty-expanded + +#![deny(unstable)] + +#[test] +fn foo() {} diff --git a/src/test/run-pass/issue-20953.rs b/src/test/run-pass/issue-20953.rs new file mode 100644 index 0000000000..647302bbc9 --- /dev/null +++ b/src/test/run-pass/issue-20953.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let mut shrinker: Box> = Box::new(vec![1].into_iter()); + println!("{:?}", shrinker.next()); + for v in shrinker { assert!(false); } + + let mut shrinker: &mut Iterator = &mut vec![1].into_iter(); + println!("{:?}", shrinker.next()); + for v in shrinker { assert!(false); } +} diff --git a/src/test/run-pass/issue-21033.rs b/src/test/run-pass/issue-21033.rs new file mode 100644 index 0000000000..30c166cc67 --- /dev/null +++ b/src/test/run-pass/issue-21033.rs @@ -0,0 +1,53 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +#![feature(box_patterns)] +#![feature(box_syntax)] + +enum E { + StructVar { boxed: Box } +} + +fn main() { + + // Test matching each shorthand notation for field patterns. + let mut a = E::StructVar { boxed: box 3 }; + match a { + E::StructVar { box boxed } => { } + } + match a { + E::StructVar { box ref boxed } => { } + } + match a { + E::StructVar { box mut boxed } => { } + } + match a { + E::StructVar { box ref mut boxed } => { } + } + match a { + E::StructVar { ref boxed } => { } + } + match a { + E::StructVar { ref mut boxed } => { } + } + match a { + E::StructVar { mut boxed } => { } + } + + // Test matching non shorthand notation. Recreate a since last test + // moved `boxed` + let mut a = E::StructVar { boxed: box 3 }; + match a { + E::StructVar { boxed: box ref mut num } => { } + } + match a { + E::StructVar { boxed: ref mut num } => { } + } + +} diff --git a/src/test/run-pass/issue-21058.rs b/src/test/run-pass/issue-21058.rs new file mode 100644 index 0000000000..3cdd57aed5 --- /dev/null +++ b/src/test/run-pass/issue-21058.rs @@ -0,0 +1,29 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + +struct NT(str); +struct DST { a: u32, b: str } + +fn main() { + // get_tydesc should support unsized types + assert_eq!(unsafe {( + // Slice + (*std::intrinsics::get_tydesc::<[u8]>()).name, + // str + (*std::intrinsics::get_tydesc::()).name, + // Trait + (*std::intrinsics::get_tydesc::()).name, + // Newtype + (*std::intrinsics::get_tydesc::()).name, + // DST + (*std::intrinsics::get_tydesc::()).name + )}, ("[u8]", "str", "core::marker::Copy", "NT", "DST")); +} diff --git a/src/test/run-pass/issue-21245.rs b/src/test/run-pass/issue-21245.rs new file mode 100644 index 0000000000..9205b247e1 --- /dev/null +++ b/src/test/run-pass/issue-21245.rs @@ -0,0 +1,62 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Regression test for issue #21245. Check that we are able to infer +// the types in these examples correctly. It used to be that +// insufficient type propagation caused the type of the iterator to be +// incorrectly unified with the `*const` type to which it is coerced. + +use std::ptr; + +trait IntoIterator { + type Iter: Iterator; + + fn into_iter(self) -> Self::Iter; +} + +impl IntoIterator for I where I: Iterator { + type Iter = I; + + fn into_iter(self) -> I { + self + } +} + +fn desugared_for_loop_bad(v: Vec) { + match IntoIterator::into_iter(v.iter()) { + mut iter => { + loop { + match ::std::iter::Iterator::next(&mut iter) { + ::std::option::Option::Some(x) => { + unsafe { ptr::read(x); } + }, + ::std::option::Option::None => break + } + } + } + } +} + +fn desugared_for_loop_good(v: Vec) { + match v.iter().into_iter() { + mut iter => { + loop { + match ::std::iter::Iterator::next(&mut iter) { + ::std::option::Option::Some(x) => { + unsafe { ptr::read(x); } + }, + ::std::option::Option::None => break + } + } + } + } +} + +fn main() {} diff --git a/src/test/compile-fail/simd-experimental.rs b/src/test/run-pass/issue-21296.rs similarity index 81% rename from src/test/compile-fail/simd-experimental.rs rename to src/test/run-pass/issue-21296.rs index aea970f90b..f91fb064ae 100644 --- a/src/test/compile-fail/simd-experimental.rs +++ b/src/test/run-pass/issue-21296.rs @@ -8,10 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![deny(unstable)] +#[forbid(raw_pointer_derive)] +#[derive(Copy)] +struct Test(*const i32); -use std::simd; - -fn main() { - let _ = simd::i64x2(0, 0); //~ ERROR: experimental -} +fn main() {} diff --git a/src/test/run-pass/issue-21306.rs b/src/test/run-pass/issue-21306.rs new file mode 100644 index 0000000000..235dddefac --- /dev/null +++ b/src/test/run-pass/issue-21306.rs @@ -0,0 +1,17 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::sync::Arc; + +fn main() { + let x = 5; + let command = Arc::new(Box::new(|| { x*2 })); + assert_eq!(command(), 10); +} diff --git a/src/test/run-pass/issue-21350.rs b/src/test/run-pass/issue-21350.rs new file mode 100644 index 0000000000..feafee9037 --- /dev/null +++ b/src/test/run-pass/issue-21350.rs @@ -0,0 +1,17 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Make sure that "bare sequences" don't ICE in follow checking + +macro_rules! bare { + $($id:expr),+ => ( $($id)+ ) +} + +fn main() { } diff --git a/src/test/run-pass/issue-21361.rs b/src/test/run-pass/issue-21361.rs new file mode 100644 index 0000000000..bb20b3a321 --- /dev/null +++ b/src/test/run-pass/issue-21361.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let v = vec![1, 2, 3]; + let boxed: Box> = Box::new(v.into_iter()); + assert_eq!(boxed.max(), Some(3)); + + let v = vec![1, 2, 3]; + let boxed: &mut Iterator = &mut v.into_iter(); + assert_eq!(boxed.max(), Some(3)); +} diff --git a/src/test/compile-fail/deriving-span-Rand-tuple-struct.rs b/src/test/run-pass/issue-21363.rs similarity index 74% rename from src/test/compile-fail/deriving-span-Rand-tuple-struct.rs rename to src/test/run-pass/issue-21363.rs index 8038bf3ff0..71bb3d39fe 100644 --- a/src/test/compile-fail/deriving-span-Rand-tuple-struct.rs +++ b/src/test/run-pass/issue-21363.rs @@ -8,16 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' +#![no_implicit_prelude] -extern crate rand; +trait Iterator { + type Item; + fn dummy(&self) { } +} - -struct Error; - -#[derive(Rand)] -struct Struct( - Error //~ ERROR -); +impl<'a, T> Iterator for &'a mut (Iterator + 'a) { + type Item = T; +} fn main() {} diff --git a/src/test/run-pass/issue-21384.rs b/src/test/run-pass/issue-21384.rs new file mode 100644 index 0000000000..1d3984deac --- /dev/null +++ b/src/test/run-pass/issue-21384.rs @@ -0,0 +1,29 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use ::std::ops::RangeFull; + +fn test(arg: T) -> T { + arg.clone() +} + +#[derive(PartialEq)] +struct Test(int); + +fn main() { + // Check that ranges implement clone + assert!(test(1..5) == (1..5)); + assert!(test(..5) == (..5)); + assert!(test(1..) == (1..)); + assert!(test(RangeFull) == (RangeFull)); + + // Check that ranges can still be used with non-clone limits + assert!((Test(1)..Test(5)) == (Test(1)..Test(5))); +} diff --git a/src/test/run-pass/issue-21402.rs b/src/test/run-pass/issue-21402.rs new file mode 100644 index 0000000000..6be7cea292 --- /dev/null +++ b/src/test/run-pass/issue-21402.rs @@ -0,0 +1,18 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[derive(Hash)] +struct Foo { + a: Vec, + b: (bool, bool), + c: [bool; 2], +} + +fn main() {} diff --git a/src/test/run-pass/issue-21520.rs b/src/test/run-pass/issue-21520.rs new file mode 100644 index 0000000000..3a813641a3 --- /dev/null +++ b/src/test/run-pass/issue-21520.rs @@ -0,0 +1,29 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that the requirement (in `Bar`) that `T::Bar : 'static` does +// not wind up propagating to `T`. + +pub trait Foo { + type Bar; + + fn foo(&self) -> Self; +} + +pub struct Static(T); + +struct Bar + where T::Bar : 'static +{ + x: Static> +} + +fn main() { } + diff --git a/src/test/run-pass/issue-21634.rs b/src/test/run-pass/issue-21634.rs new file mode 100644 index 0000000000..e5a2790917 --- /dev/null +++ b/src/test/run-pass/issue-21634.rs @@ -0,0 +1,22 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + +fn main() { + if let Ok(x) = "3.1415".parse() { + assert_eq!(false, x <= 0.0); + } + if let Ok(x) = "3.1415".parse() { + assert_eq!(3.1415, x + 0.0); + } + if let Ok(mut x) = "3.1415".parse() { + assert_eq!(8.1415, { x += 5.0; x }); + } +} diff --git a/src/test/compile-fail/view-items-at-top.rs b/src/test/run-pass/issue-21655.rs similarity index 67% rename from src/test/compile-fail/view-items-at-top.rs rename to src/test/run-pass/issue-21655.rs index 7b78a8d932..b9b1e5f333 100644 --- a/src/test/compile-fail/view-items-at-top.rs +++ b/src/test/run-pass/issue-21655.rs @@ -1,4 +1,4 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// 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. // @@ -8,12 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate test; - -fn f() { +fn test(it: &mut Iterator) { + for x in it { + assert_eq!(x, 1) + } } -use test::net; //~ ERROR `use` and `extern crate` declarations must precede items - fn main() { + let v = vec![1]; + test(&mut v.into_iter()) } diff --git a/src/test/run-pass/issue-21726.rs b/src/test/run-pass/issue-21726.rs new file mode 100644 index 0000000000..09d1a3bca6 --- /dev/null +++ b/src/test/run-pass/issue-21726.rs @@ -0,0 +1,44 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Regression test for #21726: an issue arose around the rules for +// subtyping of projection types that resulted in an unconstrained +// region, yielding region inference failures. + +fn main() { } + +fn foo<'a>(s: &'a str) { + let b: B<()> = B::new(s, ()); + b.get_short(); +} + +trait IntoRef<'a> { + type T: Clone; + fn into_ref(self, &'a str) -> Self::T; +} + +impl<'a> IntoRef<'a> for () { + type T = &'a str; + fn into_ref(self, s: &'a str) -> &'a str { + s + } +} + +struct B<'a, P: IntoRef<'a>>(P::T); + +impl<'a, P: IntoRef<'a>> B<'a, P> { + fn new(s: &'a str, i: P) -> B<'a, P> { + B(i.into_ref(s)) + } + + fn get_short(&self) -> P::T { + self.0.clone() + } +} diff --git a/src/test/run-pass/issue-2185.rs b/src/test/run-pass/issue-2185.rs index 1bc1196c49..20ff8d29b7 100644 --- a/src/test/run-pass/issue-2185.rs +++ b/src/test/run-pass/issue-2185.rs @@ -9,7 +9,6 @@ // except according to those terms. // ignore-test -// ignore-lexer-test FIXME #15881 // notes on this test case: // On Thu, Apr 18, 2013-2014 at 6:30 PM, John Clements wrote: @@ -73,17 +72,17 @@ fn range(lo: uint, hi: uint, it: |uint|) { let mut i = lo; while i < hi { it(i); - i += 1u; + i += 1_usize; } } pub fn main() { - let range: 'static ||uint|| = |a| range(0u, 1000u, a); + let range: 'static ||uint|| = |a| range(0_usize, 1000_usize, a); let filt: 'static ||v: uint|| = |a| filter( range, - |&&n: uint| n % 3u != 0u && n % 5u != 0u, + |&&n: uint| n % 3_usize != 0_usize && n % 5_usize != 0_usize, a); - let sum = foldl(filt, 0u, |accum, &&n: uint| accum + n ); + let sum = foldl(filt, 0_usize, |accum, &&n: uint| accum + n ); println!("{}", sum); } diff --git a/src/test/run-pass/issue-21891.rs b/src/test/run-pass/issue-21891.rs new file mode 100644 index 0000000000..d6e6f23191 --- /dev/null +++ b/src/test/run-pass/issue-21891.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +static foo: [uint; 3] = [1, 2, 3]; + +static slice_1: &'static [uint] = &foo; +static slice_2: &'static [uint] = &foo; + +fn main() {} diff --git a/src/test/run-pass/issue-2190-1.rs b/src/test/run-pass/issue-2190-1.rs index 810bf385d7..3025741694 100644 --- a/src/test/run-pass/issue-2190-1.rs +++ b/src/test/run-pass/issue-2190-1.rs @@ -13,11 +13,11 @@ use std::thunk::Thunk; static generations: uint = 1024+256+128+49; -fn spawn(f: Thunk) { +fn spawn(f: Thunk<'static>) { Builder::new().stack_size(32 * 1024).spawn(move|| f.invoke(())); } -fn child_no(x: uint) -> Thunk { +fn child_no(x: uint) -> Thunk<'static> { Thunk::new(move|| { if x < generations { spawn(child_no(x+1)); diff --git a/src/test/run-pass/issue-21909.rs b/src/test/run-pass/issue-21909.rs new file mode 100644 index 0000000000..55b61dd194 --- /dev/null +++ b/src/test/run-pass/issue-21909.rs @@ -0,0 +1,22 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +trait A { + fn dummy(&self, arg: X); +} + +trait B { + type X; + type Y: A; + + fn dummy(&self); +} + +fn main () { } diff --git a/src/test/run-pass/issue-22036.rs b/src/test/run-pass/issue-22036.rs new file mode 100644 index 0000000000..c06a29c09f --- /dev/null +++ b/src/test/run-pass/issue-22036.rs @@ -0,0 +1,33 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +trait DigitCollection: Sized { + type Iter: Iterator; + fn digit_iter(self) -> Self::Iter; + + fn digit_sum(self) -> u32 { + self.digit_iter() + .map(|digit: u8| digit as u32) + .fold(0, |sum, digit| sum + digit) + } +} + +impl DigitCollection for I where I: Iterator { + type Iter = I; + + fn digit_iter(self) -> I { + self + } +} + +fn main() { + let xs = vec![1u8, 2, 3, 4, 5]; + assert_eq!(xs.into_iter().digit_sum(), 15); +} diff --git a/src/test/run-pass/issue-2216.rs b/src/test/run-pass/issue-2216.rs index 98e6e05134..c2f74a9d65 100644 --- a/src/test/run-pass/issue-2216.rs +++ b/src/test/run-pass/issue-2216.rs @@ -9,12 +9,12 @@ // except according to those terms. pub fn main() { - let mut x = 0i; + let mut x = 0; 'foo: loop { 'bar: loop { 'quux: loop { - if 1i == 2 { + if 1 == 2 { break 'foo; } else { diff --git a/src/test/run-pass/issue-2288.rs b/src/test/run-pass/issue-2288.rs index 7baead6929..18bb6fe552 100644 --- a/src/test/run-pass/issue-2288.rs +++ b/src/test/run-pass/issue-2288.rs @@ -15,12 +15,11 @@ trait clam { fn chowder(&self, y: A); } +#[derive(Copy)] struct foo { x: A, } -impl Copy for foo {} - impl clam for foo { fn chowder(&self, _y: A) { } diff --git a/src/test/run-pass/issue-2311-2.rs b/src/test/run-pass/issue-2311-2.rs index e0b98ab196..5529d51b40 100644 --- a/src/test/run-pass/issue-2311-2.rs +++ b/src/test/run-pass/issue-2311-2.rs @@ -8,7 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait clam { } +trait clam { + fn get(self) -> A; +} + struct foo { x: A, } diff --git a/src/test/run-pass/issue-2311.rs b/src/test/run-pass/issue-2311.rs index dc873ed08d..b6b3114e2a 100644 --- a/src/test/run-pass/issue-2311.rs +++ b/src/test/run-pass/issue-2311.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait clam { } +trait clam { fn get(self) -> A; } trait foo { fn bar>(&self, c: C) -> B; } diff --git a/src/test/run-pass/issue-2312.rs b/src/test/run-pass/issue-2312.rs index 8c597552d7..3f273b56ef 100644 --- a/src/test/run-pass/issue-2312.rs +++ b/src/test/run-pass/issue-2312.rs @@ -10,7 +10,7 @@ // Testing that the B's are resolved -trait clam { } +trait clam { fn get(self) -> A; } struct foo(int); diff --git a/src/test/run-pass/issue-2383.rs b/src/test/run-pass/issue-2383.rs index 94bff89082..a5a05283f8 100644 --- a/src/test/run-pass/issue-2383.rs +++ b/src/test/run-pass/issue-2383.rs @@ -10,9 +10,9 @@ // except according to those terms. extern crate collections; -use std::collections::RingBuf; +use std::collections::VecDeque; pub fn main() { - let mut q = RingBuf::new(); - q.push_front(10i); + let mut q = VecDeque::new(); + q.push_front(10); } diff --git a/src/test/run-pass/issue-2428.rs b/src/test/run-pass/issue-2428.rs index afa053de24..7ed26428be 100644 --- a/src/test/run-pass/issue-2428.rs +++ b/src/test/run-pass/issue-2428.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let _foo = 100i; + let _foo = 100; const quux: int = 5; enum Stuff { diff --git a/src/test/run-pass/issue-2550.rs b/src/test/run-pass/issue-2550.rs index 99c6882650..395b2c4b45 100644 --- a/src/test/run-pass/issue-2550.rs +++ b/src/test/run-pass/issue-2550.rs @@ -22,5 +22,5 @@ fn f(_x: T) { } pub fn main() { - f(C(1u)); + f(C(1_usize)); } diff --git a/src/test/run-pass/issue-2611-3.rs b/src/test/run-pass/issue-2611-3.rs index 2608c89d15..c005699ce3 100644 --- a/src/test/run-pass/issue-2611-3.rs +++ b/src/test/run-pass/issue-2611-3.rs @@ -12,7 +12,7 @@ // than the traits require. trait A { - fn b(x: C) -> C; + fn b(&self, x: C) -> C; } struct E { @@ -20,7 +20,7 @@ struct E { } impl A for E { - fn b(_x: F) -> F { panic!() } + fn b(&self, _x: F) -> F { panic!() } //~^ ERROR in method `b`, type parameter 0 has 1 bound, but } diff --git a/src/test/run-pass/issue-2633-2.rs b/src/test/run-pass/issue-2633-2.rs index c146f8a7a9..80e9ca4702 100644 --- a/src/test/run-pass/issue-2633-2.rs +++ b/src/test/run-pass/issue-2633-2.rs @@ -17,6 +17,6 @@ fn a_val(x: Box, y: Box) -> int { } pub fn main() { - let z = box 22i; + let z = box 22; a_val(z.clone(), z.clone()); } diff --git a/src/test/run-pass/issue-2633.rs b/src/test/run-pass/issue-2633.rs index bc014f699c..de99141c80 100644 --- a/src/test/run-pass/issue-2633.rs +++ b/src/test/run-pass/issue-2633.rs @@ -8,12 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[derive(Copy)] struct cat { meow: extern "Rust" fn(), } -impl Copy for cat {} - fn meow() { println!("meow") } @@ -24,10 +23,9 @@ fn cat() -> cat { } } +#[derive(Copy)] struct KittyInfo {kitty: cat} -impl Copy for KittyInfo {} - // Code compiles and runs successfully if we add a + before the first arg fn nyan(kitty: cat, _kitty_info: KittyInfo) { (kitty.meow)(); diff --git a/src/test/run-pass/issue-2718.rs b/src/test/run-pass/issue-2718.rs index 6f5f46edc0..b8a541a0fc 100644 --- a/src/test/run-pass/issue-2718.rs +++ b/src/test/run-pass/issue-2718.rs @@ -33,7 +33,7 @@ pub mod pipes { payload: Option } - #[derive(PartialEq, Show)] + #[derive(PartialEq, Debug)] #[repr(int)] pub enum state { empty, diff --git a/src/test/run-pass/issue-2734.rs b/src/test/run-pass/issue-2734.rs index 3e4cffe5df..a7b53db6b0 100644 --- a/src/test/run-pass/issue-2734.rs +++ b/src/test/run-pass/issue-2734.rs @@ -11,7 +11,9 @@ #![allow(unknown_features)] #![feature(box_syntax)] -trait hax { } +trait hax { + fn dummy(&self) { } +} impl hax for A { } fn perform_hax(x: Box) -> Box { @@ -23,5 +25,5 @@ fn deadcode() { } pub fn main() { - let _ = perform_hax(box 42i); + let _ = perform_hax(box 42); } diff --git a/src/test/run-pass/issue-2735.rs b/src/test/run-pass/issue-2735.rs index cb376d0e43..1594b94879 100644 --- a/src/test/run-pass/issue-2735.rs +++ b/src/test/run-pass/issue-2735.rs @@ -11,7 +11,9 @@ #![allow(unknown_features)] #![feature(box_syntax)] -trait hax { } +trait hax { + fn dummy(&self) { } +} impl hax for A { } fn perform_hax(x: Box) -> Box { @@ -23,5 +25,5 @@ fn deadcode() { } pub fn main() { - perform_hax(box 42i); + perform_hax(box 42); } diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs index f87eb46d55..b55f369135 100644 --- a/src/test/run-pass/issue-2904.rs +++ b/src/test/run-pass/issue-2904.rs @@ -12,7 +12,7 @@ /// Map representation -use std::io; +use std::old_io; use std::fmt; use square::{bot, wall, rock, lambda, closed_lift, open_lift, earth, empty}; @@ -27,7 +27,7 @@ enum square { empty } -impl fmt::Show for square { +impl fmt::Debug for square { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", match *self { bot => { "R".to_string() } @@ -59,19 +59,19 @@ fn square_from_char(c: char) -> square { } } -fn read_board_grid(mut input: rdr) +fn read_board_grid(mut input: rdr) -> Vec> { - let mut input: &mut io::Reader = &mut input; + let mut input: &mut old_io::Reader = &mut input; let mut grid = Vec::new(); let mut line = [0; 10]; input.read(&mut line); let mut row = Vec::new(); - for c in line.iter() { + for c in &line { row.push(square_from_char(*c as char)) } grid.push(row); let width = grid[0].len(); - for row in grid.iter() { assert!(row.len() == width) } + for row in &grid { assert!(row.len() == width) } grid } diff --git a/src/test/run-pass/issue-2935.rs b/src/test/run-pass/issue-2935.rs index 295fd538de..31599d0caa 100644 --- a/src/test/run-pass/issue-2935.rs +++ b/src/test/run-pass/issue-2935.rs @@ -24,9 +24,9 @@ impl it for t { } pub fn main() { - // let x = ({a: 4i} as it); - // let y = box ({a: 4i}); - // let z = box ({a: 4i} as it); + // let x = ({a: 4} as it); + // let y = box ({a: 4}); + // let z = box ({a: 4} as it); // let z = box ({a: true} as it); let z = box() (box true as Box); // x.f(); diff --git a/src/test/run-pass/issue-2989.rs b/src/test/run-pass/issue-2989.rs index bef082569b..8767d397b6 100644 --- a/src/test/run-pass/issue-2989.rs +++ b/src/test/run-pass/issue-2989.rs @@ -21,7 +21,7 @@ impl methods for () { // the position of this function is significant! - if it comes before methods // then it works, if it comes after it then it doesn't! fn to_bools(bitv: Storage) -> Vec { - range(0, 8).map(|i| { + (0_usize..8).map(|i| { let w = i / 64; let b = i % 64; let x = 1u64 & (bitv.storage[w] >> b); @@ -35,7 +35,7 @@ pub fn main() { let bools = vec!(false, false, true, false, false, true, true, false); let bools2 = to_bools(Storage{storage: vec!(0b01100100)}); - for i in range(0u, 8) { + for i in 0_usize..8 { println!("{} => {} vs {}", i, bools[i], bools2[i]); } diff --git a/src/test/run-pass/issue-3026.rs b/src/test/run-pass/issue-3026.rs index cd71bfce27..25663f2605 100644 --- a/src/test/run-pass/issue-3026.rs +++ b/src/test/run-pass/issue-3026.rs @@ -17,7 +17,8 @@ extern crate collections; use std::collections::HashMap; pub fn main() { + let x; let mut buggy_map: HashMap = HashMap::new(); - let x = box 1; + x = box 1; buggy_map.insert(42, &*x); } diff --git a/src/test/run-pass/issue-3052.rs b/src/test/run-pass/issue-3052.rs index c08bdf5440..3e7deee6ec 100644 --- a/src/test/run-pass/issue-3052.rs +++ b/src/test/run-pass/issue-3052.rs @@ -14,7 +14,7 @@ type Connection = Box) + 'static>; fn f() -> Option { - let mock_connection: Connection = box |&mut: _| {}; + let mock_connection: Connection = box |_| {}; Some(mock_connection) } diff --git a/src/test/run-pass/issue-3091.rs b/src/test/run-pass/issue-3091.rs index 2e287e24e2..c4c2c2b7da 100644 --- a/src/test/run-pass/issue-3091.rs +++ b/src/test/run-pass/issue-3091.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let x = 1i; - let y = 1i; + let x = 1; + let y = 1; assert_eq!(&x, &y); } diff --git a/src/test/run-pass/issue-3121.rs b/src/test/run-pass/issue-3121.rs index c789921f62..b6ed85e9e4 100644 --- a/src/test/run-pass/issue-3121.rs +++ b/src/test/run-pass/issue-3121.rs @@ -11,14 +11,13 @@ #![allow(unknown_features)] #![feature(box_syntax)] +#[derive(Copy)] enum side { mayo, catsup, vinegar } +#[derive(Copy)] enum order { hamburger, fries(side), shake } +#[derive(Copy)] enum meal { to_go(order), for_here(order) } -impl Copy for side {} -impl Copy for order {} -impl Copy for meal {} - fn foo(m: Box, cond: bool) { match *m { meal::to_go(_) => { } diff --git a/src/test/run-pass/issue-3211.rs b/src/test/run-pass/issue-3211.rs index c52c23b5d7..28c9bf1e83 100644 --- a/src/test/run-pass/issue-3211.rs +++ b/src/test/run-pass/issue-3211.rs @@ -9,8 +9,8 @@ // except according to those terms. pub fn main() { - let mut x = 0i; - for _ in range(0i, 4096) { x += 1; } + let mut x = 0; + for _ in 0..4096 { x += 1; } assert_eq!(x, 4096); println!("x = {}", x); } diff --git a/src/test/run-pass/issue-3290.rs b/src/test/run-pass/issue-3290.rs index a72b272aba..c8d6e69801 100644 --- a/src/test/run-pass/issue-3290.rs +++ b/src/test/run-pass/issue-3290.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let mut x = box 3i; + let mut x = box 3; x = x; assert_eq!(*x, 3); } diff --git a/src/test/run-pass/issue-333.rs b/src/test/run-pass/issue-333.rs index ef49d0a170..1217f32826 100644 --- a/src/test/run-pass/issue-333.rs +++ b/src/test/run-pass/issue-333.rs @@ -12,4 +12,4 @@ fn quux(x: T) -> T { let f = id::; return f(x); } fn id(x: T) -> T { return x; } -pub fn main() { assert!((quux(10i) == 10i)); } +pub fn main() { assert!((quux(10) == 10)); } diff --git a/src/test/run-pass/issue-3389.rs b/src/test/run-pass/issue-3389.rs index 8f6b813719..26558bdd30 100644 --- a/src/test/run-pass/issue-3389.rs +++ b/src/test/run-pass/issue-3389.rs @@ -15,7 +15,7 @@ struct trie_node { } fn print_str_vector(vector: Vec ) { - for string in vector.iter() { + for string in &vector { println!("{}", *string); } } diff --git a/src/test/run-pass/issue-3424.rs b/src/test/run-pass/issue-3424.rs index 6647fbe223..0d85f61e51 100644 --- a/src/test/run-pass/issue-3424.rs +++ b/src/test/run-pass/issue-3424.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. @@ -15,8 +14,8 @@ #![feature(box_syntax)] #![feature(unboxed_closures)] -use std::path::{Path}; -use std::path; +use std::old_path::{Path}; +use std::old_path; use std::result; use std::thunk::Thunk; @@ -28,7 +27,7 @@ fn tester() result::Result::Ok("more blah".to_string()) }; - let path = path::Path::new("blah"); + let path = old_path::Path::new("blah"); assert!(loader(&path).is_ok()); } diff --git a/src/test/run-pass/issue-3429.rs b/src/test/run-pass/issue-3429.rs index 60c5345000..e331a1a2d0 100644 --- a/src/test/run-pass/issue-3429.rs +++ b/src/test/run-pass/issue-3429.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let x = 1u; - let y = |&:| x; + let x = 1_usize; + let y = || x; let _z = y(); } diff --git a/src/test/run-pass/issue-3500.rs b/src/test/run-pass/issue-3500.rs index eb422c9a8b..99def5476f 100644 --- a/src/test/run-pass/issue-3500.rs +++ b/src/test/run-pass/issue-3500.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let x = &Some(1i); + let x = &Some(1); match x { &Some(_) => (), &None => (), diff --git a/src/test/run-pass/issue-3556.rs b/src/test/run-pass/issue-3556.rs index 3448273e14..2bd270f9b0 100644 --- a/src/test/run-pass/issue-3556.rs +++ b/src/test/run-pass/issue-3556.rs @@ -9,7 +9,7 @@ // except according to those terms. -#[derive(Show)] +#[derive(Debug)] enum Token { Text(String), ETag(Vec, String), diff --git a/src/test/run-pass/issue-3559.rs b/src/test/run-pass/issue-3559.rs index 633832f424..754412ea94 100644 --- a/src/test/run-pass/issue-3559.rs +++ b/src/test/run-pass/issue-3559.rs @@ -22,8 +22,8 @@ fn check_strs(actual: &str, expected: &str) -> bool { pub fn main() { let mut table = HashMap::new(); - table.insert("one".to_string(), 1i); - table.insert("two".to_string(), 2i); - assert!(check_strs(format!("{:?}", table).as_slice(), "HashMap {\"one\": 1i, \"two\": 2i}") || - check_strs(format!("{:?}", table).as_slice(), "HashMap {\"two\": 2i, \"one\": 1i}")); + table.insert("one".to_string(), 1); + table.insert("two".to_string(), 2); + assert!(check_strs(&format!("{:?}", table), "HashMap {\"one\": 1, \"two\": 2}") || + check_strs(&format!("{:?}", table), "HashMap {\"two\": 2, \"one\": 1}")); } diff --git a/src/test/run-pass/issue-3563-2.rs b/src/test/run-pass/issue-3563-2.rs index e688b95f87..2cf29296b8 100644 --- a/src/test/run-pass/issue-3563-2.rs +++ b/src/test/run-pass/issue-3563-2.rs @@ -11,7 +11,7 @@ trait Canvas { fn add_point(&self, point: &int); fn add_points(&self, shapes: &[int]) { - for pt in shapes.iter() { + for pt in shapes { self.add_point(pt) } } diff --git a/src/test/run-pass/issue-3563-3.rs b/src/test/run-pass/issue-3563-3.rs index 3fe6e02dce..f4b85e03ea 100644 --- a/src/test/run-pass/issue-3563-3.rs +++ b/src/test/run-pass/issue-3563-3.rs @@ -27,29 +27,26 @@ use std::iter::repeat; use std::slice; // Represents a position on a canvas. +#[derive(Copy)] struct Point { x: int, y: int, } -impl Copy for Point {} - // 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, } -impl Copy for Size {} - +#[derive(Copy)] struct Rect { top_left: Point, size: Size, } -impl Copy for Rect {} - // Contains the information needed to do shape rendering via ASCII art. struct AsciiArt { width: uint, @@ -72,7 +69,7 @@ fn AsciiArt(width: uint, height: uint, 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(); - for _ in range(0, height) { + for _ in 0..height { lines.push(repeat('.').take(width).collect::>()); } @@ -125,7 +122,7 @@ trait Canvas { // Unlike interfaces traits support default implementations. // Got an ICE as soon as I added this method. fn add_points(&mut self, shapes: &[Point]) { - for pt in shapes.iter() {self.add_point(*pt)}; + for pt in shapes {self.add_point(*pt)}; } } @@ -139,13 +136,13 @@ impl Canvas for AsciiArt { fn add_rect(&mut self, shape: Rect) { // Add the top and bottom lines. - for x in range(shape.top_left.x, shape.top_left.x + shape.size.width) { + for x in shape.top_left.x..shape.top_left.x + shape.size.width { self.add_pt(x, shape.top_left.y); self.add_pt(x, shape.top_left.y + shape.size.height - 1); } // Add the left and right lines. - for y in range(shape.top_left.y, shape.top_left.y + shape.size.height) { + for y in shape.top_left.y..shape.top_left.y + shape.size.height { self.add_pt(shape.top_left.x, y); self.add_pt(shape.top_left.x + shape.size.width - 1, y); } @@ -165,7 +162,7 @@ pub fn check_strs(actual: &str, expected: &str) -> bool { fn test_ascii_art_ctor() { let art = AsciiArt(3, 3, '*'); - assert!(check_strs(art.to_string().as_slice(), "...\n...\n...")); + assert!(check_strs(&art.to_string(), "...\n...\n...")); } @@ -174,7 +171,7 @@ fn test_add_pt() { art.add_pt(0, 0); art.add_pt(0, -10); art.add_pt(1, 2); - assert!(check_strs(art.to_string().as_slice(), "*..\n...\n.*.")); + assert!(check_strs(&art.to_string(), "*..\n...\n.*.")); } @@ -182,7 +179,7 @@ fn test_shapes() { let mut art = AsciiArt(4, 4, '*'); art.add_rect(Rect {top_left: Point {x: 0, y: 0}, size: Size {width: 4, height: 4}}); art.add_point(Point {x: 2, y: 2}); - assert!(check_strs(art.to_string().as_slice(), "****\n*..*\n*.**\n****")); + assert!(check_strs(&art.to_string(), "****\n*..*\n*.**\n****")); } pub fn main() { diff --git a/src/test/run-pass/issue-3609.rs b/src/test/run-pass/issue-3609.rs index 56eb7486c9..4a28c34e5d 100644 --- a/src/test/run-pass/issue-3609.rs +++ b/src/test/run-pass/issue-3609.rs @@ -29,7 +29,7 @@ fn foo(name: String, samples_chan: Sender) { // `box() (...)` syntax is needed to make pretty printer converge in one try: let callback: SamplesFn = box() (move |buffer| { - for i in range(0u, buffer.len()) { + for i in 0_usize..buffer.len() { println!("{}: {}", i, buffer[i]) } }); diff --git a/src/test/run-pass/issue-3743.rs b/src/test/run-pass/issue-3743.rs index 382ea0c575..03699ff8d6 100644 --- a/src/test/run-pass/issue-3743.rs +++ b/src/test/run-pass/issue-3743.rs @@ -14,13 +14,12 @@ use std::ops::Mul; +#[derive(Copy)] struct Vec2 { x: f64, y: f64 } -impl Copy for Vec2 {} - // methods we want to export as methods as well as operators impl Vec2 { #[inline(always)] diff --git a/src/test/run-pass/issue-3753.rs b/src/test/run-pass/issue-3753.rs index 00a8a0893a..58d7aa276f 100644 --- a/src/test/run-pass/issue-3753.rs +++ b/src/test/run-pass/issue-3753.rs @@ -14,20 +14,18 @@ use std::f64; +#[derive(Copy)] pub struct Point { x: f64, y: f64 } -impl Copy for Point {} - +#[derive(Copy)] pub enum Shape { Circle(Point, f64), Rectangle(Point, Point) } -impl Copy for Shape {} - impl Shape { pub fn area(&self, sh: Shape) -> f64 { match sh { diff --git a/src/test/run-pass/issue-3794.rs b/src/test/run-pass/issue-3794.rs index 91c938981c..6ac252c07e 100644 --- a/src/test/run-pass/issue-3794.rs +++ b/src/test/run-pass/issue-3794.rs @@ -15,7 +15,7 @@ trait T { fn print(&self); } -#[derive(Show)] +#[derive(Debug)] struct S { s: int, } diff --git a/src/test/run-pass/issue-3878.rs b/src/test/run-pass/issue-3878.rs index 5434e44c17..c1d19f228d 100644 --- a/src/test/run-pass/issue-3878.rs +++ b/src/test/run-pass/issue-3878.rs @@ -13,6 +13,6 @@ #![feature(box_syntax)] pub fn main() { - let y = box 1i; + let y = box 1; y; } diff --git a/src/test/run-pass/issue-4107.rs b/src/test/run-pass/issue-4107.rs index 2ed662e9f2..d660f300ad 100644 --- a/src/test/run-pass/issue-4107.rs +++ b/src/test/run-pass/issue-4107.rs @@ -9,14 +9,14 @@ // except according to those terms. pub fn main() { - let _id: &Mat2 = &Matrix::identity(); + let _id: &Mat2 = &Matrix::identity(1.0); } -pub trait Index { } +pub trait Index { fn get(&self, Index) -> Result { panic!() } } pub trait Dimensional: Index { } -pub struct Mat2 { x: () } -pub struct Vec2 { x: () } +pub struct Mat2 { x: T } +pub struct Vec2 { x: T } impl Dimensional> for Mat2 { } impl Index> for Mat2 { } @@ -25,9 +25,9 @@ impl Dimensional for Vec2 { } impl Index for Vec2 { } pub trait Matrix: Dimensional { - fn identity() -> Self; + fn identity(t:T) -> Self; } impl Matrix> for Mat2 { - fn identity() -> Mat2 { Mat2{ x: () } } + fn identity(t:T) -> Mat2 { Mat2{ x: t } } } diff --git a/src/test/run-pass/issue-4241.rs b/src/test/run-pass/issue-4241.rs index 3130c0441a..89cf2f69b3 100644 --- a/src/test/run-pass/issue-4241.rs +++ b/src/test/run-pass/issue-4241.rs @@ -44,7 +44,7 @@ priv fn parse_data(len: uint, io: @io::Reader) -> Result { priv fn parse_list(len: uint, io: @io::Reader) -> Result { let mut list: ~[Result] = ~[]; - for _ in range(0, len) { + for _ in 0..len { let v = match io.read_char() { '$' => parse_bulk(io), ':' => parse_int(io), @@ -100,7 +100,7 @@ priv fn cmd_to_string(cmd: ~[String]) -> String { let mut res = "*".to_string(); res.push_str(cmd.len().to_string()); res.push_str("\r\n"); - for s in cmd.iter() { + for s in &cmd { res.push_str(["$".to_string(), s.len().to_string(), "\r\n".to_string(), (*s).clone(), "\r\n".to_string()].concat() ); } diff --git a/src/test/run-pass/issue-4252.rs b/src/test/run-pass/issue-4252.rs index 3606aff05f..9d5f8576c6 100644 --- a/src/test/run-pass/issue-4252.rs +++ b/src/test/run-pass/issue-4252.rs @@ -11,28 +11,28 @@ #![feature(unsafe_destructor)] trait X { - fn call(&self, x: &T); - fn default_method(&self, x: &T) { + fn call(&self, x: &T); + fn default_method(&self, x: &T) { println!("X::default_method {:?}", x); } } -#[derive(Show)] +#[derive(Debug)] struct Y(int); -#[derive(Show)] +#[derive(Debug)] struct Z { x: T } impl X for Y { - fn call(&self, x: &T) { + fn call(&self, x: &T) { println!("X::call {:?} {:?}", self, x); } } #[unsafe_destructor] -impl Drop for Z { +impl Drop for Z { fn drop(&mut self) { // These statements used to cause an ICE. self.x.call(self); diff --git a/src/test/run-pass/issue-4333.rs b/src/test/run-pass/issue-4333.rs index fd67b76710..28ab3c3ef1 100644 --- a/src/test/run-pass/issue-4333.rs +++ b/src/test/run-pass/issue-4333.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::io; +use std::old_io; pub fn main() { - let stdout = &mut io::stdout() as &mut io::Writer; + let stdout = &mut old_io::stdout() as &mut old_io::Writer; stdout.write(b"Hello!"); } diff --git a/src/test/run-pass/issue-4387.rs b/src/test/run-pass/issue-4387.rs index 43948ef4a4..02601ba2f2 100644 --- a/src/test/run-pass/issue-4387.rs +++ b/src/test/run-pass/issue-4387.rs @@ -9,5 +9,5 @@ // except according to those terms. pub fn main() { - let _foo = [0i; 2*4]; + let _foo = [0; 2*4]; } diff --git a/src/test/run-pass/issue-4401.rs b/src/test/run-pass/issue-4401.rs index c251fafc24..e4fea724c7 100644 --- a/src/test/run-pass/issue-4401.rs +++ b/src/test/run-pass/issue-4401.rs @@ -9,8 +9,8 @@ // except according to those terms. pub fn main() { - let mut count = 0i; - for _ in range(0i, 999_999) { count += 1; } + let mut count = 0; + for _ in 0..999_999 { count += 1; } assert_eq!(count, 999_999); println!("{}", count); } diff --git a/src/test/run-pass/issue-4446.rs b/src/test/run-pass/issue-4446.rs index 9c00348ad6..b40a726a2c 100644 --- a/src/test/run-pass/issue-4446.rs +++ b/src/test/run-pass/issue-4446.rs @@ -8,16 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::io::println; +use std::old_io::println; use std::sync::mpsc::channel; -use std::thread::Thread; +use std::thread; pub fn main() { let (tx, rx) = channel(); tx.send("hello, world").unwrap(); - Thread::scoped(move|| { + thread::spawn(move|| { println(rx.recv().unwrap()); }).join().ok().unwrap(); } diff --git a/src/test/run-pass/issue-4448.rs b/src/test/run-pass/issue-4448.rs index a19bfca721..ef30f9182b 100644 --- a/src/test/run-pass/issue-4448.rs +++ b/src/test/run-pass/issue-4448.rs @@ -9,12 +9,12 @@ // except according to those terms. use std::sync::mpsc::channel; -use std::thread::Thread; +use std::thread; pub fn main() { let (tx, rx) = channel::<&'static str>(); - let t = Thread::scoped(move|| { + let t = thread::spawn(move|| { assert_eq!(rx.recv().unwrap(), "hello, world"); }); diff --git a/src/test/run-pass/issue-4541.rs b/src/test/run-pass/issue-4541.rs index c9baab3cfa..1f090d8b62 100644 --- a/src/test/run-pass/issue-4541.rs +++ b/src/test/run-pass/issue-4541.rs @@ -9,12 +9,11 @@ // except according to those terms. fn parse_args() -> String { - let args = ::std::os::args(); - let args = args.as_slice(); + let args: Vec<_> = ::std::env::args().collect(); let mut n = 0; while n < args.len() { - match args[n].as_slice() { + match &*args[n] { "-v" => (), s => { return s.to_string(); diff --git a/src/test/run-pass/issue-4542.rs b/src/test/run-pass/issue-4542.rs index 024ee8c6df..521e1b40f9 100644 --- a/src/test/run-pass/issue-4542.rs +++ b/src/test/run-pass/issue-4542.rs @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::os; +use std::env; pub fn main() { - for arg in os::args().iter() { - match (*arg).clone() { + for arg in env::args() { + match arg.clone() { _s => { } } } diff --git a/src/test/run-pass/issue-5192.rs b/src/test/run-pass/issue-5192.rs index bb79cd4d04..a6f3771bf6 100644 --- a/src/test/run-pass/issue-5192.rs +++ b/src/test/run-pass/issue-5192.rs @@ -12,6 +12,7 @@ #![feature(box_syntax)] pub trait EventLoop { + fn dummy(&self) { } } pub struct UvEventLoop { diff --git a/src/test/run-pass/issue-5239-2.rs b/src/test/run-pass/issue-5239-2.rs index 69255c5768..dd9a6fb354 100644 --- a/src/test/run-pass/issue-5239-2.rs +++ b/src/test/run-pass/issue-5239-2.rs @@ -11,7 +11,7 @@ // Regression test for issue #5239 pub fn main() { - let _f = |&: ref x: int| { *x }; + let _f = |ref x: int| { *x }; let foo = 10; assert!(_f(foo) == 10); } diff --git a/src/test/run-pass/issue-5321-immediates-with-bare-self.rs b/src/test/run-pass/issue-5321-immediates-with-bare-self.rs index 511b8a9683..2ab41f7783 100644 --- a/src/test/run-pass/issue-5321-immediates-with-bare-self.rs +++ b/src/test/run-pass/issue-5321-immediates-with-bare-self.rs @@ -16,7 +16,7 @@ trait Fooable { impl Fooable for uint { fn yes(self) { - for _ in range(0, self) { println!("yes"); } + for _ in 0..self { println!("yes"); } } } diff --git a/src/test/run-pass/issue-5550.rs b/src/test/run-pass/issue-5550.rs index 56404bfe38..f87f1d8af7 100644 --- a/src/test/run-pass/issue-5550.rs +++ b/src/test/run-pass/issue-5550.rs @@ -12,6 +12,6 @@ pub fn main() { let s: String = "foobar".to_string(); - let mut t: &str = s.as_slice(); - t = t.slice(0, 3); // for master: str::view(t, 0, 3) maybe + let mut t: &str = &s; + t = &t[0..3]; // for master: str::view(t, 0, 3) maybe } diff --git a/src/test/run-pass/issue-5666.rs b/src/test/run-pass/issue-5666.rs index e53f4c8692..4f304e3b43 100644 --- a/src/test/run-pass/issue-5666.rs +++ b/src/test/run-pass/issue-5666.rs @@ -31,7 +31,7 @@ pub fn main() { let bubbles = box Dog{name: "bubbles".to_string()}; let barker = [snoopy as Box, bubbles as Box]; - for pup in barker.iter() { + for pup in &barker { println!("{}", pup.bark()); } } diff --git a/src/test/run-pass/issue-5688.rs b/src/test/run-pass/issue-5688.rs index cfe9c8f994..9612c4bf18 100644 --- a/src/test/run-pass/issue-5688.rs +++ b/src/test/run-pass/issue-5688.rs @@ -17,14 +17,13 @@ with the representation of [int; n] and [int] somehow, or at least failed to typecheck correctly. */ +#[derive(Copy)] struct X { vec: &'static [int] } -impl Copy for X {} - static V: &'static [X] = &[X { vec: &[1, 2, 3] }]; pub fn main() { - for &v in V.iter() { + for &v in V { println!("{:?}", v.vec); } } diff --git a/src/test/run-pass/issue-5708.rs b/src/test/run-pass/issue-5708.rs index 61ae273aef..59bca87bed 100644 --- a/src/test/run-pass/issue-5708.rs +++ b/src/test/run-pass/issue-5708.rs @@ -41,14 +41,16 @@ impl<'a> Outer<'a> { } pub fn main() { - let inner = 5i; + let inner = 5; let outer = Outer::new(&inner as &Inner); outer.inner.print(); } // minimal -pub trait MyTrait { } +pub trait MyTrait { + fn dummy(&self, t: T) -> T { panic!() } +} pub struct MyContainer<'a, T> { foos: Vec<&'a (MyTrait+'a)> , diff --git a/src/test/run-pass/issue-5988.rs b/src/test/run-pass/issue-5988.rs index cc95b135b2..1ad48d326e 100644 --- a/src/test/run-pass/issue-5988.rs +++ b/src/test/run-pass/issue-5988.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::io; +use std::old_io; trait B { fn f(&self); } @@ -19,7 +19,7 @@ trait T : B { struct A; impl B for U { - fn f(&self) { io::println("Hey, I'm a T!"); } + fn f(&self) { old_io::println("Hey, I'm a T!"); } } impl T for A { diff --git a/src/test/run-pass/issue-6117.rs b/src/test/run-pass/issue-6117.rs index 85de03dfe3..93edffdcb4 100644 --- a/src/test/run-pass/issue-6117.rs +++ b/src/test/run-pass/issue-6117.rs @@ -14,7 +14,7 @@ enum Either { Left(T), Right(U) } pub fn main() { - match Either::Left(box 17i) { + match Either::Left(box 17) { Either::Right(()) => {} _ => {} } diff --git a/src/test/run-pass/issue-6128.rs b/src/test/run-pass/issue-6128.rs index d96862b588..1746a6281d 100644 --- a/src/test/run-pass/issue-6128.rs +++ b/src/test/run-pass/issue-6128.rs @@ -17,6 +17,7 @@ use std::collections::HashMap; trait Graph { fn f(&self, Edge); + fn g(&self, Node); } @@ -24,6 +25,9 @@ impl Graph for HashMap { fn f(&self, _e: E) { panic!(); } + fn g(&self, _e: int) { + panic!(); + } } pub fn main() { diff --git a/src/test/run-pass/issue-6130.rs b/src/test/run-pass/issue-6130.rs index f28a85eab3..93429ff10d 100644 --- a/src/test/run-pass/issue-6130.rs +++ b/src/test/run-pass/issue-6130.rs @@ -12,9 +12,9 @@ pub fn main() { let i: uint = 0; - assert!(i <= 0xFFFF_FFFF_u); + assert!(i <= 0xFFFF_FFFF_usize); let i: int = 0; - assert!(i >= -0x8000_0000_i); - assert!(i <= 0x7FFF_FFFF_i); + assert!(i >= -0x8000_0000__isize); + assert!(i <= 0x7FFF_FFFF__isize); } diff --git a/src/test/run-pass/issue-6157.rs b/src/test/run-pass/issue-6157.rs index 07c7c6888e..39f387afab 100644 --- a/src/test/run-pass/issue-6157.rs +++ b/src/test/run-pass/issue-6157.rs @@ -21,7 +21,7 @@ fn squarei<'a>(x: int, op: &'a mut OpInt) -> int { op.call(x, x) } fn muli(x:int, y:int) -> int { x * y } pub fn main() { - let mut f = |&mut: x, y| muli(x, y); + let mut f = |x, y| muli(x, y); { let g = &mut f; let h = g as &mut OpInt; diff --git a/src/test/run-pass/issue-6318.rs b/src/test/run-pass/issue-6318.rs index b9f1a8bda7..6e608d34bd 100644 --- a/src/test/run-pass/issue-6318.rs +++ b/src/test/run-pass/issue-6318.rs @@ -15,7 +15,9 @@ pub enum Thing { A(Box) } -pub trait Foo {} +pub trait Foo { + fn dummy(&self) { } +} pub struct Struct; @@ -23,7 +25,7 @@ impl Foo for Struct {} pub fn main() { match Thing::A(box Struct as Box) { - Thing::A(_a) => 0i, + Thing::A(_a) => 0, }; } diff --git a/src/test/run-pass/issue-6557.rs b/src/test/run-pass/issue-6557.rs index 3163f13932..b9f4f1cf3b 100644 --- a/src/test/run-pass/issue-6557.rs +++ b/src/test/run-pass/issue-6557.rs @@ -9,6 +9,7 @@ // except according to those terms. #![allow(unknown_features)] +#![feature(box_patterns)] #![feature(box_syntax)] fn foo(box (_x, _y): Box<(int, int)>) {} diff --git a/src/test/run-pass/issue-6892.rs b/src/test/run-pass/issue-6892.rs index c2e0f5206a..557ec82233 100644 --- a/src/test/run-pass/issue-6892.rs +++ b/src/test/run-pass/issue-6892.rs @@ -49,7 +49,7 @@ fn main() { assert_eq!(unsafe { NUM_DROPS }, 3); { let _x = FooBar::_Foo(Foo); } assert_eq!(unsafe { NUM_DROPS }, 5); - { let _x = FooBar::_Bar(42u); } + { let _x = FooBar::_Bar(42_usize); } assert_eq!(unsafe { NUM_DROPS }, 6); { let _ = Foo; } @@ -60,6 +60,6 @@ fn main() { assert_eq!(unsafe { NUM_DROPS }, 9); { let _ = FooBar::_Foo(Foo); } assert_eq!(unsafe { NUM_DROPS }, 11); - { let _ = FooBar::_Bar(42u); } + { let _ = FooBar::_Bar(42_usize); } assert_eq!(unsafe { NUM_DROPS }, 12); } diff --git a/src/test/run-pass/issue-7178.rs b/src/test/run-pass/issue-7178.rs index 4acb495972..6ef740b2a5 100644 --- a/src/test/run-pass/issue-7178.rs +++ b/src/test/run-pass/issue-7178.rs @@ -13,5 +13,5 @@ extern crate "issue-7178" as cross_crate_self; pub fn main() { - let _ = cross_crate_self::Foo::new(&1i); + let _ = cross_crate_self::Foo::new(&1); } diff --git a/src/test/run-pass/issue-7563.rs b/src/test/run-pass/issue-7563.rs index 734d131ffd..eda2057f6d 100644 --- a/src/test/run-pass/issue-7563.rs +++ b/src/test/run-pass/issue-7563.rs @@ -12,9 +12,9 @@ trait IDummy { fn do_nothing(&self); } -#[derive(Show)] +#[derive(Debug)] struct A { a: int } -#[derive(Show)] +#[derive(Debug)] struct B<'a> { b: int, pa: &'a A } impl IDummy for A { diff --git a/src/test/run-pass/issue-7575.rs b/src/test/run-pass/issue-7575.rs index d60e5caee6..77cfc7f0cf 100644 --- a/src/test/run-pass/issue-7575.rs +++ b/src/test/run-pass/issue-7575.rs @@ -10,6 +10,7 @@ trait Foo { fn new() -> bool { false } + fn dummy(&self) { } } trait Bar { @@ -20,5 +21,5 @@ impl Bar for int {} impl Foo for int {} fn main() { - assert!(1i.new()); + assert!(1.new()); } diff --git a/src/test/run-pass/issue-7660.rs b/src/test/run-pass/issue-7660.rs index 8a953cea90..9e36b1f508 100644 --- a/src/test/run-pass/issue-7660.rs +++ b/src/test/run-pass/issue-7660.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Regresion test for issue 7660 +// Regression test for issue 7660 // rvalue lifetime too short when equivalent `match` works extern crate collections; diff --git a/src/test/run-pass/issue-7673-cast-generically-implemented-trait.rs b/src/test/run-pass/issue-7673-cast-generically-implemented-trait.rs index b6dfbb1ca4..736860947f 100644 --- a/src/test/run-pass/issue-7673-cast-generically-implemented-trait.rs +++ b/src/test/run-pass/issue-7673-cast-generically-implemented-trait.rs @@ -19,7 +19,10 @@ pub fn main() {} -trait A {} +trait A { + fn dummy(&self) { } +} + impl A for T {} fn owned2(a: Box) { a as Box; } diff --git a/src/test/run-pass/issue-7784.rs b/src/test/run-pass/issue-7784.rs index 882ca00f1d..a61ee8c2a0 100644 --- a/src/test/run-pass/issue-7784.rs +++ b/src/test/run-pass/issue-7784.rs @@ -20,7 +20,7 @@ fn bar(a: &'static str, b: &'static str) -> [&'static str; 4] { } fn main() { - assert_eq!(foo([1i, 2i, 3i]), (1i, 3i, 6i)); + assert_eq!(foo([1, 2, 3]), (1, 3, 6)); let [a, b, c, d] = bar("foo", "bar"); assert_eq!(a, "foo"); diff --git a/src/test/run-pass/issue-7911.rs b/src/test/run-pass/issue-7911.rs index 86948ebcb9..3eb593708b 100644 --- a/src/test/run-pass/issue-7911.rs +++ b/src/test/run-pass/issue-7911.rs @@ -14,7 +14,9 @@ // with different mutability in macro in two methods #![allow(unused_variable)] // unused foobar_immut + foobar_mut -trait FooBar {} +trait FooBar { + fn dummy(&self) { } +} struct Bar(i32); struct Foo { bar: Bar } diff --git a/src/test/run-pass/issue-8044.rs b/src/test/run-pass/issue-8044.rs index c50cf845d0..504441e3ba 100644 --- a/src/test/run-pass/issue-8044.rs +++ b/src/test/run-pass/issue-8044.rs @@ -14,5 +14,5 @@ extern crate "issue-8044" as minimal; use minimal::{BTree, leaf}; pub fn main() { - BTree:: { node: leaf(1i) }; + BTree:: { node: leaf(1) }; } diff --git a/src/test/run-pass/issue-8248.rs b/src/test/run-pass/issue-8248.rs index 377b9ce262..7bc8dbe616 100644 --- a/src/test/run-pass/issue-8248.rs +++ b/src/test/run-pass/issue-8248.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait A {} +trait A { + fn dummy(&self) { } +} struct B; impl A for B {} diff --git a/src/test/run-pass/issue-8249.rs b/src/test/run-pass/issue-8249.rs index 44f07def53..83c9e9bf45 100644 --- a/src/test/run-pass/issue-8249.rs +++ b/src/test/run-pass/issue-8249.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait A {} +trait A { + fn dummy(&self) { } +} struct B; impl A for B {} diff --git a/src/test/run-pass/issue-8391.rs b/src/test/run-pass/issue-8391.rs index 468e656318..86c9b8c696 100644 --- a/src/test/run-pass/issue-8391.rs +++ b/src/test/run-pass/issue-8391.rs @@ -9,9 +9,9 @@ // except according to those terms. fn main() { - let x = match Some(1i) { - ref _y @ Some(_) => 1i, - None => 2i, + let x = match Some(1) { + ref _y @ Some(_) => 1, + None => 2, }; assert_eq!(x, 1); } diff --git a/src/test/run-pass/issue-8398.rs b/src/test/run-pass/issue-8398.rs index 185d75743a..e52e3295c6 100644 --- a/src/test/run-pass/issue-8398.rs +++ b/src/test/run-pass/issue-8398.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::io; +use std::old_io; -fn foo(a: &mut io::Writer) { +fn foo(a: &mut old_io::Writer) { a.write(&[]).unwrap(); } diff --git a/src/test/run-pass/issue-8460.rs b/src/test/run-pass/issue-8460.rs index 3ea6d5d4f2..00339a4e84 100644 --- a/src/test/run-pass/issue-8460.rs +++ b/src/test/run-pass/issue-8460.rs @@ -8,28 +8,32 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::{int, i8, i16, i32, i64}; -use std::thread::Thread; +use std::num::Int; +use std::thread; + +// Avoid using constants, which would trigger compile-time errors. +fn min_val() -> T { Int::min_value() } +fn zero() -> T { Int::zero() } fn main() { - assert!(Thread::scoped(move|| int::MIN / -1).join().is_err()); - assert!(Thread::scoped(move|| i8::MIN / -1).join().is_err()); - assert!(Thread::scoped(move|| i16::MIN / -1).join().is_err()); - assert!(Thread::scoped(move|| i32::MIN / -1).join().is_err()); - assert!(Thread::scoped(move|| i64::MIN / -1).join().is_err()); - assert!(Thread::scoped(move|| 1i / 0).join().is_err()); - assert!(Thread::scoped(move|| 1i8 / 0).join().is_err()); - assert!(Thread::scoped(move|| 1i16 / 0).join().is_err()); - assert!(Thread::scoped(move|| 1i32 / 0).join().is_err()); - assert!(Thread::scoped(move|| 1i64 / 0).join().is_err()); - assert!(Thread::scoped(move|| int::MIN % -1).join().is_err()); - assert!(Thread::scoped(move|| i8::MIN % -1).join().is_err()); - assert!(Thread::scoped(move|| i16::MIN % -1).join().is_err()); - assert!(Thread::scoped(move|| i32::MIN % -1).join().is_err()); - assert!(Thread::scoped(move|| i64::MIN % -1).join().is_err()); - assert!(Thread::scoped(move|| 1i % 0).join().is_err()); - assert!(Thread::scoped(move|| 1i8 % 0).join().is_err()); - assert!(Thread::scoped(move|| 1i16 % 0).join().is_err()); - assert!(Thread::scoped(move|| 1i32 % 0).join().is_err()); - assert!(Thread::scoped(move|| 1i64 % 0).join().is_err()); + assert!(thread::spawn(move|| { min_val::() / -1; }).join().is_err()); + assert!(thread::spawn(move|| { min_val::() / -1; }).join().is_err()); + assert!(thread::spawn(move|| { min_val::() / -1; }).join().is_err()); + assert!(thread::spawn(move|| { min_val::() / -1; }).join().is_err()); + assert!(thread::spawn(move|| { min_val::() / -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|| { min_val::() % -1; }).join().is_err()); + assert!(thread::spawn(move|| { min_val::() % -1; }).join().is_err()); + assert!(thread::spawn(move|| { min_val::() % -1; }).join().is_err()); + assert!(thread::spawn(move|| { min_val::() % -1; }).join().is_err()); + assert!(thread::spawn(move|| { min_val::() % -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()); } diff --git a/src/test/run-pass/issue-8498.rs b/src/test/run-pass/issue-8498.rs index 2a2ca4f071..494b621785 100644 --- a/src/test/run-pass/issue-8498.rs +++ b/src/test/run-pass/issue-8498.rs @@ -12,14 +12,14 @@ #![feature(box_syntax)] pub fn main() { - match &[(box 5i,box 7i)] { + match &[(box 5,box 7)] { ps => { let (ref y, _) = ps[0]; assert!(**y == 5); } } - match Some(&[(box 5i,)]) { + match Some(&[(box 5,)]) { Some(ps) => { let (ref y,) = ps[0]; assert!(**y == 5); @@ -27,7 +27,7 @@ pub fn main() { None => () } - match Some(&[(box 5i,box 7i)]) { + match Some(&[(box 5,box 7)]) { Some(ps) => { let (ref y, ref z) = ps[0]; assert!(**y == 5); diff --git a/src/test/run-pass/issue-868.rs b/src/test/run-pass/issue-868.rs index 72bdd1af74..e47999fc46 100644 --- a/src/test/run-pass/issue-868.rs +++ b/src/test/run-pass/issue-868.rs @@ -11,7 +11,7 @@ fn f(g: F) -> T where F: FnOnce() -> T { g() } pub fn main() { - let _x = f( | | { 10i }); + let _x = f( | | { 10 }); // used to be: cannot determine a type for this expression f(| | { }); // ditto @@ -20,5 +20,5 @@ pub fn main() { let _: () = f(| | { }); // empty block with no type info should compile too let _ = f(||{}); - let _ = (|&:|{}); + let _ = (||{}); } diff --git a/src/test/run-pass/issue-8783.rs b/src/test/run-pass/issue-8783.rs index d59c0ad52e..815e00e129 100644 --- a/src/test/run-pass/issue-8783.rs +++ b/src/test/run-pass/issue-8783.rs @@ -13,7 +13,7 @@ use std::default::Default; struct X { pub x: uint } impl Default for X { fn default() -> X { - X { x: 42u } + X { x: 42_usize } } } diff --git a/src/test/run-pass/issue-8827.rs b/src/test/run-pass/issue-8827.rs index d8b7490124..d7a8674954 100644 --- a/src/test/run-pass/issue-8827.rs +++ b/src/test/run-pass/issue-8827.rs @@ -15,7 +15,7 @@ fn periodical(n: int) -> Receiver { let (chan, port) = channel(); Thread::spawn(move|| { loop { - for _ in range(1, n) { + for _ in 1..n { match chan.send(false) { Ok(()) => {} Err(..) => break, @@ -49,7 +49,7 @@ fn main() { let ints = integers(); let threes = periodical(3); let fives = periodical(5); - for _ in range(1i, 100i) { + for _ in 1..100 { match (ints.recv().unwrap(), threes.recv().unwrap(), fives.recv().unwrap()) { (_, true, true) => println!("FizzBuzz"), (_, true, false) => println!("Fizz"), diff --git a/src/test/run-pass/issue-8860.rs b/src/test/run-pass/issue-8860.rs index 35f713c4c2..72e2a33b43 100644 --- a/src/test/run-pass/issue-8860.rs +++ b/src/test/run-pass/issue-8860.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -static mut DROP: int = 0i; -static mut DROP_S: int = 0i; -static mut DROP_T: int = 0i; +static mut DROP: int = 0; +static mut DROP_S: int = 0; +static mut DROP_T: int = 0; struct S; impl Drop for S { diff --git a/src/test/run-pass/issue-8898.rs b/src/test/run-pass/issue-8898.rs index 42739628ee..b1c443dd0c 100644 --- a/src/test/run-pass/issue-8898.rs +++ b/src/test/run-pass/issue-8898.rs @@ -8,19 +8,19 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn assert_repr_eq(obj : T, expected : String) { +fn assert_repr_eq(obj : T, expected : String) { assert_eq!(expected, format!("{:?}", obj)); } pub fn main() { - let abc = [1i, 2, 3]; + let abc = [1, 2, 3]; let tf = [true, false]; let x = [(), ()]; - let slice = &x[0..1]; + let slice = &x[..1]; - assert_repr_eq(&abc[], "[1i, 2i, 3i]".to_string()); - assert_repr_eq(&tf[], "[true, false]".to_string()); - assert_repr_eq(&x[], "[(), ()]".to_string()); + assert_repr_eq(&abc[..], "[1, 2, 3]".to_string()); + assert_repr_eq(&tf[..], "[true, false]".to_string()); + assert_repr_eq(&x[..], "[(), ()]".to_string()); assert_repr_eq(slice, "[()]".to_string()); - assert_repr_eq(&x[], "[(), ()]".to_string()); + assert_repr_eq(&x[..], "[(), ()]".to_string()); } diff --git a/src/test/run-pass/issue-9129.rs b/src/test/run-pass/issue-9129.rs index 2ef1c1d264..6c84399304 100644 --- a/src/test/run-pass/issue-9129.rs +++ b/src/test/run-pass/issue-9129.rs @@ -29,7 +29,7 @@ fn Ident_new() -> Ident { pub fn light_fuse(fld: Box) { int3!(); - let f = |&:| { + let f = || { int3!(); fld.boom(Ident_new()); // *** 1 }; diff --git a/src/test/run-pass/issue-9259.rs b/src/test/run-pass/issue-9259.rs index 0fe520e59d..da5338b8c3 100644 --- a/src/test/run-pass/issue-9259.rs +++ b/src/test/run-pass/issue-9259.rs @@ -19,5 +19,5 @@ pub fn main() { a: &["test".to_string()], b: Some(b), }; - assert_eq!(a.b.as_ref().unwrap()[0].as_slice(), "foo"); + assert_eq!(a.b.as_ref().unwrap()[0], "foo"); } diff --git a/src/test/run-pass/issue-9382.rs b/src/test/run-pass/issue-9382.rs index 0721223730..c501420fa6 100644 --- a/src/test/run-pass/issue-9382.rs +++ b/src/test/run-pass/issue-9382.rs @@ -34,7 +34,7 @@ pub fn main() { bar: box 32, }; Thing1 { - baz: Vec::new().as_slice(), + baz: &Vec::new(), bar: box 32, }; let _t2_fixed = Thing2 { @@ -42,7 +42,7 @@ pub fn main() { bar: 32, }; Thing2 { - baz: Vec::new().as_slice(), + baz: &Vec::new(), bar: 32, }; } diff --git a/src/test/run-pass/issue-9396.rs b/src/test/run-pass/issue-9396.rs index 73355d15a2..a98d1aba04 100644 --- a/src/test/run-pass/issue-9396.rs +++ b/src/test/run-pass/issue-9396.rs @@ -9,7 +9,7 @@ // except according to those terms. use std::sync::mpsc::{TryRecvError, channel}; -use std::io::timer::Timer; +use std::old_io::timer::Timer; use std::thread::Thread; use std::time::Duration; diff --git a/src/test/run-pass/issue-9719.rs b/src/test/run-pass/issue-9719.rs index 4c6b9a3aaa..aa1e65efaa 100644 --- a/src/test/run-pass/issue-9719.rs +++ b/src/test/run-pass/issue-9719.rs @@ -13,22 +13,26 @@ mod a { A(T), } - pub trait X {} + pub trait X { + fn dummy(&self) { } + } impl X for int {} pub struct Z<'a>(Enum<&'a (X+'a)>); - fn foo() { let x = 42i; let z = Z(Enum::A(&x as &X)); let _ = z; } + fn foo() { let x = 42; let z = Z(Enum::A(&x as &X)); let _ = z; } } mod b { - trait X {} + trait X { + fn dummy(&self) { } + } impl X for int {} struct Y<'a>{ x:Option<&'a (X+'a)>, } fn bar() { - let x = 42i; + let x = 42; let _y = Y { x: Some(&x as &X) }; } } @@ -37,7 +41,7 @@ mod c { pub trait X { fn f(&self); } impl X for int { fn f(&self) {} } pub struct Z<'a>(Option<&'a (X+'a)>); - fn main() { let x = 42i; let z = Z(Some(&x as &X)); let _ = z; } + fn main() { let x = 42; let z = Z(Some(&x as &X)); let _ = z; } } pub fn main() {} diff --git a/src/test/run-pass/issue-9906.rs b/src/test/run-pass/issue-9906.rs index d8e28e449e..921965b280 100644 --- a/src/test/run-pass/issue-9906.rs +++ b/src/test/run-pass/issue-9906.rs @@ -14,5 +14,5 @@ extern crate "issue-9906" as testmod; pub fn main() { testmod::foo(); - testmod::FooBar::new(1i); + testmod::FooBar::new(1); } diff --git a/src/test/run-pass/issue-9942.rs b/src/test/run-pass/issue-9942.rs index 321e22cd19..c7dea71998 100644 --- a/src/test/run-pass/issue-9942.rs +++ b/src/test/run-pass/issue-9942.rs @@ -9,5 +9,5 @@ // except according to those terms. pub fn main() { - const S: uint = 23 as uint; [0i; S]; () + const S: uint = 23 as uint; [0; S]; () } diff --git a/src/test/compile-fail/marker-no-share.rs b/src/test/run-pass/issue22008.rs similarity index 66% rename from src/test/compile-fail/marker-no-share.rs rename to src/test/run-pass/issue22008.rs index b29f7fab2c..3e145122e5 100644 --- a/src/test/compile-fail/marker-no-share.rs +++ b/src/test/run-pass/issue22008.rs @@ -1,4 +1,4 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// 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. // @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::marker; +pub fn main() { + let command = "a"; -fn foo(p: P) { } - -fn main() -{ - foo(marker::NoSync); //~ ERROR the trait `core::marker::Sync` is not implemented + match command { + "foo" => println!("foo"), + _ => println!("{}", command), + } } diff --git a/src/test/run-pass/issue22346.rs b/src/test/run-pass/issue22346.rs new file mode 100644 index 0000000000..3193e5c5fc --- /dev/null +++ b/src/test/run-pass/issue22346.rs @@ -0,0 +1,17 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// This used to cause an ICE because the retslot for the "return" had the wrong type +fn testcase<'a>() -> Box + 'a> { + return Box::new(range(0, 3).map(|i| { return i; })); +} + +fn main() { +} diff --git a/src/test/run-pass/istr.rs b/src/test/run-pass/istr.rs index af60f18e54..15195482ed 100644 --- a/src/test/run-pass/istr.rs +++ b/src/test/run-pass/istr.rs @@ -37,19 +37,19 @@ fn test_heap_log() { fn test_append() { let mut s = String::new(); s.push_str("a"); - assert_eq!(s.as_slice(), "a"); + assert_eq!(s, "a"); let mut s = String::from_str("a"); s.push_str("b"); println!("{}", s.clone()); - assert_eq!(s.as_slice(), "ab"); + assert_eq!(s, "ab"); let mut s = String::from_str("c"); s.push_str("offee"); - assert!(s.as_slice() == "coffee"); + assert!(s == "coffee"); s.push_str("&tea"); - assert!(s.as_slice() == "coffee&tea"); + assert!(s == "coffee&tea"); } pub fn main() { diff --git a/src/test/run-pass/item-attributes.rs b/src/test/run-pass/item-attributes.rs index 6c2de471f0..6036af5c62 100644 --- a/src/test/run-pass/item-attributes.rs +++ b/src/test/run-pass/item-attributes.rs @@ -11,6 +11,8 @@ // These are attributes of the implicit crate. Really this just needs to parse // for completeness since .rs files linked from .rc files support this // notation to specify their module's attributes + +#![feature(custom_attribute)] #![allow(unused_attribute)] #![attr1 = "val"] #![attr2 = "val"] @@ -173,7 +175,7 @@ mod test_foreign_items { #![str = "s"] #![char = 'c'] #![int = 100] - #![uint = 100u] + #![uint = 100_usize] #![mach_int = 100u32] #![float = 1.0] #![mach_float = 1.0f32] diff --git a/src/test/run-pass/keyword-changes-2012-07-31.rs b/src/test/run-pass/keyword-changes-2012-07-31.rs index 885f266ca3..ff568b77f0 100644 --- a/src/test/run-pass/keyword-changes-2012-07-31.rs +++ b/src/test/run-pass/keyword-changes-2012-07-31.rs @@ -19,7 +19,7 @@ mod foo { } fn bar() -> int { - match 0i { - _ => { 0i } + match 0 { + _ => { 0 } } } diff --git a/src/test/run-pass/kindck-owned-trait-contains-1.rs b/src/test/run-pass/kindck-owned-trait-contains-1.rs index 999fb2c4b6..f05ac11d41 100644 --- a/src/test/run-pass/kindck-owned-trait-contains-1.rs +++ b/src/test/run-pass/kindck-owned-trait-contains-1.rs @@ -24,7 +24,7 @@ fn repeater(v: Box) -> Box+'static> { } pub fn main() { - let x = 3i; + let x = 3; let y = repeater(box x); assert_eq!(x, y.get()); } diff --git a/src/test/run-pass/labeled-break.rs b/src/test/run-pass/labeled-break.rs index 9f12cd7987..30c2495d59 100644 --- a/src/test/run-pass/labeled-break.rs +++ b/src/test/run-pass/labeled-break.rs @@ -15,13 +15,13 @@ pub fn main() { } } - 'bar: for _ in range(0i, 100i) { + 'bar: for _ in 0..100 { loop { break 'bar; } } - 'foobar: while 1i + 1 == 2 { + 'foobar: while 1 + 1 == 2 { loop { break 'foobar; } diff --git a/src/test/run-pass/lambda-infer-unresolved.rs b/src/test/run-pass/lambda-infer-unresolved.rs index b33e6512b1..3c2a3f355b 100644 --- a/src/test/run-pass/lambda-infer-unresolved.rs +++ b/src/test/run-pass/lambda-infer-unresolved.rs @@ -16,7 +16,7 @@ struct Refs { refs: Vec , n: int } pub fn main() { let mut e = Refs{refs: vec!(), n: 0}; - let _f = |&:| println!("{}", e.n); - let x: &[int] = e.refs.as_slice(); + let _f = || println!("{}", e.n); + let x: &[int] = &e.refs; assert_eq!(x.len(), 0); } diff --git a/src/test/run-pass/lang-item-public.rs b/src/test/run-pass/lang-item-public.rs index 81774c73c3..350ec68a7d 100644 --- a/src/test/run-pass/lang-item-public.rs +++ b/src/test/run-pass/lang-item-public.rs @@ -1,4 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -12,8 +12,8 @@ // ignore-android // ignore-windows #13361 +#![feature(lang_items, start, no_std)] #![no_std] -#![feature(lang_items)] extern crate "lang-item-public" as lang_lib; @@ -37,6 +37,10 @@ extern {} #[link(name = "c")] extern {} +#[cfg(target_os = "openbsd")] +#[link(name = "c")] +extern {} + #[cfg(target_os = "macos")] #[link(name = "System")] extern {} diff --git a/src/test/run-pass/last-use-in-cap-clause.rs b/src/test/run-pass/last-use-in-cap-clause.rs index 9be9f09826..566d34e6d8 100644 --- a/src/test/run-pass/last-use-in-cap-clause.rs +++ b/src/test/run-pass/last-use-in-cap-clause.rs @@ -14,12 +14,13 @@ #![feature(box_syntax)] #![feature(unboxed_closures)] -struct A { a: Box } +struct A { a: Box } -fn foo() -> Box int + 'static> { - let k = box 22i; +fn foo() -> Box isize + 'static> { + let k = box 22; let _u = A {a: k.clone()}; - let result = |&mut:| 22; + // FIXME(#16640) suffix in `22_isize` suffix shouldn't be necessary + let result = || 22_isize; box result } diff --git a/src/test/run-pass/last-use-is-capture.rs b/src/test/run-pass/last-use-is-capture.rs index 4a7e844268..19a780d180 100644 --- a/src/test/run-pass/last-use-is-capture.rs +++ b/src/test/run-pass/last-use-is-capture.rs @@ -17,7 +17,7 @@ struct A { a: Box } pub fn main() { fn invoke(f: F) where F: FnOnce() { f(); } - let k = box 22i; + let k = box 22; let _u = A {a: k.clone()}; invoke(|| println!("{}", k.clone()) ) } diff --git a/src/test/run-pass/lazy-and-or.rs b/src/test/run-pass/lazy-and-or.rs index 043961ce59..559c9e7894 100644 --- a/src/test/run-pass/lazy-and-or.rs +++ b/src/test/run-pass/lazy-and-or.rs @@ -11,7 +11,7 @@ fn incr(x: &mut int) -> bool { *x += 1; assert!((false)); return false; } pub fn main() { - let x = 1i == 2 || 3i == 3; + let x = 1 == 2 || 3 == 3; assert!((x)); let mut y: int = 10; println!("{}", x || incr(&mut y)); diff --git a/src/test/run-pass/lazy-init.rs b/src/test/run-pass/lazy-init.rs index cd8be550d5..60f7689ecf 100644 --- a/src/test/run-pass/lazy-init.rs +++ b/src/test/run-pass/lazy-init.rs @@ -12,4 +12,4 @@ fn foo(x: int) { println!("{}", x); } -pub fn main() { let mut x: int; if 1i > 2 { x = 12; } else { x = 10; } foo(x); } +pub fn main() { let mut x: int; if 1 > 2 { x = 12; } else { x = 10; } foo(x); } diff --git a/src/test/run-pass/let-destruct-ref.rs b/src/test/run-pass/let-destruct-ref.rs index 343780b246..c0f674d037 100644 --- a/src/test/run-pass/let-destruct-ref.rs +++ b/src/test/run-pass/let-destruct-ref.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let x = 3u; + let x = 3_usize; let ref y = x; assert_eq!(x, *y); } diff --git a/src/test/run-pass/let-var-hygiene.rs b/src/test/run-pass/let-var-hygiene.rs index 2287cc48b6..d6409267eb 100644 --- a/src/test/run-pass/let-var-hygiene.rs +++ b/src/test/run-pass/let-var-hygiene.rs @@ -10,10 +10,10 @@ // shouldn't affect evaluation of $ex: macro_rules! bad_macro { - ($ex:expr) => ({let _x = 9i; $ex}) + ($ex:expr) => ({let _x = 9; $ex}) } pub fn main() { - let _x = 8i; - assert_eq!(bad_macro!(_x),8i) + let _x = 8; + assert_eq!(bad_macro!(_x),8) } diff --git a/src/test/run-pass/linear-for-loop.rs b/src/test/run-pass/linear-for-loop.rs index f527ad77a9..22a29279a6 100644 --- a/src/test/run-pass/linear-for-loop.rs +++ b/src/test/run-pass/linear-for-loop.rs @@ -11,14 +11,14 @@ // no-pretty-expanded FIXME #15189 pub fn main() { - let x = vec!(1i, 2i, 3i); - let mut y = 0i; - for i in x.iter() { println!("{}", *i); y += *i; } + let x = vec!(1, 2, 3); + let mut y = 0; + for i in &x { println!("{}", *i); y += *i; } println!("{}", y); assert_eq!(y, 6); let s = "hello there".to_string(); let mut i: int = 0; - for c in s.as_slice().bytes() { + for c in s.bytes() { if i == 0 { assert!((c == 'h' as u8)); } if i == 1 { assert!((c == 'e' as u8)); } if i == 2 { assert!((c == 'l' as u8)); } diff --git a/src/test/run-pass/linkage1.rs b/src/test/run-pass/linkage1.rs index 0ba7dcb013..5cd741350d 100644 --- a/src/test/run-pass/linkage1.rs +++ b/src/test/run-pass/linkage1.rs @@ -9,7 +9,6 @@ // except according to those terms. // ignore-windows -// ignore-android // ignore-macos // aux-build:linkage1.rs diff --git a/src/test/run-pass/lint-cstack.rs b/src/test/run-pass/lint-cstack.rs index 2194453aac..f180ffcd4e 100644 --- a/src/test/run-pass/lint-cstack.rs +++ b/src/test/run-pass/lint-cstack.rs @@ -15,7 +15,7 @@ extern { } trait A { - fn foo() { + fn foo(&self) { unsafe { rust_get_test_int(); } diff --git a/src/test/run-pass/liveness-loop-break.rs b/src/test/run-pass/liveness-loop-break.rs index 6ad2be68e8..0dba1830cb 100644 --- a/src/test/run-pass/liveness-loop-break.rs +++ b/src/test/run-pass/liveness-loop-break.rs @@ -11,7 +11,7 @@ fn test() { let v; loop { - v = 3i; + v = 3; break; } println!("{}", v); diff --git a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs index 7fb2390b84..c4b45ae0f0 100644 --- a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs +++ b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs @@ -8,19 +8,19 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(Clone, Show)] +#[derive(Clone, Debug)] enum foo { a(uint), b(String), } -fn check_log(exp: String, v: T) { +fn check_log(exp: String, v: T) { assert_eq!(exp, format!("{:?}", v)); } pub fn main() { - let mut x = Some(foo::a(22u)); - let exp = "Some(a(22u))".to_string(); + let mut x = Some(foo::a(22)); + let exp = "Some(a(22))".to_string(); let act = format!("{:?}", x); assert_eq!(act, exp); check_log(exp, x); diff --git a/src/test/run-pass/log-knows-the-names-of-variants.rs b/src/test/run-pass/log-knows-the-names-of-variants.rs index 45fd2098dc..e885237795 100644 --- a/src/test/run-pass/log-knows-the-names-of-variants.rs +++ b/src/test/run-pass/log-knows-the-names-of-variants.rs @@ -8,20 +8,20 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(Show)] +#[derive(Debug)] enum foo { - a(uint), + a(usize), b(String), c, } -#[derive(Show)] +#[derive(Debug)] enum bar { d, e, f } pub fn main() { - assert_eq!("a(22u)".to_string(), format!("{:?}", foo::a(22u))); + assert_eq!("a(22)".to_string(), format!("{:?}", foo::a(22))); assert_eq!("c".to_string(), format!("{:?}", foo::c)); assert_eq!("d".to_string(), format!("{:?}", bar::d)); } diff --git a/src/test/run-pass/log-poly.rs b/src/test/run-pass/log-poly.rs index a6a99d6fc9..d8a69177ca 100644 --- a/src/test/run-pass/log-poly.rs +++ b/src/test/run-pass/log-poly.rs @@ -8,14 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(Show)] +#[derive(Debug)] enum Numbers { Three } pub fn main() { - println!("{:?}", 1i); + println!("{:?}", 1); println!("{:?}", 2.0f64); println!("{:?}", Numbers::Three); - println!("{:?}", vec!(4i)); + println!("{:?}", vec!(4)); } diff --git a/src/test/run-pass/logging-only-prints-once.rs b/src/test/run-pass/logging-only-prints-once.rs index a72cfad2cb..b03c4b5ff4 100644 --- a/src/test/run-pass/logging-only-prints-once.rs +++ b/src/test/run-pass/logging-only-prints-once.rs @@ -13,11 +13,11 @@ use std::cell::Cell; use std::fmt; -use std::thread::Thread; +use std::thread; struct Foo(Cell); -impl fmt::Show for Foo { +impl fmt::Debug for Foo { fn fmt(&self, _fmt: &mut fmt::Formatter) -> fmt::Result { let Foo(ref f) = *self; assert!(f.get() == 0); @@ -27,7 +27,7 @@ impl fmt::Show for Foo { } pub fn main() { - Thread::scoped(move|| { + thread::spawn(move|| { let mut f = Foo(Cell::new(0)); println!("{:?}", f); let Foo(ref mut f) = f; diff --git a/src/test/run-pass/logging-separate-lines.rs b/src/test/run-pass/logging-separate-lines.rs index 0f13df644a..8526dfe72d 100644 --- a/src/test/run-pass/logging-separate-lines.rs +++ b/src/test/run-pass/logging-separate-lines.rs @@ -8,31 +8,29 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android // ignore-windows // exec-env:RUST_LOG=debug #[macro_use] extern crate log; -use std::io::Command; -use std::os; +use std::old_io::Command; +use std::env; use std::str; fn main() { - let args = os::args(); - let args = args.as_slice(); - if args.len() > 1 && args[1].as_slice() == "child" { + let args: Vec = env::args().collect(); + if args.len() > 1 && args[1] == "child" { debug!("foo"); debug!("bar"); return } - let p = Command::new(args[0].as_slice()) + let p = Command::new(&args[0]) .arg("child") .spawn().unwrap().wait_with_output().unwrap(); assert!(p.status.success()); - let mut lines = str::from_utf8(p.error.as_slice()).unwrap().lines(); + let mut lines = str::from_utf8(&p.error).unwrap().lines(); assert!(lines.next().unwrap().contains("foo")); assert!(lines.next().unwrap().contains("bar")); } diff --git a/src/test/run-pass/long-while.rs b/src/test/run-pass/long-while.rs index 7d30b22867..cbe2684470 100644 --- a/src/test/run-pass/long-while.rs +++ b/src/test/run-pass/long-while.rs @@ -14,6 +14,6 @@ pub fn main() { let mut i: int = 0; while i < 1000000 { i += 1; - let x = 3i; + let x = 3; } } diff --git a/src/test/run-pass/loop-break-cont-1.rs b/src/test/run-pass/loop-break-cont-1.rs index 3b7e03ae58..d58d2a7139 100644 --- a/src/test/run-pass/loop-break-cont-1.rs +++ b/src/test/run-pass/loop-break-cont-1.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let _i = 0u; + let _i = 0_usize; loop { break; } diff --git a/src/test/run-pass/loop-break-cont.rs b/src/test/run-pass/loop-break-cont.rs index b9b16d10b8..a15efa2d8e 100644 --- a/src/test/run-pass/loop-break-cont.rs +++ b/src/test/run-pass/loop-break-cont.rs @@ -9,24 +9,24 @@ // except according to those terms. pub fn main() { - let mut i = 0u; + let mut i = 0_usize; loop { println!("a"); - i += 1u; - if i == 10u { + i += 1_usize; + if i == 10_usize { break; } } - assert_eq!(i, 10u); + assert_eq!(i, 10_usize); let mut is_even = false; loop { - if i == 21u { + if i == 21_usize { break; } println!("b"); is_even = false; - i += 1u; - if i % 2u != 0u { + i += 1_usize; + if i % 2_usize != 0_usize { continue; } is_even = true; @@ -34,12 +34,12 @@ pub fn main() { assert!(!is_even); loop { println!("c"); - if i == 22u { + if i == 22_usize { break; } is_even = false; - i += 1u; - if i % 2u != 0u { + i += 1_usize; + if i % 2_usize != 0_usize { continue; } is_even = true; diff --git a/src/test/run-pass/loop-diverges.rs b/src/test/run-pass/loop-diverges.rs index 4fe73188b4..9c46ba2cb9 100644 --- a/src/test/run-pass/loop-diverges.rs +++ b/src/test/run-pass/loop-diverges.rs @@ -16,5 +16,5 @@ fn forever() -> ! { } pub fn main() { - if (1i == 2) { forever(); } + if (1 == 2) { forever(); } } diff --git a/src/test/run-pass/loop-label-shadowing.rs b/src/test/run-pass/loop-label-shadowing.rs index 46d4fa460f..d96ff869fa 100644 --- a/src/test/run-pass/loop-label-shadowing.rs +++ b/src/test/run-pass/loop-label-shadowing.rs @@ -12,8 +12,8 @@ fn main() { let mut foo = Vec::new(); - 'foo: for i in [1i, 2, 3].iter() { - foo.push(i); + 'foo: for i in &[1, 2, 3] { + foo.push(*i); } } diff --git a/src/test/run-pass/loop-no-reinit-needed-post-bot.rs b/src/test/run-pass/loop-no-reinit-needed-post-bot.rs index 0f4dd88169..2582c2e614 100644 --- a/src/test/run-pass/loop-no-reinit-needed-post-bot.rs +++ b/src/test/run-pass/loop-no-reinit-needed-post-bot.rs @@ -17,7 +17,7 @@ fn my_panic() -> ! { loop {} } pub fn step(f: bool) { let mut g = S; - let mut i = 0i; + let mut i = 0; loop { if i > 10 { break; } else { i += 1; } diff --git a/src/test/run-pass/loop-scope.rs b/src/test/run-pass/loop-scope.rs index 4b8ccad068..88711a4605 100644 --- a/src/test/run-pass/loop-scope.rs +++ b/src/test/run-pass/loop-scope.rs @@ -9,8 +9,8 @@ // except according to those terms. pub fn main() { - let x = vec!(10i, 20i, 30i); - let mut sum = 0i; - for x in x.iter() { sum += *x; } + let x = vec!(10, 20, 30); + let mut sum = 0; + for x in &x { sum += *x; } assert_eq!(sum, 60); } diff --git a/src/test/run-pass/macro-crate-def-only.rs b/src/test/run-pass/macro-crate-def-only.rs index 7505fa6e68..efee9ba963 100644 --- a/src/test/run-pass/macro-crate-def-only.rs +++ b/src/test/run-pass/macro-crate-def-only.rs @@ -14,5 +14,5 @@ extern crate macro_crate_def_only; pub fn main() { - assert_eq!(5i, make_a_5!()); + assert_eq!(5, make_a_5!()); } diff --git a/src/test/run-pass/macro-delimiter-significance.rs b/src/test/run-pass/macro-delimiter-significance.rs index fcf2dff66a..01362f0f83 100644 --- a/src/test/run-pass/macro-delimiter-significance.rs +++ b/src/test/run-pass/macro-delimiter-significance.rs @@ -9,6 +9,6 @@ // except according to those terms. fn main() { - vec![1u, 2, 3].len(); + vec![1_usize, 2, 3].len(); } diff --git a/src/test/run-pass/macro-export-inner-module.rs b/src/test/run-pass/macro-export-inner-module.rs index ef22410751..1c7b2530b9 100644 --- a/src/test/run-pass/macro-export-inner-module.rs +++ b/src/test/run-pass/macro-export-inner-module.rs @@ -15,5 +15,5 @@ extern crate macro_export_inner_module; pub fn main() { - assert_eq!(1i, foo!()); + assert_eq!(1, foo!()); } diff --git a/src/test/run-pass/macro-include-items.rs b/src/test/run-pass/macro-include-items.rs index 5c95f67257..9e2f431c3e 100644 --- a/src/test/run-pass/macro-include-items.rs +++ b/src/test/run-pass/macro-include-items.rs @@ -16,5 +16,5 @@ include!(concat!("", "", "../auxiliary/", "macro-include-items-item.rs")); fn main() { foo(); - assert_eq!(include!(concat!("", "../auxiliary/", "macro-include-items-expr.rs")), 1u); + assert_eq!(include!(concat!("", "../auxiliary/", "macro-include-items-expr.rs")), 1_usize); } diff --git a/src/test/run-pass/macro-interpolation.rs b/src/test/run-pass/macro-interpolation.rs index ff5b29d6ac..069aeb9220 100644 --- a/src/test/run-pass/macro-interpolation.rs +++ b/src/test/run-pass/macro-interpolation.rs @@ -24,6 +24,6 @@ macro_rules! overly_complicated { pub fn main() { assert!(overly_complicated!(f, x, Option, { return Some(x); }, - Some(8u), Some(y), y) == 8u) + Some(8_usize), Some(y), y) == 8_usize) } diff --git a/src/test/run-pass/macro-of-higher-order.rs b/src/test/run-pass/macro-of-higher-order.rs index 3276aa0265..1a77eee824 100644 --- a/src/test/run-pass/macro-of-higher-order.rs +++ b/src/test/run-pass/macro-of-higher-order.rs @@ -11,7 +11,7 @@ macro_rules! higher_order { (subst $lhs:tt => $rhs:tt) => ({ macro_rules! anon { $lhs => $rhs } - anon!(1u, 2u, "foo") + anon!(1_usize, 2_usize, "foo") }); } diff --git a/src/test/run-pass/macro-pat.rs b/src/test/run-pass/macro-pat.rs index 07b75389cf..6f2626a5af 100644 --- a/src/test/run-pass/macro-pat.rs +++ b/src/test/run-pass/macro-pat.rs @@ -47,27 +47,27 @@ fn f(c: Option) -> uint { } pub fn main() { - assert_eq!(1u, f(Some('x'))); - assert_eq!(2u, f(Some('y'))); - assert_eq!(3u, f(None)); + assert_eq!(1_usize, f(Some('x'))); + assert_eq!(2_usize, f(Some('y'))); + assert_eq!(3_usize, f(None)); - assert_eq!(1i, match Some('x') { - Some(char_x!()) => 1i, - _ => 2i, + assert_eq!(1, match Some('x') { + Some(char_x!()) => 1, + _ => 2, }); - assert_eq!(1i, match Some('x') { - some!(char_x!()) => 1i, - _ => 2i, + assert_eq!(1, match Some('x') { + some!(char_x!()) => 1, + _ => 2, }); - assert_eq!(1i, match Some('x') { - indirect!() => 1i, - _ => 2i, + assert_eq!(1, match Some('x') { + indirect!() => 1, + _ => 2, }); - assert_eq!(3i, { - let ident_pat!(x) = 2i; - x+1i + assert_eq!(3, { + let ident_pat!(x) = 2; + x+1 }); } diff --git a/src/test/run-pass/macro-reexport-no-intermediate-use.rs b/src/test/run-pass/macro-reexport-no-intermediate-use.rs index 77ef942127..dba623876b 100644 --- a/src/test/run-pass/macro-reexport-no-intermediate-use.rs +++ b/src/test/run-pass/macro-reexport-no-intermediate-use.rs @@ -16,5 +16,5 @@ extern crate macro_reexport_2_no_use; fn main() { - assert_eq!(reexported!(), 3u); + assert_eq!(reexported!(), 3_usize); } diff --git a/src/test/run-pass/macro-reexport.rs b/src/test/run-pass/macro-reexport.rs index 9701610cbd..a6af8c45c2 100644 --- a/src/test/run-pass/macro-reexport.rs +++ b/src/test/run-pass/macro-reexport.rs @@ -16,5 +16,5 @@ extern crate macro_reexport_2; fn main() { - assert_eq!(reexported!(), 3u); + assert_eq!(reexported!(), 3_usize); } diff --git a/src/test/run-pass/macro-stmt.rs b/src/test/run-pass/macro-stmt.rs index cb5370c8bc..3aa0298709 100644 --- a/src/test/run-pass/macro-stmt.rs +++ b/src/test/run-pass/macro-stmt.rs @@ -26,17 +26,17 @@ pub fn main() { ) } - mylet!(y, 8i*2); - assert_eq!(y, 16i); + mylet!(y, 8*2); + assert_eq!(y, 16); myfn!(mult, (a,b), { a*b } ); assert_eq!(mult(2, add(4,4)), 16); macro_rules! actually_an_expr_macro { - () => ( 16i ) + () => ( 16 ) } - assert_eq!({ actually_an_expr_macro!() }, 16i); + assert_eq!({ actually_an_expr_macro!() }, 16); } diff --git a/src/test/run-pass/macro-with-attrs1.rs b/src/test/run-pass/macro-with-attrs1.rs index 3f9d07466c..f180922a05 100644 --- a/src/test/run-pass/macro-with-attrs1.rs +++ b/src/test/run-pass/macro-with-attrs1.rs @@ -11,11 +11,11 @@ // compile-flags: --cfg foo #[cfg(foo)] -macro_rules! foo { () => (1i) } +macro_rules! foo { () => (1) } #[cfg(not(foo))] -macro_rules! foo { () => (2i) } +macro_rules! foo { () => (2) } pub fn main() { - assert_eq!(foo!(), 1i); + assert_eq!(foo!(), 1); } diff --git a/src/test/run-pass/macro-with-attrs2.rs b/src/test/run-pass/macro-with-attrs2.rs index f90a0dfa6b..d683979462 100644 --- a/src/test/run-pass/macro-with-attrs2.rs +++ b/src/test/run-pass/macro-with-attrs2.rs @@ -9,12 +9,12 @@ // except according to those terms. #[cfg(foo)] -macro_rules! foo { () => (1i) } +macro_rules! foo { () => (1) } #[cfg(not(foo))] -macro_rules! foo { () => (2i) } +macro_rules! foo { () => (2) } pub fn main() { - assert_eq!(foo!(), 2i); + assert_eq!(foo!(), 2); } diff --git a/src/test/run-pass/macro_with_super_2.rs b/src/test/run-pass/macro_with_super_2.rs new file mode 100644 index 0000000000..5c681b8e6e --- /dev/null +++ b/src/test/run-pass/macro_with_super_2.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:macro_with_super_1.rs + +#[macro_use] +extern crate macro_with_super_1; + +declare!(); + +fn main() { + bbb::ccc(); +} diff --git a/src/test/run-pass/match-arm-statics.rs b/src/test/run-pass/match-arm-statics.rs index db512adc01..dfefe84518 100644 --- a/src/test/run-pass/match-arm-statics.rs +++ b/src/test/run-pass/match-arm-statics.rs @@ -36,10 +36,9 @@ const VARIANT2_NORTH: EnumWithStructVariants = EnumWithStructVariants::Variant2 dir: Direction::North }; pub mod glfw { + #[derive(Copy)] pub struct InputState(uint); - impl Copy for InputState {} - pub const RELEASE : InputState = InputState(0); pub const PRESS : InputState = InputState(1); pub const REPEAT : InputState = InputState(2); @@ -85,7 +84,7 @@ fn issue_14576() { enum C { D = 3, E = 4 } const F : C = C::D; - assert_eq!(match C::D { F => 1i, _ => 2, }, 1); + assert_eq!(match C::D { F => 1, _ => 2, }, 1); } fn issue_13731() { @@ -114,14 +113,14 @@ fn issue_15393() { fn main() { assert_eq!(match (true, false) { - TRUE_TRUE => 1i, + TRUE_TRUE => 1, (false, false) => 2, (false, true) => 3, (true, false) => 4 }, 4); assert_eq!(match Some(Some(Direction::North)) { - Some(NONE) => 1i, + Some(NONE) => 1, Some(Some(Direction::North)) => 2, Some(Some(EAST)) => 3, Some(Some(Direction::South)) => 4, @@ -130,7 +129,7 @@ fn main() { }, 2); assert_eq!(match (Foo { bar: Some(Direction::West), baz: NewBool(true) }) { - Foo { bar: None, baz: NewBool(true) } => 1i, + Foo { bar: None, baz: NewBool(true) } => 1, Foo { bar: NONE, baz: NEW_FALSE } => 2, STATIC_FOO => 3, Foo { bar: _, baz: NEW_FALSE } => 4, @@ -141,7 +140,7 @@ fn main() { }, 5); assert_eq!(match (EnumWithStructVariants::Variant2 { dir: Direction::North }) { - EnumWithStructVariants::Variant1(true) => 1i, + EnumWithStructVariants::Variant1(true) => 1, EnumWithStructVariants::Variant1(false) => 2, EnumWithStructVariants::Variant2 { dir: Direction::West } => 3, VARIANT2_NORTH => 4, diff --git a/src/test/run-pass/match-bot-2.rs b/src/test/run-pass/match-bot-2.rs index 5b48d0ff50..949fad1134 100644 --- a/src/test/run-pass/match-bot-2.rs +++ b/src/test/run-pass/match-bot-2.rs @@ -9,5 +9,5 @@ // except according to those terms. // n.b. This was only ever failing with optimization disabled. -fn a() -> int { match return 1i { 2i => 3i, _ => panic!() } } +fn a() -> int { match return 1 { 2 => 3, _ => panic!() } } pub fn main() { a(); } diff --git a/src/test/run-pass/match-naked-record-expr.rs b/src/test/run-pass/match-naked-record-expr.rs index 170a3513a1..433cf23626 100644 --- a/src/test/run-pass/match-naked-record-expr.rs +++ b/src/test/run-pass/match-naked-record-expr.rs @@ -11,7 +11,7 @@ struct X { x: int } pub fn main() { - let _x = match 0i { + let _x = match 0 { _ => X { x: 0 }.x diff --git a/src/test/run-pass/match-naked-record.rs b/src/test/run-pass/match-naked-record.rs index 21c31b6218..fe12b7c158 100644 --- a/src/test/run-pass/match-naked-record.rs +++ b/src/test/run-pass/match-naked-record.rs @@ -11,7 +11,7 @@ struct X { x: int } pub fn main() { - let _x = match 0i { + let _x = match 0 { _ => X { x: 0 } diff --git a/src/test/run-pass/match-pattern-bindings.rs b/src/test/run-pass/match-pattern-bindings.rs index e6ce94ec5d..abb78fc831 100644 --- a/src/test/run-pass/match-pattern-bindings.rs +++ b/src/test/run-pass/match-pattern-bindings.rs @@ -9,15 +9,15 @@ // except according to those terms. fn main() { - let value = Some(1i); + let value = Some(1); assert_eq!(match value { ref a @ Some(_) => a, ref b @ None => b - }, &Some(1i)); + }, &Some(1)); assert_eq!(match value { ref c @ Some(_) => c, ref b @ None => b - }, &Some(1i)); + }, &Some(1)); assert_eq!(match "foobarbaz" { b @ _ => b }, "foobarbaz"); diff --git a/src/test/run-pass/match-pipe-binding.rs b/src/test/run-pass/match-pipe-binding.rs index ed2f7c5cb4..bdf12d22ed 100644 --- a/src/test/run-pass/match-pipe-binding.rs +++ b/src/test/run-pass/match-pipe-binding.rs @@ -10,7 +10,7 @@ fn test1() { // from issue 6338 - match ((1i, "a".to_string()), (2i, "b".to_string())) { + match ((1, "a".to_string()), (2, "b".to_string())) { ((1, a), (2, b)) | ((2, b), (1, a)) => { assert_eq!(a, "a".to_string()); assert_eq!(b, "b".to_string()); @@ -20,7 +20,7 @@ fn test1() { } fn test2() { - match (1i, 2i, 3i) { + match (1, 2, 3) { (1, a, b) | (2, b, a) => { assert_eq!(a, 2); assert_eq!(b, 3); @@ -30,7 +30,7 @@ fn test2() { } fn test3() { - match (1i, 2i, 3i) { + match (1, 2, 3) { (1, ref a, ref b) | (2, ref b, ref a) => { assert_eq!(*a, 2); assert_eq!(*b, 3); @@ -40,7 +40,7 @@ fn test3() { } fn test4() { - match (1i, 2i, 3i) { + match (1, 2, 3) { (1, a, b) | (2, b, a) if a == 2 => { assert_eq!(a, 2); assert_eq!(b, 3); @@ -50,7 +50,7 @@ fn test4() { } fn test5() { - match (1i, 2i, 3i) { + match (1, 2, 3) { (1, ref a, ref b) | (2, ref b, ref a) if *a == 2 => { assert_eq!(*a, 2); assert_eq!(*b, 3); diff --git a/src/test/run-pass/match-range.rs b/src/test/run-pass/match-range.rs index 83066c126c..68719090cf 100644 --- a/src/test/run-pass/match-range.rs +++ b/src/test/run-pass/match-range.rs @@ -11,24 +11,24 @@ // ignore-lexer-test FIXME #15877 pub fn main() { - match 5u { - 1u...5u => {} + match 5_usize { + 1_usize...5_usize => {} _ => panic!("should match range"), } - match 5u { - 6u...7u => panic!("shouldn't match range"), + match 5_usize { + 6_usize...7_usize => panic!("shouldn't match range"), _ => {} } - match 5u { - 1u => panic!("should match non-first range"), - 2u...6u => {} + match 5_usize { + 1_usize => panic!("should match non-first range"), + 2_usize...6_usize => {} _ => panic!("math is broken") } match 'c' { 'a'...'z' => {} _ => panic!("should suppport char ranges") } - match -3i { + match -3 { -7...5 => {} _ => panic!("should match signed range") } diff --git a/src/test/run-pass/match-ref-binding-mut-option.rs b/src/test/run-pass/match-ref-binding-mut-option.rs index c983903ac1..8d1e483bcd 100644 --- a/src/test/run-pass/match-ref-binding-mut-option.rs +++ b/src/test/run-pass/match-ref-binding-mut-option.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let mut v = Some(22i); + let mut v = Some(22); match v { None => {} Some(ref mut p) => { *p += 1; } diff --git a/src/test/run-pass/match-str.rs b/src/test/run-pass/match-str.rs index 544751754c..301d99a7e2 100644 --- a/src/test/run-pass/match-str.rs +++ b/src/test/run-pass/match-str.rs @@ -18,12 +18,12 @@ pub fn main() { match t::tag1("test".to_string()) { t::tag2 => panic!(), - t::tag1(ref s) if "test" != s.as_slice() => panic!(), - t::tag1(ref s) if "test" == s.as_slice() => (), + t::tag1(ref s) if "test" != &**s => panic!(), + t::tag1(ref s) if "test" == &**s => (), _ => panic!() } - let x = match "a" { "a" => 1i, "b" => 2i, _ => panic!() }; + let x = match "a" { "a" => 1, "b" => 2, _ => panic!() }; assert_eq!(x, 1); match "a" { "a" => { } "b" => { }, _ => panic!() } diff --git a/src/test/run-pass/match-unique-bind.rs b/src/test/run-pass/match-unique-bind.rs index ebe01a1d1f..78b02d709e 100644 --- a/src/test/run-pass/match-unique-bind.rs +++ b/src/test/run-pass/match-unique-bind.rs @@ -9,10 +9,11 @@ // except according to those terms. #![allow(unknown_features)] +#![feature(box_patterns)] #![feature(box_syntax)] pub fn main() { - match box 100i { + match box 100 { box x => { println!("{}", x); assert_eq!(x, 100); diff --git a/src/test/run-pass/match-vec-alternatives.rs b/src/test/run-pass/match-vec-alternatives.rs index ae4fd1f199..eb6b2176e5 100644 --- a/src/test/run-pass/match-vec-alternatives.rs +++ b/src/test/run-pass/match-vec-alternatives.rs @@ -55,36 +55,36 @@ fn match_nested_vecs_snoc<'a, T>(l1: Option<&'a [T]>, l2: Result<&'a [T], ()>) - } fn main() { - assert_eq!(match_vecs(&[1i, 2], &[2i, 3]), "both non-empty"); - assert_eq!(match_vecs(&[], &[1i, 2, 3, 4]), "one empty"); + 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::(&[], &[]), "both empty"); - assert_eq!(match_vecs(&[1i, 2, 3], &[]), "one empty"); + assert_eq!(match_vecs(&[1, 2, 3], &[]), "one empty"); - assert_eq!(match_vecs_cons(&[1i, 2], &[2i, 3]), "both non-empty"); - assert_eq!(match_vecs_cons(&[], &[1i, 2, 3, 4]), "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::(&[], &[]), "both empty"); - assert_eq!(match_vecs_cons(&[1i, 2, 3], &[]), "one empty"); + assert_eq!(match_vecs_cons(&[1, 2, 3], &[]), "one empty"); - assert_eq!(match_vecs_snoc(&[1i, 2], &[2i, 3]), "both non-empty"); - assert_eq!(match_vecs_snoc(&[], &[1i, 2, 3, 4]), "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::(&[], &[]), "both empty"); - assert_eq!(match_vecs_snoc(&[1i, 2, 3], &[]), "one empty"); + assert_eq!(match_vecs_snoc(&[1, 2, 3], &[]), "one empty"); - assert_eq!(match_nested_vecs_cons(None, Ok::<&[_], ()>(&[4u, 2u])), + assert_eq!(match_nested_vecs_cons(None, Ok::<&[_], ()>(&[4_usize, 2_usize])), "None, Ok(at least two elements)"); assert_eq!(match_nested_vecs_cons::(None, Err(())), "None, Ok(less than one element)"); assert_eq!(match_nested_vecs_cons::(Some::<&[_]>(&[]), Ok::<&[_], ()>(&[])), "Some(empty), Ok(empty)"); - assert_eq!(match_nested_vecs_cons(Some::<&[_]>(&[1i]), Err(())), "Some(non-empty), any"); - assert_eq!(match_nested_vecs_cons(Some::<&[_]>(&[(42i, ())]), Ok::<&[_], ()>(&[(1i, ())])), + assert_eq!(match_nested_vecs_cons(Some::<&[_]>(&[1]), Err(())), "Some(non-empty), any"); + assert_eq!(match_nested_vecs_cons(Some::<&[_]>(&[(42, ())]), Ok::<&[_], ()>(&[(1, ())])), "Some(non-empty), any"); - assert_eq!(match_nested_vecs_snoc(None, Ok::<&[_], ()>(&[4u, 2u])), + assert_eq!(match_nested_vecs_snoc(None, Ok::<&[_], ()>(&[4_usize, 2_usize])), "None, Ok(at least two elements)"); assert_eq!(match_nested_vecs_snoc::(None, Err(())), "None, Ok(less than one element)"); assert_eq!(match_nested_vecs_snoc::(Some::<&[_]>(&[]), Ok::<&[_], ()>(&[])), "Some(empty), Ok(empty)"); - assert_eq!(match_nested_vecs_snoc(Some::<&[_]>(&[1i]), Err(())), "Some(non-empty), any"); - assert_eq!(match_nested_vecs_snoc(Some::<&[_]>(&[(42i, ())]), Ok::<&[_], ()>(&[(1i, ())])), + assert_eq!(match_nested_vecs_snoc(Some::<&[_]>(&[1]), Err(())), "Some(non-empty), any"); + assert_eq!(match_nested_vecs_snoc(Some::<&[_]>(&[(42, ())]), Ok::<&[_], ()>(&[(1, ())])), "Some(non-empty), any"); } diff --git a/src/test/run-pass/match-vec-rvalue.rs b/src/test/run-pass/match-vec-rvalue.rs index 0f058086ad..04a0204d20 100644 --- a/src/test/run-pass/match-vec-rvalue.rs +++ b/src/test/run-pass/match-vec-rvalue.rs @@ -12,7 +12,7 @@ pub fn main() { - match vec!(1i, 2i, 3i) { + match vec!(1, 2, 3) { x => { assert_eq!(x.len(), 3); assert_eq!(x[0], 1); diff --git a/src/test/run-pass/match-with-ret-arm.rs b/src/test/run-pass/match-with-ret-arm.rs index a1537e63e5..05c6aac90e 100644 --- a/src/test/run-pass/match-with-ret-arm.rs +++ b/src/test/run-pass/match-with-ret-arm.rs @@ -14,7 +14,7 @@ pub fn main() { // sometimes we have had trouble finding // the right type for f, as we unified // bot and u32 here - let f = match "1234".parse::() { + let f = match "1234".parse::().ok() { None => return (), Some(num) => num as u32 }; diff --git a/src/test/run-pass/method-attributes.rs b/src/test/run-pass/method-attributes.rs index c015244d52..92af96e0d8 100644 --- a/src/test/run-pass/method-attributes.rs +++ b/src/test/run-pass/method-attributes.rs @@ -10,6 +10,7 @@ // pp-exact - Make sure we print all the attributes #![allow(unused_attribute)] +#![feature(custom_attribute)] #[frobable] trait frobable { diff --git a/src/test/run-pass/method-early-bound-lifetimes-on-self.rs b/src/test/run-pass/method-early-bound-lifetimes-on-self.rs index 25ce0d774e..cec9753a2f 100644 --- a/src/test/run-pass/method-early-bound-lifetimes-on-self.rs +++ b/src/test/run-pass/method-early-bound-lifetimes-on-self.rs @@ -13,7 +13,11 @@ #![allow(dead_code)] -struct Cursor<'a>; +use std::marker; + +struct Cursor<'a> { + m: marker::PhantomData<&'a ()> +} trait CursorNavigator { fn init_cursor<'a, 'b:'a>(&'a self, cursor: &mut Cursor<'b>) -> bool; @@ -28,7 +32,7 @@ impl CursorNavigator for SimpleNavigator { } fn main() { - let mut c = Cursor; + let mut c = Cursor { m: marker::PhantomData }; let n = SimpleNavigator; n.init_cursor(&mut c); } diff --git a/src/test/run-pass/method-mut-self-modifies-mut-slice-lvalue.rs b/src/test/run-pass/method-mut-self-modifies-mut-slice-lvalue.rs index 9ae7f49c75..0ad600dd85 100644 --- a/src/test/run-pass/method-mut-self-modifies-mut-slice-lvalue.rs +++ b/src/test/run-pass/method-mut-self-modifies-mut-slice-lvalue.rs @@ -15,7 +15,7 @@ use std::raw; use std::mem; use std::slice; -use std::io::IoResult; +use std::old_io::IoResult; trait MyWriter { fn my_write(&mut self, buf: &[u8]) -> IoResult<()>; @@ -41,7 +41,7 @@ fn main() { let mut buf = [0_u8; 6]; { - let mut writer = buf.as_mut_slice(); + let mut writer: &mut [_] = &mut buf; writer.my_write(&[0, 1, 2]).unwrap(); writer.my_write(&[3, 4, 5]).unwrap(); } diff --git a/src/test/run-pass/method-recursive-blanket-impl.rs b/src/test/run-pass/method-recursive-blanket-impl.rs index 338bd89ab5..15eb2ae2e4 100644 --- a/src/test/run-pass/method-recursive-blanket-impl.rs +++ b/src/test/run-pass/method-recursive-blanket-impl.rs @@ -17,16 +17,16 @@ use std::marker::Sized; // Note: this must be generic for the problem to show up trait Foo { - fn foo(&self); + fn foo(&self, a: A); } impl Foo for [u8] { - fn foo(&self) {} + fn foo(&self, a: u8) {} } impl<'a, A, T> Foo for &'a T where T: Foo { - fn foo(&self) { - Foo::foo(*self) + fn foo(&self, a: A) { + Foo::foo(*self, a) } } diff --git a/src/test/run-pass/method-self-arg-trait.rs b/src/test/run-pass/method-self-arg-trait.rs index 39018a8739..c79141d979 100644 --- a/src/test/run-pass/method-self-arg-trait.rs +++ b/src/test/run-pass/method-self-arg-trait.rs @@ -15,10 +15,9 @@ static mut COUNT: u64 = 1; +#[derive(Copy)] struct Foo; -impl Copy for Foo {} - trait Bar : Sized { fn foo1(&self); fn foo2(self); diff --git a/src/test/run-pass/method-self-arg.rs b/src/test/run-pass/method-self-arg.rs index ae15bc6074..de24297c7b 100644 --- a/src/test/run-pass/method-self-arg.rs +++ b/src/test/run-pass/method-self-arg.rs @@ -15,10 +15,9 @@ static mut COUNT: uint = 1; +#[derive(Copy)] struct Foo; -impl Copy for Foo {} - impl Foo { fn foo(self, x: &Foo) { unsafe { COUNT *= 2; } @@ -55,5 +54,5 @@ fn main() { x.foo(&x); - unsafe { assert!(COUNT == 2u*3*3*3*5*5*5*7*7*7); } + unsafe { assert!(COUNT == 2_usize*3*3*3*5*5*5*7*7*7); } } diff --git a/src/test/run-pass/method-two-trait-defer-resolution-1.rs b/src/test/run-pass/method-two-trait-defer-resolution-1.rs index e4ae33c1c5..414b08b433 100644 --- a/src/test/run-pass/method-two-trait-defer-resolution-1.rs +++ b/src/test/run-pass/method-two-trait-defer-resolution-1.rs @@ -12,28 +12,28 @@ // type that is (ultimately) inferred for `x`. trait foo { - fn foo(&self) -> int; + fn foo(&self) -> i32; } -impl foo for Vec { - fn foo(&self) -> int {1} +impl foo for Vec { + fn foo(&self) -> i32 {1} } -impl foo for Vec { - fn foo(&self) -> int {2} +impl foo for Vec { + fn foo(&self) -> i32 {2} } -fn call_foo_uint() -> int { +fn call_foo_uint() -> i32 { let mut x = Vec::new(); let y = x.foo(); - x.push(0u); + x.push(0u32); y } -fn call_foo_int() -> int { +fn call_foo_int() -> i32 { let mut x = Vec::new(); let y = x.foo(); - x.push(0i); + x.push(0i32); y } diff --git a/src/test/run-pass/method-two-trait-defer-resolution-2.rs b/src/test/run-pass/method-two-trait-defer-resolution-2.rs index b18c29dc3c..7463783be5 100644 --- a/src/test/run-pass/method-two-trait-defer-resolution-2.rs +++ b/src/test/run-pass/method-two-trait-defer-resolution-2.rs @@ -34,14 +34,14 @@ impl Foo for Vec> { fn call_foo_copy() -> int { let mut x = Vec::new(); let y = x.foo(); - x.push(0u); + x.push(0_usize); y } fn call_foo_other() -> int { let mut x = Vec::new(); let y = x.foo(); - x.push(box 0i); + x.push(box 0); y } diff --git a/src/test/run-pass/method-where-clause.rs b/src/test/run-pass/method-where-clause.rs index 4361c22f55..6337538a33 100644 --- a/src/test/run-pass/method-where-clause.rs +++ b/src/test/run-pass/method-where-clause.rs @@ -12,24 +12,24 @@ // where clause type, and not only type parameters. trait Foo { - fn foo(&self) -> int; + fn foo(&self) -> i32; } -impl Foo for Option +impl Foo for Option { - fn foo(&self) -> int { + fn foo(&self) -> i32 { self.unwrap_or(22) } } -impl Foo for Option +impl Foo for Option { - fn foo(&self) -> int { - self.unwrap_or(22) as int + fn foo(&self) -> i32 { + self.unwrap_or(22) as i32 } } -fn check(x: Option) -> (int, int) +fn check(x: Option) -> (i32, i32) where Option : Foo { let y: Option = None; @@ -37,6 +37,6 @@ fn check(x: Option) -> (int, int) } fn main() { - assert_eq!(check(Some(23u)), (23i, 22i)); - assert_eq!(check(Some(23i)), (23i, 22i)); + assert_eq!(check(Some(23u32)), (23, 22)); + assert_eq!(check(Some(23)), (23, 22)); } diff --git a/src/test/run-pass/monad.rs b/src/test/run-pass/monad.rs index acd8078b1f..457c0a35fd 100644 --- a/src/test/run-pass/monad.rs +++ b/src/test/run-pass/monad.rs @@ -17,7 +17,7 @@ trait vec_monad { impl vec_monad for Vec { fn bind(&self, mut f: F) -> Vec where F: FnMut(&A) -> Vec { let mut r = Vec::new(); - for elt in self.iter() { + for elt in self { r.extend(f(elt).into_iter()); } r diff --git a/src/test/run-pass/monomorphize-abi-alignment.rs b/src/test/run-pass/monomorphize-abi-alignment.rs index 84bffed59a..726f205f5c 100644 --- a/src/test/run-pass/monomorphize-abi-alignment.rs +++ b/src/test/run-pass/monomorphize-abi-alignment.rs @@ -18,26 +18,21 @@ * and apply the wrong instance of the method `unwrap`. */ +#[derive(Copy)] struct S { i:u8, t:T } -impl Copy for S {} - impl S { fn unwrap(self) -> T { self.t } } -#[derive(PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] struct A((u32, u32)); -impl Copy for A {} - -#[derive(PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] struct B(u64); -impl Copy for B {} - pub fn main() { static Ca: S = S { i: 0, t: A((13, 104)) }; static Cb: S = S { i: 0, t: B(31337) }; diff --git a/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs b/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs index 4ebebc4601..1164ef1a3c 100644 --- a/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs +++ b/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs @@ -8,8 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::marker::MarkerTrait; -trait Serializer { +trait Serializer : MarkerTrait { } trait Serializable { @@ -32,9 +33,9 @@ impl Serializer for int { } pub fn main() { - let foo = F { a: 1i }; - foo.serialize(1i); + let foo = F { a: 1 }; + foo.serialize(1); - let bar = F { a: F {a: 1i } }; - bar.serialize(2i); + let bar = F { a: F {a: 1 } }; + bar.serialize(2); } diff --git a/src/test/run-pass/move-3-unique.rs b/src/test/run-pass/move-3-unique.rs index a10e3f9f5b..07d0594b49 100644 --- a/src/test/run-pass/move-3-unique.rs +++ b/src/test/run-pass/move-3-unique.rs @@ -27,7 +27,7 @@ fn test(x: bool, foo: Box) -> int { pub fn main() { let x = box Triple{x: 1, y: 2, z: 3}; - for _ in range(0u, 10000u) { + for _ in 0_usize..10000_usize { assert_eq!(test(true, x.clone()), 2); } assert_eq!(test(false, x), 5); diff --git a/src/test/run-pass/move-out-of-field.rs b/src/test/run-pass/move-out-of-field.rs index 92c5e025b9..cb487a34f3 100644 --- a/src/test/run-pass/move-out-of-field.rs +++ b/src/test/run-pass/move-out-of-field.rs @@ -31,5 +31,5 @@ pub fn main() { sb.append("Hello, "); sb.append("World!"); let str = to_string(sb); - assert_eq!(str.as_slice(), "Hello, World!"); + assert_eq!(str, "Hello, World!"); } diff --git a/src/test/run-pass/multi-let.rs b/src/test/run-pass/multi-let.rs index 201abeba07..eb1444be37 100644 --- a/src/test/run-pass/multi-let.rs +++ b/src/test/run-pass/multi-let.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let x = 10i; + let x = 10; let y = x; assert!((y == 10)); } diff --git a/src/test/run-pass/multidispatch-conditional-impl-not-considered.rs b/src/test/run-pass/multidispatch-conditional-impl-not-considered.rs index 5db5a6267b..49ecef9c73 100644 --- a/src/test/run-pass/multidispatch-conditional-impl-not-considered.rs +++ b/src/test/run-pass/multidispatch-conditional-impl-not-considered.rs @@ -29,5 +29,5 @@ impl Bar { fn main() { let b = RefCell::new(Bar); - b.borrow().foo() + b.borrow().foo(); } diff --git a/src/test/run-pass/multidispatch1.rs b/src/test/run-pass/multidispatch1.rs index 87d188418b..b9435afdc7 100644 --- a/src/test/run-pass/multidispatch1.rs +++ b/src/test/run-pass/multidispatch1.rs @@ -8,18 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::fmt::Show; +use std::fmt::Debug; trait MyTrait { fn get(&self) -> T; } +#[derive(Copy)] struct MyType { dummy: uint } -impl Copy for MyType {} - impl MyTrait for MyType { fn get(&self) -> uint { self.dummy } } @@ -29,7 +28,7 @@ impl MyTrait for MyType { } fn test_eq(m: M, v: T) -where T : Eq + Show, +where T : Eq + Debug, M : MyTrait { assert_eq!(m.get(), v); diff --git a/src/test/run-pass/multidispatch2.rs b/src/test/run-pass/multidispatch2.rs index 1aa15cc598..6b52ea9dfa 100644 --- a/src/test/run-pass/multidispatch2.rs +++ b/src/test/run-pass/multidispatch2.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::fmt::Show; +use std::fmt::Debug; use std::default::Default; trait MyTrait { @@ -23,25 +23,24 @@ impl MyTrait for T } } +#[derive(Copy)] struct MyType { dummy: uint } -impl Copy for MyType {} - impl MyTrait for MyType { fn get(&self) -> uint { self.dummy } } fn test_eq(m: M, v: T) -where T : Eq + Show, +where T : Eq + Debug, M : MyTrait { assert_eq!(m.get(), v); } pub fn main() { - test_eq(22u, 0u); + test_eq(22_usize, 0_usize); let value = MyType { dummy: 256 + 22 }; test_eq(value, value.dummy); diff --git a/src/test/run-pass/multiple-trait-bounds.rs b/src/test/run-pass/multiple-trait-bounds.rs index 10abe4ce71..7ce1afb52a 100644 --- a/src/test/run-pass/multiple-trait-bounds.rs +++ b/src/test/run-pass/multiple-trait-bounds.rs @@ -12,5 +12,5 @@ fn f(_: T) { } pub fn main() { - f(3i); + f(3); } diff --git a/src/test/run-pass/mut-function-arguments.rs b/src/test/run-pass/mut-function-arguments.rs index 388b814b2a..b1f7da17c8 100644 --- a/src/test/run-pass/mut-function-arguments.rs +++ b/src/test/run-pass/mut-function-arguments.rs @@ -17,7 +17,7 @@ fn f(mut y: Box) { } fn g() { - let frob = |&: mut q: Box| { *q = 2; assert!(*q == 2); }; + let frob = |mut q: Box| { *q = 2; assert!(*q == 2); }; let w = box 37; frob(w); diff --git a/src/test/run-pass/mut-in-ident-patterns.rs b/src/test/run-pass/mut-in-ident-patterns.rs index ad9161f9bd..d3ae80861f 100644 --- a/src/test/run-pass/mut-in-ident-patterns.rs +++ b/src/test/run-pass/mut-in-ident-patterns.rs @@ -20,7 +20,7 @@ struct X; impl Foo for X {} pub fn main() { - let (a, mut b) = (23i, 4i); + let (a, mut b) = (23, 4); assert_eq!(a, 23); assert_eq!(b, 4); b = a + b; @@ -34,7 +34,7 @@ pub fn main() { Baz(f32, u8) } - let (x, mut y) = (32i, Bar::Foo(21)); + let (x, mut y) = (32, Bar::Foo(21)); match x { mut z @ 32 => { @@ -75,6 +75,6 @@ pub fn main() { x = 30; assert_eq!(x, 30); - (|&: A { x: mut t }: A| { t = t+1; t })(A { x: 34 }); + (|A { x: mut t }: A| { t = t+1; t })(A { x: 34 }); } diff --git a/src/test/run-pass/mutability-inherits-through-fixed-length-vec.rs b/src/test/run-pass/mutability-inherits-through-fixed-length-vec.rs index bf926a6c48..e074c3fb3d 100644 --- a/src/test/run-pass/mutability-inherits-through-fixed-length-vec.rs +++ b/src/test/run-pass/mutability-inherits-through-fixed-length-vec.rs @@ -9,15 +9,15 @@ // except according to those terms. fn test1() { - let mut ints = [0i; 32]; + let mut ints = [0; 32]; ints[0] += 1; assert_eq!(ints[0], 1); } fn test2() { - let mut ints = [0i; 32]; - for i in ints.iter_mut() { *i += 22; } - for i in ints.iter() { assert!(*i == 22); } + let mut ints = [0; 32]; + for i in &mut ints { *i += 22; } + for i in &ints { assert!(*i == 22); } } pub fn main() { diff --git a/src/test/run-pass/native-print-no-runtime.rs b/src/test/run-pass/native-print-no-runtime.rs index a7937efd66..b151eddb94 100644 --- a/src/test/run-pass/native-print-no-runtime.rs +++ b/src/test/run-pass/native-print-no-runtime.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(start)] #[start] pub fn main(_: int, _: *const *const u8) -> int { diff --git a/src/test/run-pass/negative.rs b/src/test/run-pass/negative.rs index 4bf91bf703..435382666f 100644 --- a/src/test/run-pass/negative.rs +++ b/src/test/run-pass/negative.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - match -5i { + match -5 { -5 => {} _ => { panic!() } } diff --git a/src/test/run-pass/nested-matchs.rs b/src/test/run-pass/nested-matchs.rs index 55c1de2700..b0ac9fb597 100644 --- a/src/test/run-pass/nested-matchs.rs +++ b/src/test/run-pass/nested-matchs.rs @@ -14,7 +14,7 @@ fn foo() { match Some::(5) { Some::(_x) => { let mut bar; - match None:: { None:: => { bar = 5i; } _ => { baz(); } } + match None:: { None:: => { bar = 5; } _ => { baz(); } } println!("{}", bar); } None:: => { println!("hello"); } diff --git a/src/test/run-pass/new-box-syntax.rs b/src/test/run-pass/new-box-syntax.rs index 4ea51b3b40..3d4847a119 100644 --- a/src/test/run-pass/new-box-syntax.rs +++ b/src/test/run-pass/new-box-syntax.rs @@ -24,8 +24,8 @@ struct Structure { } pub fn main() { - let x: Box = box(HEAP) 2i; - let y: Box = box 2i; - let b: Box = box()(1i + 2); - let c = box()(3i + 4); + let x: Box = box(HEAP) 2; + let y: Box = box 2; + let b: Box = box()(1 + 2); + let c = box()(3 + 4); } diff --git a/src/test/run-pass/new-impl-syntax.rs b/src/test/run-pass/new-impl-syntax.rs index 84d2083ced..bd0a53b620 100644 --- a/src/test/run-pass/new-impl-syntax.rs +++ b/src/test/run-pass/new-impl-syntax.rs @@ -15,7 +15,7 @@ struct Thingy { y: int } -impl fmt::Show for Thingy { +impl fmt::Debug for Thingy { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{{ x: {:?}, y: {:?} }}", self.x, self.y) } @@ -25,7 +25,7 @@ struct PolymorphicThingy { x: T } -impl fmt::Show for PolymorphicThingy { +impl fmt::Debug for PolymorphicThingy { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self.x) } diff --git a/src/test/run-pass/new-unicode-escapes.rs b/src/test/run-pass/new-unicode-escapes.rs index 2888389bcc..7430f730f3 100644 --- a/src/test/run-pass/new-unicode-escapes.rs +++ b/src/test/run-pass/new-unicode-escapes.rs @@ -18,5 +18,5 @@ pub fn main() { let s = "\\{20}"; let mut correct_s = String::from_str("\\"); correct_s.push_str("{20}"); - assert_eq!(s, correct_s.as_slice()); + assert_eq!(s, correct_s); } diff --git a/src/test/run-pass/newtype-polymorphic.rs b/src/test/run-pass/newtype-polymorphic.rs index 74487f5b57..4b7dbdc9e5 100644 --- a/src/test/run-pass/newtype-polymorphic.rs +++ b/src/test/run-pass/newtype-polymorphic.rs @@ -23,7 +23,7 @@ fn myvec_elt(mv: myvec) -> X { } pub fn main() { - let mv = myvec(vec!(1i, 2, 3)); + let mv = myvec(vec!(1, 2, 3)); let mv_clone = mv.clone(); let mv_clone = myvec_deref(mv_clone); assert_eq!(mv_clone[1], 2); diff --git a/src/test/run-pass/newtype-temporary.rs b/src/test/run-pass/newtype-temporary.rs index d2523eac31..5952258e46 100644 --- a/src/test/run-pass/newtype-temporary.rs +++ b/src/test/run-pass/newtype-temporary.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct Foo(uint); fn foo() -> Foo { diff --git a/src/test/run-pass/newtype.rs b/src/test/run-pass/newtype.rs index 093fd6c81c..869ae4a37d 100644 --- a/src/test/run-pass/newtype.rs +++ b/src/test/run-pass/newtype.rs @@ -8,17 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[derive(Copy)] struct mytype(Mytype); -impl Copy for mytype {} - +#[derive(Copy)] struct Mytype { compute: fn(mytype) -> int, val: int, } -impl Copy for Mytype {} - fn compute(i: mytype) -> int { let mytype(m) = i; return m.val + 20; diff --git a/src/test/run-pass/no-landing-pads.rs b/src/test/run-pass/no-landing-pads.rs index 64e78c3483..5ce32e4fe2 100644 --- a/src/test/run-pass/no-landing-pads.rs +++ b/src/test/run-pass/no-landing-pads.rs @@ -10,7 +10,7 @@ // compile-flags: -Z no-landing-pads -use std::thread::Thread; +use std::thread; static mut HIT: bool = false; @@ -23,9 +23,9 @@ impl Drop for A { } fn main() { - Thread::scoped(move|| -> () { + thread::spawn(move|| -> () { let _a = A; panic!(); - }).join().unwrap_err(); + }).join().err().unwrap(); assert!(unsafe { !HIT }); } diff --git a/src/test/run-pass/no-std-xcrate2.rs b/src/test/run-pass/no-std-xcrate2.rs index dcafb5f451..f5f34607af 100644 --- a/src/test/run-pass/no-std-xcrate2.rs +++ b/src/test/run-pass/no-std-xcrate2.rs @@ -16,6 +16,7 @@ // This tests that libraries built with #[no_std] can be linked to crates with // #[no_std] and actually run. +#![feature(no_std)] #![no_std] extern crate no_std_crate; diff --git a/src/test/run-pass/nondrop-cycle.rs b/src/test/run-pass/nondrop-cycle.rs new file mode 100644 index 0000000000..bbce9a8f4a --- /dev/null +++ b/src/test/run-pass/nondrop-cycle.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::cell::Cell; + +struct C<'a> { + p: Cell>>, +} + +impl<'a> C<'a> { + fn new() -> C<'a> { C { p: Cell::new(None) } } +} + +fn f1() { + let (c1, c2) = (C::new(), C::new()); + c1.p.set(Some(&c2)); + c2.p.set(Some(&c1)); +} + +fn f2() { + let (c1, c2); + c1 = C::new(); + c2 = C::new(); + c1.p.set(Some(&c2)); + c2.p.set(Some(&c1)); +} + +fn main() { + f1(); + f2(); +} diff --git a/src/test/run-pass/numeric-method-autoexport.rs b/src/test/run-pass/numeric-method-autoexport.rs index b4d079d79d..eccc2a41a8 100644 --- a/src/test/run-pass/numeric-method-autoexport.rs +++ b/src/test/run-pass/numeric-method-autoexport.rs @@ -21,22 +21,22 @@ use std::num::ToPrimitive; pub fn main() { // ints // num - assert_eq!(15i.add(6), 21); - assert_eq!(15i8.add(6i8), 21i8); - assert_eq!(15i16.add(6i16), 21i16); - assert_eq!(15i32.add(6i32), 21i32); - assert_eq!(15i64.add(6i64), 21i64); + assert_eq!(15_isize.add(6_isize), 21_isize); + assert_eq!(15_i8.add(6i8), 21_i8); + assert_eq!(15_i16.add(6i16), 21_i16); + assert_eq!(15_i32.add(6i32), 21_i32); + assert_eq!(15_i64.add(6i64), 21_i64); // uints // num - assert_eq!(15u.add(6u), 21u); - assert_eq!(15u8.add(6u8), 21u8); - assert_eq!(15u16.add(6u16), 21u16); - assert_eq!(15u32.add(6u32), 21u32); - assert_eq!(15u64.add(6u64), 21u64); + assert_eq!(15_usize.add(6_usize), 21_usize); + assert_eq!(15_u8.add(6u8), 21_u8); + assert_eq!(15_u16.add(6u16), 21_u16); + assert_eq!(15_u32.add(6u32), 21_u32); + assert_eq!(15_u64.add(6u64), 21_u64); // floats // num - assert_eq!(10f32.to_int().unwrap(), 10); - assert_eq!(10f64.to_int().unwrap(), 10); + assert_eq!(10_f32.to_i32().unwrap(), 10); + assert_eq!(10_f64.to_i32().unwrap(), 10); } diff --git a/src/test/run-pass/object-lifetime-default-default-to-static.rs b/src/test/run-pass/object-lifetime-default-default-to-static.rs new file mode 100644 index 0000000000..c385a0195b --- /dev/null +++ b/src/test/run-pass/object-lifetime-default-default-to-static.rs @@ -0,0 +1,42 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that `Box` is equivalent to `Box`, both in +// fields and fn arguments. + +#![allow(dead_code)] + +trait Test { + fn foo(&self) { } +} + +struct SomeStruct { + t: Box, + u: Box, +} + +fn a(t: Box, mut ss: SomeStruct) { + ss.t = t; +} + +fn b(t: Box, mut ss: SomeStruct) { + ss.t = t; +} + +fn c(t: Box, mut ss: SomeStruct) { + ss.u = t; +} + +fn d(t: Box, mut ss: SomeStruct) { + ss.u = t; +} + +fn main() { +} diff --git a/src/test/run-pass/object-lifetime-default-from-ref-struct.rs b/src/test/run-pass/object-lifetime-default-from-ref-struct.rs new file mode 100644 index 0000000000..24da960367 --- /dev/null +++ b/src/test/run-pass/object-lifetime-default-from-ref-struct.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that the lifetime of the enclosing `&` is used for the object +// lifetime bound. + +#![allow(dead_code)] + +trait Test { + fn foo(&self) { } +} + +struct Ref<'a,T:'a+?Sized> { + r: &'a T +} + +struct SomeStruct<'a> { + t: Ref<'a,Test>, + u: Ref<'a,Test+'a>, +} + +fn a<'a>(t: Ref<'a,Test>, mut ss: SomeStruct<'a>) { + ss.t = t; +} + +fn b<'a>(t: Ref<'a,Test>, mut ss: SomeStruct<'a>) { + ss.u = t; +} + +fn c<'a>(t: Ref<'a,Test+'a>, mut ss: SomeStruct<'a>) { + ss.t = t; +} + +fn d<'a>(t: Ref<'a,Test+'a>, mut ss: SomeStruct<'a>) { + ss.u = t; +} + + +fn main() { +} diff --git a/src/test/run-pass/object-lifetime-default-from-rptr-box.rs b/src/test/run-pass/object-lifetime-default-from-rptr-box.rs new file mode 100644 index 0000000000..825800e1d4 --- /dev/null +++ b/src/test/run-pass/object-lifetime-default-from-rptr-box.rs @@ -0,0 +1,42 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that the lifetime from the enclosing `&` is "inherited" +// through the `Box` struct. + +#![allow(dead_code)] + +trait Test { + fn foo(&self) { } +} + +struct SomeStruct<'a> { + t: &'a Box, + u: &'a Box, +} + +fn a<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { + ss.t = t; +} + +fn b<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { + ss.u = t; +} + +fn c<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { + ss.t = t; +} + +fn d<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { + ss.u = t; +} + +fn main() { +} diff --git a/src/test/run-pass/object-lifetime-default-from-rptr-mut.rs b/src/test/run-pass/object-lifetime-default-from-rptr-mut.rs new file mode 100644 index 0000000000..0f34d945c8 --- /dev/null +++ b/src/test/run-pass/object-lifetime-default-from-rptr-mut.rs @@ -0,0 +1,43 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that the lifetime of the enclosing `&` is used for the object +// lifetime bound. + +#![allow(dead_code)] + +trait Test { + fn foo(&self) { } +} + +struct SomeStruct<'a> { + t: &'a mut Test, + u: &'a mut (Test+'a), +} + +fn a<'a>(t: &'a mut Test, mut ss: SomeStruct<'a>) { + ss.t = t; +} + +fn b<'a>(t: &'a mut Test, mut ss: SomeStruct<'a>) { + ss.u = t; +} + +fn c<'a>(t: &'a mut (Test+'a), mut ss: SomeStruct<'a>) { + ss.t = t; +} + +fn d<'a>(t: &'a mut (Test+'a), mut ss: SomeStruct<'a>) { + ss.u = t; +} + + +fn main() { +} diff --git a/src/test/run-pass/object-lifetime-default-from-rptr-struct.rs b/src/test/run-pass/object-lifetime-default-from-rptr-struct.rs new file mode 100644 index 0000000000..9d5dac536f --- /dev/null +++ b/src/test/run-pass/object-lifetime-default-from-rptr-struct.rs @@ -0,0 +1,46 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that the lifetime from the enclosing `&` is "inherited" +// through the `MyBox` struct. + +#![allow(dead_code)] + +trait Test { + fn foo(&self) { } +} + +struct SomeStruct<'a> { + t: &'a MyBox, + u: &'a MyBox, +} + +struct MyBox { + b: Box +} + +fn a<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { + ss.t = t; +} + +fn b<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { + ss.u = t; +} + +fn c<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { + ss.t = t; +} + +fn d<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { + ss.u = t; +} + +fn main() { +} diff --git a/src/test/run-pass/object-lifetime-default-from-rptr.rs b/src/test/run-pass/object-lifetime-default-from-rptr.rs new file mode 100644 index 0000000000..b7a28a5c52 --- /dev/null +++ b/src/test/run-pass/object-lifetime-default-from-rptr.rs @@ -0,0 +1,43 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that the lifetime of the enclosing `&` is used for the object +// lifetime bound. + +#![allow(dead_code)] + +trait Test { + fn foo(&self) { } +} + +struct SomeStruct<'a> { + t: &'a Test, + u: &'a (Test+'a), +} + +fn a<'a>(t: &'a Test, mut ss: SomeStruct<'a>) { + ss.t = t; +} + +fn b<'a>(t: &'a Test, mut ss: SomeStruct<'a>) { + ss.u = t; +} + +fn c<'a>(t: &'a (Test+'a), mut ss: SomeStruct<'a>) { + ss.t = t; +} + +fn d<'a>(t: &'a (Test+'a), mut ss: SomeStruct<'a>) { + ss.u = t; +} + + +fn main() { +} diff --git a/src/test/run-pass/object-method-numbering.rs b/src/test/run-pass/object-method-numbering.rs new file mode 100644 index 0000000000..8da753acb9 --- /dev/null +++ b/src/test/run-pass/object-method-numbering.rs @@ -0,0 +1,36 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test for using an object with an associated type binding as the +// instantiation for a generic type with a bound. + +trait SomeTrait { + type SomeType; + + fn get(&self) -> Self::SomeType; +} + +fn get_int+?Sized>(x: &T) -> i32 { + x.get() +} + +impl SomeTrait for i32 { + type SomeType = i32; + fn get(&self) -> i32 { + *self + } +} + +fn main() { + let x = 22_i32; + let x1: &SomeTrait = &x; + let y = get_int(x1); + assert_eq!(x, y); +} diff --git a/src/test/run-pass/object-one-type-two-traits.rs b/src/test/run-pass/object-one-type-two-traits.rs index ebdf3c08a2..f8a3ce7cda 100644 --- a/src/test/run-pass/object-one-type-two-traits.rs +++ b/src/test/run-pass/object-one-type-two-traits.rs @@ -35,7 +35,7 @@ fn is(x: &Any) -> bool { } fn main() { - let x = box 22i as Box; + let x = box 22 as Box; println!("x={}", x.get()); let y = x.wrap(); } diff --git a/src/test/run-pass/objects-coerce-freeze-borrored.rs b/src/test/run-pass/objects-coerce-freeze-borrored.rs index 0bdc36750a..998af27c33 100644 --- a/src/test/run-pass/objects-coerce-freeze-borrored.rs +++ b/src/test/run-pass/objects-coerce-freeze-borrored.rs @@ -40,9 +40,9 @@ fn do_it_imm(obj: &Foo, v: uint) { } pub fn main() { - let mut x = 22_u; + let mut x = 22_usize; let obj = &mut x as &mut Foo; do_it_mut(obj); - do_it_imm(obj, 23u); + do_it_imm(obj, 23_usize); do_it_mut(obj); } diff --git a/src/test/run-pass/objects-owned-object-borrowed-method-headerless.rs b/src/test/run-pass/objects-owned-object-borrowed-method-headerless.rs index cd97c34f8c..30a8c270bd 100644 --- a/src/test/run-pass/objects-owned-object-borrowed-method-headerless.rs +++ b/src/test/run-pass/objects-owned-object-borrowed-method-headerless.rs @@ -37,7 +37,7 @@ pub fn main() { box BarStruct{ x: 2 } as Box ); - for i in range(0u, foos.len()) { + for i in 0_usize..foos.len() { assert_eq!(i, foos[i].foo()); } } diff --git a/src/test/run-pass/operator-associativity.rs b/src/test/run-pass/operator-associativity.rs index 8d45b8ecb0..bee6d23a27 100644 --- a/src/test/run-pass/operator-associativity.rs +++ b/src/test/run-pass/operator-associativity.rs @@ -12,4 +12,4 @@ // Testcase for issue #130, operator associativity. -pub fn main() { assert!((3i * 5i / 2i == 7i)); } +pub fn main() { assert!((3 * 5 / 2 == 7)); } diff --git a/src/test/run-pass/operator-multidispatch.rs b/src/test/run-pass/operator-multidispatch.rs index 8e5750005e..4ce6fcee8c 100644 --- a/src/test/run-pass/operator-multidispatch.rs +++ b/src/test/run-pass/operator-multidispatch.rs @@ -13,7 +13,7 @@ use std::ops; -#[derive(Show,PartialEq,Eq)] +#[derive(Debug,PartialEq,Eq)] struct Point { x: int, y: int diff --git a/src/test/run-pass/operator-overloading.rs b/src/test/run-pass/operator-overloading.rs index c20b7336de..3ddc666cd3 100644 --- a/src/test/run-pass/operator-overloading.rs +++ b/src/test/run-pass/operator-overloading.rs @@ -11,7 +11,7 @@ use std::cmp; use std::ops; -#[derive(Copy, Show)] +#[derive(Copy, Debug)] struct Point { x: int, y: int diff --git a/src/test/run-pass/or-pattern.rs b/src/test/run-pass/or-pattern.rs index 1a42c3ca59..654d2429a0 100644 --- a/src/test/run-pass/or-pattern.rs +++ b/src/test/run-pass/or-pattern.rs @@ -16,6 +16,6 @@ fn or_alt(q: blah) -> int { pub fn main() { assert_eq!(or_alt(blah::c), 0); - assert_eq!(or_alt(blah::a(10, 100, 0u)), 110); + assert_eq!(or_alt(blah::a(10, 100, 0_usize)), 110); assert_eq!(or_alt(blah::b(20, 200)), 220); } diff --git a/src/test/run-pass/order-drop-with-match.rs b/src/test/run-pass/order-drop-with-match.rs index a866be43a0..3710f1b9d3 100644 --- a/src/test/run-pass/order-drop-with-match.rs +++ b/src/test/run-pass/order-drop-with-match.rs @@ -60,6 +60,6 @@ fn main() { } unsafe { let expected: &[_] = &[1, 2, 3]; - assert_eq!(expected, ORDER.as_slice()); + assert_eq!(expected, ORDER); } } diff --git a/src/test/run-pass/out-of-stack-new-thread-no-split.rs b/src/test/run-pass/out-of-stack-new-thread-no-split.rs index ce6604df49..f574259c37 100644 --- a/src/test/run-pass/out-of-stack-new-thread-no-split.rs +++ b/src/test/run-pass/out-of-stack-new-thread-no-split.rs @@ -15,8 +15,8 @@ #![feature(asm)] -use std::io::process::Command; -use std::os; +use std::old_io::process::Command; +use std::env; use std::thread::Thread; // lifted from the test module @@ -28,22 +28,21 @@ pub fn black_box(dummy: T) { unsafe { asm!("" : : "r"(&dummy)) } } #[no_stack_check] fn recurse() { - let buf = [0i; 10]; + let buf = [0; 10]; black_box(buf); recurse(); } fn main() { - let args = os::args(); - let args = args.as_slice(); - if args.len() > 1 && args[1].as_slice() == "recurse" { + let args: Vec = env::args().collect(); + if args.len() > 1 && args[1] == "recurse" { let _t = Thread::scoped(recurse); } else { - let recurse = Command::new(args[0].as_slice()).arg("recurse").output().unwrap(); + let recurse = Command::new(&args[0]).arg("recurse").output().unwrap(); assert!(!recurse.status.success()); - let error = String::from_utf8_lossy(recurse.error.as_slice()); + let error = String::from_utf8_lossy(&recurse.error); println!("wut"); println!("`{}`", error); - assert!(error.as_slice().contains("has overflowed its stack")); + assert!(error.contains("has overflowed its stack")); } } diff --git a/src/test/run-pass/out-of-stack-no-split.rs b/src/test/run-pass/out-of-stack-no-split.rs index 79926776ab..948c4d064d 100644 --- a/src/test/run-pass/out-of-stack-no-split.rs +++ b/src/test/run-pass/out-of-stack-no-split.rs @@ -16,8 +16,8 @@ #![feature(asm)] -use std::io::process::Command; -use std::os; +use std::old_io::process::Command; +use std::env; // lifted from the test module // Inlining to avoid llvm turning the recursive functions into tail calls, @@ -28,20 +28,19 @@ pub fn black_box(dummy: T) { unsafe { asm!("" : : "r"(&dummy)) } } #[no_stack_check] fn recurse() { - let buf = [0i; 10]; + let buf = [0; 10]; black_box(buf); recurse(); } fn main() { - let args = os::args(); - let args = args.as_slice(); - if args.len() > 1 && args[1].as_slice() == "recurse" { + let args: Vec = env::args().collect(); + if args.len() > 1 && args[1] == "recurse" { recurse(); } else { - let recurse = Command::new(args[0].as_slice()).arg("recurse").output().unwrap(); + let recurse = Command::new(&args[0]).arg("recurse").output().unwrap(); assert!(!recurse.status.success()); - let error = String::from_utf8_lossy(recurse.error.as_slice()); - assert!(error.as_slice().contains("has overflowed its stack")); + let error = String::from_utf8_lossy(&recurse.error); + assert!(error.contains("has overflowed its stack")); } } diff --git a/src/test/run-pass/out-of-stack.rs b/src/test/run-pass/out-of-stack.rs index 1594cca89e..cc5eb69bb8 100644 --- a/src/test/run-pass/out-of-stack.rs +++ b/src/test/run-pass/out-of-stack.rs @@ -12,8 +12,8 @@ #![feature(asm)] -use std::io::process::Command; -use std::os; +use std::old_io::process::Command; +use std::env; // lifted from the test module // Inlining to avoid llvm turning the recursive functions into tail calls, @@ -22,7 +22,7 @@ use std::os; pub fn black_box(dummy: T) { unsafe { asm!("" : : "r"(&dummy)) } } fn silent_recurse() { - let buf = [0i; 1000]; + let buf = [0; 1000]; black_box(buf); silent_recurse(); } @@ -34,21 +34,20 @@ fn loud_recurse() { } fn main() { - let args = os::args(); - let args = args.as_slice(); - if args.len() > 1 && args[1].as_slice() == "silent" { + let args: Vec = env::args().collect(); + if args.len() > 1 && args[1] == "silent" { silent_recurse(); - } else if args.len() > 1 && args[1].as_slice() == "loud" { + } else if args.len() > 1 && args[1] == "loud" { loud_recurse(); } else { - let silent = Command::new(args[0].as_slice()).arg("silent").output().unwrap(); + let silent = Command::new(&args[0]).arg("silent").output().unwrap(); assert!(!silent.status.success()); - let error = String::from_utf8_lossy(silent.error.as_slice()); - assert!(error.as_slice().contains("has overflowed its stack")); + let error = String::from_utf8_lossy(&silent.error); + assert!(error.contains("has overflowed its stack")); - let loud = Command::new(args[0].as_slice()).arg("loud").output().unwrap(); + let loud = Command::new(&args[0]).arg("loud").output().unwrap(); assert!(!loud.status.success()); - let error = String::from_utf8_lossy(silent.error.as_slice()); - assert!(error.as_slice().contains("has overflowed its stack")); + let error = String::from_utf8_lossy(&silent.error); + assert!(error.contains("has overflowed its stack")); } } diff --git a/src/test/run-pass/out-pointer-aliasing.rs b/src/test/run-pass/out-pointer-aliasing.rs index 5f399deb88..eee9838da2 100644 --- a/src/test/run-pass/out-pointer-aliasing.rs +++ b/src/test/run-pass/out-pointer-aliasing.rs @@ -8,13 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[derive(Copy)] pub struct Foo { f1: int, _f2: int, } -impl Copy for Foo {} - #[inline(never)] pub fn foo(f: &mut Foo) -> Foo { let ret = *f; diff --git a/src/test/run-pass/over-constrained-vregs.rs b/src/test/run-pass/over-constrained-vregs.rs index 4cd8e65e50..1118638fe0 100644 --- a/src/test/run-pass/over-constrained-vregs.rs +++ b/src/test/run-pass/over-constrained-vregs.rs @@ -10,10 +10,10 @@ // Regression test for issue #152. pub fn main() { - let mut b: uint = 1u; - while b <= 32u { - 0u << b; - b <<= 1u; + let mut b: uint = 1_usize; + while b <= 32_usize { + 0_usize << b; + b <<= 1_usize; println!("{}", b); } } diff --git a/src/test/run-pass/overloaded-autoderef-count.rs b/src/test/run-pass/overloaded-autoderef-count.rs index f0646853b6..cc36b625c3 100644 --- a/src/test/run-pass/overloaded-autoderef-count.rs +++ b/src/test/run-pass/overloaded-autoderef-count.rs @@ -48,7 +48,7 @@ impl DerefMut for DerefCounter { } } -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct Point { x: int, y: int diff --git a/src/test/run-pass/overloaded-autoderef-indexing.rs b/src/test/run-pass/overloaded-autoderef-indexing.rs index de37173810..4cb7ece4ab 100644 --- a/src/test/run-pass/overloaded-autoderef-indexing.rs +++ b/src/test/run-pass/overloaded-autoderef-indexing.rs @@ -23,6 +23,6 @@ impl<'a, T> Deref for DerefArray<'a, T> { } pub fn main() { - let a = &[1i, 2i, 3i]; + let a = &[1, 2, 3]; assert_eq!(DerefArray {inner: a}[1], 2); } diff --git a/src/test/run-pass/overloaded-autoderef-order.rs b/src/test/run-pass/overloaded-autoderef-order.rs index c34aed42c9..d023a01f4b 100644 --- a/src/test/run-pass/overloaded-autoderef-order.rs +++ b/src/test/run-pass/overloaded-autoderef-order.rs @@ -11,13 +11,12 @@ use std::rc::Rc; use std::ops::Deref; +#[derive(Copy)] struct DerefWrapper { x: X, y: Y } -impl Copy for DerefWrapper {} - impl DerefWrapper { fn get_x(self) -> X { self.x @@ -35,13 +34,12 @@ impl Deref for DerefWrapper { mod priv_test { use std::ops::Deref; + #[derive(Copy)] pub struct DerefWrapperHideX { x: X, pub y: Y } - impl Copy for DerefWrapperHideX {} - impl DerefWrapperHideX { pub fn new(x: X, y: Y) -> DerefWrapperHideX { DerefWrapperHideX { @@ -61,7 +59,7 @@ mod priv_test { } pub fn main() { - let nested = DerefWrapper {x: true, y: DerefWrapper {x: 0i, y: 1i}}; + let nested = DerefWrapper {x: true, y: DerefWrapper {x: 0, y: 1}}; // Use the first field that you can find. assert_eq!(nested.x, true); @@ -75,7 +73,7 @@ pub fn main() { // Also go through multiple levels of indirection. assert_eq!(Rc::new(nested).x, true); - let nested_priv = priv_test::DerefWrapperHideX::new(true, DerefWrapper {x: 0i, y: 1i}); + let nested_priv = priv_test::DerefWrapperHideX::new(true, DerefWrapper {x: 0, y: 1}); // FIXME(eddyb) #12808 should skip private fields. // assert_eq!(nested_priv.x, 0); assert_eq!((*nested_priv).x, 0); diff --git a/src/test/run-pass/overloaded-autoderef-vtable.rs b/src/test/run-pass/overloaded-autoderef-vtable.rs index be2b309b82..d50f2efe0e 100644 --- a/src/test/run-pass/overloaded-autoderef-vtable.rs +++ b/src/test/run-pass/overloaded-autoderef-vtable.rs @@ -11,7 +11,8 @@ use std::ops::Deref; struct DerefWithHelper { - helper: H + helper: H, + value: T } trait Helper { @@ -39,6 +40,7 @@ impl Foo { } pub fn main() { - let x: DerefWithHelper, Foo> = DerefWithHelper { helper: Some(Foo {x: 5}) }; + let x: DerefWithHelper, Foo> = + DerefWithHelper { helper: Some(Foo {x: 5}), value: Foo { x: 2 } }; assert!(x.foo() == 5); } diff --git a/src/test/run-pass/overloaded-autoderef-xcrate.rs b/src/test/run-pass/overloaded-autoderef-xcrate.rs index 4f449b344e..f8dd729ec6 100644 --- a/src/test/run-pass/overloaded-autoderef-xcrate.rs +++ b/src/test/run-pass/overloaded-autoderef-xcrate.rs @@ -13,5 +13,5 @@ extern crate overloaded_autoderef_xc; fn main() { - assert!(overloaded_autoderef_xc::check(5i, 5i)); + assert!(overloaded_autoderef_xc::check(5, 5)); } diff --git a/src/test/run-pass/overloaded-autoderef.rs b/src/test/run-pass/overloaded-autoderef.rs index 5831d500b8..f40c9dc45c 100644 --- a/src/test/run-pass/overloaded-autoderef.rs +++ b/src/test/run-pass/overloaded-autoderef.rs @@ -15,39 +15,40 @@ use std::cell::RefCell; use std::rc::Rc; use std::num::ToPrimitive; -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct Point { x: int, y: int } pub fn main() { - assert_eq!(Rc::new(5u).to_uint(), Some(5)); - assert_eq!((box &box &Rc::new(box box &box 5u)).to_uint(), Some(5)); + let box_5 = box 5_usize; + assert_eq!(Rc::new(5_usize).to_uint(), Some(5)); + assert_eq!((box &box &Rc::new(box box &box_5)).to_uint(), Some(5)); let point = Rc::new(Point {x: 2, y: 4}); assert_eq!(point.x, 2); assert_eq!(point.y, 4); - let i = Rc::new(RefCell::new(2i)); + let i = Rc::new(RefCell::new(2)); let i_value = *i.borrow(); *i.borrow_mut() = 5; assert_eq!((i_value, *i.borrow()), (2, 5)); let s = Rc::new("foo".to_string()); - assert_eq!(s.as_slice(), "foo"); + assert_eq!(&**s, "foo"); let mut_s = Rc::new(RefCell::new(String::from_str("foo"))); mut_s.borrow_mut().push_str("bar"); // HACK assert_eq! would panic here because it stores the LHS and RHS in two locals. - assert!(mut_s.borrow().as_slice() == "foobar"); - assert!(mut_s.borrow_mut().as_slice() == "foobar"); + assert!(&**mut_s.borrow() == "foobar"); + assert!(&**mut_s.borrow_mut() == "foobar"); let p = Rc::new(RefCell::new(Point {x: 1, y: 2})); p.borrow_mut().x = 3; p.borrow_mut().y += 3; assert_eq!(*p.borrow(), Point {x: 3, y: 5}); - let v = Rc::new(RefCell::new([1i, 2, 3])); + let v = Rc::new(RefCell::new([1, 2, 3])); v.borrow_mut()[0] = 3; v.borrow_mut()[1] += 3; assert_eq!((v.borrow()[0], v.borrow()[1], v.borrow()[2]), (3, 5, 3)); diff --git a/src/test/run-pass/overloaded-calls-param-vtables.rs b/src/test/run-pass/overloaded-calls-param-vtables.rs index 56887636d5..2ef9e08134 100644 --- a/src/test/run-pass/overloaded-calls-param-vtables.rs +++ b/src/test/run-pass/overloaded-calls-param-vtables.rs @@ -12,18 +12,21 @@ #![feature(unboxed_closures)] +use std::marker::PhantomData; use std::ops::Fn; use std::ops::Add; -struct G; +struct G(PhantomData); -impl<'a, A: Add> Fn<(A,), int> for G { - extern "rust-call" fn call(&self, (arg,): (A,)) -> int { +impl<'a, A: Add> Fn<(A,)> for G { + type Output = i32; + + extern "rust-call" fn call(&self, (arg,): (A,)) -> i32 { arg.add(1) } } fn main() { // ICE trigger - G(1i); + (G(PhantomData))(1_i32); } diff --git a/src/test/run-pass/overloaded-calls-simple.rs b/src/test/run-pass/overloaded-calls-simple.rs index bb5b88d367..f9e838d9b3 100644 --- a/src/test/run-pass/overloaded-calls-simple.rs +++ b/src/test/run-pass/overloaded-calls-simple.rs @@ -13,34 +13,37 @@ use std::ops::{Fn, FnMut, FnOnce}; struct S1 { - x: int, - y: int, + x: i32, + y: i32, } -impl FnMut<(int,),int> for S1 { - extern "rust-call" fn call_mut(&mut self, (z,): (int,)) -> int { +impl FnMut<(i32,)> for S1 { + type Output = i32; + extern "rust-call" fn call_mut(&mut self, (z,): (i32,)) -> i32 { self.x * self.y * z } } struct S2 { - x: int, - y: int, + x: i32, + y: i32, } -impl Fn<(int,),int> for S2 { - extern "rust-call" fn call(&self, (z,): (int,)) -> int { +impl Fn<(i32,)> for S2 { + type Output = i32; + extern "rust-call" fn call(&self, (z,): (i32,)) -> i32 { self.x * self.y * z } } struct S3 { - x: int, - y: int, + x: i32, + y: i32, } -impl FnOnce<(int,int),int> for S3 { - extern "rust-call" fn call_once(self, (z,zz): (int,int)) -> int { +impl FnOnce<(i32,i32)> for S3 { + type Output = i32; + extern "rust-call" fn call_once(self, (z,zz): (i32,i32)) -> i32 { self.x * self.y * z * zz } } diff --git a/src/test/run-pass/overloaded-calls-zero-args.rs b/src/test/run-pass/overloaded-calls-zero-args.rs index 809a251fe8..ce7395673b 100644 --- a/src/test/run-pass/overloaded-calls-zero-args.rs +++ b/src/test/run-pass/overloaded-calls-zero-args.rs @@ -13,12 +13,13 @@ use std::ops::{FnMut}; struct S { - x: int, - y: int, + x: i32, + y: i32, } -impl FnMut<(),int> for S { - extern "rust-call" fn call_mut(&mut self, (): ()) -> int { +impl FnMut<()> for S { + type Output = i32; + extern "rust-call" fn call_mut(&mut self, (): ()) -> i32 { self.x * self.y } } diff --git a/src/test/run-pass/overloaded-deref-count.rs b/src/test/run-pass/overloaded-deref-count.rs index 5cd7687979..f3091b53e8 100644 --- a/src/test/run-pass/overloaded-deref-count.rs +++ b/src/test/run-pass/overloaded-deref-count.rs @@ -49,7 +49,7 @@ impl DerefMut for DerefCounter { } pub fn main() { - let mut n = DerefCounter::new(0i); + let mut n = DerefCounter::new(0); let mut v = DerefCounter::new(Vec::new()); let _ = *n; // Immutable deref + copy a POD. @@ -62,7 +62,7 @@ pub fn main() { assert_eq!(n.counts(), (2, 1)); assert_eq!(v.counts(), (1, 1)); let mut v2 = Vec::new(); - v2.push(1i); + v2.push(1); *n = 5; *v = v2; // Mutable deref + assignment. assert_eq!(n.counts(), (2, 2)); assert_eq!(v.counts(), (1, 2)); @@ -82,5 +82,5 @@ pub fn main() { // Check the final states. assert_eq!(*n, 2); let expected: &[_] = &[1, 2]; - assert_eq!((*v).as_slice(), expected); + assert_eq!((*v), expected); } diff --git a/src/test/run-pass/overloaded-deref.rs b/src/test/run-pass/overloaded-deref.rs index a2cc7b7dfe..f56e7d56fe 100644 --- a/src/test/run-pass/overloaded-deref.rs +++ b/src/test/run-pass/overloaded-deref.rs @@ -15,38 +15,38 @@ use std::cell::RefCell; use std::rc::Rc; use std::string::String; -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct Point { x: int, y: int } pub fn main() { - assert_eq!(*Rc::new(5i), 5); - assert_eq!(***Rc::new(box box 5i), 5); + assert_eq!(*Rc::new(5), 5); + assert_eq!(***Rc::new(box box 5), 5); assert_eq!(*Rc::new(Point {x: 2, y: 4}), Point {x: 2, y: 4}); - let i = Rc::new(RefCell::new(2i)); + let i = Rc::new(RefCell::new(2)); let i_value = *(*i).borrow(); *(*i).borrow_mut() = 5; assert_eq!((i_value, *(*i).borrow()), (2, 5)); let s = Rc::new("foo".to_string()); assert_eq!(*s, "foo".to_string()); - assert_eq!((*s).as_slice(), "foo"); + assert_eq!((*s), "foo"); let mut_s = Rc::new(RefCell::new(String::from_str("foo"))); (*(*mut_s).borrow_mut()).push_str("bar"); // assert_eq! would panic here because it stores the LHS and RHS in two locals. - assert!((*(*mut_s).borrow()).as_slice() == "foobar"); - assert!((*(*mut_s).borrow_mut()).as_slice() == "foobar"); + assert!((*(*mut_s).borrow()) == "foobar"); + assert!((*(*mut_s).borrow_mut()) == "foobar"); let p = Rc::new(RefCell::new(Point {x: 1, y: 2})); (*(*p).borrow_mut()).x = 3; (*(*p).borrow_mut()).y += 3; assert_eq!(*(*p).borrow(), Point {x: 3, y: 5}); - let v = Rc::new(RefCell::new(vec!(1i, 2, 3))); + let v = Rc::new(RefCell::new(vec!(1, 2, 3))); (*(*v).borrow_mut())[0] = 3; (*(*v).borrow_mut())[1] += 3; assert_eq!(((*(*v).borrow())[0], diff --git a/src/test/run-pass/overloaded-index-assoc-list.rs b/src/test/run-pass/overloaded-index-assoc-list.rs index 2e044227eb..0064748e88 100644 --- a/src/test/run-pass/overloaded-index-assoc-list.rs +++ b/src/test/run-pass/overloaded-index-assoc-list.rs @@ -28,11 +28,11 @@ impl AssociationList { } } -impl Index for AssociationList { +impl Index for AssociationList { type Output = V; fn index<'a>(&'a self, index: &K) -> &'a V { - for pair in self.pairs.iter() { + for pair in &self.pairs { if pair.key == *index { return &pair.value } @@ -46,8 +46,8 @@ pub fn main() { let bar = "bar".to_string(); let mut list = AssociationList {pairs: Vec::new()}; - list.push(foo.clone(), 22i); - list.push(bar.clone(), 44i); + list.push(foo.clone(), 22); + list.push(bar.clone(), 44); assert!(list[foo] == 22); assert!(list[bar] == 44); diff --git a/src/test/run-pass/overloaded-index-autoderef.rs b/src/test/run-pass/overloaded-index-autoderef.rs index 637d2c9469..d5ccf8cd2b 100644 --- a/src/test/run-pass/overloaded-index-autoderef.rs +++ b/src/test/run-pass/overloaded-index-autoderef.rs @@ -33,8 +33,6 @@ impl Index for Foo { } impl IndexMut for Foo { - type Output = int; - fn index_mut(&mut self, z: &int) -> &mut int { if *z == 0 { &mut self.x diff --git a/src/test/run-pass/overloaded-index.rs b/src/test/run-pass/overloaded-index.rs index 0afdb24a81..10ca3804ea 100644 --- a/src/test/run-pass/overloaded-index.rs +++ b/src/test/run-pass/overloaded-index.rs @@ -28,8 +28,6 @@ impl Index for Foo { } impl IndexMut for Foo { - type Output = int; - fn index_mut(&mut self, z: &int) -> &mut int { if *z == 0 { &mut self.x diff --git a/src/test/run-pass/owned-implies-static.rs b/src/test/run-pass/owned-implies-static.rs index e784318fc7..2db6f7ffaa 100644 --- a/src/test/run-pass/owned-implies-static.rs +++ b/src/test/run-pass/owned-implies-static.rs @@ -14,5 +14,5 @@ fn f(_x: T) {} pub fn main() { - f(box 5i); + f(box 5); } diff --git a/src/test/run-pass/packed-struct-vec.rs b/src/test/run-pass/packed-struct-vec.rs index 8e5decf5e6..cfe49c38c5 100644 --- a/src/test/run-pass/packed-struct-vec.rs +++ b/src/test/run-pass/packed-struct-vec.rs @@ -13,24 +13,22 @@ use std::mem; #[repr(packed)] -#[derive(PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] struct Foo { bar: u8, baz: u64 } -impl Copy for Foo {} - pub fn main() { let foos = [Foo { bar: 1, baz: 2 }; 10]; assert_eq!(mem::size_of::<[Foo; 10]>(), 90); - for i in range(0u, 10) { + for i in 0_usize..10 { assert_eq!(foos[i], Foo { bar: 1, baz: 2}); } - for &foo in foos.iter() { + for &foo in &foos { assert_eq!(foo, Foo { bar: 1, baz: 2 }); } } diff --git a/src/test/run-pass/panic-in-dtor-drops-fields.rs b/src/test/run-pass/panic-in-dtor-drops-fields.rs index 3cc01b967c..6da15b97ac 100644 --- a/src/test/run-pass/panic-in-dtor-drops-fields.rs +++ b/src/test/run-pass/panic-in-dtor-drops-fields.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::thread::Thread; +use std::thread; static mut dropped: bool = false; @@ -33,7 +33,7 @@ impl Drop for B { } pub fn main() { - let ret = Thread::scoped(move|| { + let ret = thread::spawn(move|| { let _a = A { b: B { foo: 3 } }; }).join(); assert!(ret.is_err()); diff --git a/src/test/run-pass/parameterized-trait-with-bounds.rs b/src/test/run-pass/parameterized-trait-with-bounds.rs index 840e58848a..061c916895 100644 --- a/src/test/run-pass/parameterized-trait-with-bounds.rs +++ b/src/test/run-pass/parameterized-trait-with-bounds.rs @@ -11,12 +11,12 @@ #![allow(dead_code)] -trait A {} -trait B {} -trait C<'a, U> {} +trait A { fn get(self) -> T; } +trait B { fn get(self) -> (T,U); } +trait C<'a, U> { fn get(self) -> &'a U; } mod foo { - pub trait D<'a, T> {} + pub trait D<'a, T> { fn get(self) -> &'a T; } } fn foo1(_: &(A + Send)) {} diff --git a/src/test/run-pass/paren-free.rs b/src/test/run-pass/paren-free.rs index 569023c443..d9669812d2 100644 --- a/src/test/run-pass/paren-free.rs +++ b/src/test/run-pass/paren-free.rs @@ -10,6 +10,6 @@ pub fn main() { let x = true; - if x { let mut i = 10i; while i > 0 { i -= 1; } } + if x { let mut i = 10; while i > 0 { i -= 1; } } match x { true => { println!("right"); } false => { println!("wrong"); } } } diff --git a/src/test/run-pass/parse-complex-macro-invoc-op.rs b/src/test/run-pass/parse-complex-macro-invoc-op.rs index e9ec624c13..0995910fd4 100644 --- a/src/test/run-pass/parse-complex-macro-invoc-op.rs +++ b/src/test/run-pass/parse-complex-macro-invoc-op.rs @@ -17,24 +17,24 @@ macro_rules! id { } fn foo() { - id!(1i) + 1; - id![1i] - 1; - id!(1i) * 1; - id![1i] / 1; - id!(1i) % 1; + id!(1) + 1; + id![1] - 1; + id!(1) * 1; + id![1] / 1; + id!(1) % 1; - id!(1i) & 1; - id![1i] | 1; - id!(1i) ^ 1; + id!(1) & 1; + id![1] | 1; + id!(1) ^ 1; - let mut x = 1i; + let mut x = 1; id![x] = 2; id!(x) += 1; id!(1f64).clone(); - id!([1i, 2, 3])[1]; - id![drop](1i); + id!([1, 2, 3])[1]; + id![drop](1); id!(true) && true; id![true] || true; diff --git a/src/test/run-pass/parse-panic.rs b/src/test/run-pass/parse-panic.rs index 0dbba3654b..22b24ebb3b 100644 --- a/src/test/run-pass/parse-panic.rs +++ b/src/test/run-pass/parse-panic.rs @@ -10,6 +10,6 @@ #![allow(unreachable_code)] -fn dont_call_me() { panic!(); println!("{}", 1i); } +fn dont_call_me() { panic!(); println!("{}", 1); } pub fn main() { } diff --git a/src/test/run-pass/path.rs b/src/test/run-pass/path.rs index 44953c44da..02d8602d59 100644 --- a/src/test/run-pass/path.rs +++ b/src/test/run-pass/path.rs @@ -14,4 +14,4 @@ mod foo { pub fn bar(_offset: uint) { } } -pub fn main() { foo::bar(0u); } +pub fn main() { foo::bar(0_usize); } diff --git a/src/test/run-pass/pattern-bound-var-in-for-each.rs b/src/test/run-pass/pattern-bound-var-in-for-each.rs index fde1999e72..7d9c3d324f 100644 --- a/src/test/run-pass/pattern-bound-var-in-for-each.rs +++ b/src/test/run-pass/pattern-bound-var-in-for-each.rs @@ -16,13 +16,13 @@ fn foo(src: uint) { match Some(src) { Some(src_id) => { - for _i in range(0u, 10u) { + for _i in 0_usize..10_usize { let yyy = src_id; - assert_eq!(yyy, 0u); + assert_eq!(yyy, 0_usize); } } _ => { } } } -pub fn main() { foo(0u); } +pub fn main() { foo(0_usize); } diff --git a/src/test/run-pass/pattern-in-closure.rs b/src/test/run-pass/pattern-in-closure.rs index c718b948f8..e4f1df2d63 100644 --- a/src/test/run-pass/pattern-in-closure.rs +++ b/src/test/run-pass/pattern-in-closure.rs @@ -14,8 +14,8 @@ struct Foo { } pub fn main() { - let f = |&: (x, _): (int, int)| println!("{}", x + 1); - let g = |&: Foo { x: x, y: _y }: Foo| println!("{}", x + 1); + let f = |(x, _): (int, int)| println!("{}", x + 1); + let g = |Foo { x: x, y: _y }: Foo| println!("{}", x + 1); f((2, 3)); g(Foo { x: 1, y: 2 }); } diff --git a/src/test/run-pass/placement-new-arena.rs b/src/test/run-pass/placement-new-arena.rs index 1ca7e5aa3c..7ad93d271a 100644 --- a/src/test/run-pass/placement-new-arena.rs +++ b/src/test/run-pass/placement-new-arena.rs @@ -15,7 +15,7 @@ use arena::Arena; pub fn main() { let mut arena = Arena::new(); let p = &mut arena; - let x = p.alloc(|| 4u); + let x = p.alloc(|| 4_usize); println!("{}", *x); - assert_eq!(*x, 4u); + assert_eq!(*x, 4_usize); } diff --git a/src/test/run-pass/priv-impl-prim-ty.rs b/src/test/run-pass/priv-impl-prim-ty.rs index a8cd5e789b..679aa3d668 100644 --- a/src/test/run-pass/priv-impl-prim-ty.rs +++ b/src/test/run-pass/priv-impl-prim-ty.rs @@ -13,6 +13,6 @@ extern crate "priv-impl-prim-ty" as bar; pub fn main() { - bar::frob(1i); + bar::frob(1); } diff --git a/src/test/run-pass/privacy-ns.rs b/src/test/run-pass/privacy-ns.rs index f3380352f5..e9b8e694d6 100644 --- a/src/test/run-pass/privacy-ns.rs +++ b/src/test/run-pass/privacy-ns.rs @@ -19,6 +19,7 @@ // public type, private value pub mod foo1 { pub trait Bar { + fn dummy(&self) { } } pub struct Baz; @@ -50,6 +51,7 @@ fn test_glob1() { // private type, public value pub mod foo2 { trait Bar { + fn dummy(&self) { } } pub struct Baz; @@ -81,6 +83,7 @@ fn test_glob2() { // public type, public value pub mod foo3 { pub trait Bar { + fn dummy(&self) { } } pub struct Baz; diff --git a/src/test/run-pass/private-class-field.rs b/src/test/run-pass/private-class-field.rs index 93872bebec..c7380b362f 100644 --- a/src/test/run-pass/private-class-field.rs +++ b/src/test/run-pass/private-class-field.rs @@ -26,6 +26,6 @@ fn cat(in_x : uint, in_y : int) -> cat { } pub fn main() { - let mut nyan : cat = cat(52u, 99); - assert_eq!(nyan.meow_count(), 52u); + let mut nyan : cat = cat(52_usize, 99); + assert_eq!(nyan.meow_count(), 52_usize); } diff --git a/src/test/run-pass/private-method.rs b/src/test/run-pass/private-method.rs index b64ca955cd..498bd04e37 100644 --- a/src/test/run-pass/private-method.rs +++ b/src/test/run-pass/private-method.rs @@ -16,13 +16,13 @@ struct cat { impl cat { pub fn play(&mut self) { - self.meows += 1u; + self.meows += 1_usize; self.nap(); } } impl cat { - fn nap(&mut self) { for _ in range(1u, 10u) { } } + fn nap(&mut self) { for _ in 1_usize..10_usize { } } } fn cat(in_x : uint, in_y : int) -> cat { @@ -33,6 +33,6 @@ fn cat(in_x : uint, in_y : int) -> cat { } pub fn main() { - let mut nyan : cat = cat(52u, 99); + let mut nyan : cat = cat(52_usize, 99); nyan.play(); } diff --git a/src/test/run-pass/process-remove-from-env.rs b/src/test/run-pass/process-remove-from-env.rs index eab9c8a95d..9eb7d624c9 100644 --- a/src/test/run-pass/process-remove-from-env.rs +++ b/src/test/run-pass/process-remove-from-env.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::io::Command; -use std::os; +use std::old_io::Command; +use std::env; #[cfg(all(unix, not(target_os="android")))] pub fn env_cmd() -> Command { @@ -31,23 +31,23 @@ pub fn env_cmd() -> Command { fn main() { // save original environment - let old_env = os::getenv("RUN_TEST_NEW_ENV"); + let old_env = env::var_os("RUN_TEST_NEW_ENV"); - os::setenv("RUN_TEST_NEW_ENV", "123"); + env::set_var("RUN_TEST_NEW_ENV", "123"); let mut cmd = env_cmd(); cmd.env_remove("RUN_TEST_NEW_ENV"); // restore original environment match old_env { - None => os::unsetenv("RUN_TEST_NEW_ENV"), - Some(val) => os::setenv("RUN_TEST_NEW_ENV", val.as_slice()) + None => env::remove_var("RUN_TEST_NEW_ENV"), + Some(val) => env::set_var("RUN_TEST_NEW_ENV", &val) } let prog = cmd.spawn().unwrap(); let result = prog.wait_with_output().unwrap(); - let output = String::from_utf8_lossy(result.output.as_slice()); + let output = String::from_utf8_lossy(&result.output); - assert!(!output.as_slice().contains("RUN_TEST_NEW_ENV"), + assert!(!output.contains("RUN_TEST_NEW_ENV"), "found RUN_TEST_NEW_ENV inside of:\n\n{}", output); } diff --git a/src/test/run-pass/process-spawn-with-unicode-params.rs b/src/test/run-pass/process-spawn-with-unicode-params.rs index cceb0bf4d9..017784990f 100644 --- a/src/test/run-pass/process-spawn-with-unicode-params.rs +++ b/src/test/run-pass/process-spawn-with-unicode-params.rs @@ -16,16 +16,17 @@ // non-ASCII characters. The child process ensures all the strings are // intact. -use std::io; -use std::io::fs; -use std::io::Command; +use std::old_io; +use std::old_io::fs; +use std::old_io::Command; use std::os; -use std::path::Path; +use std::env; +use std::old_path::Path; fn main() { - let my_args = os::args(); + let my_args = env::args().collect::>(); let my_cwd = os::getcwd().unwrap(); - let my_env = os::env(); + let my_env = env::vars().collect::>(); let my_path = Path::new(os::self_exe_name().unwrap()); let my_dir = my_path.dir_path(); let my_ext = my_path.extension_str().unwrap_or(""); @@ -49,7 +50,7 @@ fn main() { let child_path = cwd.join(child_filename); // make a separate directory for the child - drop(fs::mkdir(&cwd, io::USER_RWX).is_ok()); + drop(fs::mkdir(&cwd, old_io::USER_RWX).is_ok()); assert!(fs::copy(&my_path, &child_path).is_ok()); let mut my_env = my_env; my_env.push(env); @@ -58,12 +59,12 @@ fn main() { let p = Command::new(&child_path) .arg(arg) .cwd(&cwd) - .env_set_all(my_env.as_slice()) + .env_set_all(&my_env) .spawn().unwrap().wait_with_output().unwrap(); // display the output - assert!(io::stdout().write(p.output.as_slice()).is_ok()); - assert!(io::stderr().write(p.error.as_slice()).is_ok()); + assert!(old_io::stdout().write(&p.output).is_ok()); + assert!(old_io::stderr().write(&p.error).is_ok()); // make sure the child succeeded assert!(p.status.success()); @@ -74,7 +75,7 @@ fn main() { assert!(my_cwd.ends_with_path(&Path::new(child_dir))); // check arguments - assert_eq!(my_args[1].as_slice(), arg); + assert_eq!(&*my_args[1], arg); // check environment variable assert!(my_env.contains(&env)); diff --git a/src/test/run-pass/ptr-coercion.rs b/src/test/run-pass/ptr-coercion.rs index 1b77c1316e..a6a8890101 100644 --- a/src/test/run-pass/ptr-coercion.rs +++ b/src/test/run-pass/ptr-coercion.rs @@ -12,24 +12,24 @@ pub fn main() { // &mut -> & - let x: &mut int = &mut 42i; + let x: &mut int = &mut 42; let x: &int = x; - let x: &int = &mut 42i; + let x: &int = &mut 42; // & -> *const - let x: &int = &42i; + let x: &int = &42; let x: *const int = x; - let x: *const int = &42i; + let x: *const int = &42; // &mut -> *const - let x: &mut int = &mut 42i; + let x: &mut int = &mut 42; let x: *const int = x; - let x: *const int = &mut 42i; + let x: *const int = &mut 42; // *mut -> *const - let x: *mut int = &mut 42i; + let x: *mut int = &mut 42; let x: *const int = x; } diff --git a/src/test/run-pass/pub-extern-privacy.rs b/src/test/run-pass/pub-extern-privacy.rs index 16f5a06b88..7428377b59 100644 --- a/src/test/run-pass/pub-extern-privacy.rs +++ b/src/test/run-pass/pub-extern-privacy.rs @@ -18,6 +18,6 @@ mod a { pub fn main() { unsafe { - a::free(transmute(0u)); + a::free(transmute(0_usize)); } } diff --git a/src/test/run-pass/pub-item-inside-macro.rs b/src/test/run-pass/pub-item-inside-macro.rs new file mode 100644 index 0000000000..442eea13d6 --- /dev/null +++ b/src/test/run-pass/pub-item-inside-macro.rs @@ -0,0 +1,25 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Issue #14660 + +mod bleh { + macro_rules! foo { + () => { + pub fn bar() { } + } + } + + foo!(); +} + +fn main() { + bleh::bar(); +} diff --git a/src/test/run-pass/pub-method-inside-macro.rs b/src/test/run-pass/pub-method-inside-macro.rs new file mode 100644 index 0000000000..af2f217c1f --- /dev/null +++ b/src/test/run-pass/pub-method-inside-macro.rs @@ -0,0 +1,29 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Issue #17436 + +mod bleh { + macro_rules! foo { + () => { + pub fn bar(&self) { } + } + } + + pub struct S; + + impl S { + foo!(); + } +} + +fn main() { + bleh::S.bar(); +} diff --git a/src/test/run-pass/pure-sum.rs b/src/test/run-pass/pure-sum.rs index 7fbdd2f219..f7adb0f6e4 100644 --- a/src/test/run-pass/pure-sum.rs +++ b/src/test/run-pass/pure-sum.rs @@ -14,31 +14,31 @@ #![feature(box_syntax)] fn sums_to(v: Vec , sum: int) -> bool { - let mut i = 0u; + let mut i = 0_usize; let mut sum0 = 0; while i < v.len() { sum0 += v[i]; - i += 1u; + i += 1_usize; } return sum0 == sum; } fn sums_to_using_uniq(v: Vec , sum: int) -> bool { - let mut i = 0u; + let mut i = 0_usize; let mut sum0 = box 0; while i < v.len() { *sum0 += v[i]; - i += 1u; + i += 1_usize; } return *sum0 == sum; } fn sums_to_using_rec(v: Vec , sum: int) -> bool { - let mut i = 0u; + let mut i = 0_usize; let mut sum0 = F {f: 0}; while i < v.len() { sum0.f += v[i]; - i += 1u; + i += 1_usize; } return sum0.f == sum; } @@ -46,11 +46,11 @@ fn sums_to_using_rec(v: Vec , sum: int) -> bool { struct F { f: T } fn sums_to_using_uniq_rec(v: Vec , sum: int) -> bool { - let mut i = 0u; + let mut i = 0_usize; let mut sum0 = F {f: box 0}; while i < v.len() { *sum0.f += v[i]; - i += 1u; + i += 1_usize; } return *sum0.f == sum; } diff --git a/src/test/run-pass/range-type-infer.rs b/src/test/run-pass/range-type-infer.rs new file mode 100644 index 0000000000..51945a4677 --- /dev/null +++ b/src/test/run-pass/range-type-infer.rs @@ -0,0 +1,28 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Make sure the type inference for the new range expression work as +// good as the old one. Check out issue #21672, #21595 and #21649 for +// more details. + +fn main() { + let xs = (0..8).map(|i| i == 1u64).collect::>(); + assert_eq!(xs[1], true); + let xs = (0..8).map(|i| 1u64 == i).collect::>(); + assert_eq!(xs[1], true); + let xs: Vec = (0..10).collect(); + assert_eq!(xs.len(), 10); + + for x in 0..10 { x % 2; } + for x in 0..100 { x as f32; } + + let array = [true, false]; + for i in 0..1 { array[i]; } +} diff --git a/src/test/run-pass/range.rs b/src/test/run-pass/range.rs index 90e8716899..50b90b1a5e 100644 --- a/src/test/run-pass/range.rs +++ b/src/test/run-pass/range.rs @@ -12,16 +12,20 @@ fn foo() -> int { 42 } +// Test that range syntax works in return statements +fn return_range_to() -> ::std::ops::RangeTo { return ..1; } +fn return_full_range() -> ::std::ops::RangeFull { return ..; } + pub fn main() { let mut count = 0; - for i in 0u..10 { + for i in 0_usize..10 { assert!(i >= 0 && i < 10); count += i; } assert!(count == 45); let mut count = 0; - let mut range = 0u..10; + let mut range = 0_usize..10; for i in range { assert!(i >= 0 && i < 10); count += i; @@ -29,22 +33,22 @@ pub fn main() { assert!(count == 45); let mut count = 0; - let mut rf = 3u..; + let mut rf = 3_usize..; for i in rf.take(10) { assert!(i >= 3 && i < 13); count += i; } assert!(count == 75); - let _ = 0u..4+4-3; + let _ = 0_usize..4+4-3; let _ = 0..foo(); - let _ = ..42u; + let _ = ..42_usize; // Test we can use two different types with a common supertype. - let x = &42i; + let x = &42; { - let y = 42i; + let y = 42; let _ = x..&y; } } diff --git a/src/test/run-pass/ranges-precedence.rs b/src/test/run-pass/ranges-precedence.rs index f678eed877..db414abb7f 100644 --- a/src/test/run-pass/ranges-precedence.rs +++ b/src/test/run-pass/ranges-precedence.rs @@ -10,7 +10,6 @@ // Test that the precedence of ranges is correct -#![feature(slicing_syntax)] struct Foo { foo: uint, @@ -48,5 +47,15 @@ fn main() { assert!(x == &a[3..]); for _i in 2+4..10-3 {} + + let i = 42; + for _ in 1..i {} + for _ in 1.. { break; } + + let x = [1]..[2]; + assert!(x == (([1])..([2]))); + + let y = ..; + assert!(y == (..)); } diff --git a/src/test/run-pass/rcvr-borrowed-to-slice.rs b/src/test/run-pass/rcvr-borrowed-to-slice.rs index aad281dbeb..6a5da01499 100644 --- a/src/test/run-pass/rcvr-borrowed-to-slice.rs +++ b/src/test/run-pass/rcvr-borrowed-to-slice.rs @@ -24,17 +24,17 @@ fn call_sum(x: &[int]) -> int { x.sum_() } pub fn main() { let x = vec!(1, 2, 3); - let y = call_sum(x.as_slice()); + let y = call_sum(&x); println!("y=={}", y); assert_eq!(y, 6); let x = vec!(1, 2, 3); - let y = x.as_slice().sum_(); + let y = x.sum_(); println!("y=={}", y); assert_eq!(y, 6); let x = vec!(1, 2, 3); - let y = x.as_slice().sum_(); + let y = x.sum_(); println!("y=={}", y); assert_eq!(y, 6); } diff --git a/src/test/run-pass/realloc-16687.rs b/src/test/run-pass/realloc-16687.rs index 80ee735be7..de5b14104c 100644 --- a/src/test/run-pass/realloc-16687.rs +++ b/src/test/run-pass/realloc-16687.rs @@ -28,16 +28,16 @@ fn main() { unsafe fn test_triangle() -> bool { static COUNT : uint = 16; let mut ascend = repeat(ptr::null_mut()).take(COUNT).collect::>(); - let ascend = ascend.as_mut_slice(); + let ascend = &mut *ascend; static ALIGN : uint = 1; // Checks that `ascend` forms triangle of ascending size formed // from pairs of rows (where each pair of rows is equally sized), // and the elements of the triangle match their row-pair index. unsafe fn sanity_check(ascend: &[*mut u8]) { - for i in range(0u, COUNT / 2) { + for i in 0_usize..COUNT / 2 { let (p0, p1, size) = (ascend[2*i], ascend[2*i+1], idx_to_size(i)); - for j in range(0u, size) { + for j in 0_usize..size { assert_eq!(*p0.offset(j as int), i as u8); assert_eq!(*p1.offset(j as int), i as u8); } @@ -88,28 +88,28 @@ unsafe fn test_triangle() -> bool { // that at least two rows will be allocated near each other, so // that we trigger the bug (a buffer overrun) in an observable // way.) - for i in range(0u, COUNT / 2) { + for i in 0_usize..COUNT / 2 { let size = idx_to_size(i); ascend[2*i] = allocate(size, ALIGN); ascend[2*i+1] = allocate(size, ALIGN); } // Initialize each pair of rows to distinct value. - for i in range(0u, COUNT / 2) { + for i in 0_usize..COUNT / 2 { let (p0, p1, size) = (ascend[2*i], ascend[2*i+1], idx_to_size(i)); - for j in range(0, size) { + for j in 0..size { *p0.offset(j as int) = i as u8; *p1.offset(j as int) = i as u8; } } - sanity_check(ascend.as_slice()); + sanity_check(&*ascend); test_1(ascend); // triangle -> square test_2(ascend); // square -> triangle test_3(ascend); // triangle -> square test_4(ascend); // square -> triangle - for i in range(0u, COUNT / 2) { + for i in 0_usize..COUNT / 2 { let size = idx_to_size(i); deallocate(ascend[2*i], size, ALIGN); deallocate(ascend[2*i+1], size, ALIGN); @@ -123,60 +123,60 @@ unsafe fn test_triangle() -> bool { // rows as we go. unsafe fn test_1(ascend: &mut [*mut u8]) { let new_size = idx_to_size(COUNT-1); - for i in range(0u, COUNT / 2) { + for i in 0_usize..COUNT / 2 { let (p0, p1, old_size) = (ascend[2*i], ascend[2*i+1], idx_to_size(i)); assert!(old_size < new_size); ascend[2*i] = reallocate(p0, old_size, new_size, ALIGN); - sanity_check(ascend.as_slice()); + sanity_check(&*ascend); ascend[2*i+1] = reallocate(p1, old_size, new_size, ALIGN); - sanity_check(ascend.as_slice()); + sanity_check(&*ascend); } } // Test 2: turn the square back into a triangle, top to bottom. unsafe fn test_2(ascend: &mut [*mut u8]) { let old_size = idx_to_size(COUNT-1); - for i in range(0u, COUNT / 2) { + for i in 0_usize..COUNT / 2 { let (p0, p1, new_size) = (ascend[2*i], ascend[2*i+1], idx_to_size(i)); assert!(new_size < old_size); ascend[2*i] = reallocate(p0, old_size, new_size, ALIGN); - sanity_check(ascend.as_slice()); + sanity_check(&*ascend); ascend[2*i+1] = reallocate(p1, old_size, new_size, ALIGN); - sanity_check(ascend.as_slice()); + sanity_check(&*ascend); } } // Test 3: turn triangle into a square, bottom to top. unsafe fn test_3(ascend: &mut [*mut u8]) { let new_size = idx_to_size(COUNT-1); - for i in range(0u, COUNT / 2).rev() { + for i in (0_usize..COUNT / 2).rev() { let (p0, p1, old_size) = (ascend[2*i], ascend[2*i+1], idx_to_size(i)); assert!(old_size < new_size); ascend[2*i+1] = reallocate(p1, old_size, new_size, ALIGN); - sanity_check(ascend.as_slice()); + sanity_check(&*ascend); ascend[2*i] = reallocate(p0, old_size, new_size, ALIGN); - sanity_check(ascend.as_slice()); + sanity_check(&*ascend); } } // Test 4: turn the square back into a triangle, bottom to top. unsafe fn test_4(ascend: &mut [*mut u8]) { let old_size = idx_to_size(COUNT-1); - for i in range(0u, COUNT / 2).rev() { + for i in (0_usize..COUNT / 2).rev() { let (p0, p1, new_size) = (ascend[2*i], ascend[2*i+1], idx_to_size(i)); assert!(new_size < old_size); ascend[2*i+1] = reallocate(p1, old_size, new_size, ALIGN); - sanity_check(ascend.as_slice()); + sanity_check(&*ascend); ascend[2*i] = reallocate(p0, old_size, new_size, ALIGN); - sanity_check(ascend.as_slice()); + sanity_check(&*ascend); } } } diff --git a/src/test/run-pass/rec-align-u32.rs b/src/test/run-pass/rec-align-u32.rs index 5b91d5e930..51b800bc9f 100644 --- a/src/test/run-pass/rec-align-u32.rs +++ b/src/test/run-pass/rec-align-u32.rs @@ -22,14 +22,14 @@ mod rusti { } // This is the type with the questionable alignment -#[derive(Show)] +#[derive(Debug)] struct Inner { c64: u32 } // This is the type that contains the type with the // questionable alignment, for testing -#[derive(Show)] +#[derive(Debug)] struct Outer { c8: u8, t: Inner @@ -38,14 +38,14 @@ struct Outer { #[cfg(any(target_arch = "x86", target_arch = "arm", target_arch = "aarch64"))] mod m { - pub fn align() -> uint { 4u } - pub fn size() -> uint { 8u } + pub fn align() -> uint { 4_usize } + pub fn size() -> uint { 8_usize } } #[cfg(target_arch = "x86_64")] mod m { - pub fn align() -> uint { 4u } - pub fn size() -> uint { 8u } + pub fn align() -> uint { 4_usize } + pub fn size() -> uint { 8_usize } } pub fn main() { @@ -66,6 +66,6 @@ pub fn main() { // because `inner`s alignment was 4. assert_eq!(mem::size_of::(), m::size()); - assert_eq!(y, "Outer { c8: 22u8, t: Inner { c64: 44u32 } }".to_string()); + assert_eq!(y, "Outer { c8: 22, t: Inner { c64: 44 } }".to_string()); } } diff --git a/src/test/run-pass/rec-align-u64.rs b/src/test/run-pass/rec-align-u64.rs index 27941542d0..cf23a1a0f2 100644 --- a/src/test/run-pass/rec-align-u64.rs +++ b/src/test/run-pass/rec-align-u64.rs @@ -22,14 +22,14 @@ mod rusti { } // This is the type with the questionable alignment -#[derive(Show)] +#[derive(Debug)] struct Inner { c64: u64 } // This is the type that contains the type with the // questionable alignment, for testing -#[derive(Show)] +#[derive(Debug)] struct Outer { c8: u8, t: Inner @@ -39,18 +39,19 @@ struct Outer { #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", - target_os = "dragonfly"))] + target_os = "dragonfly", + target_os = "openbsd"))] mod m { #[cfg(target_arch = "x86")] pub mod m { - pub fn align() -> uint { 4u } - pub fn size() -> uint { 12u } + pub fn align() -> uint { 4_usize } + pub fn size() -> uint { 12_usize } } #[cfg(any(target_arch = "x86_64", target_arch = "arm", target_arch = "aarch64"))] pub mod m { - pub fn align() -> uint { 8u } - pub fn size() -> uint { 16u } + pub fn align() -> uint { 8_usize } + pub fn size() -> uint { 16_usize } } } @@ -58,23 +59,23 @@ mod m { mod m { #[cfg(target_arch = "x86")] pub mod m { - pub fn align() -> uint { 8u } - pub fn size() -> uint { 16u } + pub fn align() -> uint { 8_usize } + pub fn size() -> uint { 16_usize } } #[cfg(target_arch = "x86_64")] pub mod m { - pub fn align() -> uint { 8u } - pub fn size() -> uint { 16u } + pub fn align() -> uint { 8_usize } + pub fn size() -> uint { 16_usize } } } #[cfg(target_os = "android")] mod m { - #[cfg(target_arch = "arm")] + #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] pub mod m { - pub fn align() -> uint { 8u } - pub fn size() -> uint { 16u } + pub fn align() -> uint { 8_usize } + pub fn size() -> uint { 16_usize } } } @@ -95,6 +96,6 @@ pub fn main() { // because `Inner`s alignment was 4. assert_eq!(mem::size_of::(), m::m::size()); - assert_eq!(y, "Outer { c8: 22u8, t: Inner { c64: 44u64 } }".to_string()); + assert_eq!(y, "Outer { c8: 22, t: Inner { c64: 44 } }".to_string()); } } diff --git a/src/test/run-pass/rec-tup.rs b/src/test/run-pass/rec-tup.rs index 8adad012ec..dab7d26cc8 100644 --- a/src/test/run-pass/rec-tup.rs +++ b/src/test/run-pass/rec-tup.rs @@ -8,10 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[derive(Copy)] struct Point {x: int, y: int} -impl Copy for Point {} - type rect = (Point, Point); fn fst(r: rect) -> Point { let (fst, _) = r; return fst; } diff --git a/src/test/run-pass/rec.rs b/src/test/run-pass/rec.rs index 02fcf1ad06..f59538c51a 100644 --- a/src/test/run-pass/rec.rs +++ b/src/test/run-pass/rec.rs @@ -8,13 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - - - +#[derive(Copy)] struct Rect {x: int, y: int, w: int, h: int} -impl Copy for Rect {} - fn f(r: Rect, x: int, y: int, w: int, h: int) { assert_eq!(r.x, x); assert_eq!(r.y, y); diff --git a/src/test/run-pass/record-pat.rs b/src/test/run-pass/record-pat.rs index e0db1ed75d..282a24a407 100644 --- a/src/test/run-pass/record-pat.rs +++ b/src/test/run-pass/record-pat.rs @@ -20,6 +20,6 @@ fn m(input: t3) -> int { } pub fn main() { - assert_eq!(m(t3::c(T2 {x: t1::a(10), y: 5}, 4u)), 10); - assert_eq!(m(t3::c(T2 {x: t1::b(10u), y: 5}, 4u)), 19); + assert_eq!(m(t3::c(T2 {x: t1::a(10), y: 5}, 4_usize)), 10); + assert_eq!(m(t3::c(T2 {x: t1::b(10_usize), y: 5}, 4_usize)), 19); } diff --git a/src/test/run-pass/reexported-static-methods-cross-crate.rs b/src/test/run-pass/reexported-static-methods-cross-crate.rs index 0d0fdb13db..5399f3cfd3 100644 --- a/src/test/run-pass/reexported-static-methods-cross-crate.rs +++ b/src/test/run-pass/reexported-static-methods-cross-crate.rs @@ -17,8 +17,8 @@ use reexported_static_methods::Boz; use reexported_static_methods::Bort; pub fn main() { - assert_eq!(42i, Foo::foo()); - assert_eq!(84i, Baz::bar()); - assert!(Boz::boz(1i)); + assert_eq!(42, Foo::foo()); + assert_eq!(84, Baz::bar()); + assert!(Boz::boz(1)); assert_eq!("bort()".to_string(), Bort::bort()); } diff --git a/src/test/run-pass/regions-assoc-type-region-bound.rs b/src/test/run-pass/regions-assoc-type-region-bound.rs new file mode 100644 index 0000000000..77e1a21476 --- /dev/null +++ b/src/test/run-pass/regions-assoc-type-region-bound.rs @@ -0,0 +1,28 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that the compiler considers the 'a bound declared in the +// trait. Issue #20890. + +trait Foo<'a> { + type Value: 'a; + + fn get(&self) -> &'a Self::Value; +} + +fn takes_foo<'a,F: Foo<'a>>(f: &'a F) { + // This call would be illegal, because it results in &'a F::Value, + // and the only way we know that `F::Value : 'a` is because of the + // trait declaration. + + f.get(); +} + +fn main() { } diff --git a/src/test/run-pass/regions-assoc-type-static-bound.rs b/src/test/run-pass/regions-assoc-type-static-bound.rs new file mode 100644 index 0000000000..80ae371e50 --- /dev/null +++ b/src/test/run-pass/regions-assoc-type-static-bound.rs @@ -0,0 +1,25 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that the compiler considers the 'static bound declared in the +// trait. Issue #20890. + +trait Foo { + type Value: 'static; + fn dummy(&self) { } +} + +fn require_static() {} + +fn takes_foo() { + require_static::() +} + +fn main() { } diff --git a/src/test/run-pass/regions-borrow-at.rs b/src/test/run-pass/regions-borrow-at.rs index ba86e3f7b5..89779fa4d2 100644 --- a/src/test/run-pass/regions-borrow-at.rs +++ b/src/test/run-pass/regions-borrow-at.rs @@ -16,8 +16,8 @@ fn foo(x: &uint) -> uint { } pub fn main() { - let p = box 22u; + let p = box 22_usize; let r = foo(&*p); println!("r={}", r); - assert_eq!(r, 22u); + assert_eq!(r, 22_usize); } diff --git a/src/test/run-pass/regions-borrow-evec-uniq.rs b/src/test/run-pass/regions-borrow-evec-uniq.rs index f5d46d4ce7..16eeb99982 100644 --- a/src/test/run-pass/regions-borrow-evec-uniq.rs +++ b/src/test/run-pass/regions-borrow-evec-uniq.rs @@ -15,10 +15,10 @@ fn foo(x: &[int]) -> int { pub fn main() { let p = vec!(1,2,3,4,5); - let r = foo(p.as_slice()); + let r = foo(&p); assert_eq!(r, 1); let p = vec!(5,4,3,2,1); - let r = foo(p.as_slice()); + let r = foo(&p); assert_eq!(r, 5); } diff --git a/src/test/run-pass/regions-borrow-uniq.rs b/src/test/run-pass/regions-borrow-uniq.rs index 30a22512d2..a1af7159a9 100644 --- a/src/test/run-pass/regions-borrow-uniq.rs +++ b/src/test/run-pass/regions-borrow-uniq.rs @@ -16,7 +16,7 @@ fn foo(x: &uint) -> uint { } pub fn main() { - let p = box 3u; + let p = box 3_usize; let r = foo(&*p); - assert_eq!(r, 3u); + assert_eq!(r, 3_usize); } diff --git a/src/test/run-pass/regions-bound-lists-feature-gate-2.rs b/src/test/run-pass/regions-bound-lists-feature-gate-2.rs index 0a95a89d57..a06e0f6da7 100644 --- a/src/test/run-pass/regions-bound-lists-feature-gate-2.rs +++ b/src/test/run-pass/regions-bound-lists-feature-gate-2.rs @@ -12,7 +12,9 @@ #![feature(issue_5723_bootstrap)] -trait Foo { } +trait Foo { + fn dummy(&self) { } +} fn foo<'a, 'b, 'c:'a+'b, 'd>() { } diff --git a/src/test/run-pass/regions-bound-lists-feature-gate.rs b/src/test/run-pass/regions-bound-lists-feature-gate.rs index c5baecf727..996583dc6d 100644 --- a/src/test/run-pass/regions-bound-lists-feature-gate.rs +++ b/src/test/run-pass/regions-bound-lists-feature-gate.rs @@ -12,8 +12,9 @@ #![feature(issue_5723_bootstrap)] - -trait Foo { } +trait Foo { + fn dummy(&self) { } +} fn foo<'a>(x: Box) { } diff --git a/src/test/run-pass/regions-copy-closure.rs b/src/test/run-pass/regions-copy-closure.rs index 0152793d96..6ebef9f34a 100644 --- a/src/test/run-pass/regions-copy-closure.rs +++ b/src/test/run-pass/regions-copy-closure.rs @@ -21,10 +21,10 @@ fn box_it<'a>(x: Box) -> closure_box<'a> { } pub fn main() { - let mut i = 3i; + let mut i = 3i32; assert_eq!(i, 3); { - let cl = |&mut:| i += 1; + let cl = || i += 1; let mut cl_box = box_it(box cl); cl_box.cl.call_mut(()); } diff --git a/src/test/run-pass/regions-debruijn-of-object.rs b/src/test/run-pass/regions-debruijn-of-object.rs new file mode 100644 index 0000000000..b9d3ed49c6 --- /dev/null +++ b/src/test/run-pass/regions-debruijn-of-object.rs @@ -0,0 +1,25 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct ctxt<'tcx> { + x: &'tcx i32 +} + +trait AstConv<'tcx> { + fn tcx<'a>(&'a self) -> &'a ctxt<'tcx>; +} + +fn foo(conv: &AstConv) { } + +fn bar<'tcx>(conv: &AstConv<'tcx>) { + foo(conv) +} + +fn main() { } diff --git a/src/test/run-pass/regions-dependent-addr-of.rs b/src/test/run-pass/regions-dependent-addr-of.rs index e38a472fa4..b51be0f0f7 100644 --- a/src/test/run-pass/regions-dependent-addr-of.rs +++ b/src/test/run-pass/regions-dependent-addr-of.rs @@ -12,6 +12,7 @@ // Issue #3148. #![allow(unknown_features)] +#![feature(box_patterns)] #![feature(box_syntax)] struct A { @@ -27,12 +28,11 @@ struct B { v6: Option } +#[derive(Copy)] struct C { f: int } -impl Copy for C {} - fn get_v1(a: &A) -> &int { // Region inferencer must deduce that &v < L2 < L1 let foo = &a.value; // L1 diff --git a/src/test/run-pass/regions-dependent-autoslice.rs b/src/test/run-pass/regions-dependent-autoslice.rs index 2cee2ac58b..bcf74729fd 100644 --- a/src/test/run-pass/regions-dependent-autoslice.rs +++ b/src/test/run-pass/regions-dependent-autoslice.rs @@ -20,5 +20,5 @@ fn both<'r>(v: &'r [uint]) -> &'r [uint] { pub fn main() { let v = vec!(1,2,3); - both(v.as_slice()); + both(&v); } diff --git a/src/test/run-pass/regions-early-bound-lifetime-in-assoc-fn.rs b/src/test/run-pass/regions-early-bound-lifetime-in-assoc-fn.rs index 978383c244..bdc0d41c94 100644 --- a/src/test/run-pass/regions-early-bound-lifetime-in-assoc-fn.rs +++ b/src/test/run-pass/regions-early-bound-lifetime-in-assoc-fn.rs @@ -14,6 +14,8 @@ // lifetime parameters must be early bound in the type of the // associated item. +use std::marker; + pub enum Value<'v> { A(&'v str), B, @@ -23,7 +25,9 @@ pub trait Decoder<'v> { fn read(&mut self) -> Value<'v>; } -pub trait Decodable<'v, D: Decoder<'v>> { +pub trait Decodable<'v, D: Decoder<'v>> + : marker::PhantomFn<(), &'v int> +{ fn decode(d: &mut D) -> Self; } diff --git a/src/test/run-pass/regions-early-bound-trait-param.rs b/src/test/run-pass/regions-early-bound-trait-param.rs index 3267ff2c7e..3f434a4838 100644 --- a/src/test/run-pass/regions-early-bound-trait-param.rs +++ b/src/test/run-pass/regions-early-bound-trait-param.rs @@ -53,11 +53,11 @@ fn field_invoke2<'l, 'm, 'n>(x: &'n Struct2<'l,'m>) -> int { x.f.short() } -trait MakerTrait<'o> { +trait MakerTrait { fn mk() -> Self; } -fn make_val<'p, T:MakerTrait<'p>>() -> T { +fn make_val() -> T { MakerTrait::mk() } @@ -80,8 +80,8 @@ impl<'s> Trait<'s> for (int,int) { } } -impl<'t> MakerTrait<'t> for Box+'static> { - fn mk() -> Box+'static> { box() (4i,5i) as Box } +impl<'t> MakerTrait for Box+'static> { + fn mk() -> Box+'static> { box() (4,5) as Box } } enum List<'l> { @@ -111,7 +111,7 @@ impl<'t> RefMakerTrait<'t> for List<'t> { } pub fn main() { - let t = (2i,3i); + let t = (2,3); let o = &t as &Trait; let s1 = Struct1 { f: o }; let s2 = Struct2 { f: o }; diff --git a/src/test/run-pass/regions-early-bound-used-in-bound-method.rs b/src/test/run-pass/regions-early-bound-used-in-bound-method.rs index 5b4169a4e8..410415e57a 100644 --- a/src/test/run-pass/regions-early-bound-used-in-bound-method.rs +++ b/src/test/run-pass/regions-early-bound-used-in-bound-method.rs @@ -15,12 +15,11 @@ trait GetRef<'a> { fn get(&self) -> &'a int; } +#[derive(Copy)] struct Box<'a> { t: &'a int } -impl<'a> Copy for Box<'a> {} - impl<'a> GetRef<'a> for Box<'a> { fn get(&self) -> &'a int { self.t diff --git a/src/test/run-pass/regions-early-bound-used-in-bound.rs b/src/test/run-pass/regions-early-bound-used-in-bound.rs index 73eb7ca718..a3602c5fbe 100644 --- a/src/test/run-pass/regions-early-bound-used-in-bound.rs +++ b/src/test/run-pass/regions-early-bound-used-in-bound.rs @@ -32,6 +32,6 @@ fn add<'a,G:GetRef<'a, int>>(g1: G, g2: G) -> int { } pub fn main() { - let b1 = Box { t: &3i }; - assert_eq!(add(b1, b1), 6i); + let b1 = Box { t: &3 }; + assert_eq!(add(b1, b1), 6); } diff --git a/src/test/run-pass/regions-early-bound-used-in-type-param.rs b/src/test/run-pass/regions-early-bound-used-in-type-param.rs index 622f820971..caef4e3fa9 100644 --- a/src/test/run-pass/regions-early-bound-used-in-type-param.rs +++ b/src/test/run-pass/regions-early-bound-used-in-type-param.rs @@ -15,12 +15,11 @@ trait Get { fn get(&self) -> T; } +#[derive(Copy)] struct Box { t: T } -impl Copy for Box {} - impl Get for Box { fn get(&self) -> T { self.t.clone() @@ -32,6 +31,6 @@ fn add<'a,G:Get<&'a int>>(g1: G, g2: G) -> int { } pub fn main() { - let b1 = Box { t: &3i }; - assert_eq!(add(b1, b1), 6i); + let b1 = Box { t: &3 }; + assert_eq!(add(b1, b1), 6); } diff --git a/src/test/run-pass/regions-escape-into-other-fn.rs b/src/test/run-pass/regions-escape-into-other-fn.rs index 9637c43170..b15f9d3485 100644 --- a/src/test/run-pass/regions-escape-into-other-fn.rs +++ b/src/test/run-pass/regions-escape-into-other-fn.rs @@ -15,6 +15,6 @@ fn foo(x: &uint) -> &uint { x } fn bar(x: &uint) -> uint { *x } pub fn main() { - let p = box 3u; + let p = box 3_usize; assert_eq!(bar(foo(&*p)), 3); } diff --git a/src/test/run-pass/regions-infer-borrow-scope-addr-of.rs b/src/test/run-pass/regions-infer-borrow-scope-addr-of.rs index 319e01172b..9f1a383fd6 100644 --- a/src/test/run-pass/regions-infer-borrow-scope-addr-of.rs +++ b/src/test/run-pass/regions-infer-borrow-scope-addr-of.rs @@ -13,7 +13,7 @@ use std::mem::swap; pub fn main() { let mut x = 4; - for i in range(0u, 3) { + for i in 0_usize..3 { // ensure that the borrow in this alt // does not interfere with the swap // below. note that it would it you diff --git a/src/test/run-pass/regions-infer-borrow-scope-view.rs b/src/test/run-pass/regions-infer-borrow-scope-view.rs index ce9edb5678..1fdf3a92a3 100644 --- a/src/test/run-pass/regions-infer-borrow-scope-view.rs +++ b/src/test/run-pass/regions-infer-borrow-scope-view.rs @@ -12,8 +12,8 @@ fn view(x: &[T]) -> &[T] {x} pub fn main() { - let v = vec!(1i, 2, 3); - let x = view(v.as_slice()); - let y = view(x.as_slice()); + let v = vec!(1, 2, 3); + let x = view(&v); + let y = view(x); assert!((v[0] == x[0]) && (v[0] == y[0])); } diff --git a/src/test/run-pass/regions-infer-borrow-scope-within-loop-ok.rs b/src/test/run-pass/regions-infer-borrow-scope-within-loop-ok.rs index f397b5124c..d07110fd72 100644 --- a/src/test/run-pass/regions-infer-borrow-scope-within-loop-ok.rs +++ b/src/test/run-pass/regions-infer-borrow-scope-within-loop-ok.rs @@ -14,7 +14,7 @@ fn borrow(x: &T) -> &T {x} pub fn main() { - let x = box 3i; + let x = box 3; loop { let y = borrow(&*x); assert_eq!(*x, *y); diff --git a/src/test/run-pass/regions-issue-21422.rs b/src/test/run-pass/regions-issue-21422.rs new file mode 100644 index 0000000000..c59bf15afc --- /dev/null +++ b/src/test/run-pass/regions-issue-21422.rs @@ -0,0 +1,25 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Regression test for issue #21422, which was related to failing to +// add inference constraints that the operands of a binary operator +// should outlive the binary operation itself. + +pub struct P<'a> { + _ptr: *const &'a u8, +} + +impl <'a> PartialEq for P<'a> { + fn eq(&self, other: &P<'a>) -> bool { + (self as *const _) == (other as *const _) + } +} + +fn main() {} diff --git a/src/test/run-pass/regions-issue-22246.rs b/src/test/run-pass/regions-issue-22246.rs new file mode 100644 index 0000000000..f5c34d6b34 --- /dev/null +++ b/src/test/run-pass/regions-issue-22246.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Regression test for issue #22246 -- we should be able to deduce +// that `&'a B::Owned` implies that `B::Owned : 'a`. + +#![allow(dead_code)] + +use std::ops::Deref; + +pub trait ToOwned { + type Owned: Borrow; + fn to_owned(&self) -> Self::Owned; +} + +pub trait Borrow { + fn borrow(&self) -> &Borrowed; +} + +pub struct Foo { + owned: B::Owned +} + +fn foo(this: &Foo) -> &B { + this.owned.borrow() +} + +fn main() { } diff --git a/src/test/run-pass/regions-lifetime-nonfree-late-bound.rs b/src/test/run-pass/regions-lifetime-nonfree-late-bound.rs index c4852c9162..a2b6d569ac 100644 --- a/src/test/run-pass/regions-lifetime-nonfree-late-bound.rs +++ b/src/test/run-pass/regions-lifetime-nonfree-late-bound.rs @@ -28,14 +28,14 @@ pub fn main() { fn explicit() { fn test(_x: Option>) where F: FnMut(Box FnMut(&'a int)>) {} - test(Some(box |&mut: _f: Box FnMut(&'a int)>| {})); + test(Some(box |_f: Box FnMut(&'a int)>| {})); } // The code below is shorthand for the code above (and more likely // to represent what one encounters in practice). fn implicit() { fn test(_x: Option>) where F: FnMut(Box< FnMut(& int)>) {} - test(Some(box |&mut: _f: Box< FnMut(& int)>| {})); + test(Some(box |_f: Box< FnMut(& int)>| {})); } explicit(); diff --git a/src/test/run-pass/regions-mock-tcx.rs b/src/test/run-pass/regions-mock-tcx.rs index 6e85011b14..bf789d5364 100644 --- a/src/test/run-pass/regions-mock-tcx.rs +++ b/src/test/run-pass/regions-mock-tcx.rs @@ -21,20 +21,18 @@ extern crate libc; use TypeStructure::{TypeInt, TypeFunction}; use AstKind::{ExprInt, ExprVar, ExprLambda}; -use arena::Arena; +use arena::TypedArena; use std::collections::HashMap; use std::mem; type Type<'tcx> = &'tcx TypeStructure<'tcx>; -#[derive(Show)] +#[derive(Copy, Debug)] enum TypeStructure<'tcx> { TypeInt, TypeFunction(Type<'tcx>, Type<'tcx>), } -impl<'tcx> Copy for TypeStructure<'tcx> {} - impl<'tcx> PartialEq for TypeStructure<'tcx> { fn eq(&self, other: &TypeStructure<'tcx>) -> bool { match (*self, *other) { @@ -47,17 +45,20 @@ impl<'tcx> PartialEq for TypeStructure<'tcx> { impl<'tcx> Eq for TypeStructure<'tcx> {} +type TyArena<'tcx> = TypedArena>; +type AstArena<'ast> = TypedArena>; + struct TypeContext<'tcx, 'ast> { - ty_arena: &'tcx Arena, + ty_arena: &'tcx TyArena<'tcx>, types: Vec> , type_table: HashMap>, - ast_arena: &'ast Arena, + ast_arena: &'ast AstArena<'ast>, ast_counter: uint, } impl<'tcx,'ast> TypeContext<'tcx, 'ast> { - fn new(ty_arena: &'tcx Arena, ast_arena: &'ast Arena) + fn new(ty_arena: &'tcx TyArena<'tcx>, ast_arena: &'ast AstArena<'ast>) -> TypeContext<'tcx, 'ast> { TypeContext { ty_arena: ty_arena, types: Vec::new(), @@ -68,13 +69,13 @@ impl<'tcx,'ast> TypeContext<'tcx, 'ast> { } fn add_type(&mut self, s: TypeStructure<'tcx>) -> Type<'tcx> { - for &ty in self.types.iter() { + for &ty in &self.types { if *ty == s { return ty; } } - let ty = self.ty_arena.alloc(|| s); + let ty = self.ty_arena.alloc(s); self.types.push(ty); ty } @@ -87,34 +88,30 @@ impl<'tcx,'ast> TypeContext<'tcx, 'ast> { fn ast(&mut self, a: AstKind<'ast>) -> Ast<'ast> { let id = self.ast_counter; self.ast_counter += 1; - self.ast_arena.alloc(|| AstStructure { id: NodeId {id:id}, kind: a }) + self.ast_arena.alloc(AstStructure { id: NodeId {id:id}, kind: a }) } } -#[derive(PartialEq, Eq, Hash)] +#[derive(Copy, PartialEq, Eq, Hash)] struct NodeId { id: uint } -impl Copy for NodeId {} - type Ast<'ast> = &'ast AstStructure<'ast>; +#[derive(Copy)] struct AstStructure<'ast> { id: NodeId, kind: AstKind<'ast> } -impl<'ast> Copy for AstStructure<'ast> {} - +#[derive(Copy)] enum AstKind<'ast> { ExprInt, ExprVar(uint), ExprLambda(Ast<'ast>), } -impl<'ast> Copy for AstKind<'ast> {} - fn compute_types<'tcx,'ast>(tcx: &mut TypeContext<'tcx,'ast>, ast: Ast<'ast>) -> Type<'tcx> { @@ -133,8 +130,8 @@ fn compute_types<'tcx,'ast>(tcx: &mut TypeContext<'tcx,'ast>, } pub fn main() { - let ty_arena = arena::Arena::new(); - let ast_arena = arena::Arena::new(); + let ty_arena = TypedArena::new(); + let ast_arena = TypedArena::new(); let mut tcx = TypeContext::new(&ty_arena, &ast_arena); let ast = tcx.ast(ExprInt); let ty = compute_types(&mut tcx, ast); diff --git a/src/test/run-pass/regions-no-bound-in-argument-cleanup.rs b/src/test/run-pass/regions-no-bound-in-argument-cleanup.rs index d3464f0120..5964ac65d5 100644 --- a/src/test/run-pass/regions-no-bound-in-argument-cleanup.rs +++ b/src/test/run-pass/regions-no-bound-in-argument-cleanup.rs @@ -10,7 +10,9 @@ #![feature(unsafe_destructor)] -pub struct Foo; +use std::marker; + +pub struct Foo(marker::PhantomData); impl Iterator for Foo { type Item = T; diff --git a/src/test/run-pass/regions-no-variance-from-fn-generics.rs b/src/test/run-pass/regions-no-variance-from-fn-generics.rs index a35ab1bfc0..80c478afa6 100644 --- a/src/test/run-pass/regions-no-variance-from-fn-generics.rs +++ b/src/test/run-pass/regions-no-variance-from-fn-generics.rs @@ -12,7 +12,9 @@ // should not upset the variance inference for actual occurrences of // that lifetime in type expressions. -pub trait HasLife<'a> { } +pub trait HasLife<'a> { + fn dummy(&'a self) { } // just to induce a variance on 'a +} trait UseLife01 { fn refs<'a, H: HasLife<'a>>(&'a self) -> H; @@ -23,7 +25,11 @@ trait UseLife02 { } -pub trait HasType { } +pub trait HasType +{ + fn dummy(&self, t: T) -> T { panic!() } +} + trait UseLife03 { fn refs<'a, H: HasType<&'a T>>(&'a self) -> H; diff --git a/src/test/run-pass/regions-params.rs b/src/test/run-pass/regions-params.rs index 0042d3a765..c71953e20f 100644 --- a/src/test/run-pass/regions-params.rs +++ b/src/test/run-pass/regions-params.rs @@ -21,6 +21,6 @@ fn parameterized(x: &uint) -> uint { } pub fn main() { - let x = 3u; - assert_eq!(parameterized(&x), 3u); + let x = 3_usize; + assert_eq!(parameterized(&x), 3_usize); } diff --git a/src/test/run-pass/regions-refcell.rs b/src/test/run-pass/regions-refcell.rs new file mode 100644 index 0000000000..a224017780 --- /dev/null +++ b/src/test/run-pass/regions-refcell.rs @@ -0,0 +1,53 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// This is a regression test for something that only came up while +// attempting to bootstrap librustc with new destructor lifetime +// semantics. + +use std::collections::HashMap; +use std::cell::RefCell; + +// This version does not yet work (associated type issues)... +#[cfg(cannot_use_this_yet)] +fn foo<'a>(map: RefCell>) { + let one = [1_usize]; + assert_eq!(map.borrow().get("one"), Some(&one[..])); +} + +#[cfg(cannot_use_this_yet_either)] +// ... and this version does not work (the lifetime of `one` is +// supposed to match the lifetime `'a`) ... +fn foo<'a>(map: RefCell>) { + let one = [1_usize]; + assert_eq!(map.borrow().get("one"), Some(&one.as_slice())); +} + +#[cfg(all(not(cannot_use_this_yet),not(cannot_use_this_yet_either)))] +fn foo<'a>(map: RefCell>) { + // ...so instead we walk through the trivial slice and make sure + // it contains the element we expect. + + for (i, &x) in map.borrow().get("one").unwrap().iter().enumerate() { + assert_eq!((i, x), (0, 1)); + } +} + +fn main() { + let zer = [0u8]; + let one = [1u8]; + let two = [2u8]; + let mut map = HashMap::new(); + map.insert("zero", &zer[..]); + map.insert("one", &one[..]); + map.insert("two", &two[..]); + let map = RefCell::new(map); + foo(map); +} diff --git a/src/test/run-pass/regions-return-interior-of-option.rs b/src/test/run-pass/regions-return-interior-of-option.rs index 54458f0d0d..ee1d668730 100644 --- a/src/test/run-pass/regions-return-interior-of-option.rs +++ b/src/test/run-pass/regions-return-interior-of-option.rs @@ -16,14 +16,14 @@ fn get(opt: &Option) -> &T { } pub fn main() { - let mut x = Some(23i); + let mut x = Some(23); { let y = get(&x); assert_eq!(*y, 23); } - x = Some(24i); + x = Some(24); { let y = get(&x); diff --git a/src/test/run-pass/regions-scope-chain-example.rs b/src/test/run-pass/regions-scope-chain-example.rs index 0388ffb789..e5ef88006c 100644 --- a/src/test/run-pass/regions-scope-chain-example.rs +++ b/src/test/run-pass/regions-scope-chain-example.rs @@ -31,7 +31,7 @@ struct Context<'a> { impl<'a> Context<'a> { fn foo(&mut self, scope: Scope) { - let link = if 1i < 2 { + let link = if 1 < 2 { let l = ScopeChain::Link(scope); self.take_scope(&l); l diff --git a/src/test/run-pass/regions-static-closure.rs b/src/test/run-pass/regions-static-closure.rs index abd5789bb1..7198c35944 100644 --- a/src/test/run-pass/regions-static-closure.rs +++ b/src/test/run-pass/regions-static-closure.rs @@ -25,6 +25,6 @@ fn call_static_closure(mut cl: closure_box<'static>) { } pub fn main() { - let cl_box = box_it(box |&mut:| println!("Hello, world!")); + let cl_box = box_it(box || println!("Hello, world!")); call_static_closure(cl_box); } diff --git a/src/test/run-pass/regions-trait-object-1.rs b/src/test/run-pass/regions-trait-object-1.rs new file mode 100644 index 0000000000..eb3bec7732 --- /dev/null +++ b/src/test/run-pass/regions-trait-object-1.rs @@ -0,0 +1,43 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// This is a regression test for something that only came up while +// attempting to bootstrap libsyntax; it is adapted from +// `syntax::ext::tt::generic_extension`. + +pub struct E<'a> { + pub f: &'a u8, +} +impl<'b> E<'b> { + pub fn m(&self) -> &'b u8 { self.f } +} + +pub struct P<'c> { + pub g: &'c u8, +} +pub trait M { + fn n(&self) -> u8; +} +impl<'d> M for P<'d> { + fn n(&self) -> u8 { *self.g } +} + +fn extension<'e>(x: &'e E<'e>) -> Box { + loop { + let p = P { g: x.m() }; + return Box::new(p) as Box; + } +} + +fn main() { + let w = E { f: &10u8 }; + let o = extension(&w); + assert_eq!(o.n(), 10u8); +} diff --git a/src/test/run-pass/rename-directory.rs b/src/test/run-pass/rename-directory.rs index d610bf09ed..abe6ffe7d4 100644 --- a/src/test/run-pass/rename-directory.rs +++ b/src/test/run-pass/rename-directory.rs @@ -14,10 +14,10 @@ extern crate libc; use std::ffi::CString; -use std::io::TempDir; -use std::io::fs::PathExtensions; -use std::io::fs; -use std::io; +use std::old_io::TempDir; +use std::old_io::fs::PathExtensions; +use std::old_io::fs; +use std::old_io; use std::os; fn rename_directory() { @@ -27,25 +27,25 @@ fn rename_directory() { let tmpdir = TempDir::new("rename_directory").ok().expect("rename_directory failed"); let tmpdir = tmpdir.path(); let old_path = tmpdir.join_many(&["foo", "bar", "baz"]); - fs::mkdir_recursive(&old_path, io::USER_RWX); + fs::mkdir_recursive(&old_path, old_io::USER_RWX); let test_file = &old_path.join("temp.txt"); /* Write the temp input file */ - let fromp = CString::from_slice(test_file.as_vec()); - let modebuf = CString::from_slice(b"w+b"); + let fromp = CString::new(test_file.as_vec()).unwrap(); + let modebuf = CString::new(b"w+b").unwrap(); let ostream = libc::fopen(fromp.as_ptr(), modebuf.as_ptr()); - assert!((ostream as uint != 0u)); + assert!((ostream as uint != 0_usize)); let s = "hello".to_string(); - let buf = CString::from_slice(b"hello"); + let buf = CString::new(b"hello").unwrap(); let write_len = libc::fwrite(buf.as_ptr() as *mut _, - 1u as libc::size_t, - (s.len() + 1u) as libc::size_t, + 1_usize as libc::size_t, + (s.len() + 1_usize) as libc::size_t, ostream); assert_eq!(write_len, (s.len() + 1) as libc::size_t); - assert_eq!(libc::fclose(ostream), (0u as libc::c_int)); + assert_eq!(libc::fclose(ostream), (0_usize as libc::c_int)); let new_path = tmpdir.join_many(&["quux", "blat"]); - fs::mkdir_recursive(&new_path, io::USER_RWX); + fs::mkdir_recursive(&new_path, old_io::USER_RWX); fs::rename(&old_path, &new_path.join("newdir")); assert!(new_path.join("newdir").is_dir()); assert!(new_path.join_many(&["newdir", "temp.txt"]).exists()); diff --git a/src/test/run-pass/repeated-vector-syntax.rs b/src/test/run-pass/repeated-vector-syntax.rs index d1d37ea5bb..6d72e9774d 100644 --- a/src/test/run-pass/repeated-vector-syntax.rs +++ b/src/test/run-pass/repeated-vector-syntax.rs @@ -10,12 +10,12 @@ pub fn main() { let x = [ [true]; 512 ]; - let y = [ 0i; 1 ]; + let y = [ 0; 1 ]; print!("["); - for xi in x.iter() { - print!("{:?}, ", &xi[]); + for xi in &x[..] { + print!("{:?}, ", &xi[..]); } println!("]"); - println!("{:?}", &y[]); + println!("{:?}", &y[..]); } diff --git a/src/test/run-pass/resource-assign-is-not-copy.rs b/src/test/run-pass/resource-assign-is-not-copy.rs index 57f72b23ad..abc33e9f2e 100644 --- a/src/test/run-pass/resource-assign-is-not-copy.rs +++ b/src/test/run-pass/resource-assign-is-not-copy.rs @@ -12,7 +12,7 @@ use std::cell::Cell; -#[derive(Show)] +#[derive(Debug)] struct r<'a> { i: &'a Cell, } @@ -31,11 +31,11 @@ fn r(i: &Cell) -> r { } pub fn main() { - let i = &Cell::new(0i); + let i = &Cell::new(0); // Even though these look like copies, they are guaranteed not to be { let a = r(i); - let b = (a, 10i); + let b = (a, 10); let (c, _d) = b; println!("{:?}", c); } diff --git a/src/test/run-pass/ret-bang.rs b/src/test/run-pass/ret-bang.rs index ff4932e845..74227192ca 100644 --- a/src/test/run-pass/ret-bang.rs +++ b/src/test/run-pass/ret-bang.rs @@ -14,11 +14,11 @@ fn my_err(s: String) -> ! { println!("{}", s); panic!(); } fn okay(i: uint) -> int { - if i == 3u { + if i == 3_usize { my_err("I don't like three".to_string()); } else { return 42; } } -pub fn main() { okay(4u); } +pub fn main() { okay(4_usize); } diff --git a/src/test/run-pass/return-from-closure.rs b/src/test/run-pass/return-from-closure.rs index 899dc8ddbe..60856ee604 100644 --- a/src/test/run-pass/return-from-closure.rs +++ b/src/test/run-pass/return-from-closure.rs @@ -13,7 +13,7 @@ static mut calls: uint = 0; fn surrounding() { - let return_works = |&: n: int| { + let return_works = |n: int| { unsafe { calls += 1 } if n >= 0 { return; } @@ -23,7 +23,7 @@ fn surrounding() { return_works(10); return_works(20); - let return_works_proc = |: n: int| { + let return_works_proc = |n: int| { unsafe { calls += 1 } if n >= 0 { return; } diff --git a/src/test/run-pass/running-with-no-runtime.rs b/src/test/run-pass/running-with-no-runtime.rs index d6c25672cd..ec033b74dd 100644 --- a/src/test/run-pass/running-with-no-runtime.rs +++ b/src/test/run-pass/running-with-no-runtime.rs @@ -8,8 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(start)] + use std::ffi; -use std::io::process::{Command, ProcessOutput}; +use std::old_io::process::{Command, ProcessOutput}; use std::os; use std::rt::unwind::try; use std::rt; @@ -34,12 +36,12 @@ fn start(argc: int, argv: *const *const u8) -> int { } let args = unsafe { - range(0, argc as uint).map(|i| { + (0..argc as uint).map(|i| { let ptr = *argv.offset(i as int) as *const _; ffi::c_str_to_bytes(&ptr).to_vec() }).collect::>() }; - let me = args[0].as_slice(); + let me = &*args[0]; let x: &[u8] = &[1u8]; pass(Command::new(me).arg(x).output().unwrap()); @@ -57,7 +59,7 @@ fn start(argc: int, argv: *const *const u8) -> int { fn pass(output: ProcessOutput) { if !output.status.success() { - println!("{:?}", str::from_utf8(output.output.as_slice())); - println!("{:?}", str::from_utf8(output.error.as_slice())); + println!("{:?}", str::from_utf8(&output.output)); + println!("{:?}", str::from_utf8(&output.error)); } } diff --git a/src/test/run-pass/rust-log-filter.rs b/src/test/run-pass/rust-log-filter.rs index 28d47f7aa9..5d6657c7e1 100644 --- a/src/test/run-pass/rust-log-filter.rs +++ b/src/test/run-pass/rust-log-filter.rs @@ -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/f.o +// exec-env:RUST_LOG=rust-log-filter/foo #![allow(unknown_features)] #![feature(box_syntax)] @@ -42,18 +42,14 @@ pub fn main() { let _t = Thread::spawn(move|| { log::set_logger(logger); - // our regex is "f.o" - // ensure it is a regex, and isn't anchored info!("foo"); info!("bar"); info!("foo bar"); info!("bar foo"); - info!("f1o"); }); - assert_eq!(rx.recv().unwrap().as_slice(), "foo"); - assert_eq!(rx.recv().unwrap().as_slice(), "foo bar"); - assert_eq!(rx.recv().unwrap().as_slice(), "bar foo"); - assert_eq!(rx.recv().unwrap().as_slice(), "f1o"); + assert_eq!(rx.recv().unwrap(), "foo"); + assert_eq!(rx.recv().unwrap(), "foo bar"); + assert_eq!(rx.recv().unwrap(), "bar foo"); assert!(rx.recv().is_err()); } diff --git a/src/test/run-pass/segfault-no-out-of-stack.rs b/src/test/run-pass/segfault-no-out-of-stack.rs index 6ef33c1a11..492736c225 100644 --- a/src/test/run-pass/segfault-no-out-of-stack.rs +++ b/src/test/run-pass/segfault-no-out-of-stack.rs @@ -8,18 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::io::process::Command; -use std::os; +use std::old_io::process::Command; +use std::env; fn main() { - let args = os::args(); - let args = args.as_slice(); - if args.len() > 1 && args[1].as_slice() == "segfault" { + let args: Vec = env::args().collect(); + if args.len() > 1 && args[1] == "segfault" { unsafe { *(0 as *mut int) = 1 }; // trigger a segfault } else { - let segfault = Command::new(args[0].as_slice()).arg("segfault").output().unwrap(); + let segfault = Command::new(&args[0]).arg("segfault").output().unwrap(); assert!(!segfault.status.success()); - let error = String::from_utf8_lossy(segfault.error.as_slice()); - assert!(!error.as_slice().contains("has overflowed its stack")); + let error = String::from_utf8_lossy(&segfault.error); + assert!(!error.contains("has overflowed its stack")); } } diff --git a/src/test/run-pass/self-impl.rs b/src/test/run-pass/self-impl.rs index 40a4dc52a7..af2b2de8ab 100644 --- a/src/test/run-pass/self-impl.rs +++ b/src/test/run-pass/self-impl.rs @@ -29,6 +29,7 @@ pub struct Baz { trait Bar { fn bar(x: Self, y: &Self, z: Box) -> Self; + fn dummy(&self, x: X) { } } impl Bar for Box> { diff --git a/src/test/run-pass/self-in-mut-slot-immediate-value.rs b/src/test/run-pass/self-in-mut-slot-immediate-value.rs index 1603f7f976..a4b5ea1d68 100644 --- a/src/test/run-pass/self-in-mut-slot-immediate-value.rs +++ b/src/test/run-pass/self-in-mut-slot-immediate-value.rs @@ -11,12 +11,11 @@ // Assert that `mut self` on an immediate value doesn't // allow mutating the original - issue #10615. +#[derive(Copy)] struct Value { n: int } -impl Copy for Value {} - impl Value { fn squared(mut self) -> Value { self.n *= self.n; diff --git a/src/test/run-pass/self-re-assign.rs b/src/test/run-pass/self-re-assign.rs index 3092898d98..cf09737e32 100644 --- a/src/test/run-pass/self-re-assign.rs +++ b/src/test/run-pass/self-re-assign.rs @@ -17,11 +17,11 @@ use std::rc::Rc; pub fn main() { - let mut x = box 3i; + let mut x = box 3; x = x; assert!(*x == 3); - let mut x = Rc::new(3i); + let mut x = Rc::new(3); x = x; assert!(*x == 3); } diff --git a/src/test/run-pass/send-is-not-static-par-for.rs b/src/test/run-pass/send-is-not-static-par-for.rs new file mode 100755 index 0000000000..c6b64d97fb --- /dev/null +++ b/src/test/run-pass/send-is-not-static-par-for.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(core, std_misc)] +use std::thread::Thread; +use std::sync::Mutex; + +fn par_for(iter: I, f: F) + where I: Iterator, + ::Item: Send, + F: Fn(::Item) + Sync +{ + let f = &f; + let _guards: Vec<_> = iter.map(|elem| { + Thread::scoped(move || { + f(elem) + }) + }).collect(); + +} + +fn sum(x: &[i32]) { + let sum_lengths = Mutex::new(0); + par_for(x.windows(4), |x| { + *sum_lengths.lock().unwrap() += x.len() + }); + + assert_eq!(*sum_lengths.lock().unwrap(), (x.len() - 3) * 4); +} + +fn main() { + let mut elements = [0; 20]; + + // iterators over references into this stack frame + par_for(elements.iter_mut().enumerate(), |(i, x)| { + *x = i as i32 + }); + + sum(&elements) +} diff --git a/src/test/run-pass/send-type-inference.rs b/src/test/run-pass/send-type-inference.rs index ae992a0a35..60093803f0 100644 --- a/src/test/run-pass/send-type-inference.rs +++ b/src/test/run-pass/send-type-inference.rs @@ -16,7 +16,7 @@ struct Command { val: V } -fn cache_server(mut tx: Sender>>) { +fn cache_server(mut tx: Sender>>) { let (tx1, _rx) = channel(); tx.send(tx1); } diff --git a/src/test/run-pass/send_str_hashmap.rs b/src/test/run-pass/send_str_hashmap.rs index c58654670d..33e4fa85bc 100644 --- a/src/test/run-pass/send_str_hashmap.rs +++ b/src/test/run-pass/send_str_hashmap.rs @@ -13,7 +13,7 @@ extern crate collections; use std::collections::HashMap; use std::borrow::{Cow, IntoCow}; -type SendStr = Cow<'static, String, str>; +type SendStr = Cow<'static, str>; pub fn main() { let mut map: HashMap = HashMap::new(); diff --git a/src/test/run-pass/send_str_treemap.rs b/src/test/run-pass/send_str_treemap.rs index 438724a2b0..3390369242 100644 --- a/src/test/run-pass/send_str_treemap.rs +++ b/src/test/run-pass/send_str_treemap.rs @@ -13,7 +13,7 @@ extern crate collections; use self::collections::BTreeMap; use std::borrow::{Cow, IntoCow}; -type SendStr = Cow<'static, String, str>; +type SendStr = Cow<'static, str>; pub fn main() { let mut map: BTreeMap = BTreeMap::new(); diff --git a/src/test/run-pass/sendfn-is-a-block.rs b/src/test/run-pass/sendfn-is-a-block.rs index c70ed9a3d7..18519573c2 100644 --- a/src/test/run-pass/sendfn-is-a-block.rs +++ b/src/test/run-pass/sendfn-is-a-block.rs @@ -10,10 +10,10 @@ fn test(f: F) -> uint where F: FnOnce(uint) -> uint { - return f(22u); + return f(22_usize); } pub fn main() { - let y = test(|x| 4u * x); - assert_eq!(y, 88u); + let y = test(|x| 4_usize * x); + assert_eq!(y, 88_usize); } diff --git a/src/test/run-pass/sendfn-spawn-with-fn-arg.rs b/src/test/run-pass/sendfn-spawn-with-fn-arg.rs index 89624c3ac1..523b752810 100644 --- a/src/test/run-pass/sendfn-spawn-with-fn-arg.rs +++ b/src/test/run-pass/sendfn-spawn-with-fn-arg.rs @@ -11,7 +11,7 @@ #![allow(unknown_features)] #![feature(box_syntax)] -use std::thread::Thread; +use std::thread; pub fn main() { test05(); } @@ -21,11 +21,11 @@ fn test05_start(f: F) { fn test05() { let three = box 3; - let fn_to_send = move|: n:int| { + let fn_to_send = move|n:int| { println!("{}", *three + n); // will copy x into the closure assert_eq!(*three, 3); }; - Thread::scoped(move|| { + thread::spawn(move|| { test05_start(fn_to_send); }).join().ok().unwrap(); } diff --git a/src/test/run-pass/sepcomp-lib-lto.rs b/src/test/run-pass/sepcomp-lib-lto.rs index 002671ff51..f0b6a50592 100644 --- a/src/test/run-pass/sepcomp-lib-lto.rs +++ b/src/test/run-pass/sepcomp-lib-lto.rs @@ -11,7 +11,6 @@ // Check that we can use `-C lto` when linking against libraries that were // separately compiled. -// ignore-android linker weridness (see #18800) // aux-build:sepcomp_lib.rs // compile-flags: -C lto // no-prefer-dynamic diff --git a/src/test/run-pass/sepcomp-unwind.rs b/src/test/run-pass/sepcomp-unwind.rs index b8bb3b4e7f..21c5a6fc83 100644 --- a/src/test/run-pass/sepcomp-unwind.rs +++ b/src/test/run-pass/sepcomp-unwind.rs @@ -19,7 +19,7 @@ // In any case, this test should let us know if enabling parallel codegen ever // breaks unwinding. -use std::thread::Thread; +use std::thread; fn pad() -> uint { 0 } @@ -36,5 +36,5 @@ mod b { } fn main() { - Thread::scoped(move|| { ::b::g() }).join().unwrap_err(); + thread::spawn(move|| { ::b::g() }).join().err().unwrap(); } diff --git a/src/test/run-pass/seq-compare.rs b/src/test/run-pass/seq-compare.rs index 29729b15aa..ef14e0ba93 100644 --- a/src/test/run-pass/seq-compare.rs +++ b/src/test/run-pass/seq-compare.rs @@ -13,13 +13,13 @@ pub fn main() { assert!(("hello".to_string() < "hellr".to_string())); assert!(("hello ".to_string() > "hello".to_string())); assert!(("hello".to_string() != "there".to_string())); - assert!((vec!(1i, 2, 3, 4) > vec!(1, 2, 3))); - assert!((vec!(1i, 2, 3) < vec!(1, 2, 3, 4))); - assert!((vec!(1i, 2, 4, 4) > vec!(1, 2, 3, 4))); - assert!((vec!(1i, 2, 3, 4) < vec!(1, 2, 4, 4))); - assert!((vec!(1i, 2, 3) <= vec!(1, 2, 3))); - assert!((vec!(1i, 2, 3) <= vec!(1, 2, 3, 3))); - assert!((vec!(1i, 2, 3, 4) > vec!(1, 2, 3))); - assert_eq!(vec!(1i, 2, 3), vec!(1, 2, 3)); - assert!((vec!(1i, 2, 3) != vec!(1, 1, 3))); + assert!((vec!(1, 2, 3, 4) > vec!(1, 2, 3))); + assert!((vec!(1, 2, 3) < vec!(1, 2, 3, 4))); + assert!((vec!(1, 2, 4, 4) > vec!(1, 2, 3, 4))); + assert!((vec!(1, 2, 3, 4) < vec!(1, 2, 4, 4))); + assert!((vec!(1, 2, 3) <= vec!(1, 2, 3))); + assert!((vec!(1, 2, 3) <= vec!(1, 2, 3, 3))); + assert!((vec!(1, 2, 3, 4) > vec!(1, 2, 3))); + assert_eq!(vec!(1, 2, 3), vec!(1, 2, 3)); + assert!((vec!(1, 2, 3) != vec!(1, 1, 3))); } diff --git a/src/test/run-pass/shadow.rs b/src/test/run-pass/shadow.rs index 06d707d3ab..6e03c1e4a8 100644 --- a/src/test/run-pass/shadow.rs +++ b/src/test/run-pass/shadow.rs @@ -15,9 +15,9 @@ fn foo(c: Vec ) { match t::none:: { t::some::(_) => { - for _i in c.iter() { + for _i in &c { println!("{}", a); - let a = 17i; + let a = 17; b.push(a); } } @@ -27,4 +27,4 @@ fn foo(c: Vec ) { enum t { none, some(T), } -pub fn main() { let x = 10i; let x = x + 20; assert!((x == 30)); foo(Vec::new()); } +pub fn main() { let x = 10; let x = x + 20; assert!((x == 30)); foo(Vec::new()); } diff --git a/src/test/run-pass/shift.rs b/src/test/run-pass/shift.rs index d8a67eef3f..918da53509 100644 --- a/src/test/run-pass/shift.rs +++ b/src/test/run-pass/shift.rs @@ -18,7 +18,7 @@ pub fn main() { } fn test_misc() { - assert_eq!(1i << 1 << 1 << 1 << 1 << 1, 32); + assert_eq!(1 << 1 << 1 << 1 << 1 << 1, 32); } fn test_expr() { @@ -54,28 +54,28 @@ fn test_expr() { } fn test_const() { - static r1_1: uint = 10u >> 2u; - static r2_1: uint = 10u << 4u; + 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_2: u8 = 10u8 >> 2u; - static r2_2: u8 = 10u8 << 4u; + 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 >> 2u; - static r2_3: int = 10 << 4u; + 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_4: i8 = 10i8 >> 2u; - static r2_4: i8 = 10i8 << 4u; + 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 = 10u >> 2u; - static r2_5: uint = 10u << 4u; + 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); } diff --git a/src/test/run-pass/show-boxed-slice.rs b/src/test/run-pass/show-boxed-slice.rs index fc0b501e9c..f496765edc 100644 --- a/src/test/run-pass/show-boxed-slice.rs +++ b/src/test/run-pass/show-boxed-slice.rs @@ -11,7 +11,7 @@ #![allow(unknown_features)] #![feature(box_syntax)] -#[derive(Show)] +#[derive(Debug)] struct Foo(Box<[u8]>); pub fn main() { diff --git a/src/test/run-pass/signal-exit-status.rs b/src/test/run-pass/signal-exit-status.rs index dc72b6b053..776d897938 100644 --- a/src/test/run-pass/signal-exit-status.rs +++ b/src/test/run-pass/signal-exit-status.rs @@ -10,17 +10,16 @@ // ignore-windows -use std::os; -use std::io::process::{Command, ExitSignal, ExitStatus}; +use std::env; +use std::old_io::process::{Command, ExitSignal, ExitStatus}; pub fn main() { - let args = os::args(); - let args = args.as_slice(); - if args.len() >= 2 && args[1].as_slice() == "signal" { + let args: Vec = env::args().collect(); + if args.len() >= 2 && args[1] == "signal" { // Raise a segfault. unsafe { *(0 as *mut int) = 0; } } else { - let status = Command::new(args[0].as_slice()).arg("signal").status().unwrap(); + let status = Command::new(&args[0]).arg("signal").status().unwrap(); // Windows does not have signal, so we get exit status 0xC0000028 (STATUS_BAD_STACK). match status { ExitSignal(_) if cfg!(unix) => {}, diff --git a/src/test/run-pass/signed-shift-const-eval.rs b/src/test/run-pass/signed-shift-const-eval.rs index 62f1ca6314..2acb93f48f 100644 --- a/src/test/run-pass/signed-shift-const-eval.rs +++ b/src/test/run-pass/signed-shift-const-eval.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -enum test { thing = -5 >> 1u } +enum test { thing = -5 >> 1_usize } pub fn main() { assert_eq!(test::thing as int, -3); } diff --git a/src/test/run-pass/sigpipe-should-be-ignored.rs b/src/test/run-pass/sigpipe-should-be-ignored.rs index 1804dd2e13..d1428c6be1 100644 --- a/src/test/run-pass/sigpipe-should-be-ignored.rs +++ b/src/test/run-pass/sigpipe-should-be-ignored.rs @@ -12,8 +12,9 @@ // doesn't die in a ball of fire, but rather it's gracefully handled. use std::os; -use std::io::PipeStream; -use std::io::Command; +use std::env; +use std::old_io::PipeStream; +use std::old_io::Command; fn test() { let os::Pipe { reader, writer } = unsafe { os::pipe().unwrap() }; @@ -25,13 +26,12 @@ fn test() { } fn main() { - let args = os::args(); - let args = args.as_slice(); - if args.len() > 1 && args[1].as_slice() == "test" { + let args: Vec = env::args().collect(); + if args.len() > 1 && args[1] == "test" { return test(); } - let mut p = Command::new(args[0].as_slice()) + let mut p = Command::new(&args[0]) .arg("test").spawn().unwrap(); assert!(p.wait().unwrap().success()); } diff --git a/src/test/run-pass/simd-binop.rs b/src/test/run-pass/simd-binop.rs index 690ad35124..779e507f43 100644 --- a/src/test/run-pass/simd-binop.rs +++ b/src/test/run-pass/simd-binop.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unstable)] use std::simd::{i32x4, f32x4, u32x4}; @@ -56,17 +55,18 @@ pub fn main() { // comparison operators - assert!(eq_u32x4(u32x4(1, 2, 3, 4) == u32x4(3, 2, 1, 0), u32x4(0, !0, 0, 0))); - assert!(eq_u32x4(u32x4(1, 2, 3, 4) != u32x4(3, 2, 1, 0), u32x4(!0, 0, !0, !0))); - assert!(eq_u32x4(u32x4(1, 2, 3, 4) < u32x4(3, 2, 1, 0), u32x4(!0, 0, 0, 0))); - assert!(eq_u32x4(u32x4(1, 2, 3, 4) <= u32x4(3, 2, 1, 0), u32x4(!0, !0, 0, 0))); - assert!(eq_u32x4(u32x4(1, 2, 3, 4) >= u32x4(3, 2, 1, 0), u32x4(0, !0, !0, !0))); - assert!(eq_u32x4(u32x4(1, 2, 3, 4) > u32x4(3, 2, 1, 0), u32x4(0, 0, !0, !0))); + // check !0/-1 to ensure operators are using the correct signedness. + assert!(eq_u32x4(u32x4(1, 2, 3, !0) == u32x4(3, 2, 1, 0), u32x4(0, !0, 0, 0))); + assert!(eq_u32x4(u32x4(1, 2, 3, !0) != u32x4(3, 2, 1, 0), u32x4(!0, 0, !0, !0))); + assert!(eq_u32x4(u32x4(1, 2, 3, !0) < u32x4(3, 2, 1, 0), u32x4(!0, 0, 0, 0))); + assert!(eq_u32x4(u32x4(1, 2, 3, !0) <= u32x4(3, 2, 1, 0), u32x4(!0, !0, 0, 0))); + assert!(eq_u32x4(u32x4(1, 2, 3, !0) >= u32x4(3, 2, 1, 0), u32x4(0, !0, !0, !0))); + assert!(eq_u32x4(u32x4(1, 2, 3, !0) > u32x4(3, 2, 1, 0), u32x4(0, 0, !0, !0))); - assert!(eq_i32x4(i32x4(1, 2, 3, 4) == i32x4(3, 2, 1, 0), i32x4(0, !0, 0, 0))); - assert!(eq_i32x4(i32x4(1, 2, 3, 4) != i32x4(3, 2, 1, 0), i32x4(!0, 0, !0, !0))); - assert!(eq_i32x4(i32x4(1, 2, 3, 4) < i32x4(3, 2, 1, 0), i32x4(!0, 0, 0, 0))); - assert!(eq_i32x4(i32x4(1, 2, 3, 4) <= i32x4(3, 2, 1, 0), i32x4(!0, !0, 0, 0))); - assert!(eq_i32x4(i32x4(1, 2, 3, 4) >= i32x4(3, 2, 1, 0), i32x4(0, !0, !0, !0))); - assert!(eq_i32x4(i32x4(1, 2, 3, 4) > i32x4(3, 2, 1, 0), i32x4(0, 0, !0, !0))); + assert!(eq_i32x4(i32x4(1, 2, 3, -1) == i32x4(3, 2, 1, 0), i32x4(0, !0, 0, 0))); + assert!(eq_i32x4(i32x4(1, 2, 3, -1) != i32x4(3, 2, 1, 0), i32x4(!0, 0, !0, !0))); + assert!(eq_i32x4(i32x4(1, 2, 3, -1) < i32x4(3, 2, 1, 0), i32x4(!0, 0, 0, !0))); + assert!(eq_i32x4(i32x4(1, 2, 3, -1) <= i32x4(3, 2, 1, 0), i32x4(!0, !0, 0, !0))); + assert!(eq_i32x4(i32x4(1, 2, 3, -1) >= i32x4(3, 2, 1, 0), i32x4(0, !0, !0, 0))); + assert!(eq_i32x4(i32x4(1, 2, 3, -1) > i32x4(3, 2, 1, 0), i32x4(0, 0, !0, 0))); } diff --git a/src/test/run-pass/simd-generics.rs b/src/test/run-pass/simd-generics.rs index e89d5c9922..1371c4cc5f 100644 --- a/src/test/run-pass/simd-generics.rs +++ b/src/test/run-pass/simd-generics.rs @@ -13,9 +13,9 @@ use std::ops; -#[simd] struct f32x4(f32, f32, f32, f32); - -impl Copy for f32x4 {} +#[simd] +#[derive(Copy)] +struct f32x4(f32, f32, f32, f32); fn add>(lhs: T, rhs: T) -> T { lhs + rhs diff --git a/src/test/run-pass/simd-issue-10604.rs b/src/test/run-pass/simd-issue-10604.rs index 6f0db23e2a..7f1be4b7d7 100644 --- a/src/test/run-pass/simd-issue-10604.rs +++ b/src/test/run-pass/simd-issue-10604.rs @@ -9,7 +9,6 @@ // except according to those terms. -#![allow(unstable)] #![feature(simd)] pub fn main() { diff --git a/src/test/run-pass/simple-infer.rs b/src/test/run-pass/simple-infer.rs index 4f6feb544f..04c1af4326 100644 --- a/src/test/run-pass/simple-infer.rs +++ b/src/test/run-pass/simple-infer.rs @@ -10,4 +10,4 @@ -pub fn main() { let mut n; n = 1i; println!("{}", n); } +pub fn main() { let mut n; n = 1; println!("{}", n); } diff --git a/src/test/run-pass/simple-match-generic-tag.rs b/src/test/run-pass/simple-match-generic-tag.rs index 7ed8cb434c..2217dddbd2 100644 --- a/src/test/run-pass/simple-match-generic-tag.rs +++ b/src/test/run-pass/simple-match-generic-tag.rs @@ -8,11 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - - -enum opt { none, } +enum opt { none, some(T) } pub fn main() { let x = opt::none::; - match x { opt::none:: => { println!("hello world"); } } + match x { + opt::none:: => { println!("hello world"); } + opt::some(_) => { } + } } diff --git a/src/test/run-pass/slice-2.rs b/src/test/run-pass/slice-2.rs index 8f031d2e97..6e256be69d 100644 --- a/src/test/run-pass/slice-2.rs +++ b/src/test/run-pass/slice-2.rs @@ -13,28 +13,28 @@ fn main() { let x: &[int] = &[1, 2, 3, 4, 5]; let cmp: &[int] = &[1, 2, 3, 4, 5]; - assert!(&x[] == cmp); + assert!(&x[..] == cmp); let cmp: &[int] = &[3, 4, 5]; assert!(&x[2..] == cmp); let cmp: &[int] = &[1, 2, 3]; - assert!(&x[0..3] == cmp); + assert!(&x[..3] == cmp); let cmp: &[int] = &[2, 3, 4]; assert!(&x[1..4] == cmp); let x: Vec = vec![1, 2, 3, 4, 5]; let cmp: &[int] = &[1, 2, 3, 4, 5]; - assert!(&x[] == cmp); + assert!(&x[..] == cmp); let cmp: &[int] = &[3, 4, 5]; assert!(&x[2..] == cmp); let cmp: &[int] = &[1, 2, 3]; - assert!(&x[0..3] == cmp); + assert!(&x[..3] == cmp); let cmp: &[int] = &[2, 3, 4]; assert!(&x[1..4] == cmp); let x: &mut [int] = &mut [1, 2, 3, 4, 5]; { let cmp: &mut [int] = &mut [1, 2, 3, 4, 5]; - assert!(&mut x[] == cmp); + assert!(&mut x[..] == cmp); } { let cmp: &mut [int] = &mut [3, 4, 5]; @@ -52,7 +52,7 @@ fn main() { let mut x: Vec = vec![1, 2, 3, 4, 5]; { let cmp: &mut [int] = &mut [1, 2, 3, 4, 5]; - assert!(&mut x[] == cmp); + assert!(&mut x[..] == cmp); } { let cmp: &mut [int] = &mut [3, 4, 5]; diff --git a/src/test/run-pass/slice-panic-1.rs b/src/test/run-pass/slice-panic-1.rs index b2e3d83ca9..639ffd5600 100644 --- a/src/test/run-pass/slice-panic-1.rs +++ b/src/test/run-pass/slice-panic-1.rs @@ -10,7 +10,7 @@ // Test that if a slicing expr[..] fails, the correct cleanups happen. -use std::thread::Thread; +use std::thread; struct Foo; @@ -26,6 +26,6 @@ fn foo() { } fn main() { - let _ = Thread::scoped(move|| foo()).join(); + let _ = thread::spawn(move|| foo()).join(); unsafe { assert!(DTOR_COUNT == 2); } } diff --git a/src/test/run-pass/slice-panic-2.rs b/src/test/run-pass/slice-panic-2.rs index dea45e63ab..4a2038175d 100644 --- a/src/test/run-pass/slice-panic-2.rs +++ b/src/test/run-pass/slice-panic-2.rs @@ -10,7 +10,7 @@ // Test that if a slicing expr[..] fails, the correct cleanups happen. -use std::thread::Thread; +use std::thread; struct Foo; @@ -30,6 +30,6 @@ fn foo() { } fn main() { - let _ = Thread::scoped(move|| foo()).join(); + let _ = thread::spawn(move|| foo()).join(); unsafe { assert!(DTOR_COUNT == 2); } } diff --git a/src/test/run-pass/slice.rs b/src/test/run-pass/slice.rs index 9cb7cfd7fe..30b53dbb0a 100644 --- a/src/test/run-pass/slice.rs +++ b/src/test/run-pass/slice.rs @@ -13,7 +13,7 @@ #![feature(associated_types)] extern crate core; -use core::ops::{Index, IndexMut, Range, RangeTo, RangeFrom, FullRange}; +use core::ops::{Index, IndexMut, Range, RangeTo, RangeFrom, RangeFull}; static mut COUNT: uint = 0; @@ -40,38 +40,34 @@ impl Index> for Foo { self } } -impl Index for Foo { +impl Index for Foo { type Output = Foo; - fn index(&self, _index: &FullRange) -> &Foo { + fn index(&self, _index: &RangeFull) -> &Foo { unsafe { COUNT += 1; } self } } impl IndexMut> for Foo { - type Output = Foo; fn index_mut(&mut self, index: &Range) -> &mut Foo { unsafe { COUNT += 1; } self } } impl IndexMut> for Foo { - type Output = Foo; fn index_mut(&mut self, index: &RangeTo) -> &mut Foo { unsafe { COUNT += 1; } self } } impl IndexMut> for Foo { - type Output = Foo; fn index_mut(&mut self, index: &RangeFrom) -> &mut Foo { unsafe { COUNT += 1; } self } } -impl IndexMut for Foo { - type Output = Foo; - fn index_mut(&mut self, _index: &FullRange) -> &mut Foo { +impl IndexMut for Foo { + fn index_mut(&mut self, _index: &RangeFull) -> &mut Foo { unsafe { COUNT += 1; } self } @@ -80,11 +76,11 @@ impl IndexMut for Foo { fn main() { let mut x = Foo; - &x[]; + &x[..]; &x[Foo..]; &x[..Foo]; &x[Foo..Foo]; - &mut x[]; + &mut x[..]; &mut x[Foo..]; &mut x[..Foo]; &mut x[Foo..Foo]; diff --git a/src/test/run-pass/small-enum-range-edge.rs b/src/test/run-pass/small-enum-range-edge.rs index de38a553e1..35283e466c 100644 --- a/src/test/run-pass/small-enum-range-edge.rs +++ b/src/test/run-pass/small-enum-range-edge.rs @@ -13,18 +13,16 @@ */ #[repr(u8)] +#[derive(Copy)] enum Eu { Lu = 0, Hu = 255 } -impl Copy for Eu {} - static CLu: Eu = Eu::Lu; static CHu: Eu = Eu::Hu; #[repr(i8)] +#[derive(Copy)] enum Es { Ls = -128, Hs = 127 } -impl Copy for Es {} - static CLs: Es = Es::Ls; static CHs: Es = Es::Hs; diff --git a/src/test/run-pass/small-enums-with-fields.rs b/src/test/run-pass/small-enums-with-fields.rs index c793deaae2..475af8f2b8 100644 --- a/src/test/run-pass/small-enums-with-fields.rs +++ b/src/test/run-pass/small-enums-with-fields.rs @@ -10,7 +10,7 @@ use std::mem::size_of; -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] enum Either { Left(T), Right(U) } macro_rules! check { @@ -20,8 +20,8 @@ macro_rules! check { static S: $t = $e; let v: $t = $e; assert_eq!(S, v); - assert_eq!(format!("{:?}", v).as_slice(), $s); - assert_eq!(format!("{:?}", S).as_slice(), $s); + assert_eq!(format!("{:?}", v), $s); + assert_eq!(format!("{:?}", S), $s); });* }} } @@ -29,14 +29,14 @@ macro_rules! check { pub fn main() { check!(Option, 2, None, "None", - Some(129u8), "Some(129u8)"); + Some(129u8), "Some(129)"); check!(Option, 4, None, "None", - Some(-20000i16), "Some(-20000i16)"); + Some(-20000i16), "Some(-20000)"); check!(Either, 2, - Either::Left(132u8), "Left(132u8)", - Either::Right(-32i8), "Right(-32i8)"); + Either::Left(132u8), "Left(132)", + Either::Right(-32i8), "Right(-32)"); check!(Either, 4, - Either::Left(132u8), "Left(132u8)", - Either::Right(-20000i16), "Right(-20000i16)"); + Either::Left(132u8), "Left(132)", + Either::Right(-20000i16), "Right(-20000)"); } diff --git a/src/test/run-pass/smallest-hello-world.rs b/src/test/run-pass/smallest-hello-world.rs index 2877aa6bd3..61b2fc8b50 100644 --- a/src/test/run-pass/smallest-hello-world.rs +++ b/src/test/run-pass/smallest-hello-world.rs @@ -8,12 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-android - // Smallest "hello world" with a libc runtime +#![feature(intrinsics, lang_items, start, no_std)] #![no_std] -#![feature(intrinsics, lang_items)] extern crate libc; @@ -34,3 +32,6 @@ fn main(_: int, _: *const *const u8) -> int { return 0; } +#[cfg(target_os = "android")] +#[link(name="gcc")] +extern { } diff --git a/src/test/run-pass/snake-case-no-lowercase-equivalent.rs b/src/test/run-pass/snake-case-no-lowercase-equivalent.rs new file mode 100644 index 0000000000..2220761a02 --- /dev/null +++ b/src/test/run-pass/snake-case-no-lowercase-equivalent.rs @@ -0,0 +1,17 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(non_ascii_idents)] +#![deny(non_snake_case)] + +// This name is neither upper nor lower case +fn 你好() {} + +fn main() {} diff --git a/src/test/run-pass/spawn-types.rs b/src/test/run-pass/spawn-types.rs index eaad2abe8f..bf2f03b3e6 100644 --- a/src/test/run-pass/spawn-types.rs +++ b/src/test/run-pass/spawn-types.rs @@ -14,7 +14,7 @@ Arnold. */ -use std::thread::Thread; +use std::thread; use std::sync::mpsc::{channel, Sender}; type ctx = Sender; @@ -25,6 +25,6 @@ fn iotask(_tx: &ctx, ip: String) { pub fn main() { let (tx, _rx) = channel::(); - let t = Thread::scoped(move|| iotask(&tx, "localhost".to_string()) ); + let t = thread::spawn(move|| iotask(&tx, "localhost".to_string()) ); t.join().ok().unwrap(); } diff --git a/src/test/run-pass/spawn.rs b/src/test/run-pass/spawn.rs index 8f937afa6b..90b47f4986 100644 --- a/src/test/run-pass/spawn.rs +++ b/src/test/run-pass/spawn.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::thread::Thread; +use std::thread; pub fn main() { - Thread::scoped(move|| child(10)).join().ok().unwrap(); + thread::spawn(move|| child(10)).join().ok().unwrap(); } fn child(i: int) { println!("{}", i); assert!((i == 10)); } diff --git a/src/test/run-pass/spawn2.rs b/src/test/run-pass/spawn2.rs index 75104a4dde..91edb5fd9c 100644 --- a/src/test/run-pass/spawn2.rs +++ b/src/test/run-pass/spawn2.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::thread::Thread; +use std::thread; pub fn main() { - let t = Thread::scoped(move|| child((10, 20, 30, 40, 50, 60, 70, 80, 90)) ); + let t = thread::spawn(move|| child((10, 20, 30, 40, 50, 60, 70, 80, 90)) ); t.join().ok().unwrap(); } diff --git a/src/test/run-pass/stat.rs b/src/test/run-pass/stat.rs index 250eafa2f4..87d7376c24 100644 --- a/src/test/run-pass/stat.rs +++ b/src/test/run-pass/stat.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::io::fs::PathExtensions; -use std::io::{File, TempDir}; +use std::old_io::fs::PathExtensions; +use std::old_io::{File, TempDir}; pub fn main() { let dir = TempDir::new_in(&Path::new("."), "").unwrap(); @@ -20,7 +20,7 @@ pub fn main() { Err(..) => unreachable!(), Ok(f) => { let mut f = f; - for _ in range(0u, 1000) { + for _ in 0_usize..1000 { f.write(&[0]); } } diff --git a/src/test/run-pass/static-assert.rs b/src/test/run-pass/static-assert.rs index c695fa2b72..f8fd81b936 100644 --- a/src/test/run-pass/static-assert.rs +++ b/src/test/run-pass/static-assert.rs @@ -12,13 +12,13 @@ static b: bool = true; #[static_assert] -static c: bool = 1i == 1; +static c: bool = 1 == 1; #[static_assert] -static d: bool = 1i != 2; +static d: bool = 1 != 2; #[static_assert] -static f: bool = (4i/2) == 2; +static f: bool = (4/2) == 2; pub fn main() { } diff --git a/src/test/run-pass/static-fn-inline-xc.rs b/src/test/run-pass/static-fn-inline-xc.rs index dbe9221066..efc374e25b 100644 --- a/src/test/run-pass/static-fn-inline-xc.rs +++ b/src/test/run-pass/static-fn-inline-xc.rs @@ -15,5 +15,5 @@ extern crate "static_fn_inline_xc_aux" as mycore; use mycore::num; pub fn main() { - let _1: f64 = num::Num2::from_int2(1i); + let _1: f64 = num::Num2::from_int2(1); } diff --git a/src/test/run-pass/static-fn-trait-xc.rs b/src/test/run-pass/static-fn-trait-xc.rs index 5dd6b6dbc5..cb9f7c3da0 100644 --- a/src/test/run-pass/static-fn-trait-xc.rs +++ b/src/test/run-pass/static-fn-trait-xc.rs @@ -15,5 +15,5 @@ extern crate "static_fn_trait_xc_aux" as mycore; use mycore::num; pub fn main() { - let _1: f64 = num::Num2::from_int2(1i); + let _1: f64 = num::Num2::from_int2(1); } diff --git a/src/test/run-pass/static-impl.rs b/src/test/run-pass/static-impl.rs index 74c0663971..b66999c8e6 100644 --- a/src/test/run-pass/static-impl.rs +++ b/src/test/run-pass/static-impl.rs @@ -34,8 +34,8 @@ impl uint_utils for uint { self.to_string() } fn multi(&self, mut f: F) where F: FnMut(uint) { - let mut c = 0u; - while c < *self { f(c); c += 1u; } + let mut c = 0_usize; + while c < *self { f(c); c += 1_usize; } } } @@ -47,10 +47,10 @@ trait vec_utils { impl vec_utils for Vec { fn length_(&self) -> uint { self.len() } - fn iter_(&self, mut f: F) where F: FnMut(&T) { for x in self.iter() { f(x); } } + fn iter_(&self, mut f: F) where F: FnMut(&T) { for x in self { f(x); } } fn map_(&self, mut f: F) -> Vec where F: FnMut(&T) -> U { let mut r = Vec::new(); - for elt in self.iter() { + for elt in self { r.push(f(elt)); } r @@ -58,15 +58,15 @@ impl vec_utils for Vec { } pub fn main() { - assert_eq!(10u.plus(), 30); + assert_eq!(10_usize.plus(), 30); assert_eq!(("hi".to_string()).plus(), 200); - assert_eq!((vec!(1i)).length_().str(), "1".to_string()); - let vect = vec!(3i, 4).map_(|a| *a + 4); + 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!(3i, 4)).map_::(|a| *a as uint + 4u); - assert_eq!(vect[0], 7u); - let mut x = 0u; - 10u.multi(|_n| x += 2u ); - assert_eq!(x, 20u); + let vect = (vec!(3, 4)).map_::(|a| *a as uint + 4_usize); + assert_eq!(vect[0], 7_usize); + let mut x = 0_usize; + 10_usize.multi(|_n| x += 2_usize ); + assert_eq!(x, 20_usize); } diff --git a/src/test/run-pass/static-methods-in-traits.rs b/src/test/run-pass/static-methods-in-traits.rs index 180cd115c9..5f6dc4f2a5 100644 --- a/src/test/run-pass/static-methods-in-traits.rs +++ b/src/test/run-pass/static-methods-in-traits.rs @@ -21,7 +21,7 @@ mod a { impl Foo for uint { fn foo() -> uint { - 5u + 5_usize } } } diff --git a/src/test/run-pass/string-self-append.rs b/src/test/run-pass/string-self-append.rs index dc1e23ca09..359c14ea7b 100644 --- a/src/test/run-pass/string-self-append.rs +++ b/src/test/run-pass/string-self-append.rs @@ -11,13 +11,13 @@ pub fn main() { // Make sure we properly handle repeated self-appends. let mut a: String = "A".to_string(); - let mut i = 20i; - let mut expected_len = 1u; + let mut i = 20; + let mut expected_len = 1_usize; while i > 0 { println!("{}", a.len()); assert_eq!(a.len(), expected_len); a = format!("{}{}", a, a); i -= 1; - expected_len *= 2u; + expected_len *= 2_usize; } } diff --git a/src/test/run-pass/struct-lit-functional-no-fields.rs b/src/test/run-pass/struct-lit-functional-no-fields.rs index da40f10e9f..c3b1ff0f05 100644 --- a/src/test/run-pass/struct-lit-functional-no-fields.rs +++ b/src/test/run-pass/struct-lit-functional-no-fields.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(Show,PartialEq,Clone)] +#[derive(Debug,PartialEq,Clone)] struct Foo { bar: T, baz: T @@ -16,8 +16,8 @@ struct Foo { pub fn main() { let foo = Foo { - bar: 0i, - baz: 1i + bar: 0, + baz: 1 }; let foo_ = foo.clone(); diff --git a/src/test/run-pass/struct-partial-move-1.rs b/src/test/run-pass/struct-partial-move-1.rs index 043ca121b1..8f75b763d9 100644 --- a/src/test/run-pass/struct-partial-move-1.rs +++ b/src/test/run-pass/struct-partial-move-1.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] pub struct Partial { x: T, y: T } -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct S { val: int } impl S { fn new(v: int) -> S { S { val: v } } } impl Drop for S { fn drop(&mut self) { } } diff --git a/src/test/run-pass/struct-partial-move-2.rs b/src/test/run-pass/struct-partial-move-2.rs index 6327e03e52..377e9e6b89 100644 --- a/src/test/run-pass/struct-partial-move-2.rs +++ b/src/test/run-pass/struct-partial-move-2.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] pub struct Partial { x: T, y: T } -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct S { val: int } impl S { fn new(v: int) -> S { S { val: v } } } impl Drop for S { fn drop(&mut self) { } } diff --git a/src/test/run-pass/struct-return.rs b/src/test/run-pass/struct-return.rs index bd945327d1..c8768731e2 100644 --- a/src/test/run-pass/struct-return.rs +++ b/src/test/run-pass/struct-return.rs @@ -10,14 +10,12 @@ // // ignore-lexer-test FIXME #15883 +#[derive(Copy)] pub struct Quad { a: u64, b: u64, c: u64, d: u64 } -impl Copy for Quad {} - +#[derive(Copy)] pub struct Floats { a: f64, b: u8, c: f64 } -impl Copy for Floats {} - mod rustrt { use super::{Floats, Quad}; diff --git a/src/test/run-pass/structured-compare.rs b/src/test/run-pass/structured-compare.rs index 4f6ed55f42..12d8fe8f4c 100644 --- a/src/test/run-pass/structured-compare.rs +++ b/src/test/run-pass/structured-compare.rs @@ -10,11 +10,9 @@ -#[derive(Show)] +#[derive(Copy, Debug)] enum foo { large, small, } -impl Copy for foo {} - impl PartialEq for foo { fn eq(&self, other: &foo) -> bool { ((*self) as uint) == ((*other) as uint) @@ -23,14 +21,14 @@ impl PartialEq for foo { } pub fn main() { - let a = (1i, 2i, 3i); - let b = (1i, 2i, 3i); + let a = (1, 2, 3); + let b = (1, 2, 3); assert_eq!(a, b); assert!((a != (1, 2, 4))); assert!((a < (1, 2, 4))); assert!((a <= (1, 2, 4))); - assert!(((1i, 2i, 4i) > a)); - assert!(((1i, 2i, 4i) >= a)); + assert!(((1, 2, 4) > a)); + assert!(((1, 2, 4) >= a)); let x = foo::large; let y = foo::small; assert!((x != y)); diff --git a/src/test/run-pass/supertrait-default-generics.rs b/src/test/run-pass/supertrait-default-generics.rs index f31d9ca186..e158ae672a 100644 --- a/src/test/run-pass/supertrait-default-generics.rs +++ b/src/test/run-pass/supertrait-default-generics.rs @@ -38,7 +38,7 @@ impl Positioned for Point { impl> Movable for Point {} pub fn main() { - let mut p = Point{ x: 1i, y: 2i}; + let mut p = Point{ x: 1, y: 2}; p.translate(3); assert_eq!(p.X(), 4); } diff --git a/src/test/run-pass/supported-cast.rs b/src/test/run-pass/supported-cast.rs index 7cba4533c7..3fffef060a 100644 --- a/src/test/run-pass/supported-cast.rs +++ b/src/test/run-pass/supported-cast.rs @@ -11,7 +11,7 @@ extern crate libc; pub fn main() { - let f = 1u as *const libc::FILE; + let f = 1_usize as *const libc::FILE; println!("{:?}", f as int); println!("{:?}", f as uint); println!("{:?}", f as i8); @@ -34,22 +34,22 @@ pub fn main() { println!("{:?}", 1 as u16); println!("{:?}", 1 as u32); println!("{:?}", 1 as u64); - println!("{:?}", 1i as f32); - println!("{:?}", 1i as f64); - - println!("{:?}", 1u as int); - println!("{:?}", 1u as uint); - println!("{:?}", 1u as *const libc::FILE); - println!("{:?}", 1u as i8); - println!("{:?}", 1u as i16); - println!("{:?}", 1u as i32); - println!("{:?}", 1u as i64); - println!("{:?}", 1u as u8); - println!("{:?}", 1u as u16); - println!("{:?}", 1u as u32); - println!("{:?}", 1u as u64); - println!("{:?}", 1u as f32); - println!("{:?}", 1u as f64); + println!("{:?}", 1 as f32); + println!("{:?}", 1 as f64); + + println!("{:?}", 1_usize as int); + println!("{:?}", 1_usize as uint); + println!("{:?}", 1_usize as *const libc::FILE); + println!("{:?}", 1_usize as i8); + println!("{:?}", 1_usize as i16); + println!("{:?}", 1_usize as i32); + println!("{:?}", 1_usize as i64); + println!("{:?}", 1_usize as u8); + println!("{:?}", 1_usize as u16); + println!("{:?}", 1_usize as u32); + println!("{:?}", 1_usize as u64); + println!("{:?}", 1_usize as f32); + println!("{:?}", 1_usize as f64); println!("{:?}", 1i8 as int); println!("{:?}", 1i8 as uint); diff --git a/src/test/run-pass/swap-1.rs b/src/test/run-pass/swap-1.rs index 9a77356d7e..82a76512e0 100644 --- a/src/test/run-pass/swap-1.rs +++ b/src/test/run-pass/swap-1.rs @@ -11,7 +11,7 @@ use std::mem::swap; pub fn main() { - let mut x = 3i; let mut y = 7i; + let mut x = 3; let mut y = 7; swap(&mut x, &mut y); assert!((x == 7)); assert!((y == 3)); } diff --git a/src/test/run-pass/swap-2.rs b/src/test/run-pass/swap-2.rs index 3c0f950573..1dbd29a781 100644 --- a/src/test/run-pass/swap-2.rs +++ b/src/test/run-pass/swap-2.rs @@ -12,7 +12,7 @@ use std::mem::swap; pub fn main() { let mut a: Vec = vec!(0, 1, 2, 3, 4, 5, 6); - a.as_mut_slice().swap(2, 4); + a.swap(2, 4); assert_eq!(a[2], 4); assert_eq!(a[4], 2); let mut n = 42; diff --git a/src/test/run-pass/syntax-extension-source-utils-files/includeme.fragment b/src/test/run-pass/syntax-extension-source-utils-files/includeme.fragment index 5d326a50f0..dea7f99fcb 100644 --- a/src/test/run-pass/syntax-extension-source-utils-files/includeme.fragment +++ b/src/test/run-pass/syntax-extension-source-utils-files/includeme.fragment @@ -2,6 +2,6 @@ { assert!(file!().ends_with("includeme.fragment")); - assert!(line!() == 5u); + assert!(line!() == 5_usize); format!("victory robot {}", line!()) } diff --git a/src/test/run-pass/syntax-extension-source-utils.rs b/src/test/run-pass/syntax-extension-source-utils.rs index f85305cf31..349a676a43 100644 --- a/src/test/run-pass/syntax-extension-source-utils.rs +++ b/src/test/run-pass/syntax-extension-source-utils.rs @@ -40,7 +40,7 @@ pub fn main() { include_bytes!("syntax-extension-source-utils-files/includeme.fragment") [1] == (42 as u8)); // '*' // The Windows tests are wrapped in an extra module for some reason - assert!((m1::m2::where_am_i().as_slice().ends_with("m1::m2"))); + assert!((m1::m2::where_am_i().ends_with("m1::m2"))); assert!(match (45, "( 2 * 3 ) + 5") { (line!(), stringify!((2*3) + 5)) => true, diff --git a/src/test/run-pass/syntax-trait-polarity.rs b/src/test/run-pass/syntax-trait-polarity.rs index a91e5da153..340ad2a531 100644 --- a/src/test/run-pass/syntax-trait-polarity.rs +++ b/src/test/run-pass/syntax-trait-polarity.rs @@ -10,22 +10,20 @@ #![feature(optin_builtin_traits)] -use std::marker::Send; +use std::marker::{MarkerTrait, Send}; struct TestType; impl TestType {} -trait TestTrait {} +trait TestTrait : MarkerTrait {} -unsafe impl !Send for TestType {} -impl !TestTrait for TestType {} +impl !Send for TestType {} -struct TestType2; +struct TestType2(T); impl TestType2 {} -unsafe impl !Send for TestType2 {} -impl !TestTrait for TestType2 {} +impl !Send for TestType2 {} fn main() {} diff --git a/src/test/run-pass/tag-align-dyn-u64.rs b/src/test/run-pass/tag-align-dyn-u64.rs index 7805204aa0..b7fe4983b0 100644 --- a/src/test/run-pass/tag-align-dyn-u64.rs +++ b/src/test/run-pass/tag-align-dyn-u64.rs @@ -28,7 +28,7 @@ fn mk_rec() -> Rec { fn is_8_byte_aligned(u: &Tag) -> bool { let p: uint = unsafe { mem::transmute(u) }; - return (p & 7u) == 0u; + return (p & 7_usize) == 0_usize; } pub fn main() { diff --git a/src/test/run-pass/tag-align-dyn-variants.rs b/src/test/run-pass/tag-align-dyn-variants.rs index aef9e23ce4..cb298e720e 100644 --- a/src/test/run-pass/tag-align-dyn-variants.rs +++ b/src/test/run-pass/tag-align-dyn-variants.rs @@ -31,7 +31,7 @@ fn mk_rec(a: A, b: B) -> Rec { fn is_aligned(amnt: uint, u: &A) -> bool { let p: uint = unsafe { mem::transmute(u) }; - return (p & (amnt-1u)) == 0u; + return (p & (amnt-1_usize)) == 0_usize; } fn variant_data_is_aligned(amnt: uint, u: &Tag) -> bool { @@ -43,32 +43,32 @@ fn variant_data_is_aligned(amnt: uint, u: &Tag) -> bool { pub fn main() { let x = mk_rec(22u64, 23u64); - assert!(is_aligned(8u, &x.tA)); - assert!(variant_data_is_aligned(8u, &x.tA)); - assert!(is_aligned(8u, &x.tB)); - assert!(variant_data_is_aligned(8u, &x.tB)); + assert!(is_aligned(8_usize, &x.tA)); + assert!(variant_data_is_aligned(8_usize, &x.tA)); + assert!(is_aligned(8_usize, &x.tB)); + assert!(variant_data_is_aligned(8_usize, &x.tB)); let x = mk_rec(22u64, 23u32); - assert!(is_aligned(8u, &x.tA)); - assert!(variant_data_is_aligned(8u, &x.tA)); - assert!(is_aligned(8u, &x.tB)); - assert!(variant_data_is_aligned(4u, &x.tB)); + assert!(is_aligned(8_usize, &x.tA)); + assert!(variant_data_is_aligned(8_usize, &x.tA)); + assert!(is_aligned(8_usize, &x.tB)); + assert!(variant_data_is_aligned(4_usize, &x.tB)); let x = mk_rec(22u32, 23u64); - assert!(is_aligned(8u, &x.tA)); - assert!(variant_data_is_aligned(4u, &x.tA)); - assert!(is_aligned(8u, &x.tB)); - assert!(variant_data_is_aligned(8u, &x.tB)); + assert!(is_aligned(8_usize, &x.tA)); + assert!(variant_data_is_aligned(4_usize, &x.tA)); + assert!(is_aligned(8_usize, &x.tB)); + assert!(variant_data_is_aligned(8_usize, &x.tB)); let x = mk_rec(22u32, 23u32); - assert!(is_aligned(4u, &x.tA)); - assert!(variant_data_is_aligned(4u, &x.tA)); - assert!(is_aligned(4u, &x.tB)); - assert!(variant_data_is_aligned(4u, &x.tB)); + assert!(is_aligned(4_usize, &x.tA)); + assert!(variant_data_is_aligned(4_usize, &x.tA)); + assert!(is_aligned(4_usize, &x.tB)); + assert!(variant_data_is_aligned(4_usize, &x.tB)); let x = mk_rec(22f64, 23f64); - assert!(is_aligned(8u, &x.tA)); - assert!(variant_data_is_aligned(8u, &x.tA)); - assert!(is_aligned(8u, &x.tB)); - assert!(variant_data_is_aligned(8u, &x.tB)); + assert!(is_aligned(8_usize, &x.tA)); + assert!(variant_data_is_aligned(8_usize, &x.tA)); + assert!(is_aligned(8_usize, &x.tB)); + assert!(variant_data_is_aligned(8_usize, &x.tB)); } diff --git a/src/test/run-pass/tag-align-shape.rs b/src/test/run-pass/tag-align-shape.rs index b88357252d..cc0a75181d 100644 --- a/src/test/run-pass/tag-align-shape.rs +++ b/src/test/run-pass/tag-align-shape.rs @@ -8,12 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(Show)] +#[derive(Debug)] enum a_tag { a_tag_var(u64) } -#[derive(Show)] +#[derive(Debug)] struct t_rec { c8: u8, t: a_tag @@ -23,5 +23,5 @@ pub fn main() { let x = t_rec {c8: 22u8, t: a_tag::a_tag_var(44u64)}; let y = format!("{:?}", x); println!("y = {:?}", y); - assert_eq!(y, "t_rec { c8: 22u8, t: a_tag_var(44u64) }".to_string()); + assert_eq!(y, "t_rec { c8: 22, t: a_tag_var(44) }".to_string()); } diff --git a/src/test/run-pass/tag-align-u64.rs b/src/test/run-pass/tag-align-u64.rs index be84888477..713f55cc10 100644 --- a/src/test/run-pass/tag-align-u64.rs +++ b/src/test/run-pass/tag-align-u64.rs @@ -28,7 +28,7 @@ fn mk_rec() -> Rec { fn is_8_byte_aligned(u: &Tag) -> bool { let p: uint = unsafe { mem::transmute(u) }; - return (p & 7u) == 0u; + return (p & 7_usize) == 0_usize; } pub fn main() { diff --git a/src/test/run-pass/tag-disr-val-shape.rs b/src/test/run-pass/tag-disr-val-shape.rs index 049e4bb9a3..fba3f9fb0d 100644 --- a/src/test/run-pass/tag-disr-val-shape.rs +++ b/src/test/run-pass/tag-disr-val-shape.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(Show)] +#[derive(Debug)] enum color { red = 0xff0000, green = 0x00ff00, diff --git a/src/test/run-pass/tag-variant-disr-type-mismatch.rs b/src/test/run-pass/tag-variant-disr-type-mismatch.rs index c04751d51b..7e4bd9ab27 100644 --- a/src/test/run-pass/tag-variant-disr-type-mismatch.rs +++ b/src/test/run-pass/tag-variant-disr-type-mismatch.rs @@ -9,7 +9,7 @@ // except according to those terms. enum color { - red = 1i, + red = 1, blue = 2, } diff --git a/src/test/run-pass/tag-variant-disr-val.rs b/src/test/run-pass/tag-variant-disr-val.rs index cf53c1a912..915a0b5b7e 100644 --- a/src/test/run-pass/tag-variant-disr-val.rs +++ b/src/test/run-pass/tag-variant-disr-val.rs @@ -9,6 +9,7 @@ // except according to those terms. use color::{red, green, blue, black, white, imaginary, purple, orange}; +#[derive(Copy)] enum color { red = 0xff0000, green = 0x00ff00, @@ -20,8 +21,6 @@ enum color { orange = 8 >> 1 } -impl Copy for color {} - impl PartialEq for color { fn eq(&self, other: &color) -> bool { ((*self) as uint) == ((*other) as uint) diff --git a/src/test/run-pass/task-comm-12.rs b/src/test/run-pass/task-comm-12.rs index da080408ad..08dce2a764 100644 --- a/src/test/run-pass/task-comm-12.rs +++ b/src/test/run-pass/task-comm-12.rs @@ -21,7 +21,7 @@ fn test00() { }); // Sleep long enough for the task to finish. - let mut i = 0u; + let mut i = 0_usize; while i < 10000 { Thread::yield_now(); i += 1; diff --git a/src/test/run-pass/task-comm-16.rs b/src/test/run-pass/task-comm-16.rs index 065777bd96..1d297c04c8 100644 --- a/src/test/run-pass/task-comm-16.rs +++ b/src/test/run-pass/task-comm-16.rs @@ -46,7 +46,7 @@ fn test_str() { assert_eq!(s1.as_bytes()[3], 't' as u8); } -#[derive(Show)] +#[derive(Debug)] enum t { tag1, tag2(int), diff --git a/src/test/run-pass/task-comm-3.rs b/src/test/run-pass/task-comm-3.rs index 306cc0ffce..9028294683 100644 --- a/src/test/run-pass/task-comm-3.rs +++ b/src/test/run-pass/task-comm-3.rs @@ -51,7 +51,7 @@ fn test00() { // Read from spawned tasks... let mut sum = 0; - for _r in results.iter() { + for _r in &results { i = 0; while i < number_of_messages { let value = rx.recv().unwrap(); @@ -61,7 +61,7 @@ fn test00() { } // Join spawned tasks... - for r in results.into_iter() { r.join(); } + for r in results { r.join(); } println!("Completed: Final number is: "); println!("{}", sum); diff --git a/src/test/run-pass/task-stderr.rs b/src/test/run-pass/task-stderr.rs index 5e6247bac9..1c263b19dd 100644 --- a/src/test/run-pass/task-stderr.rs +++ b/src/test/run-pass/task-stderr.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] use std::sync::mpsc::channel; -use std::io::{ChanReader, ChanWriter}; +use std::old_io::{ChanReader, ChanWriter}; use std::thread; fn main() { @@ -20,11 +20,12 @@ fn main() { let mut reader = ChanReader::new(rx); let stderr = ChanWriter::new(tx); - let res = thread::Builder::new().stderr(box stderr as Box).scoped(move|| -> () { + let res = thread::Builder::new().stderr(box stderr as Box) + .spawn(move|| -> () { panic!("Hello, world!") - }).join(); + }).unwrap().join(); assert!(res.is_err()); let output = reader.read_to_string().unwrap(); - assert!(output.as_slice().contains("Hello, world!")); + assert!(output.contains("Hello, world!")); } diff --git a/src/test/run-pass/tcp-accept-stress.rs b/src/test/run-pass/tcp-accept-stress.rs index cad7173203..b87718ba46 100644 --- a/src/test/run-pass/tcp-accept-stress.rs +++ b/src/test/run-pass/tcp-accept-stress.rs @@ -13,9 +13,9 @@ // quite quickly and it takes a few seconds for the sockets to get // recycled. -use std::io::{TcpListener, Listener, Acceptor, EndOfFile, TcpStream}; +use std::old_io::{TcpListener, Listener, Acceptor, EndOfFile, TcpStream}; use std::sync::Arc; -use std::sync::atomic::{AtomicUint, Ordering}; +use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::mpsc::channel; use std::thread::Thread; @@ -30,11 +30,11 @@ fn test() { let mut l = TcpListener::bind("127.0.0.1:0").unwrap(); let addr = l.socket_name().unwrap(); let mut a = l.listen().unwrap(); - let cnt = Arc::new(AtomicUint::new(0)); + let cnt = Arc::new(AtomicUsize::new(0)); let (srv_tx, srv_rx) = channel(); let (cli_tx, cli_rx) = channel(); - let _t = range(0, N).map(|_| { + let _t = (0..N).map(|_| { let a = a.clone(); let cnt = cnt.clone(); let srv_tx = srv_tx.clone(); @@ -55,10 +55,10 @@ fn test() { }) }).collect::>(); - let _t = range(0, N).map(|_| { + let _t = (0..N).map(|_| { let cli_tx = cli_tx.clone(); Thread::scoped(move|| { - for _ in range(0, M) { + for _ in 0..M { let _s = TcpStream::connect(addr).unwrap(); } cli_tx.send(()); diff --git a/src/test/run-pass/tcp-connect-timeouts.rs b/src/test/run-pass/tcp-connect-timeouts.rs index 56044289fb..d1a3edcfbc 100644 --- a/src/test/run-pass/tcp-connect-timeouts.rs +++ b/src/test/run-pass/tcp-connect-timeouts.rs @@ -16,14 +16,13 @@ // one test task to ensure that errors are timeouts, not file descriptor // exhaustion. -#![allow(unstable)] #![reexport_test_harness_main = "test_main"] #![allow(unused_imports)] -use std::io::*; -use std::io::test::*; -use std::io; +use std::old_io::*; +use std::old_io::test::*; +use std::old_io; use std::time::Duration; use std::sync::mpsc::channel; use std::thread::Thread; @@ -42,10 +41,10 @@ fn eventual_timeout() { rx1.recv().unwrap(); let mut v = Vec::new(); - for _ in range(0u, 10000) { + for _ in 0_usize..10000 { match TcpStream::connect_timeout(addr, Duration::milliseconds(100)) { Ok(e) => v.push(e), - Err(ref e) if e.kind == io::TimedOut => return, + Err(ref e) if e.kind == old_io::TimedOut => return, Err(e) => panic!("other error: {}", e), } } diff --git a/src/test/run-pass/tcp-stress.rs b/src/test/run-pass/tcp-stress.rs index 0109d64ad5..82584c83de 100644 --- a/src/test/run-pass/tcp-stress.rs +++ b/src/test/run-pass/tcp-stress.rs @@ -1,4 +1,4 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -10,6 +10,7 @@ // ignore-linux see joyent/libuv#1189 // ignore-android needs extra network permissions +// ignore-openbsd system ulimit (Too many open files) // exec-env:RUST_LOG=debug #[macro_use] @@ -17,15 +18,15 @@ extern crate log; extern crate libc; use std::sync::mpsc::channel; -use std::io::net::tcp::{TcpListener, TcpStream}; -use std::io::{Acceptor, Listener}; +use std::old_io::net::tcp::{TcpListener, TcpStream}; +use std::old_io::{Acceptor, Listener}; use std::thread::{Builder, Thread}; use std::time::Duration; fn main() { // This test has a chance to time out, try to not let it time out Thread::spawn(move|| -> () { - use std::io::timer; + use std::old_io::timer; timer::sleep(Duration::milliseconds(30 * 1000)); println!("timed out!"); unsafe { libc::exit(1) } @@ -51,7 +52,7 @@ fn main() { let addr = rx.recv().unwrap(); let (tx, rx) = channel(); - for _ in range(0u, 1000) { + for _ in 0_usize..1000 { let tx = tx.clone(); Builder::new().stack_size(64 * 1024).spawn(move|| { match TcpStream::connect(addr) { @@ -70,7 +71,7 @@ fn main() { // Wait for all clients to exit, but don't wait for the server to exit. The // server just runs infinitely. drop(tx); - for _ in range(0u, 1000) { + for _ in 0_usize..1000 { rx.recv().unwrap(); } unsafe { libc::exit(0) } diff --git a/src/test/run-pass/tempfile.rs b/src/test/run-pass/tempfile.rs index b931bd9609..053df3a57f 100644 --- a/src/test/run-pass/tempfile.rs +++ b/src/test/run-pass/tempfile.rs @@ -18,12 +18,12 @@ // they're in a different location than before. Hence, these tests are all run // serially here. -use std::io::fs::PathExtensions; -use std::io::{fs, TempDir}; -use std::io; +use std::old_io::fs::PathExtensions; +use std::old_io::{fs, TempDir}; +use std::old_io; use std::os; use std::sync::mpsc::channel; -use std::thread::Thread; +use std::thread; fn test_tempdir() { let path = { @@ -37,30 +37,31 @@ fn test_tempdir() { fn test_rm_tempdir() { let (tx, rx) = channel(); - let f = move|:| -> () { + let f = move|| -> () { let tmp = TempDir::new("test_rm_tempdir").unwrap(); tx.send(tmp.path().clone()).unwrap(); panic!("panic to unwind past `tmp`"); }; - let _ = Thread::scoped(f).join(); + thread::spawn(f).join(); let path = rx.recv().unwrap(); assert!(!path.exists()); let tmp = TempDir::new("test_rm_tempdir").unwrap(); let path = tmp.path().clone(); - let f = move|:| -> () { + let f = move|| -> () { let _tmp = tmp; panic!("panic to unwind past `tmp`"); }; - let _ = Thread::scoped(f).join(); + thread::spawn(f).join(); assert!(!path.exists()); let path; { - let f = move|:| { + let f = move || { TempDir::new("test_rm_tempdir").unwrap() }; - let tmp = Thread::scoped(f).join().ok().expect("test_rm_tmdir"); + // FIXME(#16640) `: TempDir` annotation shouldn't be necessary + let tmp: TempDir = thread::scoped(f).join(); path = tmp.path().clone(); assert!(path.exists()); } @@ -78,32 +79,33 @@ fn test_rm_tempdir() { fn test_rm_tempdir_close() { let (tx, rx) = channel(); - let f = move|:| -> () { + let f = move|| -> () { let tmp = TempDir::new("test_rm_tempdir").unwrap(); tx.send(tmp.path().clone()).unwrap(); tmp.close(); panic!("panic when unwinding past `tmp`"); }; - let _ = Thread::scoped(f).join(); + thread::spawn(f).join(); let path = rx.recv().unwrap(); assert!(!path.exists()); let tmp = TempDir::new("test_rm_tempdir").unwrap(); let path = tmp.path().clone(); - let f = move|:| -> () { + let f = move|| -> () { let tmp = tmp; tmp.close(); panic!("panic when unwinding past `tmp`"); }; - let _ = Thread::scoped(f).join(); + thread::spawn(f).join(); assert!(!path.exists()); let path; { - let f = move|:| { + let f = move || { TempDir::new("test_rm_tempdir").unwrap() }; - let tmp = Thread::scoped(f).join().ok().expect("test_rm_tmdir"); + // FIXME(#16640) `: TempDir` annotation shouldn't be necessary + let tmp: TempDir = thread::scoped(f).join(); path = tmp.path().clone(); assert!(path.exists()); tmp.close(); @@ -127,17 +129,17 @@ fn recursive_mkdir_rel() { let cwd = os::getcwd().unwrap(); println!("recursive_mkdir_rel: Making: {} in cwd {} [{}]", path.display(), cwd.display(), path.exists()); - fs::mkdir_recursive(&path, io::USER_RWX); + fs::mkdir_recursive(&path, old_io::USER_RWX); assert!(path.is_dir()); - fs::mkdir_recursive(&path, io::USER_RWX); + fs::mkdir_recursive(&path, old_io::USER_RWX); assert!(path.is_dir()); } fn recursive_mkdir_dot() { let dot = Path::new("."); - fs::mkdir_recursive(&dot, io::USER_RWX); + fs::mkdir_recursive(&dot, old_io::USER_RWX); let dotdot = Path::new(".."); - fs::mkdir_recursive(&dotdot, io::USER_RWX); + fs::mkdir_recursive(&dotdot, old_io::USER_RWX); } fn recursive_mkdir_rel_2() { @@ -145,20 +147,20 @@ fn recursive_mkdir_rel_2() { let cwd = os::getcwd().unwrap(); println!("recursive_mkdir_rel_2: Making: {} in cwd {} [{}]", path.display(), cwd.display(), path.exists()); - fs::mkdir_recursive(&path, io::USER_RWX); + fs::mkdir_recursive(&path, old_io::USER_RWX); assert!(path.is_dir()); assert!(path.dir_path().is_dir()); let path2 = Path::new("quux/blat"); println!("recursive_mkdir_rel_2: Making: {} in cwd {}", path2.display(), cwd.display()); - fs::mkdir_recursive(&path2, io::USER_RWX); + fs::mkdir_recursive(&path2, old_io::USER_RWX); assert!(path2.is_dir()); assert!(path2.dir_path().is_dir()); } // Ideally this would be in core, but needs TempFile pub fn test_rmdir_recursive_ok() { - let rwx = io::USER_RWX; + let rwx = old_io::USER_RWX; let tmpdir = TempDir::new("test").ok().expect("test_rmdir_recursive_ok: \ couldn't create temp dir"); @@ -177,7 +179,7 @@ pub fn test_rmdir_recursive_ok() { } pub fn dont_double_panic() { - let r: Result<(), _> = Thread::scoped(move|| { + let r: Result<(), _> = thread::spawn(move|| { let tmpdir = TempDir::new("test").unwrap(); // Remove the temporary directory so that TempDir sees // an error on drop diff --git a/src/test/run-pass/terminate-in-initializer.rs b/src/test/run-pass/terminate-in-initializer.rs index bfd1f5f4a7..bef9efa9eb 100644 --- a/src/test/run-pass/terminate-in-initializer.rs +++ b/src/test/run-pass/terminate-in-initializer.rs @@ -12,23 +12,23 @@ // Issue #787 // Don't try to clean up uninitialized locals -use std::thread::Thread; +use std::thread; fn test_break() { loop { let _x: Box = break; } } -fn test_cont() { let mut i = 0i; while i < 1 { i += 1; let _x: Box = continue; } } +fn test_cont() { let mut i = 0; while i < 1 { i += 1; let _x: Box = continue; } } fn test_ret() { let _x: Box = return; } fn test_panic() { fn f() { let _x: Box = panic!(); } - Thread::scoped(move|| f() ).join().err().unwrap(); + thread::spawn(move|| f() ).join().err().unwrap(); } fn test_panic_indirect() { fn f() -> ! { panic!(); } fn g() { let _x: Box = f(); } - Thread::scoped(move|| g() ).join().err().unwrap(); + thread::spawn(move|| g() ).join().err().unwrap(); } pub fn main() { diff --git a/src/test/run-pass/test-fn-signature-verification-for-explicit-return-type.rs b/src/test/run-pass/test-fn-signature-verification-for-explicit-return-type.rs new file mode 100644 index 0000000000..7c99c968e3 --- /dev/null +++ b/src/test/run-pass/test-fn-signature-verification-for-explicit-return-type.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: --test +// no-pretty-expanded +extern crate test; + +#[bench] +fn bench_explicit_return_type(_: &mut ::test::Bencher) -> () {} + +#[test] +fn test_explicit_return_type() -> () {} + diff --git a/src/test/run-pass/trailing-comma.rs b/src/test/run-pass/trailing-comma.rs index 00e0506408..76c62a83e7 100644 --- a/src/test/run-pass/trailing-comma.rs +++ b/src/test/run-pass/trailing-comma.rs @@ -12,7 +12,7 @@ fn f(_: T,) {} -struct Foo; +struct Foo(T); struct Bar; @@ -28,16 +28,16 @@ enum Baz { #[allow(unused,)] pub fn main() { - f::(0i,); - let (_, _,) = (1i, 1i,); - let [_, _,] = [1i, 1,]; - let [_, _, .., _,] = [1i, 1, 1, 1,]; - let [_, _, _.., _,] = [1i, 1, 1, 1,]; + f::(0,); + let (_, _,) = (1, 1,); + let [_, _,] = [1, 1,]; + let [_, _, .., _,] = [1, 1, 1, 1,]; + let [_, _, _.., _,] = [1, 1, 1, 1,]; - let x: Foo = Foo::; + let x: Foo = Foo::(1); - Bar::f(0i,); - Bar.g(0i,); + Bar::f(0,); + Bar.g(0,); Bar.h(); let x = Baz::Qux(1,); diff --git a/src/test/run-pass/trait-bounds-basic.rs b/src/test/run-pass/trait-bounds-basic.rs index d03496403a..ed25bf8b02 100644 --- a/src/test/run-pass/trait-bounds-basic.rs +++ b/src/test/run-pass/trait-bounds-basic.rs @@ -9,7 +9,7 @@ // except according to those terms. -trait Foo { +trait Foo : ::std::marker::MarkerTrait { } fn b(_x: Box) { diff --git a/src/test/run-pass/trait-bounds-in-arc.rs b/src/test/run-pass/trait-bounds-in-arc.rs index 0089646d0a..26772a5b22 100644 --- a/src/test/run-pass/trait-bounds-in-arc.rs +++ b/src/test/run-pass/trait-bounds-in-arc.rs @@ -44,19 +44,19 @@ struct Goldfyshe { } impl Pet for Catte { - fn name(&self, mut blk: Box) { blk(self.name.as_slice()) } + fn name(&self, mut blk: Box) { blk(&self.name) } fn num_legs(&self) -> uint { 4 } fn of_good_pedigree(&self) -> bool { self.num_whiskers >= 4 } } impl Pet for Dogge { - fn name(&self, mut blk: Box) { blk(self.name.as_slice()) } + fn name(&self, mut blk: Box) { blk(&self.name) } fn num_legs(&self) -> uint { 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) { blk(self.name.as_slice()) } + fn name(&self, mut blk: Box) { blk(&self.name) } fn num_legs(&self) -> uint { 0 } fn of_good_pedigree(&self) -> bool { self.swim_speed >= 500 } } @@ -97,20 +97,20 @@ pub fn main() { fn check_legs(arc: Arc>>) { let mut legs = 0; - for pet in arc.iter() { + for pet in &*arc { legs += pet.num_legs(); } assert!(legs == 12); } fn check_names(arc: Arc>>) { - for pet in arc.iter() { + for pet in &*arc { pet.name(box |name| { assert!(name.as_bytes()[0] == 'a' as u8 && name.as_bytes()[1] == 'l' as u8); }) } } fn check_pedigree(arc: Arc>>) { - for pet in arc.iter() { + for pet in &*arc { assert!(pet.of_good_pedigree()); } } diff --git a/src/test/run-pass/trait-bounds-on-structs-and-enums.rs b/src/test/run-pass/trait-bounds-on-structs-and-enums.rs index e3234f0375..976120908b 100644 --- a/src/test/run-pass/trait-bounds-on-structs-and-enums.rs +++ b/src/test/run-pass/trait-bounds-on-structs-and-enums.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait U {} -trait T {} +trait U : ::std::marker::MarkerTrait {} +trait T { fn get(self) -> X; } -trait S2 { +trait S2 : ::std::marker::MarkerTrait { fn m(x: Box+'static>) {} } diff --git a/src/test/run-pass/trait-bounds-recursion.rs b/src/test/run-pass/trait-bounds-recursion.rs index 49f8999cd4..7135dad7d1 100644 --- a/src/test/run-pass/trait-bounds-recursion.rs +++ b/src/test/run-pass/trait-bounds-recursion.rs @@ -10,17 +10,17 @@ trait I { fn i(&self) -> Self; } -trait A { +trait A : ::std::marker::MarkerTrait { fn id(x:T) -> T { x.i() } } -trait J { fn j(&self) -> Self; } +trait J { fn j(&self) -> T; } -trait B> { +trait B> : ::std::marker::MarkerTrait { fn id(x:T) -> T { x.j() } } -trait C { +trait C : ::std::marker::MarkerTrait { fn id>(x:T) -> T { x.j() } } diff --git a/src/test/run-pass/trait-coercion-generic.rs b/src/test/run-pass/trait-coercion-generic.rs index 22db6c6477..fa02dabb37 100644 --- a/src/test/run-pass/trait-coercion-generic.rs +++ b/src/test/run-pass/trait-coercion-generic.rs @@ -15,13 +15,12 @@ trait Trait { fn f(&self, x: T); } +#[derive(Copy)] struct Struct { x: int, y: int, } -impl Copy for Struct {} - impl Trait<&'static str> for Struct { fn f(&self, x: &'static str) { println!("Hi, {}!", x); diff --git a/src/test/run-pass/trait-coercion.rs b/src/test/run-pass/trait-coercion.rs index 0d4a05bed7..1ae9b3f0e9 100644 --- a/src/test/run-pass/trait-coercion.rs +++ b/src/test/run-pass/trait-coercion.rs @@ -11,19 +11,18 @@ #![allow(unknown_features)] #![feature(box_syntax)] -use std::io; +use std::old_io; trait Trait { fn f(&self); } +#[derive(Copy)] struct Struct { x: int, y: int, } -impl Copy for Struct {} - impl Trait for Struct { fn f(&self) { println!("Hi!"); @@ -41,7 +40,7 @@ pub fn main() { let c: &Trait = &a; c.f(); - let out = io::stdout(); + let out = old_io::stdout(); foo(box out); } diff --git a/src/test/run-pass/trait-default-method-bound-subst.rs b/src/test/run-pass/trait-default-method-bound-subst.rs index 6b0ab8910d..5f0e149eb2 100644 --- a/src/test/run-pass/trait-default-method-bound-subst.rs +++ b/src/test/run-pass/trait-default-method-bound-subst.rs @@ -13,14 +13,14 @@ trait A { fn g(&self, x: T, y: U) -> (T, U) { (x, y) } } -impl A for int { } -impl A for uint { } +impl A for i32 { } +impl A for u32 { } fn f>(i: V, j: T, k: U) -> (T, U) { i.g(j, k) } pub fn main () { - assert_eq!(f(0i, 1i, 2i), (1, 2)); - assert_eq!(f(0u, 1i, 2i), (1, 2)); + assert_eq!(f(0, 1, 2), (1, 2)); + assert_eq!(f(0, 1, 2), (1, 2)); } diff --git a/src/test/run-pass/trait-default-method-bound-subst2.rs b/src/test/run-pass/trait-default-method-bound-subst2.rs index d9ba9ca922..1ea3879e7f 100644 --- a/src/test/run-pass/trait-default-method-bound-subst2.rs +++ b/src/test/run-pass/trait-default-method-bound-subst2.rs @@ -20,5 +20,5 @@ fn f>(i: V, j: T) -> T { } pub fn main () { - assert_eq!(f(0i, 2i), 2); + assert_eq!(f(0, 2), 2); } diff --git a/src/test/run-pass/trait-default-method-bound-subst3.rs b/src/test/run-pass/trait-default-method-bound-subst3.rs index 43fb19a58e..aff20ffe96 100644 --- a/src/test/run-pass/trait-default-method-bound-subst3.rs +++ b/src/test/run-pass/trait-default-method-bound-subst3.rs @@ -20,6 +20,6 @@ fn f(i: V, j: T, k: T) -> (T, T) { } pub fn main () { - assert_eq!(f(0i, 1i, 2i), (1, 2)); - assert_eq!(f(0i, 1u8, 2u8), (1u8, 2u8)); + assert_eq!(f(0, 1, 2), (1, 2)); + assert_eq!(f(0, 1u8, 2u8), (1u8, 2u8)); } diff --git a/src/test/run-pass/trait-default-method-bound-subst4.rs b/src/test/run-pass/trait-default-method-bound-subst4.rs index fdc42e58f8..383849ca51 100644 --- a/src/test/run-pass/trait-default-method-bound-subst4.rs +++ b/src/test/run-pass/trait-default-method-bound-subst4.rs @@ -11,6 +11,7 @@ trait A { fn g(&self, x: uint) -> uint { x } + fn h(&self, x: T) { } } impl A for int { } @@ -20,6 +21,6 @@ fn f>(i: V, j: uint) -> uint { } pub fn main () { - assert_eq!(f::(0, 2u), 2u); - assert_eq!(f::(0, 2u), 2u); + assert_eq!(f::(0, 2_usize), 2_usize); + assert_eq!(f::(0, 2_usize), 2_usize); } diff --git a/src/test/run-pass/trait-default-method-bound.rs b/src/test/run-pass/trait-default-method-bound.rs index 1505d48839..8a2f1b1743 100644 --- a/src/test/run-pass/trait-default-method-bound.rs +++ b/src/test/run-pass/trait-default-method-bound.rs @@ -20,5 +20,5 @@ fn f(i: T) { } pub fn main () { - f(0i); + f(0); } diff --git a/src/test/run-pass/trait-default-method-xc-2.rs b/src/test/run-pass/trait-default-method-xc-2.rs index 1aa958dafc..b28e8bd24a 100644 --- a/src/test/run-pass/trait-default-method-xc-2.rs +++ b/src/test/run-pass/trait-default-method-xc-2.rs @@ -20,15 +20,15 @@ use aux2::{a_struct, welp}; pub fn main () { - let a = a_struct { x: 0i }; - let b = a_struct { x: 1i }; + let a = a_struct { x: 0 }; + let b = a_struct { x: 1 }; - assert_eq!(0i.g(), 10); + assert_eq!(0.g(), 10); assert_eq!(a.g(), 10); assert_eq!(a.h(), 11); assert_eq!(b.g(), 10); assert_eq!(b.h(), 11); assert_eq!(A::lurr(&a, &b), 21); - welp(&0i); + welp(&0); } diff --git a/src/test/run-pass/trait-default-method-xc.rs b/src/test/run-pass/trait-default-method-xc.rs index c4880e97c4..4745d05795 100644 --- a/src/test/run-pass/trait-default-method-xc.rs +++ b/src/test/run-pass/trait-default-method-xc.rs @@ -52,35 +52,35 @@ impl TestEquality for stuff::thing { pub fn main() { // Some tests of random things - f(0i); + f(0); - assert_eq!(A::lurr(&0i, &1i), 21); + assert_eq!(A::lurr(&0, &1), 21); let a = stuff::thing { x: 0 }; let b = stuff::thing { x: 1 }; let c = Something { x: 1 }; - assert_eq!(0i.g(), 10); + assert_eq!(0.g(), 10); assert_eq!(a.g(), 10); assert_eq!(a.h(), 11); assert_eq!(c.h(), 11); - assert_eq!(0i.thing(3.14f64, 1i), (3.14f64, 1i)); - assert_eq!(B::staticthing(&0i, 3.14f64, 1i), (3.14f64, 1i)); - assert_eq!(B::::staticthing::(&0i, 3.14, 1), (3.14, 1)); + assert_eq!(0.thing(3.14f64, 1), (3.14f64, 1)); + assert_eq!(B::staticthing(&0, 3.14f64, 1), (3.14f64, 1)); + assert_eq!(B::::staticthing::(&0, 3.14, 1), (3.14, 1)); - assert_eq!(g(0i, 3.14f64, 1i), (3.14f64, 1i)); - assert_eq!(g(false, 3.14f64, 1i), (3.14, 1)); + assert_eq!(g(0, 3.14f64, 1), (3.14f64, 1)); + assert_eq!(g(false, 3.14f64, 1), (3.14, 1)); // Trying out a real one - assert!(12i.test_neq(&10i)); - assert!(!10i.test_neq(&10i)); + assert!(12.test_neq(&10)); + assert!(!10.test_neq(&10)); assert!(a.test_neq(&b)); assert!(!a.test_neq(&a)); - assert!(neq(&12i, &10i)); - assert!(!neq(&10i, &10i)); + assert!(neq(&12, &10)); + assert!(!neq(&10, &10)); assert!(neq(&a, &b)); assert!(!neq(&a, &a)); } diff --git a/src/test/run-pass/trait-false-ambiguity-where-clause-builtin-bound.rs b/src/test/run-pass/trait-false-ambiguity-where-clause-builtin-bound.rs new file mode 100644 index 0000000000..ca66a106c4 --- /dev/null +++ b/src/test/run-pass/trait-false-ambiguity-where-clause-builtin-bound.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we do not error out because of a (False) ambiguity +// between the builtin rules for Sized and the where clause. Issue +// #20959. + +fn foo(x: Option) + where Option : Sized +{ + let _y = x; +} + +fn main() { + foo(Some(22)); +} diff --git a/src/test/run-pass/trait-generic.rs b/src/test/run-pass/trait-generic.rs index d4c1b688b4..5f4b18df6e 100644 --- a/src/test/run-pass/trait-generic.rs +++ b/src/test/run-pass/trait-generic.rs @@ -29,7 +29,7 @@ trait map { impl map for Vec { fn map(&self, mut f: F) -> Vec where F: FnMut(&T) -> U { let mut r = Vec::new(); - for i in self.iter() { + for i in self { r.push(f(i)); } r @@ -44,7 +44,7 @@ fn bar>(x: T) -> Vec { } pub fn main() { - assert_eq!(foo(vec!(1i)), vec!("hi".to_string())); + assert_eq!(foo(vec!(1)), vec!("hi".to_string())); assert_eq!(bar:: >(vec!(4, 5)), vec!("4".to_string(), "5".to_string())); assert_eq!(bar:: >(vec!("x".to_string(), "y".to_string())), vec!("x".to_string(), "y".to_string())); diff --git a/src/test/run-pass/trait-impl.rs b/src/test/run-pass/trait-impl.rs index 003686c0bb..325fba8a0e 100644 --- a/src/test/run-pass/trait-impl.rs +++ b/src/test/run-pass/trait-impl.rs @@ -16,7 +16,9 @@ use traitimpl::Bar; static mut COUNT: uint = 1; -trait T {} +trait T { + fn t(&self) {} +} impl<'a> T+'a { fn foo(&self) { @@ -33,7 +35,7 @@ struct Foo; impl<'a> Bar<'a> for Foo {} fn main() { - let x: &T = &42i; + let x: &T = &42; x.foo(); T::foo(x); diff --git a/src/test/run-pass/trait-inheritance-num.rs b/src/test/run-pass/trait-inheritance-num.rs index e606018feb..9a30d51f4c 100644 --- a/src/test/run-pass/trait-inheritance-num.rs +++ b/src/test/run-pass/trait-inheritance-num.rs @@ -16,7 +16,7 @@ pub trait NumExt: NumCast + PartialEq + PartialOrd {} pub trait FloatExt: NumExt {} -fn greater_than_one(n: &T) -> bool { *n > NumCast::from(1i).unwrap() } -fn greater_than_one_float(n: &T) -> bool { *n > NumCast::from(1i).unwrap() } +fn greater_than_one(n: &T) -> bool { *n > NumCast::from(1).unwrap() } +fn greater_than_one_float(n: &T) -> bool { *n > NumCast::from(1).unwrap() } pub fn main() {} diff --git a/src/test/run-pass/trait-inheritance-num0.rs b/src/test/run-pass/trait-inheritance-num0.rs index 42eaaa09fc..d68b6a54f7 100644 --- a/src/test/run-pass/trait-inheritance-num0.rs +++ b/src/test/run-pass/trait-inheritance-num0.rs @@ -22,7 +22,7 @@ pub trait Num { pub trait NumExt: NumCast + PartialOrd { } fn greater_than_one(n: &T) -> bool { - n.gt(&NumCast::from(1i).unwrap()) + n.gt(&NumCast::from(1).unwrap()) } pub fn main() {} diff --git a/src/test/run-pass/trait-inheritance-num1.rs b/src/test/run-pass/trait-inheritance-num1.rs index 9407afbdd6..15fb5df462 100644 --- a/src/test/run-pass/trait-inheritance-num1.rs +++ b/src/test/run-pass/trait-inheritance-num1.rs @@ -14,7 +14,7 @@ use std::num::NumCast; pub trait NumExt: NumCast + PartialOrd { } fn greater_than_one(n: &T) -> bool { - *n > NumCast::from(1i).unwrap() + *n > NumCast::from(1).unwrap() } pub fn main() {} diff --git a/src/test/run-pass/trait-inheritance-num2.rs b/src/test/run-pass/trait-inheritance-num2.rs index 1e6e7227a0..f89eea4609 100644 --- a/src/test/run-pass/trait-inheritance-num2.rs +++ b/src/test/run-pass/trait-inheritance-num2.rs @@ -14,8 +14,7 @@ use std::cmp::{PartialEq, PartialOrd}; use std::num::NumCast; -pub trait TypeExt {} - +pub trait TypeExt : ::std::marker::MarkerTrait { } impl TypeExt for u8 {} impl TypeExt for u16 {} diff --git a/src/test/run-pass/trait-inheritance-num3.rs b/src/test/run-pass/trait-inheritance-num3.rs index bd93223093..09015d983e 100644 --- a/src/test/run-pass/trait-inheritance-num3.rs +++ b/src/test/run-pass/trait-inheritance-num3.rs @@ -16,7 +16,7 @@ pub trait NumExt: PartialEq + PartialOrd + NumCast {} impl NumExt for f32 {} fn num_eq_one(n: T) { - println!("{}", n == NumCast::from(1i).unwrap()) + println!("{}", n == NumCast::from(1).unwrap()) } pub fn main() { diff --git a/src/test/run-pass/trait-inheritance-num5.rs b/src/test/run-pass/trait-inheritance-num5.rs index 4c79600e2e..a21026839a 100644 --- a/src/test/run-pass/trait-inheritance-num5.rs +++ b/src/test/run-pass/trait-inheritance-num5.rs @@ -17,7 +17,7 @@ impl NumExt for f32 {} impl NumExt for int {} fn num_eq_one() -> T { - NumCast::from(1i).unwrap() + NumCast::from(1).unwrap() } pub fn main() { diff --git a/src/test/run-pass/trait-inheritance-overloading-simple.rs b/src/test/run-pass/trait-inheritance-overloading-simple.rs index 3c319a8c51..4cd9fbeba9 100644 --- a/src/test/run-pass/trait-inheritance-overloading-simple.rs +++ b/src/test/run-pass/trait-inheritance-overloading-simple.rs @@ -12,7 +12,7 @@ use std::cmp::PartialEq; trait MyNum : PartialEq { } -#[derive(Show)] +#[derive(Debug)] struct MyInt { val: int } impl PartialEq for MyInt { diff --git a/src/test/run-pass/trait-inheritance-overloading.rs b/src/test/run-pass/trait-inheritance-overloading.rs index 4349445851..893f782cba 100644 --- a/src/test/run-pass/trait-inheritance-overloading.rs +++ b/src/test/run-pass/trait-inheritance-overloading.rs @@ -13,7 +13,7 @@ use std::ops::{Add, Sub, Mul}; trait MyNum : Add + Sub + Mul + PartialEq + Clone { } -#[derive(Clone, Show)] +#[derive(Clone, Debug)] struct MyInt { val: int } impl Add for MyInt { diff --git a/src/test/run-pass/trait-inheritance-static2.rs b/src/test/run-pass/trait-inheritance-static2.rs index 3b454aad03..8f3b325a51 100644 --- a/src/test/run-pass/trait-inheritance-static2.rs +++ b/src/test/run-pass/trait-inheritance-static2.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub trait MyEq { } +pub trait MyEq : ::std::marker::MarkerTrait { } -pub trait MyNum { +pub trait MyNum : ::std::marker::MarkerTrait { fn from_int(int) -> Self; } diff --git a/src/test/run-pass/trait-inheritance-visibility.rs b/src/test/run-pass/trait-inheritance-visibility.rs index dc84cbfb09..3cdedd884a 100644 --- a/src/test/run-pass/trait-inheritance-visibility.rs +++ b/src/test/run-pass/trait-inheritance-visibility.rs @@ -24,5 +24,5 @@ fn f(x: &T) { } pub fn main() { - f(&0i) + f(&0) } diff --git a/src/test/run-pass/trait-object-generics.rs b/src/test/run-pass/trait-object-generics.rs index 76352c799a..6f89490716 100644 --- a/src/test/run-pass/trait-object-generics.rs +++ b/src/test/run-pass/trait-object-generics.rs @@ -13,11 +13,14 @@ #![allow(unknown_features)] #![feature(box_syntax)] +use std::marker; + pub trait Trait2 { - fn doit(&self); + fn doit(&self) -> A; } pub struct Impl { + m1: marker::PhantomData<(A1,A2,A3)>, /* * With A2 we get the ICE: * task failed at 'index out of bounds: the len is 1 but the index is 1', @@ -28,13 +31,13 @@ pub struct Impl { impl Impl { pub fn step(&self) { - self.t.doit() + self.t.doit(); } } // test for #8601 -enum Type { Constant } +enum Type { Constant(T) } trait Trait { fn method(&self,Type<(K,V)>) -> int; @@ -46,5 +49,5 @@ impl Trait for () { pub fn main() { let a = box() () as Box>; - assert_eq!(a.method(Type::Constant), 0); + assert_eq!(a.method(Type::Constant((1u8, 2u8))), 0); } diff --git a/src/test/run-pass/trait-object-with-lifetime-bound.rs b/src/test/run-pass/trait-object-with-lifetime-bound.rs new file mode 100644 index 0000000000..4e481910aa --- /dev/null +++ b/src/test/run-pass/trait-object-with-lifetime-bound.rs @@ -0,0 +1,42 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Uncovered during work on new scoping rules for safe destructors +// as an important use case to support properly. + +pub struct E<'a> { + pub f: &'a u8, +} +impl<'b> E<'b> { + pub fn m(&self) -> &'b u8 { self.f } +} + +pub struct P<'c> { + pub g: &'c u8, +} +pub trait M { + fn n(&self) -> u8; +} +impl<'d> M for P<'d> { + fn n(&self) -> u8 { *self.g } +} + +fn extension<'e>(x: &'e E<'e>) -> Box { + loop { + let p = P { g: x.m() }; + return Box::new(p) as Box; + } +} + +fn main() { + let w = E { f: &10u8 }; + let o = extension(&w); + assert_eq!(o.n(), 10u8); +} diff --git a/src/test/run-pass/trait-static-method-overwriting.rs b/src/test/run-pass/trait-static-method-overwriting.rs index a8cea24db0..10439d5c86 100644 --- a/src/test/run-pass/trait-static-method-overwriting.rs +++ b/src/test/run-pass/trait-static-method-overwriting.rs @@ -10,7 +10,7 @@ // except according to those terms. mod base { - pub trait HasNew { + pub trait HasNew { fn new() -> Self; } @@ -18,7 +18,7 @@ mod base { dummy: (), } - impl ::base::HasNew for Foo { + impl ::base::HasNew for Foo { fn new() -> Foo { println!("Foo"); Foo { dummy: () } @@ -29,7 +29,7 @@ mod base { dummy: (), } - impl ::base::HasNew for Bar { + impl ::base::HasNew for Bar { fn new() -> Bar { println!("Bar"); Bar { dummy: () } @@ -38,6 +38,6 @@ mod base { } pub fn main() { - let _f: base::Foo = base::HasNew::::new(); - let _b: base::Bar = base::HasNew::::new(); + let _f: base::Foo = base::HasNew::new(); + let _b: base::Bar = base::HasNew::new(); } diff --git a/src/test/run-pass/trait-to-str.rs b/src/test/run-pass/trait-to-str.rs index 9b910d24bd..ea8a5a28c3 100644 --- a/src/test/run-pass/trait-to-str.rs +++ b/src/test/run-pass/trait-to-str.rs @@ -31,15 +31,15 @@ impl to_str for Vec { pub fn main() { assert!(1.to_string_() == "1".to_string()); - assert!((vec!(2i, 3, 4)).to_string_() == "[2, 3, 4]".to_string()); + assert!((vec!(2, 3, 4)).to_string_() == "[2, 3, 4]".to_string()); fn indirect(x: T) -> String { format!("{}!", x.to_string_()) } - assert!(indirect(vec!(10i, 20)) == "[10, 20]!".to_string()); + assert!(indirect(vec!(10, 20)) == "[10, 20]!".to_string()); fn indirect2(x: T) -> String { indirect(x) } - assert!(indirect2(vec!(1i)) == "[1]!".to_string()); + assert!(indirect2(vec!(1)) == "[1]!".to_string()); } diff --git a/src/test/run-pass/traits-conditional-dispatch.rs b/src/test/run-pass/traits-conditional-dispatch.rs index 7e2b7ae066..5af2d4ee80 100644 --- a/src/test/run-pass/traits-conditional-dispatch.rs +++ b/src/test/run-pass/traits-conditional-dispatch.rs @@ -35,5 +35,5 @@ fn main() { assert_eq!(get_it(&1_u32), 1_u32); assert_eq!(get_it(&1_u16), 1_u16); assert_eq!(get_it(&Some(1_u16)), Some(1_u16)); - assert_eq!(get_it(&box 1i), box 1i); + assert_eq!(get_it(&box 1), box 1); } diff --git a/src/test/run-pass/traits-issue-22019.rs b/src/test/run-pass/traits-issue-22019.rs new file mode 100644 index 0000000000..7e0f60d55a --- /dev/null +++ b/src/test/run-pass/traits-issue-22019.rs @@ -0,0 +1,41 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test an issue where global caching was causing free regions from +// distinct scopes to be compared (`'g` and `'h`). The only important +// thing is that compilation succeeds here. + +#![allow(missing_copy_implementations)] +#![allow(unused_variables)] + +use std::borrow::ToOwned; + +pub struct CFGNode; + +pub type Node<'a> = &'a CFGNode; + +pub trait GraphWalk<'c, N> { + /// Returns all the nodes in this graph. + fn nodes(&'c self) where [N]:ToOwned>; +} + +impl<'g> GraphWalk<'g, Node<'g>> for u32 +{ + fn nodes(&'g self) where [Node<'g>]:ToOwned>> + { loop { } } +} + +impl<'h> GraphWalk<'h, Node<'h>> for u64 +{ + fn nodes(&'h self) where [Node<'h>]:ToOwned>> + { loop { } } +} + +fn main() { } diff --git a/src/test/run-pass/traits-issue-22110.rs b/src/test/run-pass/traits-issue-22110.rs new file mode 100644 index 0000000000..9cdcf4945d --- /dev/null +++ b/src/test/run-pass/traits-issue-22110.rs @@ -0,0 +1,34 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test an issue where we reported ambiguity between the where-clause +// and the blanket impl. The only important thing is that compilation +// succeeds here. Issue #22110. + +#![allow(dead_code)] + +trait Foo { + fn foo(&self, a: A); +} + +impl Foo for F { + fn foo(&self, _: A) { } +} + +fn baz Foo<(&'a A,)>>(_: F) { } + +fn components(t: fn(&A)) + where fn(&A) : for<'a> Foo<(&'a A,)>, +{ + baz(t) +} + +fn main() { +} diff --git a/src/test/run-pass/traits-negative-impls.rs b/src/test/run-pass/traits-negative-impls.rs new file mode 100644 index 0000000000..09c7d07770 --- /dev/null +++ b/src/test/run-pass/traits-negative-impls.rs @@ -0,0 +1,29 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(optin_builtin_traits)] + +use std::marker::Send; + +pub struct WaitToken; +impl !Send for WaitToken {} + +pub struct Test(T); +unsafe impl Send for Test {} + +pub fn spawn(_: F) -> () where F: FnOnce(), F: Send + 'static {} + +fn main() { + let wt = Test(WaitToken); + spawn(move || { + let x = wt; + println!("Hello, World!"); + }); +} diff --git a/src/test/run-pass/trivial-message.rs b/src/test/run-pass/trivial-message.rs index df8efb42e3..fd60c61463 100644 --- a/src/test/run-pass/trivial-message.rs +++ b/src/test/run-pass/trivial-message.rs @@ -17,7 +17,7 @@ use std::sync::mpsc::channel; pub fn main() { let (tx, rx) = channel(); - tx.send(42i); + tx.send(42); let r = rx.recv(); println!("{:?}", r); } diff --git a/src/test/run-pass/tuple-index-fat-types.rs b/src/test/run-pass/tuple-index-fat-types.rs index eccd841e35..924b861a91 100644 --- a/src/test/run-pass/tuple-index-fat-types.rs +++ b/src/test/run-pass/tuple-index-fat-types.rs @@ -11,11 +11,11 @@ struct Foo<'a>(&'a [int]); fn main() { - let x: &[int] = &[1i, 2, 3]; + let x: &[int] = &[1, 2, 3]; let y = (x,); assert_eq!(y.0, x); - let x: &[int] = &[1i, 2, 3]; + let x: &[int] = &[1, 2, 3]; let y = Foo(x); assert_eq!(y.0, x); } diff --git a/src/test/run-pass/tuple-index.rs b/src/test/run-pass/tuple-index.rs index 78e0cad471..abdf617277 100644 --- a/src/test/run-pass/tuple-index.rs +++ b/src/test/run-pass/tuple-index.rs @@ -24,7 +24,7 @@ fn main() { } assert_eq!(x.1, 0); - let mut x = (3i, 2i); + let mut x = (3, 2); assert_eq!(x.0, 3); assert_eq!(x.1, 2); x.0 += 5; diff --git a/src/test/run-pass/tuple-struct-construct.rs b/src/test/run-pass/tuple-struct-construct.rs index d7a78dbc41..7773bf647f 100644 --- a/src/test/run-pass/tuple-struct-construct.rs +++ b/src/test/run-pass/tuple-struct-construct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(Show)] +#[derive(Debug)] struct Foo(int, int); pub fn main() { diff --git a/src/test/run-pass/tuple-struct-constructor-pointer.rs b/src/test/run-pass/tuple-struct-constructor-pointer.rs index a4bb914b1a..bcd62e92b4 100644 --- a/src/test/run-pass/tuple-struct-constructor-pointer.rs +++ b/src/test/run-pass/tuple-struct-constructor-pointer.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct Foo(int); -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct Bar(int, int); pub fn main() { diff --git a/src/test/run-pass/type-id-higher-rank.rs b/src/test/run-pass/type-id-higher-rank.rs index 7287d149f5..d33ebeadba 100644 --- a/src/test/run-pass/type-id-higher-rank.rs +++ b/src/test/run-pass/type-id-higher-rank.rs @@ -13,7 +13,7 @@ #![feature(unboxed_closures)] -use std::intrinsics::TypeId; +use std::any::TypeId; fn main() { // Bare fns @@ -56,8 +56,8 @@ fn main() { // 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(|_: &int, _: &int| {}); + let b = id(|_: &int, _: &int| {}); assert!(a != b); } diff --git a/src/test/run-pass/type-param-constraints.rs b/src/test/run-pass/type-param-constraints.rs index 3fcb04d684..7d1fad5d28 100644 --- a/src/test/run-pass/type-param-constraints.rs +++ b/src/test/run-pass/type-param-constraints.rs @@ -33,12 +33,12 @@ pub fn main() { p_foo(r(10)); p_foo(box r(10)); - p_foo(box 10i); - p_foo(10i); + p_foo(box 10); + p_foo(10); - s_foo(box 10i); - s_foo(10i); + s_foo(box 10); + s_foo(10); - u_foo(box 10i); - u_foo(10i); + u_foo(box 10); + u_foo(10); } diff --git a/src/test/run-pass/type-params-in-for-each.rs b/src/test/run-pass/type-params-in-for-each.rs index 24cc5fab8e..cf8a09998d 100644 --- a/src/test/run-pass/type-params-in-for-each.rs +++ b/src/test/run-pass/type-params-in-for-each.rs @@ -16,11 +16,11 @@ struct S { fn range_(lo: uint, hi: uint, mut it: F) where F: FnMut(uint) { let mut lo_ = lo; - while lo_ < hi { it(lo_); lo_ += 1u; } + while lo_ < hi { it(lo_); lo_ += 1_usize; } } fn create_index(_index: Vec> , _hash_fn: extern fn(T) -> uint) { - range_(0u, 256u, |_i| { + range_(0_usize, 256_usize, |_i| { let _bucket: Vec = Vec::new(); }) } diff --git a/src/test/run-pass/typeck_type_placeholder_1.rs b/src/test/run-pass/typeck_type_placeholder_1.rs index a8ae3f40f0..48dc944382 100644 --- a/src/test/run-pass/typeck_type_placeholder_1.rs +++ b/src/test/run-pass/typeck_type_placeholder_1.rs @@ -21,17 +21,17 @@ static CONSTEXPR: TestStruct = TestStruct{x: &413 as *const _}; pub fn main() { - let x: Vec<_> = range(0u, 5).collect(); + let x: Vec<_> = (0_usize..5).collect(); let expected: &[uint] = &[0,1,2,3,4]; - assert_eq!(x.as_slice(), expected); + assert_eq!(x, expected); - let x = range(0u, 5).collect::>(); - assert_eq!(x.as_slice(), expected); + let x = (0_usize..5).collect::>(); + assert_eq!(x, expected); let y: _ = "hello"; assert_eq!(y.len(), 5); - let ptr = &5u; + let ptr = &5_usize; let ptr2 = ptr as *const _; assert_eq!(ptr as *const uint as uint, ptr2 as uint); diff --git a/src/test/run-pass/typeclasses-eq-example-static.rs b/src/test/run-pass/typeclasses-eq-example-static.rs index 20a28c5a9e..0ea7a1be43 100644 --- a/src/test/run-pass/typeclasses-eq-example-static.rs +++ b/src/test/run-pass/typeclasses-eq-example-static.rs @@ -21,11 +21,9 @@ trait Equal { fn isEq(a: &Self, b: &Self) -> bool; } -#[derive(Clone)] +#[derive(Clone, Copy)] enum Color { cyan, magenta, yellow, black } -impl Copy for Color {} - impl Equal for Color { fn isEq(a: &Color, b: &Color) -> bool { match (*a, *b) { diff --git a/src/test/run-pass/typeclasses-eq-example.rs b/src/test/run-pass/typeclasses-eq-example.rs index aa290edd86..69d22cf34f 100644 --- a/src/test/run-pass/typeclasses-eq-example.rs +++ b/src/test/run-pass/typeclasses-eq-example.rs @@ -19,11 +19,9 @@ trait Equal { fn isEq(&self, a: &Self) -> bool; } -#[derive(Clone)] +#[derive(Clone, Copy)] enum Color { cyan, magenta, yellow, black } -impl Copy for Color {} - impl Equal for Color { fn isEq(&self, a: &Color) -> bool { match (*self, *a) { diff --git a/src/test/run-pass/typeid-intrinsic.rs b/src/test/run-pass/typeid-intrinsic.rs index e346c4ff34..a251fcc732 100644 --- a/src/test/run-pass/typeid-intrinsic.rs +++ b/src/test/run-pass/typeid-intrinsic.rs @@ -15,41 +15,40 @@ extern crate "typeid-intrinsic" as other1; extern crate "typeid-intrinsic2" as other2; use std::hash::{self, SipHasher}; -use std::intrinsics; -use std::intrinsics::TypeId; +use std::any::TypeId; struct A; struct Test; pub fn main() { unsafe { - assert_eq!(intrinsics::type_id::(), other1::id_A()); - assert_eq!(intrinsics::type_id::(), other1::id_B()); - assert_eq!(intrinsics::type_id::(), other1::id_C()); - assert_eq!(intrinsics::type_id::(), other1::id_D()); - assert_eq!(intrinsics::type_id::(), other1::id_E()); - assert_eq!(intrinsics::type_id::(), other1::id_F()); - assert_eq!(intrinsics::type_id::(), other1::id_G()); - assert_eq!(intrinsics::type_id::(), other1::id_H()); + assert_eq!(TypeId::of::(), other1::id_A()); + assert_eq!(TypeId::of::(), other1::id_B()); + assert_eq!(TypeId::of::(), other1::id_C()); + assert_eq!(TypeId::of::(), other1::id_D()); + assert_eq!(TypeId::of::(), other1::id_E()); + assert_eq!(TypeId::of::(), other1::id_F()); + assert_eq!(TypeId::of::(), other1::id_G()); + assert_eq!(TypeId::of::(), other1::id_H()); - assert_eq!(intrinsics::type_id::(), other2::id_A()); - assert_eq!(intrinsics::type_id::(), other2::id_B()); - assert_eq!(intrinsics::type_id::(), other2::id_C()); - assert_eq!(intrinsics::type_id::(), other2::id_D()); - assert_eq!(intrinsics::type_id::(), other2::id_E()); - assert_eq!(intrinsics::type_id::(), other2::id_F()); - assert_eq!(intrinsics::type_id::(), other2::id_G()); - assert_eq!(intrinsics::type_id::(), other2::id_H()); + assert_eq!(TypeId::of::(), other2::id_A()); + assert_eq!(TypeId::of::(), other2::id_B()); + assert_eq!(TypeId::of::(), other2::id_C()); + assert_eq!(TypeId::of::(), other2::id_D()); + assert_eq!(TypeId::of::(), other2::id_E()); + assert_eq!(TypeId::of::(), other2::id_F()); + assert_eq!(TypeId::of::(), other2::id_G()); + assert_eq!(TypeId::of::(), other2::id_H()); assert_eq!(other1::id_F(), other2::id_F()); assert_eq!(other1::id_G(), other2::id_G()); assert_eq!(other1::id_H(), other2::id_H()); - assert_eq!(intrinsics::type_id::(), other2::foo::()); - assert_eq!(intrinsics::type_id::(), other1::foo::()); + assert_eq!(TypeId::of::(), other2::foo::()); + assert_eq!(TypeId::of::(), other1::foo::()); assert_eq!(other2::foo::(), other1::foo::()); - assert_eq!(intrinsics::type_id::(), other2::foo::()); - assert_eq!(intrinsics::type_id::(), other1::foo::()); + assert_eq!(TypeId::of::(), other2::foo::()); + assert_eq!(TypeId::of::(), other1::foo::()); assert_eq!(other2::foo::(), other1::foo::()); } diff --git a/src/test/run-pass/typestate-cfg-nesting.rs b/src/test/run-pass/typestate-cfg-nesting.rs index f1e40cc3e5..37d06bf4f8 100644 --- a/src/test/run-pass/typestate-cfg-nesting.rs +++ b/src/test/run-pass/typestate-cfg-nesting.rs @@ -12,12 +12,12 @@ #![allow(unused_variable)] fn f() { - let x = 10i; let mut y = 11i; + let x = 10; let mut y = 11; if true { match x { _ => { y = x; } } } else { } } pub fn main() { - let x = 10i; - let mut y = 11i; + let x = 10; + let mut y = 11; if true { while false { y = x; } } else { } } diff --git a/src/test/run-pass/typestate-multi-decl.rs b/src/test/run-pass/typestate-multi-decl.rs index cbb0dcc8f2..42910c4700 100644 --- a/src/test/run-pass/typestate-multi-decl.rs +++ b/src/test/run-pass/typestate-multi-decl.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let (x, y) = (10i, 20i); + let (x, y) = (10, 20); let z = x + y; assert!((z == 30)); } diff --git a/src/test/run-pass/ufcs-explicit-self.rs b/src/test/run-pass/ufcs-explicit-self.rs index 968f351124..2be9f75dae 100644 --- a/src/test/run-pass/ufcs-explicit-self.rs +++ b/src/test/run-pass/ufcs-explicit-self.rs @@ -11,12 +11,11 @@ #![allow(unknown_features)] #![feature(box_syntax)] +#[derive(Copy)] struct Foo { f: int, } -impl Copy for Foo {} - impl Foo { fn foo(self: Foo, x: int) -> int { self.f + x @@ -29,12 +28,11 @@ impl Foo { } } +#[derive(Copy)] struct Bar { f: T, } -impl Copy for Bar {} - impl Bar { fn foo(self: Bar, x: int) -> int { x diff --git a/src/test/run-pass/ufcs-trait-object.rs b/src/test/run-pass/ufcs-trait-object.rs new file mode 100644 index 0000000000..2ae63040d1 --- /dev/null +++ b/src/test/run-pass/ufcs-trait-object.rs @@ -0,0 +1,25 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that when you use ufcs form to invoke a trait method (on a +// trait object) everything works fine. + +trait Foo { + fn test(&self) -> i32; +} + +impl Foo for i32 { + fn test(&self) -> i32 { *self } +} + +fn main() { + let a: &Foo = &22_i32; + assert_eq!(Foo::test(a), 22); +} diff --git a/src/test/run-pass/unboxed-closures-all-traits.rs b/src/test/run-pass/unboxed-closures-all-traits.rs index 635e1670aa..7e71e1da46 100644 --- a/src/test/run-pass/unboxed-closures-all-traits.rs +++ b/src/test/run-pass/unboxed-closures-all-traits.rs @@ -24,8 +24,8 @@ fn c int>(f: F) -> int { fn main() { let z: int = 7; - assert_eq!(a(move |&: x: int, y| x + y + z), 10); - assert_eq!(b(move |&mut: x: int, y| x + y + z), 14); - assert_eq!(c(move |: x: int, y| x + y + z), 18); + 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); } diff --git a/src/test/run-pass/unboxed-closures-boxed.rs b/src/test/run-pass/unboxed-closures-boxed.rs index dc35d5bf2c..d515ccf2ec 100644 --- a/src/test/run-pass/unboxed-closures-boxed.rs +++ b/src/test/run-pass/unboxed-closures-boxed.rs @@ -14,9 +14,9 @@ use std::ops::FnMut; - fn make_adder(x: int) -> Box+'static> { - (box move |&mut: y: int| -> int { x + y }) as - Box+'static> + fn make_adder(x: i32) -> Boxi32+'static> { + (box move |y: i32| -> i32 { x + y }) as + Boxi32+'static> } pub fn main() { diff --git a/src/test/run-pass/unboxed-closures-by-ref.rs b/src/test/run-pass/unboxed-closures-by-ref.rs index be955486da..178865897e 100644 --- a/src/test/run-pass/unboxed-closures-by-ref.rs +++ b/src/test/run-pass/unboxed-closures-by-ref.rs @@ -25,11 +25,11 @@ fn call_fn_once(f: F) { } fn main() { - let mut x = 0u; - let y = 2u; + let mut x = 0_usize; + let y = 2_usize; - call_fn(|&:| assert_eq!(x, 0)); - call_fn_mut(|&mut:| x += y); - call_fn_once(|:| x += y); + call_fn(|| assert_eq!(x, 0)); + call_fn_mut(|| x += y); + call_fn_once(|| x += y); assert_eq!(x, y * 2); } diff --git a/src/test/run-pass/unboxed-closures-counter-not-moved.rs b/src/test/run-pass/unboxed-closures-counter-not-moved.rs new file mode 100644 index 0000000000..0b85916d22 --- /dev/null +++ b/src/test/run-pass/unboxed-closures-counter-not-moved.rs @@ -0,0 +1,36 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we mutate a counter on the stack only when we expect to. + +fn call(f: F) where F : FnOnce() { + f(); +} + +fn main() { + let y = vec!(format!("Hello"), format!("World")); + let mut counter = 22_u32; + + call(|| { + // Move `y`, but do not move `counter`, even though it is read + // by value (note that it is also mutated). + for item in y { + let v = counter; + counter += v; + } + }); + assert_eq!(counter, 88); + + call(move || { + // this mutates a moved copy, and hence doesn't affect original + counter += 1; + }); + assert_eq!(counter, 88); +} diff --git a/src/test/run-pass/unboxed-closures-cross-crate.rs b/src/test/run-pass/unboxed-closures-cross-crate.rs index 3babaa2b7e..96d7559262 100644 --- a/src/test/run-pass/unboxed-closures-cross-crate.rs +++ b/src/test/run-pass/unboxed-closures-cross-crate.rs @@ -15,6 +15,6 @@ extern crate "unboxed-closures-cross-crate" as ubcc; fn main() { - assert_eq!(ubcc::has_closures(), 2u); - assert_eq!(ubcc::has_generic_closures(2u, 3u), 5u); + assert_eq!(ubcc::has_closures(), 2_usize); + assert_eq!(ubcc::has_generic_closures(2_usize, 3_usize), 5_usize); } diff --git a/src/test/run-pass/unboxed-closures-direct-sugary-call.rs b/src/test/run-pass/unboxed-closures-direct-sugary-call.rs index 2854d64f66..0c49c81517 100644 --- a/src/test/run-pass/unboxed-closures-direct-sugary-call.rs +++ b/src/test/run-pass/unboxed-closures-direct-sugary-call.rs @@ -11,7 +11,7 @@ #![feature(unboxed_closures)] fn main() { - let mut unboxed = |&mut:| {}; + let mut unboxed = || {}; unboxed(); } diff --git a/src/test/run-pass/unboxed-closures-drop.rs b/src/test/run-pass/unboxed-closures-drop.rs index 8d4d7b4ecb..f4a24c17e6 100644 --- a/src/test/run-pass/unboxed-closures-drop.rs +++ b/src/test/run-pass/unboxed-closures-drop.rs @@ -55,13 +55,13 @@ fn c int>(f: F) -> int { fn test_fn() { { - a(move |&: a: int, b| { a + b }); + a(move |a: int, b| { a + b }); } assert_eq!(drop_count(), 0); { let z = &Droppable::new(); - a(move |&: a: int, b| { z; a + b }); + a(move |a: int, b| { z; a + b }); assert_eq!(drop_count(), 0); } assert_eq!(drop_count(), 1); @@ -69,7 +69,7 @@ fn test_fn() { { let z = &Droppable::new(); let zz = &Droppable::new(); - a(move |&: a: int, b| { z; zz; a + b }); + a(move |a: int, b| { z; zz; a + b }); assert_eq!(drop_count(), 1); } assert_eq!(drop_count(), 3); @@ -77,13 +77,13 @@ fn test_fn() { fn test_fn_mut() { { - b(move |&mut: a: int, b| { a + b }); + b(move |a: int, b| { a + b }); } assert_eq!(drop_count(), 3); { let z = &Droppable::new(); - b(move |&mut: a: int, b| { z; a + b }); + b(move |a: int, b| { z; a + b }); assert_eq!(drop_count(), 3); } assert_eq!(drop_count(), 4); @@ -91,7 +91,7 @@ fn test_fn_mut() { { let z = &Droppable::new(); let zz = &Droppable::new(); - b(move |&mut: a: int, b| { z; zz; a + b }); + b(move |a: int, b| { z; zz; a + b }); assert_eq!(drop_count(), 4); } assert_eq!(drop_count(), 6); @@ -99,13 +99,13 @@ fn test_fn_mut() { fn test_fn_once() { { - c(move |: a: int, b| { a + b }); + c(move |a: int, b| { a + b }); } assert_eq!(drop_count(), 6); { let z = Droppable::new(); - c(move |: a: int, b| { z; a + b }); + c(move |a: int, b| { z; a + b }); assert_eq!(drop_count(), 7); } assert_eq!(drop_count(), 7); @@ -113,7 +113,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: int, b| { z; zz; a + b }); assert_eq!(drop_count(), 9); } assert_eq!(drop_count(), 9); diff --git a/src/test/run-pass/unboxed-closures-fn-as-fnmut-and-fnonce.rs b/src/test/run-pass/unboxed-closures-fn-as-fnmut-and-fnonce.rs index 8af0547e5e..5d6029e703 100644 --- a/src/test/run-pass/unboxed-closures-fn-as-fnmut-and-fnonce.rs +++ b/src/test/run-pass/unboxed-closures-fn-as-fnmut-and-fnonce.rs @@ -18,21 +18,22 @@ use std::ops::{Fn,FnMut,FnOnce}; struct S; -impl Fn<(int,),int> for S { - extern "rust-call" fn call(&self, (x,): (int,)) -> int { +impl Fn<(i32,)> for S { + type Output = i32; + extern "rust-call" fn call(&self, (x,): (i32,)) -> i32 { x * x } } -fn call_itint>(f: &F, x: int) -> int { +fn call_iti32>(f: &F, x: i32) -> i32 { f(x) } -fn call_it_mutint>(f: &mut F, x: int) -> int { +fn call_it_muti32>(f: &mut F, x: i32) -> i32 { f(x) } -fn call_it_onceint>(f: F, x: int) -> int { +fn call_it_oncei32>(f: F, x: i32) -> i32 { f(x) } diff --git a/src/test/run-pass/unboxed-closures-fnmut-as-fnonce.rs b/src/test/run-pass/unboxed-closures-fnmut-as-fnonce.rs index 068080e256..95dae41c68 100644 --- a/src/test/run-pass/unboxed-closures-fnmut-as-fnonce.rs +++ b/src/test/run-pass/unboxed-closures-fnmut-as-fnonce.rs @@ -18,17 +18,19 @@ use std::ops::{FnMut,FnOnce}; struct S; -impl FnMut<(int,),int> for S { - extern "rust-call" fn call_mut(&mut self, (x,): (int,)) -> int { +impl FnMut<(i32,)> for S { + type Output = i32; + + extern "rust-call" fn call_mut(&mut self, (x,): (i32,)) -> i32 { x * x } } -fn call_it_mutint>(f: &mut F, x: int) -> int { +fn call_it_muti32>(f: &mut F, x: i32) -> i32 { f(x) } -fn call_it_onceint>(f: F, x: int) -> int { +fn call_it_oncei32>(f: F, x: i32) -> i32 { f(x) } diff --git a/src/test/run-pass/unboxed-closures-generic.rs b/src/test/run-pass/unboxed-closures-generic.rs index 0edeeb8d19..f4af42a866 100644 --- a/src/test/run-pass/unboxed-closures-generic.rs +++ b/src/test/run-pass/unboxed-closures-generic.rs @@ -12,12 +12,12 @@ use std::ops::FnMut; -fn call_it>(y: int, mut f: F) -> int { +fn call_iti32>(y: i32, mut f: F) -> i32 { f(2, y) } pub fn main() { - let f = |&mut: x: int, y: int| -> int { x + y }; + let f = |x: i32, y: i32| -> i32 { x + y }; let z = call_it(3, f); println!("{}", z); assert_eq!(z, 5); diff --git a/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-bound.rs b/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-bound.rs index fdd85b71cd..56de159611 100644 --- a/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-bound.rs +++ b/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-bound.rs @@ -22,5 +22,5 @@ fn doit(val: T, f: &F) } pub fn main() { - doit(0i, &|&: x /*: int*/ | { x.to_int(); }); + doit(0, &|x /*: int*/ | { x.to_int(); }); } diff --git a/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-object-type.rs b/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-object-type.rs index cce8cd64a1..c74ed665e7 100644 --- a/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-object-type.rs +++ b/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-object-type.rs @@ -18,5 +18,5 @@ use std::num::ToPrimitive; fn doit(val: T, f: &Fn(T)) { f.call((val,)) } pub fn main() { - doit(0i, &|&: x /*: int*/ | { x.to_int(); }); + doit(0, &|x /*: int*/ | { x.to_int(); }); } diff --git a/src/test/run-pass/unboxed-closures-infer-argument-types-with-bound-regions-from-expected-bound.rs b/src/test/run-pass/unboxed-closures-infer-argument-types-with-bound-regions-from-expected-bound.rs index 8497bf7f98..a61dd095a0 100644 --- a/src/test/run-pass/unboxed-closures-infer-argument-types-with-bound-regions-from-expected-bound.rs +++ b/src/test/run-pass/unboxed-closures-infer-argument-types-with-bound-regions-from-expected-bound.rs @@ -22,5 +22,5 @@ fn doit(val: T, f: &F) } pub fn main() { - doit(0i, &|&: x /*: int*/ | { x.to_int(); }); + doit(0, &|x /*: int*/ | { x.to_int(); }); } diff --git a/src/test/run-pass/unboxed-closures-infer-fnmut-calling-fnmut.rs b/src/test/run-pass/unboxed-closures-infer-fnmut-calling-fnmut.rs new file mode 100644 index 0000000000..09b8c8f445 --- /dev/null +++ b/src/test/run-pass/unboxed-closures-infer-fnmut-calling-fnmut.rs @@ -0,0 +1,29 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we are able to infer a suitable kind for this closure +// that is just called (`FnMut`). + +fn main() { + let mut counter = 0; + + { + // Here this must be inferred to FnMut so that it can mutate counter: + let mut tick1 = || counter += 1; + + // In turn, tick2 must be inferred to FnMut so that it can call tick1: + let mut tick2 = || { tick1(); tick1(); }; + + tick2(); + } + + assert_eq!(counter, 2); +} + diff --git a/src/test/run-pass/unboxed-closures-infer-fnmut-move.rs b/src/test/run-pass/unboxed-closures-infer-fnmut-move.rs new file mode 100644 index 0000000000..794527249b --- /dev/null +++ b/src/test/run-pass/unboxed-closures-infer-fnmut-move.rs @@ -0,0 +1,25 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we are able to infer a suitable kind for this `move` +// closure that is just called (`FnMut`). + +fn main() { + let mut counter = 0; + + let v = { + let mut tick = move || { counter += 1; counter }; + tick(); + tick() + }; + + assert_eq!(counter, 0); + assert_eq!(v, 2); +} diff --git a/src/test/run-pass/unboxed-closures-infer-fnmut.rs b/src/test/run-pass/unboxed-closures-infer-fnmut.rs new file mode 100644 index 0000000000..67f36b9a92 --- /dev/null +++ b/src/test/run-pass/unboxed-closures-infer-fnmut.rs @@ -0,0 +1,24 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we are able to infer a suitable kind for this closure +// that is just called (`FnMut`). + +fn main() { + let mut counter = 0; + + { + let mut tick = || counter += 1; + tick(); + tick(); + } + + assert_eq!(counter, 2); +} diff --git a/src/test/run-pass/unboxed-closures-infer-fnonce-move.rs b/src/test/run-pass/unboxed-closures-infer-fnonce-move.rs new file mode 100644 index 0000000000..9f8fc80819 --- /dev/null +++ b/src/test/run-pass/unboxed-closures-infer-fnonce-move.rs @@ -0,0 +1,37 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(unsafe_destructor)] + +// Test that we are able to infer a suitable kind for this `move` +// closure that is just called (`FnOnce`). + +use std::mem; + +struct DropMe<'a>(&'a mut i32); + +#[unsafe_destructor] +impl<'a> Drop for DropMe<'a> { + fn drop(&mut self) { + *self.0 += 1; + } +} + +fn main() { + let mut counter = 0; + + { + let drop_me = DropMe(&mut counter); + let tick = move || mem::drop(drop_me); + tick(); + } + + assert_eq!(counter, 1); +} diff --git a/src/test/run-pass/unboxed-closures-infer-fnonce.rs b/src/test/run-pass/unboxed-closures-infer-fnonce.rs new file mode 100644 index 0000000000..f0f10139c5 --- /dev/null +++ b/src/test/run-pass/unboxed-closures-infer-fnonce.rs @@ -0,0 +1,37 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(unsafe_destructor)] + +// Test that we are able to infer a suitable kind for this closure +// that is just called (`FnOnce`). + +use std::mem; + +struct DropMe<'a>(&'a mut i32); + +#[unsafe_destructor] +impl<'a> Drop for DropMe<'a> { + fn drop(&mut self) { + *self.0 += 1; + } +} + +fn main() { + let mut counter = 0; + + { + let drop_me = DropMe(&mut counter); + let tick = || mem::drop(drop_me); + tick(); + } + + assert_eq!(counter, 1); +} diff --git a/src/test/run-pass/unboxed-closures-infer-kind.rs b/src/test/run-pass/unboxed-closures-infer-kind.rs index 0cb719ecd7..36c8400be7 100644 --- a/src/test/run-pass/unboxed-closures-infer-kind.rs +++ b/src/test/run-pass/unboxed-closures-infer-kind.rs @@ -28,8 +28,8 @@ fn call_fn_once(f: F) { } fn main() { - let mut x = 0u; - let y = 2u; + let mut x = 0_usize; + let y = 2_usize; call_fn(|| assert_eq!(x, 0)); call_fn_mut(|| x += y); diff --git a/src/test/run-pass/unboxed-closures-infer-recursive-fn.rs b/src/test/run-pass/unboxed-closures-infer-recursive-fn.rs new file mode 100644 index 0000000000..2d1ba7f39b --- /dev/null +++ b/src/test/run-pass/unboxed-closures-infer-recursive-fn.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(core,unboxed_closures)] + +use std::marker::PhantomData; + +// Test that we are able to infer a suitable kind for a "recursive" +// closure. As far as I can tell, coding up a recursive closure +// requires the good ol' [Y Combinator]. +// +// [Y Combinator]: http://en.wikipedia.org/wiki/Fixed-point_combinator#Y_combinator + +struct YCombinator { + func: F, + marker: PhantomData<(A,R)>, +} + +impl YCombinator { + fn new(f: F) -> YCombinator { + YCombinator { func: f, marker: PhantomData } + } +} + +impl R, A) -> R> Fn<(A,)> for YCombinator { + type Output = R; + + extern "rust-call" fn call(&self, (arg,): (A,)) -> R { + (self.func)(self, arg) + } +} + +fn main() { + let factorial = |recur: &Fn(u32) -> u32, arg: u32| -> u32 { + if arg == 0 {1} else {arg * recur(arg-1)} + }; + let factorial: YCombinator<_,u32,u32> = YCombinator::new(factorial); + let r = factorial(10); + assert_eq!(3628800, r); +} diff --git a/src/test/run-pass/unboxed-closures-infer-upvar.rs b/src/test/run-pass/unboxed-closures-infer-upvar.rs new file mode 100644 index 0000000000..087ef5dcf0 --- /dev/null +++ b/src/test/run-pass/unboxed-closures-infer-upvar.rs @@ -0,0 +1,22 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that the type variable in the type(`Vec<_>`) of a closed over +// variable does not interfere with type inference. + +fn f(mut f: F) { + f(); +} + +fn main() { + let mut v: Vec<_> = vec![]; + f(|| v.push(0)); + assert_eq!(v, vec![0]); +} diff --git a/src/test/run-pass/unboxed-closures-manual-impl.rs b/src/test/run-pass/unboxed-closures-manual-impl.rs index 88c9ceae4a..37075de040 100644 --- a/src/test/run-pass/unboxed-closures-manual-impl.rs +++ b/src/test/run-pass/unboxed-closures-manual-impl.rs @@ -15,17 +15,19 @@ use std::ops::FnMut; struct S; -impl FnMut<(int,),int> for S { - extern "rust-call" fn call_mut(&mut self, (x,): (int,)) -> int { +impl FnMut<(i32,)> for S { + type Output = i32; + + extern "rust-call" fn call_mut(&mut self, (x,): (i32,)) -> i32 { x * x } } -fn call_itint>(mut f: F, x: int) -> int { +fn call_iti32>(mut f: F, x: i32) -> i32 { f(x) + 3 } -fn call_box(f: &mut FnMut(int) -> int, x: int) -> int { +fn call_box(f: &mut FnMut(i32) -> i32, x: i32) -> i32 { f(x) + 3 } diff --git a/src/test/run-pass/unboxed-closures-monomorphization.rs b/src/test/run-pass/unboxed-closures-monomorphization.rs index 6701f879e4..535c456236 100644 --- a/src/test/run-pass/unboxed-closures-monomorphization.rs +++ b/src/test/run-pass/unboxed-closures-monomorphization.rs @@ -16,25 +16,23 @@ #![feature(unboxed_closures)] fn main(){ - fn bar<'a, T:Clone+'a> (t: T) -> Box + 'a> { - box move |&mut:| t.clone() + fn bar<'a, T:Clone+'a> (t: T) -> BoxT + 'a> { + box move || t.clone() } - let mut f = bar(42u); + let mut f = bar(42_u32); assert_eq!(f.call_mut(()), 42); let mut f = bar("forty-two"); assert_eq!(f.call_mut(()), "forty-two"); - let x = 42u; + let x = 42_u32; let mut f = bar(&x); assert_eq!(f.call_mut(()), &x); - #[derive(Clone, Show, PartialEq)] + #[derive(Clone, Copy, Debug, PartialEq)] struct Foo(uint, &'static str); - impl Copy for Foo {} - let x = Foo(42, "forty-two"); let mut f = bar(x); assert_eq!(f.call_mut(()), x); diff --git a/src/test/run-pass/unboxed-closures-move-mutable.rs b/src/test/run-pass/unboxed-closures-move-mutable.rs index 43a44eca2d..069e93b86b 100644 --- a/src/test/run-pass/unboxed-closures-move-mutable.rs +++ b/src/test/run-pass/unboxed-closures-move-mutable.rs @@ -20,19 +20,19 @@ fn set(x: &mut uint) { *x = 42; } fn main() { { - let mut x = 0u; - move |&mut:| x += 1; + let mut x = 0_usize; + move || x += 1; } { - let mut x = 0u; - move |:| x += 1; + let mut x = 0_usize; + move || x += 1; } { - let mut x = 0u; - move |&mut:| set(&mut x); + let mut x = 0_usize; + move || set(&mut x); } { - let mut x = 0u; - move |:| set(&mut x); + let mut x = 0_usize; + move || set(&mut x); } } diff --git a/src/test/run-pass/unboxed-closures-move-some-upvars-in-by-ref-closure.rs b/src/test/run-pass/unboxed-closures-move-some-upvars-in-by-ref-closure.rs new file mode 100644 index 0000000000..9966364625 --- /dev/null +++ b/src/test/run-pass/unboxed-closures-move-some-upvars-in-by-ref-closure.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that in a by-ref once closure we move some variables even as +// we capture others by mutable reference. + +fn call(f: F) where F : FnOnce() { + f(); +} + +fn main() { + let mut x = vec!(format!("Hello")); + let y = vec!(format!("World")); + call(|| { + // Here: `x` must be captured with a mutable reference in + // order for us to append on it, and `y` must be captured by + // value. + for item in y { + x.push(item); + } + }); + assert_eq!(x.len(), 2); + assert_eq!(&*x[0], "Hello"); + assert_eq!(&*x[1], "World"); +} diff --git a/src/test/run-pass/unboxed-closures-prelude.rs b/src/test/run-pass/unboxed-closures-prelude.rs index 915715727e..c8f0d5fde4 100644 --- a/src/test/run-pass/unboxed-closures-prelude.rs +++ b/src/test/run-pass/unboxed-closures-prelude.rs @@ -15,13 +15,13 @@ #![feature(unboxed_closures)] fn main() { - let task: Box int> = box |&: x| x; - task.call((0i, )); + let task: Box int> = box |x| x; + task.call((0, )); - let mut task: Box int> = box |&mut: x| x; - task(0i); + let mut task: Box int> = box |x| x; + task(0); - call(|:x| x, 22); + call(|x| x, 22); } fn call int>(f: F, x: int) -> int { diff --git a/src/test/run-pass/unboxed-closures-simple.rs b/src/test/run-pass/unboxed-closures-simple.rs index c473db4586..9f29e75be7 100644 --- a/src/test/run-pass/unboxed-closures-simple.rs +++ b/src/test/run-pass/unboxed-closures-simple.rs @@ -13,7 +13,7 @@ use std::ops::FnMut; pub fn main() { - let mut f = |&mut: x: int, y: int| -> int { x + y }; + let mut f = |x: int, y: int| -> int { x + y }; let z = f(1, 2); assert_eq!(z, 3); } diff --git a/src/test/run-pass/unboxed-closures-single-word-env.rs b/src/test/run-pass/unboxed-closures-single-word-env.rs index 61ceb5e140..9e543f925f 100644 --- a/src/test/run-pass/unboxed-closures-single-word-env.rs +++ b/src/test/run-pass/unboxed-closures-single-word-env.rs @@ -27,8 +27,8 @@ fn c int>(f: F) -> int { fn main() { let z = 10; - assert_eq!(a(move |&: x: int, y| x + y + z), 13); - assert_eq!(b(move |&mut: x: int, y| x + y + z), 17); - assert_eq!(c(move |: x: int, y| x + y + z), 21); + 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); } diff --git a/src/test/run-pass/unboxed-closures-static-call-fn-once.rs b/src/test/run-pass/unboxed-closures-static-call-fn-once.rs index 780a1e6cdf..7a6b68a5e0 100644 --- a/src/test/run-pass/unboxed-closures-static-call-fn-once.rs +++ b/src/test/run-pass/unboxed-closures-static-call-fn-once.rs @@ -11,7 +11,7 @@ #![feature(unboxed_closures)] fn main() { - let onetime = |: x| x; - onetime(0i); + let onetime = |x| x; + onetime(0); } diff --git a/src/test/run-pass/unboxed-closures-sugar-object.rs b/src/test/run-pass/unboxed-closures-sugar-object.rs index d65de43851..fff841a2f0 100644 --- a/src/test/run-pass/unboxed-closures-sugar-object.rs +++ b/src/test/run-pass/unboxed-closures-sugar-object.rs @@ -29,7 +29,7 @@ impl Getter for Identity { } fn main() { - let x: &Getter(int) -> (int,) = &Identity; + let x: &Getter<(i32,), (i32,)> = &Identity; let (y,) = x.get((22,)); assert_eq!(y, 22); } diff --git a/src/test/run-pass/unboxed-closures-unique-type-id.rs b/src/test/run-pass/unboxed-closures-unique-type-id.rs index 4fdfb8cf02..5c36832d9f 100644 --- a/src/test/run-pass/unboxed-closures-unique-type-id.rs +++ b/src/test/run-pass/unboxed-closures-unique-type-id.rs @@ -12,7 +12,7 @@ // // error: internal compiler error: get_unique_type_id_of_type() - // unexpected type: closure, -// ty_unboxed_closure(syntax::ast::DefId{krate: 0u32, node: 66u32}, +// ty_closure(syntax::ast::DefId{krate: 0u32, node: 66u32}, // ReScope(63u32)) // // This is a regression test for issue #17021. @@ -28,8 +28,8 @@ pub fn replace_map<'a, T, F>(src: &mut T, prod: F) where F: FnOnce(T) -> T { } pub fn main() { - let mut a = 7u; + let mut a = 7_usize; let b = &mut a; - replace_map(b, |: x: uint| x * 2); - assert_eq!(*b, 14u); + replace_map(b, |x: uint| x * 2); + assert_eq!(*b, 14_usize); } diff --git a/src/test/run-pass/unboxed-closures-zero-args.rs b/src/test/run-pass/unboxed-closures-zero-args.rs index f2eddd84af..8e3d44df79 100644 --- a/src/test/run-pass/unboxed-closures-zero-args.rs +++ b/src/test/run-pass/unboxed-closures-zero-args.rs @@ -11,7 +11,7 @@ #![feature(unboxed_closures)] fn main() { - let mut zero = |&mut:| {}; - let () = zero.call_mut(()); + let mut zero = || {}; + let () = zero(); } diff --git a/src/test/run-pass/unify-return-ty.rs b/src/test/run-pass/unify-return-ty.rs index a189d4528a..1a65f685a5 100644 --- a/src/test/run-pass/unify-return-ty.rs +++ b/src/test/run-pass/unify-return-ty.rs @@ -16,7 +16,7 @@ use std::mem; fn null() -> *const T { unsafe { - mem::transmute(0u) + mem::transmute(0_usize) } } diff --git a/src/test/run-pass/unique-assign-copy.rs b/src/test/run-pass/unique-assign-copy.rs index 9e3d9544d4..c19063fe46 100644 --- a/src/test/run-pass/unique-assign-copy.rs +++ b/src/test/run-pass/unique-assign-copy.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let mut i = box 1i; + let mut i = box 1; // Should be a copy let mut j; j = i.clone(); diff --git a/src/test/run-pass/unique-assign-drop.rs b/src/test/run-pass/unique-assign-drop.rs index 81c4b6ab7e..241258f089 100644 --- a/src/test/run-pass/unique-assign-drop.rs +++ b/src/test/run-pass/unique-assign-drop.rs @@ -13,8 +13,8 @@ #![feature(box_syntax)] pub fn main() { - let i = box 1i; - let mut j = box 2i; + let i = box 1; + let mut j = box 2; // Should drop the previous value of j j = i; assert_eq!(*j, 1); diff --git a/src/test/run-pass/unique-assign-generic.rs b/src/test/run-pass/unique-assign-generic.rs index 7c9bbd6417..c8abb08084 100644 --- a/src/test/run-pass/unique-assign-generic.rs +++ b/src/test/run-pass/unique-assign-generic.rs @@ -18,6 +18,6 @@ fn f(t: T) -> T { } pub fn main() { - let t = f(box 100i); - assert_eq!(t, box 100i); + let t = f(box 100); + assert_eq!(t, box 100); } diff --git a/src/test/run-pass/unique-assign.rs b/src/test/run-pass/unique-assign.rs index 199657fd99..cbcb6afb4c 100644 --- a/src/test/run-pass/unique-assign.rs +++ b/src/test/run-pass/unique-assign.rs @@ -13,6 +13,6 @@ pub fn main() { let mut i; - i = box 1i; + i = box 1; assert_eq!(*i, 1); } diff --git a/src/test/run-pass/unique-autoderef-index.rs b/src/test/run-pass/unique-autoderef-index.rs index 1c7b4c534e..30c4b2d7b5 100644 --- a/src/test/run-pass/unique-autoderef-index.rs +++ b/src/test/run-pass/unique-autoderef-index.rs @@ -12,6 +12,6 @@ #![feature(box_syntax)] pub fn main() { - let i = box vec!(100i); - assert_eq!((*i)[0], 100i); + let i = box vec!(100); + assert_eq!((*i)[0], 100); } diff --git a/src/test/run-pass/unique-cmp.rs b/src/test/run-pass/unique-cmp.rs index dba4d8db84..a2962dc00d 100644 --- a/src/test/run-pass/unique-cmp.rs +++ b/src/test/run-pass/unique-cmp.rs @@ -12,10 +12,10 @@ #![feature(box_syntax)] pub fn main() { - let i = box 100i; - assert!(i == box 100i); - assert!(i < box 101i); - assert!(i <= box 100i); - assert!(i > box 99i); - assert!(i >= box 99i); + let i = box 100; + assert!(i == box 100); + assert!(i < box 101); + assert!(i <= box 100); + assert!(i > box 99); + assert!(i >= box 99); } diff --git a/src/test/run-pass/unique-create.rs b/src/test/run-pass/unique-create.rs index cec74d251b..975f1e9da8 100644 --- a/src/test/run-pass/unique-create.rs +++ b/src/test/run-pass/unique-create.rs @@ -12,9 +12,9 @@ #![feature(box_syntax)] pub fn main() { - box 100i; + box 100; } fn vec() { - vec!(0i); + vec!(0); } diff --git a/src/test/run-pass/unique-decl-init-copy.rs b/src/test/run-pass/unique-decl-init-copy.rs index d0ad03b773..3af38784ad 100644 --- a/src/test/run-pass/unique-decl-init-copy.rs +++ b/src/test/run-pass/unique-decl-init-copy.rs @@ -12,11 +12,11 @@ #![feature(box_syntax)] pub fn main() { - let mut i = box 1i; + let mut i = box 1; // Should be a copy let mut j = i.clone(); - *i = 2i; - *j = 3i; - assert_eq!(*i, 2i); - assert_eq!(*j, 3i); + *i = 2; + *j = 3; + assert_eq!(*i, 2); + assert_eq!(*j, 3); } diff --git a/src/test/run-pass/unique-decl-init.rs b/src/test/run-pass/unique-decl-init.rs index d7c19eb635..c919274880 100644 --- a/src/test/run-pass/unique-decl-init.rs +++ b/src/test/run-pass/unique-decl-init.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let i = box 1i; + let i = box 1; let j = i; assert_eq!(*j, 1); } diff --git a/src/test/run-pass/unique-decl-move.rs b/src/test/run-pass/unique-decl-move.rs index 0acdc8f3b8..96dd9f51fb 100644 --- a/src/test/run-pass/unique-decl-move.rs +++ b/src/test/run-pass/unique-decl-move.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let i = box 100i; + let i = box 100; let j = i; assert_eq!(*j, 100); } diff --git a/src/test/run-pass/unique-deref.rs b/src/test/run-pass/unique-deref.rs index 752ea830aa..41d3b87a00 100644 --- a/src/test/run-pass/unique-deref.rs +++ b/src/test/run-pass/unique-deref.rs @@ -12,6 +12,6 @@ #![feature(box_syntax)] pub fn main() { - let i = box 100i; + let i = box 100; assert_eq!(*i, 100); } diff --git a/src/test/run-pass/unique-destructure.rs b/src/test/run-pass/unique-destructure.rs index 3213146cbf..9e71e850b3 100644 --- a/src/test/run-pass/unique-destructure.rs +++ b/src/test/run-pass/unique-destructure.rs @@ -9,6 +9,7 @@ // except according to those terms. #![allow(unknown_features)] +#![feature(box_patterns)] #![feature(box_syntax)] struct Foo { a: int, b: int } diff --git a/src/test/run-pass/unique-drop-complex.rs b/src/test/run-pass/unique-drop-complex.rs index ec2c9f8c66..c5a0a4df27 100644 --- a/src/test/run-pass/unique-drop-complex.rs +++ b/src/test/run-pass/unique-drop-complex.rs @@ -12,5 +12,5 @@ #![feature(box_syntax)] pub fn main() { - let _x = box vec!(0i,0,0,0,0); + let _x = box vec!(0,0,0,0,0); } diff --git a/src/test/run-pass/unique-fn-arg-move.rs b/src/test/run-pass/unique-fn-arg-move.rs index 0e47d39e55..1b3f7e72a4 100644 --- a/src/test/run-pass/unique-fn-arg-move.rs +++ b/src/test/run-pass/unique-fn-arg-move.rs @@ -16,6 +16,6 @@ fn f(i: Box) { } pub fn main() { - let i = box 100i; + let i = box 100; f(i); } diff --git a/src/test/run-pass/unique-in-vec-copy.rs b/src/test/run-pass/unique-in-vec-copy.rs index 4620815e74..3bde79fdce 100644 --- a/src/test/run-pass/unique-in-vec-copy.rs +++ b/src/test/run-pass/unique-in-vec-copy.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let mut a = vec!(box 10i); + let mut a = vec!(box 10); let b = a.clone(); assert_eq!(*a[0], 10); diff --git a/src/test/run-pass/unique-in-vec.rs b/src/test/run-pass/unique-in-vec.rs index 389ca2c18b..05b0c7244d 100644 --- a/src/test/run-pass/unique-in-vec.rs +++ b/src/test/run-pass/unique-in-vec.rs @@ -12,6 +12,6 @@ #![feature(box_syntax)] pub fn main() { - let vect = vec!(box 100i); + let vect = vec!(box 100); assert!(vect[0] == box 100); } diff --git a/src/test/run-pass/unique-init.rs b/src/test/run-pass/unique-init.rs index b36d08364a..d3f13f1609 100644 --- a/src/test/run-pass/unique-init.rs +++ b/src/test/run-pass/unique-init.rs @@ -12,5 +12,5 @@ #![feature(box_syntax)] pub fn main() { - let _i = box 100i; + let _i = box 100; } diff --git a/src/test/run-pass/unique-kinds.rs b/src/test/run-pass/unique-kinds.rs index 56f7a3f799..4c93c379b4 100644 --- a/src/test/run-pass/unique-kinds.rs +++ b/src/test/run-pass/unique-kinds.rs @@ -23,11 +23,11 @@ fn sendable() { assert!(i != j); } - let i = box 100i; - let j = box 100i; + let i = box 100; + let j = box 100; f(i, j); - let i = box 100i; - let j = box 101i; + let i = box 100; + let j = box 101; g(i, j); } @@ -41,11 +41,11 @@ fn copyable() { assert!(i != j); } - let i = box 100i; - let j = box 100i; + let i = box 100; + let j = box 100; f(i, j); - let i = box 100i; - let j = box 101i; + let i = box 100; + let j = box 101; g(i, j); } @@ -59,11 +59,11 @@ fn noncopyable() { assert!(i != j); } - let i = box 100i; - let j = box 100i; + let i = box 100; + let j = box 100; f(i, j); - let i = box 100i; - let j = box 101i; + let i = box 100; + let j = box 101; g(i, j); } diff --git a/src/test/run-pass/unique-log.rs b/src/test/run-pass/unique-log.rs index 05579796da..4b21b949f8 100644 --- a/src/test/run-pass/unique-log.rs +++ b/src/test/run-pass/unique-log.rs @@ -12,6 +12,6 @@ #![feature(box_syntax)] pub fn main() { - let i = box 100i; + let i = box 100; println!("{}", i); } diff --git a/src/test/run-pass/unique-move-drop.rs b/src/test/run-pass/unique-move-drop.rs index 1388c6c5d2..705b9d6e92 100644 --- a/src/test/run-pass/unique-move-drop.rs +++ b/src/test/run-pass/unique-move-drop.rs @@ -13,8 +13,8 @@ #![feature(box_syntax)] pub fn main() { - let i = box 100i; - let j = box 200i; + let i = box 100; + let j = box 200; let j = i; assert_eq!(*j, 100); } diff --git a/src/test/run-pass/unique-move-temp.rs b/src/test/run-pass/unique-move-temp.rs index af82d3e14e..b6c24f5be2 100644 --- a/src/test/run-pass/unique-move-temp.rs +++ b/src/test/run-pass/unique-move-temp.rs @@ -13,6 +13,6 @@ pub fn main() { let mut i; - i = box 100i; + i = box 100; assert_eq!(*i, 100); } diff --git a/src/test/run-pass/unique-move.rs b/src/test/run-pass/unique-move.rs index 791c4799bf..ed13bf6a5c 100644 --- a/src/test/run-pass/unique-move.rs +++ b/src/test/run-pass/unique-move.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let i = box 100i; + let i = box 100; let mut j; j = i; assert_eq!(*j, 100); diff --git a/src/test/run-pass/unique-mutable.rs b/src/test/run-pass/unique-mutable.rs index c4f860d930..403b8bf18b 100644 --- a/src/test/run-pass/unique-mutable.rs +++ b/src/test/run-pass/unique-mutable.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let mut i = box 0i; + let mut i = box 0; *i = 1; assert_eq!(*i, 1); } diff --git a/src/test/run-pass/unique-object-move.rs b/src/test/run-pass/unique-object-move.rs index cec523a067..f01a56142e 100644 --- a/src/test/run-pass/unique-object-move.rs +++ b/src/test/run-pass/unique-object-move.rs @@ -13,7 +13,7 @@ #![allow(unknown_features)] #![feature(box_syntax)] -pub trait EventLoop { } +pub trait EventLoop { fn foo(&self) {} } pub struct UvEventLoop { uvio: int diff --git a/src/test/run-pass/unique-pat-2.rs b/src/test/run-pass/unique-pat-2.rs index eab775fc1d..5db96bc356 100644 --- a/src/test/run-pass/unique-pat-2.rs +++ b/src/test/run-pass/unique-pat-2.rs @@ -9,6 +9,7 @@ // except according to those terms. #![allow(unknown_features)] +#![feature(box_patterns)] #![feature(box_syntax)] struct Foo {a: int, b: uint} @@ -16,7 +17,7 @@ struct Foo {a: int, b: uint} enum bar { u(Box), w(int), } pub fn main() { - assert!(match bar::u(box Foo{a: 10, b: 40u}) { + assert!(match bar::u(box Foo{a: 10, b: 40_usize}) { bar::u(box Foo{a: a, b: b}) => { a + (b as int) } _ => { 66 } } == 50); diff --git a/src/test/run-pass/unique-pat.rs b/src/test/run-pass/unique-pat.rs index ee975b9c81..bff2d4e917 100644 --- a/src/test/run-pass/unique-pat.rs +++ b/src/test/run-pass/unique-pat.rs @@ -9,6 +9,7 @@ // except according to those terms. #![allow(unknown_features)] +#![feature(box_patterns)] #![feature(box_syntax)] fn simple() { diff --git a/src/test/run-pass/unique-send-2.rs b/src/test/run-pass/unique-send-2.rs index 90f4b2e634..43824812ec 100644 --- a/src/test/run-pass/unique-send-2.rs +++ b/src/test/run-pass/unique-send-2.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] use std::sync::mpsc::{channel, Sender}; -use std::thread::Thread; +use std::thread; fn child(tx: &Sender>, i: uint) { tx.send(box i).unwrap(); @@ -20,18 +20,18 @@ fn child(tx: &Sender>, i: uint) { pub fn main() { let (tx, rx) = channel(); - let n = 100u; - let mut expected = 0u; - let _t = range(0u, n).map(|i| { + let n = 100_usize; + let mut expected = 0_usize; + let _t = (0_usize..n).map(|i| { expected += i; let tx = tx.clone(); - Thread::scoped(move|| { + thread::spawn(move|| { child(&tx, i) }) }).collect::>(); - let mut actual = 0u; - for _ in range(0u, n) { + let mut actual = 0_usize; + for _ in 0_usize..n { let j = rx.recv().unwrap(); actual += *j; } diff --git a/src/test/run-pass/unique-send.rs b/src/test/run-pass/unique-send.rs index 1372858545..2a462e9cdd 100644 --- a/src/test/run-pass/unique-send.rs +++ b/src/test/run-pass/unique-send.rs @@ -15,7 +15,7 @@ use std::sync::mpsc::channel; pub fn main() { let (tx, rx) = channel(); - tx.send(box 100i).unwrap(); + tx.send(box 100).unwrap(); let v = rx.recv().unwrap(); - assert_eq!(v, box 100i); + assert_eq!(v, box 100); } diff --git a/src/test/run-pass/unique-swap.rs b/src/test/run-pass/unique-swap.rs index cd3b59a69b..2adb9c22f6 100644 --- a/src/test/run-pass/unique-swap.rs +++ b/src/test/run-pass/unique-swap.rs @@ -14,9 +14,9 @@ use std::mem::swap; pub fn main() { - let mut i = box 100i; - let mut j = box 200i; + let mut i = box 100; + let mut j = box 200; swap(&mut i, &mut j); - assert_eq!(i, box 200i); - assert_eq!(j, box 100i); + assert_eq!(i, box 200); + assert_eq!(j, box 100); } diff --git a/src/test/run-pass/unit-like-struct-drop-run.rs b/src/test/run-pass/unit-like-struct-drop-run.rs index 4c86650328..ac46187f03 100644 --- a/src/test/run-pass/unit-like-struct-drop-run.rs +++ b/src/test/run-pass/unit-like-struct-drop-run.rs @@ -11,7 +11,7 @@ // Make sure the destructor is run for unit-like structs. use std::boxed::BoxAny; -use std::thread::Thread; +use std::thread; struct Foo; @@ -22,10 +22,10 @@ impl Drop for Foo { } pub fn main() { - let x = Thread::scoped(move|| { + let x = thread::spawn(move|| { let _b = Foo; }).join(); - let s = x.unwrap_err().downcast::<&'static str>().unwrap(); - assert_eq!(s.as_slice(), "This panic should happen."); + let s = x.err().unwrap().downcast::<&'static str>().ok().unwrap(); + assert_eq!(&**s, "This panic should happen."); } diff --git a/src/test/run-pass/unreachable-code.rs b/src/test/run-pass/unreachable-code.rs index a9ac78c5d7..a28dc2c1f1 100644 --- a/src/test/run-pass/unreachable-code.rs +++ b/src/test/run-pass/unreachable-code.rs @@ -24,7 +24,7 @@ fn call_id_2() { id(true) && id(return); } fn call_id_3() { id(return) && id(return); } fn ret_guard() { - match 2i { + match 2 { x if (return) => { x; } _ => {} } diff --git a/src/test/run-pass/unsized.rs b/src/test/run-pass/unsized.rs index e6dd8d4695..ae175d27b0 100644 --- a/src/test/run-pass/unsized.rs +++ b/src/test/run-pass/unsized.rs @@ -12,17 +12,19 @@ // Test syntax checks for `?Sized` syntax. -trait T1 {} -pub trait T2 {} -trait T3 : T2 {} -trait T4 {} -trait T5 {} -trait T6 {} -trait T7 {} -trait T8 {} -trait T9 {} -struct S1; -enum E {} +use std::marker::{PhantomData, PhantomFn}; + +trait T1 : PhantomFn { } +pub trait T2 : PhantomFn { } +trait T3 : T2 + PhantomFn { } +trait T4 : PhantomFn<(Self,X)> {} +trait T5 : PhantomFn<(Self,X,Y)> {} +trait T6 : PhantomFn<(Self,X,Y)> {} +trait T7 : PhantomFn<(Self,X,Y)> {} +trait T8 : PhantomFn<(Self,X)> {} +trait T9 : PhantomFn<(Self,X)> {} +struct S1(PhantomData); +enum E { E1(PhantomData) } impl T1 for S1 {} fn f() {} type TT = T; diff --git a/src/test/run-pass/unsized2.rs b/src/test/run-pass/unsized2.rs index 285100dd71..10b2f2fb70 100644 --- a/src/test/run-pass/unsized2.rs +++ b/src/test/run-pass/unsized2.rs @@ -15,6 +15,8 @@ // Test sized-ness checking in substitution. +use std::marker; + // Unbounded. fn f1(x: &X) { f1::(x); @@ -25,7 +27,7 @@ fn f2(x: &X) { } // Bounded. -trait T {} +trait T { fn dummy(&self) { } } fn f3(x: &X) { f3::(x); } @@ -66,20 +68,24 @@ fn f7(x: &X) { } trait T4 { - fn m1(x: &T4); - fn m2(x: &T5); + fn dummy(&self) { } + fn m1(x: &T4, y: X); + fn m2(x: &T5, y: X); } trait T5 { + fn dummy(&self) { } // not an error (for now) fn m1(x: &T4); fn m2(x: &T5); } trait T6 { + fn dummy(&self) { } fn m1(x: &T4); fn m2(x: &T5); } trait T7 { + fn dummy(&self) { } // not an error (for now) fn m1(x: &T4); fn m2(x: &T5); diff --git a/src/test/run-pass/unused-move-capture.rs b/src/test/run-pass/unused-move-capture.rs index 27945f4692..4e8fdda956 100644 --- a/src/test/run-pass/unused-move-capture.rs +++ b/src/test/run-pass/unused-move-capture.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let _x = box 1i; - let lam_move = |&:| {}; + let _x = box 1; + let lam_move = || {}; lam_move(); } diff --git a/src/test/run-pass/unused-move.rs b/src/test/run-pass/unused-move.rs index 22201c7d83..d053b03a2c 100644 --- a/src/test/run-pass/unused-move.rs +++ b/src/test/run-pass/unused-move.rs @@ -18,6 +18,6 @@ pub fn main() { - let y = box 1i; + let y = box 1; y; } diff --git a/src/test/run-pass/unwind-resource.rs b/src/test/run-pass/unwind-resource.rs index 159bac1018..52c09aadfb 100644 --- a/src/test/run-pass/unwind-resource.rs +++ b/src/test/run-pass/unwind-resource.rs @@ -9,7 +9,7 @@ // except according to those terms. use std::sync::mpsc::{channel, Sender}; -use std::thread::Thread; +use std::thread; struct complainer { tx: Sender, @@ -37,7 +37,7 @@ fn f(tx: Sender) { pub fn main() { let (tx, rx) = channel(); - let _t = Thread::scoped(move|| f(tx.clone())); + let _t = thread::spawn(move|| f(tx.clone())); println!("hiiiiiiiii"); assert!(rx.recv().unwrap()); } diff --git a/src/test/run-pass/unwind-unique.rs b/src/test/run-pass/unwind-unique.rs index 371fd677bd..d38b6e79eb 100644 --- a/src/test/run-pass/unwind-unique.rs +++ b/src/test/run-pass/unwind-unique.rs @@ -11,13 +11,13 @@ #![allow(unknown_features)] #![feature(box_syntax)] -use std::thread::Thread; +use std::thread; fn f() { - let _a = box 0i; + let _a = box 0; panic!(); } pub fn main() { - let _t = Thread::spawn(f); + let _t = thread::spawn(f); } diff --git a/src/test/run-pass/use-uninit-match.rs b/src/test/run-pass/use-uninit-match.rs index 3f23d714c0..efa6a2c583 100644 --- a/src/test/run-pass/use-uninit-match.rs +++ b/src/test/run-pass/use-uninit-match.rs @@ -21,4 +21,4 @@ fn foo(o: myoption) -> int { enum myoption { none, some(T), } -pub fn main() { println!("{}", 5i); } +pub fn main() { println!("{}", 5); } diff --git a/src/test/run-pass/use-uninit-match2.rs b/src/test/run-pass/use-uninit-match2.rs index de5b32dd17..f2b487b703 100644 --- a/src/test/run-pass/use-uninit-match2.rs +++ b/src/test/run-pass/use-uninit-match2.rs @@ -21,4 +21,4 @@ fn foo(o: myoption) -> int { enum myoption { none, some(T), } -pub fn main() { println!("{}", 5i); } +pub fn main() { println!("{}", 5); } diff --git a/src/test/run-pass/use.rs b/src/test/run-pass/use.rs index 67083f5362..65a392e63c 100644 --- a/src/test/run-pass/use.rs +++ b/src/test/run-pass/use.rs @@ -9,14 +9,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - #![allow(unused_imports)] - +#![feature(start, no_std)] #![no_std] + extern crate std; extern crate "std" as zed; - use std::str; use zed::str as x; mod baz { diff --git a/src/test/run-pass/utf8.rs b/src/test/run-pass/utf8.rs index a52828387b..96bba01068 100644 --- a/src/test/run-pass/utf8.rs +++ b/src/test/run-pass/utf8.rs @@ -44,7 +44,7 @@ pub fn main() { fn check_str_eq(a: String, b: String) { let mut i: int = 0; - for ab in a.as_slice().bytes() { + for ab in a.bytes() { println!("{}", i); println!("{}", ab); let bb: u8 = b.as_bytes()[i as uint]; diff --git a/src/test/run-pass/utf8_chars.rs b/src/test/run-pass/utf8_chars.rs index 1b2aa88cab..84f605eef5 100644 --- a/src/test/run-pass/utf8_chars.rs +++ b/src/test/run-pass/utf8_chars.rs @@ -18,12 +18,12 @@ pub fn main() { let s: String = chs.iter().cloned().collect(); let schs: Vec = s.chars().collect(); - assert!(s.len() == 10u); - assert!(s.chars().count() == 4u); - assert!(schs.len() == 4u); + assert!(s.len() == 10_usize); + assert!(s.chars().count() == 4_usize); + assert!(schs.len() == 4_usize); assert!(schs.iter().cloned().collect::() == s); - assert!(s.char_at(0u) == 'e'); - assert!(s.char_at(1u) == 'é'); + assert!(s.char_at(0_usize) == 'e'); + assert!(s.char_at(1_usize) == 'é'); assert!((str::from_utf8(s.as_bytes()).is_ok())); // invalid prefix diff --git a/src/test/run-pass/utf8_idents.rs b/src/test/run-pass/utf8_idents.rs index c99c394969..beb2f4d996 100644 --- a/src/test/run-pass/utf8_idents.rs +++ b/src/test/run-pass/utf8_idents.rs @@ -26,25 +26,25 @@ fn საჭმელად_გემრიელი_სადილი() -> int // Lunch in several languages. - let ランチ = 10i; - let 午餐 = 10i; + let ランチ = 10; + let 午餐 = 10; - let ארוחת_צהריי = 10i; - let غداء = 10u; - let լանչ = 10i; - let обед = 10i; - let абед = 10i; - let μεσημεριανό = 10i; - let hádegismatur = 10i; - let ручек = 10i; + let ארוחת_צהריי = 10; + let غداء = 10_usize; + let լանչ = 10; + let обед = 10; + let абед = 10; + let μεσημεριανό = 10; + let hádegismatur = 10; + let ручек = 10; - let ăn_trưa = 10i; - let อาหารกลางวัน = 10i; + let ăn_trưa = 10; + let อาหารกลางวัน = 10; // Lunchy arithmetic, mm. assert_eq!(hádegismatur * ручек * обед, 1000); - assert_eq!(10i, ארוחת_צהריי); + assert_eq!(10, ארוחת_צהריי); assert_eq!(ランチ + 午餐 + μεσημεριανό, 30); assert_eq!(ăn_trưa + อาหารกลางวัน, 20); return (абед + լանչ) >> غداء; diff --git a/src/test/run-pass/variadic-ffi.rs b/src/test/run-pass/variadic-ffi.rs index 9600a242ca..5a476ed9ee 100644 --- a/src/test/run-pass/variadic-ffi.rs +++ b/src/test/run-pass/variadic-ffi.rs @@ -29,13 +29,13 @@ pub fn main() { unsafe { // Call with just the named parameter - let c = CString::from_slice(b"Hello World\n"); + let c = CString::new(b"Hello World\n").unwrap(); check("Hello World\n", |s| sprintf(s, c.as_ptr())); // Call with variable number of arguments - let c = CString::from_slice(b"%d %f %c %s\n"); + let c = CString::new(b"%d %f %c %s\n").unwrap(); check("42 42.500000 a %d %f %c %s\n\n", |s| { - sprintf(s, c.as_ptr(), 42i, 42.5f64, 'a' as c_int, c.as_ptr()); + sprintf(s, c.as_ptr(), 42, 42.5f64, 'a' as c_int, c.as_ptr()); }); // Make a function pointer @@ -44,13 +44,13 @@ pub fn main() { // A function that takes a function pointer unsafe fn call(p: unsafe extern fn(*mut c_char, *const c_char, ...) -> c_int) { // Call with just the named parameter - let c = CString::from_slice(b"Hello World\n"); + let c = CString::new(b"Hello World\n").unwrap(); check("Hello World\n", |s| sprintf(s, c.as_ptr())); // Call with variable number of arguments - let c = CString::from_slice(b"%d %f %c %s\n"); + let c = CString::new(b"%d %f %c %s\n").unwrap(); check("42 42.500000 a %d %f %c %s\n\n", |s| { - sprintf(s, c.as_ptr(), 42i, 42.5f64, 'a' as c_int, c.as_ptr()); + sprintf(s, c.as_ptr(), 42, 42.5f64, 'a' as c_int, c.as_ptr()); }); } diff --git a/src/test/run-pass/variance-intersection-of-ref-and-opt-ref.rs b/src/test/run-pass/variance-intersection-of-ref-and-opt-ref.rs new file mode 100644 index 0000000000..948d68e0cc --- /dev/null +++ b/src/test/run-pass/variance-intersection-of-ref-and-opt-ref.rs @@ -0,0 +1,34 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Elaborated version of the opening example from RFC 738. This failed +// to compile before variance because invariance of `Option` prevented +// us from approximating the lifetimes of `field1` and `field2` to a +// common intersection. + +#![allow(dead_code)] + +struct List<'l> { + field1: &'l i32, + field2: Option<&'l i32>, +} + +fn foo(field1: &i32, field2: Option<&i32>) -> i32 { + let list = List { field1: field1, field2: field2 }; + *list.field1 + list.field2.cloned().unwrap_or(0) +} + +fn main() { + let x = 22; + let y = Some(3); + let z = None; + assert_eq!(foo(&x, y.as_ref()), 25); + assert_eq!(foo(&x, z.as_ref()), 22); +} diff --git a/src/test/run-pass/variance-trait-matching.rs b/src/test/run-pass/variance-trait-matching.rs new file mode 100644 index 0000000000..10441bee3c --- /dev/null +++ b/src/test/run-pass/variance-trait-matching.rs @@ -0,0 +1,49 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(dead_code)] + +// Get is covariant in T +trait Get { + fn get(&self) -> T; +} + +struct Cloner { + t: T +} + +impl Get for Cloner { + fn get(&self) -> T { + self.t.clone() + } +} + +fn get<'a, G>(get: &G) -> i32 + where G : Get<&'a i32> +{ + // This call only type checks if we can use `G : Get<&'a i32>` as + // evidence that `G : Get<&'b i32>` where `'a : 'b`. + pick(get, &22) +} + +fn pick<'b, G>(get: &'b G, if_odd: &'b i32) -> i32 + where G : Get<&'b i32> +{ + let v = *get.get(); + if v % 2 != 0 { v } else { *if_odd } +} + +fn main() { + let x = Cloner { t: &23 }; + let y = get(&x); + assert_eq!(y, 23); +} + + diff --git a/src/test/run-pass/variance-vec-covariant.rs b/src/test/run-pass/variance-vec-covariant.rs new file mode 100644 index 0000000000..caec6df5a4 --- /dev/null +++ b/src/test/run-pass/variance-vec-covariant.rs @@ -0,0 +1,28 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that vec is now covariant in its argument type. + +#![allow(dead_code)] + +fn foo<'a,'b>(v1: Vec<&'a i32>, v2: Vec<&'b i32>) -> i32 { + bar(v1, v2).cloned().unwrap_or(0) // only type checks if we can intersect 'a and 'b +} + +fn bar<'c>(v1: Vec<&'c i32>, v2: Vec<&'c i32>) -> Option<&'c i32> { + v1.get(0).cloned().or_else(|| v2.get(0).cloned()) +} + +fn main() { + let x = 22; + let y = 44; + assert_eq!(foo(vec![&x], vec![&y]), 22); + assert_eq!(foo(vec![&y], vec![&x]), 44); +} diff --git a/src/test/run-pass/variant-attributes.rs b/src/test/run-pass/variant-attributes.rs index 88255ad94f..16dca2db39 100644 --- a/src/test/run-pass/variant-attributes.rs +++ b/src/test/run-pass/variant-attributes.rs @@ -9,6 +9,7 @@ // except according to those terms. // pp-exact - Make sure we actually print the attributes +#![feature(custom_attribute)] enum crew_of_enterprise_d { diff --git a/src/test/run-pass/vec-concat.rs b/src/test/run-pass/vec-concat.rs index 02a791e797..64c4c17386 100644 --- a/src/test/run-pass/vec-concat.rs +++ b/src/test/run-pass/vec-concat.rs @@ -14,7 +14,7 @@ pub fn main() { let a: Vec = vec!(1, 2, 3, 4, 5); let b: Vec = vec!(6, 7, 8, 9, 0); let mut v: Vec = a; - v.push_all(b.as_slice()); + v.push_all(&b); println!("{}", v[9]); assert_eq!(v[0], 1); assert_eq!(v[7], 8); diff --git a/src/test/run-pass/vec-fixed-length.rs b/src/test/run-pass/vec-fixed-length.rs index 101999bbe0..015baea5fb 100644 --- a/src/test/run-pass/vec-fixed-length.rs +++ b/src/test/run-pass/vec-fixed-length.rs @@ -17,11 +17,11 @@ pub fn main() { assert_eq!(x[2], 3); assert_eq!(x[3], 4); - assert_eq!(size_of::<[u8; 4]>(), 4u); + assert_eq!(size_of::<[u8; 4]>(), 4_usize); // FIXME #10183 // FIXME #18069 //if cfg!(target_pointer_width = "64") { - // assert_eq!(size_of::<[u8; (1 << 32)]>(), (1u << 32)); + // assert_eq!(size_of::<[u8; (1 << 32)]>(), (1_usize << 32)); //} } diff --git a/src/test/run-pass/vec-growth.rs b/src/test/run-pass/vec-growth.rs index d5e5f94d26..b8626b9c8a 100644 --- a/src/test/run-pass/vec-growth.rs +++ b/src/test/run-pass/vec-growth.rs @@ -10,11 +10,11 @@ pub fn main() { - let mut v = vec!(1i); - v.push(2i); - v.push(3i); - v.push(4i); - v.push(5i); + let mut v = vec!(1); + v.push(2); + v.push(3); + v.push(4); + v.push(5); assert_eq!(v[0], 1); assert_eq!(v[1], 2); assert_eq!(v[2], 3); diff --git a/src/test/run-pass/vec-macro-no-std.rs b/src/test/run-pass/vec-macro-no-std.rs index 7b2c35aa08..47b87fce2a 100644 --- a/src/test/run-pass/vec-macro-no-std.rs +++ b/src/test/run-pass/vec-macro-no-std.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(lang_items)] +#![feature(lang_items, start, no_std)] #![no_std] extern crate "std" as other; diff --git a/src/test/run-pass/vec-macro-repeat.rs b/src/test/run-pass/vec-macro-repeat.rs new file mode 100644 index 0000000000..76e7b92ea0 --- /dev/null +++ b/src/test/run-pass/vec-macro-repeat.rs @@ -0,0 +1,22 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + +pub fn main() { + assert_eq!(vec![1; 3], vec![1, 1, 1]); + assert_eq!(vec![1; 2], vec![1, 1]); + assert_eq!(vec![1; 1], vec![1]); + assert_eq!(vec![1; 0], vec![]); + + // from_elem syntax (see RFC 832) + let el = Box::new(1); + let n = 3; + assert_eq!(vec![el; n], vec![Box::new(1), Box::new(1), Box::new(1)]); +} diff --git a/src/test/run-pass/vec-macro-rvalue-scope.rs b/src/test/run-pass/vec-macro-rvalue-scope.rs new file mode 100644 index 0000000000..68dedfc6a2 --- /dev/null +++ b/src/test/run-pass/vec-macro-rvalue-scope.rs @@ -0,0 +1,18 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn one() -> i32 { 1 } + +// Make sure the vec![...] macro doesn't introduce hidden rvalue +// scopes (such as blocks) around the element expressions. +pub fn main() { + assert_eq!(vec![&one(), &one(), &2], vec![&1, &1, &(one()+one())]); + assert_eq!(vec![&one(); 2], vec![&1, &one()]); +} diff --git a/src/test/run-pass/vec-macro-with-brackets.rs b/src/test/run-pass/vec-macro-with-brackets.rs index a263501f8f..5d1f43fb23 100644 --- a/src/test/run-pass/vec-macro-with-brackets.rs +++ b/src/test/run-pass/vec-macro-with-brackets.rs @@ -17,5 +17,5 @@ macro_rules! vec [ ]; pub fn main() { - let my_vec = vec![1i, 2, 3, 4, 5]; + let my_vec = vec![1, 2, 3, 4, 5]; } diff --git a/src/test/run-pass/vec-macro-with-trailing-comma.rs b/src/test/run-pass/vec-macro-with-trailing-comma.rs index 80c2a5fe83..07033d6049 100644 --- a/src/test/run-pass/vec-macro-with-trailing-comma.rs +++ b/src/test/run-pass/vec-macro-with-trailing-comma.rs @@ -10,6 +10,6 @@ pub fn main() { - assert_eq!(vec!(1i), vec!(1i,)); - assert_eq!(vec!(1i, 2, 3), vec!(1i, 2, 3,)); + assert_eq!(vec!(1), vec!(1,)); + assert_eq!(vec!(1, 2, 3), vec!(1, 2, 3,)); } diff --git a/src/test/run-pass/vec-matching-autoslice.rs b/src/test/run-pass/vec-matching-autoslice.rs index 6476f734ae..4ed73dc230 100644 --- a/src/test/run-pass/vec-matching-autoslice.rs +++ b/src/test/run-pass/vec-matching-autoslice.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let x = [1i, 2, 3]; + let x = [1, 2, 3]; match x { [2, _, _] => panic!(), [1, a, b] => { @@ -18,7 +18,7 @@ pub fn main() { [_, _, _] => panic!(), } - let y = ([(1i, true), (2i, false)], 0.5f64); + let y = ([(1, true), (2, false)], 0.5f64); match y { ([(1, a), (b, false)], _) => { assert_eq!(a, true); diff --git a/src/test/run-pass/vec-matching-fixed.rs b/src/test/run-pass/vec-matching-fixed.rs index a1a14823ff..6ef1dc4ea2 100644 --- a/src/test/run-pass/vec-matching-fixed.rs +++ b/src/test/run-pass/vec-matching-fixed.rs @@ -11,7 +11,7 @@ #![feature(advanced_slice_patterns)] fn a() { - let x = [1i, 2, 3]; + let x = [1, 2, 3]; match x { [1, 2, 4] => unreachable!(), [0, 2, 3, ..] => unreachable!(), diff --git a/src/test/run-pass/vec-matching-fold.rs b/src/test/run-pass/vec-matching-fold.rs index 5766018333..e72170cb73 100644 --- a/src/test/run-pass/vec-matching-fold.rs +++ b/src/test/run-pass/vec-matching-fold.rs @@ -39,11 +39,11 @@ fn foldr(values: &[T], } pub fn main() { - let x = &[1i, 2, 3, 4, 5]; + let x = &[1, 2, 3, 4, 5]; - let product = foldl(x, 1i, |a, b| a * *b); + let product = foldl(x, 1, |a, b| a * *b); assert_eq!(product, 120); - let sum = foldr(x, 0i, |a, b| *a + b); + let sum = foldr(x, 0, |a, b| *a + b); assert_eq!(sum, 15); } diff --git a/src/test/run-pass/vec-matching-legal-tail-element-borrow.rs b/src/test/run-pass/vec-matching-legal-tail-element-borrow.rs index a140399447..6430990615 100644 --- a/src/test/run-pass/vec-matching-legal-tail-element-borrow.rs +++ b/src/test/run-pass/vec-matching-legal-tail-element-borrow.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let x = &[1i, 2, 3, 4, 5]; + let x = &[1, 2, 3, 4, 5]; let x: &[int] = &[1, 2, 3, 4, 5]; if !x.is_empty() { let el = match x { diff --git a/src/test/run-pass/vec-matching.rs b/src/test/run-pass/vec-matching.rs index 77226df7fa..8dcf4612f4 100644 --- a/src/test/run-pass/vec-matching.rs +++ b/src/test/run-pass/vec-matching.rs @@ -11,7 +11,7 @@ #![feature(advanced_slice_patterns)] fn a() { - let x = [1i]; + let x = [1]; match x { [a] => { assert_eq!(a, 1); @@ -20,7 +20,7 @@ fn a() { } fn b() { - let x = [1i, 2, 3]; + let x = [1, 2, 3]; match x { [a, b, c..] => { assert_eq!(a, 1); @@ -55,7 +55,7 @@ fn b() { } fn c() { - let x = [1i]; + let x = [1]; match x { [2, ..] => panic!(), [..] => () @@ -63,18 +63,18 @@ fn c() { } fn d() { - let x = [1i, 2, 3]; + let x = [1, 2, 3]; let branch = match x { - [1, 1, ..] => 0i, - [1, 2, 3, ..] => 1i, - [1, 2, ..] => 2i, + [1, 1, ..] => 0, + [1, 2, 3, ..] => 1, + [1, 2, ..] => 2, _ => 3 }; assert_eq!(branch, 1); } fn e() { - let x: &[int] = &[1i, 2, 3]; + let x: &[int] = &[1, 2, 3]; match x { [1, 2] => (), [..] => () diff --git a/src/test/run-pass/vec-push.rs b/src/test/run-pass/vec-push.rs index fe0f92a0c1..33f01c5bd4 100644 --- a/src/test/run-pass/vec-push.rs +++ b/src/test/run-pass/vec-push.rs @@ -8,4 +8,4 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub fn main() { let mut v = vec!(1i, 2, 3); v.push(1); } +pub fn main() { let mut v = vec!(1, 2, 3); v.push(1); } diff --git a/src/test/run-pass/vec-repeat-with-cast.rs b/src/test/run-pass/vec-repeat-with-cast.rs index 97a443cb3b..22ca6c37a8 100644 --- a/src/test/run-pass/vec-repeat-with-cast.rs +++ b/src/test/run-pass/vec-repeat-with-cast.rs @@ -8,4 +8,4 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub fn main() { let _a = [0i; 1 as uint]; } +pub fn main() { let _a = [0; 1 as uint]; } diff --git a/src/test/run-pass/vec-slice.rs b/src/test/run-pass/vec-slice.rs index b0799e4944..5375e54e27 100644 --- a/src/test/run-pass/vec-slice.rs +++ b/src/test/run-pass/vec-slice.rs @@ -9,8 +9,8 @@ // except according to those terms. pub fn main() { - let v = vec!(1i,2,3,4,5); - let v2 = v.slice(1, 3); + let v = vec![1,2,3,4,5]; + let v2 = &v[1..3]; assert_eq!(v2[0], 2); assert_eq!(v2[1], 3); } diff --git a/src/test/run-pass/vec-tail-matching.rs b/src/test/run-pass/vec-tail-matching.rs index a1a222549a..401d629c38 100644 --- a/src/test/run-pass/vec-tail-matching.rs +++ b/src/test/run-pass/vec-tail-matching.rs @@ -31,8 +31,8 @@ pub fn main() { unreachable!(); } [Foo { string: ref a }, Foo { string: ref b }] => { - assert_eq!("bar", a.as_slice().slice(0, a.len())); - assert_eq!("baz", b.as_slice().slice(0, b.len())); + assert_eq!("bar", &a[0..a.len()]); + assert_eq!("baz", &b[0..b.len()]); } _ => { unreachable!(); diff --git a/src/test/run-pass/vec-to_str.rs b/src/test/run-pass/vec-to_str.rs index 97c12d0954..5d132b2a74 100644 --- a/src/test/run-pass/vec-to_str.rs +++ b/src/test/run-pass/vec-to_str.rs @@ -9,11 +9,11 @@ // except according to those terms. pub fn main() { - assert_eq!(format!("{:?}", vec!(0i, 1)), "[0i, 1i]".to_string()); + assert_eq!(format!("{:?}", vec!(0, 1)), "[0, 1]".to_string()); - let foo = vec!(3i, 4); + let foo = vec!(3, 4); let bar: &[int] = &[4, 5]; - assert_eq!(format!("{:?}", foo), "[3i, 4i]"); - assert_eq!(format!("{:?}", bar), "[4i, 5i]"); + assert_eq!(format!("{:?}", foo), "[3, 4]"); + assert_eq!(format!("{:?}", bar), "[4, 5]"); } diff --git a/src/test/run-pass/vec_cycle.rs b/src/test/run-pass/vec_cycle.rs new file mode 100644 index 0000000000..65522bd95d --- /dev/null +++ b/src/test/run-pass/vec_cycle.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::cell::Cell; + +#[derive(Show)] +struct C<'a> { + v: Vec>>>, +} + +impl<'a> C<'a> { + fn new() -> C<'a> { + C { v: Vec::new() } + } +} + +fn f() { + let (mut c1, mut c2, mut c3); + c1 = C::new(); + c2 = C::new(); + c3 = C::new(); + + c1.v.push(Cell::new(None)); + c1.v.push(Cell::new(None)); + c2.v.push(Cell::new(None)); + c2.v.push(Cell::new(None)); + c3.v.push(Cell::new(None)); + c3.v.push(Cell::new(None)); + + c1.v[0].set(Some(&c2)); + c1.v[1].set(Some(&c3)); + c2.v[0].set(Some(&c2)); + c2.v[1].set(Some(&c3)); + c3.v[0].set(Some(&c1)); + c3.v[1].set(Some(&c2)); +} + +fn main() { + f(); +} diff --git a/src/test/run-pass/vec_cycle_wrapped.rs b/src/test/run-pass/vec_cycle_wrapped.rs new file mode 100644 index 0000000000..f179df90b3 --- /dev/null +++ b/src/test/run-pass/vec_cycle_wrapped.rs @@ -0,0 +1,58 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::cell::Cell; + +#[derive(Show)] +struct Refs<'a> { + v: Vec>>>, +} + +#[derive(Show)] +struct C<'a> { + refs: Refs<'a>, +} + +impl<'a> Refs<'a> { + fn new() -> Refs<'a> { + Refs { v: Vec::new() } + } +} + +impl<'a> C<'a> { + fn new() -> C<'a> { + C { refs: Refs::new() } + } +} + +fn f() { + let (mut c1, mut c2, mut c3); + c1 = C::new(); + c2 = C::new(); + c3 = C::new(); + + c1.refs.v.push(Cell::new(None)); + c1.refs.v.push(Cell::new(None)); + c2.refs.v.push(Cell::new(None)); + c2.refs.v.push(Cell::new(None)); + c3.refs.v.push(Cell::new(None)); + c3.refs.v.push(Cell::new(None)); + + c1.refs.v[0].set(Some(&c2)); + c1.refs.v[1].set(Some(&c3)); + c2.refs.v[0].set(Some(&c2)); + c2.refs.v[1].set(Some(&c3)); + c3.refs.v[0].set(Some(&c1)); + c3.refs.v[1].set(Some(&c2)); +} + +fn main() { + f(); +} diff --git a/src/test/run-pass/vector-sort-panic-safe.rs b/src/test/run-pass/vector-sort-panic-safe.rs index 29bf82a81d..08d39e58b7 100644 --- a/src/test/run-pass/vector-sort-panic-safe.rs +++ b/src/test/run-pass/vector-sort-panic-safe.rs @@ -8,30 +8,32 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::sync::atomic::{AtomicUint, ATOMIC_UINT_INIT, Ordering}; +use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; use std::rand::{thread_rng, Rng, Rand}; -use std::thread::Thread; +use std::thread; -const REPEATS: uint = 5; -const MAX_LEN: uint = 32; -static drop_counts: [AtomicUint; MAX_LEN] = - // FIXME #5244: AtomicUint is not Copy. +const REPEATS: usize = 5; +const MAX_LEN: usize = 32; +static drop_counts: [AtomicUsize; MAX_LEN] = + // FIXME #5244: AtomicUsize is not Copy. [ - ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, - ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, - ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, - ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, - - ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, - ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, - ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, - ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, ATOMIC_UINT_INIT, + ATOMIC_USIZE_INIT, ATOMIC_USIZE_INIT, ATOMIC_USIZE_INIT, + ATOMIC_USIZE_INIT, ATOMIC_USIZE_INIT, ATOMIC_USIZE_INIT, + ATOMIC_USIZE_INIT, ATOMIC_USIZE_INIT, ATOMIC_USIZE_INIT, + ATOMIC_USIZE_INIT, ATOMIC_USIZE_INIT, ATOMIC_USIZE_INIT, + ATOMIC_USIZE_INIT, ATOMIC_USIZE_INIT, ATOMIC_USIZE_INIT, + ATOMIC_USIZE_INIT, ATOMIC_USIZE_INIT, ATOMIC_USIZE_INIT, + ATOMIC_USIZE_INIT, ATOMIC_USIZE_INIT, ATOMIC_USIZE_INIT, + ATOMIC_USIZE_INIT, ATOMIC_USIZE_INIT, ATOMIC_USIZE_INIT, + ATOMIC_USIZE_INIT, ATOMIC_USIZE_INIT, ATOMIC_USIZE_INIT, + ATOMIC_USIZE_INIT, ATOMIC_USIZE_INIT, ATOMIC_USIZE_INIT, + ATOMIC_USIZE_INIT, ATOMIC_USIZE_INIT, ]; -static creation_count: AtomicUint = ATOMIC_UINT_INIT; +static creation_count: AtomicUsize = ATOMIC_USIZE_INIT; #[derive(Clone, PartialEq, PartialOrd, Eq, Ord)] -struct DropCounter { x: uint, creation_id: uint } +struct DropCounter { x: usize, creation_id: usize } impl Rand for DropCounter { fn rand(rng: &mut R) -> DropCounter { @@ -51,10 +53,10 @@ impl Drop for DropCounter { } pub fn main() { - assert!(MAX_LEN <= std::uint::BITS); + assert!(MAX_LEN <= std::usize::BITS); // len can't go above 64. - for len in range(2, MAX_LEN) { - for _ in range(0, REPEATS) { + for len in 2..MAX_LEN { + for _ in 0..REPEATS { // reset the count for these new DropCounters, so their // IDs start from 0. creation_count.store(0, Ordering::Relaxed); @@ -65,22 +67,22 @@ pub fn main() { // work out the total number of comparisons required to sort // this array... - let mut count = 0; - main.clone().as_mut_slice().sort_by(|a, b| { count += 1; a.cmp(b) }); + let mut count = 0_usize; + main.clone().sort_by(|a, b| { count += 1; a.cmp(b) }); // ... and then panic on each and every single one. - for panic_countdown in range(0i, count) { + for panic_countdown in 0..count { // refresh the counters. - for c in drop_counts.iter() { + for c in &drop_counts { c.store(0, Ordering::Relaxed); } let v = main.clone(); - let _ = Thread::scoped(move|| { + let _ = thread::spawn(move|| { let mut v = v; let mut panic_countdown = panic_countdown; - v.as_mut_slice().sort_by(|a, b| { + v.sort_by(|a, b| { if panic_countdown == 0 { panic!() } diff --git a/src/test/run-pass/visible-private-types-feature-gate.rs b/src/test/run-pass/visible-private-types-feature-gate.rs index 9518671b47..46e93b2569 100644 --- a/src/test/run-pass/visible-private-types-feature-gate.rs +++ b/src/test/run-pass/visible-private-types-feature-gate.rs @@ -10,7 +10,7 @@ #![feature(visible_private_types)] -trait Foo {} +trait Foo { fn dummy(&self) { } } pub trait Bar : Foo {} diff --git a/src/test/run-pass/wait-forked-but-failed-child.rs b/src/test/run-pass/wait-forked-but-failed-child.rs index eb7205b5e0..dcbecb859e 100644 --- a/src/test/run-pass/wait-forked-but-failed-child.rs +++ b/src/test/run-pass/wait-forked-but-failed-child.rs @@ -10,7 +10,7 @@ extern crate libc; -use std::io::process::Command; +use std::old_io::process::Command; use libc::funcs::posix88::unistd; @@ -35,13 +35,13 @@ fn find_zombies() { // http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html let ps_cmd_output = Command::new("ps").args(&["-A", "-o", "pid,ppid,args"]).output().unwrap(); - let ps_output = String::from_utf8_lossy(ps_cmd_output.output.as_slice()); + let ps_output = String::from_utf8_lossy(&ps_cmd_output.output); for (line_no, line) in ps_output.split('\n').enumerate() { if 0 < line_no && 0 < line.len() && my_pid == line.split(' ').filter(|w| 0 < w.len()).nth(1) .expect("1st column should be PPID") - .parse() + .parse().ok() .expect("PPID string into integer") && line.contains("defunct") { panic!("Zombie child {}", line); @@ -55,10 +55,10 @@ fn find_zombies() { } fn main() { let too_long = format!("/NoSuchCommand{:0300}", 0u8); - let _failures = range(0, 100).map(|_| { - let cmd = Command::new(too_long.as_slice()); + let _failures = (0..100).map(|_| { + let cmd = Command::new(&too_long); let failed = cmd.spawn(); - assert!(failed.is_err(), "Make sure the command fails to spawn(): {}", cmd); + assert!(failed.is_err(), "Make sure the command fails to spawn(): {:?}", cmd); failed }).collect::>(); diff --git a/src/test/run-pass/warn-ctypes-inhibit.rs b/src/test/run-pass/warn-ctypes-inhibit.rs index 93112e3e7e..7312191825 100644 --- a/src/test/run-pass/warn-ctypes-inhibit.rs +++ b/src/test/run-pass/warn-ctypes-inhibit.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags:-D ctypes +// compile-flags:-D improper-ctypes -#![allow(ctypes)] +#![allow(improper_ctypes)] mod libc { extern { diff --git a/src/test/run-pass/weak-lang-item.rs b/src/test/run-pass/weak-lang-item.rs index 08dac5c7c8..741e8be02f 100644 --- a/src/test/run-pass/weak-lang-item.rs +++ b/src/test/run-pass/weak-lang-item.rs @@ -12,10 +12,10 @@ extern crate "weak-lang-items" as other; -use std::thread::Thread; +use std::thread; fn main() { - let _ = Thread::spawn(move|| { + let _ = thread::spawn(move|| { other::foo() }); } diff --git a/src/test/run-pass/weird-exprs.rs b/src/test/run-pass/weird-exprs.rs index c8ed1a2610..baea1b8826 100644 --- a/src/test/run-pass/weird-exprs.rs +++ b/src/test/run-pass/weird-exprs.rs @@ -26,7 +26,7 @@ fn what() { return while !x.get() { x.set(true); }; } let i = &Cell::new(false); - let dont = {|&:|the(i)}; + let dont = {||the(i)}; dont(); assert!((i.get())); } @@ -36,7 +36,7 @@ fn zombiejesus() { while (return) { if (return) { match (return) { - 1i => { + 1 => { if (return) { return } else { @@ -65,13 +65,13 @@ fn canttouchthis() -> uint { fn p() -> bool { true } let _a = (assert!((true)) == (assert!(p()))); let _c = (assert!((p())) == ()); - let _b: bool = (println!("{}", 0i) == (return 0u)); + let _b: bool = (println!("{}", 0) == (return 0_usize)); } fn angrydome() { loop { if break { } } - let mut i = 0i; - loop { i += 1; if i == 1 { match (continue) { 1i => { }, _ => panic!("wat") } } + let mut i = 0; + loop { i += 1; if i == 1 { match (continue) { 1 => { }, _ => panic!("wat") } } break; } } diff --git a/src/test/run-pass/where-clause-bounds-inconsistency.rs b/src/test/run-pass/where-clause-bounds-inconsistency.rs new file mode 100644 index 0000000000..3374f47ed5 --- /dev/null +++ b/src/test/run-pass/where-clause-bounds-inconsistency.rs @@ -0,0 +1,30 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +trait Bound { + fn dummy(&self) { } +} + +trait Trait { + fn a(&self, T) where T: Bound; + fn b(&self, T) where T: Bound; + fn c(&self, T); + fn d(&self, T); +} + +impl Trait for bool { + fn a(&self, _: T) {} + //^~ This gets rejected but should be accepted + fn b(&self, _: T) where T: Bound {} + fn c(&self, _: T) {} + fn d(&self, _: T) where T: Bound {} +} + +fn main() {} diff --git a/src/test/run-pass/where-clause-early-bound-lifetimes.rs b/src/test/run-pass/where-clause-early-bound-lifetimes.rs index cade99b83a..4a149d4d3d 100644 --- a/src/test/run-pass/where-clause-early-bound-lifetimes.rs +++ b/src/test/run-pass/where-clause-early-bound-lifetimes.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait TheTrait { } +trait TheTrait { fn dummy(&self) { } } impl TheTrait for &'static int { } diff --git a/src/test/run-pass/where-clause-method-substituion.rs b/src/test/run-pass/where-clause-method-substituion.rs index b391df8500..ecc210ea57 100644 --- a/src/test/run-pass/where-clause-method-substituion.rs +++ b/src/test/run-pass/where-clause-method-substituion.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Foo {} +trait Foo { fn dummy(&self, arg: T) { } } trait Bar { fn method(&self) where A: Foo; @@ -19,7 +19,7 @@ struct X; impl Foo for X {} -impl Bar for int { +impl Bar for i32 { fn method(&self) where X: Foo { } } diff --git a/src/test/run-pass/where-clause-region-outlives.rs b/src/test/run-pass/where-clause-region-outlives.rs index 1ecb4b6c2d..aa39325277 100644 --- a/src/test/run-pass/where-clause-region-outlives.rs +++ b/src/test/run-pass/where-clause-region-outlives.rs @@ -11,7 +11,7 @@ struct A<'a, 'b> where 'a : 'b { x: &'a int, y: &'b int } fn main() { - let x = 1i; - let y = 1i; + let x = 1; + let y = 1; let a = A { x: &x, y: &y }; } diff --git a/src/test/run-pass/where-clauses-cross-crate.rs b/src/test/run-pass/where-clauses-cross-crate.rs index 648f646b63..b822abd673 100644 --- a/src/test/run-pass/where-clauses-cross-crate.rs +++ b/src/test/run-pass/where-clauses-cross-crate.rs @@ -15,9 +15,9 @@ extern crate where_clauses_xc; use where_clauses_xc::{Equal, equal}; fn main() { - println!("{}", equal(&1i, &2i)); - println!("{}", equal(&1i, &1i)); + println!("{}", equal(&1, &2)); + println!("{}", equal(&1, &1)); println!("{}", "hello".equal(&"hello")); - println!("{}", "hello".equals::(&1i, &1i, &"foo", &"bar")); + println!("{}", "hello".equals::(&1, &1, &"foo", &"bar")); } diff --git a/src/test/run-pass/where-clauses-lifetimes.rs b/src/test/run-pass/where-clauses-lifetimes.rs index 237c83c8aa..e3ea7cd80e 100644 --- a/src/test/run-pass/where-clauses-lifetimes.rs +++ b/src/test/run-pass/where-clauses-lifetimes.rs @@ -11,5 +11,5 @@ fn foo<'a, I>(mut it: I) where I: Iterator {} fn main() { - foo([1i, 2].iter()); + foo([1, 2].iter()); } diff --git a/src/test/run-pass/where-clauses-method.rs b/src/test/run-pass/where-clauses-method.rs index 2b87bcd4b3..29efe72727 100644 --- a/src/test/run-pass/where-clauses-method.rs +++ b/src/test/run-pass/where-clauses-method.rs @@ -22,8 +22,8 @@ impl Foo { } fn main() { - let x = Foo { value: 1i }; - let y = Foo { value: 2i }; + let x = Foo { value: 1 }; + let y = Foo { value: 2 }; println!("{}", x.equals(&x)); println!("{}", x.equals(&y)); } diff --git a/src/test/run-pass/where-clauses-unboxed-closures.rs b/src/test/run-pass/where-clauses-unboxed-closures.rs index 808e937bc7..7edcdf6429 100644 --- a/src/test/run-pass/where-clauses-unboxed-closures.rs +++ b/src/test/run-pass/where-clauses-unboxed-closures.rs @@ -18,9 +18,9 @@ fn warm_up<'a, F>(f: F) where F: Fn(&'a mut Bencher) { fn main() { // ICE trigger - warm_up(|&: b: &mut Bencher| () ); + warm_up(|b: &mut Bencher| () ); // OK - warm_up(|&: b| () ); + warm_up(|b| () ); } diff --git a/src/test/run-pass/where-clauses.rs b/src/test/run-pass/where-clauses.rs index 807d95691f..92bc7edf28 100644 --- a/src/test/run-pass/where-clauses.rs +++ b/src/test/run-pass/where-clauses.rs @@ -29,9 +29,9 @@ fn equal(x: &T, y: &T) -> bool where T: Eq { } fn main() { - println!("{}", equal(&1i, &2i)); - println!("{}", equal(&1i, &1i)); + println!("{}", equal(&1, &2)); + println!("{}", equal(&1, &1)); println!("{}", "hello".equal(&"hello")); - println!("{}", "hello".equals::(&1i, &1i, &"foo", &"bar")); + println!("{}", "hello".equals::(&1, &1, &"foo", &"bar")); } diff --git a/src/test/run-pass/where-for-self.rs b/src/test/run-pass/where-for-self.rs new file mode 100644 index 0000000000..1fd223b0dd --- /dev/null +++ b/src/test/run-pass/where-for-self.rs @@ -0,0 +1,65 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we can quantify lifetimes outside a constraint (i.e., including +// the self type) in a where clause. + +use std::marker::PhantomFn; + +static mut COUNT: u32 = 1; + +trait Bar<'a> + : PhantomFn<&'a ()> +{ + fn bar(&self); +} + +trait Baz<'a> + : PhantomFn<&'a ()> +{ + fn baz(&self); +} + +impl<'a, 'b> Bar<'b> for &'a u32 { + fn bar(&self) { + unsafe { COUNT *= 2; } + } +} + +impl<'a, 'b> Baz<'b> for &'a u32 { + fn baz(&self) { + unsafe { COUNT *= 3; } + } +} + +// Test we can use the syntax for HRL including the self type. +fn foo1(x: &T) + where for<'a, 'b> &'a T: Bar<'b> +{ + x.bar() +} + +// Test we can quantify multiple bounds (i.e., the precedence is sensible). +fn foo2(x: &T) + where for<'a, 'b> &'a T: Bar<'b> + Baz<'b> +{ + x.baz(); + x.bar() +} + +fn main() { + let x = 42u32; + foo1(&x); + foo2(&x); + unsafe { + assert!(COUNT == 12); + } +} + diff --git a/src/test/run-pass/while-cont.rs b/src/test/run-pass/while-cont.rs index 50feb3ef4e..3e1a232115 100644 --- a/src/test/run-pass/while-cont.rs +++ b/src/test/run-pass/while-cont.rs @@ -10,7 +10,7 @@ // Issue #825: Should recheck the loop condition after continuing pub fn main() { - let mut i = 1i; + let mut i = 1; while i > 0 { assert!((i > 0)); println!("{}", i); diff --git a/src/test/run-pass/while-flow-graph.rs b/src/test/run-pass/while-flow-graph.rs index 01c5986b13..8239afb359 100644 --- a/src/test/run-pass/while-flow-graph.rs +++ b/src/test/run-pass/while-flow-graph.rs @@ -10,4 +10,4 @@ -pub fn main() { let x: int = 10; while x == 10 && x == 11 { let _y = 0xf00u; } } +pub fn main() { let x: int = 10; while x == 10 && x == 11 { let _y = 0xf00_usize; } } diff --git a/src/test/run-pass/while-label.rs b/src/test/run-pass/while-label.rs index 41712f7c64..4a3cd115d2 100644 --- a/src/test/run-pass/while-label.rs +++ b/src/test/run-pass/while-label.rs @@ -10,8 +10,8 @@ pub fn main() { - let mut i = 100i; - 'w: while 1i + 1 == 2 { + let mut i = 100; + 'w: while 1 + 1 == 2 { i -= 1; if i == 95 { break 'w; diff --git a/src/test/run-pass/while-let.rs b/src/test/run-pass/while-let.rs index 94a45817ee..1780445fb3 100644 --- a/src/test/run-pass/while-let.rs +++ b/src/test/run-pass/while-let.rs @@ -11,16 +11,16 @@ use std::collections::BinaryHeap; fn make_pq() -> BinaryHeap { - BinaryHeap::from_vec(vec![1i,2,3]) + BinaryHeap::from_vec(vec![1,2,3]) } pub fn main() { let mut pq = make_pq(); - let mut sum = 0i; + let mut sum = 0; while let Some(x) = pq.pop() { sum += x; } - assert_eq!(sum, 6i); + assert_eq!(sum, 6); pq = make_pq(); sum = 0; @@ -30,7 +30,7 @@ pub fn main() { break 'a; } } - assert_eq!(sum, 5i); + assert_eq!(sum, 5); pq = make_pq(); sum = 0; @@ -40,7 +40,7 @@ pub fn main() { } sum += x; } - assert_eq!(sum, 3i); + assert_eq!(sum, 3); let mut pq1 = make_pq(); sum = 0; @@ -50,5 +50,5 @@ pub fn main() { sum += x * y; } } - assert_eq!(sum, 6i + 12 + 18); + assert_eq!(sum, 6 + 12 + 18); } diff --git a/src/test/run-pass/x86stdcall.rs b/src/test/run-pass/x86stdcall.rs index 15d18525d0..5dd0a5522c 100644 --- a/src/test/run-pass/x86stdcall.rs +++ b/src/test/run-pass/x86stdcall.rs @@ -1,4 +1,4 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -22,7 +22,7 @@ mod kernel32 { #[cfg(windows)] pub fn main() { unsafe { - let expected = 1234u; + let expected = 1234_usize; kernel32::SetLastError(expected); let actual = kernel32::GetLastError(); println!("actual = {}", actual); @@ -34,5 +34,6 @@ pub fn main() { target_os = "linux", target_os = "freebsd", target_os = "dragonfly", + target_os = "openbsd", target_os = "android"))] pub fn main() { } diff --git a/src/test/run-pass/x86stdcall2.rs b/src/test/run-pass/x86stdcall2.rs index 522e5fd978..86c1ae0f51 100644 --- a/src/test/run-pass/x86stdcall2.rs +++ b/src/test/run-pass/x86stdcall2.rs @@ -31,7 +31,7 @@ mod kernel32 { pub fn main() { let heap = unsafe { kernel32::GetProcessHeap() }; let mem = unsafe { kernel32::HeapAlloc(heap, 0u32, 100u32) }; - assert!(mem != 0u); + assert!(mem != 0_usize); let res = unsafe { kernel32::HeapFree(heap, 0u32, mem) }; assert!(res != 0u8); } diff --git a/src/test/run-pass/yield.rs b/src/test/run-pass/yield.rs index 9ad6dd9d2b..45a7475095 100644 --- a/src/test/run-pass/yield.rs +++ b/src/test/run-pass/yield.rs @@ -8,18 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::thread::Thread; +use std::thread; pub fn main() { - let mut result = Thread::scoped(child); + let mut result = thread::spawn(child); println!("1"); - Thread::yield_now(); + thread::yield_now(); println!("2"); - Thread::yield_now(); + thread::yield_now(); println!("3"); result.join(); } fn child() { - println!("4"); Thread::yield_now(); println!("5"); Thread::yield_now(); println!("6"); + println!("4"); thread::yield_now(); println!("5"); thread::yield_now(); println!("6"); } diff --git a/src/test/run-pass/yield1.rs b/src/test/run-pass/yield1.rs index 3d3a36021d..69d8431082 100644 --- a/src/test/run-pass/yield1.rs +++ b/src/test/run-pass/yield1.rs @@ -8,12 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::thread::Thread; +use std::thread; pub fn main() { - let mut result = Thread::scoped(child); + let mut result = thread::spawn(child); println!("1"); - Thread::yield_now(); + thread::yield_now(); result.join(); } diff --git a/src/test/run-pass/yield2.rs b/src/test/run-pass/yield2.rs index 66ad7de029..56dc02c6d2 100644 --- a/src/test/run-pass/yield2.rs +++ b/src/test/run-pass/yield2.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::thread::Thread; +use std::thread; pub fn main() { let mut i: int = 0; - while i < 100 { i = i + 1; println!("{}", i); Thread::yield_now(); } + while i < 100 { i = i + 1; println!("{}", i); thread::yield_now(); } } diff --git a/src/test/run-pass/zero-size-type-destructors.rs b/src/test/run-pass/zero-size-type-destructors.rs index fd272a47de..f4d03a5cda 100644 --- a/src/test/run-pass/zero-size-type-destructors.rs +++ b/src/test/run-pass/zero-size-type-destructors.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(unsafe_no_drop_flag)] + static mut destructions : int = 3; pub fn foo() { diff --git a/src/test/run-pass/zero_sized_subslice_match.rs b/src/test/run-pass/zero_sized_subslice_match.rs new file mode 100644 index 0000000000..65882d3937 --- /dev/null +++ b/src/test/run-pass/zero_sized_subslice_match.rs @@ -0,0 +1,19 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let x = [(), ()]; + + // The subslice used to go out of bounds for zero-sized array items, check that this doesn't + // happen anymore + match x { + [_, y..] => assert_eq!(&x[1] as *const _, &y[0] as *const _) + } +} -- 2.39.2

Parser for P { + type Input = (); +} + +fn main() { +} diff --git a/src/test/run-pass/associated-types-nested-projections.rs b/src/test/run-pass/associated-types-nested-projections.rs index a907b9fcde..2ee8ef0d3d 100644 --- a/src/test/run-pass/associated-types-nested-projections.rs +++ b/src/test/run-pass/associated-types-nested-projections.rs @@ -10,11 +10,12 @@ // Test that we can resolve nested projection types. Issue #20666. +use std::marker::MarkerTrait; use std::slice; -trait Bound {} +trait Bound : MarkerTrait {} -impl<'a> Bound for &'a int {} +impl<'a> Bound for &'a i32 {} trait IntoIterator { type Iter: Iterator; @@ -45,6 +46,6 @@ fn bar(x: X) where } fn main() { - foo(&[0i, 1, 2]); - bar(&[0i, 1, 2]); + foo(&[0, 1, 2]); + bar(&[0, 1, 2]); } diff --git a/src/test/run-pass/associated-types-normalize-in-bounds-binding.rs b/src/test/run-pass/associated-types-normalize-in-bounds-binding.rs new file mode 100644 index 0000000000..de96af83f5 --- /dev/null +++ b/src/test/run-pass/associated-types-normalize-in-bounds-binding.rs @@ -0,0 +1,46 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we normalize associated types that appear in a bound that +// contains a binding. Issue #21664. + +#![allow(dead_code)] + +use std::marker::MarkerTrait; + +pub trait Integral : MarkerTrait { + type Opposite; +} + +impl Integral for i32 { + type Opposite = u32; +} + +impl Integral for u32 { + type Opposite = i32; +} + +pub trait FnLike { + type R; + + fn dummy(&self, a: A) -> Self::R { loop { } } +} + +fn foo() + where T : FnLike<::Opposite, R=bool> +{ + bar::(); +} + +fn bar() + where T : FnLike +{} + +fn main() { } diff --git a/src/test/run-pass/associated-types-normalize-in-bounds-ufcs.rs b/src/test/run-pass/associated-types-normalize-in-bounds-ufcs.rs index 1d264655bc..8617750ca5 100644 --- a/src/test/run-pass/associated-types-normalize-in-bounds-ufcs.rs +++ b/src/test/run-pass/associated-types-normalize-in-bounds-ufcs.rs @@ -11,15 +11,17 @@ // Test that we normalize associated types that appear in bounds; if // we didn't, the call to `self.split2()` fails to type check. -struct Splits<'a, T, P>; -struct SplitsN; +use std::marker::PhantomData; + +struct Splits<'a, T:'a, P>(PhantomData<(&'a T, P)>); +struct SplitsN(PhantomData); trait SliceExt2 { type Item; fn split2<'a, P>(&'a self, pred: P) -> Splits<'a, Self::Item, P> where P: FnMut(&Self::Item) -> bool; - fn splitn2<'a, P>(&'a self, n: uint, pred: P) -> SplitsN> + fn splitn2<'a, P>(&'a self, n: u32, pred: P) -> SplitsN> where P: FnMut(&Self::Item) -> bool; } @@ -30,7 +32,7 @@ impl SliceExt2 for [T] { loop {} } - fn splitn2