]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #47544 - U007D:master, r=nikomatsakis
authorbors <bors@rust-lang.org>
Sun, 18 Feb 2018 03:12:14 +0000 (03:12 +0000)
committerbors <bors@rust-lang.org>
Sun, 18 Feb 2018 03:12:14 +0000 (03:12 +0000)
Relax termination_trait's error bound

As per [this conversation](https://github.com/withoutboats/failure/issues/130#issuecomment-358572413) with @withoutboats and @bkchr

844 files changed:
.travis.yml
RELEASES.md
src/Cargo.lock
src/bootstrap/builder.rs
src/bootstrap/check.rs
src/bootstrap/compile.rs
src/bootstrap/config.rs
src/bootstrap/dist.rs
src/bootstrap/doc.rs
src/bootstrap/flags.rs
src/bootstrap/lib.rs
src/bootstrap/native.rs
src/bootstrap/test.rs
src/doc/unstable-book/src/language-features/macro-at-most-once-rep.md [new file with mode: 0644]
src/liballoc/vec.rs
src/libcompiler_builtins
src/libcore/iter/mod.rs
src/libcore/iter/sources.rs
src/libcore/iter/traits.rs
src/libcore/lib.rs
src/libcore/marker.rs
src/libcore/num/mod.rs
src/libcore/ops/range.rs
src/libcore/ptr.rs
src/libcore/slice/mod.rs
src/libcore/str/pattern.rs
src/libcore/sync/atomic.rs
src/libcore/tests/iter.rs
src/libcore/tests/lib.rs
src/libcore/tests/ops.rs
src/libcore/time.rs
src/librustc/hir/map/collector.rs
src/librustc/hir/map/mod.rs
src/librustc/middle/entry.rs
src/librustc/session/config.rs
src/librustc/traits/error_reporting.rs
src/librustc/ty/maps/mod.rs
src/librustc/ty/maps/plumbing.rs
src/librustc/ty/sty.rs
src/librustc_driver/driver.rs
src/librustc_incremental/lib.rs
src/librustc_incremental/persist/fs.rs
src/librustc_incremental/persist/mod.rs
src/librustc_lint/types.rs
src/librustc_llvm/build.rs
src/librustc_llvm/ffi.rs
src/librustc_mir/borrow_check/mod.rs
src/librustc_mir/interpret/memory.rs
src/librustc_mir/transform/mod.rs
src/librustc_mir/transform/qualify_consts.rs
src/librustc_mir/transform/uniform_array_move_out.rs [new file with mode: 0644]
src/librustc_mir/util/patch.rs
src/librustc_passes/consts.rs
src/librustc_resolve/resolve_imports.rs
src/librustc_trans/attributes.rs
src/librustc_trans/back/link.rs
src/librustc_trans/back/lto.rs
src/librustc_trans/cabi_x86_64.rs
src/librustc_trans/llvm_util.rs
src/librustc_typeck/check/_match.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/collect.rs
src/librustdoc/html/static/themes/dark.css
src/librustdoc/html/static/themes/main.css
src/librustdoc/test.rs
src/libstd/collections/hash/map.rs
src/libstd/env.rs
src/libstd/f32.rs
src/libstd/f64.rs
src/libstd/io/cursor.rs
src/libstd/io/mod.rs
src/libstd/path.rs
src/libstd/primitive_docs.rs
src/libstd/sync/condvar.rs
src/libstd/sys/windows/ext/fs.rs
src/libstd/sys/windows/fs.rs
src/libsyntax/codemap.rs
src/libsyntax/ext/tt/macro_parser.rs
src/libsyntax/ext/tt/macro_rules.rs
src/libsyntax/ext/tt/quoted.rs
src/libsyntax/feature_gate.rs
src/libsyntax/parse/parser.rs
src/rustllvm/Linker.cpp [new file with mode: 0644]
src/rustllvm/RustWrapper.cpp
src/test/codegen/abi-x86_64_sysv.rs [new file with mode: 0644]
src/test/codegen/repr-transparent-sysv64.rs [new file with mode: 0644]
src/test/codegen/repr-transparent.rs
src/test/compile-fail/E0001.rs [deleted file]
src/test/compile-fail/E0004-2.rs [deleted file]
src/test/compile-fail/E0004.rs [deleted file]
src/test/compile-fail/E0005.rs [deleted file]
src/test/compile-fail/E0007.rs [deleted file]
src/test/compile-fail/E0008.rs [deleted file]
src/test/compile-fail/E0009.rs [deleted file]
src/test/compile-fail/E0010.rs [deleted file]
src/test/compile-fail/E0017.rs [deleted file]
src/test/compile-fail/E0023.rs [deleted file]
src/test/compile-fail/E0025.rs [deleted file]
src/test/compile-fail/E0026.rs [deleted file]
src/test/compile-fail/E0027.rs [deleted file]
src/test/compile-fail/E0029.rs [deleted file]
src/test/compile-fail/E0030.rs [deleted file]
src/test/compile-fail/E0033.rs [deleted file]
src/test/compile-fail/E0034.rs [deleted file]
src/test/compile-fail/E0038.rs [deleted file]
src/test/compile-fail/E0040.rs [deleted file]
src/test/compile-fail/E0044.rs [deleted file]
src/test/compile-fail/E0045.rs [deleted file]
src/test/compile-fail/E0049.rs [deleted file]
src/test/compile-fail/E0050.rs [deleted file]
src/test/compile-fail/E0054.rs [deleted file]
src/test/compile-fail/E0055.rs [deleted file]
src/test/compile-fail/E0057.rs [deleted file]
src/test/compile-fail/E0059.rs [deleted file]
src/test/compile-fail/E0060.rs [deleted file]
src/test/compile-fail/E0061.rs [deleted file]
src/test/compile-fail/E0062.rs [deleted file]
src/test/compile-fail/E0063.rs [deleted file]
src/test/compile-fail/E0067.rs [deleted file]
src/test/compile-fail/E0069.rs [deleted file]
src/test/compile-fail/E0070.rs [deleted file]
src/test/compile-fail/E0071.rs [deleted file]
src/test/compile-fail/E0075.rs [deleted file]
src/test/compile-fail/E0076.rs [deleted file]
src/test/compile-fail/E0077.rs [deleted file]
src/test/compile-fail/E0080.rs [deleted file]
src/test/compile-fail/E0081.rs [deleted file]
src/test/compile-fail/E0084.rs [deleted file]
src/test/compile-fail/E0087.rs [deleted file]
src/test/compile-fail/E0088.rs [deleted file]
src/test/compile-fail/E0089.rs [deleted file]
src/test/compile-fail/E0090.rs [deleted file]
src/test/compile-fail/E0091.rs [deleted file]
src/test/compile-fail/E0092.rs [deleted file]
src/test/compile-fail/E0093.rs [deleted file]
src/test/compile-fail/E0094.rs [deleted file]
src/test/compile-fail/E0106.rs [deleted file]
src/test/compile-fail/E0107.rs [deleted file]
src/test/compile-fail/E0109.rs [deleted file]
src/test/compile-fail/E0110.rs [deleted file]
src/test/compile-fail/E0116.rs [deleted file]
src/test/compile-fail/E0117.rs [deleted file]
src/test/compile-fail/E0118.rs [deleted file]
src/test/compile-fail/E0119.rs [deleted file]
src/test/compile-fail/E0120.rs [deleted file]
src/test/compile-fail/E0121.rs [deleted file]
src/test/compile-fail/E0124.rs [deleted file]
src/test/compile-fail/E0128.rs [deleted file]
src/test/compile-fail/E0130.rs [deleted file]
src/test/compile-fail/E0131.rs [deleted file]
src/test/compile-fail/E0132.rs [deleted file]
src/test/compile-fail/E0133.rs [deleted file]
src/test/compile-fail/E0137.rs [deleted file]
src/test/compile-fail/E0138.rs [deleted file]
src/test/compile-fail/E0152.rs [deleted file]
src/test/compile-fail/E0161.rs [deleted file]
src/test/compile-fail/E0162.rs [deleted file]
src/test/compile-fail/E0164.rs [deleted file]
src/test/compile-fail/E0165.rs [deleted file]
src/test/compile-fail/E0184.rs [deleted file]
src/test/compile-fail/E0185.rs [deleted file]
src/test/compile-fail/E0186.rs [deleted file]
src/test/compile-fail/E0191.rs [deleted file]
src/test/compile-fail/E0192.rs [deleted file]
src/test/compile-fail/E0194.rs [deleted file]
src/test/compile-fail/E0195.rs [deleted file]
src/test/compile-fail/E0197.rs [deleted file]
src/test/compile-fail/E0198.rs [deleted file]
src/test/compile-fail/E0199.rs [deleted file]
src/test/compile-fail/E0200.rs [deleted file]
src/test/compile-fail/E0201.rs [deleted file]
src/test/compile-fail/E0206.rs [deleted file]
src/test/compile-fail/E0207.rs [deleted file]
src/test/compile-fail/E0214.rs [deleted file]
src/test/compile-fail/E0220.rs [deleted file]
src/test/compile-fail/E0221.rs [deleted file]
src/test/compile-fail/E0223.rs [deleted file]
src/test/compile-fail/E0225.rs [deleted file]
src/test/compile-fail/E0229.rs [deleted file]
src/test/compile-fail/E0232.rs [deleted file]
src/test/compile-fail/E0243.rs [deleted file]
src/test/compile-fail/E0244.rs [deleted file]
src/test/compile-fail/E0252.rs [deleted file]
src/test/compile-fail/E0253.rs [deleted file]
src/test/compile-fail/E0254.rs [deleted file]
src/test/compile-fail/E0255.rs [deleted file]
src/test/compile-fail/E0259.rs [deleted file]
src/test/compile-fail/E0260.rs [deleted file]
src/test/compile-fail/E0261.rs [deleted file]
src/test/compile-fail/E0262.rs [deleted file]
src/test/compile-fail/E0263.rs [deleted file]
src/test/compile-fail/E0264.rs [deleted file]
src/test/compile-fail/E0267.rs [deleted file]
src/test/compile-fail/E0268.rs [deleted file]
src/test/compile-fail/E0271.rs [deleted file]
src/test/compile-fail/E0275.rs [deleted file]
src/test/compile-fail/E0276.rs [deleted file]
src/test/compile-fail/E0277-2.rs [deleted file]
src/test/compile-fail/E0277.rs [deleted file]
src/test/compile-fail/E0282.rs [deleted file]
src/test/compile-fail/E0283.rs [deleted file]
src/test/compile-fail/E0296.rs [deleted file]
src/test/compile-fail/E0297.rs [deleted file]
src/test/compile-fail/E0301.rs [deleted file]
src/test/compile-fail/E0302.rs [deleted file]
src/test/compile-fail/E0303.rs [deleted file]
src/test/compile-fail/E0308-4.rs [deleted file]
src/test/compile-fail/E0308.rs [deleted file]
src/test/compile-fail/E0365.rs [deleted file]
src/test/compile-fail/E0370.rs [deleted file]
src/test/compile-fail/E0374.rs [deleted file]
src/test/compile-fail/E0375.rs [deleted file]
src/test/compile-fail/E0376.rs [deleted file]
src/test/compile-fail/E0388.rs [deleted file]
src/test/compile-fail/E0389.rs [deleted file]
src/test/compile-fail/E0390.rs [deleted file]
src/test/compile-fail/E0392.rs [deleted file]
src/test/compile-fail/E0393.rs [deleted file]
src/test/compile-fail/E0394.rs [deleted file]
src/test/compile-fail/E0395.rs [deleted file]
src/test/compile-fail/E0396.rs [deleted file]
src/test/compile-fail/E0401.rs [deleted file]
src/test/compile-fail/E0403.rs [deleted file]
src/test/compile-fail/E0404.rs [deleted file]
src/test/compile-fail/E0405.rs [deleted file]
src/test/compile-fail/E0407.rs [deleted file]
src/test/compile-fail/E0408.rs [deleted file]
src/test/compile-fail/E0411.rs [deleted file]
src/test/compile-fail/E0412.rs [deleted file]
src/test/compile-fail/E0415.rs [deleted file]
src/test/compile-fail/E0416.rs [deleted file]
src/test/compile-fail/E0423.rs [deleted file]
src/test/compile-fail/E0424.rs [deleted file]
src/test/compile-fail/E0425.rs [deleted file]
src/test/compile-fail/E0426.rs [deleted file]
src/test/compile-fail/E0428.rs [deleted file]
src/test/compile-fail/E0429.rs [deleted file]
src/test/compile-fail/E0430.rs [deleted file]
src/test/compile-fail/E0431.rs [deleted file]
src/test/compile-fail/E0432.rs [deleted file]
src/test/compile-fail/E0433.rs [deleted file]
src/test/compile-fail/E0434.rs [deleted file]
src/test/compile-fail/E0435.rs [deleted file]
src/test/compile-fail/E0437.rs [deleted file]
src/test/compile-fail/E0438.rs [deleted file]
src/test/compile-fail/E0439.rs [deleted file]
src/test/compile-fail/E0440.rs [deleted file]
src/test/compile-fail/E0441.rs [deleted file]
src/test/compile-fail/E0442.rs [deleted file]
src/test/compile-fail/E0443.rs [deleted file]
src/test/compile-fail/E0444.rs [deleted file]
src/test/compile-fail/E0445.rs [deleted file]
src/test/compile-fail/E0446.rs [deleted file]
src/test/compile-fail/E0449.rs [deleted file]
src/test/compile-fail/E0451.rs [deleted file]
src/test/compile-fail/E0452.rs [deleted file]
src/test/compile-fail/E0453.rs [deleted file]
src/test/compile-fail/E0454.rs [deleted file]
src/test/compile-fail/E0458.rs [deleted file]
src/test/compile-fail/E0459.rs [deleted file]
src/test/compile-fail/E0463.rs [deleted file]
src/test/compile-fail/E0478.rs [deleted file]
src/test/compile-fail/E0492.rs [deleted file]
src/test/compile-fail/E0494.rs [deleted file]
src/test/compile-fail/E0496.rs [deleted file]
src/test/compile-fail/E0499.rs [deleted file]
src/test/compile-fail/E0502.rs [deleted file]
src/test/compile-fail/E0503.rs [deleted file]
src/test/compile-fail/E0504.rs [deleted file]
src/test/compile-fail/E0505.rs [deleted file]
src/test/compile-fail/E0507.rs [deleted file]
src/test/compile-fail/E0509.rs [deleted file]
src/test/compile-fail/E0511.rs [deleted file]
src/test/compile-fail/E0512.rs [deleted file]
src/test/compile-fail/E0516.rs [deleted file]
src/test/compile-fail/E0517.rs [deleted file]
src/test/compile-fail/E0518.rs [deleted file]
src/test/compile-fail/E0520.rs [deleted file]
src/test/compile-fail/E0522.rs [deleted file]
src/test/compile-fail/E0527.rs [deleted file]
src/test/compile-fail/E0528.rs [deleted file]
src/test/compile-fail/E0529.rs [deleted file]
src/test/compile-fail/E0530.rs [deleted file]
src/test/compile-fail/E0532.rs [deleted file]
src/test/compile-fail/E0534.rs [deleted file]
src/test/compile-fail/E0558.rs [deleted file]
src/test/compile-fail/E0559.rs [deleted file]
src/test/compile-fail/E0560.rs [deleted file]
src/test/compile-fail/E0565-1.rs [deleted file]
src/test/compile-fail/E0565.rs [deleted file]
src/test/compile-fail/E0572.rs [deleted file]
src/test/compile-fail/E0582.rs [deleted file]
src/test/compile-fail/E0585.rs [deleted file]
src/test/compile-fail/E0586.rs [deleted file]
src/test/compile-fail/E0597.rs [deleted file]
src/test/compile-fail/E0599.rs [deleted file]
src/test/compile-fail/E0600.rs [deleted file]
src/test/compile-fail/E0602.rs [deleted file]
src/test/compile-fail/E0603.rs [deleted file]
src/test/compile-fail/E0604.rs [deleted file]
src/test/compile-fail/E0605.rs [deleted file]
src/test/compile-fail/E0606.rs [deleted file]
src/test/compile-fail/E0607.rs [deleted file]
src/test/compile-fail/E0608.rs [deleted file]
src/test/compile-fail/E0609.rs [deleted file]
src/test/compile-fail/E0610.rs [deleted file]
src/test/compile-fail/E0611.rs [deleted file]
src/test/compile-fail/E0612.rs [deleted file]
src/test/compile-fail/E0614.rs [deleted file]
src/test/compile-fail/E0615.rs [deleted file]
src/test/compile-fail/E0616.rs [deleted file]
src/test/compile-fail/E0617.rs [deleted file]
src/test/compile-fail/E0618.rs [deleted file]
src/test/compile-fail/E0619.rs [deleted file]
src/test/compile-fail/E0620.rs [deleted file]
src/test/compile-fail/E0621-does-not-trigger-for-closures.rs [deleted file]
src/test/compile-fail/E0622.rs [deleted file]
src/test/compile-fail/E0624.rs [deleted file]
src/test/compile-fail/E0637.rs [deleted file]
src/test/compile-fail/E0657.rs [deleted file]
src/test/compile-fail/E0658.rs [deleted file]
src/test/compile-fail/E0659.rs [deleted file]
src/test/compile-fail/borrowck/borrowck-move-out-from-array.rs [new file with mode: 0644]
src/test/compile-fail/issue-39388.rs
src/test/compile-fail/macro-at-most-once-rep-ambig.rs [new file with mode: 0644]
src/test/compile-fail/specialization/defaultimpl/specialization-default-projection.rs [deleted file]
src/test/compile-fail/specialization/defaultimpl/specialization-default-types.rs [deleted file]
src/test/compile-fail/specialization/defaultimpl/specialization-trait-item-not-implemented.rs [new file with mode: 0644]
src/test/compile-fail/specialization/defaultimpl/specialization-trait-not-implemented.rs [new file with mode: 0644]
src/test/compile-fail/specialization/defaultimpl/specialization-wfcheck.rs [new file with mode: 0644]
src/test/mir-opt/uniform_array_move_out.rs [new file with mode: 0644]
src/test/parse-fail/issue-33569.rs
src/test/run-pass-fulldeps/auxiliary/procedural_mbe_matching.rs
src/test/run-pass/cast-does-fallback.rs [new file with mode: 0644]
src/test/run-pass/dynamic-drop.rs
src/test/run-pass/issue-47703-1.rs [new file with mode: 0644]
src/test/run-pass/issue-47703.rs [new file with mode: 0644]
src/test/run-pass/macro-at-most-once-rep.rs [new file with mode: 0644]
src/test/run-pass/specialization/defaultimpl/assoc-fns.rs [deleted file]
src/test/run-pass/specialization/defaultimpl/auxiliary/cross_crate.rs [deleted file]
src/test/run-pass/specialization/defaultimpl/auxiliary/cross_crate_defaults.rs [deleted file]
src/test/run-pass/specialization/defaultimpl/basics-unsafe.rs [deleted file]
src/test/run-pass/specialization/defaultimpl/basics.rs [deleted file]
src/test/run-pass/specialization/defaultimpl/cross-crate-defaults.rs [deleted file]
src/test/run-pass/specialization/defaultimpl/cross-crate-no-gate.rs [deleted file]
src/test/run-pass/specialization/defaultimpl/cross-crate.rs [deleted file]
src/test/run-pass/specialization/defaultimpl/default-methods.rs [deleted file]
src/test/run-pass/specialization/defaultimpl/projection-alias.rs [deleted file]
src/test/run-pass/specialization/defaultimpl/specialization-trait-item-not-implemented.rs [new file with mode: 0644]
src/test/rustdoc/playground.rs
src/test/ui/cast_char.rs [new file with mode: 0644]
src/test/ui/cast_char.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0001.rs [new file with mode: 0644]
src/test/ui/error-codes/E0001.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0004-2.rs [new file with mode: 0644]
src/test/ui/error-codes/E0004-2.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0004.rs [new file with mode: 0644]
src/test/ui/error-codes/E0004.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0005.rs [new file with mode: 0644]
src/test/ui/error-codes/E0005.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0007.rs [new file with mode: 0644]
src/test/ui/error-codes/E0007.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0008.rs [new file with mode: 0644]
src/test/ui/error-codes/E0008.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0009.rs [new file with mode: 0644]
src/test/ui/error-codes/E0009.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0010-teach.rs [new file with mode: 0644]
src/test/ui/error-codes/E0010-teach.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0010.rs [new file with mode: 0644]
src/test/ui/error-codes/E0010.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0017.rs [new file with mode: 0644]
src/test/ui/error-codes/E0017.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0023.rs [new file with mode: 0644]
src/test/ui/error-codes/E0023.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0025.rs [new file with mode: 0644]
src/test/ui/error-codes/E0025.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0026-teach.rs [new file with mode: 0644]
src/test/ui/error-codes/E0026-teach.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0026.rs [new file with mode: 0644]
src/test/ui/error-codes/E0026.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0027-teach.rs [new file with mode: 0644]
src/test/ui/error-codes/E0027-teach.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0027.rs [new file with mode: 0644]
src/test/ui/error-codes/E0027.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0029-teach.rs [new file with mode: 0644]
src/test/ui/error-codes/E0029-teach.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0029.rs [new file with mode: 0644]
src/test/ui/error-codes/E0029.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0030-teach.rs [new file with mode: 0644]
src/test/ui/error-codes/E0030-teach.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0030.rs [new file with mode: 0644]
src/test/ui/error-codes/E0030.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0033-teach.rs [new file with mode: 0644]
src/test/ui/error-codes/E0033-teach.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0033.rs [new file with mode: 0644]
src/test/ui/error-codes/E0033.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0034.rs [new file with mode: 0644]
src/test/ui/error-codes/E0034.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0038.rs [new file with mode: 0644]
src/test/ui/error-codes/E0038.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0040.rs [new file with mode: 0644]
src/test/ui/error-codes/E0040.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0044.rs [new file with mode: 0644]
src/test/ui/error-codes/E0044.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0045.rs [new file with mode: 0644]
src/test/ui/error-codes/E0045.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0049.rs [new file with mode: 0644]
src/test/ui/error-codes/E0049.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0050.rs [new file with mode: 0644]
src/test/ui/error-codes/E0050.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0054.rs [new file with mode: 0644]
src/test/ui/error-codes/E0054.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0055.rs [new file with mode: 0644]
src/test/ui/error-codes/E0055.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0057.rs [new file with mode: 0644]
src/test/ui/error-codes/E0057.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0059.rs [new file with mode: 0644]
src/test/ui/error-codes/E0059.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0060.rs [new file with mode: 0644]
src/test/ui/error-codes/E0060.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0061.rs [new file with mode: 0644]
src/test/ui/error-codes/E0061.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0062.rs [new file with mode: 0644]
src/test/ui/error-codes/E0062.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0063.rs [new file with mode: 0644]
src/test/ui/error-codes/E0063.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0067.rs [new file with mode: 0644]
src/test/ui/error-codes/E0067.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0069.rs [new file with mode: 0644]
src/test/ui/error-codes/E0069.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0070.rs [new file with mode: 0644]
src/test/ui/error-codes/E0070.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0071.rs [new file with mode: 0644]
src/test/ui/error-codes/E0071.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0075.rs [new file with mode: 0644]
src/test/ui/error-codes/E0075.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0076.rs [new file with mode: 0644]
src/test/ui/error-codes/E0076.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0077.rs [new file with mode: 0644]
src/test/ui/error-codes/E0077.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0080.rs [new file with mode: 0644]
src/test/ui/error-codes/E0080.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0081.rs [new file with mode: 0644]
src/test/ui/error-codes/E0081.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0084.rs [new file with mode: 0644]
src/test/ui/error-codes/E0084.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0087.rs [new file with mode: 0644]
src/test/ui/error-codes/E0087.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0088.rs [new file with mode: 0644]
src/test/ui/error-codes/E0088.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0089.rs [new file with mode: 0644]
src/test/ui/error-codes/E0089.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0090.rs [new file with mode: 0644]
src/test/ui/error-codes/E0090.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0091.rs [new file with mode: 0644]
src/test/ui/error-codes/E0091.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0092.rs [new file with mode: 0644]
src/test/ui/error-codes/E0092.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0093.rs [new file with mode: 0644]
src/test/ui/error-codes/E0093.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0094.rs [new file with mode: 0644]
src/test/ui/error-codes/E0094.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0106.rs [new file with mode: 0644]
src/test/ui/error-codes/E0106.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0107.rs [new file with mode: 0644]
src/test/ui/error-codes/E0107.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0109.rs [new file with mode: 0644]
src/test/ui/error-codes/E0109.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0110.rs [new file with mode: 0644]
src/test/ui/error-codes/E0110.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0116.rs [new file with mode: 0644]
src/test/ui/error-codes/E0116.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0117.rs [new file with mode: 0644]
src/test/ui/error-codes/E0117.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0118.rs [new file with mode: 0644]
src/test/ui/error-codes/E0118.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0119.rs [new file with mode: 0644]
src/test/ui/error-codes/E0119.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0120.rs [new file with mode: 0644]
src/test/ui/error-codes/E0120.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0121.rs [new file with mode: 0644]
src/test/ui/error-codes/E0121.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0124.rs [new file with mode: 0644]
src/test/ui/error-codes/E0124.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0128.rs [new file with mode: 0644]
src/test/ui/error-codes/E0128.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0130.rs [new file with mode: 0644]
src/test/ui/error-codes/E0130.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0131.rs [new file with mode: 0644]
src/test/ui/error-codes/E0131.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0132.rs [new file with mode: 0644]
src/test/ui/error-codes/E0132.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0133.rs [new file with mode: 0644]
src/test/ui/error-codes/E0133.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0137.rs [new file with mode: 0644]
src/test/ui/error-codes/E0137.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0138.rs [new file with mode: 0644]
src/test/ui/error-codes/E0138.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0152.rs [new file with mode: 0644]
src/test/ui/error-codes/E0152.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0161.rs [new file with mode: 0644]
src/test/ui/error-codes/E0161.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0162.rs [new file with mode: 0644]
src/test/ui/error-codes/E0162.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0164.rs [new file with mode: 0644]
src/test/ui/error-codes/E0164.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0165.rs [new file with mode: 0644]
src/test/ui/error-codes/E0165.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0184.rs [new file with mode: 0644]
src/test/ui/error-codes/E0184.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0185.rs [new file with mode: 0644]
src/test/ui/error-codes/E0185.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0186.rs [new file with mode: 0644]
src/test/ui/error-codes/E0186.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0191.rs [new file with mode: 0644]
src/test/ui/error-codes/E0191.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0192.rs [new file with mode: 0644]
src/test/ui/error-codes/E0192.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0194.rs [new file with mode: 0644]
src/test/ui/error-codes/E0194.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0195.rs [new file with mode: 0644]
src/test/ui/error-codes/E0195.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0197.rs [new file with mode: 0644]
src/test/ui/error-codes/E0197.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0198.rs [new file with mode: 0644]
src/test/ui/error-codes/E0198.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0199.rs [new file with mode: 0644]
src/test/ui/error-codes/E0199.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0200.rs [new file with mode: 0644]
src/test/ui/error-codes/E0200.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0201.rs [new file with mode: 0644]
src/test/ui/error-codes/E0201.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0206.rs [new file with mode: 0644]
src/test/ui/error-codes/E0206.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0207.rs [new file with mode: 0644]
src/test/ui/error-codes/E0207.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0214.rs [new file with mode: 0644]
src/test/ui/error-codes/E0214.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0220.rs [new file with mode: 0644]
src/test/ui/error-codes/E0220.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0221.rs [new file with mode: 0644]
src/test/ui/error-codes/E0221.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0223.rs [new file with mode: 0644]
src/test/ui/error-codes/E0223.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0225.rs [new file with mode: 0644]
src/test/ui/error-codes/E0225.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0229.rs [new file with mode: 0644]
src/test/ui/error-codes/E0229.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0232.rs [new file with mode: 0644]
src/test/ui/error-codes/E0232.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0243.rs [new file with mode: 0644]
src/test/ui/error-codes/E0243.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0244.rs [new file with mode: 0644]
src/test/ui/error-codes/E0244.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0252.rs [new file with mode: 0644]
src/test/ui/error-codes/E0252.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0253.rs [new file with mode: 0644]
src/test/ui/error-codes/E0253.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0254.rs [new file with mode: 0644]
src/test/ui/error-codes/E0254.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0255.rs [new file with mode: 0644]
src/test/ui/error-codes/E0255.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0259.rs [new file with mode: 0644]
src/test/ui/error-codes/E0259.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0260.rs [new file with mode: 0644]
src/test/ui/error-codes/E0260.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0261.rs [new file with mode: 0644]
src/test/ui/error-codes/E0261.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0262.rs [new file with mode: 0644]
src/test/ui/error-codes/E0262.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0263.rs [new file with mode: 0644]
src/test/ui/error-codes/E0263.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0264.rs [new file with mode: 0644]
src/test/ui/error-codes/E0264.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0267.rs [new file with mode: 0644]
src/test/ui/error-codes/E0267.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0268.rs [new file with mode: 0644]
src/test/ui/error-codes/E0268.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0271.rs [new file with mode: 0644]
src/test/ui/error-codes/E0271.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0275.rs [new file with mode: 0644]
src/test/ui/error-codes/E0275.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0276.rs [new file with mode: 0644]
src/test/ui/error-codes/E0276.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0277-2.rs [new file with mode: 0644]
src/test/ui/error-codes/E0277-2.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0277.rs [new file with mode: 0644]
src/test/ui/error-codes/E0277.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0282.rs [new file with mode: 0644]
src/test/ui/error-codes/E0282.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0283.rs [new file with mode: 0644]
src/test/ui/error-codes/E0283.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0296.rs [new file with mode: 0644]
src/test/ui/error-codes/E0296.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0297.rs [new file with mode: 0644]
src/test/ui/error-codes/E0297.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0301.rs [new file with mode: 0644]
src/test/ui/error-codes/E0301.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0302.rs [new file with mode: 0644]
src/test/ui/error-codes/E0302.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0303.rs [new file with mode: 0644]
src/test/ui/error-codes/E0303.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0308-4.rs [new file with mode: 0644]
src/test/ui/error-codes/E0308-4.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0308.rs [new file with mode: 0644]
src/test/ui/error-codes/E0308.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0365.rs [new file with mode: 0644]
src/test/ui/error-codes/E0365.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0370.rs [new file with mode: 0644]
src/test/ui/error-codes/E0370.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0374.rs [new file with mode: 0644]
src/test/ui/error-codes/E0374.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0375.rs [new file with mode: 0644]
src/test/ui/error-codes/E0375.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0376.rs [new file with mode: 0644]
src/test/ui/error-codes/E0376.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0388.rs [new file with mode: 0644]
src/test/ui/error-codes/E0388.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0389.rs [new file with mode: 0644]
src/test/ui/error-codes/E0389.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0390.rs [new file with mode: 0644]
src/test/ui/error-codes/E0390.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0392.rs [new file with mode: 0644]
src/test/ui/error-codes/E0392.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0393.rs [new file with mode: 0644]
src/test/ui/error-codes/E0393.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0394.rs [new file with mode: 0644]
src/test/ui/error-codes/E0394.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0395.rs [new file with mode: 0644]
src/test/ui/error-codes/E0395.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0396.rs [new file with mode: 0644]
src/test/ui/error-codes/E0396.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0401.rs [new file with mode: 0644]
src/test/ui/error-codes/E0401.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0403.rs [new file with mode: 0644]
src/test/ui/error-codes/E0403.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0404.rs [new file with mode: 0644]
src/test/ui/error-codes/E0404.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0405.rs [new file with mode: 0644]
src/test/ui/error-codes/E0405.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0407.rs [new file with mode: 0644]
src/test/ui/error-codes/E0407.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0408.rs [new file with mode: 0644]
src/test/ui/error-codes/E0408.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0411.rs [new file with mode: 0644]
src/test/ui/error-codes/E0411.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0412.rs [new file with mode: 0644]
src/test/ui/error-codes/E0412.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0415.rs [new file with mode: 0644]
src/test/ui/error-codes/E0415.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0416.rs [new file with mode: 0644]
src/test/ui/error-codes/E0416.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0423.rs [new file with mode: 0644]
src/test/ui/error-codes/E0423.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0424.rs [new file with mode: 0644]
src/test/ui/error-codes/E0424.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0425.rs [new file with mode: 0644]
src/test/ui/error-codes/E0425.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0426.rs [new file with mode: 0644]
src/test/ui/error-codes/E0426.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0428.rs [new file with mode: 0644]
src/test/ui/error-codes/E0428.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0429.rs [new file with mode: 0644]
src/test/ui/error-codes/E0429.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0430.rs [new file with mode: 0644]
src/test/ui/error-codes/E0430.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0431.rs [new file with mode: 0644]
src/test/ui/error-codes/E0431.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0432.rs [new file with mode: 0644]
src/test/ui/error-codes/E0432.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0433.rs [new file with mode: 0644]
src/test/ui/error-codes/E0433.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0434.rs [new file with mode: 0644]
src/test/ui/error-codes/E0434.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0435.rs [new file with mode: 0644]
src/test/ui/error-codes/E0435.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0437.rs [new file with mode: 0644]
src/test/ui/error-codes/E0437.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0438.rs [new file with mode: 0644]
src/test/ui/error-codes/E0438.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0439.rs [new file with mode: 0644]
src/test/ui/error-codes/E0439.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0440.rs [new file with mode: 0644]
src/test/ui/error-codes/E0440.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0441.rs [new file with mode: 0644]
src/test/ui/error-codes/E0441.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0442.rs [new file with mode: 0644]
src/test/ui/error-codes/E0442.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0443.rs [new file with mode: 0644]
src/test/ui/error-codes/E0443.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0444.rs [new file with mode: 0644]
src/test/ui/error-codes/E0444.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0445.rs [new file with mode: 0644]
src/test/ui/error-codes/E0445.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0446.rs [new file with mode: 0644]
src/test/ui/error-codes/E0446.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0449.rs [new file with mode: 0644]
src/test/ui/error-codes/E0449.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0451.rs [new file with mode: 0644]
src/test/ui/error-codes/E0451.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0452.rs [new file with mode: 0644]
src/test/ui/error-codes/E0452.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0453.rs [new file with mode: 0644]
src/test/ui/error-codes/E0453.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0454.rs [new file with mode: 0644]
src/test/ui/error-codes/E0454.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0458.rs [new file with mode: 0644]
src/test/ui/error-codes/E0458.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0459.rs [new file with mode: 0644]
src/test/ui/error-codes/E0459.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0463.rs [new file with mode: 0644]
src/test/ui/error-codes/E0463.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0478.rs [new file with mode: 0644]
src/test/ui/error-codes/E0478.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0492.rs [new file with mode: 0644]
src/test/ui/error-codes/E0492.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0494.rs [new file with mode: 0644]
src/test/ui/error-codes/E0494.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0496.rs [new file with mode: 0644]
src/test/ui/error-codes/E0496.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0499.rs [new file with mode: 0644]
src/test/ui/error-codes/E0499.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0502.rs [new file with mode: 0644]
src/test/ui/error-codes/E0502.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0503.rs [new file with mode: 0644]
src/test/ui/error-codes/E0503.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0504.rs [new file with mode: 0644]
src/test/ui/error-codes/E0504.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0505.rs [new file with mode: 0644]
src/test/ui/error-codes/E0505.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0507.rs [new file with mode: 0644]
src/test/ui/error-codes/E0507.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0509.rs [new file with mode: 0644]
src/test/ui/error-codes/E0509.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0511.rs [new file with mode: 0644]
src/test/ui/error-codes/E0511.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0512.rs [new file with mode: 0644]
src/test/ui/error-codes/E0512.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0516.rs [new file with mode: 0644]
src/test/ui/error-codes/E0516.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0517.rs [new file with mode: 0644]
src/test/ui/error-codes/E0517.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0518.rs [new file with mode: 0644]
src/test/ui/error-codes/E0518.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0520.rs [new file with mode: 0644]
src/test/ui/error-codes/E0520.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0522.rs [new file with mode: 0644]
src/test/ui/error-codes/E0522.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0527.rs [new file with mode: 0644]
src/test/ui/error-codes/E0527.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0528.rs [new file with mode: 0644]
src/test/ui/error-codes/E0528.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0529.rs [new file with mode: 0644]
src/test/ui/error-codes/E0529.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0530.rs [new file with mode: 0644]
src/test/ui/error-codes/E0530.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0532.rs [new file with mode: 0644]
src/test/ui/error-codes/E0532.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0534.rs [new file with mode: 0644]
src/test/ui/error-codes/E0534.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0558.rs [new file with mode: 0644]
src/test/ui/error-codes/E0558.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0559.rs [new file with mode: 0644]
src/test/ui/error-codes/E0559.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0560.rs [new file with mode: 0644]
src/test/ui/error-codes/E0560.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0565-1.rs [new file with mode: 0644]
src/test/ui/error-codes/E0565-1.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0565.rs [new file with mode: 0644]
src/test/ui/error-codes/E0565.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0572.rs [new file with mode: 0644]
src/test/ui/error-codes/E0572.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0582.rs [new file with mode: 0644]
src/test/ui/error-codes/E0582.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0585.rs [new file with mode: 0644]
src/test/ui/error-codes/E0585.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0586.rs [new file with mode: 0644]
src/test/ui/error-codes/E0586.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0597.rs [new file with mode: 0644]
src/test/ui/error-codes/E0597.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0599.rs [new file with mode: 0644]
src/test/ui/error-codes/E0599.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0600.rs [new file with mode: 0644]
src/test/ui/error-codes/E0600.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0602.rs [new file with mode: 0644]
src/test/ui/error-codes/E0602.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0603.rs [new file with mode: 0644]
src/test/ui/error-codes/E0603.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0604.rs [new file with mode: 0644]
src/test/ui/error-codes/E0604.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0605.rs [new file with mode: 0644]
src/test/ui/error-codes/E0605.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0606.rs [new file with mode: 0644]
src/test/ui/error-codes/E0606.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0607.rs [new file with mode: 0644]
src/test/ui/error-codes/E0607.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0608.rs [new file with mode: 0644]
src/test/ui/error-codes/E0608.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0609.rs [new file with mode: 0644]
src/test/ui/error-codes/E0609.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0610.rs [new file with mode: 0644]
src/test/ui/error-codes/E0610.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0611.rs [new file with mode: 0644]
src/test/ui/error-codes/E0611.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0612.rs [new file with mode: 0644]
src/test/ui/error-codes/E0612.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0614.rs [new file with mode: 0644]
src/test/ui/error-codes/E0614.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0615.rs [new file with mode: 0644]
src/test/ui/error-codes/E0615.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0616.rs [new file with mode: 0644]
src/test/ui/error-codes/E0616.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0617.rs [new file with mode: 0644]
src/test/ui/error-codes/E0617.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0618.rs [new file with mode: 0644]
src/test/ui/error-codes/E0618.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0619.rs [new file with mode: 0644]
src/test/ui/error-codes/E0619.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0620.rs [new file with mode: 0644]
src/test/ui/error-codes/E0620.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0621-does-not-trigger-for-closures.rs [new file with mode: 0644]
src/test/ui/error-codes/E0621-does-not-trigger-for-closures.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0622.rs [new file with mode: 0644]
src/test/ui/error-codes/E0622.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0624.rs [new file with mode: 0644]
src/test/ui/error-codes/E0624.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0637.rs [new file with mode: 0644]
src/test/ui/error-codes/E0637.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0657.rs [new file with mode: 0644]
src/test/ui/error-codes/E0657.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0658.rs [new file with mode: 0644]
src/test/ui/error-codes/E0658.stderr [new file with mode: 0644]
src/test/ui/error-codes/E0659.rs [new file with mode: 0644]
src/test/ui/error-codes/E0659.stderr [new file with mode: 0644]
src/test/ui/feature-gate-macro_at_most_once_rep.rs [new file with mode: 0644]
src/test/ui/feature-gate-macro_at_most_once_rep.stderr [new file with mode: 0644]
src/test/ui/invalid-variadic-function.rs [new file with mode: 0644]
src/test/ui/invalid-variadic-function.stderr [new file with mode: 0644]
src/test/ui/recursive-requirements.rs [new file with mode: 0644]
src/test/ui/recursive-requirements.stderr [new file with mode: 0644]
src/tools/compiletest/src/read2.rs
src/tools/compiletest/src/runtest.rs
src/tools/rls
src/tools/tidy/src/deps.rs

index 1007aad925d965df1d1625d4388fa9d9de8deeb4..280da056995068fd58d6a8e1082f94f3d88be2f9 100644 (file)
@@ -56,7 +56,7 @@ matrix:
         NO_LLVM_ASSERTIONS=1
         NO_DEBUG_ASSERTIONS=1
       os: osx
-      osx_image: xcode8.3
+      osx_image: xcode9.2
       if: branch = auto
 
     - env: >
@@ -70,7 +70,7 @@ matrix:
         NO_LLVM_ASSERTIONS=1
         NO_DEBUG_ASSERTIONS=1
       os: osx
-      osx_image: xcode8.3
+      osx_image: xcode9.2
       if: branch = auto
 
     # OSX builders producing releases. These do not run the full test suite and
index d6f95f52075d2bdfbbbe88732b7faea45d4bd5fa..7a9d256be282f6db5704a3746e834f0eb49b3551 100644 (file)
@@ -78,6 +78,7 @@ Compatibility Notes
 - [`column!()` macro is one-based instead of zero-based][46977]
 - [`fmt::Arguments` can no longer be shared across threads][45198]
 - [Access to `#[repr(packed)]` struct fields is now unsafe][44884]
+- [Cargo sets a different working directory for the compiler][cargo/4788]
 
 [44884]: https://github.com/rust-lang/rust/pull/44884
 [45198]: https://github.com/rust-lang/rust/pull/45198
@@ -106,6 +107,7 @@ Compatibility Notes
 [47080]: https://github.com/rust-lang/rust/pull/47080
 [47084]: https://github.com/rust-lang/rust/pull/47084
 [cargo/4743]: https://github.com/rust-lang/cargo/pull/4743
+[cargo/4788]: https://github.com/rust-lang/cargo/pull/4788
 [cargo/4817]: https://github.com/rust-lang/cargo/pull/4817
 [`RefCell::replace`]: https://doc.rust-lang.org/std/cell/struct.RefCell.html#method.replace
 [`RefCell::swap`]: https://doc.rust-lang.org/std/cell/struct.RefCell.html#method.swap
index 6b722db53ed3a743b523464297bfe0a3a462cd2f..4b3099eed016b48716c5a2d97f46347ecec9d168 100644 (file)
@@ -328,6 +328,26 @@ dependencies = [
  "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "clippy_lints"
+version = "0.0.186"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "if_chain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "itertools 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pulldown-cmark 0.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
+ "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
 [[package]]
 name = "cmake"
 version = "0.1.29"
@@ -1003,7 +1023,7 @@ dependencies = [
 
 [[package]]
 name = "languageserver-types"
-version = "0.27.0"
+version = "0.30.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1640,17 +1660,20 @@ name = "rls"
 version = "0.125.0"
 dependencies = [
  "cargo 0.26.0",
+ "clippy_lints 0.0.186 (registry+https://github.com/rust-lang/crates.io-index)",
  "env_logger 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "json 0.11.12 (registry+https://github.com/rust-lang/crates.io-index)",
  "jsonrpc-core 8.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "languageserver-types 0.27.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "languageserver-types 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "racer 2.0.12 (registry+https://github.com/rust-lang/crates.io-index)",
  "rayon 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rls-analysis 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rls-data 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rls-analysis 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rls-blacklist 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rls-data 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rls-rustc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rls-vfs 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1663,27 +1686,21 @@ dependencies = [
 
 [[package]]
 name = "rls-analysis"
-version = "0.10.0"
+version = "0.11.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "derive-new 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
  "radix_trie 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "rls-data 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rls-data 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
-name = "rls-data"
-version = "0.14.0"
+name = "rls-blacklist"
+version = "0.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
-]
 
 [[package]]
 name = "rls-data"
@@ -1692,6 +1709,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -2986,6 +3005,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"
 "checksum chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7c20ebe0b2b08b0aeddba49c609fe7957ba2e33449882cb186a180bc60682fa9"
 "checksum clap 2.29.0 (registry+https://github.com/rust-lang/crates.io-index)" = "110d43e343eb29f4f51c1db31beb879d546db27998577e5715270a54bcf41d3f"
+"checksum clippy_lints 0.0.186 (registry+https://github.com/rust-lang/crates.io-index)" = "a3864104a4e6092e644b985dd7543e5f24e99aa7262f5ee400bcb17cfeec1bf5"
 "checksum cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "56d741ea7a69e577f6d06b36b7dff4738f680593dc27a701ffa8506b73ce28bb"
 "checksum coco 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c06169f5beb7e31c7c67ebf5540b8b472d23e3eade3b2ec7d1f5b504a85f91bd"
 "checksum commoncrypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d056a8586ba25a1e4d61cb090900e495952c7886786fc55f909ab2f819b69007"
@@ -3050,7 +3070,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum jsonrpc-core 8.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ddf83704f4e79979a424d1082dd2c1e52683058056c9280efa19ac5f6bc9033c"
 "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
 "checksum kuchiki 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e03098e8e719c92b7794515dfd5c1724e2b12f5ce1788e61cfa4663f82eba8d8"
-"checksum languageserver-types 0.27.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a2036fc8576a22689b7e3171c07eb8e8f700678d7a8a53f6f65abbeb35261e1"
+"checksum languageserver-types 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1541f9b22687f060511d213036e1f058797c48e3501e177f01cb6e88de802f5b"
 "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
 "checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d"
 "checksum lazycell 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3b585b7a6811fb03aa10e74b278a0f00f8dd9b45dc681f148bb29fa5cb61859b"
@@ -3114,8 +3134,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum regex 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "744554e01ccbd98fff8c457c3b092cd67af62a555a43bfe97ae8a0451f7799fa"
 "checksum regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957"
 "checksum regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8e931c58b93d86f080c734bfd2bce7dd0079ae2331235818133c8be7f422e20e"
-"checksum rls-analysis 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "38841e3c5271715a574ac220d9b408b59ed9e2626909c3bc54b5853b4eaadb7b"
-"checksum rls-data 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8024f1feaca72d0aa4ae1e2a8d454a31b9a33ed02f8d0e9c8559bf53c267ec3c"
+"checksum rls-analysis 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "30b08808959205a5cf23c68ace2d9d6defdd6867f3cd5d62981cf50fb52f8882"
+"checksum rls-blacklist 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "56fb7b8e4850b988fbcf277fbdb1eff36879070d02fc1ca243b559273866973d"
 "checksum rls-data 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bea04462e94b5512a78499837eecb7db182ff082144cd1b4bc32ef5d43de6510"
 "checksum rls-rustc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "85cfb9dde19e313da3e47738008f8a472e470cc42d910b71595a9238494701f2"
 "checksum rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d7c7046dc6a92f2ae02ed302746db4382e75131b9ce20ce967259f6b5867a6a"
index 74dd4a6fa01442672ed0955a6d7933da4a35d2b3..66a1c97246200d5c68a94817625929bdac17d22a 100644 (file)
@@ -95,7 +95,7 @@ pub struct RunConfig<'a> {
     pub builder: &'a Builder<'a>,
     pub host: Interned<String>,
     pub target: Interned<String>,
-    pub path: Option<&'a Path>,
+    pub path: PathBuf,
 }
 
 struct StepDescription {
@@ -105,6 +105,32 @@ struct StepDescription {
     only_build: bool,
     should_run: fn(ShouldRun) -> ShouldRun,
     make_run: fn(RunConfig),
+    name: &'static str,
+}
+
+#[derive(Debug, Clone, PartialOrd, Ord, PartialEq, Eq)]
+struct PathSet {
+    set: BTreeSet<PathBuf>,
+}
+
+impl PathSet {
+    fn empty() -> PathSet {
+        PathSet { set: BTreeSet::new() }
+    }
+
+    fn one<P: Into<PathBuf>>(path: P) -> PathSet {
+        let mut set = BTreeSet::new();
+        set.insert(path.into());
+        PathSet { set }
+    }
+
+    fn has(&self, needle: &Path) -> bool {
+        self.set.iter().any(|p| p.ends_with(needle))
+    }
+
+    fn path(&self, builder: &Builder) -> PathBuf {
+        self.set.iter().next().unwrap_or(&builder.build.src).to_path_buf()
+    }
 }
 
 impl StepDescription {
@@ -116,10 +142,18 @@ fn from<S: Step>() -> StepDescription {
             only_build: S::ONLY_BUILD,
             should_run: S::should_run,
             make_run: S::make_run,
+            name: unsafe { ::std::intrinsics::type_name::<S>() },
         }
     }
 
-    fn maybe_run(&self, builder: &Builder, path: Option<&Path>) {
+    fn maybe_run(&self, builder: &Builder, pathset: &PathSet) {
+        if builder.config.exclude.iter().any(|e| pathset.has(e)) {
+            eprintln!("Skipping {:?} because it is excluded", pathset);
+            return;
+        } else if !builder.config.exclude.is_empty() {
+            eprintln!("{:?} not skipped for {:?} -- not in {:?}", pathset,
+                self.name, builder.config.exclude);
+        }
         let build = builder.build;
         let hosts = if self.only_build_targets || self.only_build {
             build.build_triple()
@@ -144,7 +178,7 @@ fn maybe_run(&self, builder: &Builder, path: Option<&Path>) {
             for target in targets {
                 let run = RunConfig {
                     builder,
-                    path,
+                    path: pathset.path(builder),
                     host: *host,
                     target: *target,
                 };
@@ -157,24 +191,33 @@ fn run(v: &[StepDescription], builder: &Builder, paths: &[PathBuf]) {
         let should_runs = v.iter().map(|desc| {
             (desc.should_run)(ShouldRun::new(builder))
         }).collect::<Vec<_>>();
+
+        // sanity checks on rules
+        for (desc, should_run) in v.iter().zip(&should_runs) {
+            assert!(!should_run.paths.is_empty(),
+                "{:?} should have at least one pathset", desc.name);
+        }
+
         if paths.is_empty() {
             for (desc, should_run) in v.iter().zip(should_runs) {
                 if desc.default && should_run.is_really_default {
-                    desc.maybe_run(builder, None);
+                    for pathset in &should_run.paths {
+                        desc.maybe_run(builder, pathset);
+                    }
                 }
             }
         } else {
             for path in paths {
                 let mut attempted_run = false;
                 for (desc, should_run) in v.iter().zip(&should_runs) {
-                    if should_run.run(path) {
+                    if let Some(pathset) = should_run.pathset_for_path(path) {
                         attempted_run = true;
-                        desc.maybe_run(builder, Some(path));
+                        desc.maybe_run(builder, pathset);
                     }
                 }
 
                 if !attempted_run {
-                    eprintln!("Warning: no rules matched {}.", path.display());
+                    panic!("Error: no rules matched {}.", path.display());
                 }
             }
         }
@@ -185,7 +228,7 @@ fn run(v: &[StepDescription], builder: &Builder, paths: &[PathBuf]) {
 pub struct ShouldRun<'a> {
     pub builder: &'a Builder<'a>,
     // use a BTreeSet to maintain sort order
-    paths: BTreeSet<PathBuf>,
+    paths: BTreeSet<PathSet>,
 
     // If this is a default rule, this is an additional constraint placed on
     // it's run. Generally something like compiler docs being enabled.
@@ -206,25 +249,46 @@ pub fn default_condition(mut self, cond: bool) -> Self {
         self
     }
 
+    // Unlike `krate` this will create just one pathset. As such, it probably shouldn't actually
+    // ever be used, but as we transition to having all rules properly handle passing krate(...) by
+    // actually doing something different for every crate passed.
+    pub fn all_krates(mut self, name: &str) -> Self {
+        let mut set = BTreeSet::new();
+        for krate in self.builder.in_tree_crates(name) {
+            set.insert(PathBuf::from(&krate.path));
+        }
+        self.paths.insert(PathSet { set });
+        self
+    }
+
     pub fn krate(mut self, name: &str) -> Self {
-        for (_, krate_path) in self.builder.crates(name) {
-            self.paths.insert(PathBuf::from(krate_path));
+        for krate in self.builder.in_tree_crates(name) {
+            self.paths.insert(PathSet::one(&krate.path));
         }
         self
     }
 
-    pub fn path(mut self, path: &str) -> Self {
-        self.paths.insert(PathBuf::from(path));
+    // single, non-aliased path
+    pub fn path(self, path: &str) -> Self {
+        self.paths(&[path])
+    }
+
+    // multiple aliases for the same job
+    pub fn paths(mut self, paths: &[&str]) -> Self {
+        self.paths.insert(PathSet {
+            set: paths.iter().map(PathBuf::from).collect(),
+        });
         self
     }
 
     // allows being more explicit about why should_run in Step returns the value passed to it
-    pub fn never(self) -> ShouldRun<'a> {
+    pub fn never(mut self) -> ShouldRun<'a> {
+        self.paths.insert(PathSet::empty());
         self
     }
 
-    fn run(&self, path: &Path) -> bool {
-        self.paths.iter().any(|p| path.ends_with(p))
+    fn pathset_for_path(&self, path: &Path) -> Option<&PathSet> {
+        self.paths.iter().find(|pathset| pathset.has(path))
     }
 }
 
@@ -254,19 +318,23 @@ macro_rules! describe {
                 tool::RustInstaller, tool::Cargo, tool::Rls, tool::Rustdoc, tool::Clippy,
                 native::Llvm, tool::Rustfmt, tool::Miri),
             Kind::Check => describe!(check::Std, check::Test, check::Rustc),
-            Kind::Test => describe!(test::Tidy, test::Bootstrap, test::DefaultCompiletest,
-                test::HostCompiletest, test::Crate, test::CrateLibrustc, test::Rustdoc,
-                test::Linkcheck, test::Cargotest, test::Cargo, test::Rls, test::Docs,
-                test::ErrorIndex, test::Distcheck, test::Rustfmt, test::Miri, test::Clippy,
-                test::RustdocJS, test::RustdocTheme),
+            Kind::Test => describe!(test::Tidy, test::Bootstrap, test::Ui, test::RunPass,
+                test::CompileFail, test::ParseFail, test::RunFail, test::RunPassValgrind,
+                test::MirOpt, test::Codegen, test::CodegenUnits, test::Incremental, test::Debuginfo,
+                test::UiFullDeps, test::RunPassFullDeps, test::RunFailFullDeps,
+                test::CompileFailFullDeps, test::IncrementalFullDeps, test::Rustdoc, test::Pretty,
+                test::RunPassPretty, test::RunFailPretty, test::RunPassValgrindPretty,
+                test::RunPassFullDepsPretty, test::RunFailFullDepsPretty, test::RunMake,
+                test::Crate, test::CrateLibrustc, test::Rustdoc, test::Linkcheck, test::Cargotest,
+                test::Cargo, test::Rls, test::Docs, test::ErrorIndex, test::Distcheck,
+                test::Rustfmt, test::Miri, test::Clippy, test::RustdocJS, test::RustdocTheme),
             Kind::Bench => describe!(test::Crate, test::CrateLibrustc),
             Kind::Doc => describe!(doc::UnstableBook, doc::UnstableBookGen, doc::TheBook,
                 doc::Standalone, doc::Std, doc::Test, doc::Rustc, doc::ErrorIndex, doc::Nomicon,
                 doc::Reference, doc::Rustdoc, doc::RustByExample, doc::CargoBook),
             Kind::Dist => describe!(dist::Docs, dist::Mingw, dist::Rustc, dist::DebuggerScripts,
                 dist::Std, dist::Analysis, dist::Src, dist::PlainSourceTarball, dist::Cargo,
-                dist::Rls, dist::Rustfmt, dist::Extended, dist::HashSign,
-                dist::DontDistWithMiriEnabled),
+                dist::Rls, dist::Rustfmt, dist::Extended, dist::HashSign),
             Kind::Install => describe!(install::Docs, install::Std, install::Cargo, install::Rls,
                 install::Rustfmt, install::Analysis, install::Src, install::Rustc),
         }
@@ -297,8 +365,10 @@ pub fn get_help(build: &Build, subcommand: &str) -> Option<String> {
             should_run = (desc.should_run)(should_run);
         }
         let mut help = String::from("Available paths:\n");
-        for path in should_run.paths {
-            help.push_str(format!("    ./x.py {} {}\n", subcommand, path.display()).as_str());
+        for pathset in should_run.paths {
+            for path in pathset.set {
+                help.push_str(format!("    ./x.py {} {}\n", subcommand, path.display()).as_str());
+            }
         }
         Some(help)
     }
@@ -315,6 +385,12 @@ pub fn run(build: &Build) {
             Subcommand::Clean { .. } => panic!(),
         };
 
+        if let Some(path) = paths.get(0) {
+            if path == Path::new("nonexistent/path/to/trigger/cargo/metadata") {
+                return;
+            }
+        }
+
         let builder = Builder {
             build,
             top_stage: build.config.stage.unwrap_or(2),
@@ -323,6 +399,12 @@ pub fn run(build: &Build) {
             stack: RefCell::new(Vec::new()),
         };
 
+        if kind == Kind::Dist {
+            assert!(!build.config.test_miri, "Do not distribute with miri enabled.\n\
+                The distributed libraries would include all MIR (increasing binary size).
+                The distributed MIR would include validation statements.");
+        }
+
         StepDescription::run(&Builder::get_step_descriptions(builder.kind), &builder, paths);
     }
 
@@ -600,25 +682,9 @@ pub fn cargo(&self,
         //
         // FIXME: the guard against msvc shouldn't need to be here
         if !target.contains("msvc") {
-            let ccache = self.config.ccache.as_ref();
-            let ccacheify = |s: &Path| {
-                let ccache = match ccache {
-                    Some(ref s) => s,
-                    None => return s.display().to_string(),
-                };
-                // FIXME: the cc-rs crate only recognizes the literal strings
-                // `ccache` and `sccache` when doing caching compilations, so we
-                // mirror that here. It should probably be fixed upstream to
-                // accept a new env var or otherwise work with custom ccache
-                // vars.
-                match &ccache[..] {
-                    "ccache" | "sccache" => format!("{} {}", ccache, s.display()),
-                    _ => s.display().to_string(),
-                }
-            };
-            let cc = ccacheify(&self.cc(target));
-            cargo.env(format!("CC_{}", target), &cc)
-                 .env("CC", &cc);
+            let cc = self.cc(target);
+            cargo.env(format!("CC_{}", target), cc)
+                 .env("CC", cc);
 
             let cflags = self.cflags(target).join(" ");
             cargo.env(format!("CFLAGS_{}", target), cflags.clone())
@@ -633,9 +699,8 @@ pub fn cargo(&self,
             }
 
             if let Ok(cxx) = self.cxx(target) {
-                let cxx = ccacheify(&cxx);
-                cargo.env(format!("CXX_{}", target), &cxx)
-                     .env("CXX", &cxx)
+                cargo.env(format!("CXX_{}", target), cxx)
+                     .env("CXX", cxx)
                      .env(format!("CXXFLAGS_{}", target), cflags.clone())
                      .env("CXXFLAGS", cflags);
             }
index ede403491d7fcea4bc12ac3b38226c10b7c7623b..767ee4016c6f1d6df08505e8f323b6f9a61a167c 100644 (file)
@@ -26,7 +26,7 @@ impl Step for Std {
     const DEFAULT: bool = true;
 
     fn should_run(run: ShouldRun) -> ShouldRun {
-        run.path("src/libstd").krate("std")
+        run.all_krates("std")
     }
 
     fn make_run(run: RunConfig) {
@@ -67,7 +67,7 @@ impl Step for Rustc {
     const DEFAULT: bool = true;
 
     fn should_run(run: ShouldRun) -> ShouldRun {
-        run.path("src/librustc").krate("rustc-main")
+        run.all_krates("rustc-main")
     }
 
     fn make_run(run: RunConfig) {
@@ -114,7 +114,7 @@ impl Step for Test {
     const DEFAULT: bool = true;
 
     fn should_run(run: ShouldRun) -> ShouldRun {
-        run.path("src/libtest").krate("test")
+        run.all_krates("test")
     }
 
     fn make_run(run: RunConfig) {
index 1d5e11c5d6d41c06f55d088a82b6be93914928e1..2dcc0e0e7cd9f0110a583a93ad1450cb7ca3d08a 100644 (file)
@@ -48,7 +48,7 @@ impl Step for Std {
     const DEFAULT: bool = true;
 
     fn should_run(run: ShouldRun) -> ShouldRun {
-        run.path("src/libstd").krate("std")
+        run.all_krates("std")
     }
 
     fn make_run(run: RunConfig) {
@@ -320,7 +320,7 @@ impl Step for Test {
     const DEFAULT: bool = true;
 
     fn should_run(run: ShouldRun) -> ShouldRun {
-        run.path("src/libtest").krate("test")
+        run.all_krates("test")
     }
 
     fn make_run(run: RunConfig) {
@@ -436,7 +436,7 @@ impl Step for Rustc {
     const DEFAULT: bool = true;
 
     fn should_run(run: ShouldRun) -> ShouldRun {
-        run.path("src/librustc").krate("rustc-main")
+        run.all_krates("rustc-main")
     }
 
     fn make_run(run: RunConfig) {
@@ -593,7 +593,7 @@ impl Step for CodegenBackend {
     const DEFAULT: bool = true;
 
     fn should_run(run: ShouldRun) -> ShouldRun {
-        run.path("src/librustc_trans")
+        run.all_krates("rustc_trans")
     }
 
     fn make_run(run: RunConfig) {
@@ -828,7 +828,7 @@ impl Step for Assemble {
     type Output = Compiler;
 
     fn should_run(run: ShouldRun) -> ShouldRun {
-        run.path("src/rustc")
+        run.all_krates("rustc-main")
     }
 
     /// Prepare a new compiler from the artifacts in `stage`
index 4f4fd14ae8cabcc8c1c64635b35214b690c727a3..812ca6d64fb6a792545749b84857175a6c36db92 100644 (file)
@@ -56,6 +56,7 @@ pub struct Config {
     pub sanitizers: bool,
     pub profiler: bool,
     pub ignore_git: bool,
+    pub exclude: Vec<PathBuf>,
 
     pub run_host_only: bool,
 
@@ -311,6 +312,7 @@ pub fn parse(args: &[String]) -> Config {
         let flags = Flags::parse(&args);
         let file = flags.config.clone();
         let mut config = Config::default();
+        config.exclude = flags.exclude;
         config.llvm_enabled = true;
         config.llvm_optimize = true;
         config.llvm_version_check = true;
index 460fb016f16ea82880527704c4af40f8261b4308..e7aed7eb4fead3de97f477fc3339542e0a9f7d59 100644 (file)
@@ -1233,31 +1233,6 @@ fn run(self, builder: &Builder) -> Option<PathBuf> {
     }
 }
 
-
-#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
-pub struct DontDistWithMiriEnabled;
-
-impl Step for DontDistWithMiriEnabled {
-    type Output = PathBuf;
-    const DEFAULT: bool = true;
-
-    fn should_run(run: ShouldRun) -> ShouldRun {
-        let build_miri = run.builder.build.config.test_miri;
-        run.default_condition(build_miri)
-    }
-
-    fn make_run(run: RunConfig) {
-        run.builder.ensure(DontDistWithMiriEnabled);
-    }
-
-    fn run(self, _: &Builder) -> PathBuf {
-        panic!("Do not distribute with miri enabled.\n\
-                The distributed libraries would include all MIR (increasing binary size).
-                The distributed MIR would include validation statements.");
-    }
-}
-
-
 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
 pub struct Extended {
     stage: u32,
index 6a75fc5112f5c2d07043aaf0063cbc0744d3415e..55d9723527e6db26ac617f8fe77ea9acbcfc1fcf 100644 (file)
@@ -429,7 +429,7 @@ impl Step for Std {
 
     fn should_run(run: ShouldRun) -> ShouldRun {
         let builder = run.builder;
-        run.krate("std").default_condition(builder.build.config.docs)
+        run.all_krates("std").default_condition(builder.build.config.docs)
     }
 
     fn make_run(run: RunConfig) {
index 478e496078add23a5b85842e820ecf78b41335c0..42b949527e09dda2bec9818903aa65bd974fb795 100644 (file)
@@ -42,6 +42,7 @@ pub struct Flags {
     pub jobs: Option<u32>,
     pub cmd: Subcommand,
     pub incremental: bool,
+    pub exclude: Vec<PathBuf>,
 }
 
 pub enum Subcommand {
@@ -109,6 +110,7 @@ pub fn parse(args: &[String]) -> Flags {
         opts.optopt("", "build", "build target of the stage0 compiler", "BUILD");
         opts.optmulti("", "host", "host targets to build", "HOST");
         opts.optmulti("", "target", "target targets to build", "TARGET");
+        opts.optmulti("", "exclude", "build paths to exclude", "PATH");
         opts.optopt("", "on-fail", "command to run on failure", "CMD");
         opts.optopt("", "stage", "stage to build", "N");
         opts.optopt("", "keep-stage", "stage to keep without recompiling", "N");
@@ -273,7 +275,10 @@ pub fn parse(args: &[String]) -> Flags {
         };
         // Get any optional paths which occur after the subcommand
         let cwd = t!(env::current_dir());
-        let paths = matches.free[1..].iter().map(|p| cwd.join(p)).collect::<Vec<_>>();
+        let src = matches.opt_str("src").map(PathBuf::from)
+            .or_else(|| env::var_os("SRC").map(PathBuf::from))
+            .unwrap_or(cwd.clone());
+        let paths = matches.free[1..].iter().map(|p| p.into()).collect::<Vec<PathBuf>>();
 
         let cfg_file = matches.opt_str("config").map(PathBuf::from).or_else(|| {
             if fs::metadata("config.toml").is_ok() {
@@ -358,11 +363,6 @@ pub fn parse(args: &[String]) -> Flags {
             stage = Some(1);
         }
 
-        let cwd = t!(env::current_dir());
-        let src = matches.opt_str("src").map(PathBuf::from)
-            .or_else(|| env::var_os("SRC").map(PathBuf::from))
-            .unwrap_or(cwd);
-
         Flags {
             verbose: matches.opt_count("verbose"),
             stage,
@@ -374,10 +374,12 @@ pub fn parse(args: &[String]) -> Flags {
             target: split(matches.opt_strs("target"))
                 .into_iter().map(|x| INTERNER.intern_string(x)).collect::<Vec<_>>(),
             config: cfg_file,
-            src,
             jobs: matches.opt_str("jobs").map(|j| j.parse().unwrap()),
             cmd,
             incremental: matches.opt_present("incremental"),
+            exclude: split(matches.opt_strs("exclude"))
+                .into_iter().map(|p| p.into()).collect::<Vec<_>>(),
+            src,
         }
     }
 }
index 83c270865c0b75cc0c55c36488aef06fbc501d34..afd740ce5484549f32ee7735514162726f3ed671 100644 (file)
 //! More documentation can be found in each respective module below, and you can
 //! also check out the `src/bootstrap/README.md` file for more information.
 
-#![deny(warnings)]
-#![allow(stable_features)]
-#![feature(associated_consts)]
+//#![deny(warnings)]
+#![feature(core_intrinsics)]
 
 #[macro_use]
 extern crate build_helper;
@@ -267,6 +266,18 @@ struct Crate {
     bench_step: String,
 }
 
+impl Crate {
+    fn is_local(&self, build: &Build) -> bool {
+        self.path.starts_with(&build.config.src) &&
+        !self.path.to_string_lossy().ends_with("_shim")
+    }
+
+    fn local_path(&self, build: &Build) -> PathBuf {
+        assert!(self.is_local(build));
+        self.path.strip_prefix(&build.config.src).unwrap().into()
+    }
+}
+
 /// The various "modes" of invoking Cargo.
 ///
 /// These entries currently correspond to the various output directories of the
@@ -949,22 +960,18 @@ pub fn save_toolstate(&self, tool: &str, state: ToolState) {
         }
     }
 
-    /// Get a list of crates from a root crate.
-    ///
-    /// Returns Vec<(crate, path to crate, is_root_crate)>
-    fn crates(&self, root: &str) -> Vec<(Interned<String>, &Path)> {
-        let interned = INTERNER.intern_string(root.to_owned());
+    fn in_tree_crates(&self, root: &str) -> Vec<&Crate> {
         let mut ret = Vec::new();
-        let mut list = vec![interned];
+        let mut list = vec![INTERNER.intern_str(root)];
         let mut visited = HashSet::new();
         while let Some(krate) = list.pop() {
             let krate = &self.crates[&krate];
-            // If we can't strip prefix, then out-of-tree path
-            let path = krate.path.strip_prefix(&self.src).unwrap_or(&krate.path);
-            ret.push((krate.name, path));
-            for dep in &krate.deps {
-                if visited.insert(dep) && dep != "build_helper" {
-                    list.push(*dep);
+            if krate.is_local(self) {
+                ret.push(krate);
+                for dep in &krate.deps {
+                    if visited.insert(dep) && dep != "build_helper" {
+                        list.push(*dep);
+                    }
                 }
             }
         }
index 2ea026244034f742a2f4ec871346c0ddb6d9b34e..29cd23bdbb1978398043dd06b45a9d94502b26f1 100644 (file)
@@ -51,9 +51,7 @@ fn should_run(run: ShouldRun) -> ShouldRun {
     }
 
     fn make_run(run: RunConfig) {
-        let emscripten = run.path.map(|p| {
-            p.ends_with("llvm-emscripten")
-        }).unwrap_or(false);
+        let emscripten = run.path.ends_with("llvm-emscripten");
         run.builder.ensure(Llvm {
             target: run.target,
             emscripten,
@@ -159,6 +157,14 @@ fn run(self, builder: &Builder) -> PathBuf {
            .define("LLVM_TARGET_ARCH", target.split('-').next().unwrap())
            .define("LLVM_DEFAULT_TARGET_TRIPLE", target);
 
+        // By default, LLVM will automatically find OCaml and, if it finds it,
+        // install the LLVM bindings in LLVM_OCAML_INSTALL_PATH, which defaults
+        // to /usr/bin/ocaml.
+        // This causes problem for non-root builds of Rust. Side-step the issue
+        // by setting LLVM_OCAML_INSTALL_PATH to a relative path, so it installs
+        // in the prefix.
+        cfg.define("LLVM_OCAML_INSTALL_PATH",
+            env::var_os("LLVM_OCAML_INSTALL_PATH").unwrap_or_else(|| "usr/lib/ocaml".into()));
 
         // This setting makes the LLVM tools link to the dynamic LLVM library,
         // which saves both memory during parallel links and overall disk space
index f6b95f0bf97441200d1dd7b46155704d6e2b1bf2..64ede4f4ecc885f071969a6f516db5eb63a6a10d 100644 (file)
@@ -13,7 +13,6 @@
 //! This file implements the various regression test suites that we execute on
 //! our CI.
 
-use std::collections::HashSet;
 use std::env;
 use std::ffi::OsString;
 use std::iter;
@@ -26,6 +25,7 @@
 use build_helper::{self, output};
 
 use builder::{Kind, RunConfig, ShouldRun, Builder, Compiler, Step};
+use Crate as CargoCrate;
 use cache::{INTERNER, Interned};
 use compile;
 use dist;
@@ -550,181 +550,214 @@ fn testdir(build: &Build, host: Interned<String>) -> PathBuf {
     build.out.join(host).join("test")
 }
 
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-struct Test {
-    path: &'static str,
-    mode: &'static str,
-    suite: &'static str,
+macro_rules! default_test {
+    ($name:ident { path: $path:expr, mode: $mode:expr, suite: $suite:expr }) => {
+        test!($name { path: $path, mode: $mode, suite: $suite, default: true, host: false });
+    }
 }
 
-static DEFAULT_COMPILETESTS: &[Test] = &[
-    Test { path: "src/test/ui", mode: "ui", suite: "ui" },
-    Test { path: "src/test/run-pass", mode: "run-pass", suite: "run-pass" },
-    Test { path: "src/test/compile-fail", mode: "compile-fail", suite: "compile-fail" },
-    Test { path: "src/test/parse-fail", mode: "parse-fail", suite: "parse-fail" },
-    Test { path: "src/test/run-fail", mode: "run-fail", suite: "run-fail" },
-    Test {
-        path: "src/test/run-pass-valgrind",
-        mode: "run-pass-valgrind",
-        suite: "run-pass-valgrind"
-    },
-    Test { path: "src/test/mir-opt", mode: "mir-opt", suite: "mir-opt" },
-    Test { path: "src/test/codegen", mode: "codegen", suite: "codegen" },
-    Test { path: "src/test/codegen-units", mode: "codegen-units", suite: "codegen-units" },
-    Test { path: "src/test/incremental", mode: "incremental", suite: "incremental" },
-
-    // What this runs varies depending on the native platform being apple
-    Test { path: "src/test/debuginfo", mode: "debuginfo-XXX", suite: "debuginfo" },
-];
-
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub struct DefaultCompiletest {
-    compiler: Compiler,
-    target: Interned<String>,
-    mode: &'static str,
-    suite: &'static str,
+macro_rules! host_test {
+    ($name:ident { path: $path:expr, mode: $mode:expr, suite: $suite:expr }) => {
+        test!($name { path: $path, mode: $mode, suite: $suite, default: true, host: true });
+    }
 }
 
-impl Step for DefaultCompiletest {
-    type Output = ();
-    const DEFAULT: bool = true;
-
-    fn should_run(mut run: ShouldRun) -> ShouldRun {
-        for test in DEFAULT_COMPILETESTS {
-            run = run.path(test.path);
+macro_rules! test {
+    ($name:ident {
+        path: $path:expr,
+        mode: $mode:expr,
+        suite: $suite:expr,
+        default: $default:expr,
+        host: $host:expr
+    }) => {
+        #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+        pub struct $name {
+            pub compiler: Compiler,
+            pub target: Interned<String>,
         }
-        run
-    }
 
-    fn make_run(run: RunConfig) {
-        let compiler = run.builder.compiler(run.builder.top_stage, run.host);
+        impl Step for $name {
+            type Output = ();
+            const DEFAULT: bool = $default;
+            const ONLY_HOSTS: bool = $host;
 
-        let test = run.path.map(|path| {
-            DEFAULT_COMPILETESTS.iter().find(|&&test| {
-                path.ends_with(test.path)
-            }).unwrap_or_else(|| {
-                panic!("make_run in compile test to receive test path, received {:?}", path);
-            })
-        });
-
-        if let Some(test) = test {
-            run.builder.ensure(DefaultCompiletest {
-                compiler,
-                target: run.target,
-                mode: test.mode,
-                suite: test.suite,
-            });
-        } else {
-            for test in DEFAULT_COMPILETESTS {
-                run.builder.ensure(DefaultCompiletest {
-                    compiler,
-                    target: run.target,
-                    mode: test.mode,
-                    suite: test.suite
-                });
+            fn should_run(run: ShouldRun) -> ShouldRun {
+                run.path($path)
             }
-        }
-    }
-
-    fn run(self, builder: &Builder) {
-        builder.ensure(Compiletest {
-            compiler: self.compiler,
-            target: self.target,
-            mode: self.mode,
-            suite: self.suite,
-        })
-    }
-}
-
-// Also default, but host-only.
-static HOST_COMPILETESTS: &[Test] = &[
-    Test { path: "src/test/ui-fulldeps", mode: "ui", suite: "ui-fulldeps" },
-    Test { path: "src/test/run-pass-fulldeps", mode: "run-pass", suite: "run-pass-fulldeps" },
-    Test { path: "src/test/run-fail-fulldeps", mode: "run-fail", suite: "run-fail-fulldeps" },
-    Test {
-        path: "src/test/compile-fail-fulldeps",
-        mode: "compile-fail",
-        suite: "compile-fail-fulldeps",
-    },
-    Test {
-        path: "src/test/incremental-fulldeps",
-        mode: "incremental",
-        suite: "incremental-fulldeps",
-    },
-    Test { path: "src/test/rustdoc", mode: "rustdoc", suite: "rustdoc" },
-
-    Test { path: "src/test/pretty", mode: "pretty", suite: "pretty" },
-    Test { path: "src/test/run-pass/pretty", mode: "pretty", suite: "run-pass" },
-    Test { path: "src/test/run-fail/pretty", mode: "pretty", suite: "run-fail" },
-    Test { path: "src/test/run-pass-valgrind/pretty", mode: "pretty", suite: "run-pass-valgrind" },
-    Test { path: "src/test/run-pass-fulldeps/pretty", mode: "pretty", suite: "run-pass-fulldeps" },
-    Test { path: "src/test/run-fail-fulldeps/pretty", mode: "pretty", suite: "run-fail-fulldeps" },
-    Test { path: "src/test/run-make", mode: "run-make", suite: "run-make" },
-];
 
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub struct HostCompiletest {
-    compiler: Compiler,
-    target: Interned<String>,
-    mode: &'static str,
-    suite: &'static str,
-}
+            fn make_run(run: RunConfig) {
+                let compiler = run.builder.compiler(run.builder.top_stage, run.host);
 
-impl Step for HostCompiletest {
-    type Output = ();
-    const DEFAULT: bool = true;
-    const ONLY_HOSTS: bool = true;
-
-    fn should_run(mut run: ShouldRun) -> ShouldRun {
-        for test in HOST_COMPILETESTS {
-            run = run.path(test.path);
-        }
-        run
-    }
-
-    fn make_run(run: RunConfig) {
-        let compiler = run.builder.compiler(run.builder.top_stage, run.host);
-
-        let test = run.path.map(|path| {
-            HOST_COMPILETESTS.iter().find(|&&test| {
-                path.ends_with(test.path)
-            }).unwrap_or_else(|| {
-                panic!("make_run in compile test to receive test path, received {:?}", path);
-            })
-        });
-
-        if let Some(test) = test {
-            run.builder.ensure(HostCompiletest {
-                compiler,
-                target: run.target,
-                mode: test.mode,
-                suite: test.suite,
-            });
-        } else {
-            for test in HOST_COMPILETESTS {
-                if test.mode == "pretty" {
-                    continue;
-                }
-                run.builder.ensure(HostCompiletest {
+                run.builder.ensure($name {
                     compiler,
                     target: run.target,
-                    mode: test.mode,
-                    suite: test.suite
                 });
             }
-        }
-    }
 
-    fn run(self, builder: &Builder) {
-        builder.ensure(Compiletest {
-            compiler: self.compiler,
-            target: self.target,
-            mode: self.mode,
-            suite: self.suite,
-        })
+            fn run(self, builder: &Builder) {
+                builder.ensure(Compiletest {
+                    compiler: self.compiler,
+                    target: self.target,
+                    mode: $mode,
+                    suite: $suite,
+                })
+            }
+        }
     }
 }
 
+default_test!(Ui {
+    path: "src/test/ui",
+    mode: "ui",
+    suite: "ui"
+});
+
+default_test!(RunPass {
+    path: "src/test/run-pass",
+    mode: "run-pass",
+    suite: "run-pass"
+});
+
+default_test!(CompileFail {
+    path: "src/test/compile-fail",
+    mode: "compile-fail",
+    suite: "compile-fail"
+});
+
+default_test!(ParseFail {
+    path: "src/test/parse-fail",
+    mode: "parse-fail",
+    suite: "parse-fail"
+});
+
+default_test!(RunFail {
+    path: "src/test/run-fail",
+    mode: "run-fail",
+    suite: "run-fail"
+});
+
+default_test!(RunPassValgrind {
+    path: "src/test/run-pass-valgrind",
+    mode: "run-pass-valgrind",
+    suite: "run-pass-valgrind"
+});
+
+default_test!(MirOpt {
+    path: "src/test/mir-opt",
+    mode: "mir-opt",
+    suite: "mir-opt"
+});
+
+default_test!(Codegen {
+    path: "src/test/codegen",
+    mode: "codegen",
+    suite: "codegen"
+});
+
+default_test!(CodegenUnits {
+    path: "src/test/codegen-units",
+    mode: "codegen-units",
+    suite: "codegen-units"
+});
+
+default_test!(Incremental {
+    path: "src/test/incremental",
+    mode: "incremental",
+    suite: "incremental"
+});
+
+default_test!(Debuginfo {
+    path: "src/test/debuginfo",
+    // What this runs varies depending on the native platform being apple
+    mode: "debuginfo-XXX",
+    suite: "debuginfo"
+});
+
+host_test!(UiFullDeps {
+    path: "src/test/ui-fulldeps",
+    mode: "ui",
+    suite: "ui-fulldeps"
+});
+
+host_test!(RunPassFullDeps {
+    path: "src/test/run-pass-fulldeps",
+    mode: "run-pass",
+    suite: "run-pass-fulldeps"
+});
+
+host_test!(RunFailFullDeps {
+    path: "src/test/run-fail-fulldeps",
+    mode: "run-fail",
+    suite: "run-fail-fulldeps"
+});
+
+host_test!(CompileFailFullDeps {
+    path: "src/test/compile-fail-fulldeps",
+    mode: "compile-fail",
+    suite: "compile-fail-fulldeps"
+});
+
+host_test!(IncrementalFullDeps {
+    path: "src/test/incremental-fulldeps",
+    mode: "incremental",
+    suite: "incremental-fulldeps"
+});
+
+host_test!(Rustdoc {
+    path: "src/test/rustdoc",
+    mode: "rustdoc",
+    suite: "rustdoc"
+});
+
+test!(Pretty {
+    path: "src/test/pretty",
+    mode: "pretty",
+    suite: "pretty",
+    default: false,
+    host: true
+});
+test!(RunPassPretty {
+    path: "src/test/run-pass/pretty",
+    mode: "pretty",
+    suite: "run-pass",
+    default: false,
+    host: true
+});
+test!(RunFailPretty {
+    path: "src/test/run-fail/pretty",
+    mode: "pretty",
+    suite: "run-fail",
+    default: false,
+    host: true
+});
+test!(RunPassValgrindPretty {
+    path: "src/test/run-pass-valgrind/pretty",
+    mode: "pretty",
+    suite: "run-pass-valgrind",
+    default: false,
+    host: true
+});
+test!(RunPassFullDepsPretty {
+    path: "src/test/run-pass-fulldeps/pretty",
+    mode: "pretty",
+    suite: "run-pass-fulldeps",
+    default: false,
+    host: true
+});
+test!(RunFailFullDepsPretty {
+    path: "src/test/run-fail-fulldeps/pretty",
+    mode: "pretty",
+    suite: "run-fail-fulldeps",
+    default: false,
+    host: true
+});
+
+host_test!(RunMake {
+    path: "src/test/run-make",
+    mode: "run-make",
+    suite: "run-make"
+});
+
 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
 struct Compiletest {
     compiler: Compiler,
@@ -902,7 +935,7 @@ fn run(self, builder: &Builder) {
             }
         }
         if suite == "run-make" && !build.config.llvm_enabled {
-            println!("Ignoring run-make test suite as they generally don't work without LLVM");
+            println!("Ignoring run-make test suite as they generally dont work without LLVM");
             return;
         }
 
@@ -1099,7 +1132,7 @@ pub struct CrateLibrustc {
     compiler: Compiler,
     target: Interned<String>,
     test_kind: TestKind,
-    krate: Option<Interned<String>>,
+    krate: Interned<String>,
 }
 
 impl Step for CrateLibrustc {
@@ -1115,35 +1148,26 @@ fn make_run(run: RunConfig) {
         let builder = run.builder;
         let compiler = builder.compiler(builder.top_stage, run.host);
 
-        let make = |name: Option<Interned<String>>| {
-            let test_kind = if builder.kind == Kind::Test {
-                TestKind::Test
-            } else if builder.kind == Kind::Bench {
-                TestKind::Bench
-            } else {
-                panic!("unexpected builder.kind in crate: {:?}", builder.kind);
-            };
-
-            builder.ensure(CrateLibrustc {
-                compiler,
-                target: run.target,
-                test_kind,
-                krate: name,
-            });
-        };
+        for krate in builder.in_tree_crates("rustc-main") {
+            if run.path.ends_with(&krate.path) {
+                let test_kind = if builder.kind == Kind::Test {
+                    TestKind::Test
+                } else if builder.kind == Kind::Bench {
+                    TestKind::Bench
+                } else {
+                    panic!("unexpected builder.kind in crate: {:?}", builder.kind);
+                };
 
-        if let Some(path) = run.path {
-            for (name, krate_path) in builder.crates("rustc-main") {
-                if path.ends_with(krate_path) {
-                    make(Some(name));
-                }
+                builder.ensure(CrateLibrustc {
+                    compiler,
+                    target: run.target,
+                    test_kind,
+                    krate: krate.name,
+                });
             }
-        } else {
-            make(None);
         }
     }
 
-
     fn run(self, builder: &Builder) {
         builder.ensure(Crate {
             compiler: self.compiler,
@@ -1155,28 +1179,96 @@ fn run(self, builder: &Builder) {
     }
 }
 
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub struct CrateNotDefault {
+    compiler: Compiler,
+    target: Interned<String>,
+    test_kind: TestKind,
+    krate: &'static str,
+}
+
+impl Step for CrateNotDefault {
+    type Output = ();
+
+    fn should_run(run: ShouldRun) -> ShouldRun {
+        run.path("src/liballoc_jemalloc")
+            .path("src/librustc_asan")
+            .path("src/librustc_lsan")
+            .path("src/librustc_msan")
+            .path("src/librustc_tsan")
+    }
+
+    fn make_run(run: RunConfig) {
+        let builder = run.builder;
+        let compiler = builder.compiler(builder.top_stage, run.host);
+
+        let test_kind = if builder.kind == Kind::Test {
+            TestKind::Test
+        } else if builder.kind == Kind::Bench {
+            TestKind::Bench
+        } else {
+            panic!("unexpected builder.kind in crate: {:?}", builder.kind);
+        };
+
+        builder.ensure(CrateNotDefault {
+            compiler,
+            target: run.target,
+            test_kind,
+            krate: match run.path {
+                _ if run.path.ends_with("src/liballoc_jemalloc") => "alloc_jemalloc",
+                _ if run.path.ends_with("src/librustc_asan") => "rustc_asan",
+                _ if run.path.ends_with("src/librustc_lsan") => "rustc_lsan",
+                _ if run.path.ends_with("src/librustc_msan") => "rustc_msan",
+                _ if run.path.ends_with("src/librustc_tsan") => "rustc_tsan",
+                _ => panic!("unexpected path {:?}", run.path),
+            },
+        });
+    }
+
+    fn run(self, builder: &Builder) {
+        builder.ensure(Crate {
+            compiler: self.compiler,
+            target: self.target,
+            mode: Mode::Libstd,
+            test_kind: self.test_kind,
+            krate: INTERNER.intern_str(self.krate),
+        });
+    }
+}
+
+
 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
 pub struct Crate {
     compiler: Compiler,
     target: Interned<String>,
     mode: Mode,
     test_kind: TestKind,
-    krate: Option<Interned<String>>,
+    krate: Interned<String>,
 }
 
 impl Step for Crate {
     type Output = ();
     const DEFAULT: bool = true;
 
-    fn should_run(run: ShouldRun) -> ShouldRun {
-        run.krate("std").krate("test")
+    fn should_run(mut run: ShouldRun) -> ShouldRun {
+        let builder = run.builder;
+        run = run.krate("test");
+        for krate in run.builder.in_tree_crates("std") {
+            if krate.is_local(&run.builder) &&
+                !krate.name.contains("jemalloc") &&
+                !(krate.name.starts_with("rustc_") && krate.name.ends_with("san")) &&
+                krate.name != "dlmalloc" {
+                run = run.path(krate.local_path(&builder).to_str().unwrap());
+            }
+        }
+        run
     }
 
     fn make_run(run: RunConfig) {
         let builder = run.builder;
         let compiler = builder.compiler(builder.top_stage, run.host);
 
-        let make = |mode: Mode, name: Option<Interned<String>>| {
+        let make = |mode: Mode, krate: &CargoCrate| {
             let test_kind = if builder.kind == Kind::Test {
                 TestKind::Test
             } else if builder.kind == Kind::Bench {
@@ -1190,29 +1282,24 @@ fn make_run(run: RunConfig) {
                 target: run.target,
                 mode,
                 test_kind,
-                krate: name,
+                krate: krate.name,
             });
         };
 
-        if let Some(path) = run.path {
-            for (name, krate_path) in builder.crates("std") {
-                if path.ends_with(krate_path) {
-                    make(Mode::Libstd, Some(name));
-                }
+        for krate in builder.in_tree_crates("std") {
+            if run.path.ends_with(&krate.local_path(&builder)) {
+                make(Mode::Libstd, krate);
             }
-            for (name, krate_path) in builder.crates("test") {
-                if path.ends_with(krate_path) {
-                    make(Mode::Libtest, Some(name));
-                }
+        }
+        for krate in builder.in_tree_crates("test") {
+            if run.path.ends_with(&krate.local_path(&builder)) {
+                make(Mode::Libtest, krate);
             }
-        } else {
-            make(Mode::Libstd, None);
-            make(Mode::Libtest, None);
         }
     }
 
-    /// Run all unit tests plus documentation tests for an entire crate DAG defined
-    /// by a `Cargo.toml`
+    /// Run all unit tests plus documentation tests for a given crate defined
+    /// by a `Cargo.toml` (single manifest)
     ///
     /// This is what runs tests for crates like the standard library, compiler, etc.
     /// It essentially is the driver for running `cargo test`.
@@ -1241,27 +1328,23 @@ fn run(self, builder: &Builder) {
         };
 
         let mut cargo = builder.cargo(compiler, mode, target, test_kind.subcommand());
-        let (name, root) = match mode {
+        match mode {
             Mode::Libstd => {
                 compile::std_cargo(build, &compiler, target, &mut cargo);
-                ("libstd", "std")
             }
             Mode::Libtest => {
                 compile::test_cargo(build, &compiler, target, &mut cargo);
-                ("libtest", "test")
             }
             Mode::Librustc => {
                 builder.ensure(compile::Rustc { compiler, target });
                 compile::rustc_cargo(build, &mut cargo);
-                ("librustc", "rustc-main")
             }
             _ => panic!("can only test libraries"),
         };
-        let root = INTERNER.intern_string(String::from(root));
         let _folder = build.fold_output(|| {
-            format!("{}_stage{}-{}", test_kind.subcommand(), compiler.stage, name)
+            format!("{}_stage{}-{}", test_kind.subcommand(), compiler.stage, krate)
         });
-        println!("{} {} stage{} ({} -> {})", test_kind, name, compiler.stage,
+        println!("{} {} stage{} ({} -> {})", test_kind, krate, compiler.stage,
                 &compiler.host, target);
 
         // Build up the base `cargo test` command.
@@ -1273,37 +1356,7 @@ fn run(self, builder: &Builder) {
             cargo.arg("--no-fail-fast");
         }
 
-        match krate {
-            Some(krate) => {
-                cargo.arg("-p").arg(krate);
-            }
-            None => {
-                let mut visited = HashSet::new();
-                let mut next = vec![root];
-                while let Some(name) = next.pop() {
-                    // Right now jemalloc and the sanitizer crates are
-                    // target-specific crate in the sense that it's not present
-                    // on all platforms. Custom skip it here for now, but if we
-                    // add more this probably wants to get more generalized.
-                    //
-                    // Also skip `build_helper` as it's not compiled normally
-                    // for target during the bootstrap and it's just meant to be
-                    // a helper crate, not tested. If it leaks through then it
-                    // ends up messing with various mtime calculations and such.
-                    if !name.contains("jemalloc") &&
-                       *name != *"build_helper" &&
-                       !(name.starts_with("rustc_") && name.ends_with("san")) &&
-                       name != "dlmalloc" {
-                        cargo.arg("-p").arg(&format!("{}:0.0.0", name));
-                    }
-                    for dep in build.crates[&name].deps.iter() {
-                        if visited.insert(dep) {
-                            next.push(*dep);
-                        }
-                    }
-                }
-            }
-        }
+        cargo.arg("-p").arg(krate);
 
         // The tests are going to run with the *target* libraries, so we need to
         // ensure that those libraries show up in the LD_LIBRARY_PATH equivalent.
@@ -1355,18 +1408,18 @@ fn run(self, builder: &Builder) {
 }
 
 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub struct Rustdoc {
+pub struct CrateRustdoc {
     host: Interned<String>,
     test_kind: TestKind,
 }
 
-impl Step for Rustdoc {
+impl Step for CrateRustdoc {
     type Output = ();
     const DEFAULT: bool = true;
     const ONLY_HOSTS: bool = true;
 
     fn should_run(run: ShouldRun) -> ShouldRun {
-        run.path("src/librustdoc").path("src/tools/rustdoc")
+        run.paths(&["src/librustdoc", "src/tools/rustdoc"])
     }
 
     fn make_run(run: RunConfig) {
@@ -1380,7 +1433,7 @@ fn make_run(run: RunConfig) {
             panic!("unexpected builder.kind in crate: {:?}", builder.kind);
         };
 
-        builder.ensure(Rustdoc {
+        builder.ensure(CrateRustdoc {
             host: run.host,
             test_kind,
         });
diff --git a/src/doc/unstable-book/src/language-features/macro-at-most-once-rep.md b/src/doc/unstable-book/src/language-features/macro-at-most-once-rep.md
new file mode 100644 (file)
index 0000000..dbaf91b
--- /dev/null
@@ -0,0 +1,17 @@
+# `macro_at_most_once_rep`
+
+The tracking issue for this feature is: TODO(mark-i-m)
+
+With this feature gate enabled, one can use `?` as a Kleene operator meaning "0
+or 1 repetitions" in a macro definition. Previously only `+` and `*` were allowed.
+
+For example:
+```rust
+macro_rules! foo {
+    (something $(,)?) // `?` indicates `,` is "optional"...
+        => {}
+}
+```
+
+------------------------
+
index b26979c7f6d8c75863e8386f1d77447fb42b42c6..39a4d271bd6feb0481e95ee2472e5d52a9cc450b 100644 (file)
 ///
 /// If a `Vec` *has* allocated memory, then the memory it points to is on the heap
 /// (as defined by the allocator Rust is configured to use by default), and its
-/// pointer points to [`len`] initialized elements in order (what you would see
-/// if you coerced it to a slice), followed by [`capacity`]` - `[`len`]
-/// logically uninitialized elements.
+/// pointer points to [`len`] initialized, contiguous elements in order (what
+/// you would see if you coerced it to a slice), followed by [`capacity`]` -
+/// `[`len`] logically uninitialized, contiguous elements.
 ///
 /// `Vec` will never perform a "small optimization" where elements are actually
 /// stored on the stack for two reasons:
 /// not break, however: using `unsafe` code to write to the excess capacity,
 /// and then increasing the length to match, is always valid.
 ///
-/// `Vec` does not currently guarantee the order in which elements are dropped
-/// (the order has changed in the past, and may change again).
+/// `Vec` does not currently guarantee the order in which elements are dropped.
+/// The order has changed in the past and may change again.
 ///
 /// [`vec!`]: ../../std/macro.vec.html
 /// [`Index`]: ../../std/ops/trait.Index.html
@@ -805,22 +805,7 @@ pub fn remove(&mut self, index: usize) -> T {
     pub fn retain<F>(&mut self, mut f: F)
         where F: FnMut(&T) -> bool
     {
-        let len = self.len();
-        let mut del = 0;
-        {
-            let v = &mut **self;
-
-            for i in 0..len {
-                if !f(&v[i]) {
-                    del += 1;
-                } else if del > 0 {
-                    v.swap(i - del, i);
-                }
-            }
-        }
-        if del > 0 {
-            self.truncate(len - del);
-        }
+        self.drain_filter(|x| !f(x));
     }
 
     /// Removes all but the first of consecutive elements in the vector that resolve to the same
index 345447948f7a51eca970fa036cefd613d54a4f79..266ea0740a5bdd262a38bbd88fb55fc3d2a7a96e 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 345447948f7a51eca970fa036cefd613d54a4f79
+Subproject commit 266ea0740a5bdd262a38bbd88fb55fc3d2a7a96e
index 29b62c901f310822aa215be09d50002d99a3b5ef..1a2da83429af9ef160021d984ef5787cade8ae9f 100644 (file)
 
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use self::sources::{Repeat, repeat};
+#[unstable(feature = "iterator_repeat_with", issue = "48169")]
+pub use self::sources::{RepeatWith, repeat_with};
 #[stable(feature = "iter_empty", since = "1.2.0")]
 pub use self::sources::{Empty, empty};
 #[stable(feature = "iter_once", since = "1.2.0")]
@@ -593,15 +595,15 @@ impl<'a, I, T: 'a> FusedIterator for Cloned<I>
 {}
 
 #[doc(hidden)]
-default unsafe impl<'a, I, T: 'a> TrustedRandomAccess for Cloned<I>
+unsafe impl<'a, I, T: 'a> TrustedRandomAccess for Cloned<I>
     where I: TrustedRandomAccess<Item=&'a T>, T: Clone
 {
-    unsafe fn get_unchecked(&mut self, i: usize) -> Self::Item {
+    default unsafe fn get_unchecked(&mut self, i: usize) -> Self::Item {
         self.it.get_unchecked(i).clone()
     }
 
     #[inline]
-    fn may_have_side_effect() -> bool { true }
+    default fn may_have_side_effect() -> bool { true }
 }
 
 #[doc(hidden)]
index b05a893e66104dc9cf517a66fb0598e60f13143f..3e9d799c089486b95c78cb022f834d4f521379bb 100644 (file)
@@ -57,6 +57,12 @@ unsafe impl<A: Clone> TrustedLen for Repeat<A> {}
 ///
 /// [`take`]: trait.Iterator.html#method.take
 ///
+/// If the element type of the iterator you need does not implement `Clone`,
+/// or if you do not want to keep the repeated element in memory, you can
+/// instead use the [`repeat_with`] function.
+///
+/// [`repeat_with`]: fn.repeat_with.html
+///
 /// # Examples
 ///
 /// Basic usage:
@@ -99,6 +105,115 @@ pub fn repeat<T: Clone>(elt: T) -> Repeat<T> {
     Repeat{element: elt}
 }
 
+/// An iterator that repeats elements of type `A` endlessly by
+/// applying the provided closure `F: FnMut() -> A`.
+///
+/// This `struct` is created by the [`repeat_with`] function.
+/// See its documentation for more.
+///
+/// [`repeat_with`]: fn.repeat_with.html
+#[derive(Copy, Clone, Debug)]
+#[unstable(feature = "iterator_repeat_with", issue = "48169")]
+pub struct RepeatWith<F> {
+    repeater: F
+}
+
+#[unstable(feature = "iterator_repeat_with", issue = "48169")]
+impl<A, F: FnMut() -> A> Iterator for RepeatWith<F> {
+    type Item = A;
+
+    #[inline]
+    fn next(&mut self) -> Option<A> { Some((self.repeater)()) }
+
+    #[inline]
+    fn size_hint(&self) -> (usize, Option<usize>) { (usize::MAX, None) }
+}
+
+#[unstable(feature = "iterator_repeat_with", issue = "48169")]
+impl<A, F: FnMut() -> A> DoubleEndedIterator for RepeatWith<F> {
+    #[inline]
+    fn next_back(&mut self) -> Option<A> { self.next() }
+}
+
+#[unstable(feature = "fused", issue = "35602")]
+impl<A, F: FnMut() -> A> FusedIterator for RepeatWith<F> {}
+
+#[unstable(feature = "trusted_len", issue = "37572")]
+unsafe impl<A, F: FnMut() -> A> TrustedLen for RepeatWith<F> {}
+
+/// Creates a new iterator that repeats elements of type `A` endlessly by
+/// applying the provided closure, the repeater, `F: FnMut() -> A`.
+///
+/// The `repeat_with()` function calls the repeater over and over and over and
+/// over and over and 🔁.
+///
+/// Infinite iterators like `repeat_with()` are often used with adapters like
+/// [`take`], in order to make them finite.
+///
+/// [`take`]: trait.Iterator.html#method.take
+///
+/// If the element type of the iterator you need implements `Clone`, and
+/// it is OK to keep the source element in memory, you should instead use
+/// the [`repeat`] function.
+///
+/// [`repeat`]: fn.repeat.html
+///
+/// An iterator produced by `repeat_with()` is a `DoubleEndedIterator`.
+/// It is important to not that reversing `repeat_with(f)` will produce
+/// the exact same sequence as the non-reversed iterator. In other words,
+/// `repeat_with(f).rev().collect::<Vec<_>>()` is equivalent to
+/// `repeat_with(f).collect::<Vec<_>>()`.
+///
+/// # Examples
+///
+/// Basic usage:
+///
+/// ```
+/// #![feature(iterator_repeat_with)]
+///
+/// use std::iter;
+///
+/// // let's assume we have some value of a type that is not `Clone`
+/// // or which don't want to have in memory just yet because it is expensive:
+/// #[derive(PartialEq, Debug)]
+/// struct Expensive;
+///
+/// // a particular value forever:
+/// let mut things = iter::repeat_with(|| Expensive);
+///
+/// assert_eq!(Some(Expensive), things.next());
+/// assert_eq!(Some(Expensive), things.next());
+/// assert_eq!(Some(Expensive), things.next());
+/// assert_eq!(Some(Expensive), things.next());
+/// assert_eq!(Some(Expensive), things.next());
+/// ```
+///
+/// Using mutation and going finite:
+///
+/// ```rust
+/// #![feature(iterator_repeat_with)]
+///
+/// use std::iter;
+///
+/// // From the zeroth to the third power of two:
+/// let mut curr = 1;
+/// let mut pow2 = iter::repeat_with(|| { let tmp = curr; curr *= 2; tmp })
+///                     .take(4);
+///
+/// assert_eq!(Some(1), pow2.next());
+/// assert_eq!(Some(2), pow2.next());
+/// assert_eq!(Some(4), pow2.next());
+/// assert_eq!(Some(8), pow2.next());
+///
+/// // ... and now we're done
+/// assert_eq!(None, pow2.next());
+/// ```
+#[inline]
+#[unstable(feature = "iterator_repeat_with", issue = "48169")]
+pub fn repeat_with<A, F: FnMut() -> A>(repeater: F) -> RepeatWith<F> {
+    RepeatWith { repeater }
+}
+
 /// An iterator that yields nothing.
 ///
 /// This `struct` is created by the [`empty`] function. See its documentation for more.
index be4889f24877ced555dc55a7a85df01bd495b2ed..860742d9eab6047b3fc6ff0510401d33cfdda949 100644 (file)
@@ -706,7 +706,7 @@ fn len(&self) -> usize {
     /// ```
     /// #![feature(exact_size_is_empty)]
     ///
-    /// let mut one_element = 0..1;
+    /// let mut one_element = std::iter::once(0);
     /// assert!(!one_element.is_empty());
     ///
     /// assert_eq!(one_element.next(), Some(0));
index 59a296c2a762c5e5a25ac3d3e1bcb55e11722502..447e144bf0fd6083b43a7ec4f4a99284994d18da 100644 (file)
@@ -92,6 +92,7 @@
 #![feature(unwind_attributes)]
 #![feature(doc_spotlight)]
 #![feature(rustc_const_unstable)]
+#![feature(iterator_repeat_with)]
 
 #[prelude_import]
 #[allow(unused)]
index 3032fb2de33ada892163d31d5ebcb3ddc64998c3..98e0f71eb935679b9ca97b4aab715b7c534305e2 100644 (file)
@@ -63,9 +63,13 @@ impl<T: ?Sized> !Send for *mut T { }
 /// struct BarUse(Bar<[i32]>); // OK
 /// ```
 ///
-/// The one exception is the implicit `Self` type of a trait, which does not
-/// get an implicit `Sized` bound. This is because a `Sized` bound prevents
-/// the trait from being used to form a [trait object]:
+/// The one exception is the implicit `Self` type of a trait. A trait does not
+/// have an implicit `Sized` bound as this is incompatible with [trait object]s
+/// where, by definition, the trait needs to work with all possible implementors,
+/// and thus could be any size.
+///
+/// Although Rust will let you bind `Sized` to a trait, you won't
+/// be able to use it to form a trait object later:
 ///
 /// ```
 /// # #![allow(unused_variables)]
index 1fae88b9c7775aa341304aaf6ca67ccfb3c35e39..560dcf295b278154ad0b71b4ea8be21cf2a0319e 100644 (file)
@@ -96,132 +96,156 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 pub mod bignum;
 pub mod diy_float;
 
+macro_rules! doc_comment {
+    ($x:expr, $($tt:tt)*) => {
+        #[doc = $x]
+        $($tt)*
+    };
+}
+
 // `Int` + `SignedInt` implemented for signed integers
 macro_rules! int_impl {
-    ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr) => {
-        /// Returns the smallest value that can be represented by this integer type.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(i8::min_value(), -128);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub const fn min_value() -> Self {
-            !0 ^ ((!0 as $UnsignedT) >> 1) as Self
+    ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr, $Feature:expr,
+     $EndFeature:expr) => {
+        doc_comment! {
+            concat!("Returns the smallest value that can be represented by this integer type.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(", stringify!($SelfT), "::min_value(), ", stringify!($Min), ");",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub const fn min_value() -> Self {
+                !0 ^ ((!0 as $UnsignedT) >> 1) as Self
+            }
         }
 
-        /// Returns the largest value that can be represented by this integer type.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(i8::max_value(), 127);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub const fn max_value() -> Self {
-            !Self::min_value()
+        doc_comment! {
+            concat!("Returns the largest value that can be represented by this integer type.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(", stringify!($SelfT), "::max_value(), ", stringify!($Max), ");",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub const fn max_value() -> Self {
+                !Self::min_value()
+            }
         }
 
-        /// Converts a string slice in a given base to an integer.
-        ///
-        /// The string is expected to be an optional `+` or `-` sign
-        /// followed by digits.
-        /// Leading and trailing whitespace represent an error.
-        /// Digits are a subset of these characters, depending on `radix`:
-        ///
-        /// * `0-9`
-        /// * `a-z`
-        /// * `A-Z`
-        ///
-        /// # Panics
-        ///
-        /// This function panics if `radix` is not in the range from 2 to 36.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(i32::from_str_radix("A", 16), Ok(10));
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        pub fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError> {
-            from_str_radix(src, radix)
+        doc_comment! {
+            concat!("Converts a string slice in a given base to an integer.
+
+The string is expected to be an optional `+` or `-` sign followed by digits.
+Leading and trailing whitespace represent an error. Digits are a subset of these characters,
+depending on `radix`:
+
+ * `0-9`
+ * `a-z`
+ * `a-z`
+
+# Panics
+
+This function panics if `radix` is not in the range from 2 to 36.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(", stringify!($SelfT), "::from_str_radix(\"A\", 16), Ok(10));",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            pub fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError> {
+                from_str_radix(src, radix)
+            }
         }
 
-        /// Returns the number of ones in the binary representation of `self`.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// let n = -0b1000_0000i8;
-        ///
-        /// assert_eq!(n.count_ones(), 1);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn count_ones(self) -> u32 { (self as $UnsignedT).count_ones() }
+        doc_comment! {
+            concat!("Returns the number of ones in the binary representation of `self`.
 
-        /// Returns the number of zeros in the binary representation of `self`.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// let n = -0b1000_0000i8;
-        ///
-        /// assert_eq!(n.count_zeros(), 7);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn count_zeros(self) -> u32 {
-            (!self).count_ones()
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "let n = 0b100_0000", stringify!($SelfT), ";
+
+assert_eq!(n.count_ones(), 1);",
+$EndFeature, "
+```
+"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn count_ones(self) -> u32 { (self as $UnsignedT).count_ones() }
         }
 
-        /// Returns the number of leading zeros in the binary representation
-        /// of `self`.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// let n = -1i16;
-        ///
-        /// assert_eq!(n.leading_zeros(), 0);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn leading_zeros(self) -> u32 {
-            (self as $UnsignedT).leading_zeros()
+        doc_comment! {
+            concat!("Returns the number of zeros in the binary representation of `self`.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(", stringify!($SelfT), "::max_value().count_zeros(), 1);", $EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn count_zeros(self) -> u32 {
+                (!self).count_ones()
+            }
         }
 
-        /// Returns the number of trailing zeros in the binary representation
-        /// of `self`.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// let n = -4i8;
-        ///
-        /// assert_eq!(n.trailing_zeros(), 2);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn trailing_zeros(self) -> u32 {
-            (self as $UnsignedT).trailing_zeros()
+        doc_comment! {
+            concat!("Returns the number of leading zeros in the binary representation of `self`.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "let n = -1", stringify!($SelfT), ";
+
+assert_eq!(n.leading_zeros(), 0);",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn leading_zeros(self) -> u32 {
+                (self as $UnsignedT).leading_zeros()
+            }
+        }
+
+        doc_comment! {
+            concat!("Returns the number of trailing zeros in the binary representation of `self`.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "let n = -4", stringify!($SelfT), ";
+
+assert_eq!(n.trailing_zeros(), 2);",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn trailing_zeros(self) -> u32 {
+                (self as $UnsignedT).trailing_zeros()
+            }
         }
 
         /// Shifts the bits to the left by a specified amount, `n`,
@@ -231,6 +255,9 @@ pub fn trailing_zeros(self) -> u32 {
         ///
         /// # Examples
         ///
+        /// Please note that this example is shared between integer types.
+        /// Which explains why `i64` is used here.
+        ///
         /// Basic usage:
         ///
         /// ```
@@ -253,6 +280,9 @@ pub fn rotate_left(self, n: u32) -> Self {
         ///
         /// # Examples
         ///
+        /// Please note that this example is shared between integer types.
+        /// Which explains why `i64` is used here.
+        ///
         /// Basic usage:
         ///
         /// ```
@@ -271,6 +301,9 @@ pub fn rotate_right(self, n: u32) -> Self {
         ///
         /// # Examples
         ///
+        /// Please note that this example is shared between integer types.
+        /// Which explains why `i16` is used here.
+        ///
         /// Basic usage:
         ///
         /// ```
@@ -288,1515 +321,1679 @@ pub fn swap_bytes(self) -> Self {
             (self as $UnsignedT).swap_bytes() as Self
         }
 
-        /// Converts an integer from big endian to the target's endianness.
-        ///
-        /// On big endian this is a no-op. On little endian the bytes are
-        /// swapped.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// let n = 0x0123456789ABCDEFi64;
-        ///
-        /// if cfg!(target_endian = "big") {
-        ///     assert_eq!(i64::from_be(n), n)
-        /// } else {
-        ///     assert_eq!(i64::from_be(n), n.swap_bytes())
-        /// }
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn from_be(x: Self) -> Self {
-            if cfg!(target_endian = "big") { x } else { x.swap_bytes() }
-        }
+        doc_comment! {
+            concat!("Converts an integer from big endian to the target's endianness.
 
-        /// Converts an integer from little endian to the target's endianness.
-        ///
-        /// On little endian this is a no-op. On big endian the bytes are
-        /// swapped.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// let n = 0x0123456789ABCDEFi64;
-        ///
-        /// if cfg!(target_endian = "little") {
-        ///     assert_eq!(i64::from_le(n), n)
-        /// } else {
-        ///     assert_eq!(i64::from_le(n), n.swap_bytes())
-        /// }
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn from_le(x: Self) -> Self {
-            if cfg!(target_endian = "little") { x } else { x.swap_bytes() }
-        }
+On big endian this is a no-op. On little endian the bytes are swapped.
 
-        /// Converts `self` to big endian from the target's endianness.
-        ///
-        /// On big endian this is a no-op. On little endian the bytes are
-        /// swapped.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// let n = 0x0123456789ABCDEFi64;
-        ///
-        /// if cfg!(target_endian = "big") {
-        ///     assert_eq!(n.to_be(), n)
-        /// } else {
-        ///     assert_eq!(n.to_be(), n.swap_bytes())
-        /// }
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn to_be(self) -> Self { // or not to be?
-            if cfg!(target_endian = "big") { self } else { self.swap_bytes() }
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "let n = 0x1A", stringify!($SelfT), ";
+
+if cfg!(target_endian = \"big\") {
+    assert_eq!(", stringify!($SelfT), "::from_be(n), n)
+} else {
+    assert_eq!(", stringify!($SelfT), "::from_be(n), n.swap_bytes())
+}",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn from_be(x: Self) -> Self {
+                if cfg!(target_endian = "big") { x } else { x.swap_bytes() }
+            }
         }
 
-        /// Converts `self` to little endian from the target's endianness.
-        ///
-        /// On little endian this is a no-op. On big endian the bytes are
-        /// swapped.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// let n = 0x0123456789ABCDEFi64;
-        ///
-        /// if cfg!(target_endian = "little") {
-        ///     assert_eq!(n.to_le(), n)
-        /// } else {
-        ///     assert_eq!(n.to_le(), n.swap_bytes())
-        /// }
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn to_le(self) -> Self {
-            if cfg!(target_endian = "little") { self } else { self.swap_bytes() }
+        doc_comment! {
+            concat!("Converts an integer from little endian to the target's endianness.
+
+On little endian this is a no-op. On big endian the bytes are swapped.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "let n = 0x1A", stringify!($SelfT), ";
+
+if cfg!(target_endian = \"little\") {
+    assert_eq!(", stringify!($SelfT), "::from_le(n), n)
+} else {
+    assert_eq!(", stringify!($SelfT), "::from_le(n), n.swap_bytes())
+}",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn from_le(x: Self) -> Self {
+                if cfg!(target_endian = "little") { x } else { x.swap_bytes() }
+            }
         }
 
-        /// Checked integer addition. Computes `self + rhs`, returning `None`
-        /// if overflow occurred.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(7i16.checked_add(32760), Some(32767));
-        /// assert_eq!(8i16.checked_add(32760), None);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn checked_add(self, rhs: Self) -> Option<Self> {
-            let (a, b) = self.overflowing_add(rhs);
-            if b {None} else {Some(a)}
+        doc_comment! {
+            concat!("Converts `self` to big endian from the target's endianness.
+
+On big endian this is a no-op. On little endian the bytes are swapped.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "let n = 0x1A", stringify!($SelfT), ";
+
+if cfg!(target_endian = \"big\") {
+    assert_eq!(n.to_be(), n)
+} else {
+    assert_eq!(n.to_be(), n.swap_bytes())
+}",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn to_be(self) -> Self { // or not to be?
+                if cfg!(target_endian = "big") { self } else { self.swap_bytes() }
+            }
         }
 
-        /// Checked integer subtraction. Computes `self - rhs`, returning
-        /// `None` if overflow occurred.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!((-127i8).checked_sub(1), Some(-128));
-        /// assert_eq!((-128i8).checked_sub(1), None);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn checked_sub(self, rhs: Self) -> Option<Self> {
-            let (a, b) = self.overflowing_sub(rhs);
-            if b {None} else {Some(a)}
+        doc_comment! {
+            concat!("Converts `self` to little endian from the target's endianness.
+
+On little endian this is a no-op. On big endian the bytes are swapped.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "let n = 0x1A", stringify!($SelfT), ";
+
+if cfg!(target_endian = \"little\") {
+    assert_eq!(n.to_le(), n)
+} else {
+    assert_eq!(n.to_le(), n.swap_bytes())
+}",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn to_le(self) -> Self {
+                if cfg!(target_endian = "little") { self } else { self.swap_bytes() }
+            }
         }
 
-        /// Checked integer multiplication. Computes `self * rhs`, returning
-        /// `None` if overflow occurred.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(6i8.checked_mul(21), Some(126));
-        /// assert_eq!(6i8.checked_mul(22), None);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn checked_mul(self, rhs: Self) -> Option<Self> {
-            let (a, b) = self.overflowing_mul(rhs);
-            if b {None} else {Some(a)}
+        doc_comment! {
+            concat!("Checked integer addition. Computes `self + rhs`, returning `None`
+if overflow occurred.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!((", stringify!($SelfT),
+"::max_value() - 2).checked_add(1), Some(", stringify!($SelfT), "::max_value() - 1));
+assert_eq!((", stringify!($SelfT), "::max_value() - 2).checked_add(3), None);",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn checked_add(self, rhs: Self) -> Option<Self> {
+                let (a, b) = self.overflowing_add(rhs);
+                if b {None} else {Some(a)}
+            }
         }
 
-        /// Checked integer division. Computes `self / rhs`, returning `None`
-        /// if `rhs == 0` or the division results in overflow.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!((-127i8).checked_div(-1), Some(127));
-        /// assert_eq!((-128i8).checked_div(-1), None);
-        /// assert_eq!((1i8).checked_div(0), None);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn checked_div(self, rhs: Self) -> Option<Self> {
-            if rhs == 0 || (self == Self::min_value() && rhs == -1) {
-                None
-            } else {
-                Some(unsafe { intrinsics::unchecked_div(self, rhs) })
+        doc_comment! {
+            concat!("Checked integer subtraction. Computes `self - rhs`, returning `None` if
+overflow occurred.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!((", stringify!($SelfT),
+"::min_value() + 2).checked_sub(1), Some(", stringify!($SelfT), "::min_value() + 1));
+assert_eq!((", stringify!($SelfT), "::min_value() + 2).checked_sub(3), None);",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn checked_sub(self, rhs: Self) -> Option<Self> {
+                let (a, b) = self.overflowing_sub(rhs);
+                if b {None} else {Some(a)}
             }
         }
 
-        /// Checked integer remainder. Computes `self % rhs`, returning `None`
-        /// if `rhs == 0` or the division results in overflow.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// use std::i32;
-        ///
-        /// assert_eq!(5i32.checked_rem(2), Some(1));
-        /// assert_eq!(5i32.checked_rem(0), None);
-        /// assert_eq!(i32::MIN.checked_rem(-1), None);
-        /// ```
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        #[inline]
-        pub fn checked_rem(self, rhs: Self) -> Option<Self> {
-            if rhs == 0 || (self == Self::min_value() && rhs == -1) {
-                None
-            } else {
-                Some(unsafe { intrinsics::unchecked_rem(self, rhs) })
+        doc_comment! {
+            concat!("Checked integer multiplication. Computes `self * rhs`, returning `None` if
+overflow occurred.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(", stringify!($SelfT),
+"::max_value().checked_mul(1), Some(", stringify!($SelfT), "::max_value()));
+assert_eq!(", stringify!($SelfT), "::max_value().checked_mul(2), None);",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn checked_mul(self, rhs: Self) -> Option<Self> {
+                let (a, b) = self.overflowing_mul(rhs);
+                if b {None} else {Some(a)}
             }
         }
 
-        /// Checked negation. Computes `-self`, returning `None` if `self ==
-        /// MIN`.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// use std::i32;
-        ///
-        /// assert_eq!(5i32.checked_neg(), Some(-5));
-        /// assert_eq!(i32::MIN.checked_neg(), None);
-        /// ```
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        #[inline]
-        pub fn checked_neg(self) -> Option<Self> {
-            let (a, b) = self.overflowing_neg();
-            if b {None} else {Some(a)}
-        }
+        doc_comment! {
+            concat!("Checked integer division. Computes `self / rhs`, returning `None` if `rhs == 0`
+or the division results in overflow.
 
-        /// Checked shift left. Computes `self << rhs`, returning `None`
-        /// if `rhs` is larger than or equal to the number of bits in `self`.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(0x10i32.checked_shl(4), Some(0x100));
-        /// assert_eq!(0x10i32.checked_shl(33), None);
-        /// ```
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        #[inline]
-        pub fn checked_shl(self, rhs: u32) -> Option<Self> {
-            let (a, b) = self.overflowing_shl(rhs);
-            if b {None} else {Some(a)}
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!((", stringify!($SelfT),
+"::min_value() + 1).checked_div(-1), Some(", stringify!($Max), "));
+assert_eq!(", stringify!($SelfT), "::min_value().checked_div(-1), None);
+assert_eq!((1", stringify!($SelfT), ").checked_div(0), None);",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn checked_div(self, rhs: Self) -> Option<Self> {
+                if rhs == 0 || (self == Self::min_value() && rhs == -1) {
+                    None
+                } else {
+                    Some(unsafe { intrinsics::unchecked_div(self, rhs) })
+                }
+            }
         }
 
-        /// Checked shift right. Computes `self >> rhs`, returning `None`
-        /// if `rhs` is larger than or equal to the number of bits in `self`.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(0x10i32.checked_shr(4), Some(0x1));
-        /// assert_eq!(0x10i32.checked_shr(33), None);
-        /// ```
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        #[inline]
-        pub fn checked_shr(self, rhs: u32) -> Option<Self> {
-            let (a, b) = self.overflowing_shr(rhs);
-            if b {None} else {Some(a)}
+        doc_comment! {
+            concat!("Checked integer remainder. Computes `self % rhs`, returning `None` if
+`rhs == 0` or the division results in overflow.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "use std::", stringify!($SelfT), ";
+
+assert_eq!(5", stringify!($SelfT), ".checked_rem(2), Some(1));
+assert_eq!(5", stringify!($SelfT), ".checked_rem(0), None);
+assert_eq!(", stringify!($SelfT), "::MIN.checked_rem(-1), None);",
+$EndFeature, "
+```"),
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            #[inline]
+            pub fn checked_rem(self, rhs: Self) -> Option<Self> {
+                if rhs == 0 || (self == Self::min_value() && rhs == -1) {
+                    None
+                } else {
+                    Some(unsafe { intrinsics::unchecked_rem(self, rhs) })
+                }
+            }
         }
 
-        /// Checked absolute value. Computes `self.abs()`, returning `None` if
-        /// `self == MIN`.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// use std::i32;
-        ///
-        /// assert_eq!((-5i32).checked_abs(), Some(5));
-        /// assert_eq!(i32::MIN.checked_abs(), None);
-        /// ```
-        #[stable(feature = "no_panic_abs", since = "1.13.0")]
-        #[inline]
-        pub fn checked_abs(self) -> Option<Self> {
-            if self.is_negative() {
-                self.checked_neg()
-            } else {
-                Some(self)
+        doc_comment! {
+            concat!("Checked negation. Computes `-self`, returning `None` if `self == MIN`.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "use std::", stringify!($SelfT), ";
+
+assert_eq!(5", stringify!($SelfT), ".checked_neg(), Some(-5));
+assert_eq!(", stringify!($SelfT), "::MIN.checked_neg(), None);",
+$EndFeature, "
+```"),
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            #[inline]
+            pub fn checked_neg(self) -> Option<Self> {
+                let (a, b) = self.overflowing_neg();
+                if b {None} else {Some(a)}
             }
         }
 
-        /// Saturating integer addition. Computes `self + rhs`, saturating at
-        /// the numeric bounds instead of overflowing.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(100i8.saturating_add(1), 101);
-        /// assert_eq!(100i8.saturating_add(127), 127);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn saturating_add(self, rhs: Self) -> Self {
-            match self.checked_add(rhs) {
-                Some(x) => x,
-                None if rhs >= 0 => Self::max_value(),
-                None => Self::min_value(),
+        doc_comment! {
+            concat!("Checked shift left. Computes `self << rhs`, returning `None` if `rhs` is larger
+than or equal to the number of bits in `self`.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(0x1", stringify!($SelfT), ".checked_shl(4), Some(0x10));
+assert_eq!(0x1", stringify!($SelfT), ".checked_shl(129), None);",
+$EndFeature, "
+```"),
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            #[inline]
+            pub fn checked_shl(self, rhs: u32) -> Option<Self> {
+                let (a, b) = self.overflowing_shl(rhs);
+                if b {None} else {Some(a)}
             }
         }
 
-        /// Saturating integer subtraction. Computes `self - rhs`, saturating
-        /// at the numeric bounds instead of overflowing.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(100i8.saturating_sub(127), -27);
-        /// assert_eq!((-100i8).saturating_sub(127), -128);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn saturating_sub(self, rhs: Self) -> Self {
-            match self.checked_sub(rhs) {
-                Some(x) => x,
-                None if rhs >= 0 => Self::min_value(),
-                None => Self::max_value(),
+        doc_comment! {
+            concat!("Checked shift right. Computes `self >> rhs`, returning `None` if `rhs` is
+larger than or equal to the number of bits in `self`.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(0x10", stringify!($SelfT), ".checked_shr(4), Some(0x1));
+assert_eq!(0x10", stringify!($SelfT), ".checked_shr(128), None);",
+$EndFeature, "
+```"),
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            #[inline]
+            pub fn checked_shr(self, rhs: u32) -> Option<Self> {
+                let (a, b) = self.overflowing_shr(rhs);
+                if b {None} else {Some(a)}
             }
         }
 
-        /// Saturating integer multiplication. Computes `self * rhs`,
-        /// saturating at the numeric bounds instead of overflowing.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// use std::i32;
-        ///
-        /// assert_eq!(100i32.saturating_mul(127), 12700);
-        /// assert_eq!((1i32 << 23).saturating_mul(1 << 23), i32::MAX);
-        /// assert_eq!((-1i32 << 23).saturating_mul(1 << 23), i32::MIN);
-        /// ```
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        #[inline]
-        pub fn saturating_mul(self, rhs: Self) -> Self {
-            self.checked_mul(rhs).unwrap_or_else(|| {
-                if (self < 0 && rhs < 0) || (self > 0 && rhs > 0) {
-                    Self::max_value()
+        doc_comment! {
+            concat!("Checked absolute value. Computes `self.abs()`, returning `None` if
+`self == MIN`.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "use std::", stringify!($SelfT), ";
+
+assert_eq!((-5", stringify!($SelfT), ").checked_abs(), Some(5));
+assert_eq!(", stringify!($SelfT), "::MIN.checked_abs(), None);",
+$EndFeature, "
+```"),
+            #[stable(feature = "no_panic_abs", since = "1.13.0")]
+            #[inline]
+            pub fn checked_abs(self) -> Option<Self> {
+                if self.is_negative() {
+                    self.checked_neg()
                 } else {
-                    Self::min_value()
+                    Some(self)
                 }
-            })
+            }
         }
 
-        /// Wrapping (modular) addition. Computes `self + rhs`,
-        /// wrapping around at the boundary of the type.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(100i8.wrapping_add(27), 127);
-        /// assert_eq!(100i8.wrapping_add(127), -29);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn wrapping_add(self, rhs: Self) -> Self {
-            unsafe {
-                intrinsics::overflowing_add(self, rhs)
+        doc_comment! {
+            concat!("Saturating integer addition. Computes `self + rhs`, saturating at the numeric
+bounds instead of overflowing.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(100", stringify!($SelfT), ".saturating_add(1), 101);
+assert_eq!(", stringify!($SelfT), "::max_value().saturating_add(100), ", stringify!($SelfT),
+"::max_value());",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn saturating_add(self, rhs: Self) -> Self {
+                match self.checked_add(rhs) {
+                    Some(x) => x,
+                    None if rhs >= 0 => Self::max_value(),
+                    None => Self::min_value(),
+                }
             }
         }
 
-        /// Wrapping (modular) subtraction. Computes `self - rhs`,
-        /// wrapping around at the boundary of the type.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(0i8.wrapping_sub(127), -127);
-        /// assert_eq!((-2i8).wrapping_sub(127), 127);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn wrapping_sub(self, rhs: Self) -> Self {
-            unsafe {
-                intrinsics::overflowing_sub(self, rhs)
+        doc_comment! {
+            concat!("Saturating integer subtraction. Computes `self - rhs`, saturating at the
+numeric bounds instead of overflowing.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(100", stringify!($SelfT), ".saturating_sub(127), -27);
+assert_eq!(", stringify!($SelfT), "::min_value().saturating_sub(100), ", stringify!($SelfT),
+"::min_value());",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn saturating_sub(self, rhs: Self) -> Self {
+                match self.checked_sub(rhs) {
+                    Some(x) => x,
+                    None if rhs >= 0 => Self::min_value(),
+                    None => Self::max_value(),
+                }
             }
         }
 
-        /// Wrapping (modular) multiplication. Computes `self *
-        /// rhs`, wrapping around at the boundary of the type.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(10i8.wrapping_mul(12), 120);
-        /// assert_eq!(11i8.wrapping_mul(12), -124);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn wrapping_mul(self, rhs: Self) -> Self {
-            unsafe {
-                intrinsics::overflowing_mul(self, rhs)
+        doc_comment! {
+            concat!("Saturating integer multiplication. Computes `self * rhs`, saturating at the
+numeric bounds instead of overflowing.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "use std::", stringify!($SelfT), ";
+
+assert_eq!(10", stringify!($SelfT), ".saturating_mul(12), 120);
+assert_eq!(", stringify!($SelfT), "::MAX.saturating_mul(10), ", stringify!($SelfT), "::MAX);
+assert_eq!(", stringify!($SelfT), "::MIN.saturating_mul(10), ", stringify!($SelfT), "::MIN);",
+$EndFeature, "
+```"),
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            #[inline]
+            pub fn saturating_mul(self, rhs: Self) -> Self {
+                self.checked_mul(rhs).unwrap_or_else(|| {
+                    if (self < 0 && rhs < 0) || (self > 0 && rhs > 0) {
+                        Self::max_value()
+                    } else {
+                        Self::min_value()
+                    }
+                })
             }
         }
 
-        /// Wrapping (modular) division. Computes `self / rhs`,
-        /// wrapping around at the boundary of the type.
-        ///
-        /// The only case where such wrapping can occur is when one
-        /// divides `MIN / -1` on a signed type (where `MIN` is the
-        /// negative minimal value for the type); this is equivalent
-        /// to `-MIN`, a positive value that is too large to represent
-        /// in the type. In such a case, this function returns `MIN`
-        /// itself.
-        ///
-        /// # Panics
-        ///
-        /// This function will panic if `rhs` is 0.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(100u8.wrapping_div(10), 10);
-        /// assert_eq!((-128i8).wrapping_div(-1), -128);
-        /// ```
-        #[stable(feature = "num_wrapping", since = "1.2.0")]
-        #[inline]
-        pub fn wrapping_div(self, rhs: Self) -> Self {
-            self.overflowing_div(rhs).0
+        doc_comment! {
+            concat!("Wrapping (modular) addition. Computes `self + rhs`, wrapping around at the
+boundary of the type.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(100", stringify!($SelfT), ".wrapping_add(27), 127);
+assert_eq!(", stringify!($SelfT), "::max_value().wrapping_add(2), ", stringify!($SelfT),
+"::min_value() + 1);",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn wrapping_add(self, rhs: Self) -> Self {
+                unsafe {
+                    intrinsics::overflowing_add(self, rhs)
+                }
+            }
         }
 
-        /// Wrapping (modular) remainder. Computes `self % rhs`,
-        /// wrapping around at the boundary of the type.
-        ///
-        /// Such wrap-around never actually occurs mathematically;
-        /// implementation artifacts make `x % y` invalid for `MIN /
-        /// -1` on a signed type (where `MIN` is the negative
-        /// minimal value). In such a case, this function returns `0`.
-        ///
-        /// # Panics
-        ///
-        /// This function will panic if `rhs` is 0.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(100i8.wrapping_rem(10), 0);
-        /// assert_eq!((-128i8).wrapping_rem(-1), 0);
-        /// ```
-        #[stable(feature = "num_wrapping", since = "1.2.0")]
-        #[inline]
-        pub fn wrapping_rem(self, rhs: Self) -> Self {
-            self.overflowing_rem(rhs).0
+        doc_comment! {
+            concat!("Wrapping (modular) subtraction. Computes `self - rhs`, wrapping around at the
+boundary of the type.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(0", stringify!($SelfT), ".wrapping_sub(127), -127);
+assert_eq!((-2", stringify!($SelfT), ").wrapping_sub(", stringify!($SelfT), "::max_value()), ",
+stringify!($SelfT), "::max_value());",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn wrapping_sub(self, rhs: Self) -> Self {
+                unsafe {
+                    intrinsics::overflowing_sub(self, rhs)
+                }
+            }
         }
 
-        /// Wrapping (modular) negation. Computes `-self`,
-        /// wrapping around at the boundary of the type.
-        ///
-        /// The only case where such wrapping can occur is when one
-        /// negates `MIN` on a signed type (where `MIN` is the
-        /// negative minimal value for the type); this is a positive
-        /// value that is too large to represent in the type. In such
-        /// a case, this function returns `MIN` itself.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(100i8.wrapping_neg(), -100);
-        /// assert_eq!((-128i8).wrapping_neg(), -128);
-        /// ```
-        #[stable(feature = "num_wrapping", since = "1.2.0")]
-        #[inline]
-        pub fn wrapping_neg(self) -> Self {
-            self.overflowing_neg().0
+        doc_comment! {
+            concat!("Wrapping (modular) multiplication. Computes `self * rhs`, wrapping around at
+the boundary of the type.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(10", stringify!($SelfT), ".wrapping_mul(12), 120);
+assert_eq!(11i8.wrapping_mul(12), -124);",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn wrapping_mul(self, rhs: Self) -> Self {
+                unsafe {
+                    intrinsics::overflowing_mul(self, rhs)
+                }
+            }
         }
 
-        /// Panic-free bitwise shift-left; yields `self << mask(rhs)`,
-        /// where `mask` removes any high-order bits of `rhs` that
-        /// would cause the shift to exceed the bitwidth of the type.
-        ///
-        /// Note that this is *not* the same as a rotate-left; the
-        /// RHS of a wrapping shift-left is restricted to the range
-        /// of the type, rather than the bits shifted out of the LHS
-        /// being returned to the other end. The primitive integer
-        /// types all implement a `rotate_left` function, which may
-        /// be what you want instead.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!((-1i8).wrapping_shl(7), -128);
-        /// assert_eq!((-1i8).wrapping_shl(8), -1);
-        /// ```
-        #[stable(feature = "num_wrapping", since = "1.2.0")]
-        #[inline]
-        pub fn wrapping_shl(self, rhs: u32) -> Self {
-            unsafe {
-                intrinsics::unchecked_shl(self, (rhs & ($BITS - 1)) as $SelfT)
+        doc_comment! {
+            concat!("Wrapping (modular) division. Computes `self / rhs`, wrapping around at the
+boundary of the type.
+
+The only case where such wrapping can occur is when one divides `MIN / -1` on a signed type (where
+`MIN` is the negative minimal value for the type); this is equivalent to `-MIN`, a positive value
+that is too large to represent in the type. In such a case, this function returns `MIN` itself.
+
+# Panics
+
+This function will panic if `rhs` is 0.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(100", stringify!($SelfT), ".wrapping_div(10), 10);
+assert_eq!((-128i8).wrapping_div(-1), -128);",
+$EndFeature, "
+```"),
+            #[stable(feature = "num_wrapping", since = "1.2.0")]
+            #[inline]
+            pub fn wrapping_div(self, rhs: Self) -> Self {
+                self.overflowing_div(rhs).0
             }
         }
 
-        /// Panic-free bitwise shift-right; yields `self >> mask(rhs)`,
-        /// where `mask` removes any high-order bits of `rhs` that
-        /// would cause the shift to exceed the bitwidth of the type.
-        ///
-        /// Note that this is *not* the same as a rotate-right; the
-        /// RHS of a wrapping shift-right is restricted to the range
-        /// of the type, rather than the bits shifted out of the LHS
-        /// being returned to the other end. The primitive integer
-        /// types all implement a `rotate_right` function, which may
-        /// be what you want instead.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!((-128i8).wrapping_shr(7), -1);
-        /// assert_eq!((-128i8).wrapping_shr(8), -128);
-        /// ```
-        #[stable(feature = "num_wrapping", since = "1.2.0")]
-        #[inline]
-        pub fn wrapping_shr(self, rhs: u32) -> Self {
-            unsafe {
-                intrinsics::unchecked_shr(self, (rhs & ($BITS - 1)) as $SelfT)
+        doc_comment! {
+            concat!("Wrapping (modular) remainder. Computes `self % rhs`, wrapping around at the
+boundary of the type.
+
+Such wrap-around never actually occurs mathematically; implementation artifacts make `x % y`
+invalid for `MIN / -1` on a signed type (where `MIN` is the negative minimal value). In such a case,
+this function returns `0`.
+
+# Panics
+
+This function will panic if `rhs` is 0.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(100", stringify!($SelfT), ".wrapping_rem(10), 0);
+assert_eq!((-128i8).wrapping_rem(-1), 0);",
+$EndFeature, "
+```"),
+            #[stable(feature = "num_wrapping", since = "1.2.0")]
+            #[inline]
+            pub fn wrapping_rem(self, rhs: Self) -> Self {
+                self.overflowing_rem(rhs).0
             }
         }
 
-        /// Wrapping (modular) absolute value. Computes `self.abs()`,
-        /// wrapping around at the boundary of the type.
-        ///
-        /// The only case where such wrapping can occur is when one takes
-        /// the absolute value of the negative minimal value for the type
-        /// this is a positive value that is too large to represent in the
-        /// type. In such a case, this function returns `MIN` itself.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(100i8.wrapping_abs(), 100);
-        /// assert_eq!((-100i8).wrapping_abs(), 100);
-        /// assert_eq!((-128i8).wrapping_abs(), -128);
-        /// assert_eq!((-128i8).wrapping_abs() as u8, 128);
-        /// ```
-        #[stable(feature = "no_panic_abs", since = "1.13.0")]
-        #[inline]
-        pub fn wrapping_abs(self) -> Self {
-            if self.is_negative() {
-                self.wrapping_neg()
-            } else {
-                self
+        doc_comment! {
+            concat!("Wrapping (modular) negation. Computes `-self`, wrapping around at the boundary
+of the type.
+
+The only case where such wrapping can occur is when one negates `MIN` on a signed type (where `MIN`
+is the negative minimal value for the type); this is a positive value that is too large to represent
+in the type. In such a case, this function returns `MIN` itself.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(100", stringify!($SelfT), ".wrapping_neg(), -100);
+assert_eq!(", stringify!($SelfT), "::min_value().wrapping_neg(), ", stringify!($SelfT),
+"::min_value());",
+$EndFeature, "
+```"),
+            #[stable(feature = "num_wrapping", since = "1.2.0")]
+            #[inline]
+            pub fn wrapping_neg(self) -> Self {
+                self.overflowing_neg().0
             }
         }
 
-        /// Calculates `self` + `rhs`
-        ///
-        /// Returns a tuple of the addition along with a boolean indicating
-        /// whether an arithmetic overflow would occur. If an overflow would
-        /// have occurred then the wrapped value is returned.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage
-        ///
-        /// ```
-        /// use std::i32;
-        ///
-        /// assert_eq!(5i32.overflowing_add(2), (7, false));
-        /// assert_eq!(i32::MAX.overflowing_add(1), (i32::MIN, true));
-        /// ```
-        #[inline]
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        pub fn overflowing_add(self, rhs: Self) -> (Self, bool) {
-            let (a, b) = unsafe {
-                intrinsics::add_with_overflow(self as $ActualT,
-                                              rhs as $ActualT)
-            };
-            (a as Self, b)
+        doc_comment! {
+            concat!("Panic-free bitwise shift-left; yields `self << mask(rhs)`, where `mask` removes
+any high-order bits of `rhs` that would cause the shift to exceed the bitwidth of the type.
+
+Note that this is *not* the same as a rotate-left; the RHS of a wrapping shift-left is restricted to
+the range of the type, rather than the bits shifted out of the LHS being returned to the other end.
+The primitive integer types all implement a `rotate_left` function, which may be what you want
+instead.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!((-1", stringify!($SelfT), ").wrapping_shl(7), -128);
+assert_eq!((-1", stringify!($SelfT), ").wrapping_shl(128), -1);",
+$EndFeature, "
+```"),
+            #[stable(feature = "num_wrapping", since = "1.2.0")]
+            #[inline]
+            pub fn wrapping_shl(self, rhs: u32) -> Self {
+                unsafe {
+                    intrinsics::unchecked_shl(self, (rhs & ($BITS - 1)) as $SelfT)
+                }
+            }
         }
 
-        /// Calculates `self` - `rhs`
-        ///
-        /// Returns a tuple of the subtraction along with a boolean indicating
-        /// whether an arithmetic overflow would occur. If an overflow would
-        /// have occurred then the wrapped value is returned.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage
-        ///
-        /// ```
-        /// use std::i32;
-        ///
-        /// assert_eq!(5i32.overflowing_sub(2), (3, false));
-        /// assert_eq!(i32::MIN.overflowing_sub(1), (i32::MAX, true));
-        /// ```
-        #[inline]
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        pub fn overflowing_sub(self, rhs: Self) -> (Self, bool) {
-            let (a, b) = unsafe {
-                intrinsics::sub_with_overflow(self as $ActualT,
-                                              rhs as $ActualT)
-            };
-            (a as Self, b)
+        doc_comment! {
+            concat!("Panic-free bitwise shift-right; yields `self >> mask(rhs)`, where `mask`
+removes any high-order bits of `rhs` that would cause the shift to exceed the bitwidth of the type.
+
+Note that this is *not* the same as a rotate-right; the RHS of a wrapping shift-right is restricted
+to the range of the type, rather than the bits shifted out of the LHS being returned to the other
+end. The primitive integer types all implement a `rotate_right` function, which may be what you want
+instead.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!((-128", stringify!($SelfT), ").wrapping_shr(7), -1);
+assert_eq!((-128i16).wrapping_shr(64), -128);",
+$EndFeature, "
+```"),
+            #[stable(feature = "num_wrapping", since = "1.2.0")]
+            #[inline]
+            pub fn wrapping_shr(self, rhs: u32) -> Self {
+                unsafe {
+                    intrinsics::unchecked_shr(self, (rhs & ($BITS - 1)) as $SelfT)
+                }
+            }
         }
 
-        /// Calculates the multiplication of `self` and `rhs`.
-        ///
-        /// Returns a tuple of the multiplication along with a boolean
-        /// indicating whether an arithmetic overflow would occur. If an
-        /// overflow would have occurred then the wrapped value is returned.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage
-        ///
-        /// ```
-        /// assert_eq!(5i32.overflowing_mul(2), (10, false));
-        /// assert_eq!(1_000_000_000i32.overflowing_mul(10), (1410065408, true));
-        /// ```
-        #[inline]
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        pub fn overflowing_mul(self, rhs: Self) -> (Self, bool) {
-            let (a, b) = unsafe {
-                intrinsics::mul_with_overflow(self as $ActualT,
-                                              rhs as $ActualT)
-            };
-            (a as Self, b)
+        doc_comment! {
+            concat!("Wrapping (modular) absolute value. Computes `self.abs()`, wrapping around at
+the boundary of the type.
+
+The only case where such wrapping can occur is when one takes the absolute value of the negative
+minimal value for the type this is a positive value that is too large to represent in the type. In
+such a case, this function returns `MIN` itself.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(100", stringify!($SelfT), ".wrapping_abs(), 100);
+assert_eq!((-100", stringify!($SelfT), ").wrapping_abs(), 100);
+assert_eq!(", stringify!($SelfT), "::min_value().wrapping_abs(), ", stringify!($SelfT),
+"::min_value());
+assert_eq!((-128i8).wrapping_abs() as u8, 128);",
+$EndFeature, "
+```"),
+            #[stable(feature = "no_panic_abs", since = "1.13.0")]
+            #[inline]
+            pub fn wrapping_abs(self) -> Self {
+                if self.is_negative() {
+                    self.wrapping_neg()
+                } else {
+                    self
+                }
+            }
         }
 
-        /// Calculates the divisor when `self` is divided by `rhs`.
-        ///
-        /// Returns a tuple of the divisor along with a boolean indicating
-        /// whether an arithmetic overflow would occur. If an overflow would
-        /// occur then self is returned.
-        ///
-        /// # Panics
-        ///
-        /// This function will panic if `rhs` is 0.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage
-        ///
-        /// ```
-        /// use std::i32;
-        ///
-        /// assert_eq!(5i32.overflowing_div(2), (2, false));
-        /// assert_eq!(i32::MIN.overflowing_div(-1), (i32::MIN, true));
-        /// ```
-        #[inline]
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        pub fn overflowing_div(self, rhs: Self) -> (Self, bool) {
-            if self == Self::min_value() && rhs == -1 {
-                (self, true)
-            } else {
-                (self / rhs, false)
+        doc_comment! {
+            concat!("Calculates `self` + `rhs`
+
+Returns a tuple of the addition along with a boolean indicating whether an arithmetic overflow would
+occur. If an overflow would have occurred then the wrapped value is returned.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "use std::", stringify!($SelfT), ";
+
+assert_eq!(5", stringify!($SelfT), ".overflowing_add(2), (7, false));
+assert_eq!(", stringify!($SelfT), "::MAX.overflowing_add(1), (", stringify!($SelfT),
+"::MIN, true));", $EndFeature, "
+```"),
+            #[inline]
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            pub fn overflowing_add(self, rhs: Self) -> (Self, bool) {
+                let (a, b) = unsafe {
+                    intrinsics::add_with_overflow(self as $ActualT,
+                                                  rhs as $ActualT)
+                };
+                (a as Self, b)
             }
         }
 
-        /// Calculates the remainder when `self` is divided by `rhs`.
-        ///
-        /// Returns a tuple of the remainder after dividing along with a boolean
-        /// indicating whether an arithmetic overflow would occur. If an
-        /// overflow would occur then 0 is returned.
-        ///
-        /// # Panics
-        ///
-        /// This function will panic if `rhs` is 0.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage
-        ///
-        /// ```
-        /// use std::i32;
-        ///
-        /// assert_eq!(5i32.overflowing_rem(2), (1, false));
-        /// assert_eq!(i32::MIN.overflowing_rem(-1), (0, true));
-        /// ```
-        #[inline]
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        pub fn overflowing_rem(self, rhs: Self) -> (Self, bool) {
-            if self == Self::min_value() && rhs == -1 {
-                (0, true)
-            } else {
-                (self % rhs, false)
+        doc_comment! {
+            concat!("Calculates `self` - `rhs`
+
+Returns a tuple of the subtraction along with a boolean indicating whether an arithmetic overflow
+would occur. If an overflow would have occurred then the wrapped value is returned.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "use std::", stringify!($SelfT), ";
+
+assert_eq!(5", stringify!($SelfT), ".overflowing_sub(2), (3, false));
+assert_eq!(", stringify!($SelfT), "::MIN.overflowing_sub(1), (", stringify!($SelfT),
+"::MAX, true));", $EndFeature, "
+```"),
+            #[inline]
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            pub fn overflowing_sub(self, rhs: Self) -> (Self, bool) {
+                let (a, b) = unsafe {
+                    intrinsics::sub_with_overflow(self as $ActualT,
+                                                  rhs as $ActualT)
+                };
+                (a as Self, b)
             }
         }
 
-        /// Negates self, overflowing if this is equal to the minimum value.
-        ///
-        /// Returns a tuple of the negated version of self along with a boolean
-        /// indicating whether an overflow happened. If `self` is the minimum
-        /// value (e.g. `i32::MIN` for values of type `i32`), then the minimum
-        /// value will be returned again and `true` will be returned for an
-        /// overflow happening.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage
-        ///
-        /// ```
-        /// use std::i32;
-        ///
-        /// assert_eq!(2i32.overflowing_neg(), (-2, false));
-        /// assert_eq!(i32::MIN.overflowing_neg(), (i32::MIN, true));
-        /// ```
-        #[inline]
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        pub fn overflowing_neg(self) -> (Self, bool) {
-            if self == Self::min_value() {
-                (Self::min_value(), true)
-            } else {
-                (-self, false)
+        doc_comment! {
+            concat!("Calculates the multiplication of `self` and `rhs`.
+
+Returns a tuple of the multiplication along with a boolean indicating whether an arithmetic overflow
+would occur. If an overflow would have occurred then the wrapped value is returned.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(5", stringify!($SelfT), ".overflowing_mul(2), (10, false));
+assert_eq!(1_000_000_000i32.overflowing_mul(10), (1410065408, true));",
+$EndFeature, "
+```"),
+            #[inline]
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            pub fn overflowing_mul(self, rhs: Self) -> (Self, bool) {
+                let (a, b) = unsafe {
+                    intrinsics::mul_with_overflow(self as $ActualT,
+                                                  rhs as $ActualT)
+                };
+                (a as Self, b)
             }
         }
 
-        /// Shifts self left by `rhs` bits.
-        ///
-        /// Returns a tuple of the shifted version of self along with a boolean
-        /// indicating whether the shift value was larger than or equal to the
-        /// number of bits. If the shift value is too large, then value is
-        /// masked (N-1) where N is the number of bits, and this value is then
-        /// used to perform the shift.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage
-        ///
-        /// ```
-        /// assert_eq!(0x10i32.overflowing_shl(4), (0x100, false));
-        /// assert_eq!(0x10i32.overflowing_shl(36), (0x100, true));
-        /// ```
-        #[inline]
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        pub fn overflowing_shl(self, rhs: u32) -> (Self, bool) {
-            (self.wrapping_shl(rhs), (rhs > ($BITS - 1)))
+        doc_comment! {
+            concat!("Calculates the divisor when `self` is divided by `rhs`.
+
+Returns a tuple of the divisor along with a boolean indicating whether an arithmetic overflow would
+occur. If an overflow would occur then self is returned.
+
+# Panics
+
+This function will panic if `rhs` is 0.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "use std::", stringify!($SelfT), ";
+
+assert_eq!(5", stringify!($SelfT), ".overflowing_div(2), (2, false));
+assert_eq!(", stringify!($SelfT), "::MIN.overflowing_div(-1), (", stringify!($SelfT),
+"::MIN, true));",
+$EndFeature, "
+```"),
+            #[inline]
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            pub fn overflowing_div(self, rhs: Self) -> (Self, bool) {
+                if self == Self::min_value() && rhs == -1 {
+                    (self, true)
+                } else {
+                    (self / rhs, false)
+                }
+            }
         }
 
-        /// Shifts self right by `rhs` bits.
-        ///
-        /// Returns a tuple of the shifted version of self along with a boolean
-        /// indicating whether the shift value was larger than or equal to the
-        /// number of bits. If the shift value is too large, then value is
-        /// masked (N-1) where N is the number of bits, and this value is then
-        /// used to perform the shift.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage
-        ///
-        /// ```
-        /// assert_eq!(0x10i32.overflowing_shr(4), (0x1, false));
-        /// assert_eq!(0x10i32.overflowing_shr(36), (0x1, true));
-        /// ```
-        #[inline]
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        pub fn overflowing_shr(self, rhs: u32) -> (Self, bool) {
-            (self.wrapping_shr(rhs), (rhs > ($BITS - 1)))
+        doc_comment! {
+            concat!("Calculates the remainder when `self` is divided by `rhs`.
+
+Returns a tuple of the remainder after dividing along with a boolean indicating whether an
+arithmetic overflow would occur. If an overflow would occur then 0 is returned.
+
+# Panics
+
+This function will panic if `rhs` is 0.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "use std::", stringify!($SelfT), ";
+
+assert_eq!(5", stringify!($SelfT), ".overflowing_rem(2), (1, false));
+assert_eq!(", stringify!($SelfT), "::MIN.overflowing_rem(-1), (0, true));",
+$EndFeature, "
+```"),
+            #[inline]
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            pub fn overflowing_rem(self, rhs: Self) -> (Self, bool) {
+                if self == Self::min_value() && rhs == -1 {
+                    (0, true)
+                } else {
+                    (self % rhs, false)
+                }
+            }
         }
 
-        /// Computes the absolute value of `self`.
-        ///
-        /// Returns a tuple of the absolute version of self along with a
-        /// boolean indicating whether an overflow happened. If self is the
-        /// minimum value (e.g. i32::MIN for values of type i32), then the
-        /// minimum value will be returned again and true will be returned for
-        /// an overflow happening.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(10i8.overflowing_abs(), (10,false));
-        /// assert_eq!((-10i8).overflowing_abs(), (10,false));
-        /// assert_eq!((-128i8).overflowing_abs(), (-128,true));
-        /// ```
-        #[stable(feature = "no_panic_abs", since = "1.13.0")]
-        #[inline]
-        pub fn overflowing_abs(self) -> (Self, bool) {
-            if self.is_negative() {
-                self.overflowing_neg()
-            } else {
-                (self, false)
+        doc_comment! {
+            concat!("Negates self, overflowing if this is equal to the minimum value.
+
+Returns a tuple of the negated version of self along with a boolean indicating whether an overflow
+happened. If `self` is the minimum value (e.g. `i32::MIN` for values of type `i32`), then the
+minimum value will be returned again and `true` will be returned for an overflow happening.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "use std::", stringify!($SelfT), ";
+
+assert_eq!(2", stringify!($SelfT), ".overflowing_neg(), (-2, false));
+assert_eq!(", stringify!($SelfT), "::MIN.overflowing_neg(), (", stringify!($SelfT),
+"::MIN, true));", $EndFeature, "
+```"),
+            #[inline]
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            pub fn overflowing_neg(self) -> (Self, bool) {
+                if self == Self::min_value() {
+                    (Self::min_value(), true)
+                } else {
+                    (-self, false)
+                }
             }
         }
 
-        /// Raises self to the power of `exp`, using exponentiation by squaring.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// let x: i32 = 2; // or any other integer type
-        ///
-        /// assert_eq!(x.pow(4), 16);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        #[rustc_inherit_overflow_checks]
-        pub fn pow(self, mut exp: u32) -> Self {
-            let mut base = self;
-            let mut acc = 1;
+        doc_comment! {
+            concat!("Shifts self left by `rhs` bits.
+
+Returns a tuple of the shifted version of self along with a boolean indicating whether the shift
+value was larger than or equal to the number of bits. If the shift value is too large, then value is
+masked (N-1) where N is the number of bits, and this value is then used to perform the shift.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(0x1", stringify!($SelfT),".overflowing_shl(4), (0x10, false));
+assert_eq!(0x1i32.overflowing_shl(36), (0x10, true));",
+$EndFeature, "
+```"),
+            #[inline]
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            pub fn overflowing_shl(self, rhs: u32) -> (Self, bool) {
+                (self.wrapping_shl(rhs), (rhs > ($BITS - 1)))
+            }
+        }
+
+        doc_comment! {
+            concat!("Shifts self right by `rhs` bits.
+
+Returns a tuple of the shifted version of self along with a boolean indicating whether the shift
+value was larger than or equal to the number of bits. If the shift value is too large, then value is
+masked (N-1) where N is the number of bits, and this value is then used to perform the shift.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(0x10", stringify!($SelfT), ".overflowing_shr(4), (0x1, false));
+assert_eq!(0x10i32.overflowing_shr(36), (0x1, true));",
+$EndFeature, "
+```"),
+            #[inline]
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            pub fn overflowing_shr(self, rhs: u32) -> (Self, bool) {
+                (self.wrapping_shr(rhs), (rhs > ($BITS - 1)))
+            }
+        }
+
+        doc_comment! {
+            concat!("Computes the absolute value of `self`.
+
+Returns a tuple of the absolute version of self along with a boolean indicating whether an overflow
+happened. If self is the minimum value (e.g. ", stringify!($SelfT), "::MIN for values of type
+ ", stringify!($SelfT), "), then the minimum value will be returned again and true will be returned
+for an overflow happening.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(10", stringify!($SelfT), ".overflowing_abs(), (10, false));
+assert_eq!((-10", stringify!($SelfT), ").overflowing_abs(), (10, false));
+assert_eq!((", stringify!($SelfT), "::min_value()).overflowing_abs(), (", stringify!($SelfT),
+"::min_value(), true));",
+$EndFeature, "
+```"),
+            #[stable(feature = "no_panic_abs", since = "1.13.0")]
+            #[inline]
+            pub fn overflowing_abs(self) -> (Self, bool) {
+                if self.is_negative() {
+                    self.overflowing_neg()
+                } else {
+                    (self, false)
+                }
+            }
+        }
+
+        doc_comment! {
+            concat!("Raises self to the power of `exp`, using exponentiation by squaring.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "let x: ", stringify!($SelfT), " = 2; // or any other integer type
+
+assert_eq!(x.pow(4), 16);",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            #[rustc_inherit_overflow_checks]
+            pub fn pow(self, mut exp: u32) -> Self {
+                let mut base = self;
+                let mut acc = 1;
+
+                while exp > 1 {
+                    if (exp & 1) == 1 {
+                        acc = acc * base;
+                    }
+                    exp /= 2;
+                    base = base * base;
+                }
+
+                // Deal with the final bit of the exponent separately, since
+                // squaring the base afterwards is not necessary and may cause a
+                // needless overflow.
+                if exp == 1 {
+                    acc = acc * base;
+                }
+
+                acc
+            }
+        }
+
+        doc_comment! {
+            concat!("Computes the absolute value of `self`.
 
-            while exp > 1 {
-                if (exp & 1) == 1 {
-                    acc = acc * base;
+# Overflow behavior
+
+The absolute value of `", stringify!($SelfT), "::min_value()` cannot be represented as an
+`", stringify!($SelfT), "`, and attempting to calculate it will cause an overflow. This means that
+code in debug mode will trigger a panic on this case and optimized code will return `",
+stringify!($SelfT), "::min_value()` without a panic.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(10", stringify!($SelfT), ".abs(), 10);
+assert_eq!((-10", stringify!($SelfT), ").abs(), 10);",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            #[rustc_inherit_overflow_checks]
+            pub fn abs(self) -> Self {
+                if self.is_negative() {
+                    // Note that the #[inline] above means that the overflow
+                    // semantics of this negation depend on the crate we're being
+                    // inlined into.
+                    -self
+                } else {
+                    self
                 }
-                exp /= 2;
-                base = base * base;
             }
+        }
 
-            // Deal with the final bit of the exponent separately, since
-            // squaring the base afterwards is not necessary and may cause a
-            // needless overflow.
-            if exp == 1 {
-                acc = acc * base;
-            }
+        doc_comment! {
+            concat!("Returns a number representing sign of `self`.
 
-            acc
-        }
+ - `0` if the number is zero
+ - `1` if the number is positive
+ - `-1` if the number is negative
 
-        /// Computes the absolute value of `self`.
-        ///
-        /// # Overflow behavior
-        ///
-        /// The absolute value of `i32::min_value()` cannot be represented as an
-        /// `i32`, and attempting to calculate it will cause an overflow. This
-        /// means that code in debug mode will trigger a panic on this case and
-        /// optimized code will return `i32::min_value()` without a panic.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(10i8.abs(), 10);
-        /// assert_eq!((-10i8).abs(), 10);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        #[rustc_inherit_overflow_checks]
-        pub fn abs(self) -> Self {
-            if self.is_negative() {
-                // Note that the #[inline] above means that the overflow
-                // semantics of this negation depend on the crate we're being
-                // inlined into.
-                -self
-            } else {
-                self
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(10", stringify!($SelfT), ".signum(), 1);
+assert_eq!(0", stringify!($SelfT), ".signum(), 0);
+assert_eq!((-10", stringify!($SelfT), ").signum(), -1);",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn signum(self) -> Self {
+                match self {
+                    n if n > 0 =>  1,
+                    0          =>  0,
+                    _          => -1,
+                }
             }
         }
 
-        /// Returns a number representing sign of `self`.
-        ///
-        /// - `0` if the number is zero
-        /// - `1` if the number is positive
-        /// - `-1` if the number is negative
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(10i8.signum(), 1);
-        /// assert_eq!(0i8.signum(), 0);
-        /// assert_eq!((-10i8).signum(), -1);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn signum(self) -> Self {
-            match self {
-                n if n > 0 =>  1,
-                0          =>  0,
-                _          => -1,
-            }
+        doc_comment! {
+            concat!("Returns `true` if `self` is positive and `false` if the number is zero or
+negative.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert!(10", stringify!($SelfT), ".is_positive());
+assert!(!(-10", stringify!($SelfT), ").is_positive());",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn is_positive(self) -> bool { self > 0 }
         }
 
-        /// Returns `true` if `self` is positive and `false` if the number
-        /// is zero or negative.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert!(10i8.is_positive());
-        /// assert!(!(-10i8).is_positive());
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn is_positive(self) -> bool { self > 0 }
+        doc_comment! {
+            concat!("Returns `true` if `self` is negative and `false` if the number is zero or
+positive.
 
-        /// Returns `true` if `self` is negative and `false` if the number
-        /// is zero or positive.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert!((-10i8).is_negative());
-        /// assert!(!10i8.is_negative());
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn is_negative(self) -> bool { self < 0 }
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert!((-10", stringify!($SelfT), ").is_negative());
+assert!(!10", stringify!($SelfT), ".is_negative());",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn is_negative(self) -> bool { self < 0 }
+        }
     }
 }
 
 #[lang = "i8"]
 impl i8 {
-    int_impl! { i8, i8, u8, 8 }
+    int_impl! { i8, i8, u8, 8, -128, 127, "", "" }
 }
 
 #[lang = "i16"]
 impl i16 {
-    int_impl! { i16, i16, u16, 16 }
+    int_impl! { i16, i16, u16, 16, -32768, 32767, "", "" }
 }
 
 #[lang = "i32"]
 impl i32 {
-    int_impl! { i32, i32, u32, 32 }
+    int_impl! { i32, i32, u32, 32, -2147483648, 2147483647, "", "" }
 }
 
 #[lang = "i64"]
 impl i64 {
-    int_impl! { i64, i64, u64, 64 }
+    int_impl! { i64, i64, u64, 64, -9223372036854775808, 9223372036854775807, "", "" }
 }
 
 #[lang = "i128"]
 impl i128 {
-    int_impl! { i128, i128, u128, 128 }
+    int_impl! { i128, i128, u128, 128, -170141183460469231731687303715884105728,
+        170141183460469231731687303715884105727, "#![feature(i128_type)]
+#![feature(i128)]
+# fn main() {
+", "
+# }" }
 }
 
 #[cfg(target_pointer_width = "16")]
 #[lang = "isize"]
 impl isize {
-    int_impl! { isize, i16, u16, 16 }
+    int_impl! { isize, i16, u16, 16, -32768, 32767, "", "" }
 }
 
 #[cfg(target_pointer_width = "32")]
 #[lang = "isize"]
 impl isize {
-    int_impl! { isize, i32, u32, 32 }
+    int_impl! { isize, i32, u32, 32, -2147483648, 2147483647, "", "" }
 }
 
 #[cfg(target_pointer_width = "64")]
 #[lang = "isize"]
 impl isize {
-    int_impl! { isize, i64, u64, 64 }
+    int_impl! { isize, i64, u64, 64, -9223372036854775808, 9223372036854775807, "", "" }
 }
 
 // `Int` + `UnsignedInt` implemented for unsigned integers
 macro_rules! uint_impl {
-    ($SelfT:ty, $ActualT:ty, $BITS:expr) => {
-        /// Returns the smallest value that can be represented by this integer type.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(u8::min_value(), 0);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub const fn min_value() -> Self { 0 }
+    ($SelfT:ty, $ActualT:ty, $BITS:expr, $MaxV:expr, $Feature:expr, $EndFeature:expr) => {
+        doc_comment! {
+            concat!("Returns the smallest value that can be represented by this integer type.
 
-        /// Returns the largest value that can be represented by this integer type.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(u8::max_value(), 255);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub const fn max_value() -> Self { !0 }
+# Examples
 
-        /// Converts a string slice in a given base to an integer.
-        ///
-        /// The string is expected to be an optional `+` sign
-        /// followed by digits.
-        /// Leading and trailing whitespace represent an error.
-        /// Digits are a subset of these characters, depending on `radix`:
-        ///
-        /// * `0-9`
-        /// * `a-z`
-        /// * `A-Z`
-        ///
-        /// # Panics
-        ///
-        /// This function panics if `radix` is not in the range from 2 to 36.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(u32::from_str_radix("A", 16), Ok(10));
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        pub fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError> {
-            from_str_radix(src, radix)
-        }
+Basic usage:
 
-        /// Returns the number of ones in the binary representation of `self`.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// let n = 0b01001100u8;
-        ///
-        /// assert_eq!(n.count_ones(), 3);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn count_ones(self) -> u32 {
-            unsafe { intrinsics::ctpop(self as $ActualT) as u32 }
+```
+", $Feature, "assert_eq!(", stringify!($SelfT), "::min_value(), 0);", $EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub const fn min_value() -> Self { 0 }
         }
 
-        /// Returns the number of zeros in the binary representation of `self`.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// let n = 0b01001100u8;
-        ///
-        /// assert_eq!(n.count_zeros(), 5);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn count_zeros(self) -> u32 {
-            (!self).count_ones()
-        }
+        doc_comment! {
+            concat!("Returns the largest value that can be represented by this integer type.
 
-        /// Returns the number of leading zeros in the binary representation
-        /// of `self`.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// let n = 0b0101000u16;
-        ///
-        /// assert_eq!(n.leading_zeros(), 10);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn leading_zeros(self) -> u32 {
-            unsafe { intrinsics::ctlz(self as $ActualT) as u32 }
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(", stringify!($SelfT), "::max_value(), ",
+stringify!($MaxV), ");", $EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub const fn max_value() -> Self { !0 }
         }
 
-        /// Returns the number of trailing zeros in the binary representation
-        /// of `self`.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// let n = 0b0101000u16;
-        ///
-        /// assert_eq!(n.trailing_zeros(), 3);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn trailing_zeros(self) -> u32 {
-            // As of LLVM 3.6 the codegen for the zero-safe cttz8 intrinsic
-            // emits two conditional moves on x86_64. By promoting the value to
-            // u16 and setting bit 8, we get better code without any conditional
-            // operations.
-            // FIXME: There's a LLVM patch (http://reviews.llvm.org/D9284)
-            // pending, remove this workaround once LLVM generates better code
-            // for cttz8.
-            unsafe {
-                if $BITS == 8 {
-                    intrinsics::cttz(self as u16 | 0x100) as u32
-                } else {
-                    intrinsics::cttz(self) as u32
-                }
+        doc_comment! {
+            concat!("Converts a string slice in a given base to an integer.
+
+The string is expected to be an optional `+` sign
+followed by digits.
+Leading and trailing whitespace represent an error.
+Digits are a subset of these characters, depending on `radix`:
+
+* `0-9`
+* `a-z`
+* `A-Z`
+
+# Panics
+
+This function panics if `radix` is not in the range from 2 to 36.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(", stringify!($SelfT), "::from_str_radix(\"A\", 16), Ok(10));",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            pub fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError> {
+                from_str_radix(src, radix)
             }
         }
 
-        /// Shifts the bits to the left by a specified amount, `n`,
-        /// wrapping the truncated bits to the end of the resulting integer.
-        ///
-        /// Please note this isn't the same operation as `<<`!
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// let n = 0x0123456789ABCDEFu64;
-        /// let m = 0x3456789ABCDEF012u64;
-        ///
-        /// assert_eq!(n.rotate_left(12), m);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn rotate_left(self, n: u32) -> Self {
-            // Protect against undefined behaviour for over-long bit shifts
-            let n = n % $BITS;
-            (self << n) | (self >> (($BITS - n) % $BITS))
+        doc_comment! {
+            concat!("Returns the number of ones in the binary representation of `self`.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "let n = 0b01001100", stringify!($SelfT), ";
+
+assert_eq!(n.count_ones(), 3);", $EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn count_ones(self) -> u32 {
+                unsafe { intrinsics::ctpop(self as $ActualT) as u32 }
+            }
         }
 
-        /// Shifts the bits to the right by a specified amount, `n`,
-        /// wrapping the truncated bits to the beginning of the resulting
-        /// integer.
-        ///
-        /// Please note this isn't the same operation as `>>`!
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// let n = 0x0123456789ABCDEFu64;
-        /// let m = 0xDEF0123456789ABCu64;
-        ///
-        /// assert_eq!(n.rotate_right(12), m);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn rotate_right(self, n: u32) -> Self {
-            // Protect against undefined behaviour for over-long bit shifts
-            let n = n % $BITS;
-            (self >> n) | (self << (($BITS - n) % $BITS))
+        doc_comment! {
+            concat!("Returns the number of zeros in the binary representation of `self`.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(", stringify!($SelfT), "::max_value().count_zeros(), 0);", $EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn count_zeros(self) -> u32 {
+                (!self).count_ones()
+            }
         }
 
-        /// Reverses the byte order of the integer.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// let n: u16 = 0b0000000_01010101;
-        /// assert_eq!(n, 85);
-        ///
-        /// let m = n.swap_bytes();
-        ///
-        /// assert_eq!(m, 0b01010101_00000000);
-        /// assert_eq!(m, 21760);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn swap_bytes(self) -> Self {
-            unsafe { intrinsics::bswap(self as $ActualT) as Self }
+        doc_comment! {
+            concat!("Returns the number of leading zeros in the binary representation of `self`.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "let n = ", stringify!($SelfT), "::max_value() >> 2;
+
+assert_eq!(n.leading_zeros(), 2);", $EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn leading_zeros(self) -> u32 {
+                unsafe { intrinsics::ctlz(self as $ActualT) as u32 }
+            }
         }
 
-        /// Converts an integer from big endian to the target's endianness.
-        ///
-        /// On big endian this is a no-op. On little endian the bytes are
-        /// swapped.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// let n = 0x0123456789ABCDEFu64;
-        ///
-        /// if cfg!(target_endian = "big") {
-        ///     assert_eq!(u64::from_be(n), n)
-        /// } else {
-        ///     assert_eq!(u64::from_be(n), n.swap_bytes())
-        /// }
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn from_be(x: Self) -> Self {
-            if cfg!(target_endian = "big") { x } else { x.swap_bytes() }
+        doc_comment! {
+            concat!("Returns the number of trailing zeros in the binary representation
+of `self`.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "let n = 0b0101000", stringify!($SelfT), ";
+
+assert_eq!(n.trailing_zeros(), 3);", $EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn trailing_zeros(self) -> u32 {
+                // As of LLVM 3.6 the codegen for the zero-safe cttz8 intrinsic
+                // emits two conditional moves on x86_64. By promoting the value to
+                // u16 and setting bit 8, we get better code without any conditional
+                // operations.
+                // FIXME: There's a LLVM patch (http://reviews.llvm.org/D9284)
+                // pending, remove this workaround once LLVM generates better code
+                // for cttz8.
+                unsafe {
+                    if $BITS == 8 {
+                        intrinsics::cttz(self as u16 | 0x100) as u32
+                    } else {
+                        intrinsics::cttz(self) as u32
+                    }
+                }
+            }
         }
 
-        /// Converts an integer from little endian to the target's endianness.
+        /// Shifts the bits to the left by a specified amount, `n`,
+        /// wrapping the truncated bits to the end of the resulting integer.
         ///
-        /// On little endian this is a no-op. On big endian the bytes are
-        /// swapped.
+        /// Please note this isn't the same operation as `<<`!
         ///
         /// # Examples
         ///
         /// Basic usage:
         ///
+        /// Please note that this example is shared between integer types.
+        /// Which explains why `u64` is used here.
+        ///
         /// ```
         /// let n = 0x0123456789ABCDEFu64;
+        /// let m = 0x3456789ABCDEF012u64;
         ///
-        /// if cfg!(target_endian = "little") {
-        ///     assert_eq!(u64::from_le(n), n)
-        /// } else {
-        ///     assert_eq!(u64::from_le(n), n.swap_bytes())
-        /// }
+        /// assert_eq!(n.rotate_left(12), m);
         /// ```
         #[stable(feature = "rust1", since = "1.0.0")]
         #[inline]
-        pub fn from_le(x: Self) -> Self {
-            if cfg!(target_endian = "little") { x } else { x.swap_bytes() }
+        pub fn rotate_left(self, n: u32) -> Self {
+            // Protect against undefined behaviour for over-long bit shifts
+            let n = n % $BITS;
+            (self << n) | (self >> (($BITS - n) % $BITS))
         }
 
-        /// Converts `self` to big endian from the target's endianness.
+        /// Shifts the bits to the right by a specified amount, `n`,
+        /// wrapping the truncated bits to the beginning of the resulting
+        /// integer.
         ///
-        /// On big endian this is a no-op. On little endian the bytes are
-        /// swapped.
+        /// Please note this isn't the same operation as `>>`!
         ///
         /// # Examples
         ///
         /// Basic usage:
         ///
+        /// Please note that this example is shared between integer types.
+        /// Which explains why `u64` is used here.
+        ///
         /// ```
         /// let n = 0x0123456789ABCDEFu64;
+        /// let m = 0xDEF0123456789ABCu64;
         ///
-        /// if cfg!(target_endian = "big") {
-        ///     assert_eq!(n.to_be(), n)
-        /// } else {
-        ///     assert_eq!(n.to_be(), n.swap_bytes())
-        /// }
+        /// assert_eq!(n.rotate_right(12), m);
         /// ```
         #[stable(feature = "rust1", since = "1.0.0")]
         #[inline]
-        pub fn to_be(self) -> Self { // or not to be?
-            if cfg!(target_endian = "big") { self } else { self.swap_bytes() }
+        pub fn rotate_right(self, n: u32) -> Self {
+            // Protect against undefined behaviour for over-long bit shifts
+            let n = n % $BITS;
+            (self >> n) | (self << (($BITS - n) % $BITS))
         }
 
-        /// Converts `self` to little endian from the target's endianness.
-        ///
-        /// On little endian this is a no-op. On big endian the bytes are
-        /// swapped.
+        /// Reverses the byte order of the integer.
         ///
         /// # Examples
         ///
         /// Basic usage:
         ///
-        /// ```
-        /// let n = 0x0123456789ABCDEFu64;
+        /// Please note that this example is shared between integer types.
+        /// Which explains why `u16` is used here.
         ///
-        /// if cfg!(target_endian = "little") {
-        ///     assert_eq!(n.to_le(), n)
-        /// } else {
-        ///     assert_eq!(n.to_le(), n.swap_bytes())
-        /// }
         /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn to_le(self) -> Self {
-            if cfg!(target_endian = "little") { self } else { self.swap_bytes() }
-        }
-
-        /// Checked integer addition. Computes `self + rhs`, returning `None`
-        /// if overflow occurred.
-        ///
-        /// # Examples
+        /// let n: u16 = 0b0000000_01010101;
+        /// assert_eq!(n, 85);
         ///
-        /// Basic usage:
+        /// let m = n.swap_bytes();
         ///
-        /// ```
-        /// assert_eq!(5u16.checked_add(65530), Some(65535));
-        /// assert_eq!(6u16.checked_add(65530), None);
+        /// assert_eq!(m, 0b01010101_00000000);
+        /// assert_eq!(m, 21760);
         /// ```
         #[stable(feature = "rust1", since = "1.0.0")]
         #[inline]
-        pub fn checked_add(self, rhs: Self) -> Option<Self> {
-            let (a, b) = self.overflowing_add(rhs);
-            if b {None} else {Some(a)}
+        pub fn swap_bytes(self) -> Self {
+            unsafe { intrinsics::bswap(self as $ActualT) as Self }
         }
 
-        /// Checked integer subtraction. Computes `self - rhs`, returning
-        /// `None` if overflow occurred.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(1u8.checked_sub(1), Some(0));
-        /// assert_eq!(0u8.checked_sub(1), None);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn checked_sub(self, rhs: Self) -> Option<Self> {
-            let (a, b) = self.overflowing_sub(rhs);
-            if b {None} else {Some(a)}
+        doc_comment! {
+            concat!("Converts an integer from big endian to the target's endianness.
+
+On big endian this is a no-op. On little endian the bytes are
+swapped.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "let n = 0x1A", stringify!($SelfT), ";
+
+if cfg!(target_endian = \"big\") {
+    assert_eq!(", stringify!($SelfT), "::from_be(n), n)
+} else {
+    assert_eq!(", stringify!($SelfT), "::from_be(n), n.swap_bytes())
+}", $EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn from_be(x: Self) -> Self {
+                if cfg!(target_endian = "big") { x } else { x.swap_bytes() }
+            }
         }
 
-        /// Checked integer multiplication. Computes `self * rhs`, returning
-        /// `None` if overflow occurred.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(5u8.checked_mul(51), Some(255));
-        /// assert_eq!(5u8.checked_mul(52), None);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn checked_mul(self, rhs: Self) -> Option<Self> {
-            let (a, b) = self.overflowing_mul(rhs);
-            if b {None} else {Some(a)}
+        doc_comment! {
+            concat!("Converts an integer from little endian to the target's endianness.
+
+On little endian this is a no-op. On big endian the bytes are
+swapped.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "let n = 0x1A", stringify!($SelfT), ";
+
+if cfg!(target_endian = \"little\") {
+    assert_eq!(", stringify!($SelfT), "::from_le(n), n)
+} else {
+    assert_eq!(", stringify!($SelfT), "::from_le(n), n.swap_bytes())
+}", $EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn from_le(x: Self) -> Self {
+                if cfg!(target_endian = "little") { x } else { x.swap_bytes() }
+            }
         }
 
-        /// Checked integer division. Computes `self / rhs`, returning `None`
-        /// if `rhs == 0`.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(128u8.checked_div(2), Some(64));
-        /// assert_eq!(1u8.checked_div(0), None);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn checked_div(self, rhs: Self) -> Option<Self> {
-            match rhs {
-                0 => None,
-                rhs => Some(unsafe { intrinsics::unchecked_div(self, rhs) }),
+        doc_comment! {
+            concat!("Converts `self` to big endian from the target's endianness.
+
+On big endian this is a no-op. On little endian the bytes are
+swapped.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "let n = 0x1A", stringify!($SelfT), ";
+
+if cfg!(target_endian = \"big\") {
+    assert_eq!(n.to_be(), n)
+} else {
+    assert_eq!(n.to_be(), n.swap_bytes())
+}", $EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn to_be(self) -> Self { // or not to be?
+                if cfg!(target_endian = "big") { self } else { self.swap_bytes() }
             }
         }
 
-        /// Checked integer remainder. Computes `self % rhs`, returning `None`
-        /// if `rhs == 0`.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(5u32.checked_rem(2), Some(1));
-        /// assert_eq!(5u32.checked_rem(0), None);
-        /// ```
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        #[inline]
-        pub fn checked_rem(self, rhs: Self) -> Option<Self> {
-            if rhs == 0 {
-                None
-            } else {
-                Some(unsafe { intrinsics::unchecked_rem(self, rhs) })
+        doc_comment! {
+            concat!("Converts `self` to little endian from the target's endianness.
+
+On little endian this is a no-op. On big endian the bytes are
+swapped.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "let n = 0x1A", stringify!($SelfT), ";
+
+if cfg!(target_endian = \"little\") {
+    assert_eq!(n.to_le(), n)
+} else {
+    assert_eq!(n.to_le(), n.swap_bytes())
+}", $EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn to_le(self) -> Self {
+                if cfg!(target_endian = "little") { self } else { self.swap_bytes() }
             }
         }
 
-        /// Checked negation. Computes `-self`, returning `None` unless `self ==
-        /// 0`.
-        ///
-        /// Note that negating any positive integer will overflow.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(0u32.checked_neg(), Some(0));
-        /// assert_eq!(1u32.checked_neg(), None);
-        /// ```
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        #[inline]
-        pub fn checked_neg(self) -> Option<Self> {
-            let (a, b) = self.overflowing_neg();
-            if b {None} else {Some(a)}
+        doc_comment! {
+            concat!("Checked integer addition. Computes `self + rhs`, returning `None`
+if overflow occurred.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!((", stringify!($SelfT), "::max_value() - 2).checked_add(1), ",
+"Some(", stringify!($SelfT), "::max_value() - 1));
+assert_eq!((", stringify!($SelfT), "::max_value() - 2).checked_add(3),None);", $EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn checked_add(self, rhs: Self) -> Option<Self> {
+                let (a, b) = self.overflowing_add(rhs);
+                if b {None} else {Some(a)}
+            }
         }
 
-        /// Checked shift left. Computes `self << rhs`, returning `None`
-        /// if `rhs` is larger than or equal to the number of bits in `self`.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(0x10u32.checked_shl(4), Some(0x100));
-        /// assert_eq!(0x10u32.checked_shl(33), None);
-        /// ```
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        #[inline]
-        pub fn checked_shl(self, rhs: u32) -> Option<Self> {
-            let (a, b) = self.overflowing_shl(rhs);
-            if b {None} else {Some(a)}
+        doc_comment! {
+            concat!("Checked integer subtraction. Computes `self - rhs`, returning
+`None` if overflow occurred.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(1", stringify!($SelfT), ".checked_sub(1), Some(0));
+assert_eq!(0", stringify!($SelfT), ".checked_sub(1), None);", $EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn checked_sub(self, rhs: Self) -> Option<Self> {
+                let (a, b) = self.overflowing_sub(rhs);
+                if b {None} else {Some(a)}
+            }
         }
 
-        /// Checked shift right. Computes `self >> rhs`, returning `None`
-        /// if `rhs` is larger than or equal to the number of bits in `self`.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(0x10u32.checked_shr(4), Some(0x1));
-        /// assert_eq!(0x10u32.checked_shr(33), None);
-        /// ```
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        #[inline]
-        pub fn checked_shr(self, rhs: u32) -> Option<Self> {
-            let (a, b) = self.overflowing_shr(rhs);
-            if b {None} else {Some(a)}
+        doc_comment! {
+            concat!("Checked integer multiplication. Computes `self * rhs`, returning
+`None` if overflow occurred.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(5", stringify!($SelfT), ".checked_mul(1), Some(5));
+assert_eq!(", stringify!($SelfT), "::max_value().checked_mul(2), None);", $EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn checked_mul(self, rhs: Self) -> Option<Self> {
+                let (a, b) = self.overflowing_mul(rhs);
+                if b {None} else {Some(a)}
+            }
         }
 
-        /// Saturating integer addition. Computes `self + rhs`, saturating at
-        /// the numeric bounds instead of overflowing.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(100u8.saturating_add(1), 101);
-        /// assert_eq!(200u8.saturating_add(127), 255);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn saturating_add(self, rhs: Self) -> Self {
-            match self.checked_add(rhs) {
-                Some(x) => x,
-                None => Self::max_value(),
+        doc_comment! {
+            concat!("Checked integer division. Computes `self / rhs`, returning `None`
+if `rhs == 0`.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(128", stringify!($SelfT), ".checked_div(2), Some(64));
+assert_eq!(1", stringify!($SelfT), ".checked_div(0), None);", $EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn checked_div(self, rhs: Self) -> Option<Self> {
+                match rhs {
+                    0 => None,
+                    rhs => Some(unsafe { intrinsics::unchecked_div(self, rhs) }),
+                }
             }
         }
 
-        /// Saturating integer subtraction. Computes `self - rhs`, saturating
-        /// at the numeric bounds instead of overflowing.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(100u8.saturating_sub(27), 73);
-        /// assert_eq!(13u8.saturating_sub(127), 0);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn saturating_sub(self, rhs: Self) -> Self {
-            match self.checked_sub(rhs) {
-                Some(x) => x,
-                None => Self::min_value(),
+        doc_comment! {
+            concat!("Checked integer remainder. Computes `self % rhs`, returning `None`
+if `rhs == 0`.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(5", stringify!($SelfT), ".checked_rem(2), Some(1));
+assert_eq!(5", stringify!($SelfT), ".checked_rem(0), None);", $EndFeature, "
+```"),
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            #[inline]
+            pub fn checked_rem(self, rhs: Self) -> Option<Self> {
+                if rhs == 0 {
+                    None
+                } else {
+                    Some(unsafe { intrinsics::unchecked_rem(self, rhs) })
+                }
             }
         }
 
-        /// Saturating integer multiplication. Computes `self * rhs`,
-        /// saturating at the numeric bounds instead of overflowing.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// use std::u32;
-        ///
-        /// assert_eq!(100u32.saturating_mul(127), 12700);
-        /// assert_eq!((1u32 << 23).saturating_mul(1 << 23), u32::MAX);
-        /// ```
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        #[inline]
-        pub fn saturating_mul(self, rhs: Self) -> Self {
-            self.checked_mul(rhs).unwrap_or(Self::max_value())
+        doc_comment! {
+            concat!("Checked negation. Computes `-self`, returning `None` unless `self ==
+0`.
+
+Note that negating any positive integer will overflow.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(0", stringify!($SelfT), ".checked_neg(), Some(0));
+assert_eq!(1", stringify!($SelfT), ".checked_neg(), None);", $EndFeature, "
+```"),
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            #[inline]
+            pub fn checked_neg(self) -> Option<Self> {
+                let (a, b) = self.overflowing_neg();
+                if b {None} else {Some(a)}
+            }
         }
 
-        /// Wrapping (modular) addition. Computes `self + rhs`,
-        /// wrapping around at the boundary of the type.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(200u8.wrapping_add(55), 255);
-        /// assert_eq!(200u8.wrapping_add(155), 99);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn wrapping_add(self, rhs: Self) -> Self {
-            unsafe {
-                intrinsics::overflowing_add(self, rhs)
+        doc_comment! {
+            concat!("Checked shift left. Computes `self << rhs`, returning `None`
+if `rhs` is larger than or equal to the number of bits in `self`.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(0x1", stringify!($SelfT), ".checked_shl(4), Some(0x10));
+assert_eq!(0x10", stringify!($SelfT), ".checked_shl(129), None);", $EndFeature, "
+```"),
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            #[inline]
+            pub fn checked_shl(self, rhs: u32) -> Option<Self> {
+                let (a, b) = self.overflowing_shl(rhs);
+                if b {None} else {Some(a)}
             }
         }
 
-        /// Wrapping (modular) subtraction. Computes `self - rhs`,
-        /// wrapping around at the boundary of the type.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(100u8.wrapping_sub(100), 0);
-        /// assert_eq!(100u8.wrapping_sub(155), 201);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn wrapping_sub(self, rhs: Self) -> Self {
-            unsafe {
-                intrinsics::overflowing_sub(self, rhs)
+        doc_comment! {
+            concat!("Checked shift right. Computes `self >> rhs`, returning `None`
+if `rhs` is larger than or equal to the number of bits in `self`.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(0x10", stringify!($SelfT), ".checked_shr(4), Some(0x1));
+assert_eq!(0x10", stringify!($SelfT), ".checked_shr(129), None);", $EndFeature, "
+```"),
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            #[inline]
+            pub fn checked_shr(self, rhs: u32) -> Option<Self> {
+                let (a, b) = self.overflowing_shr(rhs);
+                if b {None} else {Some(a)}
+            }
+        }
+
+        doc_comment! {
+            concat!("Saturating integer addition. Computes `self + rhs`, saturating at
+the numeric bounds instead of overflowing.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(100", stringify!($SelfT), ".saturating_add(1), 101);
+assert_eq!(200u8.saturating_add(127), 255);", $EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn saturating_add(self, rhs: Self) -> Self {
+                match self.checked_add(rhs) {
+                    Some(x) => x,
+                    None => Self::max_value(),
+                }
+            }
+        }
+
+        doc_comment! {
+            concat!("Saturating integer subtraction. Computes `self - rhs`, saturating
+at the numeric bounds instead of overflowing.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(100", stringify!($SelfT), ".saturating_sub(27), 73);
+assert_eq!(13", stringify!($SelfT), ".saturating_sub(127), 0);", $EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn saturating_sub(self, rhs: Self) -> Self {
+                match self.checked_sub(rhs) {
+                    Some(x) => x,
+                    None => Self::min_value(),
+                }
+            }
+        }
+
+        doc_comment! {
+            concat!("Saturating integer multiplication. Computes `self * rhs`,
+saturating at the numeric bounds instead of overflowing.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "use std::", stringify!($SelfT), ";
+
+assert_eq!(2", stringify!($SelfT), ".saturating_mul(10), 20);
+assert_eq!((", stringify!($SelfT), "::MAX).saturating_mul(10), ", stringify!($SelfT),
+"::MAX);", $EndFeature, "
+```"),
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            #[inline]
+            pub fn saturating_mul(self, rhs: Self) -> Self {
+                self.checked_mul(rhs).unwrap_or(Self::max_value())
+            }
+        }
+
+        doc_comment! {
+            concat!("Wrapping (modular) addition. Computes `self + rhs`,
+wrapping around at the boundary of the type.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(200", stringify!($SelfT), ".wrapping_add(55), 255);
+assert_eq!(200", stringify!($SelfT), ".wrapping_add(", stringify!($SelfT), "::max_value()), 199);",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn wrapping_add(self, rhs: Self) -> Self {
+                unsafe {
+                    intrinsics::overflowing_add(self, rhs)
+                }
+            }
+        }
+
+        doc_comment! {
+            concat!("Wrapping (modular) subtraction. Computes `self - rhs`,
+wrapping around at the boundary of the type.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(100", stringify!($SelfT), ".wrapping_sub(100), 0);
+assert_eq!(100", stringify!($SelfT), ".wrapping_sub(", stringify!($SelfT), "::max_value()), 101);",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn wrapping_sub(self, rhs: Self) -> Self {
+                unsafe {
+                    intrinsics::overflowing_sub(self, rhs)
+                }
             }
         }
 
@@ -1807,6 +2004,9 @@ pub fn wrapping_sub(self, rhs: Self) -> Self {
         ///
         /// Basic usage:
         ///
+        /// Please note that this example is shared between integer types.
+        /// Which explains why `u8` is used here.
+        ///
         /// ```
         /// assert_eq!(10u8.wrapping_mul(12), 120);
         /// assert_eq!(25u8.wrapping_mul(12), 44);
@@ -1819,43 +2019,47 @@ pub fn wrapping_mul(self, rhs: Self) -> Self {
             }
         }
 
-        /// Wrapping (modular) division. Computes `self / rhs`.
-        /// Wrapped division on unsigned types is just normal division.
-        /// There's no way wrapping could ever happen.
-        /// This function exists, so that all operations
-        /// are accounted for in the wrapping operations.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(100u8.wrapping_div(10), 10);
-        /// ```
-        #[stable(feature = "num_wrapping", since = "1.2.0")]
-        #[inline]
-        pub fn wrapping_div(self, rhs: Self) -> Self {
-            self / rhs
+        doc_comment! {
+            concat!("Wrapping (modular) division. Computes `self / rhs`.
+Wrapped division on unsigned types is just normal division.
+There's no way wrapping could ever happen.
+This function exists, so that all operations
+are accounted for in the wrapping operations.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(100", stringify!($SelfT), ".wrapping_div(10), 10);", $EndFeature, "
+```"),
+            #[stable(feature = "num_wrapping", since = "1.2.0")]
+            #[inline]
+            pub fn wrapping_div(self, rhs: Self) -> Self {
+                self / rhs
+            }
         }
 
-        /// Wrapping (modular) remainder. Computes `self % rhs`.
-        /// Wrapped remainder calculation on unsigned types is
-        /// just the regular remainder calculation.
-        /// There's no way wrapping could ever happen.
-        /// This function exists, so that all operations
-        /// are accounted for in the wrapping operations.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(100u8.wrapping_rem(10), 0);
-        /// ```
-        #[stable(feature = "num_wrapping", since = "1.2.0")]
-        #[inline]
-        pub fn wrapping_rem(self, rhs: Self) -> Self {
-            self % rhs
+        doc_comment! {
+            concat!("Wrapping (modular) remainder. Computes `self % rhs`.
+Wrapped remainder calculation on unsigned types is
+just the regular remainder calculation.
+There's no way wrapping could ever happen.
+This function exists, so that all operations
+are accounted for in the wrapping operations.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(100", stringify!($SelfT), ".wrapping_rem(10), 0);", $EndFeature, "
+```"),
+            #[stable(feature = "num_wrapping", since = "1.2.0")]
+            #[inline]
+            pub fn wrapping_rem(self, rhs: Self) -> Self {
+                self % rhs
+            }
         }
 
         /// Wrapping (modular) negation. Computes `-self`,
@@ -1872,11 +2076,12 @@ pub fn wrapping_rem(self, rhs: Self) -> Self {
         ///
         /// Basic usage:
         ///
+        /// Please note that this example is shared between integer types.
+        /// Which explains why `i8` is used here.
+        ///
         /// ```
-        /// assert_eq!(100u8.wrapping_neg(), 156);
-        /// assert_eq!(0u8.wrapping_neg(), 0);
-        /// assert_eq!(180u8.wrapping_neg(), 76);
-        /// assert_eq!(180u8.wrapping_neg(), (127 + 1) - (180u8 - (127 + 1)));
+        /// assert_eq!(100i8.wrapping_neg(), -100);
+        /// assert_eq!((-128i8).wrapping_neg(), -128);
         /// ```
         #[stable(feature = "num_wrapping", since = "1.2.0")]
         #[inline]
@@ -1884,110 +2089,119 @@ pub fn wrapping_neg(self) -> Self {
             self.overflowing_neg().0
         }
 
-        /// Panic-free bitwise shift-left; yields `self << mask(rhs)`,
-        /// where `mask` removes any high-order bits of `rhs` that
-        /// would cause the shift to exceed the bitwidth of the type.
-        ///
-        /// Note that this is *not* the same as a rotate-left; the
-        /// RHS of a wrapping shift-left is restricted to the range
-        /// of the type, rather than the bits shifted out of the LHS
-        /// being returned to the other end. The primitive integer
-        /// types all implement a `rotate_left` function, which may
-        /// be what you want instead.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(1u8.wrapping_shl(7), 128);
-        /// assert_eq!(1u8.wrapping_shl(8), 1);
-        /// ```
-        #[stable(feature = "num_wrapping", since = "1.2.0")]
-        #[inline]
-        pub fn wrapping_shl(self, rhs: u32) -> Self {
-            unsafe {
-                intrinsics::unchecked_shl(self, (rhs & ($BITS - 1)) as $SelfT)
+        doc_comment! {
+            concat!("Panic-free bitwise shift-left; yields `self << mask(rhs)`,
+where `mask` removes any high-order bits of `rhs` that
+would cause the shift to exceed the bitwidth of the type.
+
+Note that this is *not* the same as a rotate-left; the
+RHS of a wrapping shift-left is restricted to the range
+of the type, rather than the bits shifted out of the LHS
+being returned to the other end. The primitive integer
+types all implement a `rotate_left` function, which may
+be what you want instead.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(1", stringify!($SelfT), ".wrapping_shl(7), 128);
+assert_eq!(1", stringify!($SelfT), ".wrapping_shl(128), 1);", $EndFeature, "
+```"),
+            #[stable(feature = "num_wrapping", since = "1.2.0")]
+            #[inline]
+            pub fn wrapping_shl(self, rhs: u32) -> Self {
+                unsafe {
+                    intrinsics::unchecked_shl(self, (rhs & ($BITS - 1)) as $SelfT)
+                }
             }
         }
 
-        /// Panic-free bitwise shift-right; yields `self >> mask(rhs)`,
-        /// where `mask` removes any high-order bits of `rhs` that
-        /// would cause the shift to exceed the bitwidth of the type.
-        ///
-        /// Note that this is *not* the same as a rotate-right; the
-        /// RHS of a wrapping shift-right is restricted to the range
-        /// of the type, rather than the bits shifted out of the LHS
-        /// being returned to the other end. The primitive integer
-        /// types all implement a `rotate_right` function, which may
-        /// be what you want instead.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(128u8.wrapping_shr(7), 1);
-        /// assert_eq!(128u8.wrapping_shr(8), 128);
-        /// ```
-        #[stable(feature = "num_wrapping", since = "1.2.0")]
-        #[inline]
-        pub fn wrapping_shr(self, rhs: u32) -> Self {
-            unsafe {
-                intrinsics::unchecked_shr(self, (rhs & ($BITS - 1)) as $SelfT)
+        doc_comment! {
+            concat!("Panic-free bitwise shift-right; yields `self >> mask(rhs)`,
+where `mask` removes any high-order bits of `rhs` that
+would cause the shift to exceed the bitwidth of the type.
+
+Note that this is *not* the same as a rotate-right; the
+RHS of a wrapping shift-right is restricted to the range
+of the type, rather than the bits shifted out of the LHS
+being returned to the other end. The primitive integer
+types all implement a `rotate_right` function, which may
+be what you want instead.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(128", stringify!($SelfT), ".wrapping_shr(7), 1);
+assert_eq!(128", stringify!($SelfT), ".wrapping_shr(128), 128);", $EndFeature, "
+```"),
+            #[stable(feature = "num_wrapping", since = "1.2.0")]
+            #[inline]
+            pub fn wrapping_shr(self, rhs: u32) -> Self {
+                unsafe {
+                    intrinsics::unchecked_shr(self, (rhs & ($BITS - 1)) as $SelfT)
+                }
             }
         }
 
-        /// Calculates `self` + `rhs`
-        ///
-        /// Returns a tuple of the addition along with a boolean indicating
-        /// whether an arithmetic overflow would occur. If an overflow would
-        /// have occurred then the wrapped value is returned.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage
-        ///
-        /// ```
-        /// use std::u32;
-        ///
-        /// assert_eq!(5u32.overflowing_add(2), (7, false));
-        /// assert_eq!(u32::MAX.overflowing_add(1), (0, true));
-        /// ```
-        #[inline]
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        pub fn overflowing_add(self, rhs: Self) -> (Self, bool) {
-            let (a, b) = unsafe {
-                intrinsics::add_with_overflow(self as $ActualT,
-                                              rhs as $ActualT)
-            };
-            (a as Self, b)
+        doc_comment! {
+            concat!("Calculates `self` + `rhs`
+
+Returns a tuple of the addition along with a boolean indicating
+whether an arithmetic overflow would occur. If an overflow would
+have occurred then the wrapped value is returned.
+
+# Examples
+
+Basic usage
+
+```
+", $Feature, "use std::", stringify!($SelfT), ";
+
+assert_eq!(5", stringify!($SelfT), ".overflowing_add(2), (7, false));
+assert_eq!(", stringify!($SelfT), "::MAX.overflowing_add(1), (0, true));", $EndFeature, "
+```"),
+            #[inline]
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            pub fn overflowing_add(self, rhs: Self) -> (Self, bool) {
+                let (a, b) = unsafe {
+                    intrinsics::add_with_overflow(self as $ActualT,
+                                                  rhs as $ActualT)
+                };
+                (a as Self, b)
+            }
         }
 
-        /// Calculates `self` - `rhs`
-        ///
-        /// Returns a tuple of the subtraction along with a boolean indicating
-        /// whether an arithmetic overflow would occur. If an overflow would
-        /// have occurred then the wrapped value is returned.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage
-        ///
-        /// ```
-        /// use std::u32;
-        ///
-        /// assert_eq!(5u32.overflowing_sub(2), (3, false));
-        /// assert_eq!(0u32.overflowing_sub(1), (u32::MAX, true));
-        /// ```
-        #[inline]
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        pub fn overflowing_sub(self, rhs: Self) -> (Self, bool) {
-            let (a, b) = unsafe {
-                intrinsics::sub_with_overflow(self as $ActualT,
-                                              rhs as $ActualT)
-            };
-            (a as Self, b)
+        doc_comment! {
+            concat!("Calculates `self` - `rhs`
+
+Returns a tuple of the subtraction along with a boolean indicating
+whether an arithmetic overflow would occur. If an overflow would
+have occurred then the wrapped value is returned.
+
+# Examples
+
+Basic usage
+
+```
+", $Feature, "use std::", stringify!($SelfT), ";
+
+assert_eq!(5", stringify!($SelfT), ".overflowing_sub(2), (3, false));
+assert_eq!(0", stringify!($SelfT), ".overflowing_sub(1), (", stringify!($SelfT), "::MAX, true));",
+$EndFeature, "
+```"),
+            #[inline]
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            pub fn overflowing_sub(self, rhs: Self) -> (Self, bool) {
+                let (a, b) = unsafe {
+                    intrinsics::sub_with_overflow(self as $ActualT,
+                                                  rhs as $ActualT)
+                };
+                (a as Self, b)
+            }
         }
 
         /// Calculates the multiplication of `self` and `rhs`.
@@ -1998,7 +2212,10 @@ pub fn overflowing_sub(self, rhs: Self) -> (Self, bool) {
         ///
         /// # Examples
         ///
-        /// Basic usage
+        /// Basic usage:
+        ///
+        /// Please note that this example is shared between integer types.
+        /// Which explains why `u32` is used here.
         ///
         /// ```
         /// assert_eq!(5u32.overflowing_mul(2), (10, false));
@@ -2014,129 +2231,141 @@ pub fn overflowing_mul(self, rhs: Self) -> (Self, bool) {
             (a as Self, b)
         }
 
-        /// Calculates the divisor when `self` is divided by `rhs`.
-        ///
-        /// Returns a tuple of the divisor along with a boolean indicating
-        /// whether an arithmetic overflow would occur. Note that for unsigned
-        /// integers overflow never occurs, so the second value is always
-        /// `false`.
-        ///
-        /// # Panics
-        ///
-        /// This function will panic if `rhs` is 0.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage
-        ///
-        /// ```
-        /// assert_eq!(5u32.overflowing_div(2), (2, false));
-        /// ```
-        #[inline]
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        pub fn overflowing_div(self, rhs: Self) -> (Self, bool) {
-            (self / rhs, false)
+        doc_comment! {
+            concat!("Calculates the divisor when `self` is divided by `rhs`.
+
+Returns a tuple of the divisor along with a boolean indicating
+whether an arithmetic overflow would occur. Note that for unsigned
+integers overflow never occurs, so the second value is always
+`false`.
+
+# Panics
+
+This function will panic if `rhs` is 0.
+
+# Examples
+
+Basic usage
+
+```
+", $Feature, "assert_eq!(5", stringify!($SelfT), ".overflowing_div(2), (2, false));", $EndFeature, "
+```"),
+            #[inline]
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            pub fn overflowing_div(self, rhs: Self) -> (Self, bool) {
+                (self / rhs, false)
+            }
         }
 
-        /// Calculates the remainder when `self` is divided by `rhs`.
-        ///
-        /// Returns a tuple of the remainder after dividing along with a boolean
-        /// indicating whether an arithmetic overflow would occur. Note that for
-        /// unsigned integers overflow never occurs, so the second value is
-        /// always `false`.
-        ///
-        /// # Panics
-        ///
-        /// This function will panic if `rhs` is 0.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage
-        ///
-        /// ```
-        /// assert_eq!(5u32.overflowing_rem(2), (1, false));
-        /// ```
-        #[inline]
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        pub fn overflowing_rem(self, rhs: Self) -> (Self, bool) {
-            (self % rhs, false)
+        doc_comment! {
+            concat!("Calculates the remainder when `self` is divided by `rhs`.
+
+Returns a tuple of the remainder after dividing along with a boolean
+indicating whether an arithmetic overflow would occur. Note that for
+unsigned integers overflow never occurs, so the second value is
+always `false`.
+
+# Panics
+
+This function will panic if `rhs` is 0.
+
+# Examples
+
+Basic usage
+
+```
+", $Feature, "assert_eq!(5", stringify!($SelfT), ".overflowing_rem(2), (1, false));", $EndFeature, "
+```"),
+            #[inline]
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            pub fn overflowing_rem(self, rhs: Self) -> (Self, bool) {
+                (self % rhs, false)
+            }
         }
 
-        /// Negates self in an overflowing fashion.
-        ///
-        /// Returns `!self + 1` using wrapping operations to return the value
-        /// that represents the negation of this unsigned value. Note that for
-        /// positive unsigned values overflow always occurs, but negating 0 does
-        /// not overflow.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage
-        ///
-        /// ```
-        /// assert_eq!(0u32.overflowing_neg(), (0, false));
-        /// assert_eq!(2u32.overflowing_neg(), (-2i32 as u32, true));
-        /// ```
-        #[inline]
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        pub fn overflowing_neg(self) -> (Self, bool) {
-            ((!self).wrapping_add(1), self != 0)
+        doc_comment! {
+            concat!("Negates self in an overflowing fashion.
+
+Returns `!self + 1` using wrapping operations to return the value
+that represents the negation of this unsigned value. Note that for
+positive unsigned values overflow always occurs, but negating 0 does
+not overflow.
+
+# Examples
+
+Basic usage
+
+```
+", $Feature, "assert_eq!(0", stringify!($SelfT), ".overflowing_neg(), (0, false));
+assert_eq!(2", stringify!($SelfT), ".overflowing_neg(), (-2i32 as ", stringify!($SelfT),
+", true));", $EndFeature, "
+```"),
+            #[inline]
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            pub fn overflowing_neg(self) -> (Self, bool) {
+                ((!self).wrapping_add(1), self != 0)
+            }
         }
 
-        /// Shifts self left by `rhs` bits.
-        ///
-        /// Returns a tuple of the shifted version of self along with a boolean
-        /// indicating whether the shift value was larger than or equal to the
-        /// number of bits. If the shift value is too large, then value is
-        /// masked (N-1) where N is the number of bits, and this value is then
-        /// used to perform the shift.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage
-        ///
-        /// ```
-        /// assert_eq!(0x10u32.overflowing_shl(4), (0x100, false));
-        /// assert_eq!(0x10u32.overflowing_shl(36), (0x100, true));
-        /// ```
-        #[inline]
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        pub fn overflowing_shl(self, rhs: u32) -> (Self, bool) {
-            (self.wrapping_shl(rhs), (rhs > ($BITS - 1)))
+        doc_comment! {
+            concat!("Shifts self left by `rhs` bits.
+
+Returns a tuple of the shifted version of self along with a boolean
+indicating whether the shift value was larger than or equal to the
+number of bits. If the shift value is too large, then value is
+masked (N-1) where N is the number of bits, and this value is then
+used to perform the shift.
+
+# Examples
+
+Basic usage
+
+```
+", $Feature, "assert_eq!(0x1", stringify!($SelfT), ".overflowing_shl(4), (0x10, false));
+assert_eq!(0x1", stringify!($SelfT), ".overflowing_shl(132), (0x10, true));", $EndFeature, "
+```"),
+            #[inline]
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            pub fn overflowing_shl(self, rhs: u32) -> (Self, bool) {
+                (self.wrapping_shl(rhs), (rhs > ($BITS - 1)))
+            }
         }
 
-        /// Shifts self right by `rhs` bits.
-        ///
-        /// Returns a tuple of the shifted version of self along with a boolean
-        /// indicating whether the shift value was larger than or equal to the
-        /// number of bits. If the shift value is too large, then value is
-        /// masked (N-1) where N is the number of bits, and this value is then
-        /// used to perform the shift.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage
-        ///
-        /// ```
-        /// assert_eq!(0x10u32.overflowing_shr(4), (0x1, false));
-        /// assert_eq!(0x10u32.overflowing_shr(36), (0x1, true));
-        /// ```
-        #[inline]
-        #[stable(feature = "wrapping", since = "1.7.0")]
-        pub fn overflowing_shr(self, rhs: u32) -> (Self, bool) {
-            (self.wrapping_shr(rhs), (rhs > ($BITS - 1)))
+        doc_comment! {
+            concat!("Shifts self right by `rhs` bits.
+
+Returns a tuple of the shifted version of self along with a boolean
+indicating whether the shift value was larger than or equal to the
+number of bits. If the shift value is too large, then value is
+masked (N-1) where N is the number of bits, and this value is then
+used to perform the shift.
+
+# Examples
+
+Basic usage
+
+```
+", $Feature, "assert_eq!(0x10", stringify!($SelfT), ".overflowing_shr(4), (0x1, false));
+assert_eq!(0x10", stringify!($SelfT), ".overflowing_shr(132), (0x1, true));", $EndFeature, "
+```"),
+            #[inline]
+            #[stable(feature = "wrapping", since = "1.7.0")]
+            pub fn overflowing_shr(self, rhs: u32) -> (Self, bool) {
+                (self.wrapping_shr(rhs), (rhs > ($BITS - 1)))
+            }
 
         }
 
-        /// Raises self to the power of `exp`, using exponentiation by squaring.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(2u32.pow(4), 16);
-        /// ```
+        doc_comment! {
+            concat!("Raises self to the power of `exp`, using exponentiation by squaring.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(2", stringify!($SelfT), ".pow(4), 16);", $EndFeature, "
+```"),
         #[stable(feature = "rust1", since = "1.0.0")]
         #[inline]
         #[rustc_inherit_overflow_checks]
@@ -2161,21 +2390,24 @@ pub fn pow(self, mut exp: u32) -> Self {
 
             acc
         }
+    }
 
-        /// Returns `true` if and only if `self == 2^k` for some `k`.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert!(16u8.is_power_of_two());
-        /// assert!(!10u8.is_power_of_two());
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn is_power_of_two(self) -> bool {
-            (self.wrapping_sub(1)) & self == 0 && !(self == 0)
+        doc_comment! {
+            concat!("Returns `true` if and only if `self == 2^k` for some `k`.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert!(16", stringify!($SelfT), ".is_power_of_two());
+assert!(!10", stringify!($SelfT), ".is_power_of_two());", $EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn is_power_of_two(self) -> bool {
+                (self.wrapping_sub(1)) & self == 0 && !(self == 0)
+            }
         }
 
         // Returns one less than next power of two.
@@ -2200,50 +2432,56 @@ fn one_less_than_next_power_of_two(self) -> Self {
             <$SelfT>::max_value() >> z
         }
 
-        /// Returns the smallest power of two greater than or equal to `self`.
-        ///
-        /// When return value overflows (i.e. `self > (1 << (N-1))` for type
-        /// `uN`), it panics in debug mode and return value is wrapped to 0 in
-        /// release mode (the only situation in which method can return 0).
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(2u8.next_power_of_two(), 2);
-        /// assert_eq!(3u8.next_power_of_two(), 4);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        #[inline]
-        pub fn next_power_of_two(self) -> Self {
-            // Call the trait to get overflow checks
-            ops::Add::add(self.one_less_than_next_power_of_two(), 1)
+        doc_comment! {
+            concat!("Returns the smallest power of two greater than or equal to `self`.
+
+When return value overflows (i.e. `self > (1 << (N-1))` for type
+`uN`), it panics in debug mode and return value is wrapped to 0 in
+release mode (the only situation in which method can return 0).
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(2", stringify!($SelfT), ".next_power_of_two(), 2);
+assert_eq!(3", stringify!($SelfT), ".next_power_of_two(), 4);", $EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            #[inline]
+            pub fn next_power_of_two(self) -> Self {
+                // Call the trait to get overflow checks
+                ops::Add::add(self.one_less_than_next_power_of_two(), 1)
+            }
         }
 
-        /// Returns the smallest power of two greater than or equal to `n`. If
-        /// the next power of two is greater than the type's maximum value,
-        /// `None` is returned, otherwise the power of two is wrapped in `Some`.
-        ///
-        /// # Examples
-        ///
-        /// Basic usage:
-        ///
-        /// ```
-        /// assert_eq!(2u8.checked_next_power_of_two(), Some(2));
-        /// assert_eq!(3u8.checked_next_power_of_two(), Some(4));
-        /// assert_eq!(200u8.checked_next_power_of_two(), None);
-        /// ```
-        #[stable(feature = "rust1", since = "1.0.0")]
-        pub fn checked_next_power_of_two(self) -> Option<Self> {
-            self.one_less_than_next_power_of_two().checked_add(1)
+        doc_comment! {
+            concat!("Returns the smallest power of two greater than or equal to `n`. If
+the next power of two is greater than the type's maximum value,
+`None` is returned, otherwise the power of two is wrapped in `Some`.
+
+# Examples
+
+Basic usage:
+
+```
+", $Feature, "assert_eq!(2", stringify!($SelfT),
+".checked_next_power_of_two(), Some(2));
+assert_eq!(3", stringify!($SelfT), ".checked_next_power_of_two(), Some(4));
+assert_eq!(", stringify!($SelfT), "::max_value().checked_next_power_of_two(), None);",
+$EndFeature, "
+```"),
+            #[stable(feature = "rust1", since = "1.0.0")]
+            pub fn checked_next_power_of_two(self) -> Option<Self> {
+                self.one_less_than_next_power_of_two().checked_add(1)
+            }
         }
     }
 }
 
 #[lang = "u8"]
 impl u8 {
-    uint_impl! { u8, u8, 8 }
+    uint_impl! { u8, u8, 8, 255, "", "" }
 
 
     /// Checks if the value is within the ASCII range.
@@ -2789,39 +3027,44 @@ pub fn is_ascii_control(&self) -> bool {
 
 #[lang = "u16"]
 impl u16 {
-    uint_impl! { u16, u16, 16 }
+    uint_impl! { u16, u16, 16, 65535, "", "" }
 }
 
 #[lang = "u32"]
 impl u32 {
-    uint_impl! { u32, u32, 32 }
+    uint_impl! { u32, u32, 32, 4294967295, "", "" }
 }
 
 #[lang = "u64"]
 impl u64 {
-    uint_impl! { u64, u64, 64 }
+    uint_impl! { u64, u64, 64, 18446744073709551615, "", "" }
 }
 
 #[lang = "u128"]
 impl u128 {
-    uint_impl! { u128, u128, 128 }
+    uint_impl! { u128, u128, 128, 340282366920938463463374607431768211455, "#![feature(i128_type)]
+#![feature(i128)]
+
+# fn main() {
+", "
+# }" }
 }
 
 #[cfg(target_pointer_width = "16")]
 #[lang = "usize"]
 impl usize {
-    uint_impl! { usize, u16, 16 }
+    uint_impl! { usize, u16, 16, 65536, "", "" }
 }
 #[cfg(target_pointer_width = "32")]
 #[lang = "usize"]
 impl usize {
-    uint_impl! { usize, u32, 32 }
+    uint_impl! { usize, u32, 32, 4294967295, "", "" }
 }
 
 #[cfg(target_pointer_width = "64")]
 #[lang = "usize"]
 impl usize {
-    uint_impl! { usize, u64, 64 }
+    uint_impl! { usize, u64, 64, 18446744073709551615, "", "" }
 }
 
 /// A classification of floating point numbers.
@@ -2881,7 +3124,7 @@ pub enum FpCategory {
            issue = "32110")]
 pub trait Float: Sized {
     /// Type used by `to_bits` and `from_bits`.
-    #[stable(feature = "core_float_bits", since = "1.24.0")]
+    #[stable(feature = "core_float_bits", since = "1.25.0")]
     type Bits;
 
     /// Returns `true` if this value is NaN and false otherwise.
@@ -2947,10 +3190,10 @@ pub trait Float: Sized {
     fn min(self, other: Self) -> Self;
 
     /// Raw transmutation to integer.
-    #[stable(feature = "core_float_bits", since="1.24.0")]
+    #[stable(feature = "core_float_bits", since="1.25.0")]
     fn to_bits(self) -> Self::Bits;
     /// Raw transmutation from integer.
-    #[stable(feature = "core_float_bits", since="1.24.0")]
+    #[stable(feature = "core_float_bits", since="1.25.0")]
     fn from_bits(v: Self::Bits) -> Self;
 }
 
index 3f573f7c7eb69b73ef38eb69c31e463d3988682d..1d9c0f873b34a2baa51e2b0460d6540345818e7a 100644 (file)
@@ -60,7 +60,7 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
 /// (`start..end`).
 ///
 /// The `Range` `start..end` contains all values with `x >= start` and
-/// `x < end`.
+/// `x < end`.  It is empty unless `start < end`.
 ///
 /// # Examples
 ///
@@ -68,11 +68,11 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
 /// assert_eq!((3..5), std::ops::Range { start: 3, end: 5 });
 /// assert_eq!(3 + 4 + 5, (3..6).sum());
 ///
-/// let arr = [0, 1, 2, 3];
-/// assert_eq!(arr[ .. ], [0,1,2,3]);
-/// assert_eq!(arr[ ..3], [0,1,2  ]);
-/// assert_eq!(arr[1.. ], [  1,2,3]);
-/// assert_eq!(arr[1..3], [  1,2  ]);  // Range
+/// let arr = ['a', 'b', 'c', 'd'];
+/// assert_eq!(arr[ .. ], ['a', 'b', 'c', 'd']);
+/// assert_eq!(arr[ ..3], ['a', 'b', 'c',    ]);
+/// assert_eq!(arr[1.. ], [     'b', 'c', 'd']);
+/// assert_eq!(arr[1..3], [     'b', 'c'     ]);  // Range
 /// ```
 #[derive(Clone, PartialEq, Eq, Hash)]  // not Copy -- see #27186
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -92,7 +92,6 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
-#[unstable(feature = "range_contains", reason = "recently added as per RFC", issue = "32311")]
 impl<Idx: PartialOrd<Idx>> Range<Idx> {
     /// Returns `true` if `item` is contained in the range.
     ///
@@ -109,9 +108,37 @@ impl<Idx: PartialOrd<Idx>> Range<Idx> {
     /// assert!(!(3..3).contains(3));
     /// assert!(!(3..2).contains(3));
     /// ```
+    #[unstable(feature = "range_contains", reason = "recently added as per RFC", issue = "32311")]
     pub fn contains(&self, item: Idx) -> bool {
         (self.start <= item) && (item < self.end)
     }
+
+    /// Returns `true` if the range contains no items.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// #![feature(range_is_empty)]
+    ///
+    /// assert!(!(3..5).is_empty());
+    /// assert!( (3..3).is_empty());
+    /// assert!( (3..2).is_empty());
+    /// ```
+    ///
+    /// The range is empty if either side is incomparable:
+    ///
+    /// ```
+    /// #![feature(range_is_empty,inclusive_range_syntax)]
+    ///
+    /// use std::f32::NAN;
+    /// assert!(!(3.0..5.0).is_empty());
+    /// assert!( (3.0..NAN).is_empty());
+    /// assert!( (NAN..5.0).is_empty());
+    /// ```
+    #[unstable(feature = "range_is_empty", reason = "recently added", issue = "48111")]
+    pub fn is_empty(&self) -> bool {
+        !(self.start < self.end)
+    }
 }
 
 /// A range only bounded inclusively below (`start..`).
@@ -244,7 +271,14 @@ pub fn contains(&self, item: Idx) -> bool {
 /// An range bounded inclusively below and above (`start..=end`).
 ///
 /// The `RangeInclusive` `start..=end` contains all values with `x >= start`
-/// and `x <= end`.
+/// and `x <= end`.  It is empty unless `start <= end`.
+///
+/// This iterator is [fused], but the specific values of `start` and `end` after
+/// iteration has finished are **unspecified** other than that [`.is_empty()`]
+/// will return `true` once no more values will be produced.
+///
+/// [fused]: ../iter/trait.FusedIterator.html
+/// [`.is_empty()`]: #method.is_empty
 ///
 /// # Examples
 ///
@@ -280,7 +314,6 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
-#[unstable(feature = "range_contains", reason = "recently added as per RFC", issue = "32311")]
 impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
     /// Returns `true` if `item` is contained in the range.
     ///
@@ -298,9 +331,48 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
     /// assert!( (3..=3).contains(3));
     /// assert!(!(3..=2).contains(3));
     /// ```
+    #[unstable(feature = "range_contains", reason = "recently added as per RFC", issue = "32311")]
     pub fn contains(&self, item: Idx) -> bool {
         self.start <= item && item <= self.end
     }
+
+    /// Returns `true` if the range contains no items.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// #![feature(range_is_empty,inclusive_range_syntax)]
+    ///
+    /// assert!(!(3..=5).is_empty());
+    /// assert!(!(3..=3).is_empty());
+    /// assert!( (3..=2).is_empty());
+    /// ```
+    ///
+    /// The range is empty if either side is incomparable:
+    ///
+    /// ```
+    /// #![feature(range_is_empty,inclusive_range_syntax)]
+    ///
+    /// use std::f32::NAN;
+    /// assert!(!(3.0..=5.0).is_empty());
+    /// assert!( (3.0..=NAN).is_empty());
+    /// assert!( (NAN..=5.0).is_empty());
+    /// ```
+    ///
+    /// This method returns `true` after iteration has finished:
+    ///
+    /// ```
+    /// #![feature(range_is_empty,inclusive_range_syntax)]
+    ///
+    /// let mut r = 3..=5;
+    /// for _ in r.by_ref() {}
+    /// // Precise field values are unspecified here
+    /// assert!(r.is_empty());
+    /// ```
+    #[unstable(feature = "range_is_empty", reason = "recently added", issue = "48111")]
+    pub fn is_empty(&self) -> bool {
+        !(self.start <= self.end)
+    }
 }
 
 /// A range only bounded inclusively above (`..=end`).
index 3d84e910fe662d0de5873d267b8fbda362584038..b266771b818e5b71d5627ba3f4641216e402359a 100644 (file)
@@ -2573,7 +2573,7 @@ fn clone(&self) -> Self {
 #[stable(feature = "nonnull", since = "1.25.0")]
 impl<T: ?Sized> Copy for NonNull<T> { }
 
-#[stable(feature = "nonnull", since = "1.25.0")]
+#[unstable(feature = "coerce_unsized", issue = "27732")]
 impl<T: ?Sized, U: ?Sized> CoerceUnsized<NonNull<U>> for NonNull<T> where T: Unsize<U> { }
 
 #[stable(feature = "nonnull", since = "1.25.0")]
@@ -2621,7 +2621,7 @@ fn hash<H: hash::Hasher>(&self, state: &mut H) {
     }
 }
 
-#[stable(feature = "nonnull", since = "1.25.0")]
+#[unstable(feature = "ptr_internals", issue = "0")]
 impl<T: ?Sized> From<Unique<T>> for NonNull<T> {
     fn from(unique: Unique<T>) -> Self {
         NonNull { pointer: unique.pointer }
index aacbbd5058e05c23ce194e4659be2f6b090d543d..ac390313a6797a8e9470efe0d9de8ff7e372134f 100644 (file)
@@ -1246,15 +1246,18 @@ fn position<P>(&mut self, mut predicate: P) -> Option<usize> where
             {
                 // The addition might panic on overflow
                 // Use the len of the slice to hint optimizer to remove result index bounds check.
-                let n = make_slice!(self.ptr, self.end).len();
+                let _n = make_slice!(self.ptr, self.end).len();
                 self.try_fold(0, move |i, x| {
                     if predicate(x) { Err(i) }
                     else { Ok(i + 1) }
                 }).err()
-                    .map(|i| {
-                        unsafe { assume(i < n) };
-                        i
-                    })
+                    // // FIXME(#48116/#45964):
+                    // // This assume() causes misoptimization on LLVM 6.
+                    // // Commented out until it is fixed again.
+                    // .map(|i| {
+                    //     unsafe { assume(i < n) };
+                    //     i
+                    // })
             }
 
             #[inline]
@@ -1271,10 +1274,13 @@ fn rposition<P>(&mut self, mut predicate: P) -> Option<usize> where
                     if predicate(x) { Err(i) }
                     else { Ok(i) }
                 }).err()
-                    .map(|i| {
-                        unsafe { assume(i < n) };
-                        i
-                    })
+                    // // FIXME(#48116/#45964):
+                    // // This assume() causes misoptimization on LLVM 6.
+                    // // Commented out until it is fixed again.
+                    // .map(|i| {
+                    //     unsafe { assume(i < n) };
+                    //     i
+                    // })
             }
         }
 
index 089d691773a1bcf94a6b1ab31407006cb022e9ee..95bb8f18947ec842a5a92ff107e4fb63b550f9b5 100644 (file)
@@ -324,7 +324,7 @@ fn next_match(&mut self) -> Option<(usize, usize)> {
                 // the second byte when searching for the third.
                 //
                 // However, this is totally okay. While we have the invariant that
-                // self.finger is on a UTF8 boundary, this invariant is not relid upon
+                // self.finger is on a UTF8 boundary, this invariant is not relied upon
                 // within this method (it is relied upon in CharSearcher::next()).
                 //
                 // We only exit this method when we reach the end of the string, or if we
index f22862ae701903457c177c9e1737325d8fd22592..25827edee7d9343c0719fc30c4ebad784c35992e 100644 (file)
 /// Save power or switch hyperthreads in a busy-wait spin-loop.
 ///
 /// This function is deliberately more primitive than
-/// `std::thread::yield_now` and does not directly yield to the
-/// system's scheduler.  In some cases it might be useful to use a
-/// combination of both functions.  Careful benchmarking is advised.
+/// [`std::thread::yield_now`](../../../std/thread/fn.yield_now.html) and
+/// does not directly yield to the system's scheduler.
+/// In some cases it might be useful to use a combination of both functions.
+/// Careful benchmarking is advised.
 ///
 /// On some platforms this function may not do anything at all.
 #[inline]
index b2a5243d5e67b86f7e449e380a93aacdd1c8aea5..f91c919d7447d6111d258a79532d6ef8fd8c29e1 100644 (file)
@@ -1322,42 +1322,84 @@ fn test_range() {
                (isize::MAX as usize + 2, Some(isize::MAX as usize + 2)));
 }
 
+#[test]
+fn test_range_exhaustion() {
+    let mut r = 10..10;
+    assert!(r.is_empty());
+    assert_eq!(r.next(), None);
+    assert_eq!(r.next_back(), None);
+    assert_eq!(r, 10..10);
+
+    let mut r = 10..12;
+    assert_eq!(r.next(), Some(10));
+    assert_eq!(r.next(), Some(11));
+    assert!(r.is_empty());
+    assert_eq!(r, 12..12);
+    assert_eq!(r.next(), None);
+
+    let mut r = 10..12;
+    assert_eq!(r.next_back(), Some(11));
+    assert_eq!(r.next_back(), Some(10));
+    assert!(r.is_empty());
+    assert_eq!(r, 10..10);
+    assert_eq!(r.next_back(), None);
+
+    let mut r = 100..10;
+    assert!(r.is_empty());
+    assert_eq!(r.next(), None);
+    assert_eq!(r.next_back(), None);
+    assert_eq!(r, 100..10);
+}
+
 #[test]
 fn test_range_inclusive_exhaustion() {
     let mut r = 10..=10;
     assert_eq!(r.next(), Some(10));
-    assert_eq!(r, 1..=0);
+    assert!(r.is_empty());
+    assert_eq!(r.next(), None);
+    assert_eq!(r.next(), None);
 
     let mut r = 10..=10;
     assert_eq!(r.next_back(), Some(10));
-    assert_eq!(r, 1..=0);
+    assert!(r.is_empty());
+    assert_eq!(r.next_back(), None);
 
     let mut r = 10..=12;
     assert_eq!(r.next(), Some(10));
     assert_eq!(r.next(), Some(11));
     assert_eq!(r.next(), Some(12));
-    assert_eq!(r, 1..=0);
+    assert!(r.is_empty());
+    assert_eq!(r.next(), None);
 
     let mut r = 10..=12;
     assert_eq!(r.next_back(), Some(12));
     assert_eq!(r.next_back(), Some(11));
     assert_eq!(r.next_back(), Some(10));
-    assert_eq!(r, 1..=0);
+    assert!(r.is_empty());
+    assert_eq!(r.next_back(), None);
 
     let mut r = 10..=12;
     assert_eq!(r.nth(2), Some(12));
-    assert_eq!(r, 1..=0);
+    assert!(r.is_empty());
+    assert_eq!(r.next(), None);
 
     let mut r = 10..=12;
     assert_eq!(r.nth(5), None);
-    assert_eq!(r, 1..=0);
+    assert!(r.is_empty());
+    assert_eq!(r.next(), None);
 
     let mut r = 100..=10;
     assert_eq!(r.next(), None);
+    assert!(r.is_empty());
+    assert_eq!(r.next(), None);
+    assert_eq!(r.next(), None);
     assert_eq!(r, 100..=10);
 
     let mut r = 100..=10;
     assert_eq!(r.next_back(), None);
+    assert!(r.is_empty());
+    assert_eq!(r.next_back(), None);
+    assert_eq!(r.next_back(), None);
     assert_eq!(r, 100..=10);
 }
 
@@ -1428,9 +1470,10 @@ fn test_range_inclusive_nth() {
     assert_eq!(r.nth(2), Some(15));
     assert_eq!(r, 16..=20);
     assert_eq!(r.is_empty(), false);
+    assert_eq!(ExactSizeIterator::is_empty(&r), false);
     assert_eq!(r.nth(10), None);
     assert_eq!(r.is_empty(), true);
-    assert_eq!(r, 1..=0);  // We may not want to document/promise this detail
+    assert_eq!(ExactSizeIterator::is_empty(&r), true);
 }
 
 #[test]
@@ -1514,11 +1557,11 @@ fn test_range_inclusive_folds() {
 
     let mut it = 10..=20;
     assert_eq!(it.try_fold(0, |a,b| Some(a+b)), Some(165));
-    assert_eq!(it, 1..=0);
+    assert!(it.is_empty());
 
     let mut it = 10..=20;
     assert_eq!(it.try_rfold(0, |a,b| Some(a+b)), Some(165));
-    assert_eq!(it, 1..=0);
+    assert!(it.is_empty());
 }
 
 #[test]
@@ -1549,6 +1592,51 @@ fn test_repeat_take_collect() {
     assert_eq!(v, vec![42, 42, 42]);
 }
 
+#[test]
+fn test_repeat_with() {
+    #[derive(PartialEq, Debug)]
+    struct NotClone(usize);
+    let mut it = repeat_with(|| NotClone(42));
+    assert_eq!(it.next(), Some(NotClone(42)));
+    assert_eq!(it.next(), Some(NotClone(42)));
+    assert_eq!(it.next(), Some(NotClone(42)));
+    assert_eq!(repeat_with(|| NotClone(42)).size_hint(), (usize::MAX, None));
+}
+
+#[test]
+fn test_repeat_with_rev() {
+    let mut curr = 1;
+    let mut pow2 = repeat_with(|| { let tmp = curr; curr *= 2; tmp })
+                    .rev().take(4);
+    assert_eq!(pow2.next(), Some(1));
+    assert_eq!(pow2.next(), Some(2));
+    assert_eq!(pow2.next(), Some(4));
+    assert_eq!(pow2.next(), Some(8));
+    assert_eq!(pow2.next(), None);
+}
+
+#[test]
+fn test_repeat_with_take() {
+    let mut it = repeat_with(|| 42).take(3);
+    assert_eq!(it.next(), Some(42));
+    assert_eq!(it.next(), Some(42));
+    assert_eq!(it.next(), Some(42));
+    assert_eq!(it.next(), None);
+    is_trusted_len(repeat_with(|| 42).take(3));
+    assert_eq!(repeat_with(|| 42).take(3).size_hint(), (3, Some(3)));
+    assert_eq!(repeat_with(|| 42).take(0).size_hint(), (0, Some(0)));
+    assert_eq!(repeat_with(|| 42).take(usize::MAX).size_hint(),
+               (usize::MAX, Some(usize::MAX)));
+}
+
+#[test]
+fn test_repeat_with_take_collect() {
+    let mut curr = 1;
+    let v: Vec<_> = repeat_with(|| { let tmp = curr; curr *= 2; tmp })
+                      .take(5).collect();
+    assert_eq!(v, vec![1, 2, 4, 8, 16]);
+}
+
 #[test]
 fn test_fuse() {
     let mut it = 0..3;
index 9e90313bc0e9efeb27bb4a04def98ae2968f5194..3e901a9d442ce29bc8460e2c582fa417c859b93e 100644 (file)
 #![feature(iterator_try_fold)]
 #![feature(iter_rfind)]
 #![feature(iter_rfold)]
+#![feature(iterator_repeat_with)]
 #![feature(nonzero)]
 #![feature(pattern)]
+#![feature(range_is_empty)]
 #![feature(raw)]
 #![feature(refcell_replace_swap)]
 #![feature(sip_hash_13)]
index 9d2fa1abff658474e095e4cb4bffd5cc103423b9..bed08f86d72c124e4851f46364ddaf4eaee80b74 100644 (file)
@@ -68,3 +68,27 @@ fn test_range_inclusive() {
     assert_eq!(r.size_hint(), (0, Some(0)));
     assert_eq!(r.next(), None);
 }
+
+
+#[test]
+fn test_range_is_empty() {
+    use core::f32::*;
+
+    assert!(!(0.0 .. 10.0).is_empty());
+    assert!( (-0.0 .. 0.0).is_empty());
+    assert!( (10.0 .. 0.0).is_empty());
+
+    assert!(!(NEG_INFINITY .. INFINITY).is_empty());
+    assert!( (EPSILON .. NAN).is_empty());
+    assert!( (NAN .. EPSILON).is_empty());
+    assert!( (NAN .. NAN).is_empty());
+
+    assert!(!(0.0 ..= 10.0).is_empty());
+    assert!(!(-0.0 ..= 0.0).is_empty());
+    assert!( (10.0 ..= 0.0).is_empty());
+
+    assert!(!(NEG_INFINITY ..= INFINITY).is_empty());
+    assert!( (EPSILON ..= NAN).is_empty());
+    assert!( (NAN ..= EPSILON).is_empty());
+    assert!( (NAN ..= NAN).is_empty());
+}
index 1a0208d2f25b206cd8893753a914d305a97b60fc..b8d0719b9b992b565daf45d68b161b9e68dfff87 100644 (file)
@@ -7,7 +7,7 @@
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
-#![stable(feature = "duration_core", since = "1.24.0")]
+#![stable(feature = "duration_core", since = "1.25.0")]
 
 //! Temporal quantification.
 //!
@@ -58,7 +58,7 @@
 ///
 /// let ten_millis = Duration::from_millis(10);
 /// ```
-#[stable(feature = "duration_core", since = "1.24.0")]
+#[stable(feature = "duration", since = "1.3.0")]
 #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Hash, Default)]
 pub struct Duration {
     secs: u64,
index 0e1c66277163ea6a19ffaee6a20c993aedeff7a2..99b1e5783e01e18f698307b13181978f3bc23c53 100644 (file)
@@ -9,14 +9,15 @@
 // except according to those terms.
 
 use super::*;
-
 use dep_graph::{DepGraph, DepKind, DepNodeIndex};
+use hir::def_id::{LOCAL_CRATE, CrateNum};
 use hir::intravisit::{Visitor, NestedVisitorMap};
 use hir::svh::Svh;
 use middle::cstore::CrateStore;
 use session::CrateDisambiguator;
 use std::iter::repeat;
 use syntax::ast::{NodeId, CRATE_NODE_ID};
+use syntax::codemap::CodeMap;
 use syntax_pos::Span;
 
 use ich::StableHashingContext;
@@ -123,6 +124,7 @@ pub(super) fn root(krate: &'hir Crate,
     pub(super) fn finalize_and_compute_crate_hash(self,
                                                   crate_disambiguator: CrateDisambiguator,
                                                   cstore: &CrateStore,
+                                                  codemap: &CodeMap,
                                                   commandline_args_hash: u64)
                                                   -> (Vec<MapEntry<'hir>>, Svh) {
         let mut node_hashes: Vec<_> = self
@@ -147,11 +149,25 @@ pub(super) fn finalize_and_compute_crate_hash(self,
             (name1, dis1).cmp(&(name2, dis2))
         });
 
+        // We hash the final, remapped names of all local source files so we
+        // don't have to include the path prefix remapping commandline args.
+        // If we included the full mapping in the SVH, we could only have
+        // reproducible builds by compiling from the same directory. So we just
+        // hash the result of the mapping instead of the mapping itself.
+        let mut source_file_names: Vec<_> = codemap
+            .files()
+            .iter()
+            .filter(|filemap| CrateNum::from_u32(filemap.crate_of_origin) == LOCAL_CRATE)
+            .map(|filemap| filemap.name_hash)
+            .collect();
+
+        source_file_names.sort_unstable();
+
         let (_, crate_dep_node_index) = self
             .dep_graph
             .with_task(DepNode::new_no_params(DepKind::Krate),
                        &self.hcx,
-                       ((node_hashes, upstream_crates),
+                       (((node_hashes, upstream_crates), source_file_names),
                         (commandline_args_hash,
                          crate_disambiguator.to_fingerprint())),
                        identity_fn);
index 5feea602d281434271462aa244e74912faf4c2aa..b6b3e8955351c48a4a6d7db511e8fd7985162dd2 100644 (file)
@@ -1065,6 +1065,7 @@ pub fn map_crate<'hir>(sess: &::session::Session,
         let cmdline_args = sess.opts.dep_tracking_hash();
         collector.finalize_and_compute_crate_hash(crate_disambiguator,
                                                   cstore,
+                                                  sess.codemap(),
                                                   cmdline_args)
     };
 
index 31e054ec1cb93d1f78dae98c08715bfda02e941a..8b4b9aaeac848b98c85c1eb3c2aa5b84422314b6 100644 (file)
@@ -175,6 +175,10 @@ fn configure_main(this: &mut EntryContext) {
             err.emit();
             this.session.abort_if_errors();
         } else {
+            if this.session.teach(&err.get_code().unwrap()) {
+                err.note("If you don't know the basics of Rust, you can go look to the Rust Book \
+                          to get started: https://doc.rust-lang.org/book/");
+            }
             err.emit();
         }
     }
index 5b8092e86da045f13d798275174c57f1f089098b..cfbf233297cf82d32fa4e656232b1d52b86ebac1 100644 (file)
@@ -1269,9 +1269,9 @@ fn parse_epoch(slot: &mut Epoch, v: Option<&str>) -> bool {
         "set the optimization fuel quota for a crate"),
     print_fuel: Option<String> = (None, parse_opt_string, [TRACKED],
         "make Rustc print the total optimization fuel used by a crate"),
-    remap_path_prefix_from: Vec<PathBuf> = (vec![], parse_pathbuf_push, [TRACKED],
+    remap_path_prefix_from: Vec<PathBuf> = (vec![], parse_pathbuf_push, [UNTRACKED],
         "add a source pattern to the file path remapping config"),
-    remap_path_prefix_to: Vec<PathBuf> = (vec![], parse_pathbuf_push, [TRACKED],
+    remap_path_prefix_to: Vec<PathBuf> = (vec![], parse_pathbuf_push, [UNTRACKED],
         "add a mapping target to the file path remapping config"),
     force_unstable_if_unmarked: bool = (false, parse_bool, [TRACKED],
         "force all crates to be `rustc_private` unstable"),
@@ -1320,6 +1320,8 @@ fn parse_epoch(slot: &mut Epoch, v: Option<&str>) -> bool {
         "The epoch to build Rust with. Newer epochs may include features
          that require breaking changes. The default epoch is 2015 (the first
          epoch). Crates compiled with different epochs can be linked together."),
+    run_dsymutil: Option<bool> = (None, parse_opt_bool, [TRACKED],
+          "run `dsymutil` and delete intermediate object files"),
 }
 
 pub fn default_lib_output() -> CrateType {
@@ -1717,7 +1719,7 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
     }
 
     let remap_path_prefix_sources = debugging_opts.remap_path_prefix_from.len();
-    let remap_path_prefix_targets = debugging_opts.remap_path_prefix_from.len();
+    let remap_path_prefix_targets = debugging_opts.remap_path_prefix_to.len();
 
     if remap_path_prefix_targets < remap_path_prefix_sources {
         for source in &debugging_opts.remap_path_prefix_from[remap_path_prefix_targets..] {
index a290839425ebe2051947c32eeaf4ae0d23560a39..214d8ec325f2b16ce72bb39953f941b921471a91 100644 (file)
@@ -1224,13 +1224,15 @@ fn note_obligation_cause<T>(&self,
     {
         self.note_obligation_cause_code(err,
                                         &obligation.predicate,
-                                        &obligation.cause.code);
+                                        &obligation.cause.code,
+                                        &mut vec![]);
     }
 
     fn note_obligation_cause_code<T>(&self,
                                      err: &mut DiagnosticBuilder,
                                      predicate: &T,
-                                     cause_code: &ObligationCauseCode<'tcx>)
+                                     cause_code: &ObligationCauseCode<'tcx>,
+                                     obligated_types: &mut Vec<&ty::TyS<'tcx>>)
         where T: fmt::Display
     {
         let tcx = self.tcx;
@@ -1326,12 +1328,17 @@ fn note_obligation_cause_code<T>(&self,
             }
             ObligationCauseCode::BuiltinDerivedObligation(ref data) => {
                 let parent_trait_ref = self.resolve_type_vars_if_possible(&data.parent_trait_ref);
-                err.note(&format!("required because it appears within the type `{}`",
-                                  parent_trait_ref.0.self_ty()));
+                let ty = parent_trait_ref.0.self_ty();
+                err.note(&format!("required because it appears within the type `{}`", ty));
+                obligated_types.push(ty);
+
                 let parent_predicate = parent_trait_ref.to_predicate();
-                self.note_obligation_cause_code(err,
-                                                &parent_predicate,
-                                                &data.parent_code);
+                if !self.is_recursive_obligation(obligated_types, &data.parent_code) {
+                    self.note_obligation_cause_code(err,
+                                                    &parent_predicate,
+                                                    &data.parent_code,
+                                                    obligated_types);
+                }
             }
             ObligationCauseCode::ImplDerivedObligation(ref data) => {
                 let parent_trait_ref = self.resolve_type_vars_if_possible(&data.parent_trait_ref);
@@ -1341,8 +1348,9 @@ fn note_obligation_cause_code<T>(&self,
                              parent_trait_ref.0.self_ty()));
                 let parent_predicate = parent_trait_ref.to_predicate();
                 self.note_obligation_cause_code(err,
-                                                &parent_predicate,
-                                                &data.parent_code);
+                                            &parent_predicate,
+                                            &data.parent_code,
+                                            obligated_types);
             }
             ObligationCauseCode::CompareImplMethodObligation { .. } => {
                 err.note(
@@ -1361,6 +1369,20 @@ fn suggest_new_overflow_limit(&self, err: &mut DiagnosticBuilder) {
         err.help(&format!("consider adding a `#![recursion_limit=\"{}\"]` attribute to your crate",
                           suggested_limit));
     }
+
+    fn is_recursive_obligation(&self,
+                                   obligated_types: &mut Vec<&ty::TyS<'tcx>>,
+                                   cause_code: &ObligationCauseCode<'tcx>) -> bool {
+        if let ObligationCauseCode::BuiltinDerivedObligation(ref data) = cause_code {
+            let parent_trait_ref = self.resolve_type_vars_if_possible(&data.parent_trait_ref);
+            for obligated_type in obligated_types {
+                if obligated_type == &parent_trait_ref.0.self_ty() {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
 }
 
 enum ArgKind {
index 85fca68187fe661fc82f9084cd94aea5719144cd..21ffe6b895e72cca62aefae16ae84a78a278fab1 100644 (file)
 // a way that memoizes and does dep-graph tracking,
 // wrapping around the actual chain of providers that
 // the driver creates (using several `rustc_*` crates).
+//
+// The result of query must implement Clone. They must also implement ty::maps::values::Value
+// which produces an appropiate error value if the query resulted in a query cycle.
+// Queries marked with `fatal_cycle` do not need that implementation
+// as they will raise an fatal error on query cycles instead.
 define_maps! { <'tcx>
     /// Records the type of every item.
     [] fn type_of: TypeOfItem(DefId) -> Ty<'tcx>,
     [] fn dylib_dependency_formats: DylibDepFormats(CrateNum)
                                     -> Rc<Vec<(CrateNum, LinkagePreference)>>,
 
-    [] fn is_panic_runtime: IsPanicRuntime(CrateNum) -> bool,
-    [] fn is_compiler_builtins: IsCompilerBuiltins(CrateNum) -> bool,
-    [] fn has_global_allocator: HasGlobalAllocator(CrateNum) -> bool,
-    [] fn is_sanitizer_runtime: IsSanitizerRuntime(CrateNum) -> bool,
-    [] fn is_profiler_runtime: IsProfilerRuntime(CrateNum) -> bool,
-    [] fn panic_strategy: GetPanicStrategy(CrateNum) -> PanicStrategy,
-    [] fn is_no_builtins: IsNoBuiltins(CrateNum) -> bool,
+    [fatal_cycle] fn is_panic_runtime: IsPanicRuntime(CrateNum) -> bool,
+    [fatal_cycle] fn is_compiler_builtins: IsCompilerBuiltins(CrateNum) -> bool,
+    [fatal_cycle] fn has_global_allocator: HasGlobalAllocator(CrateNum) -> bool,
+    [fatal_cycle] fn is_sanitizer_runtime: IsSanitizerRuntime(CrateNum) -> bool,
+    [fatal_cycle] fn is_profiler_runtime: IsProfilerRuntime(CrateNum) -> bool,
+    [fatal_cycle] fn panic_strategy: GetPanicStrategy(CrateNum) -> PanicStrategy,
+    [fatal_cycle] fn is_no_builtins: IsNoBuiltins(CrateNum) -> bool,
 
     [] fn extern_crate: ExternCrate(DefId) -> Rc<Option<ExternCrate>>,
 
index 0ab6ee1a54a9b1a02ac866b6e6f3839c97c2296a..f02c7cbd0ea3e8dcf6d36bbd9201cd97e541a44c 100644 (file)
@@ -183,6 +183,19 @@ macro_rules! profq_key {
     }
 }
 
+macro_rules! handle_cycle_error {
+    ([][$this: expr]) => {{
+        Value::from_cycle_error($this.global_tcx())
+    }};
+    ([fatal_cycle$(, $modifiers:ident)*][$this:expr]) => {{
+        $this.tcx.sess.abort_if_errors();
+        unreachable!();
+    }};
+    ([$other:ident$(, $modifiers:ident)*][$($args:tt)*]) => {
+        handle_cycle_error!([$($modifiers),*][$($args)*])
+    };
+}
+
 macro_rules! define_maps {
     (<$tcx:tt>
      $($(#[$attr:meta])*
@@ -564,7 +577,7 @@ impl<'a, $tcx, 'lcx> TyCtxtAt<'a, $tcx, 'lcx> {
             pub fn $name(self, key: $K) -> $V {
                 queries::$name::try_get(self.tcx, self.span, key).unwrap_or_else(|mut e| {
                     e.emit();
-                    Value::from_cycle_error(self.global_tcx())
+                    handle_cycle_error!([$($modifiers)*][self])
                 })
             })*
         }
@@ -583,7 +596,7 @@ fn clone(&self) -> Self { *self }
 
 macro_rules! define_map_struct {
     (tcx: $tcx:tt,
-     input: ($(([$(modifiers:tt)*] [$($attr:tt)*] [$name:ident]))*)) => {
+     input: ($(([$($modifiers:tt)*] [$($attr:tt)*] [$name:ident]))*)) => {
         pub struct Maps<$tcx> {
             providers: IndexVec<CrateNum, Providers<$tcx>>,
             query_stack: RefCell<Vec<(Span, Query<$tcx>)>>,
index 1593b452cdffc3c4541819d71e1e8cb36a2d58d1..961c2650afdefc995bc256deece40915defc071c 100644 (file)
@@ -1297,6 +1297,13 @@ pub fn is_ty_var(&self) -> bool {
         }
     }
 
+    pub fn is_ty_infer(&self) -> bool {
+        match self.sty {
+            TyInfer(_) => true,
+            _ => false,
+        }
+    }
+
     pub fn is_phantom_data(&self) -> bool {
         if let TyAdt(def, _) = self.sty {
             def.is_phantom_data()
index f344624666a6cb482ff38ec857b20909da691258..b8a1fe99105406b63edbe42f6bb6e343a38578d6 100644 (file)
@@ -660,6 +660,15 @@ pub fn phase_2_configure_and_expand_inner<'a, F>(sess: &'a Session,
         disambiguator,
     );
 
+    if sess.opts.incremental.is_some() {
+        time(time_passes, "garbage collect incremental cache directory", || {
+            if let Err(e) = rustc_incremental::garbage_collect_session_directories(sess) {
+                warn!("Error while trying to garbage collect incremental \
+                       compilation cache directory: {}", e);
+            }
+        });
+    }
+
     // If necessary, compute the dependency graph (in the background).
     let future_dep_graph = if sess.opts.build_dep_graph() {
         Some(rustc_incremental::load_dep_graph(sess, time_passes))
index b53ee1daada429427c18040a8bdf48619b7972fd..65fbd9d0bf8f1a213a02dbe72347c60a1c1def77 100644 (file)
@@ -46,3 +46,4 @@
 pub use persist::prepare_session_directory;
 pub use persist::finalize_session_directory;
 pub use persist::delete_workproduct_files;
+pub use persist::garbage_collect_session_directories;
index f4171f951f4076e0a40758b8ea0aa320c345fe7d..795825f180c9dfdcb0658b1c2a1e6898043fff7a 100644 (file)
@@ -603,7 +603,7 @@ fn timestamp_to_string(timestamp: SystemTime) -> String {
 }
 
 fn string_to_timestamp(s: &str) -> Result<SystemTime, ()> {
-    let micros_since_unix_epoch = u64::from_str_radix(s, 36);
+    let micros_since_unix_epoch = u64::from_str_radix(s, INT_ENCODE_BASE as u32);
 
     if micros_since_unix_epoch.is_err() {
         return Err(())
@@ -733,6 +733,20 @@ pub fn garbage_collect_session_directories(sess: &Session) -> io::Result<()> {
                                 })
                                 .collect();
 
+    // Delete all session directories that don't have a lock file.
+    for directory_name in session_directories {
+        if !lock_file_to_session_dir.values().any(|dir| *dir == directory_name) {
+            let path = crate_directory.join(directory_name);
+            if let Err(err) = safe_remove_dir_all(&path) {
+                sess.warn(&format!("Failed to garbage collect invalid incremental \
+                                    compilation session directory `{}`: {}",
+                                    path.display(),
+                                    err));
+            }
+        }
+    }
+
+    // Now garbage collect the valid session directories.
     let mut deletion_candidates = vec![];
     let mut definitely_delete = vec![];
 
index 82a43d85bc6082dcb2f5a55034d3a8a834091b1a..2f864aaefba89df6fb0a9075260e1ba0f8d53344 100644 (file)
 mod work_product;
 mod file_format;
 
-pub use self::fs::prepare_session_directory;
 pub use self::fs::finalize_session_directory;
+pub use self::fs::garbage_collect_session_directories;
 pub use self::fs::in_incr_comp_dir;
+pub use self::fs::prepare_session_directory;
 pub use self::load::dep_graph_tcx_init;
 pub use self::load::load_dep_graph;
 pub use self::load::load_query_result_cache;
index e7e4119b9999bee72eb0558cfe216057e8e9e176..f734f3182a93139b29a84a249c251c59646e1837 100644 (file)
@@ -11,6 +11,7 @@
 #![allow(non_snake_case)]
 
 use rustc::hir::def_id::DefId;
+use rustc::hir::map as hir_map;
 use rustc::ty::subst::Substs;
 use rustc::ty::{self, AdtKind, Ty, TyCtxt};
 use rustc::ty::layout::{self, LayoutOf};
@@ -176,6 +177,22 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx hir::Expr) {
                             _ => bug!(),
                         };
                         if lit_val < min || lit_val > max {
+                            let parent_id = cx.tcx.hir.get_parent_node(e.id);
+                            if let hir_map::NodeExpr(parent_expr) = cx.tcx.hir.get(parent_id) {
+                                if let hir::ExprCast(..) = parent_expr.node {
+                                    if let ty::TyChar = cx.tables.expr_ty(parent_expr).sty {
+                                        let mut err = cx.struct_span_lint(
+                                                             OVERFLOWING_LITERALS,
+                                                             parent_expr.span,
+                                                             "only u8 can be casted into char");
+                                        err.span_suggestion(parent_expr.span,
+                                                            &"use a char literal instead",
+                                                            format!("'\\u{{{:X}}}'", lit_val));
+                                        err.emit();
+                                        return
+                                    }
+                                }
+                            }
                             cx.span_lint(OVERFLOWING_LITERALS,
                                          e.span,
                                          &format!("literal out of range for {:?}", t));
index 49b93f3c7d6a248fd37b9020a5b606b582ef6849..54e3f544acb68b0258186b0729245a02b324070a 100644 (file)
@@ -155,6 +155,7 @@ fn main() {
     cfg.file("../rustllvm/PassWrapper.cpp")
        .file("../rustllvm/RustWrapper.cpp")
        .file("../rustllvm/ArchiveWrapper.cpp")
+       .file("../rustllvm/Linker.cpp")
        .cpp(true)
        .cpp_link_stdlib(None) // we handle this below
        .compile("rustllvm");
index 99e43a2ddf98de52b09d71522557ca59e06d693c..e71bef512cf067c84956d197d93394565fac9476 100644 (file)
@@ -444,6 +444,9 @@ pub enum RustArchiveMember_opaque {}
 #[allow(missing_copy_implementations)]
 pub enum OperandBundleDef_opaque {}
 pub type OperandBundleDefRef = *mut OperandBundleDef_opaque;
+#[allow(missing_copy_implementations)]
+pub enum Linker_opaque {}
+pub type LinkerRef = *mut Linker_opaque;
 
 pub type DiagnosticHandler = unsafe extern "C" fn(DiagnosticInfoRef, *mut c_void);
 pub type InlineAsmDiagHandler = unsafe extern "C" fn(SMDiagnosticRef, *const c_void, c_uint);
@@ -1608,7 +1611,6 @@ pub fn LLVMRustPrintModule(PM: PassManagerRef,
     pub fn LLVMRustPrintPasses();
     pub fn LLVMRustSetNormalizedTarget(M: ModuleRef, triple: *const c_char);
     pub fn LLVMRustAddAlwaysInlinePass(P: PassManagerBuilderRef, AddLifetimes: bool);
-    pub fn LLVMRustLinkInExternalBitcode(M: ModuleRef, bc: *const c_char, len: size_t) -> bool;
     pub fn LLVMRustRunRestrictionPass(M: ModuleRef, syms: *const *const c_char, len: size_t);
     pub fn LLVMRustMarkAllFunctionsNounwind(M: ModuleRef);
 
@@ -1724,4 +1726,10 @@ pub fn LLVMRustThinLTOGetDICompileUnit(M: ModuleRef,
                                            CU2: *mut *mut c_void);
     pub fn LLVMRustThinLTOPatchDICompileUnit(M: ModuleRef, CU: *mut c_void);
     pub fn LLVMRustThinLTORemoveAvailableExternally(M: ModuleRef);
+
+    pub fn LLVMRustLinkerNew(M: ModuleRef) -> LinkerRef;
+    pub fn LLVMRustLinkerAdd(linker: LinkerRef,
+                             bytecode: *const c_char,
+                             bytecode_len: usize) -> bool;
+    pub fn LLVMRustLinkerFree(linker: LinkerRef);
 }
index c4df7349391e23dcaaba2c5768cbd4d2395f6985..650f99828ae483592fc4b4fb9ab4f5158183be70 100644 (file)
@@ -463,13 +463,20 @@ fn visit_terminator_entry(
                 target: _,
                 unwind: _,
             } => {
-                self.access_place(
-                    ContextKind::Drop.new(loc),
-                    (drop_place, span),
-                    (Deep, Write(WriteKind::StorageDeadOrDrop)),
-                    LocalMutationIsAllowed::Yes,
-                    flow_state,
-                );
+                let gcx = self.tcx.global_tcx();
+
+                // Compute the type with accurate region information.
+                let drop_place_ty = drop_place.ty(self.mir, self.tcx);
+
+                // Erase the regions.
+                let drop_place_ty = self.tcx.erase_regions(&drop_place_ty).to_ty(self.tcx);
+
+                // "Lift" into the gcx -- once regions are erased, this type should be in the
+                // global arenas; this "lift" operation basically just asserts that is true, but
+                // that is useful later.
+                let drop_place_ty = gcx.lift(&drop_place_ty).unwrap();
+
+                self.visit_terminator_drop(loc, term, flow_state, drop_place, drop_place_ty, span);
             }
             TerminatorKind::DropAndReplace {
                 location: ref drop_place,
@@ -717,6 +724,65 @@ fn allow_two_phase_borrow(&self, kind: BorrowKind) -> bool {
              self.tcx.sess.opts.debugging_opts.two_phase_beyond_autoref)
     }
 
+    /// Invokes `access_place` as appropriate for dropping the value
+    /// at `drop_place`. Note that the *actual* `Drop` in the MIR is
+    /// always for a variable (e.g., `Drop(x)`) -- but we recursively
+    /// break this variable down into subpaths (e.g., `Drop(x.foo)`)
+    /// to indicate more precisely which fields might actually be
+    /// accessed by a destructor.
+    fn visit_terminator_drop(
+        &mut self,
+        loc: Location,
+        term: &Terminator<'tcx>,
+        flow_state: &Flows<'cx, 'gcx, 'tcx>,
+        drop_place: &Place<'tcx>,
+        erased_drop_place_ty: ty::Ty<'gcx>,
+        span: Span,
+    ) {
+        match erased_drop_place_ty.sty {
+            // When a struct is being dropped, we need to check
+            // whether it has a destructor, if it does, then we can
+            // call it, if it does not then we need to check the
+            // individual fields instead. This way if `foo` has a
+            // destructor but `bar` does not, we will only check for
+            // borrows of `x.foo` and not `x.bar`. See #47703.
+            ty::TyAdt(def, substs) if def.is_struct() && !def.has_dtor(self.tcx) => {
+                for (index, field) in def.all_fields().enumerate() {
+                    let gcx = self.tcx.global_tcx();
+                    let field_ty = field.ty(gcx, substs);
+                    let field_ty = gcx.normalize_associated_type_in_env(&field_ty, self.param_env);
+                    let place = drop_place.clone().field(Field::new(index), field_ty);
+
+                    self.visit_terminator_drop(
+                        loc,
+                        term,
+                        flow_state,
+                        &place,
+                        field_ty,
+                        span,
+                    );
+                }
+            },
+            _ => {
+                // We have now refined the type of the value being
+                // dropped (potentially) to just the type of a
+                // subfield; so check whether that field's type still
+                // "needs drop". If so, we assume that the destructor
+                // may access any data it likes (i.e., a Deep Write).
+                let gcx = self.tcx.global_tcx();
+                if erased_drop_place_ty.needs_drop(gcx, self.param_env) {
+                    self.access_place(
+                        ContextKind::Drop.new(loc),
+                        (drop_place, span),
+                        (Deep, Write(WriteKind::StorageDeadOrDrop)),
+                        LocalMutationIsAllowed::Yes,
+                        flow_state,
+                    );
+                }
+            },
+        }
+    }
+
     /// Checks an access to the given place to see if it is allowed. Examines the set of borrows
     /// that are in scope, as well as which paths have been initialized, to ensure that (a) the
     /// place is initialized and (b) it is not borrowed in some way that would prevent this
index 3a28eae2d1c49e502773a5d8e505a7137ff1cb76..7cc4ba84895251ec5303a99e86882d8135a87f78 100644 (file)
@@ -238,7 +238,7 @@ pub fn pointer_size(&self) -> u64 {
         self.tcx.data_layout.pointer_size.bytes()
     }
 
-    pub fn endianess(&self) -> layout::Endian {
+    pub fn endianness(&self) -> layout::Endian {
         self.tcx.data_layout.endian
     }
 
@@ -722,7 +722,7 @@ pub fn write_repeat(&mut self, ptr: Pointer, val: u8, count: u64) -> EvalResult<
 
     pub fn read_primval(&self, ptr: MemoryPointer, ptr_align: Align, size: u64, signed: bool) -> EvalResult<'tcx, PrimVal> {
         self.check_relocation_edges(ptr, size)?; // Make sure we don't read part of a pointer as a pointer
-        let endianess = self.endianess();
+        let endianness = self.endianness();
         let bytes = self.get_bytes_unchecked(ptr, size, ptr_align.min(self.int_align(size)))?;
         // Undef check happens *after* we established that the alignment is correct.
         // We must not return Ok() for unaligned pointers!
@@ -731,9 +731,9 @@ pub fn read_primval(&self, ptr: MemoryPointer, ptr_align: Align, size: u64, sign
         }
         // Now we do the actual reading
         let bytes = if signed {
-            read_target_int(endianess, bytes).unwrap() as u128
+            read_target_int(endianness, bytes).unwrap() as u128
         } else {
-            read_target_uint(endianess, bytes).unwrap()
+            read_target_uint(endianness, bytes).unwrap()
         };
         // See if we got a pointer
         if size != self.pointer_size() {
@@ -756,7 +756,7 @@ pub fn read_ptr_sized_unsigned(&self, ptr: MemoryPointer, ptr_align: Align) -> E
     }
 
     pub fn write_primval(&mut self, ptr: MemoryPointer, ptr_align: Align, val: PrimVal, size: u64, signed: bool) -> EvalResult<'tcx> {
-        let endianess = self.endianess();
+        let endianness = self.endianness();
 
         let bytes = match val {
             PrimVal::Ptr(val) => {
@@ -788,9 +788,9 @@ pub fn write_primval(&mut self, ptr: MemoryPointer, ptr_align: Align, val: PrimV
             let align = self.int_align(size);
             let dst = self.get_bytes_mut(ptr, size, ptr_align.min(align))?;
             if signed {
-                write_target_int(endianess, dst, bytes as i128).unwrap();
+                write_target_int(endianness, dst, bytes as i128).unwrap();
             } else {
-                write_target_uint(endianess, dst, bytes).unwrap();
+                write_target_uint(endianness, dst, bytes).unwrap();
             }
         }
 
@@ -941,41 +941,41 @@ pub fn mark_definedness(
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// Methods to access integers in the target endianess
+// Methods to access integers in the target endianness
 ////////////////////////////////////////////////////////////////////////////////
 
 fn write_target_uint(
-    endianess: layout::Endian,
+    endianness: layout::Endian,
     mut target: &mut [u8],
     data: u128,
 ) -> Result<(), io::Error> {
     let len = target.len();
-    match endianess {
+    match endianness {
         layout::Endian::Little => target.write_uint128::<LittleEndian>(data, len),
         layout::Endian::Big => target.write_uint128::<BigEndian>(data, len),
     }
 }
 fn write_target_int(
-    endianess: layout::Endian,
+    endianness: layout::Endian,
     mut target: &mut [u8],
     data: i128,
 ) -> Result<(), io::Error> {
     let len = target.len();
-    match endianess {
+    match endianness {
         layout::Endian::Little => target.write_int128::<LittleEndian>(data, len),
         layout::Endian::Big => target.write_int128::<BigEndian>(data, len),
     }
 }
 
-fn read_target_uint(endianess: layout::Endian, mut source: &[u8]) -> Result<u128, io::Error> {
-    match endianess {
+fn read_target_uint(endianness: layout::Endian, mut source: &[u8]) -> Result<u128, io::Error> {
+    match endianness {
         layout::Endian::Little => source.read_uint128::<LittleEndian>(source.len()),
         layout::Endian::Big => source.read_uint128::<BigEndian>(source.len()),
     }
 }
 
-fn read_target_int(endianess: layout::Endian, mut source: &[u8]) -> Result<i128, io::Error> {
-    match endianess {
+fn read_target_int(endianness: layout::Endian, mut source: &[u8]) -> Result<i128, io::Error> {
+    match endianness {
         layout::Endian::Little => source.read_int128::<LittleEndian>(source.len()),
         layout::Endian::Big => source.read_int128::<BigEndian>(source.len()),
     }
index 563405fccc970a3dbd612b9fcc5640cdcab4c22a..7ed250e94c52f595a01df323c29251dfc1c35d7b 100644 (file)
@@ -44,6 +44,7 @@
 pub mod generator;
 pub mod inline;
 pub mod lower_128bit;
+pub mod uniform_array_move_out;
 
 pub(crate) fn provide(providers: &mut Providers) {
     self::qualify_consts::provide(providers);
@@ -197,6 +198,7 @@ fn mir_const<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Stea
         simplify::SimplifyCfg::new("initial"),
         type_check::TypeckMir,
         rustc_peek::SanityCheck,
+        uniform_array_move_out::UniformArrayMoveOut,
     ];
     tcx.alloc_steal_mir(mir)
 }
@@ -253,6 +255,7 @@ fn optimized_mir<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx
 
         lower_128bit::Lower128Bit,
 
+
         // Optimizations begin.
         inline::Inline,
         instcombine::InstCombine,
index 11dc34717a96d117d41057710e9417d79f2d09f2..a8a7831c823f87ac6decfa5c65ecb005dbaba68b 100644 (file)
@@ -170,8 +170,20 @@ fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     fn not_const(&mut self) {
         self.add(Qualif::NOT_CONST);
         if self.mode != Mode::Fn {
-            span_err!(self.tcx.sess, self.span, E0019,
-                      "{} contains unimplemented expression type", self.mode);
+            let mut err = struct_span_err!(
+                self.tcx.sess,
+                self.span,
+                E0019,
+                "{} contains unimplemented expression type",
+                self.mode
+            );
+            if self.tcx.sess.teach(&err.get_code().unwrap()) {
+                err.note("A function call isn't allowed in the const's initialization expression \
+                          because the expression's value must be known at compile-time.");
+                err.note("Remember: you can't use a function call inside a const's initialization \
+                          expression! However, you can use it anywhere else.");
+            }
+            err.emit();
         }
     }
 
@@ -179,9 +191,19 @@ fn not_const(&mut self) {
     fn statement_like(&mut self) {
         self.add(Qualif::NOT_CONST);
         if self.mode != Mode::Fn {
-            span_err!(self.tcx.sess, self.span, E0016,
-                      "blocks in {}s are limited to items and tail expressions",
-                      self.mode);
+            let mut err = struct_span_err!(
+                self.tcx.sess,
+                self.span,
+                E0016,
+                "blocks in {}s are limited to items and tail expressions",
+                self.mode
+            );
+            if self.tcx.sess.teach(&err.get_code().unwrap()) {
+                err.note("Blocks in constants may only contain items (such as constant, function \
+                          definition, etc...) and a tail expression.");
+                err.help("To avoid it, you have to replace the non-item object.");
+            }
+            err.emit();
         }
     }
 
@@ -475,9 +497,19 @@ fn visit_place(&mut self,
                 }
 
                 if self.mode == Mode::Const || self.mode == Mode::ConstFn {
-                    span_err!(self.tcx.sess, self.span, E0013,
-                              "{}s cannot refer to statics, use \
-                               a constant instead", self.mode);
+                    let mut err = struct_span_err!(self.tcx.sess, self.span, E0013,
+                                                   "{}s cannot refer to statics, use \
+                                                    a constant instead", self.mode);
+                    if self.tcx.sess.teach(&err.get_code().unwrap()) {
+                        err.note(
+                            "Static and const variables can refer to other const variables. But a \
+                             const variable cannot refer to a static variable."
+                        );
+                        err.help(
+                            "To fix this, the value can be extracted as a const and then used."
+                        );
+                    }
+                    err.emit()
                 }
             }
             Place::Projection(ref proj) => {
@@ -494,17 +526,30 @@ fn visit_place(&mut self,
                                 this.add(Qualif::STATIC);
                             }
 
+                            this.add(Qualif::NOT_CONST);
+
                             let base_ty = proj.base.ty(this.mir, this.tcx).to_ty(this.tcx);
                             if let ty::TyRawPtr(_) = base_ty.sty {
-                                this.add(Qualif::NOT_CONST);
                                 if this.mode != Mode::Fn {
-                                    struct_span_err!(this.tcx.sess,
-                                        this.span, E0396,
+                                    let mut err = struct_span_err!(
+                                        this.tcx.sess,
+                                        this.span,
+                                        E0396,
                                         "raw pointers cannot be dereferenced in {}s",
-                                        this.mode)
-                                    .span_label(this.span,
-                                        "dereference of raw pointer in constant")
-                                    .emit();
+                                        this.mode
+                                    );
+                                    err.span_label(this.span,
+                                                   "dereference of raw pointer in constant");
+                                    if this.tcx.sess.teach(&err.get_code().unwrap()) {
+                                        err.note(
+                                            "The value behind a raw pointer can't be determined \
+                                             at compile-time (or even link-time), which means it \
+                                             can't be used in a constant expression."
+                                        );
+                                        err.help("A possible fix is to dereference your pointer \
+                                                  at some point in run-time.");
+                                    }
+                                    err.emit();
                                 }
                             }
                         }
@@ -573,7 +618,38 @@ fn visit_operand(&mut self, operand: &Operand<'tcx>, location: Location) {
 
     fn visit_rvalue(&mut self, rvalue: &Rvalue<'tcx>, location: Location) {
         // Recurse through operands and places.
-        self.super_rvalue(rvalue, location);
+        if let Rvalue::Ref(region, kind, ref place) = *rvalue {
+            let mut is_reborrow = false;
+            if let Place::Projection(ref proj) = *place {
+                if let ProjectionElem::Deref = proj.elem {
+                    let base_ty = proj.base.ty(self.mir, self.tcx).to_ty(self.tcx);
+                    if let ty::TyRef(..) = base_ty.sty {
+                        is_reborrow = true;
+                    }
+                }
+            }
+
+            if is_reborrow {
+                self.nest(|this| {
+                    this.super_place(place, PlaceContext::Borrow {
+                        region,
+                        kind
+                    }, location);
+                    if !this.try_consume() {
+                        return;
+                    }
+
+                    if this.qualif.intersects(Qualif::STATIC_REF) {
+                        this.qualif = this.qualif - Qualif::STATIC_REF;
+                        this.add(Qualif::STATIC);
+                    }
+                });
+            } else {
+                self.super_rvalue(rvalue, location);
+            }
+        } else {
+            self.super_rvalue(rvalue, location);
+        }
 
         match *rvalue {
             Rvalue::Use(_) |
@@ -623,12 +699,22 @@ fn visit_rvalue(&mut self, rvalue: &Rvalue<'tcx>, location: Location) {
                     if !allow {
                         self.add(Qualif::NOT_CONST);
                         if self.mode != Mode::Fn {
-                            struct_span_err!(self.tcx.sess,  self.span, E0017,
-                                             "references in {}s may only refer \
-                                              to immutable values", self.mode)
-                                .span_label(self.span, format!("{}s require immutable values",
-                                                                self.mode))
-                                .emit();
+                            let mut err = struct_span_err!(self.tcx.sess,  self.span, E0017,
+                                                           "references in {}s may only refer \
+                                                            to immutable values", self.mode);
+                            err.span_label(self.span, format!("{}s require immutable values",
+                                                                self.mode));
+                            if self.tcx.sess.teach(&err.get_code().unwrap()) {
+                                err.note("References in statics and constants may only refer to \
+                                          immutable values.\n\n\
+                                          Statics are shared everywhere, and if they refer to \
+                                          mutable data one might violate memory safety since \
+                                          holding multiple mutable references to shared data is \
+                                          not allowed.\n\n\
+                                          If you really want global mutable state, try using \
+                                          static mut or a global UnsafeCell.");
+                            }
+                            err.emit();
                         }
                     }
                 } else {
@@ -669,9 +755,42 @@ fn visit_rvalue(&mut self, rvalue: &Rvalue<'tcx>, location: Location) {
                     (CastTy::FnPtr, CastTy::Int(_)) => {
                         self.add(Qualif::NOT_CONST);
                         if self.mode != Mode::Fn {
-                            span_err!(self.tcx.sess, self.span, E0018,
-                                      "raw pointers cannot be cast to integers in {}s",
-                                      self.mode);
+                            let mut err = struct_span_err!(
+                                self.tcx.sess,
+                                self.span,
+                                E0018,
+                                "raw pointers cannot be cast to integers in {}s",
+                                self.mode
+                            );
+                            if self.tcx.sess.teach(&err.get_code().unwrap()) {
+                                err.note("\
+The value of static and constant integers must be known at compile time. You can't cast a pointer \
+to an integer because the address of a pointer can vary.
+
+For example, if you write:
+
+```
+static MY_STATIC: u32 = 42;
+static MY_STATIC_ADDR: usize = &MY_STATIC as *const _ as usize;
+static WHAT: usize = (MY_STATIC_ADDR^17) + MY_STATIC_ADDR;
+```
+
+Then `MY_STATIC_ADDR` would contain the address of `MY_STATIC`. However, the address can change \
+when the program is linked, as well as change between different executions due to ASLR, and many \
+linkers would not be able to calculate the value of `WHAT`.
+
+On the other hand, static and constant pointers can point either to a known numeric address or to \
+the address of a symbol.
+
+```
+static MY_STATIC: u32 = 42;
+static MY_STATIC_ADDR: &'static u32 = &MY_STATIC;
+const CONST_ADDR: *const u8 = 0x5f3759df as *const u8;
+```
+
+This does not pose a problem by itself because they can't be accessed directly.");
+                            }
+                            err.emit();
                         }
                     }
                     _ => {}
@@ -702,10 +821,18 @@ fn visit_rvalue(&mut self, rvalue: &Rvalue<'tcx>, location: Location) {
             Rvalue::NullaryOp(NullOp::Box, _) => {
                 self.add(Qualif::NOT_CONST);
                 if self.mode != Mode::Fn {
-                    struct_span_err!(self.tcx.sess, self.span, E0010,
-                                     "allocations are not allowed in {}s", self.mode)
-                        .span_label(self.span, format!("allocation not allowed in {}s", self.mode))
-                        .emit();
+                    let mut err = struct_span_err!(self.tcx.sess, self.span, E0010,
+                                                   "allocations are not allowed in {}s", self.mode);
+                    err.span_label(self.span, format!("allocation not allowed in {}s", self.mode));
+                    if self.tcx.sess.teach(&err.get_code().unwrap()) {
+                        err.note(
+                            "The value of statics and constants must be known at compile time, \
+                             and they live for the entire lifetime of a program. Creating a boxed \
+                             value allocates memory on the heap at runtime, and therefore cannot \
+                             be done at compile time."
+                        );
+                    }
+                    err.emit();
                 }
             }
 
@@ -931,9 +1058,22 @@ fn visit_assign(&mut self,
                 // Avoid a generic error for other uses of arguments.
                 if self.qualif.intersects(Qualif::FN_ARGUMENT) {
                     let decl = &self.mir.local_decls[index];
-                    span_err!(self.tcx.sess, decl.source_info.span, E0022,
-                              "arguments of constant functions can only \
-                               be immutable by-value bindings");
+                    let mut err = struct_span_err!(
+                        self.tcx.sess,
+                        decl.source_info.span,
+                        E0022,
+                        "arguments of constant functions can only be immutable by-value bindings"
+                    );
+                    if self.tcx.sess.teach(&err.get_code().unwrap()) {
+                        err.note("Constant functions are not allowed to mutate anything. Thus, \
+                                  binding to an argument with a mutable pattern is not allowed.");
+                        err.note("Remove any mutable bindings from the argument list to fix this \
+                                  error. In case you need to mutate the argument, try lazily \
+                                  initializing a global variable instead of using a const fn, or \
+                                  refactoring the code to a functional style to avoid mutation if \
+                                  possible.");
+                    }
+                    err.emit();
                     return;
                 }
             }
diff --git a/src/librustc_mir/transform/uniform_array_move_out.rs b/src/librustc_mir/transform/uniform_array_move_out.rs
new file mode 100644 (file)
index 0000000..0db5ecf
--- /dev/null
@@ -0,0 +1,153 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// This pass converts move out from array by Subslice and
+// ConstIndex{.., from_end: true} to ConstIndex move out(s) from begin
+// of array. It allows detect error by mir borrowck and elaborate
+// drops for array without additional work.
+//
+// Example:
+//
+// let a = [ box 1,box 2, box 3];
+// if b {
+//  let [_a.., _] = a;
+// } else {
+//  let [.., _b] = a;
+// }
+//
+//  mir statement _10 = move _2[:-1]; replaced by:
+//  StorageLive(_12);
+//  _12 = move _2[0 of 3];
+//  StorageLive(_13);
+//  _13 = move _2[1 of 3];
+//  _10 = [move _12, move _13]
+//  StorageDead(_12);
+//  StorageDead(_13);
+//
+//  and mir statement _11 = move _2[-1 of 1]; replaced by:
+//  _11 = move _2[2 of 3];
+//
+// FIXME: convert to Subslice back for performance reason
+// FIXME: integrate this transformation to the mir build
+
+use rustc::ty;
+use rustc::ty::TyCtxt;
+use rustc::mir::*;
+use rustc::mir::visit::Visitor;
+use transform::{MirPass, MirSource};
+use util::patch::MirPatch;
+
+pub struct UniformArrayMoveOut;
+
+impl MirPass for UniformArrayMoveOut {
+    fn run_pass<'a, 'tcx>(&self,
+                          tcx: TyCtxt<'a, 'tcx, 'tcx>,
+                          _src: MirSource,
+                          mir: &mut Mir<'tcx>) {
+        let mut patch = MirPatch::new(mir);
+        {
+            let mut visitor = UniformArrayMoveOutVisitor{mir, patch: &mut patch, tcx};
+            visitor.visit_mir(mir);
+        }
+        patch.apply(mir);
+    }
+}
+
+struct UniformArrayMoveOutVisitor<'a, 'tcx: 'a> {
+    mir: &'a Mir<'tcx>,
+    patch: &'a mut MirPatch<'tcx>,
+    tcx: TyCtxt<'a, 'tcx, 'tcx>,
+}
+
+impl<'a, 'tcx> Visitor<'tcx> for UniformArrayMoveOutVisitor<'a, 'tcx> {
+    fn visit_statement(&mut self,
+                       block: BasicBlock,
+                       statement: &Statement<'tcx>,
+                       location: Location) {
+        if let StatementKind::Assign(ref dst_place,
+                                     Rvalue::Use(Operand::Move(ref src_place))) = statement.kind {
+            if let Place::Projection(ref proj) = *src_place {
+                if let ProjectionElem::ConstantIndex{offset: _,
+                                                     min_length: _,
+                                                     from_end: false} = proj.elem {
+                    // no need to transformation
+                } else {
+                    let place_ty = proj.base.ty(self.mir, self.tcx).to_ty(self.tcx);
+                    if let ty::TyArray(item_ty, const_size) = place_ty.sty {
+                        if let Some(size) = const_size.val.to_const_int().and_then(|v| v.to_u64()) {
+                            assert!(size <= (u32::max_value() as u64),
+                                    "unform array move out doesn't supported
+                                     for array bigger then u32");
+                            self.uniform(location, dst_place, proj, item_ty, size as u32);
+                        }
+                    }
+
+                }
+            }
+        }
+        return self.super_statement(block, statement, location);
+    }
+}
+
+impl<'a, 'tcx> UniformArrayMoveOutVisitor<'a, 'tcx> {
+    fn uniform(&mut self,
+               location: Location,
+               dst_place: &Place<'tcx>,
+               proj: &PlaceProjection<'tcx>,
+               item_ty: &'tcx ty::TyS<'tcx>,
+               size: u32) {
+        match proj.elem {
+            // uniform _10 = move _2[:-1];
+            ProjectionElem::Subslice{from, to} => {
+                self.patch.make_nop(location);
+                let temps : Vec<_> = (from..(size-to)).map(|i| {
+                    let temp = self.patch.new_temp(item_ty, self.mir.source_info(location).span);
+                    self.patch.add_statement(location, StatementKind::StorageLive(temp));
+                    self.patch.add_assign(location,
+                                          Place::Local(temp),
+                                          Rvalue::Use(
+                                              Operand::Move(
+                                                  Place::Projection(box PlaceProjection{
+                                                      base: proj.base.clone(),
+                                                      elem: ProjectionElem::ConstantIndex{
+                                                          offset: i,
+                                                          min_length: size,
+                                                          from_end: false}
+                                                  }))));
+                    temp
+                }).collect();
+                self.patch.add_assign(location,
+                                      dst_place.clone(),
+                                      Rvalue::Aggregate(box AggregateKind::Array(item_ty),
+                                      temps.iter().map(
+                                          |x| Operand::Move(Place::Local(*x))).collect()
+                                      ));
+                for temp in temps {
+                    self.patch.add_statement(location, StatementKind::StorageDead(temp));
+                }
+            }
+            // _11 = move _2[-1 of 1];
+            ProjectionElem::ConstantIndex{offset, min_length: _, from_end: true} => {
+                self.patch.make_nop(location);
+                self.patch.add_assign(location,
+                                      dst_place.clone(),
+                                      Rvalue::Use(
+                                          Operand::Move(
+                                              Place::Projection(box PlaceProjection{
+                                                  base: proj.base.clone(),
+                                                  elem: ProjectionElem::ConstantIndex{
+                                                      offset: size - offset,
+                                                      min_length: size,
+                                                      from_end: false }}))));
+            }
+            _ => {}
+        }
+    }
+}
index 9da593fb48e3bb858fe1817098e69b63c1b31c61..f1bdcfcd22f935ade79d9c33c6595647ed88fec3 100644 (file)
@@ -23,6 +23,7 @@ pub struct MirPatch<'tcx> {
     new_locals: Vec<LocalDecl<'tcx>>,
     resume_block: BasicBlock,
     next_local: usize,
+    make_nop: Vec<Location>,
 }
 
 impl<'tcx> MirPatch<'tcx> {
@@ -33,7 +34,8 @@ pub fn new(mir: &Mir<'tcx>) -> Self {
             new_statements: vec![],
             new_locals: vec![],
             next_local: mir.local_decls.len(),
-            resume_block: START_BLOCK
+            resume_block: START_BLOCK,
+            make_nop: vec![]
         };
 
         // make sure the MIR we create has a resume block. It is
@@ -131,7 +133,15 @@ pub fn add_assign(&mut self, loc: Location, place: Place<'tcx>, rv: Rvalue<'tcx>
         self.add_statement(loc, StatementKind::Assign(place, rv));
     }
 
+    pub fn make_nop(&mut self, loc: Location) {
+        self.make_nop.push(loc);
+    }
+
     pub fn apply(self, mir: &mut Mir<'tcx>) {
+        debug!("MirPatch: make nops at: {:?}", self.make_nop);
+        for loc in self.make_nop {
+            mir.make_statement_nop(loc);
+        }
         debug!("MirPatch: {:?} new temps, starting from index {}: {:?}",
                self.new_locals.len(), mir.local_decls.len(), self.new_locals);
         debug!("MirPatch: {} new blocks, starting from index {}",
index 6df860492f05af022bb98ec46dbacda07b2b986d..60637bb61823f9167f4489d8bad4c7c2af65f7d5 100644 (file)
@@ -237,10 +237,20 @@ fn visit_pat(&mut self, p: &'tcx hir::Pat) {
                     Ok(Ordering::Less) |
                     Ok(Ordering::Equal) => {}
                     Ok(Ordering::Greater) => {
-                        struct_span_err!(self.tcx.sess, start.span, E0030,
-                            "lower range bound must be less than or equal to upper")
-                            .span_label(start.span, "lower bound larger than upper bound")
-                            .emit();
+                        let mut err = struct_span_err!(
+                            self.tcx.sess,
+                            start.span,
+                            E0030,
+                            "lower range bound must be less than or equal to upper"
+                        );
+                        err.span_label(start.span, "lower bound larger than upper bound");
+                        if self.tcx.sess.teach(&err.get_code().unwrap()) {
+                            err.note("When matching against a range, the compiler verifies that \
+                                      the range is non-empty. Range patterns include both \
+                                      end-points, so this is equivalent to requiring the start of \
+                                      the range to be less than or equal to the end of the range.");
+                        }
+                        err.emit();
                     }
                     Err(ErrorReported) => {}
                 }
@@ -352,14 +362,9 @@ fn check_expr<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>, e: &hir::Expr, node
         hir::ExprBox(_) => {
             v.promotable = false;
         }
-        hir::ExprUnary(op, ref inner) => {
-            match v.tables.node_id_to_type(inner.hir_id).sty {
-                ty::TyRawPtr(_) => {
-                    assert!(op == hir::UnDeref);
-
-                    v.promotable = false;
-                }
-                _ => {}
+        hir::ExprUnary(op, _) => {
+            if op == hir::UnDeref {
+                v.promotable = false;
             }
         }
         hir::ExprBinary(op, ref lhs, _) => {
@@ -548,7 +553,8 @@ fn check_expr<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>, e: &hir::Expr, node
 fn check_adjustments<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>, e: &hir::Expr) {
     use rustc::ty::adjustment::*;
 
-    for adjustment in v.tables.expr_adjustments(e) {
+    let mut adjustments = v.tables.expr_adjustments(e).iter().peekable();
+    while let Some(adjustment) = adjustments.next() {
         match adjustment.kind {
             Adjust::NeverToAny |
             Adjust::ReifyFnPointer |
@@ -558,11 +564,14 @@ fn check_adjustments<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>, e: &hir::Exp
             Adjust::Borrow(_) |
             Adjust::Unsize => {}
 
-            Adjust::Deref(ref overloaded) => {
-                if overloaded.is_some() {
-                    v.promotable = false;
-                    break;
+            Adjust::Deref(_) => {
+                if let Some(next_adjustment) = adjustments.peek() {
+                    if let Adjust::Borrow(_) = next_adjustment.kind {
+                        continue;
+                    }
                 }
+                v.promotable = false;
+                break;
             }
         }
     }
index 8cb25f449b66711e409e93704526b5dff7b0bd1d..a8070c553bdbcb34dd8bde7bf8435abc2d21ba12 100644 (file)
@@ -1026,6 +1026,8 @@ fn import_path_to_string(names: &[SpannedIdent],
         if names.is_empty() {
             import_directive_subclass_to_string(subclass)
         } else {
+            // FIXME: Remove this entire logic after #48116 is fixed.
+            //
             // Note that this code looks a little wonky, it's currently here to
             // hopefully help debug #48116, but otherwise isn't intended to
             // cause any problems.
@@ -1034,8 +1036,17 @@ fn import_path_to_string(names: &[SpannedIdent],
                 names_to_string(names),
                 import_directive_subclass_to_string(subclass),
             );
-            assert!(!names.is_empty());
-            assert!(!x.starts_with("::"));
+            if names.is_empty() || x.starts_with("::") {
+                span_bug!(
+                    span,
+                    "invalid name `{}` at {:?}; global = {}, names = {:?}, subclass = {:?}",
+                    x,
+                    span,
+                    global,
+                    names,
+                    subclass
+                );
+            }
             return x
         }
     }
index 6c8088375c4b0548fc7d84f0b41a77827e137224..8309c91ab2573bcf4ee7f349cd9e7b45f79b3d05 100644 (file)
@@ -142,7 +142,7 @@ pub fn provide(providers: &mut Providers) {
         assert_eq!(cnum, LOCAL_CRATE);
         Rc::new(llvm_util::target_feature_whitelist(tcx.sess)
             .iter()
-            .map(|c| c.to_str().unwrap().to_string())
+            .map(|c| c.to_string())
             .collect())
     };
 
@@ -212,7 +212,8 @@ fn from_target_feature(
         let value = value.as_str();
         for feature in value.split(',') {
             if whitelist.contains(feature) {
-                target_features.push(format!("+{}", feature));
+                let llvm_feature = llvm_util::to_llvm_feature(feature);
+                target_features.push(format!("+{}", llvm_feature));
                 continue
             }
 
index f050edcd513b918167fd49355050327a64716b8e..4fe294a790fc4467edaedbd686672d48535e3f09 100644 (file)
@@ -166,7 +166,9 @@ pub(crate) fn link_binary(sess: &Session,
 
     // Remove the temporary object file and metadata if we aren't saving temps
     if !sess.opts.cg.save_temps {
-        if sess.opts.output_types.should_trans() {
+        if sess.opts.output_types.should_trans() &&
+            !preserve_objects_for_their_debuginfo(sess)
+        {
             for obj in trans.modules.iter().filter_map(|m| m.object.as_ref()) {
                 remove(sess, obj);
             }
@@ -190,6 +192,52 @@ pub(crate) fn link_binary(sess: &Session,
     out_filenames
 }
 
+/// Returns a boolean indicating whether we should preserve the object files on
+/// the filesystem for their debug information. This is often useful with
+/// split-dwarf like schemes.
+fn preserve_objects_for_their_debuginfo(sess: &Session) -> bool {
+    // If the objects don't have debuginfo there's nothing to preserve.
+    if sess.opts.debuginfo == NoDebugInfo {
+        return false
+    }
+
+    // If we're only producing artifacts that are archives, no need to preserve
+    // the objects as they're losslessly contained inside the archives.
+    let output_linked = sess.crate_types.borrow()
+        .iter()
+        .any(|x| *x != config::CrateTypeRlib && *x != config::CrateTypeStaticlib);
+    if !output_linked {
+        return false
+    }
+
+    // If we're on OSX then the equivalent of split dwarf is turned on by
+    // default. The final executable won't actually have any debug information
+    // except it'll have pointers to elsewhere. Historically we've always run
+    // `dsymutil` to "link all the dwarf together" but this is actually sort of
+    // a bummer for incremental compilation! (the whole point of split dwarf is
+    // that you don't do this sort of dwarf link).
+    //
+    // Basically as a result this just means that if we're on OSX and we're
+    // *not* running dsymutil then the object files are the only source of truth
+    // for debug information, so we must preserve them.
+    if sess.target.target.options.is_like_osx {
+        match sess.opts.debugging_opts.run_dsymutil {
+            // dsymutil is not being run, preserve objects
+            Some(false) => return true,
+
+            // dsymutil is being run, no need to preserve the objects
+            Some(true) => return false,
+
+            // The default historical behavior was to always run dsymutil, so
+            // we're preserving that temporarily, but we're likely to switch the
+            // default soon.
+            None => return false,
+        }
+    }
+
+    false
+}
+
 fn filename_for_metadata(sess: &Session, crate_name: &str, outputs: &OutputFilenames) -> PathBuf {
     let out_filename = outputs.single_output_file.clone()
         .unwrap_or(outputs
@@ -736,8 +784,12 @@ fn escape_string(s: &[u8]) -> String {
 
 
     // On macOS, debuggers need this utility to get run to do some munging of
-    // the symbols
-    if sess.target.target.options.is_like_osx && sess.opts.debuginfo != NoDebugInfo {
+    // the symbols. Note, though, that if the object files are being preserved
+    // for their debug information there's no need for us to run dsymutil.
+    if sess.target.target.options.is_like_osx &&
+        sess.opts.debuginfo != NoDebugInfo &&
+        !preserve_objects_for_their_debuginfo(sess)
+    {
         match Command::new("dsymutil").arg(out_filename).output() {
             Ok(..) => {}
             Err(e) => sess.fatal(&format!("failed to run dsymutil: {}", e)),
index 9ff5bcf7a33caaa5772aaf8e822ef673e6e6f281..a33270380196f5ec9ec5774eeecbd55ad5922029 100644 (file)
@@ -247,22 +247,20 @@ fn fat_lto(cgcx: &CodegenContext,
     // know much about the memory management here so we err on the side of being
     // save and persist everything with the original module.
     let mut serialized_bitcode = Vec::new();
+    let mut linker = Linker::new(llmod);
     for (bc_decoded, name) in serialized_modules {
         info!("linking {:?}", name);
-        time(cgcx.time_passes, &format!("ll link {:?}", name), || unsafe {
+        time(cgcx.time_passes, &format!("ll link {:?}", name), || {
             let data = bc_decoded.data();
-            if llvm::LLVMRustLinkInExternalBitcode(llmod,
-                                                   data.as_ptr() as *const libc::c_char,
-                                                   data.len() as libc::size_t) {
-                Ok(())
-            } else {
+            linker.add(&data).map_err(|()| {
                 let msg = format!("failed to load bc of {:?}", name);
-                Err(write::llvm_err(&diag_handler, msg))
-            }
+                write::llvm_err(&diag_handler, msg)
+            })
         })?;
         timeline.record(&format!("link {:?}", name));
         serialized_bitcode.push(bc_decoded);
     }
+    drop(linker);
     cgcx.save_temp_bitcode(&module, "lto.input");
 
     // Internalize everything that *isn't* in our whitelist to help strip out
@@ -289,6 +287,32 @@ fn fat_lto(cgcx: &CodegenContext,
     }])
 }
 
+struct Linker(llvm::LinkerRef);
+
+impl Linker {
+    fn new(llmod: ModuleRef) -> Linker {
+        unsafe { Linker(llvm::LLVMRustLinkerNew(llmod)) }
+    }
+
+    fn add(&mut self, bytecode: &[u8]) -> Result<(), ()> {
+        unsafe {
+            if llvm::LLVMRustLinkerAdd(self.0,
+                                       bytecode.as_ptr() as *const libc::c_char,
+                                       bytecode.len()) {
+                Ok(())
+            } else {
+                Err(())
+            }
+        }
+    }
+}
+
+impl Drop for Linker {
+    fn drop(&mut self) {
+        unsafe { llvm::LLVMRustLinkerFree(self.0); }
+    }
+}
+
 /// Prepare "thin" LTO to get run on these modules.
 ///
 /// The general structure of ThinLTO is quite different from the structure of
index 62bac8469ce4bc75dddc20482c6a93d0047a8dd1..b8144a3ca7a3ee2ddb87745011bd33e6f7fe9022 100644 (file)
@@ -134,12 +134,13 @@ fn reg_component(cls: &[Option<Class>], i: &mut usize, size: Size) -> Option<Reg
         None => None,
         Some(Class::Int) => {
             *i += 1;
-            Some(match size.bytes() {
-                1 => Reg::i8(),
-                2 => Reg::i16(),
-                3 |
-                4 => Reg::i32(),
-                _ => Reg::i64()
+            Some(if size.bytes() < 8 {
+                Reg {
+                    kind: RegKind::Integer,
+                    size
+                }
+            } else {
+                Reg::i64()
             })
         }
         Some(Class::Sse) => {
index 843231d376f6c49a82794b68dd447823597f234a..b25562252e72e86cc70585acd9ac74a24faf7986 100644 (file)
@@ -14,7 +14,7 @@
 use rustc::session::Session;
 use rustc::session::config::PrintRequest;
 use libc::c_int;
-use std::ffi::{CStr, CString};
+use std::ffi::CString;
 
 use std::sync::atomic::{AtomicBool, Ordering};
 use std::sync::Once;
@@ -79,46 +79,53 @@ unsafe fn configure_llvm(sess: &Session) {
 // detection code will walk past the end of the feature array,
 // leading to crashes.
 
-const ARM_WHITELIST: &'static [&'static str] = &["neon\0", "v7\0", "vfp2\0", "vfp3\0", "vfp4\0"];
+const ARM_WHITELIST: &'static [&'static str] = &["neon", "v7", "vfp2", "vfp3", "vfp4"];
 
-const AARCH64_WHITELIST: &'static [&'static str] = &["neon\0", "v7\0"];
+const AARCH64_WHITELIST: &'static [&'static str] = &["neon", "v7"];
 
-const X86_WHITELIST: &'static [&'static str] = &["avx\0", "avx2\0", "bmi\0", "bmi2\0", "sse\0",
-                                                 "sse2\0", "sse3\0", "sse4.1\0", "sse4.2\0",
-                                                 "ssse3\0", "tbm\0", "lzcnt\0", "popcnt\0",
-                                                 "sse4a\0", "rdrnd\0", "rdseed\0", "fma\0",
-                                                 "xsave\0", "xsaveopt\0", "xsavec\0",
-                                                 "xsaves\0", "aes\0",
-                                                 "avx512bw\0", "avx512cd\0",
-                                                 "avx512dq\0", "avx512er\0",
-                                                 "avx512f\0", "avx512ifma\0",
-                                                 "avx512pf\0", "avx512vbmi\0",
-                                                 "avx512vl\0", "avx512vpopcntdq\0",
-                                                 "mmx\0", "fxsr\0"];
+const X86_WHITELIST: &'static [&'static str] = &["avx", "avx2", "bmi", "bmi2", "sse",
+                                                 "sse2", "sse3", "sse4.1", "sse4.2",
+                                                 "ssse3", "tbm", "lzcnt", "popcnt",
+                                                 "sse4a", "rdrnd", "rdseed", "fma",
+                                                 "xsave", "xsaveopt", "xsavec",
+                                                 "xsaves", "aes", "pclmulqdq",
+                                                 "avx512bw", "avx512cd",
+                                                 "avx512dq", "avx512er",
+                                                 "avx512f", "avx512ifma",
+                                                 "avx512pf", "avx512vbmi",
+                                                 "avx512vl", "avx512vpopcntdq",
+                                                 "mmx", "fxsr"];
 
-const HEXAGON_WHITELIST: &'static [&'static str] = &["hvx\0", "hvx-double\0"];
+const HEXAGON_WHITELIST: &'static [&'static str] = &["hvx", "hvx-double"];
 
-const POWERPC_WHITELIST: &'static [&'static str] = &["altivec\0",
-                                                     "power8-altivec\0", "power9-altivec\0",
-                                                     "power8-vector\0", "power9-vector\0",
-                                                     "vsx\0"];
+const POWERPC_WHITELIST: &'static [&'static str] = &["altivec",
+                                                     "power8-altivec", "power9-altivec",
+                                                     "power8-vector", "power9-vector",
+                                                     "vsx"];
 
-const MIPS_WHITELIST: &'static [&'static str] = &["msa\0"];
+const MIPS_WHITELIST: &'static [&'static str] = &["msa"];
+
+pub fn to_llvm_feature(s: &str) -> &str {
+    match s {
+        "pclmulqdq" => "pclmul",
+        s => s,
+    }
+}
 
 pub fn target_features(sess: &Session) -> Vec<Symbol> {
-    let whitelist = target_feature_whitelist(sess);
     let target_machine = create_target_machine(sess);
-    let mut features = Vec::new();
-    for feat in whitelist {
-        if unsafe { llvm::LLVMRustHasFeature(target_machine, feat.as_ptr()) } {
-            features.push(Symbol::intern(feat.to_str().unwrap()));
-        }
-    }
-    features
+    target_feature_whitelist(sess)
+        .iter()
+        .filter(|feature| {
+            let llvm_feature = to_llvm_feature(feature);
+            let cstr = CString::new(llvm_feature).unwrap();
+            unsafe { llvm::LLVMRustHasFeature(target_machine, cstr.as_ptr()) }
+        })
+        .map(|feature| Symbol::intern(feature)).collect()
 }
 
-pub fn target_feature_whitelist(sess: &Session) -> Vec<&CStr> {
-    let whitelist = match &*sess.target.target.arch {
+pub fn target_feature_whitelist(sess: &Session) -> &'static [&'static str] {
+    match &*sess.target.target.arch {
         "arm" => ARM_WHITELIST,
         "aarch64" => AARCH64_WHITELIST,
         "x86" | "x86_64" => X86_WHITELIST,
@@ -126,10 +133,7 @@ pub fn target_feature_whitelist(sess: &Session) -> Vec<&CStr> {
         "mips" | "mips64" => MIPS_WHITELIST,
         "powerpc" | "powerpc64" => POWERPC_WHITELIST,
         _ => &[],
-    };
-    whitelist.iter().map(|m| {
-        CStr::from_bytes_with_nul(m.as_bytes()).unwrap()
-    }).collect()
+    }
 }
 
 pub fn print_version() {
index 1a285cd869aecad1a376251aa7e80001b1d80617..bf253a88d27c2e270f5da4f44f29e7e605ef817f 100644 (file)
@@ -214,12 +214,25 @@ pub fn check_pat_walk(
                         end.span
                     };
 
-                    struct_span_err!(tcx.sess, span, E0029,
-                        "only char and numeric types are allowed in range patterns")
-                        .span_label(span, "ranges require char or numeric types")
-                        .note(&format!("start type: {}", self.ty_to_string(lhs_ty)))
-                        .note(&format!("end type: {}", self.ty_to_string(rhs_ty)))
-                        .emit();
+                    let mut err = struct_span_err!(
+                        tcx.sess,
+                        span,
+                        E0029,
+                        "only char and numeric types are allowed in range patterns"
+                    );
+                    err.span_label(span, "ranges require char or numeric types");
+                    err.note(&format!("start type: {}", self.ty_to_string(lhs_ty)));
+                    err.note(&format!("end type: {}", self.ty_to_string(rhs_ty)));
+                    if tcx.sess.teach(&err.get_code().unwrap()) {
+                        err.note(
+                            "In a match expression, only numbers and characters can be matched \
+                             against a range. This is because the compiler checks that the range \
+                             is non-empty at compile-time, and is unable to evaluate arbitrary \
+                             comparison functions. If you want to capture values of an orderable \
+                             type between two end-points, you can use a guard."
+                         );
+                    }
+                    err.emit();
                     return;
                 }
 
@@ -505,10 +518,25 @@ pub fn check_dereferencable(&self, span: Span, expected: Ty<'tcx>, inner: &hir::
                     // This is "x = SomeTrait" being reduced from
                     // "let &x = &SomeTrait" or "let box x = Box<SomeTrait>", an error.
                     let type_str = self.ty_to_string(expected);
-                    struct_span_err!(self.tcx.sess, span, E0033,
-                              "type `{}` cannot be dereferenced", type_str)
-                        .span_label(span, format!("type `{}` cannot be dereferenced", type_str))
-                        .emit();
+                    let mut err = struct_span_err!(
+                        self.tcx.sess,
+                        span,
+                        E0033,
+                        "type `{}` cannot be dereferenced",
+                        type_str
+                    );
+                    err.span_label(span, format!("type `{}` cannot be dereferenced", type_str));
+                    if self.tcx.sess.teach(&err.get_code().unwrap()) {
+                        err.note("\
+This error indicates that a pointer to a trait type cannot be implicitly dereferenced by a \
+pattern. Every trait defines a type, but because the size of trait implementors isn't fixed, \
+this type has no compile-time size. Therefore, all accesses to trait types must be through \
+pointers. If you encounter this error you should try to avoid dereferencing the pointer.
+
+You can read more about trait objects in the Trait Objects section of the Reference: \
+https://doc.rust-lang.org/reference/types.html#trait-objects");
+                    }
+                    err.emit();
                     return false
                 }
             }
@@ -881,17 +909,33 @@ fn check_struct_pat_fields(&self,
                             self.field_ty(span, f, substs)
                         })
                         .unwrap_or_else(|| {
-                            struct_span_err!(tcx.sess, span, E0026,
-                                             "{} `{}` does not have a field named `{}`",
-                                             kind_name,
-                                             tcx.item_path_str(variant.did),
-                                             field.name)
-                                .span_label(span,
-                                            format!("{} `{}` does not have field `{}`",
-                                                     kind_name,
-                                                     tcx.item_path_str(variant.did),
-                                                     field.name))
-                                .emit();
+                            let mut err = struct_span_err!(
+                                tcx.sess,
+                                span,
+                                E0026,
+                                "{} `{}` does not have a field named `{}`",
+                                kind_name,
+                                tcx.item_path_str(variant.did),
+                                field.name
+                            );
+                            err.span_label(span,
+                                           format!("{} `{}` does not have field `{}`",
+                                                   kind_name,
+                                                   tcx.item_path_str(variant.did),
+                                                   field.name));
+                            if tcx.sess.teach(&err.get_code().unwrap()) {
+                                err.note(
+                                    "This error indicates that a struct pattern attempted to \
+                                     extract a non-existent field from a struct. Struct fields \
+                                     are identified by the name used before the colon : so struct \
+                                     patterns should resemble the declaration of the struct type \
+                                     being matched.\n\n\
+                                     If you are using shorthand field patterns but want to refer \
+                                     to the struct field by a different name, you should rename \
+                                     it explicitly."
+                                );
+                            }
+                            err.emit();
 
                             tcx.types.err
                         })
@@ -927,6 +971,14 @@ fn check_struct_pat_fields(&self,
                 if variant.ctor_kind == CtorKind::Fn {
                     diag.note("trying to match a tuple variant with a struct variant pattern");
                 }
+                if tcx.sess.teach(&diag.get_code().unwrap()) {
+                    diag.note(
+                        "This error indicates that a pattern for a struct fails to specify a \
+                         sub-pattern for every one of the struct's fields. Ensure that each field \
+                         from the struct's definition is mentioned in the pattern, or use `..` to \
+                         ignore unwanted fields."
+                    );
+                }
                 diag.emit();
             }
         }
index 165b499cc62aaad5a55ad7855f17dd3a13a0c8b6..d21bfb674c7fc61c57f80fa1ec20fcbe7b99dfaa 100644 (file)
@@ -871,10 +871,21 @@ fn typeck_tables_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
             fcx
         };
 
-        fcx.select_all_obligations_and_apply_defaults();
-        fcx.closure_analyze(body);
+        // All type checking constraints were added, try to fallback unsolved variables.
+        fcx.select_obligations_where_possible();
+        for ty in &fcx.unsolved_variables() {
+            fcx.fallback_if_possible(ty);
+        }
         fcx.select_obligations_where_possible();
+
+        // Even though coercion casts provide type hints, we check casts after fallback for
+        // backwards compatibility. This makes fallback a stronger type hint than a cast coercion.
         fcx.check_casts();
+
+        // Closure and generater analysis may run after fallback
+        // because they don't constrain other type variables.
+        fcx.closure_analyze(body);
+        assert!(fcx.deferred_call_resolutions.borrow().is_empty());
         fcx.resolve_generator_interiors(def_id);
         fcx.select_all_obligations_or_error();
 
@@ -1395,7 +1406,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
             .map(|node_item| !node_item.node.is_from_trait())
             .unwrap_or(false);
 
-        if !is_implemented {
+        if !is_implemented && !tcx.impl_is_default(impl_id) {
             if !trait_item.defaultness.has_value() {
                 missing_items.push(trait_item);
             } else if associated_type_overridden {
@@ -2143,74 +2154,32 @@ fn resolve_generator_interiors(&self, def_id: DefId) {
         }
     }
 
-    /// Apply "fallbacks" to some types
-    /// unconstrained types get replaced with ! or  () (depending on whether
-    /// feature(never_type) is enabled), unconstrained ints with i32, and
-    /// unconstrained floats with f64.
-    fn default_type_parameters(&self) {
+    // Tries to apply a fallback to `ty` if it is an unsolved variable.
+    // Non-numerics get replaced with ! or () (depending on whether
+    // feature(never_type) is enabled), unconstrained ints with i32,
+    // unconstrained floats with f64.
+    // Fallback becomes very dubious if we have encountered type-checking errors.
+    // In that case, fallback to TyError.
+    fn fallback_if_possible(&self, ty: Ty<'tcx>) {
         use rustc::ty::error::UnconstrainedNumeric::Neither;
         use rustc::ty::error::UnconstrainedNumeric::{UnconstrainedInt, UnconstrainedFloat};
 
-        // Defaulting inference variables becomes very dubious if we have
-        // encountered type-checking errors. Therefore, if we think we saw
-        // some errors in this function, just resolve all uninstanted type
-        // varibles to TyError.
-        if self.is_tainted_by_errors() {
-            for ty in &self.unsolved_variables() {
-                if let ty::TyInfer(_) = self.shallow_resolve(ty).sty {
-                    debug!("default_type_parameters: defaulting `{:?}` to error", ty);
-                    self.demand_eqtype(syntax_pos::DUMMY_SP, *ty, self.tcx().types.err);
-                }
-            }
-            return;
-        }
-
-        for ty in &self.unsolved_variables() {
-            let resolved = self.resolve_type_vars_if_possible(ty);
-            if self.type_var_diverges(resolved) {
-                debug!("default_type_parameters: defaulting `{:?}` to `!` because it diverges",
-                       resolved);
-                self.demand_eqtype(syntax_pos::DUMMY_SP, *ty,
-                                   self.tcx.mk_diverging_default());
-            } else {
-                match self.type_is_unconstrained_numeric(resolved) {
-                    UnconstrainedInt => {
-                        debug!("default_type_parameters: defaulting `{:?}` to `i32`",
-                               resolved);
-                        self.demand_eqtype(syntax_pos::DUMMY_SP, *ty, self.tcx.types.i32)
-                    },
-                    UnconstrainedFloat => {
-                        debug!("default_type_parameters: defaulting `{:?}` to `f32`",
-                               resolved);
-                        self.demand_eqtype(syntax_pos::DUMMY_SP, *ty, self.tcx.types.f64)
-                    }
-                    Neither => { }
-                }
-            }
-        }
-    }
-
-    // Implements type inference fallback algorithm
-    fn select_all_obligations_and_apply_defaults(&self) {
-        self.select_obligations_where_possible();
-        self.default_type_parameters();
-        self.select_obligations_where_possible();
+        assert!(ty.is_ty_infer());
+        let fallback = match self.type_is_unconstrained_numeric(ty) {
+            _ if self.is_tainted_by_errors() => self.tcx().types.err,
+            UnconstrainedInt => self.tcx.types.i32,
+            UnconstrainedFloat => self.tcx.types.f64,
+            Neither if self.type_var_diverges(ty) => self.tcx.mk_diverging_default(),
+            Neither => return
+        };
+        debug!("default_type_parameters: defaulting `{:?}` to `{:?}`", ty, fallback);
+        self.demand_eqtype(syntax_pos::DUMMY_SP, ty, fallback);
     }
 
     fn select_all_obligations_or_error(&self) {
         debug!("select_all_obligations_or_error");
-
-        // upvar inference should have ensured that all deferred call
-        // resolutions are handled by now.
-        assert!(self.deferred_call_resolutions.borrow().is_empty());
-
-        self.select_all_obligations_and_apply_defaults();
-
-        let mut fulfillment_cx = self.fulfillment_cx.borrow_mut();
-
-        match fulfillment_cx.select_all_or_error(self) {
-            Ok(()) => { }
-            Err(errors) => { self.report_fulfillment_errors(&errors, self.inh.body_id); }
+        if let Err(errors) = self.fulfillment_cx.borrow_mut().select_all_or_error(&self) {
+            self.report_fulfillment_errors(&errors, self.inh.body_id);
         }
     }
 
@@ -5074,39 +5043,22 @@ fn check_impl_trait(&self,
         });
     }
 
-    fn structurally_resolve_type_or_else<F>(&self, sp: Span, ty: Ty<'tcx>, f: F)
-                                            -> Ty<'tcx>
-        where F: Fn() -> Ty<'tcx>
-    {
-        let mut ty = self.resolve_type_vars_with_obligations(ty);
-
-        if ty.is_ty_var() {
-            let alternative = f();
-
-            // If not, error.
-            if alternative.is_ty_var() || alternative.references_error() {
-                if !self.is_tainted_by_errors() {
-                    type_error_struct!(self.tcx.sess, sp, ty, E0619,
-                                       "the type of this value must be known in this context")
-                        .emit();
-                }
-                self.demand_suptype(sp, self.tcx.types.err, ty);
-                ty = self.tcx.types.err;
-            } else {
-                self.demand_suptype(sp, alternative, ty);
-                ty = alternative;
-            }
-        }
-
-        ty
-    }
-
-    // Resolves `typ` by a single level if `typ` is a type variable.  If no
-    // resolution is possible, then an error is reported.
+    // Resolves `typ` by a single level if `typ` is a type variable.
+    // If no resolution is possible, then an error is reported.
+    // Numeric inference variables may be left unresolved.
     pub fn structurally_resolved_type(&self, sp: Span, ty: Ty<'tcx>) -> Ty<'tcx> {
-        self.structurally_resolve_type_or_else(sp, ty, || {
+        let ty = self.resolve_type_vars_with_obligations(ty);
+        if !ty.is_ty_var() {
+            ty
+        } else {
+            if !self.is_tainted_by_errors() {
+                type_error_struct!(self.tcx.sess, sp, ty, E0619,
+                                    "the type of this value must be known in this context")
+                .emit();
+            }
+            self.demand_suptype(sp, self.tcx.types.err, ty);
             self.tcx.types.err
-        })
+        }
     }
 
     fn with_breakable_ctxt<F: FnOnce() -> R, R>(&self, id: ast::NodeId,
index d5328a18c22400f52c5f5fb9b7e0ecede732a13b..1c8d22e4666a6dd4b9884e2bbfe4878f9028838d 100644 (file)
@@ -1364,6 +1364,7 @@ fn explicit_predicates_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     let node = tcx.hir.get(node_id);
 
     let mut is_trait = None;
+    let mut is_default_impl_trait = None;
 
     let icx = ItemCtxt::new(tcx, def_id);
     let no_generics = hir::Generics::empty();
@@ -1373,8 +1374,13 @@ fn explicit_predicates_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 
         NodeItem(item) => {
             match item.node {
+                ItemImpl(_, _, defaultness, ref generics, ..) => {
+                    if defaultness.is_default() {
+                        is_default_impl_trait = tcx.impl_trait_ref(def_id);
+                    }
+                    generics
+                }
                 ItemFn(.., ref generics, _) |
-                ItemImpl(_, _, _, ref generics, ..) |
                 ItemTy(_, ref generics) |
                 ItemEnum(_, ref generics) |
                 ItemStruct(_, ref generics) |
@@ -1446,6 +1452,18 @@ fn explicit_predicates_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         predicates.push(trait_ref.to_poly_trait_ref().to_predicate());
     }
 
+    // In default impls, we can assume that the self type implements
+    // the trait. So in:
+    //
+    //     default impl Foo for Bar { .. }
+    //
+    // we add a default where clause `Foo: Bar`. We do a similar thing for traits
+    // (see below). Recall that a default impl is not itself an impl, but rather a
+    // set of defaults that can be incorporated into another impl.
+    if let Some(trait_ref) = is_default_impl_trait {
+        predicates.push(trait_ref.to_poly_trait_ref().to_predicate());
+    }
+
     // Collect the region predicates that were declared inline as
     // well. In the case of parameters declared on a fn or method, we
     // have to be careful to only iterate over early-bound regions.
index b45c3bf8e5f4ef14226f9cd975864c1f8ddbe982..2d0fe55f70d265a039f973c9da82ab3fc860d1c0 100644 (file)
@@ -130,7 +130,7 @@ pre {
 .content .highlighted.primitive { background-color: #00708a; }
 
 .content span.enum, .content a.enum, .block a.current.enum { color: #82b089; }
-.content span.struct, .content a.struct, .block a.current.struct { color: #ff794d; }
+.content span.struct, .content a.struct, .block a.current.struct { color: #2dbfb8; }
 .content span.type, .content a.type, .block a.current.type { color: #ff7f00; }
 .content span.foreigntype, .content a.foreigntype, .block a.current.foreigntype { color: #dd7de8; }
 .content span.macro, .content a.macro, .block a.current.macro { color: #09bd00; }
index e0764640e916514db1a788007276c3060010b5cf..2334a2728554ea66dd8d345264a59e1e03ce843e 100644 (file)
@@ -130,7 +130,7 @@ pre {
 .content .highlighted.primitive { background-color: #9aecff; }
 
 .content span.enum, .content a.enum, .block a.current.enum { color: #508157; }
-.content span.struct, .content a.struct, .block a.current.struct { color: #df3600; }
+.content span.struct, .content a.struct, .block a.current.struct { color: #ad448e; }
 .content span.type, .content a.type, .block a.current.type { color: #ba5d00; }
 .content span.foreigntype, .content a.foreigntype, .block a.current.foreigntype { color: #cd00e2; }
 .content span.macro, .content a.macro, .block a.current.macro { color: #068000; }
index 087d88419bc84dbef204b1dc5085b8a4242c9b5e..08258489a2ec22ad11bf787fb973725014423d0f 100644 (file)
@@ -345,6 +345,7 @@ pub fn make_test(s: &str,
                  opts: &TestOptions)
                  -> (String, usize) {
     let (crate_attrs, everything_else) = partition_source(s);
+    let everything_else = everything_else.trim();
     let mut line_offset = 0;
     let mut prog = String::new();
 
@@ -392,12 +393,11 @@ pub fn make_test(s: &str,
         .any(|code| code.contains("fn main"));
 
     if dont_insert_main || already_has_main {
-        prog.push_str(&everything_else);
+        prog.push_str(everything_else);
     } else {
         prog.push_str("fn main() {\n");
         line_offset += 1;
-        prog.push_str(&everything_else);
-        prog = prog.trim().into();
+        prog.push_str(everything_else);
         prog.push_str("\n}");
     }
 
@@ -753,3 +753,217 @@ fn visit_macro_def(&mut self, macro_def: &'hir hir::MacroDef) {
         self.visit_testable(macro_def.name.to_string(), &macro_def.attrs, |_| ());
     }
 }
+
+#[cfg(test)]
+mod tests {
+    use super::{TestOptions, make_test};
+
+    #[test]
+    fn make_test_basic() {
+        //basic use: wraps with `fn main`, adds `#![allow(unused)]`
+        let opts = TestOptions::default();
+        let input =
+"assert_eq!(2+2, 4);";
+        let expected =
+"#![allow(unused)]
+fn main() {
+assert_eq!(2+2, 4);
+}".to_string();
+        let output = make_test(input, None, false, &opts);
+        assert_eq!(output, (expected.clone(), 2));
+    }
+
+    #[test]
+    fn make_test_crate_name_no_use() {
+        //if you give a crate name but *don't* use it within the test, it won't bother inserting
+        //the `extern crate` statement
+        let opts = TestOptions::default();
+        let input =
+"assert_eq!(2+2, 4);";
+        let expected =
+"#![allow(unused)]
+fn main() {
+assert_eq!(2+2, 4);
+}".to_string();
+        let output = make_test(input, Some("asdf"), false, &opts);
+        assert_eq!(output, (expected, 2));
+    }
+
+    #[test]
+    fn make_test_crate_name() {
+        //if you give a crate name and use it within the test, it will insert an `extern crate`
+        //statement before `fn main`
+        let opts = TestOptions::default();
+        let input =
+"use asdf::qwop;
+assert_eq!(2+2, 4);";
+        let expected =
+"#![allow(unused)]
+extern crate asdf;
+fn main() {
+use asdf::qwop;
+assert_eq!(2+2, 4);
+}".to_string();
+        let output = make_test(input, Some("asdf"), false, &opts);
+        assert_eq!(output, (expected, 3));
+    }
+
+    #[test]
+    fn make_test_no_crate_inject() {
+        //even if you do use the crate within the test, setting `opts.no_crate_inject` will skip
+        //adding it anyway
+        let opts = TestOptions {
+            no_crate_inject: true,
+            attrs: vec![],
+        };
+        let input =
+"use asdf::qwop;
+assert_eq!(2+2, 4);";
+        let expected =
+"#![allow(unused)]
+fn main() {
+use asdf::qwop;
+assert_eq!(2+2, 4);
+}".to_string();
+        let output = make_test(input, Some("asdf"), false, &opts);
+        assert_eq!(output, (expected, 2));
+    }
+
+    #[test]
+    fn make_test_ignore_std() {
+        //even if you include a crate name, and use it in the doctest, we still won't include an
+        //`extern crate` statement if the crate is "std" - that's included already by the compiler!
+        let opts = TestOptions::default();
+        let input =
+"use std::*;
+assert_eq!(2+2, 4);";
+        let expected =
+"#![allow(unused)]
+fn main() {
+use std::*;
+assert_eq!(2+2, 4);
+}".to_string();
+        let output = make_test(input, Some("std"), false, &opts);
+        assert_eq!(output, (expected, 2));
+    }
+
+    #[test]
+    fn make_test_manual_extern_crate() {
+        //when you manually include an `extern crate` statement in your doctest, make_test assumes
+        //you've included one for your own crate too
+        let opts = TestOptions::default();
+        let input =
+"extern crate asdf;
+use asdf::qwop;
+assert_eq!(2+2, 4);";
+        let expected =
+"#![allow(unused)]
+fn main() {
+extern crate asdf;
+use asdf::qwop;
+assert_eq!(2+2, 4);
+}".to_string();
+        let output = make_test(input, Some("asdf"), false, &opts);
+        assert_eq!(output, (expected, 2));
+    }
+
+    #[test]
+    fn make_test_opts_attrs() {
+        //if you supplied some doctest attributes with #![doc(test(attr(...)))], it will use those
+        //instead of the stock #![allow(unused)]
+        let mut opts = TestOptions::default();
+        opts.attrs.push("feature(sick_rad)".to_string());
+        let input =
+"use asdf::qwop;
+assert_eq!(2+2, 4);";
+        let expected =
+"#![feature(sick_rad)]
+extern crate asdf;
+fn main() {
+use asdf::qwop;
+assert_eq!(2+2, 4);
+}".to_string();
+        let output = make_test(input, Some("asdf"), false, &opts);
+        assert_eq!(output, (expected, 3));
+
+        //adding more will also bump the returned line offset
+        opts.attrs.push("feature(hella_dope)".to_string());
+        let expected =
+"#![feature(sick_rad)]
+#![feature(hella_dope)]
+extern crate asdf;
+fn main() {
+use asdf::qwop;
+assert_eq!(2+2, 4);
+}".to_string();
+        let output = make_test(input, Some("asdf"), false, &opts);
+        assert_eq!(output, (expected, 4));
+    }
+
+    #[test]
+    fn make_test_crate_attrs() {
+        //including inner attributes in your doctest will apply them to the whole "crate", pasting
+        //them outside the generated main function
+        let opts = TestOptions::default();
+        let input =
+"#![feature(sick_rad)]
+assert_eq!(2+2, 4);";
+        let expected =
+"#![allow(unused)]
+#![feature(sick_rad)]
+fn main() {
+assert_eq!(2+2, 4);
+}".to_string();
+        let output = make_test(input, None, false, &opts);
+        assert_eq!(output, (expected, 2));
+    }
+
+    #[test]
+    fn make_test_with_main() {
+        //including your own `fn main` wrapper lets the test use it verbatim
+        let opts = TestOptions::default();
+        let input =
+"fn main() {
+    assert_eq!(2+2, 4);
+}";
+        let expected =
+"#![allow(unused)]
+fn main() {
+    assert_eq!(2+2, 4);
+}".to_string();
+        let output = make_test(input, None, false, &opts);
+        assert_eq!(output, (expected, 1));
+    }
+
+    #[test]
+    fn make_test_fake_main() {
+        //...but putting it in a comment will still provide a wrapper
+        let opts = TestOptions::default();
+        let input =
+"//Ceci n'est pas une `fn main`
+assert_eq!(2+2, 4);";
+        let expected =
+"#![allow(unused)]
+fn main() {
+//Ceci n'est pas une `fn main`
+assert_eq!(2+2, 4);
+}".to_string();
+        let output = make_test(input, None, false, &opts);
+        assert_eq!(output, (expected.clone(), 2));
+    }
+
+    #[test]
+    fn make_test_dont_insert_main() {
+        //even with that, if you set `dont_insert_main`, it won't create the `fn main` wrapper
+        let opts = TestOptions::default();
+        let input =
+"//Ceci n'est pas une `fn main`
+assert_eq!(2+2, 4);";
+        let expected =
+"#![allow(unused)]
+//Ceci n'est pas une `fn main`
+assert_eq!(2+2, 4);".to_string();
+        let output = make_test(input, None, true, &opts);
+        assert_eq!(output, (expected.clone(), 1));
+    }
+}
index 82a687ae5e4930cd9fa73d6113ba287f5873d0cb..a82ff915093c6ca0952bee2f672bb4cbb7e85df2 100644 (file)
@@ -398,8 +398,9 @@ pub struct HashMap<K, V, S = RandomState> {
 }
 
 /// Search for a pre-hashed key.
+/// If you don't already know the hash, use search or search_mut instead
 #[inline]
-fn search_hashed<K, V, M, F>(table: M, hash: SafeHash, mut is_match: F) -> InternalEntry<K, V, M>
+fn search_hashed<K, V, M, F>(table: M, hash: SafeHash, is_match: F) -> InternalEntry<K, V, M>
     where M: Deref<Target = RawTable<K, V>>,
           F: FnMut(&K) -> bool
 {
@@ -410,6 +411,18 @@ fn search_hashed<K, V, M, F>(table: M, hash: SafeHash, mut is_match: F) -> Inter
         return InternalEntry::TableIsEmpty;
     }
 
+    search_hashed_nonempty(table, hash, is_match)
+}
+
+/// Search for a pre-hashed key when the hash map is known to be non-empty.
+#[inline]
+fn search_hashed_nonempty<K, V, M, F>(table: M, hash: SafeHash, mut is_match: F)
+    -> InternalEntry<K, V, M>
+    where M: Deref<Target = RawTable<K, V>>,
+          F: FnMut(&K) -> bool
+{
+    // Do not check the capacity as an extra branch could slow the lookup.
+
     let size = table.size();
     let mut probe = Bucket::new(table, hash);
     let mut displacement = 0;
@@ -543,24 +556,36 @@ fn make_hash<X: ?Sized>(&self, x: &X) -> SafeHash
     }
 
     /// Search for a key, yielding the index if it's found in the hashtable.
-    /// If you already have the hash for the key lying around, use
-    /// search_hashed.
+    /// If you already have the hash for the key lying around, or if you need an
+    /// InternalEntry, use search_hashed or search_hashed_nonempty.
     #[inline]
-    fn search<'a, Q: ?Sized>(&'a self, q: &Q) -> InternalEntry<K, V, &'a RawTable<K, V>>
+    fn search<'a, Q: ?Sized>(&'a self, q: &Q)
+        -> Option<FullBucket<K, V, &'a RawTable<K, V>>>
         where K: Borrow<Q>,
               Q: Eq + Hash
     {
+        if self.is_empty() {
+            return None;
+        }
+
         let hash = self.make_hash(q);
-        search_hashed(&self.table, hash, |k| q.eq(k.borrow()))
+        search_hashed_nonempty(&self.table, hash, |k| q.eq(k.borrow()))
+            .into_occupied_bucket()
     }
 
     #[inline]
-    fn search_mut<'a, Q: ?Sized>(&'a mut self, q: &Q) -> InternalEntry<K, V, &'a mut RawTable<K, V>>
+    fn search_mut<'a, Q: ?Sized>(&'a mut self, q: &Q)
+        -> Option<FullBucket<K, V, &'a mut RawTable<K, V>>>
         where K: Borrow<Q>,
               Q: Eq + Hash
     {
+        if self.is_empty() {
+            return None;
+        }
+
         let hash = self.make_hash(q);
-        search_hashed(&mut self.table, hash, |k| q.eq(k.borrow()))
+        search_hashed_nonempty(&mut self.table, hash, |k| q.eq(k.borrow()))
+            .into_occupied_bucket()
     }
 
     // The caller should ensure that invariants by Robin Hood Hashing hold
@@ -1118,7 +1143,7 @@ pub fn get<Q: ?Sized>(&self, k: &Q) -> Option<&V>
         where K: Borrow<Q>,
               Q: Hash + Eq
     {
-        self.search(k).into_occupied_bucket().map(|bucket| bucket.into_refs().1)
+        self.search(k).map(|bucket| bucket.into_refs().1)
     }
 
     /// Returns true if the map contains a value for the specified key.
@@ -1145,7 +1170,7 @@ pub fn contains_key<Q: ?Sized>(&self, k: &Q) -> bool
         where K: Borrow<Q>,
               Q: Hash + Eq
     {
-        self.search(k).into_occupied_bucket().is_some()
+        self.search(k).is_some()
     }
 
     /// Returns a mutable reference to the value corresponding to the key.
@@ -1174,7 +1199,7 @@ pub fn get_mut<Q: ?Sized>(&mut self, k: &Q) -> Option<&mut V>
         where K: Borrow<Q>,
               Q: Hash + Eq
     {
-        self.search_mut(k).into_occupied_bucket().map(|bucket| bucket.into_mut_refs().1)
+        self.search_mut(k).map(|bucket| bucket.into_mut_refs().1)
     }
 
     /// Inserts a key-value pair into the map.
@@ -1234,11 +1259,7 @@ pub fn remove<Q: ?Sized>(&mut self, k: &Q) -> Option<V>
         where K: Borrow<Q>,
               Q: Hash + Eq
     {
-        if self.table.size() == 0 {
-            return None;
-        }
-
-        self.search_mut(k).into_occupied_bucket().map(|bucket| pop_internal(bucket).1)
+        self.search_mut(k).map(|bucket| pop_internal(bucket).1)
     }
 
     /// Removes a key from the map, returning the stored key and value if the
@@ -1269,12 +1290,7 @@ pub fn remove_entry<Q: ?Sized>(&mut self, k: &Q) -> Option<(K, V)>
         where K: Borrow<Q>,
               Q: Hash + Eq
     {
-        if self.table.size() == 0 {
-            return None;
-        }
-
         self.search_mut(k)
-            .into_occupied_bucket()
             .map(|bucket| {
                 let (k, v, _) = pop_internal(bucket);
                 (k, v)
@@ -2632,15 +2648,11 @@ impl<K, S, Q: ?Sized> super::Recover<Q> for HashMap<K, (), S>
 
     #[inline]
     fn get(&self, key: &Q) -> Option<&K> {
-        self.search(key).into_occupied_bucket().map(|bucket| bucket.into_refs().0)
+        self.search(key).map(|bucket| bucket.into_refs().0)
     }
 
     fn take(&mut self, key: &Q) -> Option<K> {
-        if self.table.size() == 0 {
-            return None;
-        }
-
-        self.search_mut(key).into_occupied_bucket().map(|bucket| pop_internal(bucket).0)
+        self.search_mut(key).map(|bucket| pop_internal(bucket).0)
     }
 
     #[inline]
index 27bf326631fb0416cf74082a6315bbf931e46a75..c4946b6b2824d3eed6e6d20567e2fa195ff2c511 100644 (file)
@@ -723,6 +723,12 @@ pub fn args_os() -> ArgsOs {
     ArgsOs { inner: sys::args::args() }
 }
 
+#[stable(feature = "env_unimpl_send_sync", since = "1.25.0")]
+impl !Send for Args {}
+
+#[stable(feature = "env_unimpl_send_sync", since = "1.25.0")]
+impl !Sync for Args {}
+
 #[stable(feature = "env", since = "1.0.0")]
 impl Iterator for Args {
     type Item = String;
@@ -754,6 +760,12 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
+#[stable(feature = "env_unimpl_send_sync", since = "1.25.0")]
+impl !Send for ArgsOs {}
+
+#[stable(feature = "env_unimpl_send_sync", since = "1.25.0")]
+impl !Sync for ArgsOs {}
+
 #[stable(feature = "env", since = "1.0.0")]
 impl Iterator for ArgsOs {
     type Item = OsString;
index ecf68f29d6f1f7c80c4324d1c71073b09a8a019c..a760922115aef330ebb44463d4412c687e1cbbc4 100644 (file)
@@ -1023,7 +1023,7 @@ pub fn to_bits(self) -> u32 {
     /// This is currently identical to `transmute::<u32, f32>(v)` on all platforms.
     /// It turns out this is incredibly portable, for two reasons:
     ///
-    /// * Floats and Ints have the same endianess on all supported platforms.
+    /// * Floats and Ints have the same endianness on all supported platforms.
     /// * IEEE-754 very precisely specifies the bit layout of floats.
     ///
     /// However there is one caveat: prior to the 2008 version of IEEE-754, how
index 29ba7d0dac6350c0c03c899f6a978ab177ed2174..6f34f176a971155b09c2d3e5ecad66cd56002ac7 100644 (file)
@@ -978,7 +978,7 @@ pub fn to_bits(self) -> u64 {
     /// This is currently identical to `transmute::<u64, f64>(v)` on all platforms.
     /// It turns out this is incredibly portable, for two reasons:
     ///
-    /// * Floats and Ints have the same endianess on all supported platforms.
+    /// * Floats and Ints have the same endianness on all supported platforms.
     /// * IEEE-754 very precisely specifies the bit layout of floats.
     ///
     /// However there is one caveat: prior to the 2008 version of IEEE-754, how
index c8447707d5bafdbcb1d73d54927857d8c3977994..76bcb5fedc94aed53fe7c86454897938808c2e31 100644 (file)
@@ -296,7 +296,7 @@ fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
     fn flush(&mut self) -> io::Result<()> { Ok(()) }
 }
 
-#[unstable(feature = "cursor_mut_vec", issue = "30132")]
+#[stable(feature = "cursor_mut_vec", since = "1.25.0")]
 impl<'a> Write for Cursor<&'a mut Vec<u8>> {
     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
         vec_write(&mut self.pos, self.inner, buf)
index 33d11ebb35022b2ad411e2de6d76fc8ac9077900..aa07f64b678599595eae64326b90f7617d37f3ed 100644 (file)
@@ -1437,8 +1437,6 @@ pub trait BufRead: Read {
     ///
     /// If successful, this function will return the total number of bytes read.
     ///
-    /// An empty buffer returned indicates that the stream has reached EOF.
-    ///
     /// # Errors
     ///
     /// This function will ignore all instances of [`ErrorKind::Interrupted`] and
index ed102c2949ede7a667afc435e9f7d1c0a4ea88a1..e03a182653e5a451810c99820ed16ea8b1de4fe5 100644 (file)
@@ -576,7 +576,7 @@ fn as_ref(&self) -> &OsStr {
     }
 }
 
-#[stable(feature = "path_component_asref", since = "1.24.0")]
+#[stable(feature = "path_component_asref", since = "1.25.0")]
 impl<'a> AsRef<Path> for Component<'a> {
     fn as_ref(&self) -> &Path {
         self.as_os_str().as_ref()
index a2caf47e8cced5dee8d15ca3fa391374cf825a75..358aa2c37dfb4cc855cb0c546ecefa7ab048c6e7 100644 (file)
@@ -720,10 +720,6 @@ mod prim_f64 { }
 /// The 8-bit signed integer type.
 ///
 /// *[See also the `std::i8` module](i8/index.html).*
-///
-/// However, please note that examples are shared between primitive integer
-/// types. So it's normal if you see usage of types like `i64` in there.
-///
 #[stable(feature = "rust1", since = "1.0.0")]
 mod prim_i8 { }
 
@@ -732,10 +728,6 @@ mod prim_i8 { }
 /// The 16-bit signed integer type.
 ///
 /// *[See also the `std::i16` module](i16/index.html).*
-///
-/// However, please note that examples are shared between primitive integer
-/// types. So it's normal if you see usage of types like `i32` in there.
-///
 #[stable(feature = "rust1", since = "1.0.0")]
 mod prim_i16 { }
 
@@ -744,10 +736,6 @@ mod prim_i16 { }
 /// The 32-bit signed integer type.
 ///
 /// *[See also the `std::i32` module](i32/index.html).*
-///
-/// However, please note that examples are shared between primitive integer
-/// types. So it's normal if you see usage of types like `i16` in there.
-///
 #[stable(feature = "rust1", since = "1.0.0")]
 mod prim_i32 { }
 
@@ -756,10 +744,6 @@ mod prim_i32 { }
 /// The 64-bit signed integer type.
 ///
 /// *[See also the `std::i64` module](i64/index.html).*
-///
-/// However, please note that examples are shared between primitive integer
-/// types. So it's normal if you see usage of types like `i8` in there.
-///
 #[stable(feature = "rust1", since = "1.0.0")]
 mod prim_i64 { }
 
@@ -768,10 +752,6 @@ mod prim_i64 { }
 /// The 128-bit signed integer type.
 ///
 /// *[See also the `std::i128` module](i128/index.html).*
-///
-/// However, please note that examples are shared between primitive integer
-/// types. So it's normal if you see usage of types like `i8` in there.
-///
 #[unstable(feature = "i128", issue="35118")]
 mod prim_i128 { }
 
@@ -780,10 +760,6 @@ mod prim_i128 { }
 /// The 8-bit unsigned integer type.
 ///
 /// *[See also the `std::u8` module](u8/index.html).*
-///
-/// However, please note that examples are shared between primitive integer
-/// types. So it's normal if you see usage of types like `u64` in there.
-///
 #[stable(feature = "rust1", since = "1.0.0")]
 mod prim_u8 { }
 
@@ -792,10 +768,6 @@ mod prim_u8 { }
 /// The 16-bit unsigned integer type.
 ///
 /// *[See also the `std::u16` module](u16/index.html).*
-///
-/// However, please note that examples are shared between primitive integer
-/// types. So it's normal if you see usage of types like `u32` in there.
-///
 #[stable(feature = "rust1", since = "1.0.0")]
 mod prim_u16 { }
 
@@ -804,10 +776,6 @@ mod prim_u16 { }
 /// The 32-bit unsigned integer type.
 ///
 /// *[See also the `std::u32` module](u32/index.html).*
-///
-/// However, please note that examples are shared between primitive integer
-/// types. So it's normal if you see usage of types like `u16` in there.
-///
 #[stable(feature = "rust1", since = "1.0.0")]
 mod prim_u32 { }
 
@@ -816,10 +784,6 @@ mod prim_u32 { }
 /// The 64-bit unsigned integer type.
 ///
 /// *[See also the `std::u64` module](u64/index.html).*
-///
-/// However, please note that examples are shared between primitive integer
-/// types. So it's normal if you see usage of types like `u8` in there.
-///
 #[stable(feature = "rust1", since = "1.0.0")]
 mod prim_u64 { }
 
@@ -828,10 +792,6 @@ mod prim_u64 { }
 /// The 128-bit unsigned integer type.
 ///
 /// *[See also the `std::u128` module](u128/index.html).*
-///
-/// However, please note that examples are shared between primitive integer
-/// types. So it's normal if you see usage of types like `u8` in there.
-///
 #[unstable(feature = "i128", issue="35118")]
 mod prim_u128 { }
 
@@ -844,10 +804,6 @@ mod prim_u128 { }
 /// and on a 64 bit target, this is 8 bytes.
 ///
 /// *[See also the `std::isize` module](isize/index.html).*
-///
-/// However, please note that examples are shared between primitive integer
-/// types. So it's normal if you see usage of types like `usize` in there.
-///
 #[stable(feature = "rust1", since = "1.0.0")]
 mod prim_isize { }
 
@@ -860,10 +816,6 @@ mod prim_isize { }
 /// and on a 64 bit target, this is 8 bytes.
 ///
 /// *[See also the `std::usize` module](usize/index.html).*
-///
-/// However, please note that examples are shared between primitive integer
-/// types. So it's normal if you see usage of types like `isize` in there.
-///
 #[stable(feature = "rust1", since = "1.0.0")]
 mod prim_usize { }
 
index 564021758176b6f2bec77d6a86da41137f32d79e..54bb65136508b5eab83d75f0bfa455ba56f191dd 100644 (file)
@@ -47,11 +47,13 @@ impl WaitTimeoutResult {
     ///
     /// thread::spawn(move|| {
     ///     let &(ref lock, ref cvar) = &*pair2;
+    ///
+    ///     // Let's wait 20 milliseconds before notifying the condvar.
+    ///     thread::sleep(Duration::from_millis(20));
+    ///
     ///     let mut started = lock.lock().unwrap();
     ///     // We update the boolean value.
     ///     *started = true;
-    ///     // Let's wait 20 milliseconds before notifying the condvar.
-    ///     thread::sleep(Duration::from_millis(20));
     ///     cvar.notify_one();
     /// });
     ///
index 24c41046f263abf462b914ee937adf453bc28707..38bf4cca851fe3bfc4395ed7fbd4c13b4ba0ce74 100644 (file)
@@ -445,6 +445,24 @@ fn last_write_time(&self) -> u64 { self.as_inner().modified_u64() }
     fn file_size(&self) -> u64 { self.as_inner().size() }
 }
 
+/// Add support for the Windows specific fact that a symbolic link knows whether it is a file
+/// or directory.
+#[unstable(feature = "windows_file_type_ext", issue = "0")]
+pub trait FileTypeExt {
+    /// Returns whether this file type is a symbolic link that is also a directory.
+    #[unstable(feature = "windows_file_type_ext", issue = "0")]
+    fn is_symlink_dir(&self) -> bool;
+    /// Returns whether this file type is a symbolic link that is also a file.
+    #[unstable(feature = "windows_file_type_ext", issue = "0")]
+    fn is_symlink_file(&self) -> bool;
+}
+
+#[unstable(feature = "windows_file_type_ext", issue = "0")]
+impl FileTypeExt for fs::FileType {
+    fn is_symlink_dir(&self) -> bool { self.as_inner().is_symlink_dir() }
+    fn is_symlink_file(&self) -> bool { self.as_inner().is_symlink_file() }
+}
+
 /// Creates a new file symbolic link on the filesystem.
 ///
 /// The `dst` path will be a file symbolic link pointing to the `src`
index 165e1b0609b68c8ce9d09c7008fef87d462e7e43..082d4689c7ba8ef16e60f3597d7e263ab40128b4 100644 (file)
@@ -38,8 +38,9 @@ pub struct FileAttr {
 }
 
 #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
-pub enum FileType {
-    Dir, File, SymlinkFile, SymlinkDir, ReparsePoint, MountPoint,
+pub struct FileType {
+    attributes: c::DWORD,
+    reparse_tag: c::DWORD,
 }
 
 pub struct ReadDir {
@@ -516,30 +517,34 @@ pub fn set_readonly(&mut self, readonly: bool) {
 
 impl FileType {
     fn new(attrs: c::DWORD, reparse_tag: c::DWORD) -> FileType {
-        match (attrs & c::FILE_ATTRIBUTE_DIRECTORY != 0,
-               attrs & c::FILE_ATTRIBUTE_REPARSE_POINT != 0,
-               reparse_tag) {
-            (false, false, _) => FileType::File,
-            (true, false, _) => FileType::Dir,
-            (false, true, c::IO_REPARSE_TAG_SYMLINK) => FileType::SymlinkFile,
-            (true, true, c::IO_REPARSE_TAG_SYMLINK) => FileType::SymlinkDir,
-            (true, true, c::IO_REPARSE_TAG_MOUNT_POINT) => FileType::MountPoint,
-            (_, true, _) => FileType::ReparsePoint,
-            // Note: if a _file_ has a reparse tag of the type IO_REPARSE_TAG_MOUNT_POINT it is
-            // invalid, as junctions always have to be dirs. We set the filetype to ReparsePoint
-            // to indicate it is something symlink-like, but not something you can follow.
+        FileType {
+            attributes: attrs,
+            reparse_tag: reparse_tag,
         }
     }
-
-    pub fn is_dir(&self) -> bool { *self == FileType::Dir }
-    pub fn is_file(&self) -> bool { *self == FileType::File }
+    pub fn is_dir(&self) -> bool {
+        !self.is_symlink() && self.is_directory()
+    }
+    pub fn is_file(&self) -> bool {
+        !self.is_symlink() && !self.is_directory()
+    }
     pub fn is_symlink(&self) -> bool {
-        *self == FileType::SymlinkFile ||
-        *self == FileType::SymlinkDir ||
-        *self == FileType::MountPoint
+        self.is_reparse_point() && self.is_reparse_tag_name_surrogate()
     }
     pub fn is_symlink_dir(&self) -> bool {
-        *self == FileType::SymlinkDir || *self == FileType::MountPoint
+        self.is_symlink() && self.is_directory()
+    }
+    pub fn is_symlink_file(&self) -> bool {
+        self.is_symlink() && !self.is_directory()
+    }
+    fn is_directory(&self) -> bool {
+        self.attributes & c::FILE_ATTRIBUTE_DIRECTORY != 0
+    }
+    fn is_reparse_point(&self) -> bool {
+        self.attributes & c::FILE_ATTRIBUTE_REPARSE_POINT != 0
+    }
+    fn is_reparse_tag_name_surrogate(&self) -> bool {
+        self.reparse_tag & 0x20000000 != 0
     }
 }
 
index 3601b9ba8a8c1cdbf8b5669f1fd42e5f0b17cf17..df5845f6c217d5bfc2b82ca3c2135c0c5f34a415 100644 (file)
@@ -317,10 +317,10 @@ pub fn new_imported_filemap(&self,
 
     pub fn mk_substr_filename(&self, sp: Span) -> String {
         let pos = self.lookup_char_pos(sp.lo());
-        (format!("<{}:{}:{}>",
+        format!("<{}:{}:{}>",
                  pos.file.name,
                  pos.line,
-                 pos.col.to_usize() + 1)).to_string()
+                 pos.col.to_usize() + 1)
     }
 
     // If there is a doctest_offset, apply it to the line
@@ -462,12 +462,12 @@ pub fn span_to_string(&self, sp: Span) -> String {
 
         let lo = self.lookup_char_pos_adj(sp.lo());
         let hi = self.lookup_char_pos_adj(sp.hi());
-        return (format!("{}:{}:{}: {}:{}",
+        format!("{}:{}:{}: {}:{}",
                         lo.filename,
                         lo.line,
                         lo.col.to_usize() + 1,
                         hi.line,
-                        hi.col.to_usize() + 1)).to_string()
+                        hi.col.to_usize() + 1)
     }
 
     pub fn span_to_filename(&self, sp: Span) -> FileName {
@@ -690,14 +690,16 @@ fn find_width_of_character_at_span(&self, sp: Span, forwards: bool) -> u32 {
             return 1;
         }
 
+        let src = local_begin.fm.external_src.borrow();
+
         // We need to extend the snippet to the end of the src rather than to end_index so when
         // searching forwards for boundaries we've got somewhere to search.
         let snippet = if let Some(ref src) = local_begin.fm.src {
             let len = src.len();
-            (&src[start_index..len]).to_string()
-        } else if let Some(src) = local_begin.fm.external_src.borrow().get_source() {
+            (&src[start_index..len])
+        } else if let Some(src) = src.get_source() {
             let len = src.len();
-            (&src[start_index..len]).to_string()
+            (&src[start_index..len])
         } else {
             return 1;
         };
index 1a9849ca5307de616f1dd4f662ac94e4457a828f..0621f728e2a9d0fa6a33988977c9e618c9a63959 100644 (file)
@@ -181,6 +181,8 @@ struct MatcherPos {
     match_hi: usize,
 
     // Specifically used if we are matching a repetition. If we aren't both should be `None`.
+    /// The KleeneOp of this sequence if we are in a repetition.
+    seq_op: Option<quoted::KleeneOp>,
     /// The separator if we are in a repetition
     sep: Option<Token>,
     /// The "parent" matcher position if we are in a repetition. That is, the matcher position just
@@ -263,6 +265,7 @@ fn initial_matcher_pos(ms: Vec<TokenTree>, lo: BytePos) -> Box<MatcherPos> {
         stack: vec![],
 
         // Haven't descended into any sequences, so both of these are `None`.
+        seq_op: None,
         sep: None,
         up: None,
     })
@@ -466,8 +469,8 @@ fn inner_parse_loop(
                     }
                 }
                 // We don't need a separator. Move the "dot" back to the beginning of the matcher
-                // and try to match again.
-                else {
+                // and try to match again UNLESS we are only allowed to have _one_ repetition.
+                else if item.seq_op != Some(quoted::KleeneOp::ZeroOrOne) {
                     item.match_cur = item.match_lo;
                     item.idx = 0;
                     cur_items.push(item);
@@ -486,8 +489,10 @@ fn inner_parse_loop(
             match item.top_elts.get_tt(idx) {
                 // Need to descend into a sequence
                 TokenTree::Sequence(sp, seq) => {
-                    if seq.op == quoted::KleeneOp::ZeroOrMore {
-                        // Examine the case where there are 0 matches of this sequence
+                    // Examine the case where there are 0 matches of this sequence
+                    if seq.op == quoted::KleeneOp::ZeroOrMore
+                        || seq.op == quoted::KleeneOp::ZeroOrOne
+                    {
                         let mut new_item = item.clone();
                         new_item.match_cur += seq.num_captures;
                         new_item.idx += 1;
@@ -497,11 +502,11 @@ fn inner_parse_loop(
                         cur_items.push(new_item);
                     }
 
-                    // Examine the case where there is at least one match of this sequence
                     let matches = create_matches(item.matches.len());
                     cur_items.push(Box::new(MatcherPos {
                         stack: vec![],
                         sep: seq.separator.clone(),
+                        seq_op: Some(seq.op),
                         idx: 0,
                         matches,
                         match_lo: item.match_cur,
index 9efb4faa63535725bc198d261465afe694120063..5254c751e6b621b500e1620f320aebda91eb7020 100644 (file)
@@ -237,7 +237,8 @@ pub fn compile(sess: &ParseSess, features: &RefCell<Features>, def: &ast::Item)
             s.iter().map(|m| {
                 if let MatchedNonterminal(ref nt) = *m {
                     if let NtTT(ref tt) = **nt {
-                        let tt = quoted::parse(tt.clone().into(), true, sess).pop().unwrap();
+                        let tt = quoted::parse(tt.clone().into(), true, sess, features, &def.attrs)
+                            .pop().unwrap();
                         valid &= check_lhs_nt_follows(sess, features, &def.attrs, &tt);
                         return tt;
                     }
@@ -253,7 +254,8 @@ pub fn compile(sess: &ParseSess, features: &RefCell<Features>, def: &ast::Item)
             s.iter().map(|m| {
                 if let MatchedNonterminal(ref nt) = *m {
                     if let NtTT(ref tt) = **nt {
-                        return quoted::parse(tt.clone().into(), false, sess).pop().unwrap();
+                        return quoted::parse(tt.clone().into(), false, sess, features, &def.attrs)
+                            .pop().unwrap();
                     }
                 }
                 sess.span_diagnostic.span_bug(def.span, "wrong-structured lhs")
index c55dfaba8f6b26bec457ea005cc78aa0d465d95b..982b60b81e47ec7a62219d4889288dc0f8997bd5 100644 (file)
@@ -8,14 +8,17 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use ast;
+use {ast, attr};
 use ext::tt::macro_parser;
+use feature_gate::{self, emit_feature_err, Features, GateIssue};
 use parse::{token, ParseSess};
 use print::pprust;
 use symbol::keywords;
 use syntax_pos::{BytePos, Span, DUMMY_SP};
 use tokenstream;
 
+use std::cell::RefCell;
+use std::iter::Peekable;
 use std::rc::Rc;
 
 /// Contains the sub-token-trees of a "delimited" token tree, such as the contents of `(`. Note
@@ -78,6 +81,7 @@ pub enum KleeneOp {
     ZeroOrMore,
     /// Kleene plus (`+`) for one or more repetitions
     OneOrMore,
+    ZeroOrOne,
 }
 
 /// Similar to `tokenstream::TokenTree`, except that `$i`, `$i:ident`, and `$(...)`
@@ -169,6 +173,8 @@ pub fn span(&self) -> Span {
 ///   `ident` are "matchers". They are not present in the body of a macro rule -- just in the
 ///   pattern, so we pass a parameter to indicate whether to expect them or not.
 /// - `sess`: the parsing session. Any errors will be emitted to this session.
+/// - `features`, `attrs`: language feature flags and attributes so that we know whether to use
+///   unstable features or not.
 ///
 /// # Returns
 ///
@@ -177,18 +183,19 @@ pub fn parse(
     input: tokenstream::TokenStream,
     expect_matchers: bool,
     sess: &ParseSess,
+    features: &RefCell<Features>,
+    attrs: &[ast::Attribute],
 ) -> Vec<TokenTree> {
     // Will contain the final collection of `self::TokenTree`
     let mut result = Vec::new();
 
     // For each token tree in `input`, parse the token into a `self::TokenTree`, consuming
     // additional trees if need be.
-    let mut trees = input.trees();
+    let mut trees = input.trees().peekable();
     while let Some(tree) = trees.next() {
-        let tree = parse_tree(tree, &mut trees, expect_matchers, sess);
-
         // Given the parsed tree, if there is a metavar and we are expecting matchers, actually
         // parse out the matcher (i.e. in `$id:ident` this would parse the `:` and `ident`).
+        let tree = parse_tree(tree, &mut trees, expect_matchers, sess, features, attrs);
         match tree {
             TokenTree::MetaVar(start_sp, ident) if expect_matchers => {
                 let span = match trees.next() {
@@ -237,11 +244,15 @@ pub fn parse(
 ///   converting `tree`
 /// - `expect_matchers`: same as for `parse` (see above).
 /// - `sess`: the parsing session. Any errors will be emitted to this session.
+/// - `features`, `attrs`: language feature flags and attributes so that we know whether to use
+///   unstable features or not.
 fn parse_tree<I>(
     tree: tokenstream::TokenTree,
-    trees: &mut I,
+    trees: &mut Peekable<I>,
     expect_matchers: bool,
     sess: &ParseSess,
+    features: &RefCell<Features>,
+    attrs: &[ast::Attribute],
 ) -> TokenTree
 where
     I: Iterator<Item = tokenstream::TokenTree>,
@@ -260,9 +271,9 @@ fn parse_tree<I>(
                     sess.span_diagnostic.span_err(span, &msg);
                 }
                 // Parse the contents of the sequence itself
-                let sequence = parse(delimited.tts.into(), expect_matchers, sess);
+                let sequence = parse(delimited.tts.into(), expect_matchers, sess, features, attrs);
                 // Get the Kleene operator and optional separator
-                let (separator, op) = parse_sep_and_kleene_op(trees, span, sess);
+                let (separator, op) = parse_sep_and_kleene_op(trees, span, sess, features, attrs);
                 // Count the number of captured "names" (i.e. named metavars)
                 let name_captures = macro_parser::count_names(&sequence);
                 TokenTree::Sequence(
@@ -315,12 +326,46 @@ fn parse_tree<I>(
             span,
             Rc::new(Delimited {
                 delim: delimited.delim,
-                tts: parse(delimited.tts.into(), expect_matchers, sess),
+                tts: parse(delimited.tts.into(), expect_matchers, sess, features, attrs),
             }),
         ),
     }
 }
 
+/// Takes a token and returns `Some(KleeneOp)` if the token is `+` `*` or `?`. Otherwise, return
+/// `None`.
+fn kleene_op(token: &token::Token) -> Option<KleeneOp> {
+    match *token {
+        token::BinOp(token::Star) => Some(KleeneOp::ZeroOrMore),
+        token::BinOp(token::Plus) => Some(KleeneOp::OneOrMore),
+        token::Question => Some(KleeneOp::ZeroOrOne),
+        _ => None,
+    }
+}
+
+/// Parse the next token tree of the input looking for a KleeneOp. Returns
+///
+/// - Ok(Ok(op)) if the next token tree is a KleeneOp
+/// - Ok(Err(tok, span)) if the next token tree is a token but not a KleeneOp
+/// - Err(span) if the next token tree is not a token
+fn parse_kleene_op<I>(
+    input: &mut I,
+    span: Span,
+) -> Result<Result<KleeneOp, (token::Token, Span)>, Span>
+where
+    I: Iterator<Item = tokenstream::TokenTree>,
+{
+    match input.next() {
+        Some(tokenstream::TokenTree::Token(span, tok)) => match kleene_op(&tok) {
+            Some(op) => Ok(Ok(op)),
+            None => Ok(Err((tok, span))),
+        },
+        tree => Err(tree.as_ref()
+            .map(tokenstream::TokenTree::span)
+            .unwrap_or(span)),
+    }
+}
+
 /// Attempt to parse a single Kleene star, possibly with a separator.
 ///
 /// For example, in a pattern such as `$(a),*`, `a` is the pattern to be repeated, `,` is the
@@ -334,55 +379,121 @@ fn parse_tree<I>(
 /// operator and separator, then a tuple with `(separator, KleeneOp)` is returned. Otherwise, an
 /// error with the appropriate span is emitted to `sess` and a dummy value is returned.
 fn parse_sep_and_kleene_op<I>(
-    input: &mut I,
+    input: &mut Peekable<I>,
     span: Span,
     sess: &ParseSess,
+    features: &RefCell<Features>,
+    attrs: &[ast::Attribute],
 ) -> (Option<token::Token>, KleeneOp)
 where
     I: Iterator<Item = tokenstream::TokenTree>,
 {
-    fn kleene_op(token: &token::Token) -> Option<KleeneOp> {
-        match *token {
-            token::BinOp(token::Star) => Some(KleeneOp::ZeroOrMore),
-            token::BinOp(token::Plus) => Some(KleeneOp::OneOrMore),
-            _ => None,
+    // We basically look at two token trees here, denoted as #1 and #2 below
+    let span = match parse_kleene_op(input, span) {
+        // #1 is a `+` or `*` KleeneOp
+        //
+        // `?` is ambiguous: it could be a separator or a Kleene::ZeroOrOne, so we need to look
+        // ahead one more token to be sure.
+        Ok(Ok(op)) if op != KleeneOp::ZeroOrOne => return (None, op),
+
+        // #1 is `?` token, but it could be a Kleene::ZeroOrOne without a separator or it could
+        // be a `?` separator followed by any Kleene operator. We need to look ahead 1 token to
+        // find out which.
+        Ok(Ok(op)) => {
+            assert_eq!(op, KleeneOp::ZeroOrOne);
+
+            // Lookahead at #2. If it is a KleenOp, then #1 is a separator.
+            let is_1_sep = if let Some(&tokenstream::TokenTree::Token(_, ref tok2)) = input.peek() {
+                kleene_op(tok2).is_some()
+            } else {
+                false
+            };
+
+            if is_1_sep {
+                // #1 is a separator and #2 should be a KleepeOp::*
+                // (N.B. We need to advance the input iterator.)
+                match parse_kleene_op(input, span) {
+                    // #2 is a KleeneOp (this is the only valid option) :)
+                    Ok(Ok(op)) if op == KleeneOp::ZeroOrOne => {
+                        if !features.borrow().macro_at_most_once_rep
+                            && !attr::contains_name(attrs, "allow_internal_unstable")
+                        {
+                            let explain = feature_gate::EXPLAIN_MACRO_AT_MOST_ONCE_REP;
+                            emit_feature_err(
+                                sess,
+                                "macro_at_most_once_rep",
+                                span,
+                                GateIssue::Language,
+                                explain,
+                            );
+                        }
+                        return (Some(token::Question), op);
+                    }
+                    Ok(Ok(op)) => return (Some(token::Question), op),
+
+                    // #2 is a random token (this is an error) :(
+                    Ok(Err((_, span))) => span,
+
+                    // #2 is not even a token at all :(
+                    Err(span) => span,
+                }
+            } else {
+                if !features.borrow().macro_at_most_once_rep
+                    && !attr::contains_name(attrs, "allow_internal_unstable")
+                {
+                    let explain = feature_gate::EXPLAIN_MACRO_AT_MOST_ONCE_REP;
+                    emit_feature_err(
+                        sess,
+                        "macro_at_most_once_rep",
+                        span,
+                        GateIssue::Language,
+                        explain,
+                    );
+                }
+
+                // #2 is a random tree and #1 is KleeneOp::ZeroOrOne
+                return (None, op);
+            }
         }
-    }
 
-    // We attempt to look at the next two token trees in `input`. I will call the first #1 and the
-    // second #2. If #1 and #2 don't match a valid KleeneOp with/without separator, that is an
-    // error, and we should emit an error on the most specific span possible.
-    let span = match input.next() {
-        // #1 is a token
-        Some(tokenstream::TokenTree::Token(span, tok)) => match kleene_op(&tok) {
-            // #1 is a KleeneOp with no separator
-            Some(op) => return (None, op),
-
-            // #1 is not a KleeneOp, but may be a separator... need to look at #2
-            None => match input.next() {
-                // #2 is a token
-                Some(tokenstream::TokenTree::Token(span, tok2)) => match kleene_op(&tok2) {
-                    // #2 is a KleeneOp, so #1 must be a separator
-                    Some(op) => return (Some(tok), op),
-
-                    // #2 is not a KleeneOp... error
-                    None => span,
-                },
-
-                // #2 is not a token at all... error
-                tree => tree.as_ref()
-                    .map(tokenstream::TokenTree::span)
-                    .unwrap_or(span),
-            },
+        // #1 is a separator followed by #2, a KleeneOp
+        Ok(Err((tok, span))) => match parse_kleene_op(input, span) {
+            // #2 is a KleeneOp :D
+            Ok(Ok(op)) if op == KleeneOp::ZeroOrOne => {
+                if !features.borrow().macro_at_most_once_rep
+                    && !attr::contains_name(attrs, "allow_internal_unstable")
+                {
+                    let explain = feature_gate::EXPLAIN_MACRO_AT_MOST_ONCE_REP;
+                    emit_feature_err(
+                        sess,
+                        "macro_at_most_once_rep",
+                        span,
+                        GateIssue::Language,
+                        explain,
+                    );
+                }
+                return (Some(tok), op);
+            }
+            Ok(Ok(op)) => return (Some(tok), op),
+
+            // #2 is a random token :(
+            Ok(Err((_, span))) => span,
+
+            // #2 is not a token at all :(
+            Err(span) => span,
         },
 
-        // #1 is not a token at all... error
-        tree => tree.as_ref()
-            .map(tokenstream::TokenTree::span)
-            .unwrap_or(span),
+        // #1 is not a token
+        Err(span) => span,
     };
 
-    // Error...
-    sess.span_diagnostic.span_err(span, "expected `*` or `+`");
+    if !features.borrow().macro_at_most_once_rep
+        && !attr::contains_name(attrs, "allow_internal_unstable")
+    {
+        sess.span_diagnostic
+            .span_err(span, "expected one of: `*`, `+`, or `?`");
+    } else {
+        sess.span_diagnostic.span_err(span, "expected `*` or `+`");
+    }
     (None, KleeneOp::ZeroOrMore)
 }
index ae0556320b0efa2ed59aaf2f211ab890f4b7e45d..3b137f9570a390f138b9e9540acc19bd34ba13e5 100644 (file)
@@ -446,6 +446,9 @@ pub fn new() -> Features {
 
     // Allows `#[repr(transparent)]` attribute on newtype structs
     (active, repr_transparent, "1.25.0", Some(43036)),
+
+    // Use `?` as the Kleene "at most one" operator
+    (active, macro_at_most_once_rep, "1.25.0", Some(48075)),
 );
 
 declare_features! (
@@ -538,7 +541,7 @@ pub fn new() -> Features {
     // instead of just the platforms on which it is the C ABI
     (accepted, abi_sysv64, "1.24.0", Some(36167)),
     // Allows `repr(align(16))` struct attribute (RFC 1358)
-    (accepted, repr_align, "1.24.0", Some(33626)),
+    (accepted, repr_align, "1.25.0", Some(33626)),
     // allow '|' at beginning of match arms (RFC 1925)
     (accepted, match_beginning_vert, "1.25.0", Some(44101)),
     // Nested groups in `use` (RFC 2128)
@@ -1258,6 +1261,9 @@ fn leveled_feature_err<'a>(sess: &'a ParseSess, feature: &str, span: Span, issue
 pub const EXPLAIN_UNSIZED_TUPLE_COERCION: &'static str =
     "Unsized tuple coercion is not stable enough for use and is subject to change";
 
+pub const EXPLAIN_MACRO_AT_MOST_ONCE_REP: &'static str =
+    "Using the `?` macro Kleene operator for \"at most one\" repetition is unstable";
+
 struct PostExpansionVisitor<'a> {
     context: &'a Context<'a>,
 }
index dc3745fc4a3eebb9d3f461f3e7bdf3f6dd63575f..ac582627f88fdb34f6022c557180cbb169c1b9ba 100644 (file)
@@ -4859,19 +4859,30 @@ fn parse_fn_args(&mut self, named_args: bool, allow_variadic: bool)
                 |p| {
                     if p.token == token::DotDotDot {
                         p.bump();
+                        variadic = true;
                         if allow_variadic {
                             if p.token != token::CloseDelim(token::Paren) {
                                 let span = p.span;
                                 p.span_err(span,
                                     "`...` must be last in argument list for variadic function");
                             }
+                            Ok(None)
                         } else {
-                            let span = p.span;
-                            p.span_err(span,
-                                       "only foreign functions are allowed to be variadic");
+                            let span = p.prev_span;
+                            if p.token == token::CloseDelim(token::Paren) {
+                                // continue parsing to present any further errors
+                                p.struct_span_err(
+                                    span,
+                                    "only foreign functions are allowed to be variadic"
+                                ).emit();
+                                Ok(Some(dummy_arg(span)))
+                           } else {
+                               // this function definition looks beyond recovery, stop parsing
+                                p.span_err(span,
+                                           "only foreign functions are allowed to be variadic");
+                                Ok(None)
+                            }
                         }
-                        variadic = true;
-                        Ok(None)
                     } else {
                         match p.parse_arg_general(named_args) {
                             Ok(arg) => Ok(Some(arg)),
diff --git a/src/rustllvm/Linker.cpp b/src/rustllvm/Linker.cpp
new file mode 100644 (file)
index 0000000..534e4b9
--- /dev/null
@@ -0,0 +1,72 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#include "llvm/Linker/Linker.h"
+
+#include "rustllvm.h"
+
+using namespace llvm;
+
+struct RustLinker {
+  Linker L;
+  LLVMContext &Ctx;
+
+  RustLinker(Module &M) :
+    L(M),
+    Ctx(M.getContext())
+  {}
+};
+
+extern "C" RustLinker*
+LLVMRustLinkerNew(LLVMModuleRef DstRef) {
+  Module *Dst = unwrap(DstRef);
+
+  auto Ret = llvm::make_unique<RustLinker>(*Dst);
+  return Ret.release();
+}
+
+extern "C" void
+LLVMRustLinkerFree(RustLinker *L) {
+  delete L;
+}
+
+extern "C" bool
+LLVMRustLinkerAdd(RustLinker *L, char *BC, size_t Len) {
+  std::unique_ptr<MemoryBuffer> Buf =
+      MemoryBuffer::getMemBufferCopy(StringRef(BC, Len));
+
+#if LLVM_VERSION_GE(4, 0)
+  Expected<std::unique_ptr<Module>> SrcOrError =
+      llvm::getLazyBitcodeModule(Buf->getMemBufferRef(), L->Ctx);
+  if (!SrcOrError) {
+    LLVMRustSetLastError(toString(SrcOrError.takeError()).c_str());
+    return false;
+  }
+
+  auto Src = std::move(*SrcOrError);
+#else
+  ErrorOr<std::unique_ptr<Module>> Src =
+      llvm::getLazyBitcodeModule(std::move(Buf), L->Ctx);
+  if (!Src) {
+    LLVMRustSetLastError(Src.getError().message().c_str());
+    return false;
+  }
+#endif
+
+#if LLVM_VERSION_GE(4, 0)
+  if (L->L.linkInModule(std::move(Src))) {
+#else
+  if (L->L.linkInModule(std::move(Src.get()))) {
+#endif
+    LLVMRustSetLastError("");
+    return false;
+  }
+  return true;
+}
index 4dfc4029d75dcbeee5b186eb1bbb0ecc1f82f6a3..27d5496f57628c4c7d6c05c41a6fee03f12357c3 100644 (file)
@@ -916,46 +916,6 @@ extern "C" void LLVMRustWriteValueToString(LLVMValueRef V,
   }
 }
 
-extern "C" bool LLVMRustLinkInExternalBitcode(LLVMModuleRef DstRef, char *BC,
-                                              size_t Len) {
-  Module *Dst = unwrap(DstRef);
-
-  std::unique_ptr<MemoryBuffer> Buf =
-      MemoryBuffer::getMemBufferCopy(StringRef(BC, Len));
-
-#if LLVM_VERSION_GE(4, 0)
-  Expected<std::unique_ptr<Module>> SrcOrError =
-      llvm::getLazyBitcodeModule(Buf->getMemBufferRef(), Dst->getContext());
-  if (!SrcOrError) {
-    LLVMRustSetLastError(toString(SrcOrError.takeError()).c_str());
-    return false;
-  }
-
-  auto Src = std::move(*SrcOrError);
-#else
-  ErrorOr<std::unique_ptr<Module>> Src =
-      llvm::getLazyBitcodeModule(std::move(Buf), Dst->getContext());
-  if (!Src) {
-    LLVMRustSetLastError(Src.getError().message().c_str());
-    return false;
-  }
-#endif
-
-  std::string Err;
-
-  raw_string_ostream Stream(Err);
-  DiagnosticPrinterRawOStream DP(Stream);
-#if LLVM_VERSION_GE(4, 0)
-  if (Linker::linkModules(*Dst, std::move(Src))) {
-#else
-  if (Linker::linkModules(*Dst, std::move(Src.get()))) {
-#endif
-    LLVMRustSetLastError(Err.c_str());
-    return false;
-  }
-  return true;
-}
-
 // Note that the two following functions look quite similar to the
 // LLVMGetSectionName function. Sadly, it appears that this function only
 // returns a char* pointer, which isn't guaranteed to be null-terminated. The
diff --git a/src/test/codegen/abi-x86_64_sysv.rs b/src/test/codegen/abi-x86_64_sysv.rs
new file mode 100644 (file)
index 0000000..88666e9
--- /dev/null
@@ -0,0 +1,39 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// only-x86_64
+
+// compile-flags: -C no-prepopulate-passes
+
+#![crate_type = "lib"]
+
+pub struct S24 {
+  a: i8,
+  b: i8,
+  c: i8,
+}
+
+pub struct S48 {
+  a: i16,
+  b: i16,
+  c: i8,
+}
+
+// CHECK: i24 @struct_24_bits(i24
+#[no_mangle]
+pub extern "sysv64" fn struct_24_bits(a: S24) -> S24 {
+  a
+}
+
+// CHECK: i48 @struct_48_bits(i48
+#[no_mangle]
+pub extern "sysv64" fn struct_48_bits(a: S48) -> S48 {
+  a
+}
diff --git a/src/test/codegen/repr-transparent-sysv64.rs b/src/test/codegen/repr-transparent-sysv64.rs
new file mode 100644 (file)
index 0000000..7a30983
--- /dev/null
@@ -0,0 +1,39 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// only-x86_64
+
+// compile-flags: -C no-prepopulate-passes
+
+#![crate_type="lib"]
+#![feature(repr_transparent)]
+
+#[repr(C)]
+pub struct Rgb8 { r: u8, g: u8, b: u8 }
+
+#[repr(transparent)]
+pub struct Rgb8Wrap(Rgb8);
+
+// CHECK: i24 @test_Rgb8Wrap(i24)
+#[no_mangle]
+pub extern "sysv64" fn test_Rgb8Wrap(_: Rgb8Wrap) -> Rgb8Wrap { loop {} }
+
+#[repr(C)]
+pub union FloatBits {
+    float: f32,
+    bits: u32,
+}
+
+#[repr(transparent)]
+pub struct SmallUnion(FloatBits);
+
+// CHECK: i32 @test_SmallUnion(i32)
+#[no_mangle]
+pub extern "sysv64" fn test_SmallUnion(_: SmallUnion) -> SmallUnion { loop {} }
index 31020d8b94f80b5eb1bf546c280a6b72d33daca6..087fa9b16b4ed06a3eae5a7a1842827c26f45f8c 100644 (file)
@@ -123,55 +123,13 @@ pub struct UnitPhantom<T, U> { val: T, unit: PhantomData<U> }
 pub extern fn test_Projection(_: StructWithProjection) -> StructWithProjection { loop {} }
 
 
-// The rest of this file tests newtypes around small aggregates on an ABI where small aggregates are
-// packed into one register. This is ABI-dependent, so instead we focus on one ABI and supply a
-// dummy definition for other ABIs to keep FileCheck happy.
+// All that remains to be tested are aggregates. They are tested in separate files called repr-
+// transparent-*.rs  with `only-*` or `ignore-*` directives, because the expected LLVM IR
+// function signatures vary so much that it's not reasonably possible to cover all of them with a
+// single CHECK line.
 //
-// Bigger aggregates are tested in separate files called repr-transparent-aggregate-*.rs because
-// there, the expected LLVM IR function signatures vary so much that it's not reasonably possible to
-// cover all of them with a single CHECK line. Instead we group ABIs by the general "shape" of the
-// signature and have a separate test file for each bin.
-//
-// PS: You may be wondering why we don't just compare the return types and argument types for
-// equality with FileCheck regex captures. Well, rustc doesn't perform newtype unwrapping on
-// newtypes containing aggregates. This is OK on all ABIs we support, but because LLVM has not
-// gotten rid of pointee types yet, the IR function signature will be syntactically different (%Foo*
-// vs %FooWrapper*).
-
-#[repr(C)]
-pub struct Rgb8 { r: u8, g: u8, b: u8 }
-
-#[repr(transparent)]
-pub struct Rgb8Wrap(Rgb8);
-
-// NB: closing parenthesis is missing because sometimes the argument has a name and sometimes not
-// CHECK: define i32 @test_Rgb8Wrap(i32
-#[no_mangle]
-#[cfg(all(target_arch="x86_64", target_os="linux"))]
-pub extern fn test_Rgb8Wrap(_: Rgb8Wrap) -> Rgb8Wrap { loop {} }
-
-#[cfg(not(all(target_arch="x86_64", target_os="linux")))]
-#[no_mangle]
-pub extern fn test_Rgb8Wrap(_: u32) -> u32 { loop {} }
-
-// Same as with the small struct above: ABI-dependent, we only test the interesting case
-// (ABIs that pack the aggregate into a scalar) and stub it out on other ABIs
-
-#[repr(C)]
-pub union FloatBits {
-    float: f32,
-    bits: u32,
-}
-
-#[repr(transparent)]
-pub struct SmallUnion(FloatBits);
-
-// NB: closing parenthesis is missing because sometimes the argument has a name and sometimes not
-// CHECK: define i32 @test_SmallUnion(i32
-#[no_mangle]
-#[cfg(all(target_arch="x86_64", target_os="linux"))]
-pub extern fn test_SmallUnion(_: SmallUnion) -> SmallUnion { loop {} }
-
-#[cfg(not(all(target_arch="x86_64", target_os="linux")))]
-#[no_mangle]
-pub extern fn test_SmallUnion(_: u32) -> u32 { loop {} }
+// You may be wondering why we don't just compare the return types and argument types for equality
+// with FileCheck regex captures. Well, rustc doesn't perform newtype unwrapping on newtypes
+// containing aggregates. This is OK on all ABIs we support, but because LLVM has not gotten rid of
+// pointee types yet, the IR function signature will be syntactically different (%Foo* vs
+// %FooWrapper*).
diff --git a/src/test/compile-fail/E0001.rs b/src/test/compile-fail/E0001.rs
deleted file mode 100644 (file)
index b72b0d6..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![deny(unreachable_patterns)]
-
-fn main() {
-    let foo = Some(1);
-    match foo {
-        Some(_) => {/* ... */}
-        None => {/* ... */}
-        _ => {/* ... */} //~ ERROR unreachable pattern
-    }
-}
diff --git a/src/test/compile-fail/E0004-2.rs b/src/test/compile-fail/E0004-2.rs
deleted file mode 100644 (file)
index 824b86c..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let x = Some(1);
-
-    match x { } //~ ERROR E0004
-}
diff --git a/src/test/compile-fail/E0004.rs b/src/test/compile-fail/E0004.rs
deleted file mode 100644 (file)
index 8df07a0..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum Terminator {
-    HastaLaVistaBaby,
-    TalkToMyHand,
-}
-
-fn main() {
-    let x = Terminator::HastaLaVistaBaby;
-
-    match x { //~ ERROR E0004
-        Terminator::TalkToMyHand => {}
-    }
-}
diff --git a/src/test/compile-fail/E0005.rs b/src/test/compile-fail/E0005.rs
deleted file mode 100644 (file)
index 0405bba..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let x = Some(1);
-    let Some(y) = x; //~ ERROR E0005
-}
diff --git a/src/test/compile-fail/E0007.rs b/src/test/compile-fail/E0007.rs
deleted file mode 100644 (file)
index d5acbde..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let x = Some("s".to_string());
-    match x {
-        op_string @ Some(s) => {},
-        //~^ ERROR E0007
-        //~| ERROR E0303
-        None => {},
-    }
-}
diff --git a/src/test/compile-fail/E0008.rs b/src/test/compile-fail/E0008.rs
deleted file mode 100644 (file)
index ba5720e..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    match Some("hi".to_string()) {
-        Some(s) if s.len() == 0 => {},
-        //~^ ERROR E0008
-        _ => {},
-    }
-}
diff --git a/src/test/compile-fail/E0009.rs b/src/test/compile-fail/E0009.rs
deleted file mode 100644 (file)
index 02e2e80..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    struct X { x: (), }
-    let x = Some((X { x: () }, X { x: () }));
-    match x {
-        Some((y, ref z)) => {},
-        //~^ ERROR E0009
-        None => panic!()
-    }
-}
diff --git a/src/test/compile-fail/E0010.rs b/src/test/compile-fail/E0010.rs
deleted file mode 100644 (file)
index 66a9319..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(box_syntax)]
-#![allow(warnings)]
-
-const CON : Box<i32> = box 0; //~ ERROR E0010
-
-fn main() {}
diff --git a/src/test/compile-fail/E0017.rs b/src/test/compile-fail/E0017.rs
deleted file mode 100644 (file)
index c98c35a..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-static X: i32 = 1;
-const C: i32 = 2;
-
-const CR: &'static mut i32 = &mut C; //~ ERROR E0017
-static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
-                                              //~| ERROR cannot borrow
-static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017
-fn main() {}
diff --git a/src/test/compile-fail/E0023.rs b/src/test/compile-fail/E0023.rs
deleted file mode 100644 (file)
index 24032c5..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum Fruit {
-    Apple(String, String),
-    Pear(u32),
-}
-
-
-fn main() {
-    let x = Fruit::Apple(String::new(), String::new());
-    match x {
-        Fruit::Apple(a) => {}, //~ ERROR E0023
-        Fruit::Apple(a, b, c) => {}, //~ ERROR E0023
-        Fruit::Pear(1, 2) => {}, //~ ERROR E0023
-    }
-}
diff --git a/src/test/compile-fail/E0025.rs b/src/test/compile-fail/E0025.rs
deleted file mode 100644 (file)
index 81d0ea8..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo {
-    a: u8,
-    b: u8,
-}
-
-fn main() {
-    let x = Foo { a:1, b:2 };
-    let Foo { a: x, a: y, b: 0 } = x;
-    //~^ ERROR field `a` bound multiple times in the pattern
-}
diff --git a/src/test/compile-fail/E0026.rs b/src/test/compile-fail/E0026.rs
deleted file mode 100644 (file)
index f8ad7b5..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Thing {
-    x: u32,
-    y: u32
-}
-
-fn main() {
-    let thing = Thing { x: 0, y: 0 };
-    match thing {
-        Thing { x, y, z } => {}
-        //~^ ERROR struct `Thing` does not have a field named `z` [E0026]
-    }
-}
diff --git a/src/test/compile-fail/E0027.rs b/src/test/compile-fail/E0027.rs
deleted file mode 100644 (file)
index b63b0ab..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Dog {
-    name: String,
-    age: u32,
-}
-
-fn main() {
-    let d = Dog { name: "Rusty".to_string(), age: 8 };
-
-    match d {
-        Dog { age: x } => {}
-        //~^ ERROR pattern does not mention field `name`
-    }
-}
diff --git a/src/test/compile-fail/E0029.rs b/src/test/compile-fail/E0029.rs
deleted file mode 100644 (file)
index 80d215b..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let s = "hoho";
-
-    match s {
-        "hello" ... "world" => {}
-        //~^ ERROR only char and numeric types are allowed in range patterns
-        //~| ERROR non-reference pattern used to match a reference
-        _ => {}
-    }
-}
diff --git a/src/test/compile-fail/E0030.rs b/src/test/compile-fail/E0030.rs
deleted file mode 100644 (file)
index ef3bded..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-
-fn main() {
-    match 5u32 {
-        1000 ... 5 => {}
-        //~^ ERROR lower range bound must be less than or equal to upper
-    }
-}
diff --git a/src/test/compile-fail/E0033.rs b/src/test/compile-fail/E0033.rs
deleted file mode 100644 (file)
index 3cdbb55..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait SomeTrait {
-    fn foo();
-}
-
-fn main() {
-    let trait_obj: &SomeTrait = SomeTrait;
-    //~^ ERROR expected value, found trait `SomeTrait`
-    //~| ERROR E0038
-    //~| method `foo` has no receiver
-
-    let &invalid = trait_obj;
-    //~^ ERROR E0033
-}
diff --git a/src/test/compile-fail/E0034.rs b/src/test/compile-fail/E0034.rs
deleted file mode 100644 (file)
index 6eebd4d..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Test;
-
-trait Trait1 {
-    fn foo();
-}
-
-trait Trait2 {
-    fn foo();
-}
-
-impl Trait1 for Test {
-    fn foo() {}
-}
-
-impl Trait2 for Test {
-    fn foo() {}
-}
-
-fn main() {
-    Test::foo() //~ ERROR multiple applicable items in scope
-}
diff --git a/src/test/compile-fail/E0038.rs b/src/test/compile-fail/E0038.rs
deleted file mode 100644 (file)
index 8087928..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Trait {
-    fn foo(&self) -> Self;
-}
-
-fn call_foo(x: Box<Trait>) {
-    //~^ ERROR E0038
-    let y = x.foo();
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0040.rs b/src/test/compile-fail/E0040.rs
deleted file mode 100644 (file)
index 8385d68..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo {
-    x: i32,
-}
-
-impl Drop for Foo {
-    fn drop(&mut self) {
-        println!("kaboom");
-    }
-}
-
-fn main() {
-    let mut x = Foo { x: -7 };
-    x.drop();
-    //~^ ERROR E0040
-}
diff --git a/src/test/compile-fail/E0044.rs b/src/test/compile-fail/E0044.rs
deleted file mode 100644 (file)
index 48fe230..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-extern { fn some_func<T>(x: T); } //~ ERROR E0044
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0045.rs b/src/test/compile-fail/E0045.rs
deleted file mode 100644 (file)
index 57c639d..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-extern "Rust" { fn foo(x: u8, ...); }   //~ ERROR E0045
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0049.rs b/src/test/compile-fail/E0049.rs
deleted file mode 100644 (file)
index 5867e11..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Foo {
-    fn foo<T: Default>(x: T) -> Self;
-}
-
-struct Bar;
-
-impl Foo for Bar {
-    fn foo(x: bool) -> Self { Bar } //~ ERROR E0049
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0050.rs b/src/test/compile-fail/E0050.rs
deleted file mode 100644 (file)
index 2ccc380..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Foo {
-    fn foo(&self, x: u8) -> bool;
-    fn bar(&self, x: u8, y: u8, z: u8);
-    fn less(&self);
-}
-
-struct Bar;
-
-impl Foo for Bar {
-    fn foo(&self) -> bool { true } //~ ERROR E0050
-    fn bar(&self) { } //~ ERROR E0050
-    fn less(&self, x: u8, y: u8, z: u8) { } //~ ERROR E0050
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0054.rs b/src/test/compile-fail/E0054.rs
deleted file mode 100644 (file)
index 158cd6f..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let x = 5;
-    let x_is_nonzero = x as bool; //~ ERROR E0054
-}
diff --git a/src/test/compile-fail/E0055.rs b/src/test/compile-fail/E0055.rs
deleted file mode 100644 (file)
index 6e186b8..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![recursion_limit="2"]
-struct Foo;
-
-impl Foo {
-    fn foo(&self) {}
-}
-
-fn main() {
-    let foo = Foo;
-    let ref_foo = &&Foo;
-    ref_foo.foo();
-    //~^ ERROR E0055
-}
diff --git a/src/test/compile-fail/E0057.rs b/src/test/compile-fail/E0057.rs
deleted file mode 100644 (file)
index 1fb5498..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let f = |x| x * 3;
-    let a = f(); //~ ERROR E0057
-    let b = f(4);
-    let c = f(2, 3); //~ ERROR E0057
-}
diff --git a/src/test/compile-fail/E0059.rs b/src/test/compile-fail/E0059.rs
deleted file mode 100644 (file)
index 4ae9b2f..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(unboxed_closures)]
-
-fn foo<F: Fn<i32>>(f: F) -> F::Output { f(3) } //~ ERROR E0059
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0060.rs b/src/test/compile-fail/E0060.rs
deleted file mode 100644 (file)
index f450520..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-extern "C" {
-    fn printf(_: *const u8, ...) -> u32;
-}
-
-fn main() {
-    unsafe { printf(); }
-    //~^ ERROR E0060
-    //~| expected at least 1 parameter
-}
diff --git a/src/test/compile-fail/E0061.rs b/src/test/compile-fail/E0061.rs
deleted file mode 100644 (file)
index 221e18c..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn f(a: u16, b: &str) {}
-
-fn f2(a: u16) {}
-
-fn main() {
-    f(0);
-    //~^ ERROR E0061
-    //~| expected 2 parameters
-
-    f2();
-    //~^ ERROR E0061
-    //~| expected 1 parameter
-}
diff --git a/src/test/compile-fail/E0062.rs b/src/test/compile-fail/E0062.rs
deleted file mode 100644 (file)
index 684c946..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo {
-    x: i32
-}
-
-fn main() {
-    let x = Foo {
-        x: 0,
-        x: 0,
-        //~^ ERROR E0062
-    };
-}
diff --git a/src/test/compile-fail/E0063.rs b/src/test/compile-fail/E0063.rs
deleted file mode 100644 (file)
index 0208aff..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-tidy-linelength
-
-struct SingleFoo {
-    x: i32
-}
-
-struct PluralFoo {
-    x: i32,
-    y: i32,
-    z: i32
-}
-
-struct TruncatedFoo {
-    a: i32,
-    b: i32,
-    x: i32,
-    y: i32,
-    z: i32
-}
-
-struct TruncatedPluralFoo {
-    a: i32,
-    b: i32,
-    c: i32,
-    x: i32,
-    y: i32,
-    z: i32
-}
-
-
-fn main() {
-    let w = SingleFoo { };
-    //~^ ERROR missing field `x` in initializer of `SingleFoo`
-    let x = PluralFoo {x: 1};
-    //~^ ERROR missing fields `y`, `z` in initializer of `PluralFoo`
-    let y = TruncatedFoo{x:1};
-    //~^ missing fields `a`, `b`, `y` and 1 other field in initializer of `TruncatedFoo`
-    let z = TruncatedPluralFoo{x:1};
-    //~^ ERROR missing fields `a`, `b`, `c` and 2 other fields in initializer of `TruncatedPluralFoo`
-}
diff --git a/src/test/compile-fail/E0067.rs b/src/test/compile-fail/E0067.rs
deleted file mode 100644 (file)
index a3fc30e..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::collections::LinkedList;
-
-fn main() {
-    LinkedList::new() += 1; //~ ERROR E0368
-                            //~^ ERROR E0067
-}
diff --git a/src/test/compile-fail/E0069.rs b/src/test/compile-fail/E0069.rs
deleted file mode 100644 (file)
index a6a7898..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn foo() -> u8 {
-    return;
-    //~^ ERROR `return;` in a function whose return type is not `()`
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0070.rs b/src/test/compile-fail/E0070.rs
deleted file mode 100644 (file)
index ba66bd0..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-const SOME_CONST : i32 = 12;
-
-fn some_other_func() {}
-
-fn some_function() {
-    SOME_CONST = 14; //~ ERROR E0070
-    1 = 3; //~ ERROR E0070
-    some_other_func() = 4; //~ ERROR E0070
-                           //~^ ERROR E0308
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0071.rs b/src/test/compile-fail/E0071.rs
deleted file mode 100644 (file)
index d71dc79..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum Foo {}
-type FooAlias = Foo;
-
-fn main() {
-    let u = FooAlias { value: 0 };
-    //~^ ERROR expected struct, variant or union type, found enum `Foo` [E0071]
-}
diff --git a/src/test/compile-fail/E0075.rs b/src/test/compile-fail/E0075.rs
deleted file mode 100644 (file)
index d778390..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(repr_simd)]
-
-#[repr(simd)]
-struct Bad; //~ ERROR E0075
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0076.rs b/src/test/compile-fail/E0076.rs
deleted file mode 100644 (file)
index b159cf1..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(repr_simd)]
-
-#[repr(simd)]
-struct Bad(u16, u32, u32);
-//~^ ERROR E0076
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0077.rs b/src/test/compile-fail/E0077.rs
deleted file mode 100644 (file)
index b074e90..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(repr_simd)]
-
-#[repr(simd)]
-struct Bad(String); //~ ERROR E0077
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0080.rs b/src/test/compile-fail/E0080.rs
deleted file mode 100644 (file)
index 2f199c4..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum Enum {
-    X = (1 << 500), //~ ERROR E0080
-    //~| WARNING shift left with overflow
-    Y = (1 / 0) //~ ERROR E0080
-    //~| WARNING divide by zero
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0081.rs b/src/test/compile-fail/E0081.rs
deleted file mode 100644 (file)
index 3b57166..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum Enum {
-    P = 3,
-    X = 3,
-    //~^ ERROR discriminant value `3isize` already exists
-    Y = 5
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0084.rs b/src/test/compile-fail/E0084.rs
deleted file mode 100644 (file)
index 2be206c..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[repr(i32)] //~ ERROR: E0084
-enum Foo {}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0087.rs b/src/test/compile-fail/E0087.rs
deleted file mode 100644 (file)
index 6dc0886..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn foo() {}
-fn bar<T>() {}
-
-fn main() {
-    foo::<f64>(); //~ ERROR expected at most 0 type parameters, found 1 type parameter [E0087]
-
-    bar::<f64, u64>(); //~ ERROR expected at most 1 type parameter, found 2 type parameters [E0087]
-}
diff --git a/src/test/compile-fail/E0088.rs b/src/test/compile-fail/E0088.rs
deleted file mode 100644 (file)
index db84a4e..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn f() {}
-fn g<'a>() -> &'a u8 { loop {} }
-
-fn main() {
-    f::<'static>(); //~ ERROR E0088
-    g::<'static, 'static>(); //~ ERROR E0088
-}
diff --git a/src/test/compile-fail/E0089.rs b/src/test/compile-fail/E0089.rs
deleted file mode 100644 (file)
index 21df9ab..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn foo<T, U>() {}
-
-fn main() {
-    foo::<f64>(); //~ ERROR expected 2 type parameters, found 1 type parameter [E0089]
-}
diff --git a/src/test/compile-fail/E0090.rs b/src/test/compile-fail/E0090.rs
deleted file mode 100644 (file)
index 13b2131..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn foo<'a: 'b, 'b: 'a>() {}
-
-fn main() {
-    foo::<'static>(); //~ ERROR expected 2 lifetime parameters, found 1 lifetime parameter [E0090]
-}
diff --git a/src/test/compile-fail/E0091.rs b/src/test/compile-fail/E0091.rs
deleted file mode 100644 (file)
index da988db..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-type Foo<T> = u32; //~ ERROR E0091
-type Foo2<A, B> = Box<A>; //~ ERROR E0091
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0092.rs b/src/test/compile-fail/E0092.rs
deleted file mode 100644 (file)
index b08164a..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(intrinsics)]
-extern "rust-intrinsic" {
-    fn atomic_foo(); //~ ERROR E0092
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0093.rs b/src/test/compile-fail/E0093.rs
deleted file mode 100644 (file)
index d84f9f6..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(intrinsics)]
-extern "rust-intrinsic" {
-    fn foo();
-    //~^ ERROR E0093
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0094.rs b/src/test/compile-fail/E0094.rs
deleted file mode 100644 (file)
index 3a31874..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(intrinsics)]
-extern "rust-intrinsic" {
-    fn size_of<T, U>() -> usize; //~ ERROR E0094
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0106.rs b/src/test/compile-fail/E0106.rs
deleted file mode 100644 (file)
index 0674930..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo {
-    x: &bool,
-    //~^ ERROR E0106
-}
-enum Bar {
-    A(u8),
-    B(&bool),
-   //~^ ERROR E0106
-}
-type MyStr = &str;
-        //~^ ERROR E0106
-
-struct Baz<'a>(&'a str);
-struct Buzz<'a, 'b>(&'a str, &'b str);
-
-struct Quux {
-    baz: Baz,
-    //~^ ERROR E0106
-    //~| expected lifetime parameter
-    buzz: Buzz,
-    //~^ ERROR E0106
-    //~| expected 2 lifetime parameters
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0107.rs b/src/test/compile-fail/E0107.rs
deleted file mode 100644 (file)
index 16ebd3e..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo<'a>(&'a str);
-struct Buzz<'a, 'b>(&'a str, &'b str);
-
-enum Bar {
-    A,
-    B,
-    C,
-}
-
-struct Baz<'a, 'b, 'c> {
-    buzz: Buzz<'a>,
-    //~^ ERROR E0107
-    //~| expected 2 lifetime parameters
-    bar: Bar<'a>,
-    //~^ ERROR E0107
-    //~| unexpected lifetime parameter
-    foo2: Foo<'a, 'b, 'c>,
-    //~^ ERROR E0107
-    //~| 2 unexpected lifetime parameters
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0109.rs b/src/test/compile-fail/E0109.rs
deleted file mode 100644 (file)
index 9fc4784..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-type X = u32<i32>; //~ ERROR E0109
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0110.rs b/src/test/compile-fail/E0110.rs
deleted file mode 100644 (file)
index fd169f4..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-type X = u32<'static>; //~ ERROR E0110
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0116.rs b/src/test/compile-fail/E0116.rs
deleted file mode 100644 (file)
index cd7d8dc..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-impl Vec<u8> {}
-//~^ ERROR E0116
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0117.rs b/src/test/compile-fail/E0117.rs
deleted file mode 100644 (file)
index 982f875..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-impl Drop for u32 {} //~ ERROR E0117
-//~| ERROR the Drop trait may only be implemented on structures
-//~| implementing Drop requires a struct
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0118.rs b/src/test/compile-fail/E0118.rs
deleted file mode 100644 (file)
index d37ff34..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-impl (u8, u8) { //~ ERROR E0118
-    fn get_state(&self) -> String {
-        String::new()
-    }
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0119.rs b/src/test/compile-fail/E0119.rs
deleted file mode 100644 (file)
index 9528631..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait MyTrait {
-    fn get(&self) -> usize;
-}
-
-impl<T> MyTrait for T {
-    fn get(&self) -> usize { 0 }
-}
-
-struct Foo {
-    value: usize
-}
-
-impl MyTrait for Foo { //~ ERROR E0119
-    fn get(&self) -> usize { self.value }
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0120.rs b/src/test/compile-fail/E0120.rs
deleted file mode 100644 (file)
index 8d09b87..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait MyTrait { fn foo() {} }
-
-impl Drop for MyTrait {
-              //~^ ERROR E0120
-    fn drop(&mut self) {}
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0121.rs b/src/test/compile-fail/E0121.rs
deleted file mode 100644 (file)
index b26b5f4..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn foo() -> _ { 5 } //~ ERROR E0121
-
-static BAR: _ = "test"; //~ ERROR E0121
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0124.rs b/src/test/compile-fail/E0124.rs
deleted file mode 100644 (file)
index 3ef20c6..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo {
-    field1: i32,
-    field1: i32,
-    //~^ ERROR field `field1` is already declared [E0124]
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0128.rs b/src/test/compile-fail/E0128.rs
deleted file mode 100644 (file)
index 3707101..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo<T=U, U=()> { //~ ERROR E0128
-    field1: T,
-    field2: U,
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0130.rs b/src/test/compile-fail/E0130.rs
deleted file mode 100644 (file)
index d11b59c..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-extern {
-    fn foo((a, b): (u32, u32));
-    //~^ ERROR E0130
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0131.rs b/src/test/compile-fail/E0131.rs
deleted file mode 100644 (file)
index c7e31ed..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main<T>() {
-    //~^ ERROR E0131
-}
diff --git a/src/test/compile-fail/E0132.rs b/src/test/compile-fail/E0132.rs
deleted file mode 100644 (file)
index 25ccb34..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(start)]
-
-#[start]
-fn f< T >() {} //~ ERROR E0132
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0133.rs b/src/test/compile-fail/E0133.rs
deleted file mode 100644 (file)
index 2e54f65..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-unsafe fn f() { return; }
-
-fn main() {
-    f();
-    //~^ ERROR E0133
-}
diff --git a/src/test/compile-fail/E0137.rs b/src/test/compile-fail/E0137.rs
deleted file mode 100644 (file)
index 067ebcc..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(main)]
-
-#[main]
-fn foo() {}
-
-#[main]
-fn f() {}
-//~^ ERROR E0137
diff --git a/src/test/compile-fail/E0138.rs b/src/test/compile-fail/E0138.rs
deleted file mode 100644 (file)
index 856616c..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(start)]
-
-#[start]
-fn foo(argc: isize, argv: *const *const u8) -> isize { 0 }
-
-#[start]
-fn f(argc: isize, argv: *const *const u8) -> isize { 0 }
-//~^ ERROR E0138
diff --git a/src/test/compile-fail/E0152.rs b/src/test/compile-fail/E0152.rs
deleted file mode 100644 (file)
index ae501b9..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(lang_items)]
-
-#[lang = "panic_fmt"]
-struct Foo; //~ ERROR E0152
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0161.rs b/src/test/compile-fail/E0161.rs
deleted file mode 100644 (file)
index 81adf90..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(box_syntax)]
-
-fn main() {
-    let _x: Box<str> = box *"hello"; //~ ERROR E0161
-                                     //~^ ERROR E0507
-}
diff --git a/src/test/compile-fail/E0162.rs b/src/test/compile-fail/E0162.rs
deleted file mode 100644 (file)
index e13b0af..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Irrefutable(i32);
-
-fn main() {
-    let irr = Irrefutable(0);
-    if let Irrefutable(x) = irr { //~ ERROR E0162
-        println!("{}", x);
-    }
-}
diff --git a/src/test/compile-fail/E0164.rs b/src/test/compile-fail/E0164.rs
deleted file mode 100644 (file)
index a7f10dd..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-
-enum Foo {}
-
-impl Foo {
-    const B: u8 = 0;
-}
-
-fn bar(foo: Foo) -> u32 {
-    match foo {
-        Foo::B(i) => i, //~ ERROR E0164
-    }
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0165.rs b/src/test/compile-fail/E0165.rs
deleted file mode 100644 (file)
index 142635f..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Irrefutable(i32);
-
-fn main() {
-    let irr = Irrefutable(0);
-    while let Irrefutable(x) = irr { //~ ERROR E0165
-                                     //~| irrefutable pattern
-        // ...
-    }
-}
diff --git a/src/test/compile-fail/E0184.rs b/src/test/compile-fail/E0184.rs
deleted file mode 100644 (file)
index 5d72d00..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[derive(Copy)] //~ ERROR E0184
-struct Foo;
-
-impl Drop for Foo {
-    fn drop(&mut self) {
-    }
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0185.rs b/src/test/compile-fail/E0185.rs
deleted file mode 100644 (file)
index 0cd3d00..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Foo {
-    fn foo();
-    //~^ NOTE trait method declared without `&self`
-}
-
-struct Bar;
-
-impl Foo for Bar {
-    fn foo(&self) {}
-    //~^ ERROR E0185
-    //~| NOTE `&self` used in impl
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0186.rs b/src/test/compile-fail/E0186.rs
deleted file mode 100644 (file)
index 55a3490..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Foo {
-    fn foo(&self); //~ `&self` used in trait
-}
-
-struct Bar;
-
-impl Foo for Bar {
-    fn foo() {} //~ ERROR E0186
-    //~^ expected `&self` in impl
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0191.rs b/src/test/compile-fail/E0191.rs
deleted file mode 100644 (file)
index 489ebb0..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Trait {
-    type Bar;
-}
-
-type Foo = Trait; //~ ERROR E0191
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0192.rs b/src/test/compile-fail/E0192.rs
deleted file mode 100644 (file)
index 92f5876..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(optin_builtin_traits)]
-
-trait Trait {
-    type Bar;
-}
-
-struct Foo;
-
-impl !Trait for Foo { } //~ ERROR E0192
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0194.rs b/src/test/compile-fail/E0194.rs
deleted file mode 100644 (file)
index 17e0751..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Foo<T> {
-    fn do_something(&self) -> T;
-    fn do_something_else<T: Clone>(&self, bar: T);
-    //~^ ERROR E0194
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0195.rs b/src/test/compile-fail/E0195.rs
deleted file mode 100644 (file)
index 4f4d7ce..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Trait {
-    fn bar<'a,'b:'a>(x: &'a str, y: &'b str);
-    //~^ NOTE lifetimes in impl do not match this method in trait
-}
-
-struct Foo;
-
-impl Trait for Foo {
-    fn bar<'a,'b>(x: &'a str, y: &'b str) { //~ ERROR E0195
-    //~^ NOTE lifetimes do not match method in trait
-    }
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0197.rs b/src/test/compile-fail/E0197.rs
deleted file mode 100644 (file)
index f25fa9b..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo;
-
-unsafe impl Foo { } //~ ERROR E0197
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0198.rs b/src/test/compile-fail/E0198.rs
deleted file mode 100644 (file)
index 1a779a4..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(optin_builtin_traits)]
-
-struct Foo;
-
-unsafe impl !Send for Foo { } //~ ERROR E0198
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0199.rs b/src/test/compile-fail/E0199.rs
deleted file mode 100644 (file)
index 1a5cd19..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(optin_builtin_traits)]
-
-struct Foo;
-
-trait Bar { }
-unsafe impl Bar for Foo { } //~ ERROR implementing the trait `Bar` is not unsafe [E0199]
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0200.rs b/src/test/compile-fail/E0200.rs
deleted file mode 100644 (file)
index 6bfea0e..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo;
-
-unsafe trait Bar { }
-
-impl Bar for Foo { } //~ ERROR E0200
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0201.rs b/src/test/compile-fail/E0201.rs
deleted file mode 100644 (file)
index ff6cb55..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo(u8);
-
-impl Foo {
-    fn bar(&self) -> bool { self.0 > 5 }
-    fn bar() {} //~ ERROR E0201
-}
-
-trait Baz {
-    type Quux;
-    fn baz(&self) -> bool;
-}
-
-impl Baz for Foo {
-    type Quux = u32;
-
-    fn baz(&self) -> bool { true }
-    fn baz(&self) -> bool { self.0 > 5 } //~ ERROR E0201
-    type Quux = u32; //~ ERROR E0201
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0206.rs b/src/test/compile-fail/E0206.rs
deleted file mode 100644 (file)
index da0370b..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-type Foo = i32;
-
-impl Copy for Foo { }
-//~^ ERROR the trait `Copy` may not be implemented for this type
-//~| ERROR only traits defined in the current crate can be implemented for arbitrary types
-
-#[derive(Copy, Clone)]
-struct Bar;
-
-impl Copy for &'static Bar { }
-//~^ ERROR the trait `Copy` may not be implemented for this type
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0207.rs b/src/test/compile-fail/E0207.rs
deleted file mode 100644 (file)
index bd87dba..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo;
-
-impl<T: Default> Foo { //~ ERROR E0207
-    fn get(&self) -> T {
-        <T as Default>::default()
-    }
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0214.rs b/src/test/compile-fail/E0214.rs
deleted file mode 100644 (file)
index 2b09039..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let v: Vec(&str) = vec!["foo"];
-    //~^ ERROR E0214
-}
diff --git a/src/test/compile-fail/E0220.rs b/src/test/compile-fail/E0220.rs
deleted file mode 100644 (file)
index 2866ffc..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Trait {
-    type Bar;
-}
-
-type Foo = Trait<F=i32>; //~ ERROR E0220
-                         //~| ERROR E0191
-fn main() {
-}
diff --git a/src/test/compile-fail/E0221.rs b/src/test/compile-fail/E0221.rs
deleted file mode 100644 (file)
index 9909246..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait T1 {}
-trait T2 {}
-
-trait Foo {
-    type A: T1;
-}
-
-trait Bar : Foo {
-    type A: T2;
-    fn do_something() {
-        let _: Self::A;
-        //~^ ERROR E0221
-    }
-}
-
-trait T3 {}
-
-trait My : std::str::FromStr {
-    type Err: T3;
-    fn test() {
-        let _: Self::Err;
-        //~^ ERROR E0221
-    }
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0223.rs b/src/test/compile-fail/E0223.rs
deleted file mode 100644 (file)
index 0683197..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait MyTrait { type X; }
-
-fn main() {
-    let foo: MyTrait::X;
-    //~^ ERROR ambiguous associated type
-}
diff --git a/src/test/compile-fail/E0225.rs b/src/test/compile-fail/E0225.rs
deleted file mode 100644 (file)
index 6c77443..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let _: Box<std::io::Read + std::io::Write>;
-    //~^ ERROR only auto traits can be used as additional traits in a trait object [E0225]
-}
diff --git a/src/test/compile-fail/E0229.rs b/src/test/compile-fail/E0229.rs
deleted file mode 100644 (file)
index b70fb09..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub trait Foo {
-    type A;
-    fn boo(&self) -> <Self as Foo>::A;
-}
-
-struct Bar;
-
-impl Foo for isize {
-    type A = usize;
-    fn boo(&self) -> usize { 42 }
-}
-
-fn baz<I>(x: &<I as Foo<A=Bar>>::A) {}
-//~^ ERROR associated type bindings are not allowed here [E0229]
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0232.rs b/src/test/compile-fail/E0232.rs
deleted file mode 100644 (file)
index 04657c6..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(on_unimplemented)]
-
-#[rustc_on_unimplemented]
-//~^ ERROR E0232
-trait Bar {}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0243.rs b/src/test/compile-fail/E0243.rs
deleted file mode 100644 (file)
index 615ce0b..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo<T> { x: T }
-struct Bar { x: Foo }
-                //~^ ERROR wrong number of type arguments: expected 1, found 0 [E0243]
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0244.rs b/src/test/compile-fail/E0244.rs
deleted file mode 100644 (file)
index 9a78b31..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo { x: bool }
-struct Bar<S, T> { x: Foo<S, T> }
-                      //~^ ERROR wrong number of type arguments: expected 0, found 2 [E0244]
-
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0252.rs b/src/test/compile-fail/E0252.rs
deleted file mode 100644 (file)
index 6b353c8..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use foo::baz;
-use bar::baz; //~ ERROR E0252
-
-mod foo {
-    pub struct baz;
-}
-
-mod bar {
-    pub mod baz {}
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0253.rs b/src/test/compile-fail/E0253.rs
deleted file mode 100644 (file)
index 186d901..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-mod foo {
-    pub trait MyTrait {
-        fn do_something();
-    }
-}
-
-use foo::MyTrait::do_something;
-    //~^ ERROR E0253
-
-fn main() {}
diff --git a/src/test/compile-fail/E0254.rs b/src/test/compile-fail/E0254.rs
deleted file mode 100644 (file)
index 46c74fe..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(alloc)]
-#![allow(unused_extern_crates)]
-
-extern crate alloc;
-
-mod foo {
-    pub trait alloc {
-        fn do_something();
-    }
-}
-
-use foo::alloc;
-//~^ ERROR E0254
-
-fn main() {}
diff --git a/src/test/compile-fail/E0255.rs b/src/test/compile-fail/E0255.rs
deleted file mode 100644 (file)
index e05c6be..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use bar::foo;
-
-fn foo() {} //~ ERROR E0255
-
-mod bar {
-     pub fn foo() {}
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/E0259.rs b/src/test/compile-fail/E0259.rs
deleted file mode 100644 (file)
index 5a47541..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(alloc, libc)]
-#![allow(unused_extern_crates)]
-
-extern crate alloc;
-
-extern crate libc as alloc;
-//~^ ERROR E0259
-
-fn main() {}
diff --git a/src/test/compile-fail/E0260.rs b/src/test/compile-fail/E0260.rs
deleted file mode 100644 (file)
index 1b01bb1..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(alloc)]
-#![allow(unused_extern_crates)]
-
-extern crate alloc;
-
-mod alloc {
-//~^ ERROR the name `alloc` is defined multiple times [E0260]
-    pub trait MyTrait {
-        fn do_something();
-    }
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/E0261.rs b/src/test/compile-fail/E0261.rs
deleted file mode 100644 (file)
index 558c1c3..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn foo(x: &'a str) { } //~ ERROR E0261
-                       //~| undeclared lifetime
-
-struct Foo {
-    x: &'a str, //~ ERROR E0261
-                //~| undeclared lifetime
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/E0262.rs b/src/test/compile-fail/E0262.rs
deleted file mode 100644 (file)
index 41b6aca..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn foo<'static>(x: &'static str) { } //~ ERROR E0262
-                                     //~| 'static is a reserved lifetime name
-
-fn main() {}
diff --git a/src/test/compile-fail/E0263.rs b/src/test/compile-fail/E0263.rs
deleted file mode 100644 (file)
index 722f1c2..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) {
-    //~^ ERROR E0263
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/E0264.rs b/src/test/compile-fail/E0264.rs
deleted file mode 100644 (file)
index 9233297..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(lang_items)]
-
-extern "C" {
-    #[lang = "cake"]
-    fn cake(); //~ ERROR E0264
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/E0267.rs b/src/test/compile-fail/E0267.rs
deleted file mode 100644 (file)
index 6287256..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let w = || { break; }; //~ ERROR E0267
-}
diff --git a/src/test/compile-fail/E0268.rs b/src/test/compile-fail/E0268.rs
deleted file mode 100644 (file)
index 41e88e2..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    break; //~ ERROR E0268
-}
diff --git a/src/test/compile-fail/E0271.rs b/src/test/compile-fail/E0271.rs
deleted file mode 100644 (file)
index d322c8b..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Trait { type AssociatedType; }
-
-fn foo<T>(t: T) where T: Trait<AssociatedType=u32> {
-    println!("in foo");
-}
-
-impl Trait for i8 { type AssociatedType = &'static str; }
-
-fn main() {
-    foo(3_i8); //~ ERROR E0271
-}
diff --git a/src/test/compile-fail/E0275.rs b/src/test/compile-fail/E0275.rs
deleted file mode 100644 (file)
index 8dfd1d9..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Foo {}
-
-struct Bar<T>(T);
-
-impl<T> Foo for T where Bar<T>: Foo {} //~ ERROR E0275
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0276.rs b/src/test/compile-fail/E0276.rs
deleted file mode 100644 (file)
index 62e43b0..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Foo {
-    fn foo<T>(x: T);
-}
-
-impl Foo for bool {
-    fn foo<T>(x: T) where T: Copy {} //~ ERROR E0276
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0277-2.rs b/src/test/compile-fail/E0277-2.rs
deleted file mode 100644 (file)
index 4d1c500..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo {
-    bar: Bar
-}
-
-struct Bar {
-    baz: Baz
-}
-
-struct Baz {
-    x: *const u8
-}
-
-fn is_send<T: Send>() { }
-
-fn main() {
-    is_send::<Foo>();
-    //~^ ERROR the trait bound `*const u8: std::marker::Send` is not satisfied in `Foo`
-}
diff --git a/src/test/compile-fail/E0277.rs b/src/test/compile-fail/E0277.rs
deleted file mode 100644 (file)
index b29e435..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-cloudabi no std::path
-
-use std::path::Path;
-
-trait Foo {
-    fn bar(&self);
-}
-
-fn some_func<T: Foo>(foo: T) {
-    foo.bar();
-}
-
-fn f(p: Path) { }
-//~^ ERROR the trait bound `[u8]: std::marker::Sized` is not satisfied in `std::path::Path`
-
-fn main() {
-    some_func(5i32);
-    //~^ ERROR the trait bound `i32: Foo` is not satisfied
-}
diff --git a/src/test/compile-fail/E0282.rs b/src/test/compile-fail/E0282.rs
deleted file mode 100644 (file)
index dfc7026..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let x = "hello".chars().rev().collect(); //~ ERROR E0282
-}
diff --git a/src/test/compile-fail/E0283.rs b/src/test/compile-fail/E0283.rs
deleted file mode 100644 (file)
index 844c47f..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Generator {
-    fn create() -> u32;
-}
-
-struct Impl;
-
-impl Generator for Impl {
-    fn create() -> u32 { 1 }
-}
-
-struct AnotherImpl;
-
-impl Generator for AnotherImpl {
-    fn create() -> u32 { 2 }
-}
-
-fn main() {
-    let cont: u32 = Generator::create(); //~ ERROR E0283
-}
diff --git a/src/test/compile-fail/E0296.rs b/src/test/compile-fail/E0296.rs
deleted file mode 100644 (file)
index 562fd00..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![recursion_limit] //~ ERROR E0296
-
-fn main() {}
diff --git a/src/test/compile-fail/E0297.rs b/src/test/compile-fail/E0297.rs
deleted file mode 100644 (file)
index afe4444..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let xs : Vec<Option<i32>> = vec![Some(1), None];
-
-    for Some(x) in xs {}
-    //~^ ERROR E0005
-}
diff --git a/src/test/compile-fail/E0301.rs b/src/test/compile-fail/E0301.rs
deleted file mode 100644 (file)
index 06e9828..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    match Some(()) {
-        None => { },
-        option if option.take().is_none() => {}, //~ ERROR E0301
-        Some(_) => { }
-    }
-}
diff --git a/src/test/compile-fail/E0302.rs b/src/test/compile-fail/E0302.rs
deleted file mode 100644 (file)
index 6a5ad40..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    match Some(()) {
-        None => { },
-        option if { option = None; false } => { }, //~ ERROR E0302
-        Some(_) => { }
-    }
-}
diff --git a/src/test/compile-fail/E0303.rs b/src/test/compile-fail/E0303.rs
deleted file mode 100644 (file)
index 6027414..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    match Some("hi".to_string()) {
-        ref op_string_ref @ Some(s) => {},
-        //~^ ERROR pattern bindings are not allowed after an `@` [E0303]
-        //~| ERROR E0009
-        None => {},
-    }
-}
diff --git a/src/test/compile-fail/E0308-4.rs b/src/test/compile-fail/E0308-4.rs
deleted file mode 100644 (file)
index bb4cd14..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let x = 1u8;
-    match x {
-        0u8...3i8 => (), //~ ERROR E0308
-        _ => ()
-    }
-}
diff --git a/src/test/compile-fail/E0308.rs b/src/test/compile-fail/E0308.rs
deleted file mode 100644 (file)
index 078f1d3..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(intrinsics)]
-
-extern "rust-intrinsic" {
-    fn size_of<T>(); //~ ERROR E0308
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0365.rs b/src/test/compile-fail/E0365.rs
deleted file mode 100644 (file)
index 18a72b0..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-mod foo {
-    pub const X: u32 = 1;
-}
-
-pub use foo as foo2;
-//~^ ERROR `foo` is private, and cannot be re-exported [E0365]
-
-fn main() {}
diff --git a/src/test/compile-fail/E0370.rs b/src/test/compile-fail/E0370.rs
deleted file mode 100644 (file)
index cafe26c..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![allow(dead_code)]
-
-#[deny(overflowing_literals)]
-#[repr(i64)]
-enum Foo {
-    X = 0x7fffffffffffffff,
-    Y, //~ ERROR E0370
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/E0374.rs b/src/test/compile-fail/E0374.rs
deleted file mode 100644 (file)
index 6c4782d..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(coerce_unsized)]
-use std::ops::CoerceUnsized;
-
-struct Foo<T: ?Sized> {
-    a: i32,
-}
-
-impl<T, U> CoerceUnsized<Foo<U>> for Foo<T> //~ ERROR E0374
-    where T: CoerceUnsized<U> {}
-
-fn main() {}
diff --git a/src/test/compile-fail/E0375.rs b/src/test/compile-fail/E0375.rs
deleted file mode 100644 (file)
index 094ed35..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-tidy-linelength
-
-#![feature(coerce_unsized)]
-use std::ops::CoerceUnsized;
-
-struct Foo<T: ?Sized, U: ?Sized> {
-    a: i32,
-    b: T,
-    c: U,
-}
-
-impl<T, U> CoerceUnsized<Foo<U, T>> for Foo<T, U> {}
-//~^ ERROR E0375
-
-fn main() {}
diff --git a/src/test/compile-fail/E0376.rs b/src/test/compile-fail/E0376.rs
deleted file mode 100644 (file)
index 65be358..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(coerce_unsized)]
-use std::ops::CoerceUnsized;
-
-struct Foo<T: ?Sized> {
-    a: T,
-}
-
-impl<T, U> CoerceUnsized<U> for Foo<T> {} //~ ERROR E0376
-
-fn main() {}
diff --git a/src/test/compile-fail/E0388.rs b/src/test/compile-fail/E0388.rs
deleted file mode 100644 (file)
index c002bad..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-static X: i32 = 1;
-const C: i32 = 2;
-
-const CR: &'static mut i32 = &mut C; //~ ERROR E0017
-static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
-                                              //~| ERROR cannot borrow
-static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017
-
-fn main() {}
diff --git a/src/test/compile-fail/E0389.rs b/src/test/compile-fail/E0389.rs
deleted file mode 100644 (file)
index 445831b..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct FancyNum {
-    num: u8,
-}
-
-fn main() {
-    let mut fancy = FancyNum{ num: 5 };
-    let fancy_ref = &(&mut fancy);
-    fancy_ref.num = 6; //~ ERROR E0389
-    println!("{}", fancy_ref.num);
-}
diff --git a/src/test/compile-fail/E0390.rs b/src/test/compile-fail/E0390.rs
deleted file mode 100644 (file)
index cd530db..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo {
-    x: i32
-}
-
-impl *mut Foo {} //~ ERROR E0390
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0392.rs b/src/test/compile-fail/E0392.rs
deleted file mode 100644 (file)
index 4c3efcf..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum Foo<T> { Bar } //~ ERROR E0392
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0393.rs b/src/test/compile-fail/E0393.rs
deleted file mode 100644 (file)
index 9165bc2..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait A<T=Self> {}
-
-fn together_we_will_rule_the_galaxy(son: &A) {}
-//~^ ERROR E0393
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0394.rs b/src/test/compile-fail/E0394.rs
deleted file mode 100644 (file)
index dae8e14..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![allow(warnings)]
-
-static A: u32 = 0;
-static B: u32 = A;
-//~^ ERROR E0394
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0395.rs b/src/test/compile-fail/E0395.rs
deleted file mode 100644 (file)
index 00008ea..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-static FOO: i32 = 42;
-static BAR: i32 = 42;
-
-static BAZ: bool = { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR E0395
-fn main() {
-}
diff --git a/src/test/compile-fail/E0396.rs b/src/test/compile-fail/E0396.rs
deleted file mode 100644 (file)
index 7f34acd..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-const REG_ADDR: *const u8 = 0x5f3759df as *const u8;
-
-const VALUE: u8 = unsafe { *REG_ADDR }; //~ ERROR E0396
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0401.rs b/src/test/compile-fail/E0401.rs
deleted file mode 100644 (file)
index 09bc950..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn foo<T>(x: T) {
-    fn bar(y: T) { //~ ERROR E0401
-    }
-    bar(x);
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0403.rs b/src/test/compile-fail/E0403.rs
deleted file mode 100644 (file)
index 6a68013..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn foo<T, T>(s: T, u: T) {} //~ ERROR E0403
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0404.rs b/src/test/compile-fail/E0404.rs
deleted file mode 100644 (file)
index 1c088a7..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo;
-struct Bar;
-
-impl Foo for Bar {} //~ ERROR E0404
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0405.rs b/src/test/compile-fail/E0405.rs
deleted file mode 100644 (file)
index 45d4b21..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo;
-
-impl SomeTrait for Foo {} //~ ERROR E0405
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0407.rs b/src/test/compile-fail/E0407.rs
deleted file mode 100644 (file)
index 41d8b45..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Foo {
-    fn a();
-}
-
-struct Bar;
-
-impl Foo for Bar {
-    fn a() {}
-    fn b() {}
-    //~^ ERROR E0407
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0408.rs b/src/test/compile-fail/E0408.rs
deleted file mode 100644 (file)
index 8ddeb20..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let x = Some(0);
-
-    match x {
-        Some(y) | None => {} //~  ERROR variable `y` is not bound in all patterns
-        _ => ()
-    }
-}
diff --git a/src/test/compile-fail/E0411.rs b/src/test/compile-fail/E0411.rs
deleted file mode 100644 (file)
index 187986f..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    <Self>::foo; //~ ERROR E0411
-}
diff --git a/src/test/compile-fail/E0412.rs b/src/test/compile-fail/E0412.rs
deleted file mode 100644 (file)
index f62901c..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-impl Something {} //~ ERROR E0412
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0415.rs b/src/test/compile-fail/E0415.rs
deleted file mode 100644 (file)
index 2a5f0d3..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn foo(f: i32, f: i32) {} //~ ERROR E0415
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0416.rs b/src/test/compile-fail/E0416.rs
deleted file mode 100644 (file)
index 91077ab..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    match (1, 2) {
-        (x, x) => {} //~ ERROR E0416
-    }
-}
diff --git a/src/test/compile-fail/E0423.rs b/src/test/compile-fail/E0423.rs
deleted file mode 100644 (file)
index f5fea77..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main () {
-    struct Foo { a: bool };
-
-    let f = Foo(); //~ ERROR E0423
-}
diff --git a/src/test/compile-fail/E0424.rs b/src/test/compile-fail/E0424.rs
deleted file mode 100644 (file)
index 445d0c5..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo;
-
-impl Foo {
-    fn bar(self) {}
-
-    fn foo() {
-        self.bar(); //~ ERROR E0424
-    }
-}
-
-fn main () {
-}
diff --git a/src/test/compile-fail/E0425.rs b/src/test/compile-fail/E0425.rs
deleted file mode 100644 (file)
index 3786282..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Foo {
-    fn bar() {
-        elf; //~ ERROR E0425
-    }
-}
-
-fn main () {
-}
diff --git a/src/test/compile-fail/E0426.rs b/src/test/compile-fail/E0426.rs
deleted file mode 100644 (file)
index d6261d3..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main () {
-    loop {
-        break 'a;
-        //~^ ERROR E0426
-    }
-}
diff --git a/src/test/compile-fail/E0428.rs b/src/test/compile-fail/E0428.rs
deleted file mode 100644 (file)
index 3c709f3..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Bar; //~ previous definition of the type `Bar` here
-struct Bar; //~ ERROR E0428
-
-fn main () {
-}
diff --git a/src/test/compile-fail/E0429.rs b/src/test/compile-fail/E0429.rs
deleted file mode 100644 (file)
index f1cad20..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::fmt::self; //~ ERROR E0429
-
-fn main () {
-}
diff --git a/src/test/compile-fail/E0430.rs b/src/test/compile-fail/E0430.rs
deleted file mode 100644 (file)
index 992876d..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::fmt::{self, self}; //~ ERROR E0430
-                            //~^ ERROR E0252
-
-fn main () {
-}
diff --git a/src/test/compile-fail/E0431.rs b/src/test/compile-fail/E0431.rs
deleted file mode 100644 (file)
index 09ddc1e..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use {self}; //~ ERROR E0431
-
-fn main () {
-}
diff --git a/src/test/compile-fail/E0432.rs b/src/test/compile-fail/E0432.rs
deleted file mode 100644 (file)
index 08d699e..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use something::Foo; //~ ERROR E0432
-
-fn main () {
-}
diff --git a/src/test/compile-fail/E0433.rs b/src/test/compile-fail/E0433.rs
deleted file mode 100644 (file)
index 916d622..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main () {
-    let map = HashMap::new(); //~ ERROR E0433
-}
diff --git a/src/test/compile-fail/E0434.rs b/src/test/compile-fail/E0434.rs
deleted file mode 100644 (file)
index 747d9f7..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn foo() {
-    let y = 5;
-    fn bar() -> u32 {
-        y //~ ERROR E0434
-    }
-}
-
-fn main () {
-}
diff --git a/src/test/compile-fail/E0435.rs b/src/test/compile-fail/E0435.rs
deleted file mode 100644 (file)
index 5246fda..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main () {
-    let foo = 42u32;
-    let _: [u8; foo]; //~ ERROR E0435
-}
diff --git a/src/test/compile-fail/E0437.rs b/src/test/compile-fail/E0437.rs
deleted file mode 100644 (file)
index 7440a82..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Foo {}
-
-impl Foo for i32 {
-    type Bar = bool; //~ ERROR E0437
-}
-
-fn main () {
-}
diff --git a/src/test/compile-fail/E0438.rs b/src/test/compile-fail/E0438.rs
deleted file mode 100644 (file)
index 61d2513..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-
-trait Bar {}
-
-impl Bar for i32 {
-    const BAR: bool = true; //~ ERROR E0438
-}
-
-fn main () {
-}
diff --git a/src/test/compile-fail/E0439.rs b/src/test/compile-fail/E0439.rs
deleted file mode 100644 (file)
index 5244343..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(platform_intrinsics)]
-
-extern "platform-intrinsic" {
-    fn simd_shuffle<A,B>(a: A, b: A, c: [u32; 8]) -> B; //~ ERROR E0439
-}
-
-fn main () {
-}
diff --git a/src/test/compile-fail/E0440.rs b/src/test/compile-fail/E0440.rs
deleted file mode 100644 (file)
index 04e7584..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(repr_simd)]
-#![feature(platform_intrinsics)]
-
-#[repr(simd)]
-struct f64x2(f64, f64);
-
-extern "platform-intrinsic" {
-    fn x86_mm_movemask_pd<T>(x: f64x2) -> i32; //~ ERROR E0440
-}
-
-fn main () {
-}
diff --git a/src/test/compile-fail/E0441.rs b/src/test/compile-fail/E0441.rs
deleted file mode 100644 (file)
index 967ff64..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(repr_simd)]
-#![feature(platform_intrinsics)]
-
-#[repr(simd)]
-struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16);
-
-extern "platform-intrinsic" {
-    fn x86_mm_adds_ep16(x: i16x8, y: i16x8) -> i16x8; //~ ERROR E0441
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/E0442.rs b/src/test/compile-fail/E0442.rs
deleted file mode 100644 (file)
index ddd9270..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(repr_simd)]
-#![feature(platform_intrinsics)]
-
-#[repr(simd)]
-struct i8x16(i8, i8, i8, i8, i8, i8, i8, i8,
-             i8, i8, i8, i8, i8, i8, i8, i8);
-#[repr(simd)]
-struct i32x4(i32, i32, i32, i32);
-#[repr(simd)]
-struct i64x2(i64, i64);
-
-extern "platform-intrinsic" {
-    fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2;
-    //~^ ERROR E0442
-    //~| ERROR E0442
-    //~| ERROR E0442
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/E0443.rs b/src/test/compile-fail/E0443.rs
deleted file mode 100644 (file)
index 24d1ee0..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(repr_simd)]
-#![feature(platform_intrinsics)]
-
-#[repr(simd)]
-struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16);
-#[repr(simd)]
-struct i64x8(i64, i64, i64, i64, i64, i64, i64, i64);
-
-extern "platform-intrinsic" {
-    fn x86_mm_adds_epi16(x: i16x8, y: i16x8) -> i64x8; //~ ERROR E0443
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/E0444.rs b/src/test/compile-fail/E0444.rs
deleted file mode 100644 (file)
index a424a3c..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(repr_simd)]
-#![feature(platform_intrinsics)]
-
-#[repr(simd)]
-struct f64x2(f64, f64);
-
-extern "platform-intrinsic" {
-    fn x86_mm_movemask_pd(x: f64x2, y: f64x2, z: f64x2) -> i32; //~ ERROR E0444
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/E0445.rs b/src/test/compile-fail/E0445.rs
deleted file mode 100644 (file)
index bca1b52..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Foo {
-    fn dummy(&self) { }
-}
-
-pub trait Bar : Foo {}
-//~^ ERROR private trait `Foo` in public interface [E0445]
-//~| NOTE can't leak private trait
-pub struct Bar2<T: Foo>(pub T);
-//~^ ERROR private trait `Foo` in public interface [E0445]
-//~| NOTE can't leak private trait
-pub fn foo<T: Foo> (t: T) {}
-//~^ ERROR private trait `Foo` in public interface [E0445]
-//~| NOTE can't leak private trait
-
-fn main() {}
diff --git a/src/test/compile-fail/E0446.rs b/src/test/compile-fail/E0446.rs
deleted file mode 100644 (file)
index c576661..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-mod Foo {
-    struct Bar(u32);
-
-    pub fn bar() -> Bar { //~ ERROR E0446
-        Bar(0)
-    }
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/E0449.rs b/src/test/compile-fail/E0449.rs
deleted file mode 100644 (file)
index ac365db..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Bar;
-
-trait Foo {
-    fn foo();
-}
-
-pub impl Bar {} //~ ERROR E0449
-
-pub impl Foo for Bar { //~ ERROR E0449
-    pub fn foo() {} //~ ERROR E0449
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0451.rs b/src/test/compile-fail/E0451.rs
deleted file mode 100644 (file)
index af4e7d6..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-mod Bar {
-    pub struct Foo {
-        pub a: isize,
-        b: isize,
-    }
-
-    pub struct FooTuple (
-        pub isize,
-        isize,
-    );
-}
-
-fn pat_match(foo: Bar::Foo) {
-    let Bar::Foo{a:a, b:b} = foo; //~ ERROR E0451
-}
-
-fn main() {
-    let f = Bar::Foo{ a: 0, b: 0 }; //~ ERROR E0451
-}
diff --git a/src/test/compile-fail/E0452.rs b/src/test/compile-fail/E0452.rs
deleted file mode 100644 (file)
index 1665bbd..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![allow(foo = "")] //~ ERROR E0452
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0453.rs b/src/test/compile-fail/E0453.rs
deleted file mode 100644 (file)
index 8e51b84..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![forbid(non_snake_case)]
-
-#[allow(non_snake_case)]
-//~^ ERROR allow(non_snake_case) overruled by outer forbid(non_snake_case)
-fn main() {
-}
diff --git a/src/test/compile-fail/E0454.rs b/src/test/compile-fail/E0454.rs
deleted file mode 100644 (file)
index afd0f5f..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[link(name = "")] extern {}
-//~^ ERROR E0454
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0458.rs b/src/test/compile-fail/E0458.rs
deleted file mode 100644 (file)
index fea27ef..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[link(kind = "wonderful_unicorn")] extern {} //~ ERROR E0458
-                                              //~| ERROR E0459
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0459.rs b/src/test/compile-fail/E0459.rs
deleted file mode 100644 (file)
index dc7ac71..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[link(kind = "dylib")] extern {} //~ ERROR E0459
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0463.rs b/src/test/compile-fail/E0463.rs
deleted file mode 100644 (file)
index aae8397..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(plugin)]
-#![plugin(cookie_monster)]
-//~^ ERROR E0463
-extern crate cake_is_a_lie;
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0478.rs b/src/test/compile-fail/E0478.rs
deleted file mode 100644 (file)
index 8eb4003..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Wedding<'t>: 't { }
-
-struct Prince<'kiss, 'SnowWhite> {
-    child: Box<Wedding<'kiss> + 'SnowWhite>, //~ ERROR E0478
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0492.rs b/src/test/compile-fail/E0492.rs
deleted file mode 100644 (file)
index 8e4964c..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT};
-
-const A: AtomicUsize = ATOMIC_USIZE_INIT;
-static B: &'static AtomicUsize = &A; //~ ERROR E0492
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0494.rs b/src/test/compile-fail/E0494.rs
deleted file mode 100644 (file)
index 5f8632a..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo {
-    a: u32
-}
-
-static S : Foo = Foo { a : 0 };
-static A : &'static u32 = &S.a; //~ ERROR E0494
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0496.rs b/src/test/compile-fail/E0496.rs
deleted file mode 100644 (file)
index 4ca3cd9..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo<'a> {
-    a: &'a i32,
-}
-
-impl<'a> Foo<'a> {
-    fn f<'a>(x: &'a i32) { //~ ERROR E0496
-    }
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0499.rs b/src/test/compile-fail/E0499.rs
deleted file mode 100644 (file)
index 9a64bfe..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let mut i = 0;
-    let mut x = &mut i;
-    let mut a = &mut i; //~ ERROR E0499
-}
diff --git a/src/test/compile-fail/E0502.rs b/src/test/compile-fail/E0502.rs
deleted file mode 100644 (file)
index fce8513..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn bar(x: &mut i32) {}
-fn foo(a: &mut i32) {
-    let ref y = a;
-    bar(a); //~ ERROR E0502
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0503.rs b/src/test/compile-fail/E0503.rs
deleted file mode 100644 (file)
index 810eb8d..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let mut value = 3;
-    let _borrow = &mut value;
-    let _sum = value + 1; //~ ERROR E0503
-}
diff --git a/src/test/compile-fail/E0504.rs b/src/test/compile-fail/E0504.rs
deleted file mode 100644 (file)
index c594f24..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct FancyNum {
-    num: u8,
-}
-
-fn main() {
-    let fancy_num = FancyNum { num: 5 };
-    let fancy_ref = &fancy_num;
-
-    let x = move || {
-        println!("child function: {}", fancy_num.num); //~ ERROR E0504
-    };
-
-    x();
-    println!("main function: {}", fancy_ref.num);
-}
diff --git a/src/test/compile-fail/E0505.rs b/src/test/compile-fail/E0505.rs
deleted file mode 100644 (file)
index 2d534b8..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Value {}
-
-fn eat(val: Value) {}
-
-fn main() {
-    let x = Value{};
-    {
-        let _ref_to_val: &Value = &x;
-        eat(x); //~ ERROR E0505
-    }
-}
diff --git a/src/test/compile-fail/E0507.rs b/src/test/compile-fail/E0507.rs
deleted file mode 100644 (file)
index 87b1bf5..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::cell::RefCell;
-
-struct TheDarkKnight;
-
-impl TheDarkKnight {
-    fn nothing_is_true(self) {}
-}
-
-fn main() {
-    let x = RefCell::new(TheDarkKnight);
-
-    x.borrow().nothing_is_true(); //~ ERROR E0507
-}
diff --git a/src/test/compile-fail/E0509.rs b/src/test/compile-fail/E0509.rs
deleted file mode 100644 (file)
index b92024c..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct FancyNum {
-    num: usize
-}
-
-struct DropStruct {
-    fancy: FancyNum
-}
-
-impl Drop for DropStruct {
-    fn drop(&mut self) {
-    }
-}
-
-fn main() {
-    let drop_struct = DropStruct{fancy: FancyNum{num: 5}};
-    let fancy_field = drop_struct.fancy; //~ ERROR E0509
-    println!("Fancy: {}", fancy_field.num);
-}
diff --git a/src/test/compile-fail/E0511.rs b/src/test/compile-fail/E0511.rs
deleted file mode 100644 (file)
index c5c03f8..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(platform_intrinsics)]
-
-extern "platform-intrinsic" {
-    fn simd_add<T>(a: T, b: T) -> T;
-}
-
-fn main() {
-    unsafe { simd_add(0, 1); } //~ ERROR E0511
-}
diff --git a/src/test/compile-fail/E0512.rs b/src/test/compile-fail/E0512.rs
deleted file mode 100644 (file)
index 25f9627..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn takes_u8(_: u8) {}
-
-fn main() {
-    unsafe { takes_u8(::std::mem::transmute(0u16)); } //~ ERROR E0512
-}
diff --git a/src/test/compile-fail/E0516.rs b/src/test/compile-fail/E0516.rs
deleted file mode 100644 (file)
index be2b89c..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let x: typeof(92) = 92; //~ ERROR E0516
-                            //~| reserved keyword
-}
diff --git a/src/test/compile-fail/E0517.rs b/src/test/compile-fail/E0517.rs
deleted file mode 100644 (file)
index 561223c..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[repr(C)] //~ ERROR: E0517
-type Foo = u8;
-
-#[repr(packed)] //~ ERROR: E0517
-enum Foo2 {Bar, Baz}
-
-#[repr(u8)] //~ ERROR: E0517
-struct Foo3 {bar: bool, baz: bool}
-
-#[repr(C)] //~ ERROR: E0517
-impl Foo3 {
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0518.rs b/src/test/compile-fail/E0518.rs
deleted file mode 100644 (file)
index 6d5b6e4..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[inline(always)] //~ ERROR: E0518
-struct Foo;
-
-#[inline(never)] //~ ERROR: E0518
-impl Foo {
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0520.rs b/src/test/compile-fail/E0520.rs
deleted file mode 100644 (file)
index eae5b11..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(specialization)]
-
-trait SpaceLlama {
-    fn fly(&self);
-}
-
-impl<T> SpaceLlama for T {
-    default fn fly(&self) {}
-}
-
-impl<T: Clone> SpaceLlama for T {
-    fn fly(&self) {}
-}
-
-impl SpaceLlama for i32 {
-    default fn fly(&self) {}
-    //~^ ERROR E0520
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0522.rs b/src/test/compile-fail/E0522.rs
deleted file mode 100644 (file)
index 3d43778..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(lang_items)]
-
-#[lang = "cookie"]
-fn cookie() -> ! {
-//~^^ ERROR definition of an unknown language item: `cookie` [E0522]
-    loop {}
-}
diff --git a/src/test/compile-fail/E0527.rs b/src/test/compile-fail/E0527.rs
deleted file mode 100644 (file)
index 67d222e..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(slice_patterns)]
-
-fn main() {
-    let r = &[1, 2, 3, 4];
-    match r {
-        &[a, b] => {
-            //~^ ERROR E0527
-            println!("a={}, b={}", a, b);
-        }
-    }
-}
diff --git a/src/test/compile-fail/E0528.rs b/src/test/compile-fail/E0528.rs
deleted file mode 100644 (file)
index e2aa2c0..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(slice_patterns)]
-
-fn main() {
-    let r = &[1, 2];
-    match r {
-        &[a, b, c, rest..] => {
-        //~^ ERROR E0528
-        }
-    }
-}
diff --git a/src/test/compile-fail/E0529.rs b/src/test/compile-fail/E0529.rs
deleted file mode 100644 (file)
index 5262ad7..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(slice_patterns)]
-
-fn main() {
-    let r: f32 = 1.0;
-    match r {
-        [a, b] => {
-        //~^ ERROR E0529
-        }
-    }
-}
diff --git a/src/test/compile-fail/E0530.rs b/src/test/compile-fail/E0530.rs
deleted file mode 100644 (file)
index 4f674d0..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    static TEST: i32 = 0;
-
-    let r: (i32, i32) = (0, 0);
-    match r {
-        TEST => {} //~ ERROR E0530
-    }
-}
diff --git a/src/test/compile-fail/E0532.rs b/src/test/compile-fail/E0532.rs
deleted file mode 100644 (file)
index 5dc3b5f..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let value = 1;
-
-    match SomeStruct(value) {
-        StructConst1(_) => { },
-        //~^ ERROR expected tuple struct/variant, found constant `StructConst1`
-        _ => { },
-    }
-
-    struct SomeStruct(u8);
-
-    const StructConst1 : SomeStruct = SomeStruct(1);
-    const StructConst2 : SomeStruct = SomeStruct(2);
-}
diff --git a/src/test/compile-fail/E0534.rs b/src/test/compile-fail/E0534.rs
deleted file mode 100644 (file)
index fc465b2..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[inline()] //~ ERROR E0534
-pub fn something() {}
-
-fn main() {
-    something();
-}
diff --git a/src/test/compile-fail/E0558.rs b/src/test/compile-fail/E0558.rs
deleted file mode 100644 (file)
index 64a6ee4..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[export_name]
-//~^ ERROR E0558
-
-pub fn something() {}
-
-fn main() {}
diff --git a/src/test/compile-fail/E0559.rs b/src/test/compile-fail/E0559.rs
deleted file mode 100644 (file)
index da0f692..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum Field {
-    Fool { x: u32 },
-}
-
-fn main() {
-    let s = Field::Fool { joke: 0 };
-    //~^ ERROR E0559
-}
diff --git a/src/test/compile-fail/E0560.rs b/src/test/compile-fail/E0560.rs
deleted file mode 100644 (file)
index bbb7f08..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Simba {
-    mother: u32,
-}
-
-fn main() {
-    let s = Simba { mother: 1, father: 0 };
-    //~^ ERROR E0560
-}
diff --git a/src/test/compile-fail/E0565-1.rs b/src/test/compile-fail/E0565-1.rs
deleted file mode 100644 (file)
index d3e68c7..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(attr_literals)]
-
-// deprecated doesn't currently support literals
-#[deprecated("since")] //~ ERROR E0565
-fn f() {  }
-
-fn main() {  }
diff --git a/src/test/compile-fail/E0565.rs b/src/test/compile-fail/E0565.rs
deleted file mode 100644 (file)
index b2d3692..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(attr_literals)]
-
-// repr currently doesn't support literals
-#[repr("C")] //~ ERROR E0565
-struct A {  }
-
-fn main() {  }
diff --git a/src/test/compile-fail/E0572.rs b/src/test/compile-fail/E0572.rs
deleted file mode 100644 (file)
index bbaab10..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-const FOO: u32 = return 0; //~ ERROR E0572
-
-fn main() {}
diff --git a/src/test/compile-fail/E0582.rs b/src/test/compile-fail/E0582.rs
deleted file mode 100644 (file)
index 5e6f65a..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// This test was derived from the wasm and parsell crates.  They
-// stopped compiling when #32330 is fixed.
-
-#![allow(dead_code, unused_variables)]
-
-use std::str::Chars;
-
-pub trait HasOutput<Ch, Str> {
-    type Output;
-}
-
-#[derive(Clone, PartialEq, Eq, Hash, Ord, PartialOrd, Debug)]
-pub enum Token<'a> {
-    Begin(&'a str)
-}
-
-fn mk_unexpected_char_err<'a>() -> Option<&'a i32> {
-    unimplemented!()
-}
-
-fn foo<'a>(data: &mut Chars<'a>) {
-    bar(mk_unexpected_char_err)
-}
-
-fn bar<F>(t: F)
-    // No type can satisfy this requirement, since `'a` does not
-    // appear in any of the input types:
-    where F: for<'a> Fn() -> Option<&'a i32>
-    //~^ ERROR E0582
-{
-}
-
-fn baz<F>(t: F)
-    // No type can satisfy this requirement, since `'a` does not
-    // appear in any of the input types:
-    where F: for<'a> Iterator<Item=&'a i32>
-    //~^ ERROR E0582
-{
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/E0585.rs b/src/test/compile-fail/E0585.rs
deleted file mode 100644 (file)
index 1acaf8c..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    /// Hello! I'm useless...
-    //~^ ERROR E0585
-}
diff --git a/src/test/compile-fail/E0586.rs b/src/test/compile-fail/E0586.rs
deleted file mode 100644 (file)
index c1bfc5c..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1];
-    let x = &tmp[1..=]; //~ ERROR E0586
-}
diff --git a/src/test/compile-fail/E0597.rs b/src/test/compile-fail/E0597.rs
deleted file mode 100644 (file)
index 2f4a1da..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo<'a> {
-    x: Option<&'a u32>,
-}
-
-fn main() {
-    let mut x = Foo { x: None };
-    let y = 0;
-    x.x = Some(&y);
-    //~^ `y` does not live long enough [E0597]
-}
diff --git a/src/test/compile-fail/E0599.rs b/src/test/compile-fail/E0599.rs
deleted file mode 100644 (file)
index 30fca2b..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo;
-
-fn main() {
-    || if let Foo::NotEvenReal() = Foo {}; //~ ERROR E0599
-}
diff --git a/src/test/compile-fail/E0600.rs b/src/test/compile-fail/E0600.rs
deleted file mode 100644 (file)
index 5457ff2..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    !"a"; //~ ERROR E0600
-}
diff --git a/src/test/compile-fail/E0602.rs b/src/test/compile-fail/E0602.rs
deleted file mode 100644 (file)
index cc3e436..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-flags:-D bogus
-
-// error-pattern:E0602
-// error-pattern:requested on the command line with `-D bogus`
-
-fn main() {}
diff --git a/src/test/compile-fail/E0603.rs b/src/test/compile-fail/E0603.rs
deleted file mode 100644 (file)
index 1cc9f6b..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-mod SomeModule {
-    const PRIVATE: u32 = 0x_a_bad_1dea_u32;
-}
-
-fn main() {
-    SomeModule::PRIVATE; //~ ERROR E0603
-}
diff --git a/src/test/compile-fail/E0604.rs b/src/test/compile-fail/E0604.rs
deleted file mode 100644 (file)
index c5bf3a7..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    1u32 as char; //~ ERROR E0604
-}
diff --git a/src/test/compile-fail/E0605.rs b/src/test/compile-fail/E0605.rs
deleted file mode 100644 (file)
index 4b5b8be..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let x = 0u8;
-    x as Vec<u8>; //~ ERROR E0605
-
-    let v = 0 as *const u8;
-    v as &u8; //~ ERROR E0605
-}
diff --git a/src/test/compile-fail/E0606.rs b/src/test/compile-fail/E0606.rs
deleted file mode 100644 (file)
index 5507173..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    &0u8 as u8; //~ ERROR E0606
-}
diff --git a/src/test/compile-fail/E0607.rs b/src/test/compile-fail/E0607.rs
deleted file mode 100644 (file)
index fa761f2..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let v = 0 as *const u8;
-    v as *const [u8]; //~ ERROR E0607
-}
diff --git a/src/test/compile-fail/E0608.rs b/src/test/compile-fail/E0608.rs
deleted file mode 100644 (file)
index d47356a..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    0u8[2]; //~ ERROR E0608
-}
diff --git a/src/test/compile-fail/E0609.rs b/src/test/compile-fail/E0609.rs
deleted file mode 100644 (file)
index ddfd9d5..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo {
-    x: u32,
-}
-struct Bar;
-
-fn main() {
-    let x = Foo { x: 0 };
-    let _ = x.foo; //~ ERROR E0609
-
-    let y = Bar;
-    y.1; //~ ERROR E0609
-}
diff --git a/src/test/compile-fail/E0610.rs b/src/test/compile-fail/E0610.rs
deleted file mode 100644 (file)
index 522d8b0..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let x = 0;
-    let _ = x.foo; //~ ERROR E0610
-}
diff --git a/src/test/compile-fail/E0611.rs b/src/test/compile-fail/E0611.rs
deleted file mode 100644 (file)
index 1e392d1..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-mod a {
-    pub struct Foo(u32);
-
-    impl Foo {
-        pub fn new() -> Foo { Foo(0) }
-    }
-}
-
-fn main() {
-   let y = a::Foo::new();
-   y.0; //~ ERROR E0611
-}
diff --git a/src/test/compile-fail/E0612.rs b/src/test/compile-fail/E0612.rs
deleted file mode 100644 (file)
index 429a8bb..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo(u32);
-
-fn main() {
-   let y = Foo(0);
-   y.1; //~ ERROR E0612
-}
diff --git a/src/test/compile-fail/E0614.rs b/src/test/compile-fail/E0614.rs
deleted file mode 100644 (file)
index 909f0eb..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let y = 0u32;
-    *y; //~ ERROR E0614
-}
diff --git a/src/test/compile-fail/E0615.rs b/src/test/compile-fail/E0615.rs
deleted file mode 100644 (file)
index abfa93d..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo {
-    x: u32,
-}
-
-impl Foo {
-    fn method(&self) {}
-}
-
-fn main() {
-    let f = Foo { x: 0 };
-    f.method; //~ ERROR E0615
-}
diff --git a/src/test/compile-fail/E0616.rs b/src/test/compile-fail/E0616.rs
deleted file mode 100644 (file)
index 2fd9f94..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-mod a {
-    pub struct Foo {
-        x: u32,
-    }
-
-    impl Foo {
-        pub fn new() -> Foo { Foo { x: 0 } }
-    }
-}
-
-fn main() {
-    let f = a::Foo::new();
-    f.x; //~ ERROR E0616
-}
diff --git a/src/test/compile-fail/E0617.rs b/src/test/compile-fail/E0617.rs
deleted file mode 100644 (file)
index 9375fd9..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-tidy-linelength
-
-extern {
-    fn printf(c: *const i8, ...);
-}
-
-fn main() {
-    unsafe {
-        printf(::std::ptr::null(), 0f32);
-        //~^ ERROR can't pass `f32` to variadic function
-        //~| HELP cast the value to `c_double`
-        printf(::std::ptr::null(), 0i8);
-        //~^ ERROR can't pass `i8` to variadic function
-        //~| HELP cast the value to `c_int`
-        printf(::std::ptr::null(), 0i16);
-        //~^ ERROR can't pass `i16` to variadic function
-        //~| HELP cast the value to `c_int`
-        printf(::std::ptr::null(), 0u8);
-        //~^ ERROR can't pass `u8` to variadic function
-        //~| HELP cast the value to `c_uint`
-        printf(::std::ptr::null(), 0u16);
-        //~^ ERROR can't pass `u16` to variadic function
-        //~| HELP cast the value to `c_uint`
-        printf(::std::ptr::null(), printf);
-        //~^ ERROR can't pass `unsafe extern "C" fn(*const i8, ...) {printf}` to variadic function
-        //~| HELP cast the value to `unsafe extern "C" fn(*const i8, ...)`
-    }
-}
diff --git a/src/test/compile-fail/E0618.rs b/src/test/compile-fail/E0618.rs
deleted file mode 100644 (file)
index f46bdb9..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum X {
-    Entry,
-}
-
-fn main() {
-    X::Entry();
-    //~^ ERROR expected function, found enum variant `X::Entry` [E0618]
-    let x = 0i32;
-    x();
-    //~^ ERROR expected function, found `i32` [E0618]
-}
diff --git a/src/test/compile-fail/E0619.rs b/src/test/compile-fail/E0619.rs
deleted file mode 100644 (file)
index a5a5ff7..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let x;
-
-    match x {
-        (..) => {} //~ ERROR E0619
-        _ => {}
-    }
-}
-
diff --git a/src/test/compile-fail/E0620.rs b/src/test/compile-fail/E0620.rs
deleted file mode 100644 (file)
index 5e945df..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let _foo = &[1_usize, 2] as [usize]; //~ ERROR E0620
-}
diff --git a/src/test/compile-fail/E0621-does-not-trigger-for-closures.rs b/src/test/compile-fail/E0621-does-not-trigger-for-closures.rs
deleted file mode 100644 (file)
index 980461b..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that we give the generic E0495 when one of the free regions is
-// bound in a closure (rather than suggesting a change to the signature
-// of the closure, which is not specified in `foo` but rather in `invoke`).
-
-// FIXME - This might be better as a UI test, but the finer details
-// of the error seem to vary on different machines.
-fn invoke<'a, F>(x: &'a i32, f: F) -> &'a i32
-where F: FnOnce(&'a i32, &i32) -> &'a i32
-{
-    let y = 22;
-    f(x, &y)
-}
-
-fn foo<'a>(x: &'a i32) {
-    invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/E0622.rs b/src/test/compile-fail/E0622.rs
deleted file mode 100644 (file)
index f2bde5b..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(intrinsics)]
-extern "rust-intrinsic" {
-    pub static breakpoint : unsafe extern "rust-intrinsic" fn();
-    //~^ ERROR intrinsic must be a function [E0622]
-}
-fn main() { unsafe { breakpoint(); } }
diff --git a/src/test/compile-fail/E0624.rs b/src/test/compile-fail/E0624.rs
deleted file mode 100644 (file)
index 952e0b3..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-mod inner {
-    pub struct Foo;
-
-    impl Foo {
-        fn method(&self) {}
-    }
-}
-
-fn main() {
-    let foo = inner::Foo;
-    foo.method(); //~ ERROR method `method` is private [E0624]
-}
diff --git a/src/test/compile-fail/E0637.rs b/src/test/compile-fail/E0637.rs
deleted file mode 100644 (file)
index 455529b..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-#![feature(underscore_lifetimes)]
-
-struct Foo<'a: '_>(&'a u8); //~ ERROR invalid lifetime bound name: `'_`
-fn foo<'a: '_>(_: &'a u8) {} //~ ERROR invalid lifetime bound name: `'_`
-
-struct Bar<'a>(&'a u8);
-impl<'a: '_> Bar<'a> { //~ ERROR invalid lifetime bound name: `'_`
-  fn bar() {}
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/E0657.rs b/src/test/compile-fail/E0657.rs
deleted file mode 100644 (file)
index 4595e41..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-#![allow(warnings)]
-#![feature(conservative_impl_trait, nested_impl_trait)]
-
-trait Id<T> {}
-trait Lt<'a> {}
-
-impl<'a> Lt<'a> for () {}
-impl<T> Id<T> for T {}
-
-fn free_fn_capture_hrtb_in_impl_trait()
-    -> impl for<'a> Id<impl Lt<'a>>
-        //~^ ERROR `impl Trait` can only capture lifetimes bound at the fn or impl level [E0657]
-{
-    ()
-}
-
-struct Foo;
-impl Foo {
-    fn impl_fn_capture_hrtb_in_impl_trait()
-        -> impl for<'a> Id<impl Lt<'a>>
-            //~^ ERROR `impl Trait` can only capture lifetimes bound at the fn or impl level
-    {
-        ()
-    }
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/E0658.rs b/src/test/compile-fail/E0658.rs
deleted file mode 100644 (file)
index d30068e..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    let _ = ::std::u128::MAX; //~ ERROR E0658
-}
diff --git a/src/test/compile-fail/E0659.rs b/src/test/compile-fail/E0659.rs
deleted file mode 100644 (file)
index 4bd452b..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-mod moon {
-    pub fn foo() {}
-}
-
-mod earth {
-    pub fn foo() {}
-}
-
-mod collider {
-    pub use moon::*;
-    pub use earth::*;
-}
-
-fn main() {
-    collider::foo(); //~ ERROR E0659
-}
diff --git a/src/test/compile-fail/borrowck/borrowck-move-out-from-array.rs b/src/test/compile-fail/borrowck/borrowck-move-out-from-array.rs
new file mode 100644 (file)
index 0000000..e011617
--- /dev/null
@@ -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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// revisions: ast mir
+//[mir]compile-flags: -Z borrowck=mir
+
+#![feature(box_syntax, slice_patterns, advanced_slice_patterns)]
+
+fn move_out_from_begin_and_end() {
+    let a = [box 1, box 2];
+    let [_, _x] = a;
+    let [.., _y] = a; //[ast]~ ERROR [E0382]
+                      //[mir]~^ ERROR [E0382]
+}
+
+fn move_out_by_const_index_and_subslice() {
+    let a = [box 1, box 2];
+    let [_x, _] = a;
+    let [_y..] = a; //[ast]~ ERROR [E0382]
+                    //[mir]~^ ERROR [E0382]
+}
+
+fn main() {}
index 15eef429eab974667e3ea77daaada669acb10ccc..6da049374086a28cc65b793654c4eeb1e7b8e9cb 100644 (file)
@@ -11,7 +11,7 @@
 #![allow(unused_macros)]
 
 macro_rules! assign {
-    (($($a:tt)*) = ($($b:tt))*) => { //~ ERROR expected `*` or `+`
+    (($($a:tt)*) = ($($b:tt))*) => { //~ ERROR expected one of: `*`, `+`, or `?`
         $($a)* = $($b)*
     }
 }
diff --git a/src/test/compile-fail/macro-at-most-once-rep-ambig.rs b/src/test/compile-fail/macro-at-most-once-rep-ambig.rs
new file mode 100644 (file)
index 0000000..a5660f8
--- /dev/null
@@ -0,0 +1,53 @@
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// The logic for parsing Kleene operators in macros has a special case to disambiguate `?`.
+// Specifically, `$(pat)?` is the ZeroOrOne operator whereas `$(pat)?+` or `$(pat)?*` are the
+// ZeroOrMore and OneOrMore operators using `?` as a separator. These tests are intended to
+// exercise that logic in the macro parser.
+//
+// Moreover, we also throw in some tests for using a separator with `?`, which is meaningless but
+// included for consistency with `+` and `*`.
+//
+// This test focuses on error cases.
+
+#![feature(macro_at_most_once_rep)]
+
+macro_rules! foo {
+    ($(a)?) => {}
+}
+
+macro_rules! baz {
+    ($(a),?) => {} // comma separator is meaningless for `?`
+}
+
+macro_rules! barplus {
+    ($(a)?+) => {}
+}
+
+macro_rules! barstar {
+    ($(a)?*) => {}
+}
+
+pub fn main() {
+    foo!(a?a?a); //~ ERROR no rules expected the token `?`
+    foo!(a?a); //~ ERROR no rules expected the token `?`
+    foo!(a?); //~ ERROR no rules expected the token `?`
+    baz!(a?a?a); //~ ERROR no rules expected the token `?`
+    baz!(a?a); //~ ERROR no rules expected the token `?`
+    baz!(a?); //~ ERROR no rules expected the token `?`
+    baz!(a,); //~ ERROR unexpected end of macro invocation
+    baz!(a?a?a,); //~ ERROR no rules expected the token `?`
+    baz!(a?a,); //~ ERROR no rules expected the token `?`
+    baz!(a?,); //~ ERROR no rules expected the token `?`
+    barplus!(); //~ ERROR unexpected end of macro invocation
+    barplus!(a?); //~ ERROR unexpected end of macro invocation
+    barstar!(a?); //~ ERROR unexpected end of macro invocation
+}
diff --git a/src/test/compile-fail/specialization/defaultimpl/specialization-default-projection.rs b/src/test/compile-fail/specialization/defaultimpl/specialization-default-projection.rs
deleted file mode 100644 (file)
index ad55f44..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(specialization)]
-
-// Make sure we can't project defaulted associated types
-
-trait Foo {
-    type Assoc;
-}
-
-default impl<T> Foo for T {
-    type Assoc = ();
-}
-
-impl Foo for u8 {
-    type Assoc = String;
-}
-
-fn generic<T>() -> <T as Foo>::Assoc {
-    // `T` could be some downstream crate type that specializes (or,
-    // for that matter, `u8`).
-
-    () //~ ERROR mismatched types
-}
-
-fn monomorphic() -> () {
-    // Even though we know that `()` is not specialized in a
-    // downstream crate, typeck refuses to project here.
-
-    generic::<()>() //~ ERROR mismatched types
-}
-
-fn main() {
-    // No error here, we CAN project from `u8`, as there is no `default`
-    // in that impl.
-    let s: String = generic::<u8>();
-    println!("{}", s); // bad news if this all compiles
-}
diff --git a/src/test/compile-fail/specialization/defaultimpl/specialization-default-types.rs b/src/test/compile-fail/specialization/defaultimpl/specialization-default-types.rs
deleted file mode 100644 (file)
index 7353f7a..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// It should not be possible to use the concrete value of a defaulted
-// associated type in the impl defining it -- otherwise, what happens
-// if it's overridden?
-
-#![feature(specialization)]
-
-trait Example {
-    type Output;
-    fn generate(self) -> Self::Output;
-}
-
-default impl<T> Example for T {
-    type Output = Box<T>;
-    fn generate(self) -> Self::Output {
-        Box::new(self) //~ ERROR mismatched types
-    }
-}
-
-impl Example for bool {
-    type Output = bool;
-    fn generate(self) -> bool { self }
-}
-
-fn trouble<T>(t: T) -> Box<T> {
-    Example::generate(t) //~ ERROR mismatched types
-}
-
-fn weaponize() -> bool {
-    let b: Box<bool> = trouble(true);
-    *b
-}
-
-fn main() {
-    weaponize();
-}
diff --git a/src/test/compile-fail/specialization/defaultimpl/specialization-trait-item-not-implemented.rs b/src/test/compile-fail/specialization/defaultimpl/specialization-trait-item-not-implemented.rs
new file mode 100644 (file)
index 0000000..eacec2e
--- /dev/null
@@ -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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Tests that default impls do not have to supply all items but regular impls do.
+
+#![feature(specialization)]
+
+trait Foo {
+    fn foo_one(&self) -> &'static str;
+    fn foo_two(&self) -> &'static str;
+}
+
+struct MyStruct;
+
+default impl<T> Foo for T {
+    fn foo_one(&self) -> &'static str {
+        "generic"
+    }
+}
+
+impl Foo for MyStruct {}
+//~^ ERROR not all trait items implemented, missing: `foo_two` [E0046]
+
+fn main() {
+    println!("{}", MyStruct.foo_one());
+}
diff --git a/src/test/compile-fail/specialization/defaultimpl/specialization-trait-not-implemented.rs b/src/test/compile-fail/specialization/defaultimpl/specialization-trait-not-implemented.rs
new file mode 100644 (file)
index 0000000..04ddf9e
--- /dev/null
@@ -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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Tests that:
+// - default impls do not have to supply all items and
+// - a default impl does not count as an impl (in this case, an incomplete default impl).
+
+#![feature(specialization)]
+
+trait Foo {
+    fn foo_one(&self) -> &'static str;
+    fn foo_two(&self) -> &'static str;
+}
+
+struct MyStruct;
+
+default impl<T> Foo for T {
+    fn foo_one(&self) -> &'static str {
+        "generic"
+    }
+}
+
+
+fn main() {
+    println!("{}", MyStruct.foo_one());
+    //~^ ERROR no method named `foo_one` found for type `MyStruct` in the current scope
+}
diff --git a/src/test/compile-fail/specialization/defaultimpl/specialization-wfcheck.rs b/src/test/compile-fail/specialization/defaultimpl/specialization-wfcheck.rs
new file mode 100644 (file)
index 0000000..445a59a
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Tests that a default impl still has to have a WF trait ref.
+
+#![feature(specialization)]
+
+trait Foo<'a, T: Eq + 'a> { }
+
+default impl<U> Foo<'static, U> for () {}
+//~^ ERROR the trait bound `U: std::cmp::Eq` is not satisfied
+
+fn main(){}
diff --git a/src/test/mir-opt/uniform_array_move_out.rs b/src/test/mir-opt/uniform_array_move_out.rs
new file mode 100644 (file)
index 0000000..4a31025
--- /dev/null
@@ -0,0 +1,59 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(box_syntax, slice_patterns, advanced_slice_patterns)]
+
+fn move_out_from_end() {
+    let a = [box 1, box 2];
+    let [.., _y] = a;
+}
+
+fn move_out_by_subslice() {
+    let a = [box 1, box 2];
+    let [_y..] = a;
+}
+
+fn main() {
+    move_out_by_subslice();
+    move_out_from_end();
+}
+
+// END RUST SOURCE
+
+// START rustc.move_out_from_end.UniformArrayMoveOut.before.mir
+//     StorageLive(_6);
+//      _6 = move _1[-1 of 1];
+//      _0 = ();
+// END rustc.move_out_from_end.UniformArrayMoveOut.before.mir
+
+// START rustc.move_out_from_end.UniformArrayMoveOut.after.mir
+//     StorageLive(_6);
+//      _6 = move _1[1 of 2];
+//      nop;
+//      _0 = ();
+// END rustc.move_out_from_end.UniformArrayMoveOut.after.mir
+
+// START rustc.move_out_by_subslice.UniformArrayMoveOut.before.mir
+//     StorageLive(_6);
+//      _6 = move _1[0:];
+// END rustc.move_out_by_subslice.UniformArrayMoveOut.before.mir
+
+// START rustc.move_out_by_subslice.UniformArrayMoveOut.after.mir
+//     StorageLive(_6);
+//     StorageLive(_7);
+//     _7 = move _1[0 of 2];
+//     StorageLive(_8);
+//     _8 = move _1[1 of 2];
+//     _6 = [move _7, move _8];
+//     StorageDead(_7);
+//     StorageDead(_8);
+//     nop;
+//     _0 = ();
+// END rustc.move_out_by_subslice.UniformArrayMoveOut.after.mir
index 15d491719a6d58dd8edf2350edd32d3309d98fee..af90d0a83c926c86e8f9519cc8c87a32a8ace65e 100644 (file)
@@ -13,7 +13,7 @@
 macro_rules! foo {
     { $+ } => { //~ ERROR expected identifier, found `+`
                 //~^ ERROR missing fragment specifier
-        $(x)(y) //~ ERROR expected `*` or `+`
+        $(x)(y) //~ ERROR expected one of: `*`, `+`, or `?`
     }
 }
 
index b5d6ff595afd57e60eb4845048dd2a0359b6f596..9ebc438ad5a0071e8bed7f8c1c902845adf47743 100644 (file)
@@ -18,6 +18,7 @@
 extern crate rustc;
 extern crate rustc_plugin;
 
+use syntax::feature_gate::Features;
 use syntax::parse::token::{NtExpr, NtPat};
 use syntax::ast::{Ident, Pat};
 use syntax::tokenstream::{TokenTree};
 use syntax_pos::Span;
 use rustc_plugin::Registry;
 
+use std::cell::RefCell;
+
 fn expand_mbe_matches(cx: &mut ExtCtxt, _: Span, args: &[TokenTree])
         -> Box<MacResult + 'static> {
 
     let mbe_matcher = quote_tokens!(cx, $$matched:expr, $$($$pat:pat)|+);
-    let mbe_matcher = quoted::parse(mbe_matcher.into_iter().collect(), true, cx.parse_sess);
+    let mbe_matcher = quoted::parse(mbe_matcher.into_iter().collect(),
+                                    true,
+                                    cx.parse_sess,
+                                    &RefCell::new(Features::new()),
+                                    &[]);
     let map = match TokenTree::parse(cx, &mbe_matcher, args.iter().cloned().collect()) {
         Success(map) => map,
         Failure(_, tok) => {
diff --git a/src/test/run-pass/cast-does-fallback.rs b/src/test/run-pass/cast-does-fallback.rs
new file mode 100644 (file)
index 0000000..aa6752f
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub fn main() {
+    // Test that these type check correctly.
+    (&42u8 >> 4) as usize;
+    (&42u8 << 4) as usize;
+
+    let cap = 512 * 512;
+    cap as u8;
+    // Assert `cap` did not get inferred to `u8` and overflowed.
+    assert_ne!(cap, 0);
+}
index e2a51bbf14b8984b430e8c18d4c8d48ace76bc79..4d0bd3f3412f1f7fd0933363af3779e4b0cd4807 100644 (file)
@@ -225,6 +225,43 @@ fn slice_pattern_one_of(a: &Allocator, i: usize) {
     };
 }
 
+fn subslice_pattern_from_end(a: &Allocator, arg: bool) {
+    let a = [a.alloc(), a.alloc(), a.alloc()];
+    if arg {
+        let[.., _x, _] = a;
+    } else {
+        let[_, _y..] = a;
+    }
+}
+
+fn subslice_pattern_from_end_with_drop(a: &Allocator, arg: bool, arg2: bool) {
+    let a = [a.alloc(), a.alloc(), a.alloc(), a.alloc(), a.alloc()];
+    if arg2 {
+        drop(a);
+        return;
+    }
+
+    if arg {
+        let[.., _x, _] = a;
+    } else {
+        let[_, _y..] = a;
+    }
+}
+
+fn slice_pattern_reassign(a: &Allocator) {
+    let mut ar = [a.alloc(), a.alloc()];
+    let[_, _x] = ar;
+    ar = [a.alloc(), a.alloc()];
+    let[.., _y] = ar;
+}
+
+fn subslice_pattern_reassign(a: &Allocator) {
+    let mut ar = [a.alloc(), a.alloc(), a.alloc()];
+    let[_, _, _x] = ar;
+    ar = [a.alloc(), a.alloc(), a.alloc()];
+    let[_, _y..] = ar;
+}
+
 fn run_test<F>(mut f: F)
     where F: FnMut(&Allocator)
 {
@@ -303,5 +340,14 @@ fn main() {
     run_test(|a| slice_pattern_one_of(a, 2));
     run_test(|a| slice_pattern_one_of(a, 3));
 
+    run_test(|a| subslice_pattern_from_end(a, true));
+    run_test(|a| subslice_pattern_from_end(a, false));
+    run_test(|a| subslice_pattern_from_end_with_drop(a, true, true));
+    run_test(|a| subslice_pattern_from_end_with_drop(a, true, false));
+    run_test(|a| subslice_pattern_from_end_with_drop(a, false, true));
+    run_test(|a| subslice_pattern_from_end_with_drop(a, false, false));
+    run_test(|a| slice_pattern_reassign(a));
+    run_test(|a| subslice_pattern_reassign(a));
+
     run_test_nopanic(|a| union1(a));
 }
diff --git a/src/test/run-pass/issue-47703-1.rs b/src/test/run-pass/issue-47703-1.rs
new file mode 100644 (file)
index 0000000..facdee5
--- /dev/null
@@ -0,0 +1,33 @@
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(nll)]
+
+struct AtomicRefMut<'a> {
+    value: &'a mut i32,
+    borrow: AtomicBorrowRefMut,
+}
+
+struct AtomicBorrowRefMut {
+}
+
+impl Drop for AtomicBorrowRefMut {
+    fn drop(&mut self) {
+    }
+}
+
+fn map(orig: AtomicRefMut) -> AtomicRefMut {
+    AtomicRefMut {
+        value: orig.value,
+        borrow: orig.borrow,
+    }
+}
+
+fn main() {}
diff --git a/src/test/run-pass/issue-47703.rs b/src/test/run-pass/issue-47703.rs
new file mode 100644 (file)
index 0000000..2146986
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(nll)]
+
+struct MyStruct<'a> {
+    field: &'a mut (),
+    field2: WithDrop
+}
+
+struct WithDrop;
+
+impl Drop for WithDrop {
+    fn drop(&mut self) {}
+}
+
+impl<'a> MyStruct<'a> {
+    fn consume(self) -> &'a mut () { self.field }
+}
+
+fn main() {}
diff --git a/src/test/run-pass/macro-at-most-once-rep.rs b/src/test/run-pass/macro-at-most-once-rep.rs
new file mode 100644 (file)
index 0000000..b7e942f
--- /dev/null
@@ -0,0 +1,88 @@
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// The logic for parsing Kleene operators in macros has a special case to disambiguate `?`.
+// Specifically, `$(pat)?` is the ZeroOrOne operator whereas `$(pat)?+` or `$(pat)?*` are the
+// ZeroOrMore and OneOrMore operators using `?` as a separator. These tests are intended to
+// exercise that logic in the macro parser.
+//
+// Moreover, we also throw in some tests for using a separator with `?`, which is meaningless but
+// included for consistency with `+` and `*`.
+//
+// This test focuses on non-error cases and making sure the correct number of repetitions happen.
+
+#![feature(macro_at_most_once_rep)]
+
+macro_rules! foo {
+    ($($a:ident)? ; $num:expr) => { {
+        let mut x = 0;
+
+        $(
+            x += $a;
+         )?
+
+        assert_eq!(x, $num);
+    } }
+}
+
+macro_rules! baz {
+    ($($a:ident),? ; $num:expr) => { { // comma separator is meaningless for `?`
+        let mut x = 0;
+
+        $(
+            x += $a;
+         )?
+
+        assert_eq!(x, $num);
+    } }
+}
+
+macro_rules! barplus {
+    ($($a:ident)?+ ; $num:expr) => { {
+        let mut x = 0;
+
+        $(
+            x += $a;
+         )+
+
+        assert_eq!(x, $num);
+    } }
+}
+
+macro_rules! barstar {
+    ($($a:ident)?* ; $num:expr) => { {
+        let mut x = 0;
+
+        $(
+            x += $a;
+         )*
+
+        assert_eq!(x, $num);
+    } }
+}
+
+pub fn main() {
+    let a = 1;
+
+    // accept 0 or 1 repetitions
+    foo!( ; 0);
+    foo!(a ; 1);
+    baz!( ; 0);
+    baz!(a ; 1);
+
+    // Make sure using ? as a separator works as before
+    barplus!(a ; 1);
+    barplus!(a?a ; 2);
+    barplus!(a?a?a ; 3);
+    barstar!( ; 0);
+    barstar!(a ; 1);
+    barstar!(a?a ; 2);
+    barstar!(a?a?a ; 3);
+}
diff --git a/src/test/run-pass/specialization/defaultimpl/assoc-fns.rs b/src/test/run-pass/specialization/defaultimpl/assoc-fns.rs
deleted file mode 100644 (file)
index b99ba3d..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that non-method associated functions can be specialized
-
-#![feature(specialization)]
-
-trait Foo {
-    fn mk() -> Self;
-}
-
-default impl<T: Default> Foo for T {
-    fn mk() -> T {
-        T::default()
-    }
-}
-
-impl Foo for Vec<u8> {
-    fn mk() -> Vec<u8> {
-        vec![0]
-    }
-}
-
-fn main() {
-    let v1: Vec<i32> = Foo::mk();
-    let v2: Vec<u8> = Foo::mk();
-
-    assert!(v1.len() == 0);
-    assert!(v2.len() == 1);
-}
diff --git a/src/test/run-pass/specialization/defaultimpl/auxiliary/cross_crate.rs b/src/test/run-pass/specialization/defaultimpl/auxiliary/cross_crate.rs
deleted file mode 100644 (file)
index 71dd7c9..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(specialization)]
-
-pub trait Foo {
-    fn foo(&self) -> &'static str;
-}
-
-default impl<T> Foo for T {
-    fn foo(&self) -> &'static str {
-        "generic"
-    }
-}
-
-default impl<T: Clone> Foo for T {
-    fn foo(&self) -> &'static str {
-        "generic Clone"
-    }
-}
-
-default impl<T, U> Foo for (T, U) where T: Clone, U: Clone {
-    fn foo(&self) -> &'static str {
-        "generic pair"
-    }
-}
-
-default impl<T: Clone> Foo for (T, T) {
-    fn foo(&self) -> &'static str {
-        "generic uniform pair"
-    }
-}
-
-default impl Foo for (u8, u32) {
-    fn foo(&self) -> &'static str {
-        "(u8, u32)"
-    }
-}
-
-default impl Foo for (u8, u8) {
-    fn foo(&self) -> &'static str {
-        "(u8, u8)"
-    }
-}
-
-default impl<T: Clone> Foo for Vec<T> {
-    fn foo(&self) -> &'static str {
-        "generic Vec"
-    }
-}
-
-impl Foo for Vec<i32> {
-    fn foo(&self) -> &'static str {
-        "Vec<i32>"
-    }
-}
-
-impl Foo for String {
-    fn foo(&self) -> &'static str {
-        "String"
-    }
-}
-
-impl Foo for i32 {
-    fn foo(&self) -> &'static str {
-        "i32"
-    }
-}
-
-pub trait MyMarker {}
-default impl<T: Clone + MyMarker> Foo for T {
-    fn foo(&self) -> &'static str {
-        "generic Clone + MyMarker"
-    }
-}
diff --git a/src/test/run-pass/specialization/defaultimpl/auxiliary/cross_crate_defaults.rs b/src/test/run-pass/specialization/defaultimpl/auxiliary/cross_crate_defaults.rs
deleted file mode 100644 (file)
index 9d0ea64..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-
-#![feature(specialization)]
-
-// First, test only use of explicit `default` items:
-
-pub trait Foo {
-    fn foo(&self) -> bool;
-}
-
-default impl<T> Foo for T {
-    fn foo(&self) -> bool { false }
-}
-
-impl Foo for i32 {}
-
-impl Foo for i64 {
-    fn foo(&self) -> bool { true }
-}
-
-// Next, test mixture of explicit `default` and provided methods:
-
-pub trait Bar {
-    fn bar(&self) -> i32 { 0 }
-}
-
-impl<T> Bar for T {} // use the provided method
-
-impl Bar for i32 {
-    fn bar(&self) -> i32 { 1 }
-}
-impl<'a> Bar for &'a str {}
-
-default impl<T> Bar for Vec<T> {
-    fn bar(&self) -> i32 { 2 }
-}
-impl Bar for Vec<i32> {}
-impl Bar for Vec<i64> {
-    fn bar(&self) -> i32 { 3 }
-}
diff --git a/src/test/run-pass/specialization/defaultimpl/basics-unsafe.rs b/src/test/run-pass/specialization/defaultimpl/basics-unsafe.rs
deleted file mode 100644 (file)
index 7daecc8..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(specialization)]
-
-// Tests a variety of basic specialization scenarios and method
-// dispatch for them.
-
-unsafe trait Foo {
-    fn foo(&self) -> &'static str;
-}
-
-default unsafe impl<T> Foo for T {
-    fn foo(&self) -> &'static str {
-        "generic"
-    }
-}
-
-default unsafe impl<T: Clone> Foo for T {
-    fn foo(&self) -> &'static str {
-        "generic Clone"
-    }
-}
-
-default unsafe impl<T, U> Foo for (T, U) where T: Clone, U: Clone {
-    fn foo(&self) -> &'static str {
-        "generic pair"
-    }
-}
-
-default unsafe impl<T: Clone> Foo for (T, T) {
-    fn foo(&self) -> &'static str {
-        "generic uniform pair"
-    }
-}
-
-default unsafe impl Foo for (u8, u32) {
-    fn foo(&self) -> &'static str {
-        "(u8, u32)"
-    }
-}
-
-default unsafe impl Foo for (u8, u8) {
-    fn foo(&self) -> &'static str {
-        "(u8, u8)"
-    }
-}
-
-default unsafe impl<T: Clone> Foo for Vec<T> {
-    fn foo(&self) -> &'static str {
-        "generic Vec"
-    }
-}
-
-default unsafe impl Foo for Vec<i32> {
-    fn foo(&self) -> &'static str {
-        "Vec<i32>"
-    }
-}
-
-default unsafe impl Foo for String {
-    fn foo(&self) -> &'static str {
-        "String"
-    }
-}
-
-default unsafe impl Foo for i32 {
-    fn foo(&self) -> &'static str {
-        "i32"
-    }
-}
-
-struct NotClone;
-
-unsafe trait MyMarker {}
-default unsafe impl<T: Clone + MyMarker> Foo for T {
-    fn foo(&self) -> &'static str {
-        "generic Clone + MyMarker"
-    }
-}
-
-#[derive(Clone)]
-struct MarkedAndClone;
-unsafe impl MyMarker for MarkedAndClone {}
-
-fn  main() {
-    assert!(NotClone.foo() == "generic");
-    assert!(0u8.foo() == "generic Clone");
-    assert!(vec![NotClone].foo() == "generic");
-    assert!(vec![0u8].foo() == "generic Vec");
-    assert!(vec![0i32].foo() == "Vec<i32>");
-    assert!(0i32.foo() == "i32");
-    assert!(String::new().foo() == "String");
-    assert!(((), 0).foo() == "generic pair");
-    assert!(((), ()).foo() == "generic uniform pair");
-    assert!((0u8, 0u32).foo() == "(u8, u32)");
-    assert!((0u8, 0u8).foo() == "(u8, u8)");
-    assert!(MarkedAndClone.foo() == "generic Clone + MyMarker");
-}
diff --git a/src/test/run-pass/specialization/defaultimpl/basics.rs b/src/test/run-pass/specialization/defaultimpl/basics.rs
deleted file mode 100644 (file)
index 594f1e4..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(specialization)]
-
-// Tests a variety of basic specialization scenarios and method
-// dispatch for them.
-
-trait Foo {
-    fn foo(&self) -> &'static str;
-}
-
-default impl<T> Foo for T {
-    fn foo(&self) -> &'static str {
-        "generic"
-    }
-}
-
-default impl<T: Clone> Foo for T {
-    fn foo(&self) -> &'static str {
-        "generic Clone"
-    }
-}
-
-default impl<T, U> Foo for (T, U) where T: Clone, U: Clone {
-    fn foo(&self) -> &'static str {
-        "generic pair"
-    }
-}
-
-default impl<T: Clone> Foo for (T, T) {
-    fn foo(&self) -> &'static str {
-        "generic uniform pair"
-    }
-}
-
-default impl Foo for (u8, u32) {
-    fn foo(&self) -> &'static str {
-        "(u8, u32)"
-    }
-}
-
-default impl Foo for (u8, u8) {
-    fn foo(&self) -> &'static str {
-        "(u8, u8)"
-    }
-}
-
-default impl<T: Clone> Foo for Vec<T> {
-    fn foo(&self) -> &'static str {
-        "generic Vec"
-    }
-}
-
-impl Foo for Vec<i32> {
-    fn foo(&self) -> &'static str {
-        "Vec<i32>"
-    }
-}
-
-impl Foo for String {
-    fn foo(&self) -> &'static str {
-        "String"
-    }
-}
-
-impl Foo for i32 {
-    fn foo(&self) -> &'static str {
-        "i32"
-    }
-}
-
-struct NotClone;
-
-trait MyMarker {}
-default impl<T: Clone + MyMarker> Foo for T {
-    fn foo(&self) -> &'static str {
-        "generic Clone + MyMarker"
-    }
-}
-
-#[derive(Clone)]
-struct MarkedAndClone;
-impl MyMarker for MarkedAndClone {}
-
-fn  main() {
-    assert!(NotClone.foo() == "generic");
-    assert!(0u8.foo() == "generic Clone");
-    assert!(vec![NotClone].foo() == "generic");
-    assert!(vec![0u8].foo() == "generic Vec");
-    assert!(vec![0i32].foo() == "Vec<i32>");
-    assert!(0i32.foo() == "i32");
-    assert!(String::new().foo() == "String");
-    assert!(((), 0).foo() == "generic pair");
-    assert!(((), ()).foo() == "generic uniform pair");
-    assert!((0u8, 0u32).foo() == "(u8, u32)");
-    assert!((0u8, 0u8).foo() == "(u8, u8)");
-    assert!(MarkedAndClone.foo() == "generic Clone + MyMarker");
-}
diff --git a/src/test/run-pass/specialization/defaultimpl/cross-crate-defaults.rs b/src/test/run-pass/specialization/defaultimpl/cross-crate-defaults.rs
deleted file mode 100644 (file)
index 19e1af1..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// aux-build:cross_crate_defaults.rs
-
-#![feature(specialization)]
-
-extern crate cross_crate_defaults;
-
-use cross_crate_defaults::*;
-
-struct LocalDefault;
-struct LocalOverride;
-
-impl Foo for LocalDefault {}
-
-impl Foo for LocalOverride {
-    fn foo(&self) -> bool { true }
-}
-
-fn test_foo() {
-    assert!(!0i8.foo());
-    assert!(!0i32.foo());
-    assert!(0i64.foo());
-
-    assert!(!LocalDefault.foo());
-    assert!(LocalOverride.foo());
-}
-
-fn test_bar() {
-    assert!(0u8.bar() == 0);
-    assert!(0i32.bar() == 1);
-    assert!("hello".bar() == 0);
-    assert!(vec![()].bar() == 2);
-    assert!(vec![0i32].bar() == 2);
-    assert!(vec![0i64].bar() == 3);
-}
-
-fn main() {
-    test_foo();
-    test_bar();
-}
diff --git a/src/test/run-pass/specialization/defaultimpl/cross-crate-no-gate.rs b/src/test/run-pass/specialization/defaultimpl/cross-crate-no-gate.rs
deleted file mode 100644 (file)
index 67cc694..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that specialization works even if only the upstream crate enables it
-
-// aux-build:cross_crate.rs
-
-extern crate cross_crate;
-
-use cross_crate::*;
-
-fn  main() {
-    assert!(0u8.foo() == "generic Clone");
-    assert!(vec![0u8].foo() == "generic Vec");
-    assert!(vec![0i32].foo() == "Vec<i32>");
-    assert!(0i32.foo() == "i32");
-    assert!(String::new().foo() == "String");
-    assert!(((), 0).foo() == "generic pair");
-    assert!(((), ()).foo() == "generic uniform pair");
-    assert!((0u8, 0u32).foo() == "(u8, u32)");
-    assert!((0u8, 0u8).foo() == "(u8, u8)");
-}
diff --git a/src/test/run-pass/specialization/defaultimpl/cross-crate.rs b/src/test/run-pass/specialization/defaultimpl/cross-crate.rs
deleted file mode 100644 (file)
index f1ad105..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// aux-build:cross_crate.rs
-
-#![feature(specialization)]
-
-extern crate cross_crate;
-
-use cross_crate::*;
-
-struct NotClone;
-
-#[derive(Clone)]
-struct MarkedAndClone;
-impl MyMarker for MarkedAndClone {}
-
-struct MyType<T>(T);
-default impl<T> Foo for MyType<T> {
-    fn foo(&self) -> &'static str {
-        "generic MyType"
-    }
-}
-
-impl Foo for MyType<u8> {
-    fn foo(&self) -> &'static str {
-        "MyType<u8>"
-    }
-}
-
-struct MyOtherType;
-impl Foo for MyOtherType {}
-
-fn  main() {
-    assert!(NotClone.foo() == "generic");
-    assert!(0u8.foo() == "generic Clone");
-    assert!(vec![NotClone].foo() == "generic");
-    assert!(vec![0u8].foo() == "generic Vec");
-    assert!(vec![0i32].foo() == "Vec<i32>");
-    assert!(0i32.foo() == "i32");
-    assert!(String::new().foo() == "String");
-    assert!(((), 0).foo() == "generic pair");
-    assert!(((), ()).foo() == "generic uniform pair");
-    assert!((0u8, 0u32).foo() == "(u8, u32)");
-    assert!((0u8, 0u8).foo() == "(u8, u8)");
-    assert!(MarkedAndClone.foo() == "generic Clone + MyMarker");
-
-    assert!(MyType(()).foo() == "generic MyType");
-    assert!(MyType(0u8).foo() == "MyType<u8>");
-    assert!(MyOtherType.foo() == "generic");
-}
diff --git a/src/test/run-pass/specialization/defaultimpl/default-methods.rs b/src/test/run-pass/specialization/defaultimpl/default-methods.rs
deleted file mode 100644 (file)
index 4ac9afc..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(specialization)]
-
-// Test that default methods are cascaded correctly
-
-// First, test only use of explicit `default` items:
-
-trait Foo {
-    fn foo(&self) -> bool;
-}
-
-// Specialization tree for Foo:
-//
-//        T
-//       / \
-//    i32   i64
-
-default impl<T> Foo for T {
-    fn foo(&self) -> bool { false }
-}
-
-impl Foo for i32 {}
-
-impl Foo for i64 {
-    fn foo(&self) -> bool { true }
-}
-
-fn test_foo() {
-    assert!(!0i8.foo());
-    assert!(!0i32.foo());
-    assert!(0i64.foo());
-}
-
-// Next, test mixture of explicit `default` and provided methods:
-
-trait Bar {
-    fn bar(&self) -> i32 { 0 }
-}
-
-// Specialization tree for Bar.
-// Uses of $ designate that method is provided
-//
-//           $Bar   (the trait)
-//             |
-//             T
-//            /|\
-//           / | \
-//          /  |  \
-//         /   |   \
-//        /    |    \
-//       /     |     \
-//     $i32   &str  $Vec<T>
-//                    /\
-//                   /  \
-//            Vec<i32>  $Vec<i64>
-
-// use the provided method
-impl<T> Bar for T {}
-
-impl Bar for i32 {
-    fn bar(&self) -> i32 { 1 }
-}
-impl<'a> Bar for &'a str {}
-
-default impl<T> Bar for Vec<T> {
-    fn bar(&self) -> i32 { 2 }
-}
-impl Bar for Vec<i32> {}
-impl Bar for Vec<i64> {
-    fn bar(&self) -> i32 { 3 }
-}
-
-fn test_bar() {
-    assert!(0u8.bar() == 0);
-    assert!(0i32.bar() == 1);
-    assert!("hello".bar() == 0);
-    assert!(vec![()].bar() == 2);
-    assert!(vec![0i32].bar() == 2);
-    assert!(vec![0i64].bar() == 3);
-}
-
-fn main() {
-    test_foo();
-    test_bar();
-}
diff --git a/src/test/run-pass/specialization/defaultimpl/projection-alias.rs b/src/test/run-pass/specialization/defaultimpl/projection-alias.rs
deleted file mode 100644 (file)
index 2397c3e..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(specialization)]
-
-// Regression test for ICE when combining specialized associated types and type
-// aliases
-
-trait Id_ {
-    type Out;
-}
-
-type Id<T> = <T as Id_>::Out;
-
-default impl<T> Id_ for T {
-    type Out = T;
-}
-
-fn test_proection() {
-    let x: Id<bool> = panic!();
-}
-
-fn main() {
-
-}
diff --git a/src/test/run-pass/specialization/defaultimpl/specialization-trait-item-not-implemented.rs b/src/test/run-pass/specialization/defaultimpl/specialization-trait-item-not-implemented.rs
new file mode 100644 (file)
index 0000000..fc73120
--- /dev/null
@@ -0,0 +1,42 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Tests that we can combine a default impl that supplies one method with a
+// full impl that supplies the other, and they can invoke one another.
+
+#![feature(specialization)]
+
+trait Foo {
+    fn foo_one(&self) -> &'static str;
+    fn foo_two(&self) -> &'static str;
+    fn foo_three(&self) -> &'static str;
+}
+
+struct MyStruct;
+
+default impl<T> Foo for T {
+    fn foo_one(&self) -> &'static str {
+        self.foo_three()
+    }
+}
+
+impl Foo for MyStruct {
+    fn foo_two(&self) -> &'static str {
+        self.foo_one()
+    }
+
+    fn foo_three(&self) -> &'static str {
+        "generic"
+    }
+}
+
+fn main() {
+    assert!(MyStruct.foo_two() == "generic");
+}
index 8e193efaf85047f95779e5df6629333add9f66fd..9e7c3aa49018024b74dd97548e2b01e0ec76e6ab 100644 (file)
@@ -34,6 +34,6 @@
 //! }
 //! ```
 
-// @matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0A%20%20%20%20println!(%22Hello%2C%20world!%22)%3B%0A%7D%0A"]' "Run"
+// @matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0A%20%20%20%20println!(%22Hello%2C%20world!%22)%3B%0A%7D"]' "Run"
 // @matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Aprintln!(%22Hello%2C%20world!%22)%3B%0A%7D"]' "Run"
-// @matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0A%23!%5Bfeature(something)%5D%0A%0Afn%20main()%20%7B%0A%20%20%20%20println!(%22Hello%2C%20world!%22)%3B%0A%7D%0A&version=nightly"]' "Run"
+// @matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0A%23!%5Bfeature(something)%5D%0A%0Afn%20main()%20%7B%0A%20%20%20%20println!(%22Hello%2C%20world!%22)%3B%0A%7D&version=nightly"]' "Run"
diff --git a/src/test/ui/cast_char.rs b/src/test/ui/cast_char.rs
new file mode 100644 (file)
index 0000000..cd8ade5
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![deny(overflowing_literals)]
+
+fn main() {
+    const XYZ: char = 0x1F888 as char;
+    //~^ ERROR only u8 can be casted into char
+    const XY: char = 129160 as char;
+    //~^ ERROR only u8 can be casted into char
+    const ZYX: char = '\u{01F888}';
+    println!("{}", XYZ);
+}
diff --git a/src/test/ui/cast_char.stderr b/src/test/ui/cast_char.stderr
new file mode 100644 (file)
index 0000000..e42a38d
--- /dev/null
@@ -0,0 +1,20 @@
+error: only u8 can be casted into char
+  --> $DIR/cast_char.rs:14:23
+   |
+14 |     const XYZ: char = 0x1F888 as char;
+   |                       ^^^^^^^^^^^^^^^ help: use a char literal instead: `'/u{1F888}'`
+   |
+note: lint level defined here
+  --> $DIR/cast_char.rs:11:9
+   |
+11 | #![deny(overflowing_literals)]
+   |         ^^^^^^^^^^^^^^^^^^^^
+
+error: only u8 can be casted into char
+  --> $DIR/cast_char.rs:16:22
+   |
+16 |     const XY: char = 129160 as char;
+   |                      ^^^^^^^^^^^^^^ help: use a char literal instead: `'/u{1F888}'`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0001.rs b/src/test/ui/error-codes/E0001.rs
new file mode 100644 (file)
index 0000000..b72b0d6
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![deny(unreachable_patterns)]
+
+fn main() {
+    let foo = Some(1);
+    match foo {
+        Some(_) => {/* ... */}
+        None => {/* ... */}
+        _ => {/* ... */} //~ ERROR unreachable pattern
+    }
+}
diff --git a/src/test/ui/error-codes/E0001.stderr b/src/test/ui/error-codes/E0001.stderr
new file mode 100644 (file)
index 0000000..d7d67af
--- /dev/null
@@ -0,0 +1,14 @@
+error: unreachable pattern
+  --> $DIR/E0001.rs:18:9
+   |
+18 |         _ => {/* ... */} //~ ERROR unreachable pattern
+   |         ^
+   |
+note: lint level defined here
+  --> $DIR/E0001.rs:11:9
+   |
+11 | #![deny(unreachable_patterns)]
+   |         ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0004-2.rs b/src/test/ui/error-codes/E0004-2.rs
new file mode 100644 (file)
index 0000000..824b86c
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let x = Some(1);
+
+    match x { } //~ ERROR E0004
+}
diff --git a/src/test/ui/error-codes/E0004-2.stderr b/src/test/ui/error-codes/E0004-2.stderr
new file mode 100644 (file)
index 0000000..2f4d26e
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0004]: non-exhaustive patterns: type std::option::Option<i32> is non-empty
+  --> $DIR/E0004-2.rs:14:11
+   |
+14 |     match x { } //~ ERROR E0004
+   |           ^
+   |
+help: Please ensure that all possible cases are being handled; possibly adding wildcards or more match arms.
+  --> $DIR/E0004-2.rs:14:11
+   |
+14 |     match x { } //~ ERROR E0004
+   |           ^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0004.rs b/src/test/ui/error-codes/E0004.rs
new file mode 100644 (file)
index 0000000..8df07a0
--- /dev/null
@@ -0,0 +1,22 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum Terminator {
+    HastaLaVistaBaby,
+    TalkToMyHand,
+}
+
+fn main() {
+    let x = Terminator::HastaLaVistaBaby;
+
+    match x { //~ ERROR E0004
+        Terminator::TalkToMyHand => {}
+    }
+}
diff --git a/src/test/ui/error-codes/E0004.stderr b/src/test/ui/error-codes/E0004.stderr
new file mode 100644 (file)
index 0000000..836afaf
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0004]: non-exhaustive patterns: `HastaLaVistaBaby` not covered
+  --> $DIR/E0004.rs:19:11
+   |
+19 |     match x { //~ ERROR E0004
+   |           ^ pattern `HastaLaVistaBaby` not covered
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0005.rs b/src/test/ui/error-codes/E0005.rs
new file mode 100644 (file)
index 0000000..0405bba
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let x = Some(1);
+    let Some(y) = x; //~ ERROR E0005
+}
diff --git a/src/test/ui/error-codes/E0005.stderr b/src/test/ui/error-codes/E0005.stderr
new file mode 100644 (file)
index 0000000..d052c12
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0005]: refutable pattern in local binding: `None` not covered
+  --> $DIR/E0005.rs:13:9
+   |
+13 |     let Some(y) = x; //~ ERROR E0005
+   |         ^^^^^^^ pattern `None` not covered
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0007.rs b/src/test/ui/error-codes/E0007.rs
new file mode 100644 (file)
index 0000000..d5acbde
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let x = Some("s".to_string());
+    match x {
+        op_string @ Some(s) => {},
+        //~^ ERROR E0007
+        //~| ERROR E0303
+        None => {},
+    }
+}
diff --git a/src/test/ui/error-codes/E0007.stderr b/src/test/ui/error-codes/E0007.stderr
new file mode 100644 (file)
index 0000000..1370cac
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0007]: cannot bind by-move with sub-bindings
+  --> $DIR/E0007.rs:14:9
+   |
+14 |         op_string @ Some(s) => {},
+   |         ^^^^^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it
+
+error[E0303]: pattern bindings are not allowed after an `@`
+  --> $DIR/E0007.rs:14:26
+   |
+14 |         op_string @ Some(s) => {},
+   |                          ^ not allowed after `@`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0008.rs b/src/test/ui/error-codes/E0008.rs
new file mode 100644 (file)
index 0000000..ba5720e
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    match Some("hi".to_string()) {
+        Some(s) if s.len() == 0 => {},
+        //~^ ERROR E0008
+        _ => {},
+    }
+}
diff --git a/src/test/ui/error-codes/E0008.stderr b/src/test/ui/error-codes/E0008.stderr
new file mode 100644 (file)
index 0000000..6ae4506
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0008]: cannot bind by-move into a pattern guard
+  --> $DIR/E0008.rs:13:14
+   |
+13 |         Some(s) if s.len() == 0 => {},
+   |              ^ moves value into pattern guard
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0009.rs b/src/test/ui/error-codes/E0009.rs
new file mode 100644 (file)
index 0000000..02e2e80
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    struct X { x: (), }
+    let x = Some((X { x: () }, X { x: () }));
+    match x {
+        Some((y, ref z)) => {},
+        //~^ ERROR E0009
+        None => panic!()
+    }
+}
diff --git a/src/test/ui/error-codes/E0009.stderr b/src/test/ui/error-codes/E0009.stderr
new file mode 100644 (file)
index 0000000..31db957
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0009]: cannot bind by-move and by-ref in the same pattern
+  --> $DIR/E0009.rs:15:15
+   |
+15 |         Some((y, ref z)) => {},
+   |               ^  ----- both by-ref and by-move used
+   |               |
+   |               by-move pattern here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0010-teach.rs b/src/test/ui/error-codes/E0010-teach.rs
new file mode 100644 (file)
index 0000000..e5ccf32
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -Z teach
+
+#![feature(box_syntax)]
+#![allow(warnings)]
+
+const CON : Box<i32> = box 0; //~ ERROR E0010
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0010-teach.stderr b/src/test/ui/error-codes/E0010-teach.stderr
new file mode 100644 (file)
index 0000000..46f8101
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0010]: allocations are not allowed in constants
+  --> $DIR/E0010-teach.rs:16:24
+   |
+16 | const CON : Box<i32> = box 0; //~ ERROR E0010
+   |                        ^^^^^ allocation not allowed in constants
+   |
+   = note: The value of statics and constants must be known at compile time, and they live for the entire lifetime of a program. Creating a boxed value allocates memory on the heap at runtime, and therefore cannot be done at compile time.
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0010.rs b/src/test/ui/error-codes/E0010.rs
new file mode 100644 (file)
index 0000000..66a9319
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(box_syntax)]
+#![allow(warnings)]
+
+const CON : Box<i32> = box 0; //~ ERROR E0010
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0010.stderr b/src/test/ui/error-codes/E0010.stderr
new file mode 100644 (file)
index 0000000..5cef631
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0010]: allocations are not allowed in constants
+  --> $DIR/E0010.rs:14:24
+   |
+14 | const CON : Box<i32> = box 0; //~ ERROR E0010
+   |                        ^^^^^ allocation not allowed in constants
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0017.rs b/src/test/ui/error-codes/E0017.rs
new file mode 100644 (file)
index 0000000..c98c35a
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+static X: i32 = 1;
+const C: i32 = 2;
+
+const CR: &'static mut i32 = &mut C; //~ ERROR E0017
+static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
+                                              //~| ERROR cannot borrow
+static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017
+fn main() {}
diff --git a/src/test/ui/error-codes/E0017.stderr b/src/test/ui/error-codes/E0017.stderr
new file mode 100644 (file)
index 0000000..f1fe1e5
--- /dev/null
@@ -0,0 +1,26 @@
+error[E0017]: references in constants may only refer to immutable values
+  --> $DIR/E0017.rs:14:30
+   |
+14 | const CR: &'static mut i32 = &mut C; //~ ERROR E0017
+   |                              ^^^^^^ constants require immutable values
+
+error[E0017]: references in statics may only refer to immutable values
+  --> $DIR/E0017.rs:15:39
+   |
+15 | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
+   |                                       ^^^^^^ statics require immutable values
+
+error[E0596]: cannot borrow immutable static item as mutable
+  --> $DIR/E0017.rs:15:44
+   |
+15 | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
+   |                                            ^
+
+error[E0017]: references in statics may only refer to immutable values
+  --> $DIR/E0017.rs:17:38
+   |
+17 | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017
+   |                                      ^^^^^^ statics require immutable values
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/error-codes/E0023.rs b/src/test/ui/error-codes/E0023.rs
new file mode 100644 (file)
index 0000000..24032c5
--- /dev/null
@@ -0,0 +1,24 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum Fruit {
+    Apple(String, String),
+    Pear(u32),
+}
+
+
+fn main() {
+    let x = Fruit::Apple(String::new(), String::new());
+    match x {
+        Fruit::Apple(a) => {}, //~ ERROR E0023
+        Fruit::Apple(a, b, c) => {}, //~ ERROR E0023
+        Fruit::Pear(1, 2) => {}, //~ ERROR E0023
+    }
+}
diff --git a/src/test/ui/error-codes/E0023.stderr b/src/test/ui/error-codes/E0023.stderr
new file mode 100644 (file)
index 0000000..582dffe
--- /dev/null
@@ -0,0 +1,20 @@
+error[E0023]: this pattern has 1 field, but the corresponding tuple variant has 2 fields
+  --> $DIR/E0023.rs:20:9
+   |
+20 |         Fruit::Apple(a) => {}, //~ ERROR E0023
+   |         ^^^^^^^^^^^^^^^ expected 2 fields, found 1
+
+error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 2 fields
+  --> $DIR/E0023.rs:21:9
+   |
+21 |         Fruit::Apple(a, b, c) => {}, //~ ERROR E0023
+   |         ^^^^^^^^^^^^^^^^^^^^^ expected 2 fields, found 3
+
+error[E0023]: this pattern has 2 fields, but the corresponding tuple variant has 1 field
+  --> $DIR/E0023.rs:22:9
+   |
+22 |         Fruit::Pear(1, 2) => {}, //~ ERROR E0023
+   |         ^^^^^^^^^^^^^^^^^ expected 1 field, found 2
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/error-codes/E0025.rs b/src/test/ui/error-codes/E0025.rs
new file mode 100644 (file)
index 0000000..81d0ea8
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo {
+    a: u8,
+    b: u8,
+}
+
+fn main() {
+    let x = Foo { a:1, b:2 };
+    let Foo { a: x, a: y, b: 0 } = x;
+    //~^ ERROR field `a` bound multiple times in the pattern
+}
diff --git a/src/test/ui/error-codes/E0025.stderr b/src/test/ui/error-codes/E0025.stderr
new file mode 100644 (file)
index 0000000..480cd2a
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0025]: field `a` bound multiple times in the pattern
+  --> $DIR/E0025.rs:18:21
+   |
+18 |     let Foo { a: x, a: y, b: 0 } = x;
+   |               ----  ^^^^ multiple uses of `a` in pattern
+   |               |
+   |               first use of `a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0026-teach.rs b/src/test/ui/error-codes/E0026-teach.rs
new file mode 100644 (file)
index 0000000..e0ce44a
--- /dev/null
@@ -0,0 +1,24 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -Z teach
+
+struct Thing {
+    x: u32,
+    y: u32
+}
+
+fn main() {
+    let thing = Thing { x: 0, y: 0 };
+    match thing {
+        Thing { x, y, z } => {}
+        //~^ ERROR struct `Thing` does not have a field named `z` [E0026]
+    }
+}
diff --git a/src/test/ui/error-codes/E0026-teach.stderr b/src/test/ui/error-codes/E0026-teach.stderr
new file mode 100644 (file)
index 0000000..ee83cfb
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0026]: struct `Thing` does not have a field named `z`
+  --> $DIR/E0026-teach.rs:21:23
+   |
+21 |         Thing { x, y, z } => {}
+   |                       ^ struct `Thing` does not have field `z`
+   |
+   = note: This error indicates that a struct pattern attempted to extract a non-existent field from a struct. Struct fields are identified by the name used before the colon : so struct patterns should resemble the declaration of the struct type being matched.
+           
+           If you are using shorthand field patterns but want to refer to the struct field by a different name, you should rename it explicitly.
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0026.rs b/src/test/ui/error-codes/E0026.rs
new file mode 100644 (file)
index 0000000..f8ad7b5
--- /dev/null
@@ -0,0 +1,22 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Thing {
+    x: u32,
+    y: u32
+}
+
+fn main() {
+    let thing = Thing { x: 0, y: 0 };
+    match thing {
+        Thing { x, y, z } => {}
+        //~^ ERROR struct `Thing` does not have a field named `z` [E0026]
+    }
+}
diff --git a/src/test/ui/error-codes/E0026.stderr b/src/test/ui/error-codes/E0026.stderr
new file mode 100644 (file)
index 0000000..c9819df
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0026]: struct `Thing` does not have a field named `z`
+  --> $DIR/E0026.rs:19:23
+   |
+19 |         Thing { x, y, z } => {}
+   |                       ^ struct `Thing` does not have field `z`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0027-teach.rs b/src/test/ui/error-codes/E0027-teach.rs
new file mode 100644 (file)
index 0000000..17e045b
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -Z teach
+
+struct Dog {
+    name: String,
+    age: u32,
+}
+
+fn main() {
+    let d = Dog { name: "Rusty".to_string(), age: 8 };
+
+    match d {
+        Dog { age: x } => {}
+        //~^ ERROR pattern does not mention field `name`
+    }
+}
diff --git a/src/test/ui/error-codes/E0027-teach.stderr b/src/test/ui/error-codes/E0027-teach.stderr
new file mode 100644 (file)
index 0000000..e9f9e4b
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0027]: pattern does not mention field `name`
+  --> $DIR/E0027-teach.rs:22:9
+   |
+22 |         Dog { age: x } => {}
+   |         ^^^^^^^^^^^^^^ missing field `name`
+   |
+   = note: This error indicates that a pattern for a struct fails to specify a sub-pattern for every one of the struct's fields. Ensure that each field from the struct's definition is mentioned in the pattern, or use `..` to ignore unwanted fields.
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0027.rs b/src/test/ui/error-codes/E0027.rs
new file mode 100644 (file)
index 0000000..b63b0ab
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Dog {
+    name: String,
+    age: u32,
+}
+
+fn main() {
+    let d = Dog { name: "Rusty".to_string(), age: 8 };
+
+    match d {
+        Dog { age: x } => {}
+        //~^ ERROR pattern does not mention field `name`
+    }
+}
diff --git a/src/test/ui/error-codes/E0027.stderr b/src/test/ui/error-codes/E0027.stderr
new file mode 100644 (file)
index 0000000..0f93a77
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0027]: pattern does not mention field `name`
+  --> $DIR/E0027.rs:20:9
+   |
+20 |         Dog { age: x } => {}
+   |         ^^^^^^^^^^^^^^ missing field `name`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0029-teach.rs b/src/test/ui/error-codes/E0029-teach.rs
new file mode 100644 (file)
index 0000000..ca85f58
--- /dev/null
@@ -0,0 +1,22 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -Z teach
+
+fn main() {
+    let s = "hoho";
+
+    match s {
+        "hello" ... "world" => {}
+        //~^ ERROR only char and numeric types are allowed in range patterns
+        //~| ERROR non-reference pattern used to match a reference
+        _ => {}
+    }
+}
diff --git a/src/test/ui/error-codes/E0029-teach.stderr b/src/test/ui/error-codes/E0029-teach.stderr
new file mode 100644 (file)
index 0000000..dbb8d97
--- /dev/null
@@ -0,0 +1,20 @@
+error[E0658]: non-reference pattern used to match a reference (see issue #42640)
+  --> $DIR/E0029-teach.rs:17:9
+   |
+17 |         "hello" ... "world" => {}
+   |         ^^^^^^^^^^^^^^^^^^^ help: consider using a reference: `&"hello" ... "world"`
+   |
+   = help: add #![feature(match_default_bindings)] to the crate attributes to enable
+
+error[E0029]: only char and numeric types are allowed in range patterns
+  --> $DIR/E0029-teach.rs:17:9
+   |
+17 |         "hello" ... "world" => {}
+   |         ^^^^^^^^^^^^^^^^^^^ ranges require char or numeric types
+   |
+   = note: start type: &'static str
+   = note: end type: &'static str
+   = note: In a match expression, only numbers and characters can be matched against a range. This is because the compiler checks that the range is non-empty at compile-time, and is unable to evaluate arbitrary comparison functions. If you want to capture values of an orderable type between two end-points, you can use a guard.
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0029.rs b/src/test/ui/error-codes/E0029.rs
new file mode 100644 (file)
index 0000000..80d215b
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let s = "hoho";
+
+    match s {
+        "hello" ... "world" => {}
+        //~^ ERROR only char and numeric types are allowed in range patterns
+        //~| ERROR non-reference pattern used to match a reference
+        _ => {}
+    }
+}
diff --git a/src/test/ui/error-codes/E0029.stderr b/src/test/ui/error-codes/E0029.stderr
new file mode 100644 (file)
index 0000000..02fbd20
--- /dev/null
@@ -0,0 +1,19 @@
+error[E0658]: non-reference pattern used to match a reference (see issue #42640)
+  --> $DIR/E0029.rs:15:9
+   |
+15 |         "hello" ... "world" => {}
+   |         ^^^^^^^^^^^^^^^^^^^ help: consider using a reference: `&"hello" ... "world"`
+   |
+   = help: add #![feature(match_default_bindings)] to the crate attributes to enable
+
+error[E0029]: only char and numeric types are allowed in range patterns
+  --> $DIR/E0029.rs:15:9
+   |
+15 |         "hello" ... "world" => {}
+   |         ^^^^^^^^^^^^^^^^^^^ ranges require char or numeric types
+   |
+   = note: start type: &'static str
+   = note: end type: &'static str
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0030-teach.rs b/src/test/ui/error-codes/E0030-teach.rs
new file mode 100644 (file)
index 0000000..2af32ed
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -Z teach
+
+fn main() {
+    match 5u32 {
+        1000 ... 5 => {}
+        //~^ ERROR lower range bound must be less than or equal to upper
+    }
+}
diff --git a/src/test/ui/error-codes/E0030-teach.stderr b/src/test/ui/error-codes/E0030-teach.stderr
new file mode 100644 (file)
index 0000000..40b3d79
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0030]: lower range bound must be less than or equal to upper
+  --> $DIR/E0030-teach.rs:15:9
+   |
+15 |         1000 ... 5 => {}
+   |         ^^^^ lower bound larger than upper bound
+   |
+   = note: When matching against a range, the compiler verifies that the range is non-empty. Range patterns include both end-points, so this is equivalent to requiring the start of the range to be less than or equal to the end of the range.
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0030.rs b/src/test/ui/error-codes/E0030.rs
new file mode 100644 (file)
index 0000000..ef3bded
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+
+fn main() {
+    match 5u32 {
+        1000 ... 5 => {}
+        //~^ ERROR lower range bound must be less than or equal to upper
+    }
+}
diff --git a/src/test/ui/error-codes/E0030.stderr b/src/test/ui/error-codes/E0030.stderr
new file mode 100644 (file)
index 0000000..7bdecd0
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0030]: lower range bound must be less than or equal to upper
+  --> $DIR/E0030.rs:14:9
+   |
+14 |         1000 ... 5 => {}
+   |         ^^^^ lower bound larger than upper bound
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0033-teach.rs b/src/test/ui/error-codes/E0033-teach.rs
new file mode 100644 (file)
index 0000000..51a1390
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -Z teach
+
+trait SomeTrait {
+    fn foo();
+}
+
+fn main() {
+    let trait_obj: &SomeTrait = SomeTrait;
+    //~^ ERROR expected value, found trait `SomeTrait`
+    //~| ERROR E0038
+    //~| method `foo` has no receiver
+
+    let &invalid = trait_obj;
+    //~^ ERROR E0033
+}
diff --git a/src/test/ui/error-codes/E0033-teach.stderr b/src/test/ui/error-codes/E0033-teach.stderr
new file mode 100644 (file)
index 0000000..ea60fcb
--- /dev/null
@@ -0,0 +1,26 @@
+error[E0423]: expected value, found trait `SomeTrait`
+  --> $DIR/E0033-teach.rs:18:33
+   |
+18 |     let trait_obj: &SomeTrait = SomeTrait;
+   |                                 ^^^^^^^^^ not a value
+
+error[E0038]: the trait `SomeTrait` cannot be made into an object
+  --> $DIR/E0033-teach.rs:18:20
+   |
+18 |     let trait_obj: &SomeTrait = SomeTrait;
+   |                    ^^^^^^^^^^ the trait `SomeTrait` cannot be made into an object
+   |
+   = note: method `foo` has no receiver
+
+error[E0033]: type `&SomeTrait` cannot be dereferenced
+  --> $DIR/E0033-teach.rs:23:9
+   |
+23 |     let &invalid = trait_obj;
+   |         ^^^^^^^^ type `&SomeTrait` cannot be dereferenced
+   |
+   = note: This error indicates that a pointer to a trait type cannot be implicitly dereferenced by a pattern. Every trait defines a type, but because the size of trait implementors isn't fixed, this type has no compile-time size. Therefore, all accesses to trait types must be through pointers. If you encounter this error you should try to avoid dereferencing the pointer.
+           
+           You can read more about trait objects in the Trait Objects section of the Reference: https://doc.rust-lang.org/reference/types.html#trait-objects
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/error-codes/E0033.rs b/src/test/ui/error-codes/E0033.rs
new file mode 100644 (file)
index 0000000..3cdbb55
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait SomeTrait {
+    fn foo();
+}
+
+fn main() {
+    let trait_obj: &SomeTrait = SomeTrait;
+    //~^ ERROR expected value, found trait `SomeTrait`
+    //~| ERROR E0038
+    //~| method `foo` has no receiver
+
+    let &invalid = trait_obj;
+    //~^ ERROR E0033
+}
diff --git a/src/test/ui/error-codes/E0033.stderr b/src/test/ui/error-codes/E0033.stderr
new file mode 100644 (file)
index 0000000..abc535e
--- /dev/null
@@ -0,0 +1,22 @@
+error[E0423]: expected value, found trait `SomeTrait`
+  --> $DIR/E0033.rs:16:33
+   |
+16 |     let trait_obj: &SomeTrait = SomeTrait;
+   |                                 ^^^^^^^^^ not a value
+
+error[E0038]: the trait `SomeTrait` cannot be made into an object
+  --> $DIR/E0033.rs:16:20
+   |
+16 |     let trait_obj: &SomeTrait = SomeTrait;
+   |                    ^^^^^^^^^^ the trait `SomeTrait` cannot be made into an object
+   |
+   = note: method `foo` has no receiver
+
+error[E0033]: type `&SomeTrait` cannot be dereferenced
+  --> $DIR/E0033.rs:21:9
+   |
+21 |     let &invalid = trait_obj;
+   |         ^^^^^^^^ type `&SomeTrait` cannot be dereferenced
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/error-codes/E0034.rs b/src/test/ui/error-codes/E0034.rs
new file mode 100644 (file)
index 0000000..6eebd4d
--- /dev/null
@@ -0,0 +1,31 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Test;
+
+trait Trait1 {
+    fn foo();
+}
+
+trait Trait2 {
+    fn foo();
+}
+
+impl Trait1 for Test {
+    fn foo() {}
+}
+
+impl Trait2 for Test {
+    fn foo() {}
+}
+
+fn main() {
+    Test::foo() //~ ERROR multiple applicable items in scope
+}
diff --git a/src/test/ui/error-codes/E0034.stderr b/src/test/ui/error-codes/E0034.stderr
new file mode 100644 (file)
index 0000000..238fd0d
--- /dev/null
@@ -0,0 +1,19 @@
+error[E0034]: multiple applicable items in scope
+  --> $DIR/E0034.rs:30:5
+   |
+30 |     Test::foo() //~ ERROR multiple applicable items in scope
+   |     ^^^^^^^^^ multiple `foo` found
+   |
+note: candidate #1 is defined in an impl of the trait `Trait1` for the type `Test`
+  --> $DIR/E0034.rs:22:5
+   |
+22 |     fn foo() {}
+   |     ^^^^^^^^
+note: candidate #2 is defined in an impl of the trait `Trait2` for the type `Test`
+  --> $DIR/E0034.rs:26:5
+   |
+26 |     fn foo() {}
+   |     ^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0038.rs b/src/test/ui/error-codes/E0038.rs
new file mode 100644 (file)
index 0000000..8087928
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Trait {
+    fn foo(&self) -> Self;
+}
+
+fn call_foo(x: Box<Trait>) {
+    //~^ ERROR E0038
+    let y = x.foo();
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0038.stderr b/src/test/ui/error-codes/E0038.stderr
new file mode 100644 (file)
index 0000000..e942356
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0038]: the trait `Trait` cannot be made into an object
+  --> $DIR/E0038.rs:15:1
+   |
+15 | fn call_foo(x: Box<Trait>) {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` cannot be made into an object
+   |
+   = note: method `foo` references the `Self` type in its arguments or return type
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0040.rs b/src/test/ui/error-codes/E0040.rs
new file mode 100644 (file)
index 0000000..8385d68
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo {
+    x: i32,
+}
+
+impl Drop for Foo {
+    fn drop(&mut self) {
+        println!("kaboom");
+    }
+}
+
+fn main() {
+    let mut x = Foo { x: -7 };
+    x.drop();
+    //~^ ERROR E0040
+}
diff --git a/src/test/ui/error-codes/E0040.stderr b/src/test/ui/error-codes/E0040.stderr
new file mode 100644 (file)
index 0000000..73cb49f
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0040]: explicit use of destructor method
+  --> $DIR/E0040.rs:23:7
+   |
+23 |     x.drop();
+   |       ^^^^ explicit destructor calls not allowed
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0044.rs b/src/test/ui/error-codes/E0044.rs
new file mode 100644 (file)
index 0000000..48fe230
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+extern { fn some_func<T>(x: T); } //~ ERROR E0044
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0044.stderr b/src/test/ui/error-codes/E0044.stderr
new file mode 100644 (file)
index 0000000..65a429c
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0044]: foreign items may not have type parameters
+  --> $DIR/E0044.rs:11:10
+   |
+11 | extern { fn some_func<T>(x: T); } //~ ERROR E0044
+   |          ^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: consider using specialization instead of type parameters
+  --> $DIR/E0044.rs:11:10
+   |
+11 | extern { fn some_func<T>(x: T); } //~ ERROR E0044
+   |          ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0045.rs b/src/test/ui/error-codes/E0045.rs
new file mode 100644 (file)
index 0000000..57c639d
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+extern "Rust" { fn foo(x: u8, ...); }   //~ ERROR E0045
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0045.stderr b/src/test/ui/error-codes/E0045.stderr
new file mode 100644 (file)
index 0000000..cd40056
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0045]: variadic function must have C or cdecl calling convention
+  --> $DIR/E0045.rs:11:17
+   |
+11 | extern "Rust" { fn foo(x: u8, ...); }   //~ ERROR E0045
+   |                 ^^^^^^^^^^^^^^^^^^^ variadics require C or cdecl calling convention
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0049.rs b/src/test/ui/error-codes/E0049.rs
new file mode 100644 (file)
index 0000000..5867e11
--- /dev/null
@@ -0,0 +1,22 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Foo {
+    fn foo<T: Default>(x: T) -> Self;
+}
+
+struct Bar;
+
+impl Foo for Bar {
+    fn foo(x: bool) -> Self { Bar } //~ ERROR E0049
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0049.stderr b/src/test/ui/error-codes/E0049.stderr
new file mode 100644 (file)
index 0000000..e6f72ba
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0049]: method `foo` has 0 type parameters but its trait declaration has 1 type parameter
+  --> $DIR/E0049.rs:18:5
+   |
+12 |     fn foo<T: Default>(x: T) -> Self;
+   |     --------------------------------- expected 1 type parameter
+...
+18 |     fn foo(x: bool) -> Self { Bar } //~ ERROR E0049
+   |     ^^^^^^^^^^^^^^^^^^^^^^^ found 0 type parameters
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0050.rs b/src/test/ui/error-codes/E0050.rs
new file mode 100644 (file)
index 0000000..2ccc380
--- /dev/null
@@ -0,0 +1,26 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Foo {
+    fn foo(&self, x: u8) -> bool;
+    fn bar(&self, x: u8, y: u8, z: u8);
+    fn less(&self);
+}
+
+struct Bar;
+
+impl Foo for Bar {
+    fn foo(&self) -> bool { true } //~ ERROR E0050
+    fn bar(&self) { } //~ ERROR E0050
+    fn less(&self, x: u8, y: u8, z: u8) { } //~ ERROR E0050
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0050.stderr b/src/test/ui/error-codes/E0050.stderr
new file mode 100644 (file)
index 0000000..d95a200
--- /dev/null
@@ -0,0 +1,29 @@
+error[E0050]: method `foo` has 1 parameter but the declaration in trait `Foo::foo` has 2
+  --> $DIR/E0050.rs:20:12
+   |
+12 |     fn foo(&self, x: u8) -> bool;
+   |                      -- trait requires 2 parameters
+...
+20 |     fn foo(&self) -> bool { true } //~ ERROR E0050
+   |            ^^^^^ expected 2 parameters, found 1
+
+error[E0050]: method `bar` has 1 parameter but the declaration in trait `Foo::bar` has 4
+  --> $DIR/E0050.rs:21:12
+   |
+13 |     fn bar(&self, x: u8, y: u8, z: u8);
+   |                                    -- trait requires 4 parameters
+...
+21 |     fn bar(&self) { } //~ ERROR E0050
+   |            ^^^^^ expected 4 parameters, found 1
+
+error[E0050]: method `less` has 4 parameters but the declaration in trait `Foo::less` has 1
+  --> $DIR/E0050.rs:22:37
+   |
+14 |     fn less(&self);
+   |             ----- trait requires 1 parameter
+...
+22 |     fn less(&self, x: u8, y: u8, z: u8) { } //~ ERROR E0050
+   |                                     ^^ expected 1 parameter, found 4
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/error-codes/E0054.rs b/src/test/ui/error-codes/E0054.rs
new file mode 100644 (file)
index 0000000..158cd6f
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let x = 5;
+    let x_is_nonzero = x as bool; //~ ERROR E0054
+}
diff --git a/src/test/ui/error-codes/E0054.stderr b/src/test/ui/error-codes/E0054.stderr
new file mode 100644 (file)
index 0000000..fc33157
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0054]: cannot cast as `bool`
+  --> $DIR/E0054.rs:13:24
+   |
+13 |     let x_is_nonzero = x as bool; //~ ERROR E0054
+   |                        ^^^^^^^^^ unsupported cast
+   |
+   = help: compare with zero instead
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0055.rs b/src/test/ui/error-codes/E0055.rs
new file mode 100644 (file)
index 0000000..6e186b8
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![recursion_limit="2"]
+struct Foo;
+
+impl Foo {
+    fn foo(&self) {}
+}
+
+fn main() {
+    let foo = Foo;
+    let ref_foo = &&Foo;
+    ref_foo.foo();
+    //~^ ERROR E0055
+}
diff --git a/src/test/ui/error-codes/E0055.stderr b/src/test/ui/error-codes/E0055.stderr
new file mode 100644 (file)
index 0000000..001178e
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0055]: reached the recursion limit while auto-dereferencing Foo
+  --> $DIR/E0055.rs:21:13
+   |
+21 |     ref_foo.foo();
+   |             ^^^ deref recursion limit reached
+   |
+   = help: consider adding a `#![recursion_limit="4"]` attribute to your crate
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0057.rs b/src/test/ui/error-codes/E0057.rs
new file mode 100644 (file)
index 0000000..1fb5498
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let f = |x| x * 3;
+    let a = f(); //~ ERROR E0057
+    let b = f(4);
+    let c = f(2, 3); //~ ERROR E0057
+}
diff --git a/src/test/ui/error-codes/E0057.stderr b/src/test/ui/error-codes/E0057.stderr
new file mode 100644 (file)
index 0000000..450c87c
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0057]: this function takes 1 parameter but 0 parameters were supplied
+  --> $DIR/E0057.rs:13:13
+   |
+13 |     let a = f(); //~ ERROR E0057
+   |             ^^^ expected 1 parameter
+
+error[E0057]: this function takes 1 parameter but 2 parameters were supplied
+  --> $DIR/E0057.rs:15:13
+   |
+15 |     let c = f(2, 3); //~ ERROR E0057
+   |             ^^^^^^^ expected 1 parameter
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0059.rs b/src/test/ui/error-codes/E0059.rs
new file mode 100644 (file)
index 0000000..4ae9b2f
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(unboxed_closures)]
+
+fn foo<F: Fn<i32>>(f: F) -> F::Output { f(3) } //~ ERROR E0059
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0059.stderr b/src/test/ui/error-codes/E0059.stderr
new file mode 100644 (file)
index 0000000..aca4b88
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0059]: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit
+  --> $DIR/E0059.rs:13:41
+   |
+13 | fn foo<F: Fn<i32>>(f: F) -> F::Output { f(3) } //~ ERROR E0059
+   |                                         ^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0060.rs b/src/test/ui/error-codes/E0060.rs
new file mode 100644 (file)
index 0000000..f450520
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+extern "C" {
+    fn printf(_: *const u8, ...) -> u32;
+}
+
+fn main() {
+    unsafe { printf(); }
+    //~^ ERROR E0060
+    //~| expected at least 1 parameter
+}
diff --git a/src/test/ui/error-codes/E0060.stderr b/src/test/ui/error-codes/E0060.stderr
new file mode 100644 (file)
index 0000000..8207220
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0060]: this function takes at least 1 parameter but 0 parameters were supplied
+  --> $DIR/E0060.rs:16:14
+   |
+12 |     fn printf(_: *const u8, ...) -> u32;
+   |     ------------------------------------ defined here
+...
+16 |     unsafe { printf(); }
+   |              ^^^^^^^^ expected at least 1 parameter
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0061.rs b/src/test/ui/error-codes/E0061.rs
new file mode 100644 (file)
index 0000000..221e18c
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn f(a: u16, b: &str) {}
+
+fn f2(a: u16) {}
+
+fn main() {
+    f(0);
+    //~^ ERROR E0061
+    //~| expected 2 parameters
+
+    f2();
+    //~^ ERROR E0061
+    //~| expected 1 parameter
+}
diff --git a/src/test/ui/error-codes/E0061.stderr b/src/test/ui/error-codes/E0061.stderr
new file mode 100644 (file)
index 0000000..89d81b5
--- /dev/null
@@ -0,0 +1,20 @@
+error[E0061]: this function takes 2 parameters but 1 parameter was supplied
+  --> $DIR/E0061.rs:16:5
+   |
+11 | fn f(a: u16, b: &str) {}
+   | --------------------- defined here
+...
+16 |     f(0);
+   |     ^^^^ expected 2 parameters
+
+error[E0061]: this function takes 1 parameter but 0 parameters were supplied
+  --> $DIR/E0061.rs:20:5
+   |
+13 | fn f2(a: u16) {}
+   | ------------- defined here
+...
+20 |     f2();
+   |     ^^^^ expected 1 parameter
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0062.rs b/src/test/ui/error-codes/E0062.rs
new file mode 100644 (file)
index 0000000..684c946
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo {
+    x: i32
+}
+
+fn main() {
+    let x = Foo {
+        x: 0,
+        x: 0,
+        //~^ ERROR E0062
+    };
+}
diff --git a/src/test/ui/error-codes/E0062.stderr b/src/test/ui/error-codes/E0062.stderr
new file mode 100644 (file)
index 0000000..6c5ecf4
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0062]: field `x` specified more than once
+  --> $DIR/E0062.rs:18:9
+   |
+17 |         x: 0,
+   |         ---- first use of `x`
+18 |         x: 0,
+   |         ^^ used more than once
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0063.rs b/src/test/ui/error-codes/E0063.rs
new file mode 100644 (file)
index 0000000..0208aff
--- /dev/null
@@ -0,0 +1,50 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-tidy-linelength
+
+struct SingleFoo {
+    x: i32
+}
+
+struct PluralFoo {
+    x: i32,
+    y: i32,
+    z: i32
+}
+
+struct TruncatedFoo {
+    a: i32,
+    b: i32,
+    x: i32,
+    y: i32,
+    z: i32
+}
+
+struct TruncatedPluralFoo {
+    a: i32,
+    b: i32,
+    c: i32,
+    x: i32,
+    y: i32,
+    z: i32
+}
+
+
+fn main() {
+    let w = SingleFoo { };
+    //~^ ERROR missing field `x` in initializer of `SingleFoo`
+    let x = PluralFoo {x: 1};
+    //~^ ERROR missing fields `y`, `z` in initializer of `PluralFoo`
+    let y = TruncatedFoo{x:1};
+    //~^ missing fields `a`, `b`, `y` and 1 other field in initializer of `TruncatedFoo`
+    let z = TruncatedPluralFoo{x:1};
+    //~^ ERROR missing fields `a`, `b`, `c` and 2 other fields in initializer of `TruncatedPluralFoo`
+}
diff --git a/src/test/ui/error-codes/E0063.stderr b/src/test/ui/error-codes/E0063.stderr
new file mode 100644 (file)
index 0000000..023819c
--- /dev/null
@@ -0,0 +1,26 @@
+error[E0063]: missing field `x` in initializer of `SingleFoo`
+  --> $DIR/E0063.rs:42:13
+   |
+42 |     let w = SingleFoo { };
+   |             ^^^^^^^^^ missing `x`
+
+error[E0063]: missing fields `y`, `z` in initializer of `PluralFoo`
+  --> $DIR/E0063.rs:44:13
+   |
+44 |     let x = PluralFoo {x: 1};
+   |             ^^^^^^^^^ missing `y`, `z`
+
+error[E0063]: missing fields `a`, `b`, `y` and 1 other field in initializer of `TruncatedFoo`
+  --> $DIR/E0063.rs:46:13
+   |
+46 |     let y = TruncatedFoo{x:1};
+   |             ^^^^^^^^^^^^ missing `a`, `b`, `y` and 1 other field
+
+error[E0063]: missing fields `a`, `b`, `c` and 2 other fields in initializer of `TruncatedPluralFoo`
+  --> $DIR/E0063.rs:48:13
+   |
+48 |     let z = TruncatedPluralFoo{x:1};
+   |             ^^^^^^^^^^^^^^^^^^ missing `a`, `b`, `c` and 2 other fields
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/error-codes/E0067.rs b/src/test/ui/error-codes/E0067.rs
new file mode 100644 (file)
index 0000000..a3fc30e
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::collections::LinkedList;
+
+fn main() {
+    LinkedList::new() += 1; //~ ERROR E0368
+                            //~^ ERROR E0067
+}
diff --git a/src/test/ui/error-codes/E0067.stderr b/src/test/ui/error-codes/E0067.stderr
new file mode 100644 (file)
index 0000000..a4e1561
--- /dev/null
@@ -0,0 +1,16 @@
+error[E0368]: binary assignment operation `+=` cannot be applied to type `std::collections::LinkedList<_>`
+  --> $DIR/E0067.rs:14:5
+   |
+14 |     LinkedList::new() += 1; //~ ERROR E0368
+   |     -----------------^^^^^
+   |     |
+   |     cannot use `+=` on type `std::collections::LinkedList<_>`
+
+error[E0067]: invalid left-hand side expression
+  --> $DIR/E0067.rs:14:5
+   |
+14 |     LinkedList::new() += 1; //~ ERROR E0368
+   |     ^^^^^^^^^^^^^^^^^ invalid expression for left-hand side
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0069.rs b/src/test/ui/error-codes/E0069.rs
new file mode 100644 (file)
index 0000000..a6a7898
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo() -> u8 {
+    return;
+    //~^ ERROR `return;` in a function whose return type is not `()`
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0069.stderr b/src/test/ui/error-codes/E0069.stderr
new file mode 100644 (file)
index 0000000..8424531
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0069]: `return;` in a function whose return type is not `()`
+  --> $DIR/E0069.rs:12:5
+   |
+12 |     return;
+   |     ^^^^^^ return type is not ()
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0070.rs b/src/test/ui/error-codes/E0070.rs
new file mode 100644 (file)
index 0000000..ba66bd0
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+const SOME_CONST : i32 = 12;
+
+fn some_other_func() {}
+
+fn some_function() {
+    SOME_CONST = 14; //~ ERROR E0070
+    1 = 3; //~ ERROR E0070
+    some_other_func() = 4; //~ ERROR E0070
+                           //~^ ERROR E0308
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0070.stderr b/src/test/ui/error-codes/E0070.stderr
new file mode 100644 (file)
index 0000000..e1316e2
--- /dev/null
@@ -0,0 +1,29 @@
+error[E0070]: invalid left-hand side expression
+  --> $DIR/E0070.rs:16:5
+   |
+16 |     SOME_CONST = 14; //~ ERROR E0070
+   |     ^^^^^^^^^^^^^^^ left-hand of expression not valid
+
+error[E0070]: invalid left-hand side expression
+  --> $DIR/E0070.rs:17:5
+   |
+17 |     1 = 3; //~ ERROR E0070
+   |     ^^^^^ left-hand of expression not valid
+
+error[E0308]: mismatched types
+  --> $DIR/E0070.rs:18:25
+   |
+18 |     some_other_func() = 4; //~ ERROR E0070
+   |                         ^ expected (), found integral variable
+   |
+   = note: expected type `()`
+              found type `{integer}`
+
+error[E0070]: invalid left-hand side expression
+  --> $DIR/E0070.rs:18:5
+   |
+18 |     some_other_func() = 4; //~ ERROR E0070
+   |     ^^^^^^^^^^^^^^^^^^^^^ left-hand of expression not valid
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/error-codes/E0071.rs b/src/test/ui/error-codes/E0071.rs
new file mode 100644 (file)
index 0000000..d71dc79
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum Foo {}
+type FooAlias = Foo;
+
+fn main() {
+    let u = FooAlias { value: 0 };
+    //~^ ERROR expected struct, variant or union type, found enum `Foo` [E0071]
+}
diff --git a/src/test/ui/error-codes/E0071.stderr b/src/test/ui/error-codes/E0071.stderr
new file mode 100644 (file)
index 0000000..020dad3
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0071]: expected struct, variant or union type, found enum `Foo`
+  --> $DIR/E0071.rs:15:13
+   |
+15 |     let u = FooAlias { value: 0 };
+   |             ^^^^^^^^ not a struct
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0075.rs b/src/test/ui/error-codes/E0075.rs
new file mode 100644 (file)
index 0000000..d778390
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(repr_simd)]
+
+#[repr(simd)]
+struct Bad; //~ ERROR E0075
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0075.stderr b/src/test/ui/error-codes/E0075.stderr
new file mode 100644 (file)
index 0000000..39d27d6
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0075]: SIMD vector cannot be empty
+  --> $DIR/E0075.rs:14:1
+   |
+14 | struct Bad; //~ ERROR E0075
+   | ^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0076.rs b/src/test/ui/error-codes/E0076.rs
new file mode 100644 (file)
index 0000000..b159cf1
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(repr_simd)]
+
+#[repr(simd)]
+struct Bad(u16, u32, u32);
+//~^ ERROR E0076
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0076.stderr b/src/test/ui/error-codes/E0076.stderr
new file mode 100644 (file)
index 0000000..02ce479
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0076]: SIMD vector should be homogeneous
+  --> $DIR/E0076.rs:14:1
+   |
+14 | struct Bad(u16, u32, u32);
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^ SIMD elements must have the same type
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0077.rs b/src/test/ui/error-codes/E0077.rs
new file mode 100644 (file)
index 0000000..b074e90
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(repr_simd)]
+
+#[repr(simd)]
+struct Bad(String); //~ ERROR E0077
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0077.stderr b/src/test/ui/error-codes/E0077.stderr
new file mode 100644 (file)
index 0000000..7e7b55f
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0077]: SIMD vector element type should be machine type
+  --> $DIR/E0077.rs:14:1
+   |
+14 | struct Bad(String); //~ ERROR E0077
+   | ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0080.rs b/src/test/ui/error-codes/E0080.rs
new file mode 100644 (file)
index 0000000..2f199c4
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum Enum {
+    X = (1 << 500), //~ ERROR E0080
+    //~| WARNING shift left with overflow
+    Y = (1 / 0) //~ ERROR E0080
+    //~| WARNING divide by zero
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0080.stderr b/src/test/ui/error-codes/E0080.stderr
new file mode 100644 (file)
index 0000000..2ec2ad3
--- /dev/null
@@ -0,0 +1,28 @@
+warning: constant evaluation error: attempt to shift left with overflow
+  --> $DIR/E0080.rs:12:9
+   |
+12 |     X = (1 << 500), //~ ERROR E0080
+   |         ^^^^^^^^^^
+   |
+   = note: #[warn(const_err)] on by default
+
+error[E0080]: constant evaluation error
+  --> $DIR/E0080.rs:12:9
+   |
+12 |     X = (1 << 500), //~ ERROR E0080
+   |         ^^^^^^^^^^ attempt to shift left with overflow
+
+warning: constant evaluation error: attempt to divide by zero
+  --> $DIR/E0080.rs:14:9
+   |
+14 |     Y = (1 / 0) //~ ERROR E0080
+   |         ^^^^^^^
+
+error[E0080]: constant evaluation error
+  --> $DIR/E0080.rs:14:9
+   |
+14 |     Y = (1 / 0) //~ ERROR E0080
+   |         ^^^^^^^ attempt to divide by zero
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0081.rs b/src/test/ui/error-codes/E0081.rs
new file mode 100644 (file)
index 0000000..3b57166
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum Enum {
+    P = 3,
+    X = 3,
+    //~^ ERROR discriminant value `3isize` already exists
+    Y = 5
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0081.stderr b/src/test/ui/error-codes/E0081.stderr
new file mode 100644 (file)
index 0000000..035638b
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0081]: discriminant value `3isize` already exists
+  --> $DIR/E0081.rs:13:9
+   |
+12 |     P = 3,
+   |         - first use of `3isize`
+13 |     X = 3,
+   |         ^ enum already has `3isize`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0084.rs b/src/test/ui/error-codes/E0084.rs
new file mode 100644 (file)
index 0000000..2be206c
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[repr(i32)] //~ ERROR: E0084
+enum Foo {}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0084.stderr b/src/test/ui/error-codes/E0084.stderr
new file mode 100644 (file)
index 0000000..b39a129
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0084]: unsupported representation for zero-variant enum
+  --> $DIR/E0084.rs:11:1
+   |
+11 | #[repr(i32)] //~ ERROR: E0084
+   | ^^^^^^^^^^^^
+12 | enum Foo {}
+   | ----------- zero-variant enum
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0087.rs b/src/test/ui/error-codes/E0087.rs
new file mode 100644 (file)
index 0000000..6dc0886
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo() {}
+fn bar<T>() {}
+
+fn main() {
+    foo::<f64>(); //~ ERROR expected at most 0 type parameters, found 1 type parameter [E0087]
+
+    bar::<f64, u64>(); //~ ERROR expected at most 1 type parameter, found 2 type parameters [E0087]
+}
diff --git a/src/test/ui/error-codes/E0087.stderr b/src/test/ui/error-codes/E0087.stderr
new file mode 100644 (file)
index 0000000..20c8cd4
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0087]: too many type parameters provided: expected at most 0 type parameters, found 1 type parameter
+  --> $DIR/E0087.rs:15:11
+   |
+15 |     foo::<f64>(); //~ ERROR expected at most 0 type parameters, found 1 type parameter [E0087]
+   |           ^^^ expected 0 type parameters
+
+error[E0087]: too many type parameters provided: expected at most 1 type parameter, found 2 type parameters
+  --> $DIR/E0087.rs:17:16
+   |
+17 |     bar::<f64, u64>(); //~ ERROR expected at most 1 type parameter, found 2 type parameters [E0087]
+   |                ^^^ expected 1 type parameter
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0088.rs b/src/test/ui/error-codes/E0088.rs
new file mode 100644 (file)
index 0000000..db84a4e
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn f() {}
+fn g<'a>() -> &'a u8 { loop {} }
+
+fn main() {
+    f::<'static>(); //~ ERROR E0088
+    g::<'static, 'static>(); //~ ERROR E0088
+}
diff --git a/src/test/ui/error-codes/E0088.stderr b/src/test/ui/error-codes/E0088.stderr
new file mode 100644 (file)
index 0000000..615df88
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0088]: too many lifetime parameters provided: expected at most 0 lifetime parameters, found 1 lifetime parameter
+  --> $DIR/E0088.rs:15:9
+   |
+15 |     f::<'static>(); //~ ERROR E0088
+   |         ^^^^^^^ expected 0 lifetime parameters
+
+error[E0088]: too many lifetime parameters provided: expected at most 1 lifetime parameter, found 2 lifetime parameters
+  --> $DIR/E0088.rs:16:18
+   |
+16 |     g::<'static, 'static>(); //~ ERROR E0088
+   |                  ^^^^^^^ expected 1 lifetime parameter
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0089.rs b/src/test/ui/error-codes/E0089.rs
new file mode 100644 (file)
index 0000000..21df9ab
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo<T, U>() {}
+
+fn main() {
+    foo::<f64>(); //~ ERROR expected 2 type parameters, found 1 type parameter [E0089]
+}
diff --git a/src/test/ui/error-codes/E0089.stderr b/src/test/ui/error-codes/E0089.stderr
new file mode 100644 (file)
index 0000000..38b45e2
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0089]: too few type parameters provided: expected 2 type parameters, found 1 type parameter
+  --> $DIR/E0089.rs:14:5
+   |
+14 |     foo::<f64>(); //~ ERROR expected 2 type parameters, found 1 type parameter [E0089]
+   |     ^^^^^^^^^^ expected 2 type parameters
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0090.rs b/src/test/ui/error-codes/E0090.rs
new file mode 100644 (file)
index 0000000..13b2131
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo<'a: 'b, 'b: 'a>() {}
+
+fn main() {
+    foo::<'static>(); //~ ERROR expected 2 lifetime parameters, found 1 lifetime parameter [E0090]
+}
diff --git a/src/test/ui/error-codes/E0090.stderr b/src/test/ui/error-codes/E0090.stderr
new file mode 100644 (file)
index 0000000..050082d
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0090]: too few lifetime parameters provided: expected 2 lifetime parameters, found 1 lifetime parameter
+  --> $DIR/E0090.rs:14:5
+   |
+14 |     foo::<'static>(); //~ ERROR expected 2 lifetime parameters, found 1 lifetime parameter [E0090]
+   |     ^^^^^^^^^^^^^^ expected 2 lifetime parameters
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0091.rs b/src/test/ui/error-codes/E0091.rs
new file mode 100644 (file)
index 0000000..da988db
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+type Foo<T> = u32; //~ ERROR E0091
+type Foo2<A, B> = Box<A>; //~ ERROR E0091
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0091.stderr b/src/test/ui/error-codes/E0091.stderr
new file mode 100644 (file)
index 0000000..7d951dd
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0091]: type parameter `T` is unused
+  --> $DIR/E0091.rs:11:10
+   |
+11 | type Foo<T> = u32; //~ ERROR E0091
+   |          ^ unused type parameter
+
+error[E0091]: type parameter `B` is unused
+  --> $DIR/E0091.rs:12:14
+   |
+12 | type Foo2<A, B> = Box<A>; //~ ERROR E0091
+   |              ^ unused type parameter
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0092.rs b/src/test/ui/error-codes/E0092.rs
new file mode 100644 (file)
index 0000000..b08164a
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(intrinsics)]
+extern "rust-intrinsic" {
+    fn atomic_foo(); //~ ERROR E0092
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0092.stderr b/src/test/ui/error-codes/E0092.stderr
new file mode 100644 (file)
index 0000000..788f899
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0092]: unrecognized atomic operation function: `foo`
+  --> $DIR/E0092.rs:13:5
+   |
+13 |     fn atomic_foo(); //~ ERROR E0092
+   |     ^^^^^^^^^^^^^^^^ unrecognized atomic operation
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0093.rs b/src/test/ui/error-codes/E0093.rs
new file mode 100644 (file)
index 0000000..d84f9f6
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(intrinsics)]
+extern "rust-intrinsic" {
+    fn foo();
+    //~^ ERROR E0093
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0093.stderr b/src/test/ui/error-codes/E0093.stderr
new file mode 100644 (file)
index 0000000..959d64a
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0093]: unrecognized intrinsic function: `foo`
+  --> $DIR/E0093.rs:13:5
+   |
+13 |     fn foo();
+   |     ^^^^^^^^^ unrecognized intrinsic
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0094.rs b/src/test/ui/error-codes/E0094.rs
new file mode 100644 (file)
index 0000000..3a31874
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(intrinsics)]
+extern "rust-intrinsic" {
+    fn size_of<T, U>() -> usize; //~ ERROR E0094
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0094.stderr b/src/test/ui/error-codes/E0094.stderr
new file mode 100644 (file)
index 0000000..fdef3d8
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0094]: intrinsic has wrong number of type parameters: found 2, expected 1
+  --> $DIR/E0094.rs:13:15
+   |
+13 |     fn size_of<T, U>() -> usize; //~ ERROR E0094
+   |               ^^^^^^ expected 1 type parameter
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0106.rs b/src/test/ui/error-codes/E0106.rs
new file mode 100644 (file)
index 0000000..0674930
--- /dev/null
@@ -0,0 +1,36 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo {
+    x: &bool,
+    //~^ ERROR E0106
+}
+enum Bar {
+    A(u8),
+    B(&bool),
+   //~^ ERROR E0106
+}
+type MyStr = &str;
+        //~^ ERROR E0106
+
+struct Baz<'a>(&'a str);
+struct Buzz<'a, 'b>(&'a str, &'b str);
+
+struct Quux {
+    baz: Baz,
+    //~^ ERROR E0106
+    //~| expected lifetime parameter
+    buzz: Buzz,
+    //~^ ERROR E0106
+    //~| expected 2 lifetime parameters
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0106.stderr b/src/test/ui/error-codes/E0106.stderr
new file mode 100644 (file)
index 0000000..9844280
--- /dev/null
@@ -0,0 +1,32 @@
+error[E0106]: missing lifetime specifier
+  --> $DIR/E0106.rs:12:8
+   |
+12 |     x: &bool,
+   |        ^ expected lifetime parameter
+
+error[E0106]: missing lifetime specifier
+  --> $DIR/E0106.rs:17:7
+   |
+17 |     B(&bool),
+   |       ^ expected lifetime parameter
+
+error[E0106]: missing lifetime specifier
+  --> $DIR/E0106.rs:20:14
+   |
+20 | type MyStr = &str;
+   |              ^ expected lifetime parameter
+
+error[E0106]: missing lifetime specifier
+  --> $DIR/E0106.rs:27:10
+   |
+27 |     baz: Baz,
+   |          ^^^ expected lifetime parameter
+
+error[E0106]: missing lifetime specifiers
+  --> $DIR/E0106.rs:30:11
+   |
+30 |     buzz: Buzz,
+   |           ^^^^ expected 2 lifetime parameters
+
+error: aborting due to 5 previous errors
+
diff --git a/src/test/ui/error-codes/E0107.rs b/src/test/ui/error-codes/E0107.rs
new file mode 100644 (file)
index 0000000..16ebd3e
--- /dev/null
@@ -0,0 +1,33 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo<'a>(&'a str);
+struct Buzz<'a, 'b>(&'a str, &'b str);
+
+enum Bar {
+    A,
+    B,
+    C,
+}
+
+struct Baz<'a, 'b, 'c> {
+    buzz: Buzz<'a>,
+    //~^ ERROR E0107
+    //~| expected 2 lifetime parameters
+    bar: Bar<'a>,
+    //~^ ERROR E0107
+    //~| unexpected lifetime parameter
+    foo2: Foo<'a, 'b, 'c>,
+    //~^ ERROR E0107
+    //~| 2 unexpected lifetime parameters
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0107.stderr b/src/test/ui/error-codes/E0107.stderr
new file mode 100644 (file)
index 0000000..6283486
--- /dev/null
@@ -0,0 +1,20 @@
+error[E0107]: wrong number of lifetime parameters: expected 2, found 1
+  --> $DIR/E0107.rs:21:11
+   |
+21 |     buzz: Buzz<'a>,
+   |           ^^^^^^^^ expected 2 lifetime parameters
+
+error[E0107]: wrong number of lifetime parameters: expected 0, found 1
+  --> $DIR/E0107.rs:24:10
+   |
+24 |     bar: Bar<'a>,
+   |          ^^^^^^^ unexpected lifetime parameter
+
+error[E0107]: wrong number of lifetime parameters: expected 1, found 3
+  --> $DIR/E0107.rs:27:11
+   |
+27 |     foo2: Foo<'a, 'b, 'c>,
+   |           ^^^^^^^^^^^^^^^ 2 unexpected lifetime parameters
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/error-codes/E0109.rs b/src/test/ui/error-codes/E0109.rs
new file mode 100644 (file)
index 0000000..9fc4784
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+type X = u32<i32>; //~ ERROR E0109
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0109.stderr b/src/test/ui/error-codes/E0109.stderr
new file mode 100644 (file)
index 0000000..59da111
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0109]: type parameters are not allowed on this type
+  --> $DIR/E0109.rs:11:14
+   |
+11 | type X = u32<i32>; //~ ERROR E0109
+   |              ^^^ type parameter not allowed
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0110.rs b/src/test/ui/error-codes/E0110.rs
new file mode 100644 (file)
index 0000000..fd169f4
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+type X = u32<'static>; //~ ERROR E0110
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0110.stderr b/src/test/ui/error-codes/E0110.stderr
new file mode 100644 (file)
index 0000000..7417351
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0110]: lifetime parameters are not allowed on this type
+  --> $DIR/E0110.rs:11:14
+   |
+11 | type X = u32<'static>; //~ ERROR E0110
+   |              ^^^^^^^ lifetime parameter not allowed on this type
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0116.rs b/src/test/ui/error-codes/E0116.rs
new file mode 100644 (file)
index 0000000..cd7d8dc
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+impl Vec<u8> {}
+//~^ ERROR E0116
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0116.stderr b/src/test/ui/error-codes/E0116.stderr
new file mode 100644 (file)
index 0000000..c090060
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0116]: cannot define inherent `impl` for a type outside of the crate where the type is defined
+  --> $DIR/E0116.rs:11:1
+   |
+11 | impl Vec<u8> {}
+   | ^^^^^^^^^^^^^^^ impl for type defined outside of crate.
+   |
+   = note: define and implement a trait or new type instead
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0117.rs b/src/test/ui/error-codes/E0117.rs
new file mode 100644 (file)
index 0000000..982f875
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+impl Drop for u32 {} //~ ERROR E0117
+//~| ERROR the Drop trait may only be implemented on structures
+//~| implementing Drop requires a struct
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0117.stderr b/src/test/ui/error-codes/E0117.stderr
new file mode 100644 (file)
index 0000000..9856692
--- /dev/null
@@ -0,0 +1,17 @@
+error[E0120]: the Drop trait may only be implemented on structures
+  --> $DIR/E0117.rs:11:15
+   |
+11 | impl Drop for u32 {} //~ ERROR E0117
+   |               ^^^ implementing Drop requires a struct
+
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+  --> $DIR/E0117.rs:11:1
+   |
+11 | impl Drop for u32 {} //~ ERROR E0117
+   | ^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   |
+   = note: the impl does not reference any types defined in this crate
+   = note: define and implement a trait or new type instead
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0118.rs b/src/test/ui/error-codes/E0118.rs
new file mode 100644 (file)
index 0000000..d37ff34
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+impl (u8, u8) { //~ ERROR E0118
+    fn get_state(&self) -> String {
+        String::new()
+    }
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0118.stderr b/src/test/ui/error-codes/E0118.stderr
new file mode 100644 (file)
index 0000000..8c78890
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0118]: no base type found for inherent implementation
+  --> $DIR/E0118.rs:11:6
+   |
+11 | impl (u8, u8) { //~ ERROR E0118
+   |      ^^^^^^^^ impl requires a base type
+   |
+   = note: either implement a trait on it or create a newtype to wrap it instead
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0119.rs b/src/test/ui/error-codes/E0119.rs
new file mode 100644 (file)
index 0000000..9528631
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait MyTrait {
+    fn get(&self) -> usize;
+}
+
+impl<T> MyTrait for T {
+    fn get(&self) -> usize { 0 }
+}
+
+struct Foo {
+    value: usize
+}
+
+impl MyTrait for Foo { //~ ERROR E0119
+    fn get(&self) -> usize { self.value }
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0119.stderr b/src/test/ui/error-codes/E0119.stderr
new file mode 100644 (file)
index 0000000..91bb74a
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0119]: conflicting implementations of trait `MyTrait` for type `Foo`:
+  --> $DIR/E0119.rs:23:1
+   |
+15 | impl<T> MyTrait for T {
+   | --------------------- first implementation here
+...
+23 | impl MyTrait for Foo { //~ ERROR E0119
+   | ^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Foo`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0120.rs b/src/test/ui/error-codes/E0120.rs
new file mode 100644 (file)
index 0000000..8d09b87
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait MyTrait { fn foo() {} }
+
+impl Drop for MyTrait {
+              //~^ ERROR E0120
+    fn drop(&mut self) {}
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0120.stderr b/src/test/ui/error-codes/E0120.stderr
new file mode 100644 (file)
index 0000000..7c666d9
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0120]: the Drop trait may only be implemented on structures
+  --> $DIR/E0120.rs:13:15
+   |
+13 | impl Drop for MyTrait {
+   |               ^^^^^^^ implementing Drop requires a struct
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0121.rs b/src/test/ui/error-codes/E0121.rs
new file mode 100644 (file)
index 0000000..b26b5f4
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo() -> _ { 5 } //~ ERROR E0121
+
+static BAR: _ = "test"; //~ ERROR E0121
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0121.stderr b/src/test/ui/error-codes/E0121.stderr
new file mode 100644 (file)
index 0000000..fa54d67
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+  --> $DIR/E0121.rs:11:13
+   |
+11 | fn foo() -> _ { 5 } //~ ERROR E0121
+   |             ^ not allowed in type signatures
+
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+  --> $DIR/E0121.rs:13:13
+   |
+13 | static BAR: _ = "test"; //~ ERROR E0121
+   |             ^ not allowed in type signatures
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0124.rs b/src/test/ui/error-codes/E0124.rs
new file mode 100644 (file)
index 0000000..3ef20c6
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo {
+    field1: i32,
+    field1: i32,
+    //~^ ERROR field `field1` is already declared [E0124]
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0124.stderr b/src/test/ui/error-codes/E0124.stderr
new file mode 100644 (file)
index 0000000..8e1ec51
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0124]: field `field1` is already declared
+  --> $DIR/E0124.rs:13:5
+   |
+12 |     field1: i32,
+   |     ----------- `field1` first declared here
+13 |     field1: i32,
+   |     ^^^^^^^^^^^ field already declared
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0128.rs b/src/test/ui/error-codes/E0128.rs
new file mode 100644 (file)
index 0000000..3707101
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo<T=U, U=()> { //~ ERROR E0128
+    field1: T,
+    field2: U,
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0128.stderr b/src/test/ui/error-codes/E0128.stderr
new file mode 100644 (file)
index 0000000..fad2d0d
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0128]: type parameters with a default cannot use forward declared identifiers
+  --> $DIR/E0128.rs:11:14
+   |
+11 | struct Foo<T=U, U=()> { //~ ERROR E0128
+   |              ^ defaulted type parameters cannot be forward declared
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0130.rs b/src/test/ui/error-codes/E0130.rs
new file mode 100644 (file)
index 0000000..d11b59c
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+extern {
+    fn foo((a, b): (u32, u32));
+    //~^ ERROR E0130
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0130.stderr b/src/test/ui/error-codes/E0130.stderr
new file mode 100644 (file)
index 0000000..02aebe0
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0130]: patterns aren't allowed in foreign function declarations
+  --> $DIR/E0130.rs:12:12
+   |
+12 |     fn foo((a, b): (u32, u32));
+   |            ^^^^^^ pattern not allowed in foreign function
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0131.rs b/src/test/ui/error-codes/E0131.rs
new file mode 100644 (file)
index 0000000..c7e31ed
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main<T>() {
+    //~^ ERROR E0131
+}
diff --git a/src/test/ui/error-codes/E0131.stderr b/src/test/ui/error-codes/E0131.stderr
new file mode 100644 (file)
index 0000000..d97e00f
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0131]: main function is not allowed to have type parameters
+  --> $DIR/E0131.rs:11:8
+   |
+11 | fn main<T>() {
+   |        ^^^ main cannot have type parameters
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0132.rs b/src/test/ui/error-codes/E0132.rs
new file mode 100644 (file)
index 0000000..25ccb34
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(start)]
+
+#[start]
+fn f< T >() {} //~ ERROR E0132
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0132.stderr b/src/test/ui/error-codes/E0132.stderr
new file mode 100644 (file)
index 0000000..5c66d67
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0132]: start function is not allowed to have type parameters
+  --> $DIR/E0132.rs:14:5
+   |
+14 | fn f< T >() {} //~ ERROR E0132
+   |     ^^^^^ start function cannot have type parameters
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0133.rs b/src/test/ui/error-codes/E0133.rs
new file mode 100644 (file)
index 0000000..2e54f65
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+unsafe fn f() { return; }
+
+fn main() {
+    f();
+    //~^ ERROR E0133
+}
diff --git a/src/test/ui/error-codes/E0133.stderr b/src/test/ui/error-codes/E0133.stderr
new file mode 100644 (file)
index 0000000..4d2ebd1
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0133]: call to unsafe function requires unsafe function or block
+  --> $DIR/E0133.rs:14:5
+   |
+14 |     f();
+   |     ^^^ call to unsafe function
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0137.rs b/src/test/ui/error-codes/E0137.rs
new file mode 100644 (file)
index 0000000..067ebcc
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(main)]
+
+#[main]
+fn foo() {}
+
+#[main]
+fn f() {}
+//~^ ERROR E0137
diff --git a/src/test/ui/error-codes/E0137.stderr b/src/test/ui/error-codes/E0137.stderr
new file mode 100644 (file)
index 0000000..bc6bbff
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0137]: multiple functions with a #[main] attribute
+  --> $DIR/E0137.rs:17:1
+   |
+14 | fn foo() {}
+   | ----------- first #[main] function
+...
+17 | fn f() {}
+   | ^^^^^^^^^ additional #[main] function
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0138.rs b/src/test/ui/error-codes/E0138.rs
new file mode 100644 (file)
index 0000000..856616c
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(start)]
+
+#[start]
+fn foo(argc: isize, argv: *const *const u8) -> isize { 0 }
+
+#[start]
+fn f(argc: isize, argv: *const *const u8) -> isize { 0 }
+//~^ ERROR E0138
diff --git a/src/test/ui/error-codes/E0138.stderr b/src/test/ui/error-codes/E0138.stderr
new file mode 100644 (file)
index 0000000..cee7cc5
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0138]: multiple 'start' functions
+  --> $DIR/E0138.rs:17:1
+   |
+14 | fn foo(argc: isize, argv: *const *const u8) -> isize { 0 }
+   | ---------------------------------------------------------- previous `start` function here
+...
+17 | fn f(argc: isize, argv: *const *const u8) -> isize { 0 }
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ multiple `start` functions
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0152.rs b/src/test/ui/error-codes/E0152.rs
new file mode 100644 (file)
index 0000000..ae501b9
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(lang_items)]
+
+#[lang = "panic_fmt"]
+struct Foo; //~ ERROR E0152
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0152.stderr b/src/test/ui/error-codes/E0152.stderr
new file mode 100644 (file)
index 0000000..a1d5597
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0152]: duplicate lang item found: `panic_fmt`.
+  --> $DIR/E0152.rs:14:1
+   |
+14 | struct Foo; //~ ERROR E0152
+   | ^^^^^^^^^^^
+   |
+   = note: first defined in crate `std`.
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0161.rs b/src/test/ui/error-codes/E0161.rs
new file mode 100644 (file)
index 0000000..81adf90
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(box_syntax)]
+
+fn main() {
+    let _x: Box<str> = box *"hello"; //~ ERROR E0161
+                                     //~^ ERROR E0507
+}
diff --git a/src/test/ui/error-codes/E0161.stderr b/src/test/ui/error-codes/E0161.stderr
new file mode 100644 (file)
index 0000000..9914fdd
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0161]: cannot move a value of type str: the size of str cannot be statically determined
+  --> $DIR/E0161.rs:14:28
+   |
+14 |     let _x: Box<str> = box *"hello"; //~ ERROR E0161
+   |                            ^^^^^^^^
+
+error[E0507]: cannot move out of borrowed content
+  --> $DIR/E0161.rs:14:28
+   |
+14 |     let _x: Box<str> = box *"hello"; //~ ERROR E0161
+   |                            ^^^^^^^^ cannot move out of borrowed content
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0162.rs b/src/test/ui/error-codes/E0162.rs
new file mode 100644 (file)
index 0000000..e13b0af
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Irrefutable(i32);
+
+fn main() {
+    let irr = Irrefutable(0);
+    if let Irrefutable(x) = irr { //~ ERROR E0162
+        println!("{}", x);
+    }
+}
diff --git a/src/test/ui/error-codes/E0162.stderr b/src/test/ui/error-codes/E0162.stderr
new file mode 100644 (file)
index 0000000..318a023
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0162]: irrefutable if-let pattern
+  --> $DIR/E0162.rs:15:12
+   |
+15 |     if let Irrefutable(x) = irr { //~ ERROR E0162
+   |            ^^^^^^^^^^^^^^ irrefutable pattern
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0164.rs b/src/test/ui/error-codes/E0164.rs
new file mode 100644 (file)
index 0000000..a7f10dd
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+
+enum Foo {}
+
+impl Foo {
+    const B: u8 = 0;
+}
+
+fn bar(foo: Foo) -> u32 {
+    match foo {
+        Foo::B(i) => i, //~ ERROR E0164
+    }
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0164.stderr b/src/test/ui/error-codes/E0164.stderr
new file mode 100644 (file)
index 0000000..a515c83
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0164]: expected tuple struct/variant, found associated constant `<Foo>::B`
+  --> $DIR/E0164.rs:20:9
+   |
+20 |         Foo::B(i) => i, //~ ERROR E0164
+   |         ^^^^^^^^^ not a tuple variant or struct
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0165.rs b/src/test/ui/error-codes/E0165.rs
new file mode 100644 (file)
index 0000000..142635f
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Irrefutable(i32);
+
+fn main() {
+    let irr = Irrefutable(0);
+    while let Irrefutable(x) = irr { //~ ERROR E0165
+                                     //~| irrefutable pattern
+        // ...
+    }
+}
diff --git a/src/test/ui/error-codes/E0165.stderr b/src/test/ui/error-codes/E0165.stderr
new file mode 100644 (file)
index 0000000..3c90f19
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0165]: irrefutable while-let pattern
+  --> $DIR/E0165.rs:15:15
+   |
+15 |     while let Irrefutable(x) = irr { //~ ERROR E0165
+   |               ^^^^^^^^^^^^^^ irrefutable pattern
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0184.rs b/src/test/ui/error-codes/E0184.rs
new file mode 100644 (file)
index 0000000..5d72d00
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[derive(Copy)] //~ ERROR E0184
+struct Foo;
+
+impl Drop for Foo {
+    fn drop(&mut self) {
+    }
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0184.stderr b/src/test/ui/error-codes/E0184.stderr
new file mode 100644 (file)
index 0000000..53bda3b
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor
+  --> $DIR/E0184.rs:11:10
+   |
+11 | #[derive(Copy)] //~ ERROR E0184
+   |          ^^^^ Copy not allowed on types with destructors
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0185.rs b/src/test/ui/error-codes/E0185.rs
new file mode 100644 (file)
index 0000000..0cd3d00
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Foo {
+    fn foo();
+    //~^ NOTE trait method declared without `&self`
+}
+
+struct Bar;
+
+impl Foo for Bar {
+    fn foo(&self) {}
+    //~^ ERROR E0185
+    //~| NOTE `&self` used in impl
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0185.stderr b/src/test/ui/error-codes/E0185.stderr
new file mode 100644 (file)
index 0000000..0d24a37
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0185]: method `foo` has a `&self` declaration in the impl, but not in the trait
+  --> $DIR/E0185.rs:19:5
+   |
+12 |     fn foo();
+   |     --------- trait method declared without `&self`
+...
+19 |     fn foo(&self) {}
+   |     ^^^^^^^^^^^^^ `&self` used in impl
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0186.rs b/src/test/ui/error-codes/E0186.rs
new file mode 100644 (file)
index 0000000..55a3490
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Foo {
+    fn foo(&self); //~ `&self` used in trait
+}
+
+struct Bar;
+
+impl Foo for Bar {
+    fn foo() {} //~ ERROR E0186
+    //~^ expected `&self` in impl
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0186.stderr b/src/test/ui/error-codes/E0186.stderr
new file mode 100644 (file)
index 0000000..598057d
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0186]: method `foo` has a `&self` declaration in the trait, but not in the impl
+  --> $DIR/E0186.rs:18:5
+   |
+12 |     fn foo(&self); //~ `&self` used in trait
+   |     -------------- `&self` used in trait
+...
+18 |     fn foo() {} //~ ERROR E0186
+   |     ^^^^^^^^ expected `&self` in impl
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0191.rs b/src/test/ui/error-codes/E0191.rs
new file mode 100644 (file)
index 0000000..489ebb0
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Trait {
+    type Bar;
+}
+
+type Foo = Trait; //~ ERROR E0191
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0191.stderr b/src/test/ui/error-codes/E0191.stderr
new file mode 100644 (file)
index 0000000..8f99a6e
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0191]: the value of the associated type `Bar` (from the trait `Trait`) must be specified
+  --> $DIR/E0191.rs:15:12
+   |
+15 | type Foo = Trait; //~ ERROR E0191
+   |            ^^^^^ missing associated type `Bar` value
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0192.rs b/src/test/ui/error-codes/E0192.rs
new file mode 100644 (file)
index 0000000..92f5876
--- /dev/null
@@ -0,0 +1,22 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(optin_builtin_traits)]
+
+trait Trait {
+    type Bar;
+}
+
+struct Foo;
+
+impl !Trait for Foo { } //~ ERROR E0192
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0192.stderr b/src/test/ui/error-codes/E0192.stderr
new file mode 100644 (file)
index 0000000..b592c87
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0192]: negative impls are only allowed for auto traits (e.g., `Send` and `Sync`)
+  --> $DIR/E0192.rs:19:1
+   |
+19 | impl !Trait for Foo { } //~ ERROR E0192
+   | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0194.rs b/src/test/ui/error-codes/E0194.rs
new file mode 100644 (file)
index 0000000..17e0751
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Foo<T> {
+    fn do_something(&self) -> T;
+    fn do_something_else<T: Clone>(&self, bar: T);
+    //~^ ERROR E0194
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0194.stderr b/src/test/ui/error-codes/E0194.stderr
new file mode 100644 (file)
index 0000000..360e8c0
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0194]: type parameter `T` shadows another type parameter of the same name
+  --> $DIR/E0194.rs:13:26
+   |
+11 | trait Foo<T> {
+   |           - first `T` declared here
+12 |     fn do_something(&self) -> T;
+13 |     fn do_something_else<T: Clone>(&self, bar: T);
+   |                          ^ shadows another type parameter
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0195.rs b/src/test/ui/error-codes/E0195.rs
new file mode 100644 (file)
index 0000000..4f4d7ce
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Trait {
+    fn bar<'a,'b:'a>(x: &'a str, y: &'b str);
+    //~^ NOTE lifetimes in impl do not match this method in trait
+}
+
+struct Foo;
+
+impl Trait for Foo {
+    fn bar<'a,'b>(x: &'a str, y: &'b str) { //~ ERROR E0195
+    //~^ NOTE lifetimes do not match method in trait
+    }
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0195.stderr b/src/test/ui/error-codes/E0195.stderr
new file mode 100644 (file)
index 0000000..3cce3d0
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0195]: lifetime parameters or bounds on method `bar` do not match the trait declaration
+  --> $DIR/E0195.rs:19:5
+   |
+12 |     fn bar<'a,'b:'a>(x: &'a str, y: &'b str);
+   |     ----------------------------------------- lifetimes in impl do not match this method in trait
+...
+19 |     fn bar<'a,'b>(x: &'a str, y: &'b str) { //~ ERROR E0195
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetimes do not match method in trait
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0197.rs b/src/test/ui/error-codes/E0197.rs
new file mode 100644 (file)
index 0000000..f25fa9b
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo;
+
+unsafe impl Foo { } //~ ERROR E0197
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0197.stderr b/src/test/ui/error-codes/E0197.stderr
new file mode 100644 (file)
index 0000000..277f523
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0197]: inherent impls cannot be unsafe
+  --> $DIR/E0197.rs:13:1
+   |
+13 | unsafe impl Foo { } //~ ERROR E0197
+   | ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0198.rs b/src/test/ui/error-codes/E0198.rs
new file mode 100644 (file)
index 0000000..1a779a4
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(optin_builtin_traits)]
+
+struct Foo;
+
+unsafe impl !Send for Foo { } //~ ERROR E0198
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0198.stderr b/src/test/ui/error-codes/E0198.stderr
new file mode 100644 (file)
index 0000000..a85419e
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0198]: negative impls cannot be unsafe
+  --> $DIR/E0198.rs:15:1
+   |
+15 | unsafe impl !Send for Foo { } //~ ERROR E0198
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0199.rs b/src/test/ui/error-codes/E0199.rs
new file mode 100644 (file)
index 0000000..1a5cd19
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(optin_builtin_traits)]
+
+struct Foo;
+
+trait Bar { }
+unsafe impl Bar for Foo { } //~ ERROR implementing the trait `Bar` is not unsafe [E0199]
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0199.stderr b/src/test/ui/error-codes/E0199.stderr
new file mode 100644 (file)
index 0000000..efbe066
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0199]: implementing the trait `Bar` is not unsafe
+  --> $DIR/E0199.rs:16:1
+   |
+16 | unsafe impl Bar for Foo { } //~ ERROR implementing the trait `Bar` is not unsafe [E0199]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0200.rs b/src/test/ui/error-codes/E0200.rs
new file mode 100644 (file)
index 0000000..6bfea0e
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo;
+
+unsafe trait Bar { }
+
+impl Bar for Foo { } //~ ERROR E0200
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0200.stderr b/src/test/ui/error-codes/E0200.stderr
new file mode 100644 (file)
index 0000000..fb71da2
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0200]: the trait `Bar` requires an `unsafe impl` declaration
+  --> $DIR/E0200.rs:15:1
+   |
+15 | impl Bar for Foo { } //~ ERROR E0200
+   | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0201.rs b/src/test/ui/error-codes/E0201.rs
new file mode 100644 (file)
index 0000000..ff6cb55
--- /dev/null
@@ -0,0 +1,32 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo(u8);
+
+impl Foo {
+    fn bar(&self) -> bool { self.0 > 5 }
+    fn bar() {} //~ ERROR E0201
+}
+
+trait Baz {
+    type Quux;
+    fn baz(&self) -> bool;
+}
+
+impl Baz for Foo {
+    type Quux = u32;
+
+    fn baz(&self) -> bool { true }
+    fn baz(&self) -> bool { self.0 > 5 } //~ ERROR E0201
+    type Quux = u32; //~ ERROR E0201
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0201.stderr b/src/test/ui/error-codes/E0201.stderr
new file mode 100644 (file)
index 0000000..01dbee6
--- /dev/null
@@ -0,0 +1,27 @@
+error[E0201]: duplicate definitions with name `bar`:
+  --> $DIR/E0201.rs:15:5
+   |
+14 |     fn bar(&self) -> bool { self.0 > 5 }
+   |     ------------------------------------ previous definition of `bar` here
+15 |     fn bar() {} //~ ERROR E0201
+   |     ^^^^^^^^^^^ duplicate definition
+
+error[E0201]: duplicate definitions with name `baz`:
+  --> $DIR/E0201.rs:27:5
+   |
+26 |     fn baz(&self) -> bool { true }
+   |     ------------------------------ previous definition of `baz` here
+27 |     fn baz(&self) -> bool { self.0 > 5 } //~ ERROR E0201
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definition
+
+error[E0201]: duplicate definitions with name `Quux`:
+  --> $DIR/E0201.rs:28:5
+   |
+24 |     type Quux = u32;
+   |     ---------------- previous definition of `Quux` here
+...
+28 |     type Quux = u32; //~ ERROR E0201
+   |     ^^^^^^^^^^^^^^^^ duplicate definition
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/error-codes/E0206.rs b/src/test/ui/error-codes/E0206.rs
new file mode 100644 (file)
index 0000000..da0370b
--- /dev/null
@@ -0,0 +1,24 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+type Foo = i32;
+
+impl Copy for Foo { }
+//~^ ERROR the trait `Copy` may not be implemented for this type
+//~| ERROR only traits defined in the current crate can be implemented for arbitrary types
+
+#[derive(Copy, Clone)]
+struct Bar;
+
+impl Copy for &'static Bar { }
+//~^ ERROR the trait `Copy` may not be implemented for this type
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0206.stderr b/src/test/ui/error-codes/E0206.stderr
new file mode 100644 (file)
index 0000000..8eeb94a
--- /dev/null
@@ -0,0 +1,23 @@
+error[E0206]: the trait `Copy` may not be implemented for this type
+  --> $DIR/E0206.rs:13:15
+   |
+13 | impl Copy for Foo { }
+   |               ^^^ type is not a structure or enumeration
+
+error[E0206]: the trait `Copy` may not be implemented for this type
+  --> $DIR/E0206.rs:20:15
+   |
+20 | impl Copy for &'static Bar { }
+   |               ^^^^^^^^^^^^ type is not a structure or enumeration
+
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+  --> $DIR/E0206.rs:13:1
+   |
+13 | impl Copy for Foo { }
+   | ^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   |
+   = note: the impl does not reference any types defined in this crate
+   = note: define and implement a trait or new type instead
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/error-codes/E0207.rs b/src/test/ui/error-codes/E0207.rs
new file mode 100644 (file)
index 0000000..bd87dba
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo;
+
+impl<T: Default> Foo { //~ ERROR E0207
+    fn get(&self) -> T {
+        <T as Default>::default()
+    }
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0207.stderr b/src/test/ui/error-codes/E0207.stderr
new file mode 100644 (file)
index 0000000..35f9109
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
+  --> $DIR/E0207.rs:13:6
+   |
+13 | impl<T: Default> Foo { //~ ERROR E0207
+   |      ^ unconstrained type parameter
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0214.rs b/src/test/ui/error-codes/E0214.rs
new file mode 100644 (file)
index 0000000..2b09039
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let v: Vec(&str) = vec!["foo"];
+    //~^ ERROR E0214
+}
diff --git a/src/test/ui/error-codes/E0214.stderr b/src/test/ui/error-codes/E0214.stderr
new file mode 100644 (file)
index 0000000..30f5b96
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0214]: parenthesized parameters may only be used with a trait
+  --> $DIR/E0214.rs:12:15
+   |
+12 |     let v: Vec(&str) = vec!["foo"];
+   |               ^^^^^^ only traits may use parentheses
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0220.rs b/src/test/ui/error-codes/E0220.rs
new file mode 100644 (file)
index 0000000..2866ffc
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Trait {
+    type Bar;
+}
+
+type Foo = Trait<F=i32>; //~ ERROR E0220
+                         //~| ERROR E0191
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0220.stderr b/src/test/ui/error-codes/E0220.stderr
new file mode 100644 (file)
index 0000000..70b017b
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0220]: associated type `F` not found for `Trait`
+  --> $DIR/E0220.rs:15:18
+   |
+15 | type Foo = Trait<F=i32>; //~ ERROR E0220
+   |                  ^^^^^ associated type `F` not found
+
+error[E0191]: the value of the associated type `Bar` (from the trait `Trait`) must be specified
+  --> $DIR/E0220.rs:15:12
+   |
+15 | type Foo = Trait<F=i32>; //~ ERROR E0220
+   |            ^^^^^^^^^^^^ missing associated type `Bar` value
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0221.rs b/src/test/ui/error-codes/E0221.rs
new file mode 100644 (file)
index 0000000..9909246
--- /dev/null
@@ -0,0 +1,37 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait T1 {}
+trait T2 {}
+
+trait Foo {
+    type A: T1;
+}
+
+trait Bar : Foo {
+    type A: T2;
+    fn do_something() {
+        let _: Self::A;
+        //~^ ERROR E0221
+    }
+}
+
+trait T3 {}
+
+trait My : std::str::FromStr {
+    type Err: T3;
+    fn test() {
+        let _: Self::Err;
+        //~^ ERROR E0221
+    }
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0221.stderr b/src/test/ui/error-codes/E0221.stderr
new file mode 100644 (file)
index 0000000..3dd9393
--- /dev/null
@@ -0,0 +1,29 @@
+error[E0221]: ambiguous associated type `A` in bounds of `Self`
+  --> $DIR/E0221.rs:21:16
+   |
+15 |     type A: T1;
+   |     ----------- ambiguous `A` from `Foo`
+...
+19 |     type A: T2;
+   |     ----------- ambiguous `A` from `Bar`
+20 |     fn do_something() {
+21 |         let _: Self::A;
+   |                ^^^^^^^ ambiguous associated type `A`
+
+error[E0221]: ambiguous associated type `Err` in bounds of `Self`
+  --> $DIR/E0221.rs:31:16
+   |
+29 |     type Err: T3;
+   |     ------------- ambiguous `Err` from `My`
+30 |     fn test() {
+31 |         let _: Self::Err;
+   |                ^^^^^^^^^ ambiguous associated type `Err`
+   |
+note: associated type `Self` could derive from `std::str::FromStr`
+  --> $DIR/E0221.rs:31:16
+   |
+31 |         let _: Self::Err;
+   |                ^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0223.rs b/src/test/ui/error-codes/E0223.rs
new file mode 100644 (file)
index 0000000..0683197
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait MyTrait { type X; }
+
+fn main() {
+    let foo: MyTrait::X;
+    //~^ ERROR ambiguous associated type
+}
diff --git a/src/test/ui/error-codes/E0223.stderr b/src/test/ui/error-codes/E0223.stderr
new file mode 100644 (file)
index 0000000..efd0d78
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0223]: ambiguous associated type
+  --> $DIR/E0223.rs:14:14
+   |
+14 |     let foo: MyTrait::X;
+   |              ^^^^^^^^^^ ambiguous associated type
+   |
+   = note: specify the type using the syntax `<Type as MyTrait>::X`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0225.rs b/src/test/ui/error-codes/E0225.rs
new file mode 100644 (file)
index 0000000..6c77443
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let _: Box<std::io::Read + std::io::Write>;
+    //~^ ERROR only auto traits can be used as additional traits in a trait object [E0225]
+}
diff --git a/src/test/ui/error-codes/E0225.stderr b/src/test/ui/error-codes/E0225.stderr
new file mode 100644 (file)
index 0000000..35d40cb
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0225]: only auto traits can be used as additional traits in a trait object
+  --> $DIR/E0225.rs:12:32
+   |
+12 |     let _: Box<std::io::Read + std::io::Write>;
+   |                                ^^^^^^^^^^^^^^ non-auto additional trait
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0229.rs b/src/test/ui/error-codes/E0229.rs
new file mode 100644 (file)
index 0000000..b70fb09
--- /dev/null
@@ -0,0 +1,27 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub trait Foo {
+    type A;
+    fn boo(&self) -> <Self as Foo>::A;
+}
+
+struct Bar;
+
+impl Foo for isize {
+    type A = usize;
+    fn boo(&self) -> usize { 42 }
+}
+
+fn baz<I>(x: &<I as Foo<A=Bar>>::A) {}
+//~^ ERROR associated type bindings are not allowed here [E0229]
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0229.stderr b/src/test/ui/error-codes/E0229.stderr
new file mode 100644 (file)
index 0000000..6d88ef8
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0229]: associated type bindings are not allowed here
+  --> $DIR/E0229.rs:23:25
+   |
+23 | fn baz<I>(x: &<I as Foo<A=Bar>>::A) {}
+   |                         ^^^^^ associated type not allowed here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0232.rs b/src/test/ui/error-codes/E0232.rs
new file mode 100644 (file)
index 0000000..04657c6
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(on_unimplemented)]
+
+#[rustc_on_unimplemented]
+//~^ ERROR E0232
+trait Bar {}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0232.stderr b/src/test/ui/error-codes/E0232.stderr
new file mode 100644 (file)
index 0000000..e13ba62
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0232]: `#[rustc_on_unimplemented]` requires a value
+  --> $DIR/E0232.rs:13:1
+   |
+13 | #[rustc_on_unimplemented]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^ value required here
+   |
+   = note: eg `#[rustc_on_unimplemented = "foo"]`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0243.rs b/src/test/ui/error-codes/E0243.rs
new file mode 100644 (file)
index 0000000..615ce0b
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo<T> { x: T }
+struct Bar { x: Foo }
+                //~^ ERROR wrong number of type arguments: expected 1, found 0 [E0243]
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0243.stderr b/src/test/ui/error-codes/E0243.stderr
new file mode 100644 (file)
index 0000000..82a90ff
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0243]: wrong number of type arguments: expected 1, found 0
+  --> $DIR/E0243.rs:12:17
+   |
+12 | struct Bar { x: Foo }
+   |                 ^^^ expected 1 type argument
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0244.rs b/src/test/ui/error-codes/E0244.rs
new file mode 100644 (file)
index 0000000..9a78b31
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo { x: bool }
+struct Bar<S, T> { x: Foo<S, T> }
+                      //~^ ERROR wrong number of type arguments: expected 0, found 2 [E0244]
+
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0244.stderr b/src/test/ui/error-codes/E0244.stderr
new file mode 100644 (file)
index 0000000..d873fbe
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0244]: wrong number of type arguments: expected 0, found 2
+  --> $DIR/E0244.rs:12:23
+   |
+12 | struct Bar<S, T> { x: Foo<S, T> }
+   |                       ^^^^^^^^^ expected no type arguments
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0252.rs b/src/test/ui/error-codes/E0252.rs
new file mode 100644 (file)
index 0000000..6b353c8
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use foo::baz;
+use bar::baz; //~ ERROR E0252
+
+mod foo {
+    pub struct baz;
+}
+
+mod bar {
+    pub mod baz {}
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0252.stderr b/src/test/ui/error-codes/E0252.stderr
new file mode 100644 (file)
index 0000000..f63597d
--- /dev/null
@@ -0,0 +1,16 @@
+error[E0252]: the name `baz` is defined multiple times
+  --> $DIR/E0252.rs:12:5
+   |
+11 | use foo::baz;
+   |     -------- previous import of the type `baz` here
+12 | use bar::baz; //~ ERROR E0252
+   |     ^^^^^^^^ `baz` reimported here
+   |
+   = note: `baz` must be defined only once in the type namespace of this module
+help: You can use `as` to change the binding name of the import
+   |
+12 | use bar::baz as other_baz; //~ ERROR E0252
+   |     ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0253.rs b/src/test/ui/error-codes/E0253.rs
new file mode 100644 (file)
index 0000000..186d901
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod foo {
+    pub trait MyTrait {
+        fn do_something();
+    }
+}
+
+use foo::MyTrait::do_something;
+    //~^ ERROR E0253
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0253.stderr b/src/test/ui/error-codes/E0253.stderr
new file mode 100644 (file)
index 0000000..e5a3115
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0253]: `do_something` is not directly importable
+  --> $DIR/E0253.rs:17:5
+   |
+17 | use foo::MyTrait::do_something;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be imported directly
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0254.rs b/src/test/ui/error-codes/E0254.rs
new file mode 100644 (file)
index 0000000..46c74fe
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(alloc)]
+#![allow(unused_extern_crates)]
+
+extern crate alloc;
+
+mod foo {
+    pub trait alloc {
+        fn do_something();
+    }
+}
+
+use foo::alloc;
+//~^ ERROR E0254
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0254.stderr b/src/test/ui/error-codes/E0254.stderr
new file mode 100644 (file)
index 0000000..4181c7b
--- /dev/null
@@ -0,0 +1,17 @@
+error[E0254]: the name `alloc` is defined multiple times
+  --> $DIR/E0254.rs:22:5
+   |
+14 | extern crate alloc;
+   | ------------------- previous import of the extern crate `alloc` here
+...
+22 | use foo::alloc;
+   |     ^^^^^^^^^^ `alloc` reimported here
+   |
+   = note: `alloc` must be defined only once in the type namespace of this module
+help: You can use `as` to change the binding name of the import
+   |
+22 | use foo::alloc as other_alloc;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0255.rs b/src/test/ui/error-codes/E0255.rs
new file mode 100644 (file)
index 0000000..e05c6be
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use bar::foo;
+
+fn foo() {} //~ ERROR E0255
+
+mod bar {
+     pub fn foo() {}
+}
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0255.stderr b/src/test/ui/error-codes/E0255.stderr
new file mode 100644 (file)
index 0000000..924ac49
--- /dev/null
@@ -0,0 +1,17 @@
+error[E0255]: the name `foo` is defined multiple times
+  --> $DIR/E0255.rs:13:1
+   |
+11 | use bar::foo;
+   |     -------- previous import of the value `foo` here
+12 | 
+13 | fn foo() {} //~ ERROR E0255
+   | ^^^^^^^^ `foo` redefined here
+   |
+   = note: `foo` must be defined only once in the value namespace of this module
+help: You can use `as` to change the binding name of the import
+   |
+11 | use bar::foo as other_foo;
+   |     ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0259.rs b/src/test/ui/error-codes/E0259.rs
new file mode 100644 (file)
index 0000000..5a47541
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(alloc, libc)]
+#![allow(unused_extern_crates)]
+
+extern crate alloc;
+
+extern crate libc as alloc;
+//~^ ERROR E0259
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0259.stderr b/src/test/ui/error-codes/E0259.stderr
new file mode 100644 (file)
index 0000000..e05e4e1
--- /dev/null
@@ -0,0 +1,16 @@
+error[E0259]: the name `alloc` is defined multiple times
+  --> $DIR/E0259.rs:16:1
+   |
+14 | extern crate alloc;
+   | ------------------- previous import of the extern crate `alloc` here
+15 | 
+16 | extern crate libc as alloc;
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   | |
+   | `alloc` reimported here
+   | You can use `as` to change the binding name of the import
+   |
+   = note: `alloc` must be defined only once in the type namespace of this module
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0260.rs b/src/test/ui/error-codes/E0260.rs
new file mode 100644 (file)
index 0000000..1b01bb1
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(alloc)]
+#![allow(unused_extern_crates)]
+
+extern crate alloc;
+
+mod alloc {
+//~^ ERROR the name `alloc` is defined multiple times [E0260]
+    pub trait MyTrait {
+        fn do_something();
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0260.stderr b/src/test/ui/error-codes/E0260.stderr
new file mode 100644 (file)
index 0000000..3d899e6
--- /dev/null
@@ -0,0 +1,17 @@
+error[E0260]: the name `alloc` is defined multiple times
+  --> $DIR/E0260.rs:16:1
+   |
+14 | extern crate alloc;
+   | ------------------- previous import of the extern crate `alloc` here
+15 | 
+16 | mod alloc {
+   | ^^^^^^^^^ `alloc` redefined here
+   |
+   = note: `alloc` must be defined only once in the type namespace of this module
+help: You can use `as` to change the binding name of the import
+   |
+14 | extern crate alloc as other_alloc;
+   |
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0261.rs b/src/test/ui/error-codes/E0261.rs
new file mode 100644 (file)
index 0000000..558c1c3
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo(x: &'a str) { } //~ ERROR E0261
+                       //~| undeclared lifetime
+
+struct Foo {
+    x: &'a str, //~ ERROR E0261
+                //~| undeclared lifetime
+}
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0261.stderr b/src/test/ui/error-codes/E0261.stderr
new file mode 100644 (file)
index 0000000..c8dd082
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0261]: use of undeclared lifetime name `'a`
+  --> $DIR/E0261.rs:11:12
+   |
+11 | fn foo(x: &'a str) { } //~ ERROR E0261
+   |            ^^ undeclared lifetime
+
+error[E0261]: use of undeclared lifetime name `'a`
+  --> $DIR/E0261.rs:15:9
+   |
+15 |     x: &'a str, //~ ERROR E0261
+   |         ^^ undeclared lifetime
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0262.rs b/src/test/ui/error-codes/E0262.rs
new file mode 100644 (file)
index 0000000..41b6aca
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo<'static>(x: &'static str) { } //~ ERROR E0262
+                                     //~| 'static is a reserved lifetime name
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0262.stderr b/src/test/ui/error-codes/E0262.stderr
new file mode 100644 (file)
index 0000000..0910009
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0262]: invalid lifetime parameter name: `'static`
+  --> $DIR/E0262.rs:11:8
+   |
+11 | fn foo<'static>(x: &'static str) { } //~ ERROR E0262
+   |        ^^^^^^^ 'static is a reserved lifetime name
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0263.rs b/src/test/ui/error-codes/E0263.rs
new file mode 100644 (file)
index 0000000..722f1c2
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) {
+    //~^ ERROR E0263
+}
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0263.stderr b/src/test/ui/error-codes/E0263.stderr
new file mode 100644 (file)
index 0000000..942718d
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0263]: lifetime name `'a` declared twice in the same scope
+  --> $DIR/E0263.rs:11:16
+   |
+11 | fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) {
+   |        --      ^^ declared twice
+   |        |
+   |        previous declaration here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0264.rs b/src/test/ui/error-codes/E0264.rs
new file mode 100644 (file)
index 0000000..9233297
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(lang_items)]
+
+extern "C" {
+    #[lang = "cake"]
+    fn cake(); //~ ERROR E0264
+}
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0264.stderr b/src/test/ui/error-codes/E0264.stderr
new file mode 100644 (file)
index 0000000..b104946
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0264]: unknown external lang item: `cake`
+  --> $DIR/E0264.rs:15:5
+   |
+15 |     fn cake(); //~ ERROR E0264
+   |     ^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0267.rs b/src/test/ui/error-codes/E0267.rs
new file mode 100644 (file)
index 0000000..6287256
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let w = || { break; }; //~ ERROR E0267
+}
diff --git a/src/test/ui/error-codes/E0267.stderr b/src/test/ui/error-codes/E0267.stderr
new file mode 100644 (file)
index 0000000..2f6d9c7
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0267]: `break` inside of a closure
+  --> $DIR/E0267.rs:12:18
+   |
+12 |     let w = || { break; }; //~ ERROR E0267
+   |                  ^^^^^ cannot break inside of a closure
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0268.rs b/src/test/ui/error-codes/E0268.rs
new file mode 100644 (file)
index 0000000..41e88e2
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    break; //~ ERROR E0268
+}
diff --git a/src/test/ui/error-codes/E0268.stderr b/src/test/ui/error-codes/E0268.stderr
new file mode 100644 (file)
index 0000000..cf89e46
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0268]: `break` outside of loop
+  --> $DIR/E0268.rs:12:5
+   |
+12 |     break; //~ ERROR E0268
+   |     ^^^^^ cannot break outside of a loop
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0271.rs b/src/test/ui/error-codes/E0271.rs
new file mode 100644 (file)
index 0000000..d322c8b
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Trait { type AssociatedType; }
+
+fn foo<T>(t: T) where T: Trait<AssociatedType=u32> {
+    println!("in foo");
+}
+
+impl Trait for i8 { type AssociatedType = &'static str; }
+
+fn main() {
+    foo(3_i8); //~ ERROR E0271
+}
diff --git a/src/test/ui/error-codes/E0271.stderr b/src/test/ui/error-codes/E0271.stderr
new file mode 100644 (file)
index 0000000..c596b56
--- /dev/null
@@ -0,0 +1,16 @@
+error[E0271]: type mismatch resolving `<i8 as Trait>::AssociatedType == u32`
+  --> $DIR/E0271.rs:20:5
+   |
+20 |     foo(3_i8); //~ ERROR E0271
+   |     ^^^ expected reference, found u32
+   |
+   = note: expected type `&'static str`
+              found type `u32`
+note: required by `foo`
+  --> $DIR/E0271.rs:13:1
+   |
+13 | fn foo<T>(t: T) where T: Trait<AssociatedType=u32> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0275.rs b/src/test/ui/error-codes/E0275.rs
new file mode 100644 (file)
index 0000000..8dfd1d9
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Foo {}
+
+struct Bar<T>(T);
+
+impl<T> Foo for T where Bar<T>: Foo {} //~ ERROR E0275
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0275.stderr b/src/test/ui/error-codes/E0275.stderr
new file mode 100644 (file)
index 0000000..2dbe5be
--- /dev/null
@@ -0,0 +1,79 @@
+error[E0275]: overflow evaluating the requirement `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: std::marker::Sized`
+  --> $DIR/E0275.rs:15:1
+   |
+15 | impl<T> Foo for T where Bar<T>: Foo {} //~ ERROR E0275
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: consider adding a `#![recursion_limit="128"]` attribute to your crate
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<Bar<T>>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<Bar<T>>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<Bar<T>>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<Bar<T>>`
+   = note: required because of the requirements on the impl of `Foo` for `Bar<T>`
+note: required by `Foo`
+  --> $DIR/E0275.rs:11:1
+   |
+11 | trait Foo {}
+   | ^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0276.rs b/src/test/ui/error-codes/E0276.rs
new file mode 100644 (file)
index 0000000..62e43b0
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Foo {
+    fn foo<T>(x: T);
+}
+
+impl Foo for bool {
+    fn foo<T>(x: T) where T: Copy {} //~ ERROR E0276
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0276.stderr b/src/test/ui/error-codes/E0276.stderr
new file mode 100644 (file)
index 0000000..bcbe81a
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0276]: impl has stricter requirements than trait
+  --> $DIR/E0276.rs:16:5
+   |
+12 |     fn foo<T>(x: T);
+   |     ---------------- definition of `foo` from trait
+...
+16 |     fn foo<T>(x: T) where T: Copy {} //~ ERROR E0276
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: std::marker::Copy`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0277-2.rs b/src/test/ui/error-codes/E0277-2.rs
new file mode 100644 (file)
index 0000000..4d1c500
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo {
+    bar: Bar
+}
+
+struct Bar {
+    baz: Baz
+}
+
+struct Baz {
+    x: *const u8
+}
+
+fn is_send<T: Send>() { }
+
+fn main() {
+    is_send::<Foo>();
+    //~^ ERROR the trait bound `*const u8: std::marker::Send` is not satisfied in `Foo`
+}
diff --git a/src/test/ui/error-codes/E0277-2.stderr b/src/test/ui/error-codes/E0277-2.stderr
new file mode 100644 (file)
index 0000000..6a0f21e
--- /dev/null
@@ -0,0 +1,18 @@
+error[E0277]: the trait bound `*const u8: std::marker::Send` is not satisfied in `Foo`
+  --> $DIR/E0277-2.rs:26:5
+   |
+26 |     is_send::<Foo>();
+   |     ^^^^^^^^^^^^^^ `*const u8` cannot be sent between threads safely
+   |
+   = help: within `Foo`, the trait `std::marker::Send` is not implemented for `*const u8`
+   = note: required because it appears within the type `Baz`
+   = note: required because it appears within the type `Bar`
+   = note: required because it appears within the type `Foo`
+note: required by `is_send`
+  --> $DIR/E0277-2.rs:23:1
+   |
+23 | fn is_send<T: Send>() { }
+   | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0277.rs b/src/test/ui/error-codes/E0277.rs
new file mode 100644 (file)
index 0000000..b29e435
--- /dev/null
@@ -0,0 +1,29 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-cloudabi no std::path
+
+use std::path::Path;
+
+trait Foo {
+    fn bar(&self);
+}
+
+fn some_func<T: Foo>(foo: T) {
+    foo.bar();
+}
+
+fn f(p: Path) { }
+//~^ ERROR the trait bound `[u8]: std::marker::Sized` is not satisfied in `std::path::Path`
+
+fn main() {
+    some_func(5i32);
+    //~^ ERROR the trait bound `i32: Foo` is not satisfied
+}
diff --git a/src/test/ui/error-codes/E0277.stderr b/src/test/ui/error-codes/E0277.stderr
new file mode 100644 (file)
index 0000000..38d14ed
--- /dev/null
@@ -0,0 +1,24 @@
+error[E0277]: the trait bound `[u8]: std::marker::Sized` is not satisfied in `std::path::Path`
+  --> $DIR/E0277.rs:23:6
+   |
+23 | fn f(p: Path) { }
+   |      ^ `[u8]` does not have a constant size known at compile-time
+   |
+   = help: within `std::path::Path`, the trait `std::marker::Sized` is not implemented for `[u8]`
+   = note: required because it appears within the type `std::path::Path`
+   = note: all local variables must have a statically known size
+
+error[E0277]: the trait bound `i32: Foo` is not satisfied
+  --> $DIR/E0277.rs:27:5
+   |
+27 |     some_func(5i32);
+   |     ^^^^^^^^^ the trait `Foo` is not implemented for `i32`
+   |
+note: required by `some_func`
+  --> $DIR/E0277.rs:19:1
+   |
+19 | fn some_func<T: Foo>(foo: T) {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0282.rs b/src/test/ui/error-codes/E0282.rs
new file mode 100644 (file)
index 0000000..dfc7026
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let x = "hello".chars().rev().collect(); //~ ERROR E0282
+}
diff --git a/src/test/ui/error-codes/E0282.stderr b/src/test/ui/error-codes/E0282.stderr
new file mode 100644 (file)
index 0000000..8351627
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0282]: type annotations needed
+  --> $DIR/E0282.rs:12:9
+   |
+12 |     let x = "hello".chars().rev().collect(); //~ ERROR E0282
+   |         ^
+   |         |
+   |         cannot infer type for `_`
+   |         consider giving `x` a type
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0283.rs b/src/test/ui/error-codes/E0283.rs
new file mode 100644 (file)
index 0000000..844c47f
--- /dev/null
@@ -0,0 +1,29 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Generator {
+    fn create() -> u32;
+}
+
+struct Impl;
+
+impl Generator for Impl {
+    fn create() -> u32 { 1 }
+}
+
+struct AnotherImpl;
+
+impl Generator for AnotherImpl {
+    fn create() -> u32 { 2 }
+}
+
+fn main() {
+    let cont: u32 = Generator::create(); //~ ERROR E0283
+}
diff --git a/src/test/ui/error-codes/E0283.stderr b/src/test/ui/error-codes/E0283.stderr
new file mode 100644 (file)
index 0000000..9fdb6b1
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0283]: type annotations required: cannot resolve `_: Generator`
+  --> $DIR/E0283.rs:28:21
+   |
+28 |     let cont: u32 = Generator::create(); //~ ERROR E0283
+   |                     ^^^^^^^^^^^^^^^^^
+   |
+note: required by `Generator::create`
+  --> $DIR/E0283.rs:12:5
+   |
+12 |     fn create() -> u32;
+   |     ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0296.rs b/src/test/ui/error-codes/E0296.rs
new file mode 100644 (file)
index 0000000..562fd00
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![recursion_limit] //~ ERROR E0296
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0296.stderr b/src/test/ui/error-codes/E0296.stderr
new file mode 100644 (file)
index 0000000..f6a2adc
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0296]: malformed recursion limit attribute, expected #![recursion_limit="N"]
+  --> $DIR/E0296.rs:11:1
+   |
+11 | #![recursion_limit] //~ ERROR E0296
+   | ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0297.rs b/src/test/ui/error-codes/E0297.rs
new file mode 100644 (file)
index 0000000..afe4444
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let xs : Vec<Option<i32>> = vec![Some(1), None];
+
+    for Some(x) in xs {}
+    //~^ ERROR E0005
+}
diff --git a/src/test/ui/error-codes/E0297.stderr b/src/test/ui/error-codes/E0297.stderr
new file mode 100644 (file)
index 0000000..2dfed66
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0005]: refutable pattern in `for` loop binding: `None` not covered
+  --> $DIR/E0297.rs:14:9
+   |
+14 |     for Some(x) in xs {}
+   |         ^^^^^^^ pattern `None` not covered
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0301.rs b/src/test/ui/error-codes/E0301.rs
new file mode 100644 (file)
index 0000000..06e9828
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    match Some(()) {
+        None => { },
+        option if option.take().is_none() => {}, //~ ERROR E0301
+        Some(_) => { }
+    }
+}
diff --git a/src/test/ui/error-codes/E0301.stderr b/src/test/ui/error-codes/E0301.stderr
new file mode 100644 (file)
index 0000000..ff4ee32
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0301]: cannot mutably borrow in a pattern guard
+  --> $DIR/E0301.rs:14:19
+   |
+14 |         option if option.take().is_none() => {}, //~ ERROR E0301
+   |                   ^^^^^^ borrowed mutably in pattern guard
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0302.rs b/src/test/ui/error-codes/E0302.rs
new file mode 100644 (file)
index 0000000..6a5ad40
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    match Some(()) {
+        None => { },
+        option if { option = None; false } => { }, //~ ERROR E0302
+        Some(_) => { }
+    }
+}
diff --git a/src/test/ui/error-codes/E0302.stderr b/src/test/ui/error-codes/E0302.stderr
new file mode 100644 (file)
index 0000000..c7b33a4
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0302]: cannot assign in a pattern guard
+  --> $DIR/E0302.rs:14:21
+   |
+14 |         option if { option = None; false } => { }, //~ ERROR E0302
+   |                     ^^^^^^^^^^^^^ assignment in pattern guard
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0303.rs b/src/test/ui/error-codes/E0303.rs
new file mode 100644 (file)
index 0000000..6027414
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    match Some("hi".to_string()) {
+        ref op_string_ref @ Some(s) => {},
+        //~^ ERROR pattern bindings are not allowed after an `@` [E0303]
+        //~| ERROR E0009
+        None => {},
+    }
+}
diff --git a/src/test/ui/error-codes/E0303.stderr b/src/test/ui/error-codes/E0303.stderr
new file mode 100644 (file)
index 0000000..6528c97
--- /dev/null
@@ -0,0 +1,17 @@
+error[E0009]: cannot bind by-move and by-ref in the same pattern
+  --> $DIR/E0303.rs:13:34
+   |
+13 |         ref op_string_ref @ Some(s) => {},
+   |         -------------------------^-
+   |         |                        |
+   |         |                        by-move pattern here
+   |         both by-ref and by-move used
+
+error[E0303]: pattern bindings are not allowed after an `@`
+  --> $DIR/E0303.rs:13:34
+   |
+13 |         ref op_string_ref @ Some(s) => {},
+   |                                  ^ not allowed after `@`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0308-4.rs b/src/test/ui/error-codes/E0308-4.rs
new file mode 100644 (file)
index 0000000..bb4cd14
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let x = 1u8;
+    match x {
+        0u8...3i8 => (), //~ ERROR E0308
+        _ => ()
+    }
+}
diff --git a/src/test/ui/error-codes/E0308-4.stderr b/src/test/ui/error-codes/E0308-4.stderr
new file mode 100644 (file)
index 0000000..1e4beea
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0308]: mismatched types
+  --> $DIR/E0308-4.rs:14:9
+   |
+14 |         0u8...3i8 => (), //~ ERROR E0308
+   |         ^^^^^^^^^ expected u8, found i8
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0308.rs b/src/test/ui/error-codes/E0308.rs
new file mode 100644 (file)
index 0000000..078f1d3
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(intrinsics)]
+
+extern "rust-intrinsic" {
+    fn size_of<T>(); //~ ERROR E0308
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0308.stderr b/src/test/ui/error-codes/E0308.stderr
new file mode 100644 (file)
index 0000000..905b021
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0308]: intrinsic has wrong type
+  --> $DIR/E0308.rs:14:5
+   |
+14 |     fn size_of<T>(); //~ ERROR E0308
+   |     ^^^^^^^^^^^^^^^^ expected (), found usize
+   |
+   = note: expected type `unsafe extern "rust-intrinsic" fn()`
+              found type `unsafe extern "rust-intrinsic" fn() -> usize`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0365.rs b/src/test/ui/error-codes/E0365.rs
new file mode 100644 (file)
index 0000000..18a72b0
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod foo {
+    pub const X: u32 = 1;
+}
+
+pub use foo as foo2;
+//~^ ERROR `foo` is private, and cannot be re-exported [E0365]
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0365.stderr b/src/test/ui/error-codes/E0365.stderr
new file mode 100644 (file)
index 0000000..ccb1385
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0365]: `foo` is private, and cannot be re-exported
+  --> $DIR/E0365.rs:15:9
+   |
+15 | pub use foo as foo2;
+   |         ^^^^^^^^^^^ re-export of private `foo`
+   |
+   = note: consider declaring type or module `foo` with `pub`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0370.rs b/src/test/ui/error-codes/E0370.rs
new file mode 100644 (file)
index 0000000..cafe26c
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(dead_code)]
+
+#[deny(overflowing_literals)]
+#[repr(i64)]
+enum Foo {
+    X = 0x7fffffffffffffff,
+    Y, //~ ERROR E0370
+}
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0370.stderr b/src/test/ui/error-codes/E0370.stderr
new file mode 100644 (file)
index 0000000..1f248f4
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0370]: enum discriminant overflowed
+  --> $DIR/E0370.rs:17:5
+   |
+17 |     Y, //~ ERROR E0370
+   |     ^ overflowed on value after 9223372036854775807i64
+   |
+   = note: explicitly set `Y = -9223372036854775808i64` if that is desired outcome
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0374.rs b/src/test/ui/error-codes/E0374.rs
new file mode 100644 (file)
index 0000000..6c4782d
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(coerce_unsized)]
+use std::ops::CoerceUnsized;
+
+struct Foo<T: ?Sized> {
+    a: i32,
+}
+
+impl<T, U> CoerceUnsized<Foo<U>> for Foo<T> //~ ERROR E0374
+    where T: CoerceUnsized<U> {}
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0374.stderr b/src/test/ui/error-codes/E0374.stderr
new file mode 100644 (file)
index 0000000..edd463d
--- /dev/null
@@ -0,0 +1,9 @@
+error[E0374]: the trait `CoerceUnsized` may only be implemented for a coercion between structures with one field being coerced, none found
+  --> $DIR/E0374.rs:18:1
+   |
+18 | / impl<T, U> CoerceUnsized<Foo<U>> for Foo<T> //~ ERROR E0374
+19 | |     where T: CoerceUnsized<U> {}
+   | |________________________________^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0375.rs b/src/test/ui/error-codes/E0375.rs
new file mode 100644 (file)
index 0000000..094ed35
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-tidy-linelength
+
+#![feature(coerce_unsized)]
+use std::ops::CoerceUnsized;
+
+struct Foo<T: ?Sized, U: ?Sized> {
+    a: i32,
+    b: T,
+    c: U,
+}
+
+impl<T, U> CoerceUnsized<Foo<U, T>> for Foo<T, U> {}
+//~^ ERROR E0375
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0375.stderr b/src/test/ui/error-codes/E0375.stderr
new file mode 100644 (file)
index 0000000..a375915
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0375]: implementing the trait `CoerceUnsized` requires multiple coercions
+  --> $DIR/E0375.rs:22:12
+   |
+22 | impl<T, U> CoerceUnsized<Foo<U, T>> for Foo<T, U> {}
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^ requires multiple coercions
+   |
+   = note: `CoerceUnsized` may only be implemented for a coercion between structures with one field being coerced
+   = note: currently, 2 fields need coercions: b (T to U), c (U to T)
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0376.rs b/src/test/ui/error-codes/E0376.rs
new file mode 100644 (file)
index 0000000..65be358
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(coerce_unsized)]
+use std::ops::CoerceUnsized;
+
+struct Foo<T: ?Sized> {
+    a: T,
+}
+
+impl<T, U> CoerceUnsized<U> for Foo<T> {} //~ ERROR E0376
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0376.stderr b/src/test/ui/error-codes/E0376.stderr
new file mode 100644 (file)
index 0000000..d036adb
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0376]: the trait `CoerceUnsized` may only be implemented for a coercion between structures
+  --> $DIR/E0376.rs:18:1
+   |
+18 | impl<T, U> CoerceUnsized<U> for Foo<T> {} //~ ERROR E0376
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0388.rs b/src/test/ui/error-codes/E0388.rs
new file mode 100644 (file)
index 0000000..c002bad
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+static X: i32 = 1;
+const C: i32 = 2;
+
+const CR: &'static mut i32 = &mut C; //~ ERROR E0017
+static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
+                                              //~| ERROR cannot borrow
+static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0388.stderr b/src/test/ui/error-codes/E0388.stderr
new file mode 100644 (file)
index 0000000..ec21029
--- /dev/null
@@ -0,0 +1,26 @@
+error[E0017]: references in constants may only refer to immutable values
+  --> $DIR/E0388.rs:14:30
+   |
+14 | const CR: &'static mut i32 = &mut C; //~ ERROR E0017
+   |                              ^^^^^^ constants require immutable values
+
+error[E0017]: references in statics may only refer to immutable values
+  --> $DIR/E0388.rs:15:39
+   |
+15 | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
+   |                                       ^^^^^^ statics require immutable values
+
+error[E0596]: cannot borrow immutable static item as mutable
+  --> $DIR/E0388.rs:15:44
+   |
+15 | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
+   |                                            ^
+
+error[E0017]: references in statics may only refer to immutable values
+  --> $DIR/E0388.rs:17:38
+   |
+17 | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017
+   |                                      ^^^^^^ statics require immutable values
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/error-codes/E0389.rs b/src/test/ui/error-codes/E0389.rs
new file mode 100644 (file)
index 0000000..445831b
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct FancyNum {
+    num: u8,
+}
+
+fn main() {
+    let mut fancy = FancyNum{ num: 5 };
+    let fancy_ref = &(&mut fancy);
+    fancy_ref.num = 6; //~ ERROR E0389
+    println!("{}", fancy_ref.num);
+}
diff --git a/src/test/ui/error-codes/E0389.stderr b/src/test/ui/error-codes/E0389.stderr
new file mode 100644 (file)
index 0000000..e085329
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0389]: cannot assign to data in a `&` reference
+  --> $DIR/E0389.rs:18:5
+   |
+18 |     fancy_ref.num = 6; //~ ERROR E0389
+   |     ^^^^^^^^^^^^^^^^^ assignment into an immutable reference
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0390.rs b/src/test/ui/error-codes/E0390.rs
new file mode 100644 (file)
index 0000000..cd530db
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo {
+    x: i32
+}
+
+impl *mut Foo {} //~ ERROR E0390
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0390.stderr b/src/test/ui/error-codes/E0390.stderr
new file mode 100644 (file)
index 0000000..a10b0b8
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0390]: only a single inherent implementation marked with `#[lang = "mut_ptr"]` is allowed for the `*mut T` primitive
+  --> $DIR/E0390.rs:15:1
+   |
+15 | impl *mut Foo {} //~ ERROR E0390
+   | ^^^^^^^^^^^^^^^^
+   |
+help: consider using a trait to implement these methods
+  --> $DIR/E0390.rs:15:1
+   |
+15 | impl *mut Foo {} //~ ERROR E0390
+   | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0392.rs b/src/test/ui/error-codes/E0392.rs
new file mode 100644 (file)
index 0000000..4c3efcf
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum Foo<T> { Bar } //~ ERROR E0392
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0392.stderr b/src/test/ui/error-codes/E0392.stderr
new file mode 100644 (file)
index 0000000..6c466cb
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0392]: parameter `T` is never used
+  --> $DIR/E0392.rs:11:10
+   |
+11 | enum Foo<T> { Bar } //~ ERROR E0392
+   |          ^ unused type parameter
+   |
+   = help: consider removing `T` or using a marker such as `std::marker::PhantomData`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0393.rs b/src/test/ui/error-codes/E0393.rs
new file mode 100644 (file)
index 0000000..9165bc2
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait A<T=Self> {}
+
+fn together_we_will_rule_the_galaxy(son: &A) {}
+//~^ ERROR E0393
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0393.stderr b/src/test/ui/error-codes/E0393.stderr
new file mode 100644 (file)
index 0000000..10728e2
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0393]: the type parameter `T` must be explicitly specified
+  --> $DIR/E0393.rs:13:43
+   |
+13 | fn together_we_will_rule_the_galaxy(son: &A) {}
+   |                                           ^ missing reference to `T`
+   |
+   = note: because of the default `Self` reference, type parameters must be specified on object types
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0394.rs b/src/test/ui/error-codes/E0394.rs
new file mode 100644 (file)
index 0000000..dae8e14
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(warnings)]
+
+static A: u32 = 0;
+static B: u32 = A;
+//~^ ERROR E0394
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0394.stderr b/src/test/ui/error-codes/E0394.stderr
new file mode 100644 (file)
index 0000000..728cec1
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0394]: cannot refer to other statics by value, use the address-of operator or a constant instead
+  --> $DIR/E0394.rs:14:17
+   |
+14 | static B: u32 = A;
+   |                 ^ referring to another static by value
+   |
+   = note: use the address-of operator or a constant instead
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0395.rs b/src/test/ui/error-codes/E0395.rs
new file mode 100644 (file)
index 0000000..00008ea
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+static FOO: i32 = 42;
+static BAR: i32 = 42;
+
+static BAZ: bool = { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR E0395
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0395.stderr b/src/test/ui/error-codes/E0395.stderr
new file mode 100644 (file)
index 0000000..e6d76a6
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0395]: raw pointers cannot be compared in statics
+  --> $DIR/E0395.rs:14:22
+   |
+14 | static BAZ: bool = { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR E0395
+   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comparing raw pointers in static
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0396.rs b/src/test/ui/error-codes/E0396.rs
new file mode 100644 (file)
index 0000000..7f34acd
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+const REG_ADDR: *const u8 = 0x5f3759df as *const u8;
+
+const VALUE: u8 = unsafe { *REG_ADDR }; //~ ERROR E0396
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0396.stderr b/src/test/ui/error-codes/E0396.stderr
new file mode 100644 (file)
index 0000000..5c5c01c
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0396]: raw pointers cannot be dereferenced in constants
+  --> $DIR/E0396.rs:13:28
+   |
+13 | const VALUE: u8 = unsafe { *REG_ADDR }; //~ ERROR E0396
+   |                            ^^^^^^^^^ dereference of raw pointer in constant
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0401.rs b/src/test/ui/error-codes/E0401.rs
new file mode 100644 (file)
index 0000000..09bc950
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo<T>(x: T) {
+    fn bar(y: T) { //~ ERROR E0401
+    }
+    bar(x);
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0401.stderr b/src/test/ui/error-codes/E0401.stderr
new file mode 100644 (file)
index 0000000..d63aa37
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0401]: can't use type parameters from outer function; try using a local type parameter instead
+  --> $DIR/E0401.rs:12:15
+   |
+12 |     fn bar(y: T) { //~ ERROR E0401
+   |               ^ use of type variable from outer function
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0403.rs b/src/test/ui/error-codes/E0403.rs
new file mode 100644 (file)
index 0000000..6a68013
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo<T, T>(s: T, u: T) {} //~ ERROR E0403
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0403.stderr b/src/test/ui/error-codes/E0403.stderr
new file mode 100644 (file)
index 0000000..125af35
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0403]: the name `T` is already used for a type parameter in this type parameter list
+  --> $DIR/E0403.rs:11:11
+   |
+11 | fn foo<T, T>(s: T, u: T) {} //~ ERROR E0403
+   |        -  ^ already used
+   |        |
+   |        first use of `T`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0404.rs b/src/test/ui/error-codes/E0404.rs
new file mode 100644 (file)
index 0000000..1c088a7
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo;
+struct Bar;
+
+impl Foo for Bar {} //~ ERROR E0404
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0404.stderr b/src/test/ui/error-codes/E0404.stderr
new file mode 100644 (file)
index 0000000..c30d8c0
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0404]: expected trait, found struct `Foo`
+  --> $DIR/E0404.rs:14:6
+   |
+14 | impl Foo for Bar {} //~ ERROR E0404
+   |      ^^^ not a trait
+
+error: cannot continue compilation due to previous error
+
diff --git a/src/test/ui/error-codes/E0405.rs b/src/test/ui/error-codes/E0405.rs
new file mode 100644 (file)
index 0000000..45d4b21
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo;
+
+impl SomeTrait for Foo {} //~ ERROR E0405
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0405.stderr b/src/test/ui/error-codes/E0405.stderr
new file mode 100644 (file)
index 0000000..29bab3f
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0405]: cannot find trait `SomeTrait` in this scope
+  --> $DIR/E0405.rs:13:6
+   |
+13 | impl SomeTrait for Foo {} //~ ERROR E0405
+   |      ^^^^^^^^^ not found in this scope
+
+error: cannot continue compilation due to previous error
+
diff --git a/src/test/ui/error-codes/E0407.rs b/src/test/ui/error-codes/E0407.rs
new file mode 100644 (file)
index 0000000..41d8b45
--- /dev/null
@@ -0,0 +1,24 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Foo {
+    fn a();
+}
+
+struct Bar;
+
+impl Foo for Bar {
+    fn a() {}
+    fn b() {}
+    //~^ ERROR E0407
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0407.stderr b/src/test/ui/error-codes/E0407.stderr
new file mode 100644 (file)
index 0000000..f71437c
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0407]: method `b` is not a member of trait `Foo`
+  --> $DIR/E0407.rs:19:5
+   |
+19 |     fn b() {}
+   |     ^^^^^^^^^ not a member of trait `Foo`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0408.rs b/src/test/ui/error-codes/E0408.rs
new file mode 100644 (file)
index 0000000..8ddeb20
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let x = Some(0);
+
+    match x {
+        Some(y) | None => {} //~  ERROR variable `y` is not bound in all patterns
+        _ => ()
+    }
+}
diff --git a/src/test/ui/error-codes/E0408.stderr b/src/test/ui/error-codes/E0408.stderr
new file mode 100644 (file)
index 0000000..1c66bb0
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0408]: variable `y` is not bound in all patterns
+  --> $DIR/E0408.rs:15:19
+   |
+15 |         Some(y) | None => {} //~  ERROR variable `y` is not bound in all patterns
+   |              -    ^^^^ pattern doesn't bind `y`
+   |              |
+   |              variable not in all patterns
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0411.rs b/src/test/ui/error-codes/E0411.rs
new file mode 100644 (file)
index 0000000..187986f
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    <Self>::foo; //~ ERROR E0411
+}
diff --git a/src/test/ui/error-codes/E0411.stderr b/src/test/ui/error-codes/E0411.stderr
new file mode 100644 (file)
index 0000000..dda922b
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0411]: cannot find type `Self` in this scope
+  --> $DIR/E0411.rs:12:6
+   |
+12 |     <Self>::foo; //~ ERROR E0411
+   |      ^^^^ `Self` is only available in traits and impls
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0412.rs b/src/test/ui/error-codes/E0412.rs
new file mode 100644 (file)
index 0000000..f62901c
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+impl Something {} //~ ERROR E0412
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0412.stderr b/src/test/ui/error-codes/E0412.stderr
new file mode 100644 (file)
index 0000000..6ee2125
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0412]: cannot find type `Something` in this scope
+  --> $DIR/E0412.rs:11:6
+   |
+11 | impl Something {} //~ ERROR E0412
+   |      ^^^^^^^^^ not found in this scope
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0415.rs b/src/test/ui/error-codes/E0415.rs
new file mode 100644 (file)
index 0000000..2a5f0d3
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo(f: i32, f: i32) {} //~ ERROR E0415
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0415.stderr b/src/test/ui/error-codes/E0415.stderr
new file mode 100644 (file)
index 0000000..5e5cfe1
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0415]: identifier `f` is bound more than once in this parameter list
+  --> $DIR/E0415.rs:11:16
+   |
+11 | fn foo(f: i32, f: i32) {} //~ ERROR E0415
+   |                ^ used as parameter more than once
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0416.rs b/src/test/ui/error-codes/E0416.rs
new file mode 100644 (file)
index 0000000..91077ab
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    match (1, 2) {
+        (x, x) => {} //~ ERROR E0416
+    }
+}
diff --git a/src/test/ui/error-codes/E0416.stderr b/src/test/ui/error-codes/E0416.stderr
new file mode 100644 (file)
index 0000000..a48a3ad
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0416]: identifier `x` is bound more than once in the same pattern
+  --> $DIR/E0416.rs:13:13
+   |
+13 |         (x, x) => {} //~ ERROR E0416
+   |             ^ used in a pattern more than once
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0423.rs b/src/test/ui/error-codes/E0423.rs
new file mode 100644 (file)
index 0000000..f5fea77
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main () {
+    struct Foo { a: bool };
+
+    let f = Foo(); //~ ERROR E0423
+}
diff --git a/src/test/ui/error-codes/E0423.stderr b/src/test/ui/error-codes/E0423.stderr
new file mode 100644 (file)
index 0000000..aee398e
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0423]: expected function, found struct `Foo`
+  --> $DIR/E0423.rs:14:13
+   |
+14 |     let f = Foo(); //~ ERROR E0423
+   |             ^^^ did you mean `Foo { /* fields */ }`?
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0424.rs b/src/test/ui/error-codes/E0424.rs
new file mode 100644 (file)
index 0000000..445d0c5
--- /dev/null
@@ -0,0 +1,22 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo;
+
+impl Foo {
+    fn bar(self) {}
+
+    fn foo() {
+        self.bar(); //~ ERROR E0424
+    }
+}
+
+fn main () {
+}
diff --git a/src/test/ui/error-codes/E0424.stderr b/src/test/ui/error-codes/E0424.stderr
new file mode 100644 (file)
index 0000000..d1fd432
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0424]: expected value, found module `self`
+  --> $DIR/E0424.rs:17:9
+   |
+17 |         self.bar(); //~ ERROR E0424
+   |         ^^^^ `self` value is only available in methods with `self` parameter
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0425.rs b/src/test/ui/error-codes/E0425.rs
new file mode 100644 (file)
index 0000000..3786282
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Foo {
+    fn bar() {
+        elf; //~ ERROR E0425
+    }
+}
+
+fn main () {
+}
diff --git a/src/test/ui/error-codes/E0425.stderr b/src/test/ui/error-codes/E0425.stderr
new file mode 100644 (file)
index 0000000..250ecae
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0425]: cannot find value `elf` in this scope
+  --> $DIR/E0425.rs:13:9
+   |
+13 |         elf; //~ ERROR E0425
+   |         ^^^ not found in this scope
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0426.rs b/src/test/ui/error-codes/E0426.rs
new file mode 100644 (file)
index 0000000..d6261d3
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main () {
+    loop {
+        break 'a;
+        //~^ ERROR E0426
+    }
+}
diff --git a/src/test/ui/error-codes/E0426.stderr b/src/test/ui/error-codes/E0426.stderr
new file mode 100644 (file)
index 0000000..bb05eff
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0426]: use of undeclared label `'a`
+  --> $DIR/E0426.rs:13:15
+   |
+13 |         break 'a;
+   |               ^^ undeclared label `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0428.rs b/src/test/ui/error-codes/E0428.rs
new file mode 100644 (file)
index 0000000..3c709f3
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Bar; //~ previous definition of the type `Bar` here
+struct Bar; //~ ERROR E0428
+
+fn main () {
+}
diff --git a/src/test/ui/error-codes/E0428.stderr b/src/test/ui/error-codes/E0428.stderr
new file mode 100644 (file)
index 0000000..c739536
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0428]: the name `Bar` is defined multiple times
+  --> $DIR/E0428.rs:12:1
+   |
+11 | struct Bar; //~ previous definition of the type `Bar` here
+   | ----------- previous definition of the type `Bar` here
+12 | struct Bar; //~ ERROR E0428
+   | ^^^^^^^^^^^ `Bar` redefined here
+   |
+   = note: `Bar` must be defined only once in the type namespace of this module
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0429.rs b/src/test/ui/error-codes/E0429.rs
new file mode 100644 (file)
index 0000000..f1cad20
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::fmt::self; //~ ERROR E0429
+
+fn main () {
+}
diff --git a/src/test/ui/error-codes/E0429.stderr b/src/test/ui/error-codes/E0429.stderr
new file mode 100644 (file)
index 0000000..96cf505
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0429]: `self` imports are only allowed within a { } list
+  --> $DIR/E0429.rs:11:5
+   |
+11 | use std::fmt::self; //~ ERROR E0429
+   |     ^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0430.rs b/src/test/ui/error-codes/E0430.rs
new file mode 100644 (file)
index 0000000..992876d
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::fmt::{self, self}; //~ ERROR E0430
+                            //~^ ERROR E0252
+
+fn main () {
+}
diff --git a/src/test/ui/error-codes/E0430.stderr b/src/test/ui/error-codes/E0430.stderr
new file mode 100644 (file)
index 0000000..b5c80aa
--- /dev/null
@@ -0,0 +1,24 @@
+error[E0430]: `self` import can only appear once in an import list
+  --> $DIR/E0430.rs:11:16
+   |
+11 | use std::fmt::{self, self}; //~ ERROR E0430
+   |                ^^^^  ---- another `self` import appears here
+   |                |
+   |                can only appear once in an import list
+
+error[E0252]: the name `fmt` is defined multiple times
+  --> $DIR/E0430.rs:11:22
+   |
+11 | use std::fmt::{self, self}; //~ ERROR E0430
+   |                ----  ^^^^ `fmt` reimported here
+   |                |
+   |                previous import of the module `fmt` here
+   |
+   = note: `fmt` must be defined only once in the type namespace of this module
+help: You can use `as` to change the binding name of the import
+   |
+11 | use std::fmt::{self, self as other_fmt}; //~ ERROR E0430
+   |                      ^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0431.rs b/src/test/ui/error-codes/E0431.rs
new file mode 100644 (file)
index 0000000..09ddc1e
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use {self}; //~ ERROR E0431
+
+fn main () {
+}
diff --git a/src/test/ui/error-codes/E0431.stderr b/src/test/ui/error-codes/E0431.stderr
new file mode 100644 (file)
index 0000000..c7a786b
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0431]: `self` import can only appear in an import list with a non-empty prefix
+  --> $DIR/E0431.rs:11:6
+   |
+11 | use {self}; //~ ERROR E0431
+   |      ^^^^ can only appear in an import list with a non-empty prefix
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0432.rs b/src/test/ui/error-codes/E0432.rs
new file mode 100644 (file)
index 0000000..08d699e
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use something::Foo; //~ ERROR E0432
+
+fn main () {
+}
diff --git a/src/test/ui/error-codes/E0432.stderr b/src/test/ui/error-codes/E0432.stderr
new file mode 100644 (file)
index 0000000..6d808f0
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0432]: unresolved import `something`
+  --> $DIR/E0432.rs:11:5
+   |
+11 | use something::Foo; //~ ERROR E0432
+   |     ^^^^^^^^^ Maybe a missing `extern crate something;`?
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0433.rs b/src/test/ui/error-codes/E0433.rs
new file mode 100644 (file)
index 0000000..916d622
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main () {
+    let map = HashMap::new(); //~ ERROR E0433
+}
diff --git a/src/test/ui/error-codes/E0433.stderr b/src/test/ui/error-codes/E0433.stderr
new file mode 100644 (file)
index 0000000..691c592
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0433]: failed to resolve. Use of undeclared type or module `HashMap`
+  --> $DIR/E0433.rs:12:15
+   |
+12 |     let map = HashMap::new(); //~ ERROR E0433
+   |               ^^^^^^^ Use of undeclared type or module `HashMap`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0434.rs b/src/test/ui/error-codes/E0434.rs
new file mode 100644 (file)
index 0000000..747d9f7
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo() {
+    let y = 5;
+    fn bar() -> u32 {
+        y //~ ERROR E0434
+    }
+}
+
+fn main () {
+}
diff --git a/src/test/ui/error-codes/E0434.stderr b/src/test/ui/error-codes/E0434.stderr
new file mode 100644 (file)
index 0000000..06880ac
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0434]: can't capture dynamic environment in a fn item
+  --> $DIR/E0434.rs:14:9
+   |
+14 |         y //~ ERROR E0434
+   |         ^
+   |
+   = help: use the `|| { ... }` closure form instead
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0435.rs b/src/test/ui/error-codes/E0435.rs
new file mode 100644 (file)
index 0000000..5246fda
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main () {
+    let foo = 42u32;
+    let _: [u8; foo]; //~ ERROR E0435
+}
diff --git a/src/test/ui/error-codes/E0435.stderr b/src/test/ui/error-codes/E0435.stderr
new file mode 100644 (file)
index 0000000..855903b
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0435]: attempt to use a non-constant value in a constant
+  --> $DIR/E0435.rs:13:17
+   |
+13 |     let _: [u8; foo]; //~ ERROR E0435
+   |                 ^^^ non-constant value
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0437.rs b/src/test/ui/error-codes/E0437.rs
new file mode 100644 (file)
index 0000000..7440a82
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Foo {}
+
+impl Foo for i32 {
+    type Bar = bool; //~ ERROR E0437
+}
+
+fn main () {
+}
diff --git a/src/test/ui/error-codes/E0437.stderr b/src/test/ui/error-codes/E0437.stderr
new file mode 100644 (file)
index 0000000..ffad571
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0437]: type `Bar` is not a member of trait `Foo`
+  --> $DIR/E0437.rs:14:5
+   |
+14 |     type Bar = bool; //~ ERROR E0437
+   |     ^^^^^^^^^^^^^^^^ not a member of trait `Foo`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0438.rs b/src/test/ui/error-codes/E0438.rs
new file mode 100644 (file)
index 0000000..61d2513
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+
+trait Bar {}
+
+impl Bar for i32 {
+    const BAR: bool = true; //~ ERROR E0438
+}
+
+fn main () {
+}
diff --git a/src/test/ui/error-codes/E0438.stderr b/src/test/ui/error-codes/E0438.stderr
new file mode 100644 (file)
index 0000000..df58739
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0438]: const `BAR` is not a member of trait `Bar`
+  --> $DIR/E0438.rs:15:5
+   |
+15 |     const BAR: bool = true; //~ ERROR E0438
+   |     ^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `Bar`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0439.rs b/src/test/ui/error-codes/E0439.rs
new file mode 100644 (file)
index 0000000..5244343
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(platform_intrinsics)]
+
+extern "platform-intrinsic" {
+    fn simd_shuffle<A,B>(a: A, b: A, c: [u32; 8]) -> B; //~ ERROR E0439
+}
+
+fn main () {
+}
diff --git a/src/test/ui/error-codes/E0439.stderr b/src/test/ui/error-codes/E0439.stderr
new file mode 100644 (file)
index 0000000..77930d5
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0439]: invalid `simd_shuffle`, needs length: `simd_shuffle`
+  --> $DIR/E0439.rs:14:5
+   |
+14 |     fn simd_shuffle<A,B>(a: A, b: A, c: [u32; 8]) -> B; //~ ERROR E0439
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0440.rs b/src/test/ui/error-codes/E0440.rs
new file mode 100644 (file)
index 0000000..04e7584
--- /dev/null
@@ -0,0 +1,22 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(repr_simd)]
+#![feature(platform_intrinsics)]
+
+#[repr(simd)]
+struct f64x2(f64, f64);
+
+extern "platform-intrinsic" {
+    fn x86_mm_movemask_pd<T>(x: f64x2) -> i32; //~ ERROR E0440
+}
+
+fn main () {
+}
diff --git a/src/test/ui/error-codes/E0440.stderr b/src/test/ui/error-codes/E0440.stderr
new file mode 100644 (file)
index 0000000..83210a9
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0440]: platform-specific intrinsic has wrong number of type parameters: found 1, expected 0
+  --> $DIR/E0440.rs:18:5
+   |
+18 |     fn x86_mm_movemask_pd<T>(x: f64x2) -> i32; //~ ERROR E0440
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0441.rs b/src/test/ui/error-codes/E0441.rs
new file mode 100644 (file)
index 0000000..967ff64
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(repr_simd)]
+#![feature(platform_intrinsics)]
+
+#[repr(simd)]
+struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16);
+
+extern "platform-intrinsic" {
+    fn x86_mm_adds_ep16(x: i16x8, y: i16x8) -> i16x8; //~ ERROR E0441
+}
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0441.stderr b/src/test/ui/error-codes/E0441.stderr
new file mode 100644 (file)
index 0000000..34a387e
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0441]: unrecognized platform-specific intrinsic function: `x86_mm_adds_ep16`
+  --> $DIR/E0441.rs:18:5
+   |
+18 |     fn x86_mm_adds_ep16(x: i16x8, y: i16x8) -> i16x8; //~ ERROR E0441
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0442.rs b/src/test/ui/error-codes/E0442.rs
new file mode 100644 (file)
index 0000000..ddd9270
--- /dev/null
@@ -0,0 +1,29 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(repr_simd)]
+#![feature(platform_intrinsics)]
+
+#[repr(simd)]
+struct i8x16(i8, i8, i8, i8, i8, i8, i8, i8,
+             i8, i8, i8, i8, i8, i8, i8, i8);
+#[repr(simd)]
+struct i32x4(i32, i32, i32, i32);
+#[repr(simd)]
+struct i64x2(i64, i64);
+
+extern "platform-intrinsic" {
+    fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2;
+    //~^ ERROR E0442
+    //~| ERROR E0442
+    //~| ERROR E0442
+}
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0442.stderr b/src/test/ui/error-codes/E0442.stderr
new file mode 100644 (file)
index 0000000..6f19fd1
--- /dev/null
@@ -0,0 +1,20 @@
+error[E0442]: intrinsic argument 1 has wrong type: found vector with length 16, expected length 8
+  --> $DIR/E0442.rs:23:5
+   |
+23 |     fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0442]: intrinsic argument 2 has wrong type: found vector with length 4, expected length 8
+  --> $DIR/E0442.rs:23:5
+   |
+23 |     fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0442]: intrinsic return value has wrong type: found vector with length 2, expected length 8
+  --> $DIR/E0442.rs:23:5
+   |
+23 |     fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/error-codes/E0443.rs b/src/test/ui/error-codes/E0443.rs
new file mode 100644 (file)
index 0000000..24d1ee0
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(repr_simd)]
+#![feature(platform_intrinsics)]
+
+#[repr(simd)]
+struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16);
+#[repr(simd)]
+struct i64x8(i64, i64, i64, i64, i64, i64, i64, i64);
+
+extern "platform-intrinsic" {
+    fn x86_mm_adds_epi16(x: i16x8, y: i16x8) -> i64x8; //~ ERROR E0443
+}
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0443.stderr b/src/test/ui/error-codes/E0443.stderr
new file mode 100644 (file)
index 0000000..ebf8ef5
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0443]: intrinsic return value has wrong type: found `i64x8`, expected `i16x8` which was used for this vector type previously in this signature
+  --> $DIR/E0443.rs:20:5
+   |
+20 |     fn x86_mm_adds_epi16(x: i16x8, y: i16x8) -> i64x8; //~ ERROR E0443
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0444.rs b/src/test/ui/error-codes/E0444.rs
new file mode 100644 (file)
index 0000000..a424a3c
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(repr_simd)]
+#![feature(platform_intrinsics)]
+
+#[repr(simd)]
+struct f64x2(f64, f64);
+
+extern "platform-intrinsic" {
+    fn x86_mm_movemask_pd(x: f64x2, y: f64x2, z: f64x2) -> i32; //~ ERROR E0444
+}
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0444.stderr b/src/test/ui/error-codes/E0444.stderr
new file mode 100644 (file)
index 0000000..e44d945
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0444]: platform-specific intrinsic has invalid number of arguments: found 3, expected 1
+  --> $DIR/E0444.rs:18:5
+   |
+18 |     fn x86_mm_movemask_pd(x: f64x2, y: f64x2, z: f64x2) -> i32; //~ ERROR E0444
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0445.rs b/src/test/ui/error-codes/E0445.rs
new file mode 100644 (file)
index 0000000..bca1b52
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Foo {
+    fn dummy(&self) { }
+}
+
+pub trait Bar : Foo {}
+//~^ ERROR private trait `Foo` in public interface [E0445]
+//~| NOTE can't leak private trait
+pub struct Bar2<T: Foo>(pub T);
+//~^ ERROR private trait `Foo` in public interface [E0445]
+//~| NOTE can't leak private trait
+pub fn foo<T: Foo> (t: T) {}
+//~^ ERROR private trait `Foo` in public interface [E0445]
+//~| NOTE can't leak private trait
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0445.stderr b/src/test/ui/error-codes/E0445.stderr
new file mode 100644 (file)
index 0000000..7b59954
--- /dev/null
@@ -0,0 +1,20 @@
+error[E0445]: private trait `Foo` in public interface
+  --> $DIR/E0445.rs:15:1
+   |
+15 | pub trait Bar : Foo {}
+   | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+
+error[E0445]: private trait `Foo` in public interface
+  --> $DIR/E0445.rs:18:1
+   |
+18 | pub struct Bar2<T: Foo>(pub T);
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+
+error[E0445]: private trait `Foo` in public interface
+  --> $DIR/E0445.rs:21:1
+   |
+21 | pub fn foo<T: Foo> (t: T) {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/error-codes/E0446.rs b/src/test/ui/error-codes/E0446.rs
new file mode 100644 (file)
index 0000000..c576661
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod Foo {
+    struct Bar(u32);
+
+    pub fn bar() -> Bar { //~ ERROR E0446
+        Bar(0)
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0446.stderr b/src/test/ui/error-codes/E0446.stderr
new file mode 100644 (file)
index 0000000..1b61ca9
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0446]: private type `Foo::Bar` in public interface
+  --> $DIR/E0446.rs:14:5
+   |
+14 | /     pub fn bar() -> Bar { //~ ERROR E0446
+15 | |         Bar(0)
+16 | |     }
+   | |_____^ can't leak private type
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0449.rs b/src/test/ui/error-codes/E0449.rs
new file mode 100644 (file)
index 0000000..ac365db
--- /dev/null
@@ -0,0 +1,24 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Bar;
+
+trait Foo {
+    fn foo();
+}
+
+pub impl Bar {} //~ ERROR E0449
+
+pub impl Foo for Bar { //~ ERROR E0449
+    pub fn foo() {} //~ ERROR E0449
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0449.stderr b/src/test/ui/error-codes/E0449.stderr
new file mode 100644 (file)
index 0000000..2270167
--- /dev/null
@@ -0,0 +1,24 @@
+error[E0449]: unnecessary visibility qualifier
+  --> $DIR/E0449.rs:17:1
+   |
+17 | pub impl Bar {} //~ ERROR E0449
+   | ^^^^^^^^^^^^^^^ `pub` not needed here
+   |
+   = note: place qualifiers on individual impl items instead
+
+error[E0449]: unnecessary visibility qualifier
+  --> $DIR/E0449.rs:19:1
+   |
+19 | / pub impl Foo for Bar { //~ ERROR E0449
+20 | |     pub fn foo() {} //~ ERROR E0449
+21 | | }
+   | |_^ `pub` not needed here
+
+error[E0449]: unnecessary visibility qualifier
+  --> $DIR/E0449.rs:20:5
+   |
+20 |     pub fn foo() {} //~ ERROR E0449
+   |     ^^^^^^^^^^^^^^^ `pub` not needed here
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/error-codes/E0451.rs b/src/test/ui/error-codes/E0451.rs
new file mode 100644 (file)
index 0000000..af4e7d6
--- /dev/null
@@ -0,0 +1,29 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod Bar {
+    pub struct Foo {
+        pub a: isize,
+        b: isize,
+    }
+
+    pub struct FooTuple (
+        pub isize,
+        isize,
+    );
+}
+
+fn pat_match(foo: Bar::Foo) {
+    let Bar::Foo{a:a, b:b} = foo; //~ ERROR E0451
+}
+
+fn main() {
+    let f = Bar::Foo{ a: 0, b: 0 }; //~ ERROR E0451
+}
diff --git a/src/test/ui/error-codes/E0451.stderr b/src/test/ui/error-codes/E0451.stderr
new file mode 100644 (file)
index 0000000..0c29bee
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0451]: field `b` of struct `Bar::Foo` is private
+  --> $DIR/E0451.rs:24:23
+   |
+24 |     let Bar::Foo{a:a, b:b} = foo; //~ ERROR E0451
+   |                       ^^^ field `b` is private
+
+error[E0451]: field `b` of struct `Bar::Foo` is private
+  --> $DIR/E0451.rs:28:29
+   |
+28 |     let f = Bar::Foo{ a: 0, b: 0 }; //~ ERROR E0451
+   |                             ^^^^ field `b` is private
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0452.rs b/src/test/ui/error-codes/E0452.rs
new file mode 100644 (file)
index 0000000..1665bbd
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(foo = "")] //~ ERROR E0452
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0452.stderr b/src/test/ui/error-codes/E0452.stderr
new file mode 100644 (file)
index 0000000..d63d0ed
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0452]: malformed lint attribute
+  --> $DIR/E0452.rs:11:10
+   |
+11 | #![allow(foo = "")] //~ ERROR E0452
+   |          ^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0453.rs b/src/test/ui/error-codes/E0453.rs
new file mode 100644 (file)
index 0000000..8e51b84
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![forbid(non_snake_case)]
+
+#[allow(non_snake_case)]
+//~^ ERROR allow(non_snake_case) overruled by outer forbid(non_snake_case)
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0453.stderr b/src/test/ui/error-codes/E0453.stderr
new file mode 100644 (file)
index 0000000..467784f
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0453]: allow(non_snake_case) overruled by outer forbid(non_snake_case)
+  --> $DIR/E0453.rs:13:9
+   |
+11 | #![forbid(non_snake_case)]
+   |           -------------- `forbid` level set here
+12 | 
+13 | #[allow(non_snake_case)]
+   |         ^^^^^^^^^^^^^^ overruled by previous forbid
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0454.rs b/src/test/ui/error-codes/E0454.rs
new file mode 100644 (file)
index 0000000..afd0f5f
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[link(name = "")] extern {}
+//~^ ERROR E0454
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0454.stderr b/src/test/ui/error-codes/E0454.stderr
new file mode 100644 (file)
index 0000000..aee8b53
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0454]: #[link(name = "")] given with empty name
+  --> $DIR/E0454.rs:11:1
+   |
+11 | #[link(name = "")] extern {}
+   | ^^^^^^^^^^^^^^^^^^ empty name given
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0458.rs b/src/test/ui/error-codes/E0458.rs
new file mode 100644 (file)
index 0000000..fea27ef
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[link(kind = "wonderful_unicorn")] extern {} //~ ERROR E0458
+                                              //~| ERROR E0459
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0458.stderr b/src/test/ui/error-codes/E0458.stderr
new file mode 100644 (file)
index 0000000..9cdd0d5
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0458]: unknown kind: `wonderful_unicorn`
+  --> $DIR/E0458.rs:11:1
+   |
+11 | #[link(kind = "wonderful_unicorn")] extern {} //~ ERROR E0458
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unknown kind
+
+error[E0459]: #[link(...)] specified without `name = "foo"`
+  --> $DIR/E0458.rs:11:1
+   |
+11 | #[link(kind = "wonderful_unicorn")] extern {} //~ ERROR E0458
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `name` argument
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0459.rs b/src/test/ui/error-codes/E0459.rs
new file mode 100644 (file)
index 0000000..dc7ac71
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[link(kind = "dylib")] extern {} //~ ERROR E0459
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0459.stderr b/src/test/ui/error-codes/E0459.stderr
new file mode 100644 (file)
index 0000000..512788e
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0459]: #[link(...)] specified without `name = "foo"`
+  --> $DIR/E0459.rs:11:1
+   |
+11 | #[link(kind = "dylib")] extern {} //~ ERROR E0459
+   | ^^^^^^^^^^^^^^^^^^^^^^^ missing `name` argument
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0463.rs b/src/test/ui/error-codes/E0463.rs
new file mode 100644 (file)
index 0000000..aae8397
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(plugin)]
+#![plugin(cookie_monster)]
+//~^ ERROR E0463
+extern crate cake_is_a_lie;
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0463.stderr b/src/test/ui/error-codes/E0463.stderr
new file mode 100644 (file)
index 0000000..208c00c
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0463]: can't find crate for `cookie_monster`
+  --> $DIR/E0463.rs:12:11
+   |
+12 | #![plugin(cookie_monster)]
+   |           ^^^^^^^^^^^^^^ can't find crate
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0478.rs b/src/test/ui/error-codes/E0478.rs
new file mode 100644 (file)
index 0000000..8eb4003
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Wedding<'t>: 't { }
+
+struct Prince<'kiss, 'SnowWhite> {
+    child: Box<Wedding<'kiss> + 'SnowWhite>, //~ ERROR E0478
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0478.stderr b/src/test/ui/error-codes/E0478.stderr
new file mode 100644 (file)
index 0000000..f909fa4
--- /dev/null
@@ -0,0 +1,19 @@
+error[E0478]: lifetime bound not satisfied
+  --> $DIR/E0478.rs:14:5
+   |
+14 |     child: Box<Wedding<'kiss> + 'SnowWhite>, //~ ERROR E0478
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+note: lifetime parameter instantiated with the lifetime 'SnowWhite as defined on the struct at 13:1
+  --> $DIR/E0478.rs:13:1
+   |
+13 | struct Prince<'kiss, 'SnowWhite> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: but lifetime parameter must outlive the lifetime 'kiss as defined on the struct at 13:1
+  --> $DIR/E0478.rs:13:1
+   |
+13 | struct Prince<'kiss, 'SnowWhite> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0492.rs b/src/test/ui/error-codes/E0492.rs
new file mode 100644 (file)
index 0000000..8e4964c
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT};
+
+const A: AtomicUsize = ATOMIC_USIZE_INIT;
+static B: &'static AtomicUsize = &A; //~ ERROR E0492
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0492.stderr b/src/test/ui/error-codes/E0492.stderr
new file mode 100644 (file)
index 0000000..c198966
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead
+  --> $DIR/E0492.rs:14:34
+   |
+14 | static B: &'static AtomicUsize = &A; //~ ERROR E0492
+   |                                  ^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0494.rs b/src/test/ui/error-codes/E0494.rs
new file mode 100644 (file)
index 0000000..5f8632a
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo {
+    a: u32
+}
+
+static S : Foo = Foo { a : 0 };
+static A : &'static u32 = &S.a; //~ ERROR E0494
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0494.stderr b/src/test/ui/error-codes/E0494.stderr
new file mode 100644 (file)
index 0000000..1d5ded5
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0494]: cannot refer to the interior of another static, use a constant instead
+  --> $DIR/E0494.rs:16:27
+   |
+16 | static A : &'static u32 = &S.a; //~ ERROR E0494
+   |                           ^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0496.rs b/src/test/ui/error-codes/E0496.rs
new file mode 100644 (file)
index 0000000..4ca3cd9
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo<'a> {
+    a: &'a i32,
+}
+
+impl<'a> Foo<'a> {
+    fn f<'a>(x: &'a i32) { //~ ERROR E0496
+    }
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0496.stderr b/src/test/ui/error-codes/E0496.stderr
new file mode 100644 (file)
index 0000000..ab9a08a
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope
+  --> $DIR/E0496.rs:16:10
+   |
+15 | impl<'a> Foo<'a> {
+   |      -- first declared here
+16 |     fn f<'a>(x: &'a i32) { //~ ERROR E0496
+   |          ^^ lifetime 'a already in scope
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0499.rs b/src/test/ui/error-codes/E0499.rs
new file mode 100644 (file)
index 0000000..9a64bfe
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let mut i = 0;
+    let mut x = &mut i;
+    let mut a = &mut i; //~ ERROR E0499
+}
diff --git a/src/test/ui/error-codes/E0499.stderr b/src/test/ui/error-codes/E0499.stderr
new file mode 100644 (file)
index 0000000..c3057d9
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0499]: cannot borrow `i` as mutable more than once at a time
+  --> $DIR/E0499.rs:14:22
+   |
+13 |     let mut x = &mut i;
+   |                      - first mutable borrow occurs here
+14 |     let mut a = &mut i; //~ ERROR E0499
+   |                      ^ second mutable borrow occurs here
+15 | }
+   | - first borrow ends here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0502.rs b/src/test/ui/error-codes/E0502.rs
new file mode 100644 (file)
index 0000000..fce8513
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn bar(x: &mut i32) {}
+fn foo(a: &mut i32) {
+    let ref y = a;
+    bar(a); //~ ERROR E0502
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0502.stderr b/src/test/ui/error-codes/E0502.stderr
new file mode 100644 (file)
index 0000000..e578cff
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0502]: cannot borrow `*a` as mutable because `a` is also borrowed as immutable
+  --> $DIR/E0502.rs:14:9
+   |
+13 |     let ref y = a;
+   |         ----- immutable borrow occurs here
+14 |     bar(a); //~ ERROR E0502
+   |         ^ mutable borrow occurs here
+15 | }
+   | - immutable borrow ends here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0503.rs b/src/test/ui/error-codes/E0503.rs
new file mode 100644 (file)
index 0000000..810eb8d
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let mut value = 3;
+    let _borrow = &mut value;
+    let _sum = value + 1; //~ ERROR E0503
+}
diff --git a/src/test/ui/error-codes/E0503.stderr b/src/test/ui/error-codes/E0503.stderr
new file mode 100644 (file)
index 0000000..112e2c4
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0503]: cannot use `value` because it was mutably borrowed
+  --> $DIR/E0503.rs:14:16
+   |
+13 |     let _borrow = &mut value;
+   |                        ----- borrow of `value` occurs here
+14 |     let _sum = value + 1; //~ ERROR E0503
+   |                ^^^^^ use of borrowed `value`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0504.rs b/src/test/ui/error-codes/E0504.rs
new file mode 100644 (file)
index 0000000..c594f24
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct FancyNum {
+    num: u8,
+}
+
+fn main() {
+    let fancy_num = FancyNum { num: 5 };
+    let fancy_ref = &fancy_num;
+
+    let x = move || {
+        println!("child function: {}", fancy_num.num); //~ ERROR E0504
+    };
+
+    x();
+    println!("main function: {}", fancy_ref.num);
+}
diff --git a/src/test/ui/error-codes/E0504.stderr b/src/test/ui/error-codes/E0504.stderr
new file mode 100644 (file)
index 0000000..0f1b183
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0504]: cannot move `fancy_num` into closure because it is borrowed
+  --> $DIR/E0504.rs:20:40
+   |
+17 |     let fancy_ref = &fancy_num;
+   |                      --------- borrow of `fancy_num` occurs here
+...
+20 |         println!("child function: {}", fancy_num.num); //~ ERROR E0504
+   |                                        ^^^^^^^^^ move into closure occurs here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0505.rs b/src/test/ui/error-codes/E0505.rs
new file mode 100644 (file)
index 0000000..2d534b8
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Value {}
+
+fn eat(val: Value) {}
+
+fn main() {
+    let x = Value{};
+    {
+        let _ref_to_val: &Value = &x;
+        eat(x); //~ ERROR E0505
+    }
+}
diff --git a/src/test/ui/error-codes/E0505.stderr b/src/test/ui/error-codes/E0505.stderr
new file mode 100644 (file)
index 0000000..dfb327d
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0505]: cannot move out of `x` because it is borrowed
+  --> $DIR/E0505.rs:19:13
+   |
+18 |         let _ref_to_val: &Value = &x;
+   |                                    - borrow of `x` occurs here
+19 |         eat(x); //~ ERROR E0505
+   |             ^ move out of `x` occurs here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0507.rs b/src/test/ui/error-codes/E0507.rs
new file mode 100644 (file)
index 0000000..87b1bf5
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::cell::RefCell;
+
+struct TheDarkKnight;
+
+impl TheDarkKnight {
+    fn nothing_is_true(self) {}
+}
+
+fn main() {
+    let x = RefCell::new(TheDarkKnight);
+
+    x.borrow().nothing_is_true(); //~ ERROR E0507
+}
diff --git a/src/test/ui/error-codes/E0507.stderr b/src/test/ui/error-codes/E0507.stderr
new file mode 100644 (file)
index 0000000..407ebb8
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0507]: cannot move out of borrowed content
+  --> $DIR/E0507.rs:22:5
+   |
+22 |     x.borrow().nothing_is_true(); //~ ERROR E0507
+   |     ^^^^^^^^^^ cannot move out of borrowed content
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0509.rs b/src/test/ui/error-codes/E0509.rs
new file mode 100644 (file)
index 0000000..b92024c
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct FancyNum {
+    num: usize
+}
+
+struct DropStruct {
+    fancy: FancyNum
+}
+
+impl Drop for DropStruct {
+    fn drop(&mut self) {
+    }
+}
+
+fn main() {
+    let drop_struct = DropStruct{fancy: FancyNum{num: 5}};
+    let fancy_field = drop_struct.fancy; //~ ERROR E0509
+    println!("Fancy: {}", fancy_field.num);
+}
diff --git a/src/test/ui/error-codes/E0509.stderr b/src/test/ui/error-codes/E0509.stderr
new file mode 100644 (file)
index 0000000..6da0fdb
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0509]: cannot move out of type `DropStruct`, which implements the `Drop` trait
+  --> $DIR/E0509.rs:26:23
+   |
+26 |     let fancy_field = drop_struct.fancy; //~ ERROR E0509
+   |                       ^^^^^^^^^^^^^^^^^
+   |                       |
+   |                       cannot move out of here
+   |                       help: consider using a reference instead: `&drop_struct.fancy`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0511.rs b/src/test/ui/error-codes/E0511.rs
new file mode 100644 (file)
index 0000000..c5c03f8
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(platform_intrinsics)]
+
+extern "platform-intrinsic" {
+    fn simd_add<T>(a: T, b: T) -> T;
+}
+
+fn main() {
+    unsafe { simd_add(0, 1); } //~ ERROR E0511
+}
diff --git a/src/test/ui/error-codes/E0511.stderr b/src/test/ui/error-codes/E0511.stderr
new file mode 100644 (file)
index 0000000..b714350
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0511]: invalid monomorphization of `simd_add` intrinsic: expected SIMD input type, found non-SIMD `i32`
+  --> $DIR/E0511.rs:18:14
+   |
+18 |     unsafe { simd_add(0, 1); } //~ ERROR E0511
+   |              ^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0512.rs b/src/test/ui/error-codes/E0512.rs
new file mode 100644 (file)
index 0000000..25f9627
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn takes_u8(_: u8) {}
+
+fn main() {
+    unsafe { takes_u8(::std::mem::transmute(0u16)); } //~ ERROR E0512
+}
diff --git a/src/test/ui/error-codes/E0512.stderr b/src/test/ui/error-codes/E0512.stderr
new file mode 100644 (file)
index 0000000..ad25bb2
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0512]: transmute called with types of different sizes
+  --> $DIR/E0512.rs:14:23
+   |
+14 |     unsafe { takes_u8(::std::mem::transmute(0u16)); } //~ ERROR E0512
+   |                       ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: source type: u16 (16 bits)
+   = note: target type: u8 (8 bits)
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0516.rs b/src/test/ui/error-codes/E0516.rs
new file mode 100644 (file)
index 0000000..be2b89c
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let x: typeof(92) = 92; //~ ERROR E0516
+                            //~| reserved keyword
+}
diff --git a/src/test/ui/error-codes/E0516.stderr b/src/test/ui/error-codes/E0516.stderr
new file mode 100644 (file)
index 0000000..6209296
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0516]: `typeof` is a reserved keyword but unimplemented
+  --> $DIR/E0516.rs:12:12
+   |
+12 |     let x: typeof(92) = 92; //~ ERROR E0516
+   |            ^^^^^^^^^^ reserved keyword
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0517.rs b/src/test/ui/error-codes/E0517.rs
new file mode 100644 (file)
index 0000000..561223c
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[repr(C)] //~ ERROR: E0517
+type Foo = u8;
+
+#[repr(packed)] //~ ERROR: E0517
+enum Foo2 {Bar, Baz}
+
+#[repr(u8)] //~ ERROR: E0517
+struct Foo3 {bar: bool, baz: bool}
+
+#[repr(C)] //~ ERROR: E0517
+impl Foo3 {
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0517.stderr b/src/test/ui/error-codes/E0517.stderr
new file mode 100644 (file)
index 0000000..968c47f
--- /dev/null
@@ -0,0 +1,35 @@
+error[E0517]: attribute should be applied to struct, enum or union
+  --> $DIR/E0517.rs:11:8
+   |
+11 | #[repr(C)] //~ ERROR: E0517
+   |        ^
+12 | type Foo = u8;
+   | -------------- not a struct, enum or union
+
+error[E0517]: attribute should be applied to struct or union
+  --> $DIR/E0517.rs:14:8
+   |
+14 | #[repr(packed)] //~ ERROR: E0517
+   |        ^^^^^^
+15 | enum Foo2 {Bar, Baz}
+   | -------------------- not a struct or union
+
+error[E0517]: attribute should be applied to enum
+  --> $DIR/E0517.rs:17:8
+   |
+17 | #[repr(u8)] //~ ERROR: E0517
+   |        ^^
+18 | struct Foo3 {bar: bool, baz: bool}
+   | ---------------------------------- not an enum
+
+error[E0517]: attribute should be applied to struct, enum or union
+  --> $DIR/E0517.rs:20:8
+   |
+20 |   #[repr(C)] //~ ERROR: E0517
+   |          ^
+21 | / impl Foo3 {
+22 | | }
+   | |_- not a struct, enum or union
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/error-codes/E0518.rs b/src/test/ui/error-codes/E0518.rs
new file mode 100644 (file)
index 0000000..6d5b6e4
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[inline(always)] //~ ERROR: E0518
+struct Foo;
+
+#[inline(never)] //~ ERROR: E0518
+impl Foo {
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0518.stderr b/src/test/ui/error-codes/E0518.stderr
new file mode 100644 (file)
index 0000000..99a4a63
--- /dev/null
@@ -0,0 +1,19 @@
+error[E0518]: attribute should be applied to function
+  --> $DIR/E0518.rs:11:1
+   |
+11 | #[inline(always)] //~ ERROR: E0518
+   | ^^^^^^^^^^^^^^^^^
+12 | struct Foo;
+   | ----------- not a function
+
+error[E0518]: attribute should be applied to function
+  --> $DIR/E0518.rs:14:1
+   |
+14 |   #[inline(never)] //~ ERROR: E0518
+   |   ^^^^^^^^^^^^^^^^
+15 | / impl Foo {
+16 | | }
+   | |_- not a function
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0520.rs b/src/test/ui/error-codes/E0520.rs
new file mode 100644 (file)
index 0000000..eae5b11
--- /dev/null
@@ -0,0 +1,31 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(specialization)]
+
+trait SpaceLlama {
+    fn fly(&self);
+}
+
+impl<T> SpaceLlama for T {
+    default fn fly(&self) {}
+}
+
+impl<T: Clone> SpaceLlama for T {
+    fn fly(&self) {}
+}
+
+impl SpaceLlama for i32 {
+    default fn fly(&self) {}
+    //~^ ERROR E0520
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0520.stderr b/src/test/ui/error-codes/E0520.stderr
new file mode 100644 (file)
index 0000000..272c388
--- /dev/null
@@ -0,0 +1,15 @@
+error[E0520]: `fly` specializes an item from a parent `impl`, but that item is not marked `default`
+  --> $DIR/E0520.rs:26:5
+   |
+21 | / impl<T: Clone> SpaceLlama for T {
+22 | |     fn fly(&self) {}
+23 | | }
+   | |_- parent `impl` is here
+...
+26 |       default fn fly(&self) {}
+   |       ^^^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `fly`
+   |
+   = note: to specialize, `fly` in the parent `impl` must be marked `default`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0522.rs b/src/test/ui/error-codes/E0522.rs
new file mode 100644 (file)
index 0000000..3d43778
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(lang_items)]
+
+#[lang = "cookie"]
+fn cookie() -> ! {
+//~^^ ERROR definition of an unknown language item: `cookie` [E0522]
+    loop {}
+}
diff --git a/src/test/ui/error-codes/E0522.stderr b/src/test/ui/error-codes/E0522.stderr
new file mode 100644 (file)
index 0000000..819fab0
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0601]: main function not found
+
+error[E0522]: definition of an unknown language item: `cookie`
+  --> $DIR/E0522.rs:13:1
+   |
+13 | #[lang = "cookie"]
+   | ^^^^^^^^^^^^^^^^^^ definition of unknown language item `cookie`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0527.rs b/src/test/ui/error-codes/E0527.rs
new file mode 100644 (file)
index 0000000..67d222e
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(slice_patterns)]
+
+fn main() {
+    let r = &[1, 2, 3, 4];
+    match r {
+        &[a, b] => {
+            //~^ ERROR E0527
+            println!("a={}, b={}", a, b);
+        }
+    }
+}
diff --git a/src/test/ui/error-codes/E0527.stderr b/src/test/ui/error-codes/E0527.stderr
new file mode 100644 (file)
index 0000000..7cd705e
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0527]: pattern requires 2 elements but array has 4
+  --> $DIR/E0527.rs:16:10
+   |
+16 |         &[a, b] => {
+   |          ^^^^^^ expected 4 elements
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0528.rs b/src/test/ui/error-codes/E0528.rs
new file mode 100644 (file)
index 0000000..e2aa2c0
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(slice_patterns)]
+
+fn main() {
+    let r = &[1, 2];
+    match r {
+        &[a, b, c, rest..] => {
+        //~^ ERROR E0528
+        }
+    }
+}
diff --git a/src/test/ui/error-codes/E0528.stderr b/src/test/ui/error-codes/E0528.stderr
new file mode 100644 (file)
index 0000000..ff75b07
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0528]: pattern requires at least 3 elements but array has 2
+  --> $DIR/E0528.rs:16:10
+   |
+16 |         &[a, b, c, rest..] => {
+   |          ^^^^^^^^^^^^^^^^^ pattern cannot match array of 2 elements
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0529.rs b/src/test/ui/error-codes/E0529.rs
new file mode 100644 (file)
index 0000000..5262ad7
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(slice_patterns)]
+
+fn main() {
+    let r: f32 = 1.0;
+    match r {
+        [a, b] => {
+        //~^ ERROR E0529
+        }
+    }
+}
diff --git a/src/test/ui/error-codes/E0529.stderr b/src/test/ui/error-codes/E0529.stderr
new file mode 100644 (file)
index 0000000..be9039b
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0529]: expected an array or slice, found `f32`
+  --> $DIR/E0529.rs:16:9
+   |
+16 |         [a, b] => {
+   |         ^^^^^^ pattern cannot match with input type `f32`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0530.rs b/src/test/ui/error-codes/E0530.rs
new file mode 100644 (file)
index 0000000..4f674d0
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    static TEST: i32 = 0;
+
+    let r: (i32, i32) = (0, 0);
+    match r {
+        TEST => {} //~ ERROR E0530
+    }
+}
diff --git a/src/test/ui/error-codes/E0530.stderr b/src/test/ui/error-codes/E0530.stderr
new file mode 100644 (file)
index 0000000..7c0306c
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0530]: match bindings cannot shadow statics
+  --> $DIR/E0530.rs:16:9
+   |
+12 |     static TEST: i32 = 0;
+   |     --------------------- a static `TEST` is defined here
+...
+16 |         TEST => {} //~ ERROR E0530
+   |         ^^^^ cannot be named the same as a static
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0532.rs b/src/test/ui/error-codes/E0532.rs
new file mode 100644 (file)
index 0000000..5dc3b5f
--- /dev/null
@@ -0,0 +1,24 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let value = 1;
+
+    match SomeStruct(value) {
+        StructConst1(_) => { },
+        //~^ ERROR expected tuple struct/variant, found constant `StructConst1`
+        _ => { },
+    }
+
+    struct SomeStruct(u8);
+
+    const StructConst1 : SomeStruct = SomeStruct(1);
+    const StructConst2 : SomeStruct = SomeStruct(2);
+}
diff --git a/src/test/ui/error-codes/E0532.stderr b/src/test/ui/error-codes/E0532.stderr
new file mode 100644 (file)
index 0000000..4eb91ce
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0532]: expected tuple struct/variant, found constant `StructConst1`
+  --> $DIR/E0532.rs:15:9
+   |
+15 |         StructConst1(_) => { },
+   |         ^^^^^^^^^^^^ not a tuple struct/variant
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0534.rs b/src/test/ui/error-codes/E0534.rs
new file mode 100644 (file)
index 0000000..fc465b2
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[inline()] //~ ERROR E0534
+pub fn something() {}
+
+fn main() {
+    something();
+}
diff --git a/src/test/ui/error-codes/E0534.stderr b/src/test/ui/error-codes/E0534.stderr
new file mode 100644 (file)
index 0000000..fe7a548
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0534]: expected one argument
+  --> $DIR/E0534.rs:11:1
+   |
+11 | #[inline()] //~ ERROR E0534
+   | ^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0558.rs b/src/test/ui/error-codes/E0558.rs
new file mode 100644 (file)
index 0000000..64a6ee4
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[export_name]
+//~^ ERROR E0558
+
+pub fn something() {}
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0558.stderr b/src/test/ui/error-codes/E0558.stderr
new file mode 100644 (file)
index 0000000..c116201
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0558]: export_name attribute has invalid format
+  --> $DIR/E0558.rs:11:1
+   |
+11 | #[export_name]
+   | ^^^^^^^^^^^^^^ did you mean #[export_name="*"]?
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0559.rs b/src/test/ui/error-codes/E0559.rs
new file mode 100644 (file)
index 0000000..da0f692
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum Field {
+    Fool { x: u32 },
+}
+
+fn main() {
+    let s = Field::Fool { joke: 0 };
+    //~^ ERROR E0559
+}
diff --git a/src/test/ui/error-codes/E0559.stderr b/src/test/ui/error-codes/E0559.stderr
new file mode 100644 (file)
index 0000000..5d145a9
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0559]: variant `Field::Fool` has no field named `joke`
+  --> $DIR/E0559.rs:16:27
+   |
+16 |     let s = Field::Fool { joke: 0 };
+   |                           ^^^^^ `Field::Fool` does not have this field
+   |
+   = note: available fields are: `x`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0560.rs b/src/test/ui/error-codes/E0560.rs
new file mode 100644 (file)
index 0000000..bbb7f08
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Simba {
+    mother: u32,
+}
+
+fn main() {
+    let s = Simba { mother: 1, father: 0 };
+    //~^ ERROR E0560
+}
diff --git a/src/test/ui/error-codes/E0560.stderr b/src/test/ui/error-codes/E0560.stderr
new file mode 100644 (file)
index 0000000..a0185aa
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0560]: struct `Simba` has no field named `father`
+  --> $DIR/E0560.rs:16:32
+   |
+16 |     let s = Simba { mother: 1, father: 0 };
+   |                                ^^^^^^^ `Simba` does not have this field
+   |
+   = note: available fields are: `mother`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0565-1.rs b/src/test/ui/error-codes/E0565-1.rs
new file mode 100644 (file)
index 0000000..d3e68c7
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(attr_literals)]
+
+// deprecated doesn't currently support literals
+#[deprecated("since")] //~ ERROR E0565
+fn f() {  }
+
+fn main() {  }
diff --git a/src/test/ui/error-codes/E0565-1.stderr b/src/test/ui/error-codes/E0565-1.stderr
new file mode 100644 (file)
index 0000000..65b917a
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0565]: unsupported literal
+  --> $DIR/E0565-1.rs:14:14
+   |
+14 | #[deprecated("since")] //~ ERROR E0565
+   |              ^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0565.rs b/src/test/ui/error-codes/E0565.rs
new file mode 100644 (file)
index 0000000..b2d3692
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(attr_literals)]
+
+// repr currently doesn't support literals
+#[repr("C")] //~ ERROR E0565
+struct A {  }
+
+fn main() {  }
diff --git a/src/test/ui/error-codes/E0565.stderr b/src/test/ui/error-codes/E0565.stderr
new file mode 100644 (file)
index 0000000..0041b76
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0565]: unsupported literal
+  --> $DIR/E0565.rs:14:8
+   |
+14 | #[repr("C")] //~ ERROR E0565
+   |        ^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0572.rs b/src/test/ui/error-codes/E0572.rs
new file mode 100644 (file)
index 0000000..bbaab10
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+const FOO: u32 = return 0; //~ ERROR E0572
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0572.stderr b/src/test/ui/error-codes/E0572.stderr
new file mode 100644 (file)
index 0000000..cad313b
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0572]: return statement outside of function body
+  --> $DIR/E0572.rs:11:18
+   |
+11 | const FOO: u32 = return 0; //~ ERROR E0572
+   |                  ^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0582.rs b/src/test/ui/error-codes/E0582.rs
new file mode 100644 (file)
index 0000000..5e6f65a
--- /dev/null
@@ -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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// This test was derived from the wasm and parsell crates.  They
+// stopped compiling when #32330 is fixed.
+
+#![allow(dead_code, unused_variables)]
+
+use std::str::Chars;
+
+pub trait HasOutput<Ch, Str> {
+    type Output;
+}
+
+#[derive(Clone, PartialEq, Eq, Hash, Ord, PartialOrd, Debug)]
+pub enum Token<'a> {
+    Begin(&'a str)
+}
+
+fn mk_unexpected_char_err<'a>() -> Option<&'a i32> {
+    unimplemented!()
+}
+
+fn foo<'a>(data: &mut Chars<'a>) {
+    bar(mk_unexpected_char_err)
+}
+
+fn bar<F>(t: F)
+    // No type can satisfy this requirement, since `'a` does not
+    // appear in any of the input types:
+    where F: for<'a> Fn() -> Option<&'a i32>
+    //~^ ERROR E0582
+{
+}
+
+fn baz<F>(t: F)
+    // No type can satisfy this requirement, since `'a` does not
+    // appear in any of the input types:
+    where F: for<'a> Iterator<Item=&'a i32>
+    //~^ ERROR E0582
+{
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0582.stderr b/src/test/ui/error-codes/E0582.stderr
new file mode 100644 (file)
index 0000000..ac20683
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types
+  --> $DIR/E0582.rs:38:30
+   |
+38 |     where F: for<'a> Fn() -> Option<&'a i32>
+   |                              ^^^^^^^^^^^^^^^
+
+error[E0582]: binding for associated type `Item` references lifetime `'a`, which does not appear in the trait input types
+  --> $DIR/E0582.rs:46:31
+   |
+46 |     where F: for<'a> Iterator<Item=&'a i32>
+   |                               ^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0585.rs b/src/test/ui/error-codes/E0585.rs
new file mode 100644 (file)
index 0000000..1acaf8c
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    /// Hello! I'm useless...
+    //~^ ERROR E0585
+}
diff --git a/src/test/ui/error-codes/E0585.stderr b/src/test/ui/error-codes/E0585.stderr
new file mode 100644 (file)
index 0000000..49967f4
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0585]: found a documentation comment that doesn't document anything
+  --> $DIR/E0585.rs:12:5
+   |
+12 |     /// Hello! I'm useless...
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: doc comments must come before what they document, maybe a comment was intended with `//`?
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0586.rs b/src/test/ui/error-codes/E0586.rs
new file mode 100644 (file)
index 0000000..c1bfc5c
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1];
+    let x = &tmp[1..=]; //~ ERROR E0586
+}
diff --git a/src/test/ui/error-codes/E0586.stderr b/src/test/ui/error-codes/E0586.stderr
new file mode 100644 (file)
index 0000000..3cf16bd
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0586]: inclusive range with no end
+  --> $DIR/E0586.rs:13:22
+   |
+13 |     let x = &tmp[1..=]; //~ ERROR E0586
+   |                      ^
+   |
+   = help: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0597.rs b/src/test/ui/error-codes/E0597.rs
new file mode 100644 (file)
index 0000000..2f4a1da
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo<'a> {
+    x: Option<&'a u32>,
+}
+
+fn main() {
+    let mut x = Foo { x: None };
+    let y = 0;
+    x.x = Some(&y);
+    //~^ `y` does not live long enough [E0597]
+}
diff --git a/src/test/ui/error-codes/E0597.stderr b/src/test/ui/error-codes/E0597.stderr
new file mode 100644 (file)
index 0000000..7316ee6
--- /dev/null
@@ -0,0 +1,13 @@
+error[E0597]: `y` does not live long enough
+  --> $DIR/E0597.rs:18:17
+   |
+18 |     x.x = Some(&y);
+   |                 ^ borrowed value does not live long enough
+19 |     //~^ `y` does not live long enough [E0597]
+20 | }
+   | - `y` dropped here while still borrowed
+   |
+   = note: values in a scope are dropped in the opposite order they are created
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0599.rs b/src/test/ui/error-codes/E0599.rs
new file mode 100644 (file)
index 0000000..30fca2b
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo;
+
+fn main() {
+    || if let Foo::NotEvenReal() = Foo {}; //~ ERROR E0599
+}
diff --git a/src/test/ui/error-codes/E0599.stderr b/src/test/ui/error-codes/E0599.stderr
new file mode 100644 (file)
index 0000000..0274506
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0599]: no associated item named `NotEvenReal` found for type `Foo` in the current scope
+  --> $DIR/E0599.rs:14:15
+   |
+11 | struct Foo;
+   | ----------- associated item `NotEvenReal` not found for this
+...
+14 |     || if let Foo::NotEvenReal() = Foo {}; //~ ERROR E0599
+   |               ^^^^^^^^^^^^^^^^^^ associated item not found in `Foo`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0600.rs b/src/test/ui/error-codes/E0600.rs
new file mode 100644 (file)
index 0000000..5457ff2
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    !"a"; //~ ERROR E0600
+}
diff --git a/src/test/ui/error-codes/E0600.stderr b/src/test/ui/error-codes/E0600.stderr
new file mode 100644 (file)
index 0000000..fec5f41
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0600]: cannot apply unary operator `!` to type `&'static str`
+  --> $DIR/E0600.rs:12:5
+   |
+12 |     !"a"; //~ ERROR E0600
+   |     ^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0602.rs b/src/test/ui/error-codes/E0602.rs
new file mode 100644 (file)
index 0000000..cc3e436
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags:-D bogus
+
+// error-pattern:E0602
+// error-pattern:requested on the command line with `-D bogus`
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0602.stderr b/src/test/ui/error-codes/E0602.stderr
new file mode 100644 (file)
index 0000000..cb6c053
--- /dev/null
@@ -0,0 +1,6 @@
+error[E0602]: unknown lint: `bogus`
+  |
+  = note: requested on the command line with `-D bogus`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0603.rs b/src/test/ui/error-codes/E0603.rs
new file mode 100644 (file)
index 0000000..1cc9f6b
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod SomeModule {
+    const PRIVATE: u32 = 0x_a_bad_1dea_u32;
+}
+
+fn main() {
+    SomeModule::PRIVATE; //~ ERROR E0603
+}
diff --git a/src/test/ui/error-codes/E0603.stderr b/src/test/ui/error-codes/E0603.stderr
new file mode 100644 (file)
index 0000000..1d8e2fa
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0603]: constant `PRIVATE` is private
+  --> $DIR/E0603.rs:16:5
+   |
+16 |     SomeModule::PRIVATE; //~ ERROR E0603
+   |     ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0604.rs b/src/test/ui/error-codes/E0604.rs
new file mode 100644 (file)
index 0000000..c5bf3a7
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    1u32 as char; //~ ERROR E0604
+}
diff --git a/src/test/ui/error-codes/E0604.stderr b/src/test/ui/error-codes/E0604.stderr
new file mode 100644 (file)
index 0000000..78d1c4d
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0604]: only `u8` can be cast as `char`, not `u32`
+  --> $DIR/E0604.rs:12:5
+   |
+12 |     1u32 as char; //~ ERROR E0604
+   |     ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0605.rs b/src/test/ui/error-codes/E0605.rs
new file mode 100644 (file)
index 0000000..4b5b8be
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let x = 0u8;
+    x as Vec<u8>; //~ ERROR E0605
+
+    let v = 0 as *const u8;
+    v as &u8; //~ ERROR E0605
+}
diff --git a/src/test/ui/error-codes/E0605.stderr b/src/test/ui/error-codes/E0605.stderr
new file mode 100644 (file)
index 0000000..0b44de2
--- /dev/null
@@ -0,0 +1,18 @@
+error[E0605]: non-primitive cast: `u8` as `std::vec::Vec<u8>`
+  --> $DIR/E0605.rs:13:5
+   |
+13 |     x as Vec<u8>; //~ ERROR E0605
+   |     ^^^^^^^^^^^^
+   |
+   = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
+
+error[E0605]: non-primitive cast: `*const u8` as `&u8`
+  --> $DIR/E0605.rs:16:5
+   |
+16 |     v as &u8; //~ ERROR E0605
+   |     ^^^^^^^^
+   |
+   = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0606.rs b/src/test/ui/error-codes/E0606.rs
new file mode 100644 (file)
index 0000000..5507173
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    &0u8 as u8; //~ ERROR E0606
+}
diff --git a/src/test/ui/error-codes/E0606.stderr b/src/test/ui/error-codes/E0606.stderr
new file mode 100644 (file)
index 0000000..17051da
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0606]: casting `&u8` as `u8` is invalid
+  --> $DIR/E0606.rs:12:5
+   |
+12 |     &0u8 as u8; //~ ERROR E0606
+   |     ^^^^^^^^^^ cannot cast `&u8` as `u8`
+   |
+help: did you mean `*&0u8`?
+  --> $DIR/E0606.rs:12:5
+   |
+12 |     &0u8 as u8; //~ ERROR E0606
+   |     ^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0607.rs b/src/test/ui/error-codes/E0607.rs
new file mode 100644 (file)
index 0000000..fa761f2
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let v = 0 as *const u8;
+    v as *const [u8]; //~ ERROR E0607
+}
diff --git a/src/test/ui/error-codes/E0607.stderr b/src/test/ui/error-codes/E0607.stderr
new file mode 100644 (file)
index 0000000..5dfe6ad
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0607]: cannot cast thin pointer `*const u8` to fat pointer `*const [u8]`
+  --> $DIR/E0607.rs:13:5
+   |
+13 |     v as *const [u8]; //~ ERROR E0607
+   |     ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0608.rs b/src/test/ui/error-codes/E0608.rs
new file mode 100644 (file)
index 0000000..d47356a
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    0u8[2]; //~ ERROR E0608
+}
diff --git a/src/test/ui/error-codes/E0608.stderr b/src/test/ui/error-codes/E0608.stderr
new file mode 100644 (file)
index 0000000..ab75fe8
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0608]: cannot index into a value of type `u8`
+  --> $DIR/E0608.rs:12:5
+   |
+12 |     0u8[2]; //~ ERROR E0608
+   |     ^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0609.rs b/src/test/ui/error-codes/E0609.rs
new file mode 100644 (file)
index 0000000..ddfd9d5
--- /dev/null
@@ -0,0 +1,22 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo {
+    x: u32,
+}
+struct Bar;
+
+fn main() {
+    let x = Foo { x: 0 };
+    let _ = x.foo; //~ ERROR E0609
+
+    let y = Bar;
+    y.1; //~ ERROR E0609
+}
diff --git a/src/test/ui/error-codes/E0609.stderr b/src/test/ui/error-codes/E0609.stderr
new file mode 100644 (file)
index 0000000..561164c
--- /dev/null
@@ -0,0 +1,16 @@
+error[E0609]: no field `foo` on type `Foo`
+  --> $DIR/E0609.rs:18:15
+   |
+18 |     let _ = x.foo; //~ ERROR E0609
+   |               ^^^ unknown field
+   |
+   = note: available fields are: `x`
+
+error[E0609]: no field `1` on type `Bar`
+  --> $DIR/E0609.rs:21:5
+   |
+21 |     y.1; //~ ERROR E0609
+   |     ^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0610.rs b/src/test/ui/error-codes/E0610.rs
new file mode 100644 (file)
index 0000000..522d8b0
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let x = 0;
+    let _ = x.foo; //~ ERROR E0610
+}
diff --git a/src/test/ui/error-codes/E0610.stderr b/src/test/ui/error-codes/E0610.stderr
new file mode 100644 (file)
index 0000000..351e920
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
+  --> $DIR/E0610.rs:13:15
+   |
+13 |     let _ = x.foo; //~ ERROR E0610
+   |               ^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0611.rs b/src/test/ui/error-codes/E0611.rs
new file mode 100644 (file)
index 0000000..1e392d1
--- /dev/null
@@ -0,0 +1,22 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod a {
+    pub struct Foo(u32);
+
+    impl Foo {
+        pub fn new() -> Foo { Foo(0) }
+    }
+}
+
+fn main() {
+   let y = a::Foo::new();
+   y.0; //~ ERROR E0611
+}
diff --git a/src/test/ui/error-codes/E0611.stderr b/src/test/ui/error-codes/E0611.stderr
new file mode 100644 (file)
index 0000000..33fe78b
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0611]: field `0` of tuple-struct `a::Foo` is private
+  --> $DIR/E0611.rs:21:4
+   |
+21 |    y.0; //~ ERROR E0611
+   |    ^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0612.rs b/src/test/ui/error-codes/E0612.rs
new file mode 100644 (file)
index 0000000..429a8bb
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo(u32);
+
+fn main() {
+   let y = Foo(0);
+   y.1; //~ ERROR E0612
+}
diff --git a/src/test/ui/error-codes/E0612.stderr b/src/test/ui/error-codes/E0612.stderr
new file mode 100644 (file)
index 0000000..21fdaf8
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0612]: attempted out-of-bounds tuple index `1` on type `Foo`
+  --> $DIR/E0612.rs:15:4
+   |
+15 |    y.1; //~ ERROR E0612
+   |    ^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0614.rs b/src/test/ui/error-codes/E0614.rs
new file mode 100644 (file)
index 0000000..909f0eb
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let y = 0u32;
+    *y; //~ ERROR E0614
+}
diff --git a/src/test/ui/error-codes/E0614.stderr b/src/test/ui/error-codes/E0614.stderr
new file mode 100644 (file)
index 0000000..242cc36
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0614]: type `u32` cannot be dereferenced
+  --> $DIR/E0614.rs:13:5
+   |
+13 |     *y; //~ ERROR E0614
+   |     ^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0615.rs b/src/test/ui/error-codes/E0615.rs
new file mode 100644 (file)
index 0000000..abfa93d
--- /dev/null
@@ -0,0 +1,22 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo {
+    x: u32,
+}
+
+impl Foo {
+    fn method(&self) {}
+}
+
+fn main() {
+    let f = Foo { x: 0 };
+    f.method; //~ ERROR E0615
+}
diff --git a/src/test/ui/error-codes/E0615.stderr b/src/test/ui/error-codes/E0615.stderr
new file mode 100644 (file)
index 0000000..fb3f926
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0615]: attempted to take value of method `method` on type `Foo`
+  --> $DIR/E0615.rs:21:7
+   |
+21 |     f.method; //~ ERROR E0615
+   |       ^^^^^^
+   |
+   = help: maybe a `()` to call it is missing?
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0616.rs b/src/test/ui/error-codes/E0616.rs
new file mode 100644 (file)
index 0000000..2fd9f94
--- /dev/null
@@ -0,0 +1,24 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod a {
+    pub struct Foo {
+        x: u32,
+    }
+
+    impl Foo {
+        pub fn new() -> Foo { Foo { x: 0 } }
+    }
+}
+
+fn main() {
+    let f = a::Foo::new();
+    f.x; //~ ERROR E0616
+}
diff --git a/src/test/ui/error-codes/E0616.stderr b/src/test/ui/error-codes/E0616.stderr
new file mode 100644 (file)
index 0000000..1dccd06
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0616]: field `x` of struct `a::Foo` is private
+  --> $DIR/E0616.rs:23:5
+   |
+23 |     f.x; //~ ERROR E0616
+   |     ^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0617.rs b/src/test/ui/error-codes/E0617.rs
new file mode 100644 (file)
index 0000000..9375fd9
--- /dev/null
@@ -0,0 +1,38 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-tidy-linelength
+
+extern {
+    fn printf(c: *const i8, ...);
+}
+
+fn main() {
+    unsafe {
+        printf(::std::ptr::null(), 0f32);
+        //~^ ERROR can't pass `f32` to variadic function
+        //~| HELP cast the value to `c_double`
+        printf(::std::ptr::null(), 0i8);
+        //~^ ERROR can't pass `i8` to variadic function
+        //~| HELP cast the value to `c_int`
+        printf(::std::ptr::null(), 0i16);
+        //~^ ERROR can't pass `i16` to variadic function
+        //~| HELP cast the value to `c_int`
+        printf(::std::ptr::null(), 0u8);
+        //~^ ERROR can't pass `u8` to variadic function
+        //~| HELP cast the value to `c_uint`
+        printf(::std::ptr::null(), 0u16);
+        //~^ ERROR can't pass `u16` to variadic function
+        //~| HELP cast the value to `c_uint`
+        printf(::std::ptr::null(), printf);
+        //~^ ERROR can't pass `unsafe extern "C" fn(*const i8, ...) {printf}` to variadic function
+        //~| HELP cast the value to `unsafe extern "C" fn(*const i8, ...)`
+    }
+}
diff --git a/src/test/ui/error-codes/E0617.stderr b/src/test/ui/error-codes/E0617.stderr
new file mode 100644 (file)
index 0000000..49d6353
--- /dev/null
@@ -0,0 +1,42 @@
+error[E0617]: can't pass `f32` to variadic function
+  --> $DIR/E0617.rs:19:36
+   |
+19 |         printf(::std::ptr::null(), 0f32);
+   |                                    ^^^^ help: cast the value to `c_double`: `0f32 as c_double`
+
+error[E0617]: can't pass `i8` to variadic function
+  --> $DIR/E0617.rs:22:36
+   |
+22 |         printf(::std::ptr::null(), 0i8);
+   |                                    ^^^ help: cast the value to `c_int`: `0i8 as c_int`
+
+error[E0617]: can't pass `i16` to variadic function
+  --> $DIR/E0617.rs:25:36
+   |
+25 |         printf(::std::ptr::null(), 0i16);
+   |                                    ^^^^ help: cast the value to `c_int`: `0i16 as c_int`
+
+error[E0617]: can't pass `u8` to variadic function
+  --> $DIR/E0617.rs:28:36
+   |
+28 |         printf(::std::ptr::null(), 0u8);
+   |                                    ^^^ help: cast the value to `c_uint`: `0u8 as c_uint`
+
+error[E0617]: can't pass `u16` to variadic function
+  --> $DIR/E0617.rs:31:36
+   |
+31 |         printf(::std::ptr::null(), 0u16);
+   |                                    ^^^^ help: cast the value to `c_uint`: `0u16 as c_uint`
+
+error[E0617]: can't pass `unsafe extern "C" fn(*const i8, ...) {printf}` to variadic function
+  --> $DIR/E0617.rs:34:36
+   |
+34 |         printf(::std::ptr::null(), printf);
+   |                                    ^^^^^^
+help: cast the value to `unsafe extern "C" fn(*const i8, ...)`
+   |
+34 |         printf(::std::ptr::null(), printf as unsafe extern "C" fn(*const i8, ...));
+   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 6 previous errors
+
diff --git a/src/test/ui/error-codes/E0618.rs b/src/test/ui/error-codes/E0618.rs
new file mode 100644 (file)
index 0000000..f46bdb9
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum X {
+    Entry,
+}
+
+fn main() {
+    X::Entry();
+    //~^ ERROR expected function, found enum variant `X::Entry` [E0618]
+    let x = 0i32;
+    x();
+    //~^ ERROR expected function, found `i32` [E0618]
+}
diff --git a/src/test/ui/error-codes/E0618.stderr b/src/test/ui/error-codes/E0618.stderr
new file mode 100644 (file)
index 0000000..8702437
--- /dev/null
@@ -0,0 +1,23 @@
+error[E0618]: expected function, found enum variant `X::Entry`
+  --> $DIR/E0618.rs:16:5
+   |
+12 |     Entry,
+   |     ----- `X::Entry` defined here
+...
+16 |     X::Entry();
+   |     ^^^^^^^^^^ not a function
+help: `X::Entry` is a unit variant, you need to write it without the parenthesis
+   |
+16 |     X::Entry;
+   |     ^^^^^^^^
+
+error[E0618]: expected function, found `i32`
+  --> $DIR/E0618.rs:19:5
+   |
+18 |     let x = 0i32;
+   |         - `i32` defined here
+19 |     x();
+   |     ^^^ not a function
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0619.rs b/src/test/ui/error-codes/E0619.rs
new file mode 100644 (file)
index 0000000..a5a5ff7
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let x;
+
+    match x {
+        (..) => {} //~ ERROR E0619
+        _ => {}
+    }
+}
+
diff --git a/src/test/ui/error-codes/E0619.stderr b/src/test/ui/error-codes/E0619.stderr
new file mode 100644 (file)
index 0000000..cec336c
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0619]: the type of this value must be known in this context
+  --> $DIR/E0619.rs:15:9
+   |
+15 |         (..) => {} //~ ERROR E0619
+   |         ^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0620.rs b/src/test/ui/error-codes/E0620.rs
new file mode 100644 (file)
index 0000000..5e945df
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let _foo = &[1_usize, 2] as [usize]; //~ ERROR E0620
+}
diff --git a/src/test/ui/error-codes/E0620.stderr b/src/test/ui/error-codes/E0620.stderr
new file mode 100644 (file)
index 0000000..564a947
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0620]: cast to unsized type: `&[usize; 2]` as `[usize]`
+  --> $DIR/E0620.rs:12:16
+   |
+12 |     let _foo = &[1_usize, 2] as [usize]; //~ ERROR E0620
+   |                ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: consider using an implicit coercion to `&[usize]` instead
+  --> $DIR/E0620.rs:12:16
+   |
+12 |     let _foo = &[1_usize, 2] as [usize]; //~ ERROR E0620
+   |                ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.rs b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.rs
new file mode 100644 (file)
index 0000000..980461b
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that we give the generic E0495 when one of the free regions is
+// bound in a closure (rather than suggesting a change to the signature
+// of the closure, which is not specified in `foo` but rather in `invoke`).
+
+// FIXME - This might be better as a UI test, but the finer details
+// of the error seem to vary on different machines.
+fn invoke<'a, F>(x: &'a i32, f: F) -> &'a i32
+where F: FnOnce(&'a i32, &i32) -> &'a i32
+{
+    let y = 22;
+    f(x, &y)
+}
+
+fn foo<'a>(x: &'a i32) {
+    invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495
+}
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.stderr b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.stderr
new file mode 100644 (file)
index 0000000..c529a83
--- /dev/null
@@ -0,0 +1,29 @@
+error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
+  --> $DIR/E0621-does-not-trigger-for-closures.rs:25:5
+   |
+25 |     invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495
+   |     ^^^^^^
+   |
+note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 25:16...
+  --> $DIR/E0621-does-not-trigger-for-closures.rs:25:16
+   |
+25 |     invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495
+   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: ...so that reference does not outlive borrowed content
+  --> $DIR/E0621-does-not-trigger-for-closures.rs:25:45
+   |
+25 |     invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495
+   |                                             ^
+note: but, the lifetime must be valid for the call at 25:5...
+  --> $DIR/E0621-does-not-trigger-for-closures.rs:25:5
+   |
+25 |     invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: ...so type `&i32` of expression is valid during the expression
+  --> $DIR/E0621-does-not-trigger-for-closures.rs:25:5
+   |
+25 |     invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0622.rs b/src/test/ui/error-codes/E0622.rs
new file mode 100644 (file)
index 0000000..f2bde5b
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(intrinsics)]
+extern "rust-intrinsic" {
+    pub static breakpoint : unsafe extern "rust-intrinsic" fn();
+    //~^ ERROR intrinsic must be a function [E0622]
+}
+fn main() { unsafe { breakpoint(); } }
diff --git a/src/test/ui/error-codes/E0622.stderr b/src/test/ui/error-codes/E0622.stderr
new file mode 100644 (file)
index 0000000..977f44a
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0622]: intrinsic must be a function
+  --> $DIR/E0622.rs:13:5
+   |
+13 |     pub static breakpoint : unsafe extern "rust-intrinsic" fn();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected a function
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0624.rs b/src/test/ui/error-codes/E0624.rs
new file mode 100644 (file)
index 0000000..952e0b3
--- /dev/null
@@ -0,0 +1,22 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod inner {
+    pub struct Foo;
+
+    impl Foo {
+        fn method(&self) {}
+    }
+}
+
+fn main() {
+    let foo = inner::Foo;
+    foo.method(); //~ ERROR method `method` is private [E0624]
+}
diff --git a/src/test/ui/error-codes/E0624.stderr b/src/test/ui/error-codes/E0624.stderr
new file mode 100644 (file)
index 0000000..0afb05a
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0624]: method `method` is private
+  --> $DIR/E0624.rs:21:9
+   |
+21 |     foo.method(); //~ ERROR method `method` is private [E0624]
+   |         ^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0637.rs b/src/test/ui/error-codes/E0637.rs
new file mode 100644 (file)
index 0000000..455529b
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+#![feature(underscore_lifetimes)]
+
+struct Foo<'a: '_>(&'a u8); //~ ERROR invalid lifetime bound name: `'_`
+fn foo<'a: '_>(_: &'a u8) {} //~ ERROR invalid lifetime bound name: `'_`
+
+struct Bar<'a>(&'a u8);
+impl<'a: '_> Bar<'a> { //~ ERROR invalid lifetime bound name: `'_`
+  fn bar() {}
+}
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0637.stderr b/src/test/ui/error-codes/E0637.stderr
new file mode 100644 (file)
index 0000000..e314afd
--- /dev/null
@@ -0,0 +1,20 @@
+error[E0637]: invalid lifetime bound name: `'_`
+  --> $DIR/E0637.rs:12:16
+   |
+12 | struct Foo<'a: '_>(&'a u8); //~ ERROR invalid lifetime bound name: `'_`
+   |                ^^ `'_` is a reserved lifetime name
+
+error[E0637]: invalid lifetime bound name: `'_`
+  --> $DIR/E0637.rs:13:12
+   |
+13 | fn foo<'a: '_>(_: &'a u8) {} //~ ERROR invalid lifetime bound name: `'_`
+   |            ^^ `'_` is a reserved lifetime name
+
+error[E0637]: invalid lifetime bound name: `'_`
+  --> $DIR/E0637.rs:16:10
+   |
+16 | impl<'a: '_> Bar<'a> { //~ ERROR invalid lifetime bound name: `'_`
+   |          ^^ `'_` is a reserved lifetime name
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/error-codes/E0657.rs b/src/test/ui/error-codes/E0657.rs
new file mode 100644 (file)
index 0000000..4595e41
--- /dev/null
@@ -0,0 +1,36 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+#![allow(warnings)]
+#![feature(conservative_impl_trait, nested_impl_trait)]
+
+trait Id<T> {}
+trait Lt<'a> {}
+
+impl<'a> Lt<'a> for () {}
+impl<T> Id<T> for T {}
+
+fn free_fn_capture_hrtb_in_impl_trait()
+    -> impl for<'a> Id<impl Lt<'a>>
+        //~^ ERROR `impl Trait` can only capture lifetimes bound at the fn or impl level [E0657]
+{
+    ()
+}
+
+struct Foo;
+impl Foo {
+    fn impl_fn_capture_hrtb_in_impl_trait()
+        -> impl for<'a> Id<impl Lt<'a>>
+            //~^ ERROR `impl Trait` can only capture lifetimes bound at the fn or impl level
+    {
+        ()
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0657.stderr b/src/test/ui/error-codes/E0657.stderr
new file mode 100644 (file)
index 0000000..d3b53d3
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0657]: `impl Trait` can only capture lifetimes bound at the fn or impl level
+  --> $DIR/E0657.rs:20:32
+   |
+20 |     -> impl for<'a> Id<impl Lt<'a>>
+   |                                ^^
+
+error[E0657]: `impl Trait` can only capture lifetimes bound at the fn or impl level
+  --> $DIR/E0657.rs:29:36
+   |
+29 |         -> impl for<'a> Id<impl Lt<'a>>
+   |                                    ^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0658.rs b/src/test/ui/error-codes/E0658.rs
new file mode 100644 (file)
index 0000000..d30068e
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let _ = ::std::u128::MAX; //~ ERROR E0658
+}
diff --git a/src/test/ui/error-codes/E0658.stderr b/src/test/ui/error-codes/E0658.stderr
new file mode 100644 (file)
index 0000000..c18d809
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0658]: use of unstable library feature 'i128' (see issue #35118)
+  --> $DIR/E0658.rs:12:13
+   |
+12 |     let _ = ::std::u128::MAX; //~ ERROR E0658
+   |             ^^^^^^^^^^^^^^^^
+   |
+   = help: add #![feature(i128)] to the crate attributes to enable
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0659.rs b/src/test/ui/error-codes/E0659.rs
new file mode 100644 (file)
index 0000000..4bd452b
--- /dev/null
@@ -0,0 +1,26 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod moon {
+    pub fn foo() {}
+}
+
+mod earth {
+    pub fn foo() {}
+}
+
+mod collider {
+    pub use moon::*;
+    pub use earth::*;
+}
+
+fn main() {
+    collider::foo(); //~ ERROR E0659
+}
diff --git a/src/test/ui/error-codes/E0659.stderr b/src/test/ui/error-codes/E0659.stderr
new file mode 100644 (file)
index 0000000..c2410e2
--- /dev/null
@@ -0,0 +1,20 @@
+error[E0659]: `foo` is ambiguous
+  --> $DIR/E0659.rs:25:5
+   |
+25 |     collider::foo(); //~ ERROR E0659
+   |     ^^^^^^^^^^^^^
+   |
+note: `foo` could refer to the name imported here
+  --> $DIR/E0659.rs:20:13
+   |
+20 |     pub use moon::*;
+   |             ^^^^^^^
+note: `foo` could also refer to the name imported here
+  --> $DIR/E0659.rs:21:13
+   |
+21 |     pub use earth::*;
+   |             ^^^^^^^^
+   = note: consider adding an explicit import of `foo` to disambiguate
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/feature-gate-macro_at_most_once_rep.rs b/src/test/ui/feature-gate-macro_at_most_once_rep.rs
new file mode 100644 (file)
index 0000000..19f5aca
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that `?` macro Kleene operator can not be used when the `macro_at_most_once_rep` feature
+// gate is not used.
+
+macro_rules! m { ($(a)?) => {} }
+//~^ ERROR Using the `?` macro Kleene operator for "at most one" repetition is unstable
+
+fn main() {
+    m!();
+}
diff --git a/src/test/ui/feature-gate-macro_at_most_once_rep.stderr b/src/test/ui/feature-gate-macro_at_most_once_rep.stderr
new file mode 100644 (file)
index 0000000..02dbab0
--- /dev/null
@@ -0,0 +1,10 @@
+error[E0658]: Using the `?` macro Kleene operator for "at most one" repetition is unstable (see issue #48075)
+  --> $DIR/feature-gate-macro_at_most_once_rep.rs:14:20
+   |
+14 | macro_rules! m { ($(a)?) => {} }
+   |                    ^^^
+   |
+   = help: add #![feature(macro_at_most_once_rep)] to the crate attributes to enable
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/invalid-variadic-function.rs b/src/test/ui/invalid-variadic-function.rs
new file mode 100644 (file)
index 0000000..3d421e0
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+extern "C" fn foo(x: u8, ...);
+//~^ ERROR only foreign functions are allowed to be variadic
+//~| ERROR expected one of `->`, `where`, or `{`, found `;`
diff --git a/src/test/ui/invalid-variadic-function.stderr b/src/test/ui/invalid-variadic-function.stderr
new file mode 100644 (file)
index 0000000..15a908b
--- /dev/null
@@ -0,0 +1,14 @@
+error: only foreign functions are allowed to be variadic
+  --> $DIR/invalid-variadic-function.rs:11:26
+   |
+11 | extern "C" fn foo(x: u8, ...);
+   |                          ^^^
+
+error: expected one of `->`, `where`, or `{`, found `;`
+  --> $DIR/invalid-variadic-function.rs:11:30
+   |
+11 | extern "C" fn foo(x: u8, ...);
+   |                              ^ expected one of `->`, `where`, or `{` here
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/recursive-requirements.rs b/src/test/ui/recursive-requirements.rs
new file mode 100644 (file)
index 0000000..2c0f033
--- /dev/null
@@ -0,0 +1,27 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::marker::PhantomData;
+
+struct AssertSync<T: Sync>(PhantomData<T>);
+
+pub struct Foo {
+    bar: *const Bar,
+    phantom: PhantomData<Bar>,
+}
+
+pub struct Bar {
+    foo: *const Foo,
+    phantom: PhantomData<Foo>,
+}
+
+fn main() {
+    let _: AssertSync<Foo> = unimplemented!(); //~ ERROR E0275
+}
diff --git a/src/test/ui/recursive-requirements.stderr b/src/test/ui/recursive-requirements.stderr
new file mode 100644 (file)
index 0000000..8cf2c65
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0275]: overflow evaluating the requirement `Foo: std::marker::Sync`
+  --> $DIR/recursive-requirements.rs:26:12
+   |
+26 |     let _: AssertSync<Foo> = unimplemented!(); //~ ERROR E0275
+   |            ^^^^^^^^^^^^^^^
+   |
+   = help: consider adding a `#![recursion_limit="128"]` attribute to your crate
+   = note: required because it appears within the type `std::marker::PhantomData<Foo>`
+   = note: required because it appears within the type `Bar`
+   = note: required because it appears within the type `std::marker::PhantomData<Bar>`
+   = note: required because it appears within the type `Foo`
+
+error: aborting due to previous error
+
index 1d8816c7db132d95d78b728e0fdccdf536aaa14c..486c0d81e3f407d0c3424cd049f3ea21df3e025a 100644 (file)
@@ -58,9 +58,12 @@ pub fn read2(mut out_pipe: ChildStdout,
         fds[0].events = libc::POLLIN;
         fds[1].fd = err_pipe.as_raw_fd();
         fds[1].events = libc::POLLIN;
-        loop {
+        let mut nfds = 2;
+        let mut errfd = 1;
+
+        while nfds > 0 {
             // wait for either pipe to become readable using `select`
-            let r = unsafe { libc::poll(fds.as_mut_ptr(), 2, -1) };
+            let r = unsafe { libc::poll(fds.as_mut_ptr(), nfds, -1) };
             if r == -1 {
                 let err = io::Error::last_os_error();
                 if err.kind() == io::ErrorKind::Interrupted {
@@ -86,19 +89,20 @@ pub fn read2(mut out_pipe: ChildStdout,
                     }
                 }
             };
-            if !out_done && fds[0].revents != 0 && handle(out_pipe.read_to_end(&mut out))? {
-                out_done = true;
-            }
-            data(true, &mut out, out_done);
-            if !err_done && fds[1].revents != 0 && handle(err_pipe.read_to_end(&mut err))? {
+            if !err_done && fds[errfd].revents != 0 && handle(err_pipe.read_to_end(&mut err))? {
                 err_done = true;
+                nfds -= 1;
             }
             data(false, &mut err, err_done);
-
-            if out_done && err_done {
-                return Ok(())
+            if !out_done && fds[0].revents != 0 && handle(out_pipe.read_to_end(&mut out))? {
+                out_done = true;
+                fds[0].fd = err_pipe.as_raw_fd();
+                errfd = 0;
+                nfds -= 1;
             }
+            data(true, &mut out, out_done);
         }
+        Ok(())
     }
 }
 
index a3b6d16270bb59f38d94ef861732c867e8572426..c0f82d56d80312963b149f5726656d0e7989fe4c 100644 (file)
@@ -250,6 +250,7 @@ fn check_if_test_should_compile(&self, proc_res: &ProcRes) {
     fn run_cfail_test(&self) {
         let proc_res = self.compile_test();
         self.check_if_test_should_compile(&proc_res);
+        self.check_no_compiler_crash(&proc_res);
 
         let output_to_check = self.get_output(&proc_res);
         let expected_errors = errors::load_errors(&self.testpaths.file, self.revision);
@@ -262,7 +263,6 @@ fn run_cfail_test(&self) {
             self.check_error_patterns(&output_to_check, &proc_res);
         }
 
-        self.check_no_compiler_crash(&proc_res);
         self.check_forbid_output(&output_to_check, &proc_res);
     }
 
@@ -1344,7 +1344,7 @@ fn document(&self, out_dir: &Path) -> ProcRes {
     fn exec_compiled_test(&self) -> ProcRes {
         let env = &self.props.exec_env;
 
-        match &*self.config.target {
+        let proc_res = match &*self.config.target {
             // This is pretty similar to below, we're transforming:
             //
             //      program arg1 arg2
@@ -1399,7 +1399,15 @@ fn exec_compiled_test(&self) -> ProcRes {
                     None,
                 )
             }
+        };
+
+        if proc_res.status.success() {
+            // delete the executable after running it to save space.
+            // it is ok if the deletion failed.
+            let _ = fs::remove_file(self.make_exe_name());
         }
+
+        proc_res
     }
 
     /// For each `aux-build: foo/bar` annotation, we check to find the
index dee42bda8156a28ead609080e27b02173bb9c29e..f01491115e821e10217574ad4091b08015b7b1c8 160000 (submodule)
@@ -1 +1 @@
-Subproject commit dee42bda8156a28ead609080e27b02173bb9c29e
+Subproject commit f01491115e821e10217574ad4091b08015b7b1c8
index 159c9e035b7a28ab3e24d6bfb3536d580a54b97e..4dedf6bfe779bccb906eb8549fe00d6304136c4d 100644 (file)
@@ -41,6 +41,7 @@
     "fuchsia-zircon", // BSD-3-Clause, rustdoc, rustc, cargo (jobserver & tempdir)
     "cssparser-macros", // MPL-2.0, rustdoc
     "selectors", // MPL-2.0, rustdoc
+    "clippy_lints", // MPL-2.0 rls
 ];
 
 pub fn check(path: &Path, bad: &mut bool) {