From 7fd15f09008dd72f40d76a5bebb60e3991095a5f Mon Sep 17 00:00:00 2001 From: Caio Date: Sat, 6 Nov 2021 15:35:20 -0300 Subject: Move some tests to more reasonable directories --- src/test/ui/argument-passing.rs | 25 - src/test/ui/array-slice-vec/mut-vstore-expr.rs | 6 + src/test/ui/associated-types/issue-22066.rs | 12 + src/test/ui/associated-types/issue-22828.rs | 23 + src/test/ui/associated-types/issue-28871.rs | 24 + src/test/ui/associated-types/issue-47139-1.rs | 78 +++ src/test/ui/associated-types/issue-54467.rs | 46 ++ src/test/ui/async-await/issue-73541-1.rs | 12 + src/test/ui/async-await/issue-73541-1.stderr | 14 + src/test/ui/attributes/issue-40962.rs | 11 + .../ui/attributes/unrestricted-attribute-tokens.rs | 8 + src/test/ui/auxiliary/changing-crates-a1.rs | 3 - src/test/ui/auxiliary/changing-crates-a2.rs | 3 - src/test/ui/auxiliary/changing-crates-b.rs | 5 - src/test/ui/auxiliary/legacy-const-generics.rs | 6 - src/test/ui/auxiliary/lto-duplicate-symbols1.rs | 6 - src/test/ui/auxiliary/lto-duplicate-symbols2.rs | 6 - .../ui/auxiliary/lto-rustc-loads-linker-plugin.rs | 6 - src/test/ui/auxiliary/nested_item.rs | 30 - src/test/ui/bastion-of-the-turbofish.rs | 43 -- src/test/ui/binop/structured-compare.rs | 30 + src/test/ui/borrowck/issue-46095.rs | 30 + src/test/ui/box/new-box.rs | 30 + src/test/ui/c-variadic/issue-32201.rs | 13 + src/test/ui/c-variadic/issue-32201.stderr | 9 + src/test/ui/cast/supported-cast.rs | 206 +++++++ src/test/ui/changing-crates.rs | 12 - src/test/ui/changing-crates.stderr | 13 - src/test/ui/closures/issue-10398.rs | 11 + src/test/ui/closures/issue-10398.stderr | 13 + src/test/ui/closures/issue-42463.rs | 32 ++ src/test/ui/coercion/auxiliary/issue-39823.rs | 7 + src/test/ui/coercion/issue-14589.rs | 24 + src/test/ui/coercion/issue-39823.rs | 25 + src/test/ui/coercion/issue-73886.rs | 6 + src/test/ui/coercion/issue-73886.stderr | 17 + src/test/ui/conditional-compilation/issue-34028.rs | 10 + .../auxiliary/legacy-const-generics.rs | 6 + .../ui/const-generics/legacy-const-generics-bad.rs | 16 + .../legacy-const-generics-bad.stderr | 20 + .../ui/const-generics/legacy-const-generics.rs | 18 + src/test/ui/consts/issue-13902.rs | 16 + src/test/ui/consts/issue-17074.rs | 15 + src/test/ui/consts/issue-18294.rs | 5 + src/test/ui/consts/issue-18294.stderr | 11 + .../ui/consts/issue-23968-const-not-overflow.rs | 12 + src/test/ui/consts/issue-37550-1.rs | 6 + src/test/ui/consts/issue-37550-1.stderr | 12 + src/test/ui/consts/issue-37991.rs | 17 + src/test/ui/deprecation/try-macro-suggestion.rs | 9 + .../ui/deprecation/try-macro-suggestion.stderr | 31 + src/test/ui/deriving/issue-19358.rs | 23 + src/test/ui/deriving/issue-58319.rs | 621 +++++++++++++++++++++ src/test/ui/diverging-tuple-parts-39485.rs | 15 - src/test/ui/diverging-tuple-parts-39485.stderr | 32 -- src/test/ui/drop/issue-35546.rs | 20 + src/test/ui/drop/terminate-in-initializer.rs | 33 ++ .../dropck/issue-28498-ugeh-with-passed-to-fn.rs | 46 ++ src/test/ui/editions-crate-root-2015.rs | 21 - src/test/ui/editions-crate-root-2015.stderr | 28 - src/test/ui/editions/epoch-gate-feature.rs | 15 + src/test/ui/enum-discriminant/issue-51582.rs | 18 + src/test/ui/enum/issue-42747.rs | 46 ++ src/test/ui/epoch-gate-feature.rs | 15 - src/test/ui/extern/issue-28324.mir.stderr | 11 + src/test/ui/extern/issue-28324.rs | 11 + src/test/ui/extern/issue-28324.thir.stderr | 11 + src/test/ui/for-loop-while/issue-51345.rs | 8 + src/test/ui/for-loop-while/long-while.rs | 12 + src/test/ui/foreign/nil-decl-in-foreign.rs | 14 + src/test/ui/generics/issue-1112.rs | 37 ++ src/test/ui/generics/issue-333.rs | 7 + src/test/ui/generics/issue-59508-1.rs | 17 + src/test/ui/generics/issue-59508-1.stderr | 8 + src/test/ui/generics/issue-59508.fixed | 16 + src/test/ui/generics/issue-59508.rs | 16 + src/test/ui/generics/issue-59508.stderr | 8 + .../ui/higher-rank-trait-bounds/issue-60283.rs | 20 + .../ui/higher-rank-trait-bounds/issue-60283.stderr | 42 ++ src/test/ui/hygiene/lambda-var-hygiene.rs | 12 + src/test/ui/impl-trait/issue-49579.rs | 14 + src/test/ui/impl-trait/issue-49685.rs | 13 + src/test/ui/impl-trait/issue-51185.rs | 8 + src/test/ui/in-band-lifetimes.rs | 96 ---- src/test/ui/in-band-lifetimes/in-band-lifetimes.rs | 96 ++++ .../ui/inference/lub-glb-with-unbound-infer-var.rs | 15 + src/test/ui/issues/auxiliary/issue-19163.rs | 6 - src/test/ui/issues/auxiliary/issue-39823.rs | 7 - .../ui/issues/auxiliary/xcrate-issue-43189-a.rs | 7 - .../ui/issues/auxiliary/xcrate-issue-43189-b.rs | 3 - .../auxiliary/xcrate-issue-46112-rexport-core.rs | 3 - .../ui/issues/auxiliary/xcrate-issue-61711-b.rs | 5 - src/test/ui/issues/issue-10398.rs | 11 - src/test/ui/issues/issue-10398.stderr | 13 - src/test/ui/issues/issue-1112.rs | 37 -- src/test/ui/issues/issue-11577.rs | 18 - src/test/ui/issues/issue-11940.rs | 11 - src/test/ui/issues/issue-12796.rs | 9 - src/test/ui/issues/issue-12796.stderr | 12 - src/test/ui/issues/issue-13483.rs | 17 - src/test/ui/issues/issue-13483.stderr | 33 -- src/test/ui/issues/issue-13902.rs | 16 - src/test/ui/issues/issue-14227.mir.stderr | 11 - src/test/ui/issues/issue-14227.rs | 10 - src/test/ui/issues/issue-14227.thir.stderr | 11 - src/test/ui/issues/issue-14456.rs | 37 -- src/test/ui/issues/issue-14589.rs | 24 - src/test/ui/issues/issue-14837.rs | 11 - src/test/ui/issues/issue-15080.rs | 22 - src/test/ui/issues/issue-16098.rs | 16 - src/test/ui/issues/issue-16098.stderr | 14 - src/test/ui/issues/issue-16272.rs | 23 - src/test/ui/issues/issue-17074.rs | 15 - src/test/ui/issues/issue-18060.rs | 8 - src/test/ui/issues/issue-18294.rs | 5 - src/test/ui/issues/issue-18294.stderr | 11 - src/test/ui/issues/issue-18652.rs | 10 - src/test/ui/issues/issue-19163.rs | 11 - src/test/ui/issues/issue-19163.stderr | 11 - src/test/ui/issues/issue-19358.rs | 23 - src/test/ui/issues/issue-19660.rs | 15 - src/test/ui/issues/issue-19660.stderr | 4 - src/test/ui/issues/issue-20091.rs | 24 - src/test/ui/issues/issue-20616-4.rs | 35 -- src/test/ui/issues/issue-20616-4.stderr | 8 - src/test/ui/issues/issue-20616-5.rs | 35 -- src/test/ui/issues/issue-20616-5.stderr | 8 - src/test/ui/issues/issue-20616-6.rs | 35 -- src/test/ui/issues/issue-20616-6.stderr | 8 - src/test/ui/issues/issue-20616-7.rs | 35 -- src/test/ui/issues/issue-20616-7.stderr | 8 - src/test/ui/issues/issue-20823.rs | 5 - src/test/ui/issues/issue-21356.rs | 6 - src/test/ui/issues/issue-21356.stderr | 10 - src/test/ui/issues/issue-21475.rs | 19 - src/test/ui/issues/issue-21520.rs | 22 - src/test/ui/issues/issue-22066.rs | 12 - src/test/ui/issues/issue-22463.rs | 20 - src/test/ui/issues/issue-22828.rs | 23 - src/test/ui/issues/issue-23458.rs | 12 - src/test/ui/issues/issue-23458.stderr | 20 - src/test/ui/issues/issue-23716.rs | 17 - src/test/ui/issues/issue-23716.stderr | 21 - .../ui/issues/issue-23968-const-not-overflow.rs | 12 - src/test/ui/issues/issue-24010.rs | 14 - src/test/ui/issues/issue-24313.rs | 32 -- src/test/ui/issues/issue-2444.rs | 17 - src/test/ui/issues/issue-26251.rs | 15 - src/test/ui/issues/issue-26448-1.rs | 13 - src/test/ui/issues/issue-26448-2.rs | 21 - src/test/ui/issues/issue-26448-3.rs | 25 - src/test/ui/issues/issue-26638.rs | 10 - src/test/ui/issues/issue-26638.stderr | 39 -- src/test/ui/issues/issue-26996.rs | 24 - src/test/ui/issues/issue-2748-b.rs | 11 - src/test/ui/issues/issue-28324.mir.stderr | 11 - src/test/ui/issues/issue-28324.rs | 11 - src/test/ui/issues/issue-28324.thir.stderr | 11 - .../issues/issue-28498-ugeh-with-passed-to-fn.rs | 46 -- src/test/ui/issues/issue-28871.rs | 24 - src/test/ui/issues/issue-29084.rs | 13 - src/test/ui/issues/issue-29084.stderr | 14 - src/test/ui/issues/issue-3021-c.rs | 9 - src/test/ui/issues/issue-3021-c.stderr | 25 - src/test/ui/issues/issue-3021.rs | 18 - src/test/ui/issues/issue-3021.stderr | 11 - src/test/ui/issues/issue-30225.rs | 38 -- src/test/ui/issues/issue-30225.stderr | 9 - src/test/ui/issues/issue-30355.rs | 9 - src/test/ui/issues/issue-30355.stderr | 13 - src/test/ui/issues/issue-31076.rs | 17 - src/test/ui/issues/issue-31076.stderr | 19 - src/test/ui/issues/issue-31804.rs | 6 - src/test/ui/issues/issue-31804.stderr | 8 - src/test/ui/issues/issue-31845.rs | 12 - src/test/ui/issues/issue-31845.stderr | 9 - src/test/ui/issues/issue-3211.rs | 7 - src/test/ui/issues/issue-32201.rs | 13 - src/test/ui/issues/issue-32201.stderr | 9 - src/test/ui/issues/issue-333.rs | 7 - src/test/ui/issues/issue-34028.rs | 10 - src/test/ui/issues/issue-34171.rs | 10 - src/test/ui/issues/issue-34255-1.rs | 10 - src/test/ui/issues/issue-34255-1.stderr | 18 - src/test/ui/issues/issue-35546.rs | 20 - src/test/ui/issues/issue-37175.rs | 5 - src/test/ui/issues/issue-37366.rs | 16 - src/test/ui/issues/issue-37550.rs | 6 - src/test/ui/issues/issue-37550.stderr | 12 - src/test/ui/issues/issue-37991.rs | 17 - src/test/ui/issues/issue-38604.rs | 16 - src/test/ui/issues/issue-38604.stderr | 33 -- src/test/ui/issues/issue-39388.rs | 9 - src/test/ui/issues/issue-39388.stderr | 8 - src/test/ui/issues/issue-3973.rs | 25 - src/test/ui/issues/issue-3973.stderr | 22 - src/test/ui/issues/issue-39823.rs | 25 - src/test/ui/issues/issue-40770.rs | 11 - src/test/ui/issues/issue-40962.rs | 11 - src/test/ui/issues/issue-42463.rs | 32 -- src/test/ui/issues/issue-42679.rs | 22 - src/test/ui/issues/issue-42747.rs | 46 -- src/test/ui/issues/issue-43189.rs | 12 - src/test/ui/issues/issue-43189.stderr | 20 - src/test/ui/issues/issue-4401.rs | 7 - src/test/ui/issues/issue-4448.rs | 16 - src/test/ui/issues/issue-45124.rs | 18 - src/test/ui/issues/issue-45152.rs | 24 - src/test/ui/issues/issue-46095.rs | 30 - src/test/ui/issues/issue-46112.rs | 10 - src/test/ui/issues/issue-46112.stderr | 15 - src/test/ui/issues/issue-47139-1.rs | 78 --- src/test/ui/issues/issue-49040.rs | 3 - src/test/ui/issues/issue-49040.stderr | 15 - src/test/ui/issues/issue-49579.rs | 14 - src/test/ui/issues/issue-49685.rs | 13 - src/test/ui/issues/issue-50731.rs | 6 - src/test/ui/issues/issue-5099.rs | 13 - src/test/ui/issues/issue-5099.stderr | 48 -- src/test/ui/issues/issue-50993.rs | 9 - src/test/ui/issues/issue-50993.stderr | 4 - src/test/ui/issues/issue-51185.rs | 8 - src/test/ui/issues/issue-51345.rs | 8 - src/test/ui/issues/issue-51582.rs | 18 - .../issues/issue-53787-inline-assembler-macro.rs | 27 - .../issue-53787-inline-assembler-macro.stderr | 9 - src/test/ui/issues/issue-54467.rs | 46 -- src/test/ui/issues/issue-56031.rs | 6 - src/test/ui/issues/issue-56031.stderr | 18 - src/test/ui/issues/issue-57410-1.rs | 18 - src/test/ui/issues/issue-57597.rs | 80 --- src/test/ui/issues/issue-57597.stderr | 74 --- src/test/ui/issues/issue-58319.rs | 621 --------------------- src/test/ui/issues/issue-59029-1.rs | 9 - src/test/ui/issues/issue-59029-1.stderr | 15 - src/test/ui/issues/issue-59508-1.rs | 17 - src/test/ui/issues/issue-59508-1.stderr | 8 - src/test/ui/issues/issue-59508.fixed | 16 - src/test/ui/issues/issue-59508.rs | 16 - src/test/ui/issues/issue-59508.stderr | 8 - src/test/ui/issues/issue-60283.rs | 20 - src/test/ui/issues/issue-60283.stderr | 42 -- src/test/ui/issues/issue-60662.rs | 10 - src/test/ui/issues/issue-60662.stdout | 14 - .../issue-61711-once-caused-rustc-inf-loop.rs | 11 - src/test/ui/issues/issue-61882-2.rs | 11 - src/test/ui/issues/issue-61882-2.stderr | 15 - src/test/ui/issues/issue-61882.rs | 9 - src/test/ui/issues/issue-61882.stderr | 18 - src/test/ui/issues/issue-63364.rs | 10 - src/test/ui/issues/issue-63364.stderr | 11 - src/test/ui/issues/issue-6596-1.rs | 10 - src/test/ui/issues/issue-6596-1.stderr | 13 - src/test/ui/issues/issue-6804.rs | 21 - src/test/ui/issues/issue-6804.stderr | 25 - src/test/ui/issues/issue-72455.rs | 27 - src/test/ui/issues/issue-72574-2.rs | 12 - src/test/ui/issues/issue-72574-2.stderr | 37 -- src/test/ui/issues/issue-73541-1.rs | 12 - src/test/ui/issues/issue-73541-1.stderr | 14 - src/test/ui/issues/issue-73886.rs | 6 - src/test/ui/issues/issue-73886.stderr | 17 - src/test/ui/issues/issue-74739.rs | 14 - src/test/ui/issues/issue-811.rs | 26 - src/test/ui/issues/issue-8351-1.rs | 16 - src/test/ui/issues/issue-8351-2.rs | 16 - src/test/ui/issues/issue-86865.rs | 11 - src/test/ui/issues/issue-86865.stderr | 18 - src/test/ui/issues/issue-8827.rs | 53 -- src/test/ui/issues/issue-9396.rs | 23 - src/test/ui/lambda-var-hygiene.rs | 12 - src/test/ui/lang-items/issue-19660.rs | 15 + src/test/ui/lang-items/issue-19660.stderr | 4 + src/test/ui/lang-items/issue-31076.rs | 17 + src/test/ui/lang-items/issue-31076.stderr | 19 + src/test/ui/lang-items/required-lang-item.rs | 11 + src/test/ui/lang-items/required-lang-item.stderr | 4 + src/test/ui/legacy-const-generics-bad.rs | 16 - src/test/ui/legacy-const-generics-bad.stderr | 20 - src/test/ui/legacy-const-generics.rs | 18 - src/test/ui/lifetimes/issue-26638.rs | 10 + src/test/ui/lifetimes/issue-26638.stderr | 39 ++ src/test/ui/lint/issue-14837.rs | 11 + src/test/ui/lint/issue-57410-1.rs | 18 + src/test/ui/lint/issue-63364.rs | 10 + src/test/ui/lint/issue-63364.stderr | 11 + src/test/ui/lint/unnecessary-extern-crate.rs | 71 +++ src/test/ui/lint/unnecessary-extern-crate.stderr | 44 ++ src/test/ui/lint/warn-ctypes-inhibit.rs | 15 + src/test/ui/llvm-asm/issue-23458.rs | 12 + src/test/ui/llvm-asm/issue-23458.stderr | 20 + src/test/ui/llvm-asm/issue-37366.rs | 16 + .../llvm-asm/issue-53787-inline-assembler-macro.rs | 27 + .../issue-53787-inline-assembler-macro.stderr | 9 + src/test/ui/long-while.rs | 12 - src/test/ui/lto-and-no-bitcode-in-rlib.rs | 3 - src/test/ui/lto-and-no-bitcode-in-rlib.stderr | 2 - src/test/ui/lto-duplicate-symbols.rs | 11 - src/test/ui/lto-duplicate-symbols.stderr | 6 - src/test/ui/lto-many-codegen-units.rs | 6 - src/test/ui/lto-opt-level-s.rs | 7 - src/test/ui/lto-opt-level-z.rs | 7 - src/test/ui/lto-rustc-loads-linker-plugin.rs | 17 - src/test/ui/lto-still-runs-thread-dtors.rs | 34 -- src/test/ui/lto-thin-rustc-loads-linker-plugin.rs | 13 - src/test/ui/lto/all-crates.rs | 8 + src/test/ui/lto/auxiliary/dylib.rs | 6 + .../ui/lto/auxiliary/lto-duplicate-symbols1.rs | 6 + .../ui/lto/auxiliary/lto-duplicate-symbols2.rs | 6 + .../lto/auxiliary/lto-rustc-loads-linker-plugin.rs | 6 + src/test/ui/lto/auxiliary/msvc-imp-present.rs | 11 + src/test/ui/lto/auxiliary/thin-lto-inlines-aux.rs | 7 + src/test/ui/lto/dylib-works.rs | 9 + src/test/ui/lto/lto-and-no-bitcode-in-rlib.rs | 3 + src/test/ui/lto/lto-and-no-bitcode-in-rlib.stderr | 2 + src/test/ui/lto/lto-duplicate-symbols.rs | 11 + src/test/ui/lto/lto-duplicate-symbols.stderr | 6 + src/test/ui/lto/lto-many-codegen-units.rs | 6 + src/test/ui/lto/lto-opt-level-s.rs | 7 + src/test/ui/lto/lto-opt-level-z.rs | 7 + src/test/ui/lto/lto-rustc-loads-linker-plugin.rs | 17 + src/test/ui/lto/lto-still-runs-thread-dtors.rs | 34 ++ .../ui/lto/lto-thin-rustc-loads-linker-plugin.rs | 13 + src/test/ui/lto/msvc-imp-present.rs | 22 + src/test/ui/lto/thin-lto-global-allocator.rs | 7 + src/test/ui/lto/thin-lto-inlines.rs | 30 + src/test/ui/lto/thin-lto-inlines2.rs | 28 + src/test/ui/lto/weak-works.rs | 28 + src/test/ui/lub-glb-with-unbound-infer-var.rs | 15 - src/test/ui/macros/auxiliary/issue-19163.rs | 6 + src/test/ui/macros/issue-16098.rs | 16 + src/test/ui/macros/issue-16098.stderr | 14 + src/test/ui/macros/issue-19163.rs | 11 + src/test/ui/macros/issue-19163.stderr | 11 + src/test/ui/macros/issue-21356.rs | 6 + src/test/ui/macros/issue-21356.stderr | 10 + src/test/ui/macros/issue-22463.rs | 20 + src/test/ui/macros/issue-29084.rs | 13 + src/test/ui/macros/issue-29084.stderr | 14 + src/test/ui/macros/issue-34171.rs | 10 + src/test/ui/macros/issue-37175.rs | 5 + src/test/ui/macros/issue-39388.rs | 9 + src/test/ui/macros/issue-39388.stderr | 8 + src/test/ui/macros/issue-40770.rs | 11 + src/test/ui/macros/issue-57597.rs | 80 +++ src/test/ui/macros/issue-57597.stderr | 74 +++ src/test/ui/macros/issue-6596-1.rs | 10 + src/test/ui/macros/issue-6596-1.stderr | 13 + src/test/ui/macros/issue-86865.rs | 11 + src/test/ui/macros/issue-86865.stderr | 18 + src/test/ui/macros/trace_macros-format.rs | 18 + src/test/ui/macros/trace_macros-format.stderr | 38 ++ .../overlap-doesnt-conflict-with-specialization.rs | 20 + ...rlap-doesnt-conflict-with-specialization.stderr | 12 + ...verlap-permitted-for-annotated-marker-traits.rs | 26 + src/test/ui/match/issue-11940.rs | 11 + src/test/ui/match/issue-18060.rs | 8 + src/test/ui/match/issue-26251.rs | 15 + src/test/ui/match/issue-26996.rs | 24 + src/test/ui/match/issue-42679.rs | 22 + src/test/ui/mir/issue-74739.rs | 14 + src/test/ui/mut-vstore-expr.rs | 6 - src/test/ui/negative.rs | 8 - src/test/ui/nested_item_main.rs | 10 - .../ui/never_type/diverging-tuple-parts-39485.rs | 15 + .../never_type/diverging-tuple-parts-39485.stderr | 32 ++ src/test/ui/new-box.rs | 30 - src/test/ui/nil-decl-in-foreign.rs | 14 - .../unary-minus-suffix-inference.rs | 23 + src/test/ui/object-does-not-impl-trait.rs | 8 - src/test/ui/object-does-not-impl-trait.stderr | 17 - .../overlap-doesnt-conflict-with-specialization.rs | 20 - ...rlap-doesnt-conflict-with-specialization.stderr | 12 - ...verlap-permitted-for-annotated-marker-traits.rs | 26 - src/test/ui/packed/issue-46152.rs | 24 + src/test/ui/parser/bastion-of-the-turbofish.rs | 43 ++ src/test/ui/parser/issue-13483.rs | 17 + src/test/ui/parser/issue-13483.stderr | 33 ++ src/test/ui/parser/issue-20616-4.rs | 35 ++ src/test/ui/parser/issue-20616-4.stderr | 8 + src/test/ui/parser/issue-20616-5.rs | 35 ++ src/test/ui/parser/issue-20616-5.stderr | 8 + src/test/ui/parser/issue-20616-6.rs | 35 ++ src/test/ui/parser/issue-20616-6.stderr | 8 + src/test/ui/parser/issue-20616-7.rs | 35 ++ src/test/ui/parser/issue-20616-7.stderr | 8 + src/test/ui/parser/issue-21475.rs | 19 + src/test/ui/parser/issue-31804.rs | 6 + src/test/ui/parser/issue-31804.stderr | 8 + src/test/ui/parser/issue-34255-1.rs | 10 + src/test/ui/parser/issue-34255-1.stderr | 18 + src/test/ui/parser/issue-49040.rs | 3 + src/test/ui/parser/issue-49040.stderr | 15 + src/test/ui/parser/issue-56031.rs | 6 + src/test/ui/parser/issue-56031.stderr | 18 + src/test/ui/pattern/issue-11577.rs | 18 + src/test/ui/pattern/issue-15080.rs | 22 + src/test/ui/pattern/issue-72574-2.rs | 12 + src/test/ui/pattern/issue-72574-2.stderr | 37 ++ src/test/ui/pattern/issue-8351-1.rs | 16 + src/test/ui/pattern/issue-8351-2.rs | 16 + src/test/ui/process/issue-14456.rs | 37 ++ src/test/ui/process/issue-16272.rs | 23 + src/test/ui/process/issue-20091.rs | 24 + src/test/ui/process/signal-exit-status.rs | 18 + src/test/ui/regions/issue-21520.rs | 22 + src/test/ui/regions/issue-26448-1.rs | 13 + src/test/ui/regions/issue-26448-2.rs | 21 + src/test/ui/regions/issue-26448-3.rs | 25 + src/test/ui/required-lang-item.rs | 11 - src/test/ui/required-lang-item.stderr | 4 - src/test/ui/resolve/editions-crate-root-2015.rs | 21 + .../ui/resolve/editions-crate-root-2015.stderr | 28 + src/test/ui/resolve/issue-12796.rs | 9 + src/test/ui/resolve/issue-12796.stderr | 12 + src/test/ui/resolve/issue-23716.rs | 17 + src/test/ui/resolve/issue-23716.stderr | 21 + src/test/ui/resolve/issue-3021-c.rs | 9 + src/test/ui/resolve/issue-3021-c.stderr | 25 + src/test/ui/resolve/issue-3021.rs | 18 + src/test/ui/resolve/issue-3021.stderr | 11 + src/test/ui/resolve/issue-31845.rs | 12 + src/test/ui/resolve/issue-31845.stderr | 9 + src/test/ui/resolve/issue-5099.rs | 13 + src/test/ui/resolve/issue-5099.stderr | 48 ++ .../issue-6804.rs | 21 + .../issue-6804.stderr | 25 + src/test/ui/self/issue-61882-2.rs | 11 + src/test/ui/self/issue-61882-2.stderr | 15 + src/test/ui/self/issue-61882.rs | 9 + src/test/ui/self/issue-61882.stderr | 18 + src/test/ui/signal-exit-status.rs | 18 - .../ui/specialization/transmute-specialization.rs | 15 + .../specialization/transmute-specialization.stderr | 12 + src/test/ui/static/auxiliary/nested_item.rs | 30 + src/test/ui/static/nested_item_main.rs | 10 + src/test/ui/statics/issue-14227.mir.stderr | 11 + src/test/ui/statics/issue-14227.rs | 10 + src/test/ui/statics/issue-14227.thir.stderr | 11 + src/test/ui/structs-enums/issue-50731.rs | 6 + src/test/ui/structured-compare.rs | 30 - src/test/ui/supported-cast.rs | 206 ------- src/test/ui/svh/auxiliary/changing-crates-a1.rs | 3 + src/test/ui/svh/auxiliary/changing-crates-a2.rs | 3 + src/test/ui/svh/auxiliary/changing-crates-b.rs | 5 + src/test/ui/svh/changing-crates.rs | 12 + src/test/ui/svh/changing-crates.stderr | 13 + src/test/ui/syntax-trait-polarity.rs | 25 - src/test/ui/syntax-trait-polarity.stderr | 37 -- src/test/ui/terminate-in-initializer.rs | 33 -- src/test/ui/test-attrs/issue-20823.rs | 5 + src/test/ui/thin-lto-global-allocator.rs | 7 - src/test/ui/thinlto/all-crates.rs | 8 - src/test/ui/thinlto/auxiliary/dylib.rs | 6 - src/test/ui/thinlto/auxiliary/msvc-imp-present.rs | 11 - .../ui/thinlto/auxiliary/thin-lto-inlines-aux.rs | 7 - src/test/ui/thinlto/dylib-works.rs | 9 - src/test/ui/thinlto/msvc-imp-present.rs | 22 - src/test/ui/thinlto/thin-lto-inlines.rs | 30 - src/test/ui/thinlto/thin-lto-inlines2.rs | 28 - src/test/ui/thinlto/weak-works.rs | 28 - src/test/ui/threads-sendsync/issue-24313.rs | 32 ++ src/test/ui/threads-sendsync/issue-4448.rs | 16 + src/test/ui/threads-sendsync/issue-8827.rs | 53 ++ src/test/ui/threads-sendsync/issue-9396.rs | 23 + src/test/ui/threads-sendsync/trivial-message.rs | 16 + src/test/ui/threads-sendsync/yield2.rs | 8 + src/test/ui/trace_macros-format.rs | 18 - src/test/ui/trace_macros-format.stderr | 38 -- src/test/ui/traits/issue-24010.rs | 14 + src/test/ui/traits/issue-38604.rs | 16 + src/test/ui/traits/issue-38604.stderr | 33 ++ src/test/ui/traits/issue-3973.rs | 25 + src/test/ui/traits/issue-3973.stderr | 22 + src/test/ui/traits/issue-59029-1.rs | 9 + src/test/ui/traits/issue-59029-1.stderr | 15 + src/test/ui/traits/issue-72455.rs | 27 + src/test/ui/traits/object-does-not-impl-trait.rs | 8 + .../ui/traits/object-does-not-impl-trait.stderr | 17 + src/test/ui/traits/syntax-trait-polarity.rs | 25 + src/test/ui/traits/syntax-trait-polarity.stderr | 37 ++ src/test/ui/transmute-specialization.rs | 15 - src/test/ui/transmute-specialization.stderr | 12 - src/test/ui/trivial-message.rs | 16 - src/test/ui/try-block/issue-45124.rs | 18 + src/test/ui/try-macro-suggestion.rs | 9 - src/test/ui/try-macro-suggestion.stderr | 31 - src/test/ui/type-alias-impl-trait/issue-60662.rs | 10 + .../ui/type-alias-impl-trait/issue-60662.stdout | 14 + src/test/ui/type-inference/issue-30225.rs | 38 ++ src/test/ui/type-inference/issue-30225.stderr | 9 + .../ui/typeck/auxiliary/xcrate-issue-43189-a.rs | 7 + .../ui/typeck/auxiliary/xcrate-issue-43189-b.rs | 3 + .../auxiliary/xcrate-issue-46112-rexport-core.rs | 3 + .../ui/typeck/auxiliary/xcrate-issue-61711-b.rs | 5 + src/test/ui/typeck/issue-43189.rs | 12 + src/test/ui/typeck/issue-43189.stderr | 20 + src/test/ui/typeck/issue-46112.rs | 10 + src/test/ui/typeck/issue-46112.stderr | 15 + .../issue-61711-once-caused-rustc-inf-loop.rs | 11 + src/test/ui/unary-minus-suffix-inference.rs | 23 - src/test/ui/unboxed-closures/issue-18652.rs | 10 + src/test/ui/unnecessary-extern-crate.rs | 71 --- src/test/ui/unnecessary-extern-crate.stderr | 44 -- src/test/ui/unrestricted-attribute-tokens.rs | 8 - src/test/ui/unsized/issue-30355.rs | 9 + src/test/ui/unsized/issue-30355.stderr | 13 + src/test/ui/warn-ctypes-inhibit.rs | 15 - src/test/ui/yield2.rs | 8 - 509 files changed, 5217 insertions(+), 5331 deletions(-) delete mode 100644 src/test/ui/argument-passing.rs create mode 100644 src/test/ui/array-slice-vec/mut-vstore-expr.rs create mode 100644 src/test/ui/associated-types/issue-22066.rs create mode 100644 src/test/ui/associated-types/issue-22828.rs create mode 100644 src/test/ui/associated-types/issue-28871.rs create mode 100644 src/test/ui/associated-types/issue-47139-1.rs create mode 100644 src/test/ui/associated-types/issue-54467.rs create mode 100644 src/test/ui/async-await/issue-73541-1.rs create mode 100644 src/test/ui/async-await/issue-73541-1.stderr create mode 100644 src/test/ui/attributes/issue-40962.rs create mode 100644 src/test/ui/attributes/unrestricted-attribute-tokens.rs delete mode 100644 src/test/ui/auxiliary/changing-crates-a1.rs delete mode 100644 src/test/ui/auxiliary/changing-crates-a2.rs delete mode 100644 src/test/ui/auxiliary/changing-crates-b.rs delete mode 100644 src/test/ui/auxiliary/legacy-const-generics.rs delete mode 100644 src/test/ui/auxiliary/lto-duplicate-symbols1.rs delete mode 100644 src/test/ui/auxiliary/lto-duplicate-symbols2.rs delete mode 100644 src/test/ui/auxiliary/lto-rustc-loads-linker-plugin.rs delete mode 100644 src/test/ui/auxiliary/nested_item.rs delete mode 100644 src/test/ui/bastion-of-the-turbofish.rs create mode 100644 src/test/ui/binop/structured-compare.rs create mode 100644 src/test/ui/borrowck/issue-46095.rs create mode 100644 src/test/ui/box/new-box.rs create mode 100644 src/test/ui/c-variadic/issue-32201.rs create mode 100644 src/test/ui/c-variadic/issue-32201.stderr create mode 100644 src/test/ui/cast/supported-cast.rs delete mode 100644 src/test/ui/changing-crates.rs delete mode 100644 src/test/ui/changing-crates.stderr create mode 100644 src/test/ui/closures/issue-10398.rs create mode 100644 src/test/ui/closures/issue-10398.stderr create mode 100644 src/test/ui/closures/issue-42463.rs create mode 100644 src/test/ui/coercion/auxiliary/issue-39823.rs create mode 100644 src/test/ui/coercion/issue-14589.rs create mode 100644 src/test/ui/coercion/issue-39823.rs create mode 100644 src/test/ui/coercion/issue-73886.rs create mode 100644 src/test/ui/coercion/issue-73886.stderr create mode 100644 src/test/ui/conditional-compilation/issue-34028.rs create mode 100644 src/test/ui/const-generics/auxiliary/legacy-const-generics.rs create mode 100644 src/test/ui/const-generics/legacy-const-generics-bad.rs create mode 100644 src/test/ui/const-generics/legacy-const-generics-bad.stderr create mode 100644 src/test/ui/const-generics/legacy-const-generics.rs create mode 100644 src/test/ui/consts/issue-13902.rs create mode 100644 src/test/ui/consts/issue-17074.rs create mode 100644 src/test/ui/consts/issue-18294.rs create mode 100644 src/test/ui/consts/issue-18294.stderr create mode 100644 src/test/ui/consts/issue-23968-const-not-overflow.rs create mode 100644 src/test/ui/consts/issue-37550-1.rs create mode 100644 src/test/ui/consts/issue-37550-1.stderr create mode 100644 src/test/ui/consts/issue-37991.rs create mode 100644 src/test/ui/deprecation/try-macro-suggestion.rs create mode 100644 src/test/ui/deprecation/try-macro-suggestion.stderr create mode 100644 src/test/ui/deriving/issue-19358.rs create mode 100644 src/test/ui/deriving/issue-58319.rs delete mode 100644 src/test/ui/diverging-tuple-parts-39485.rs delete mode 100644 src/test/ui/diverging-tuple-parts-39485.stderr create mode 100644 src/test/ui/drop/issue-35546.rs create mode 100644 src/test/ui/drop/terminate-in-initializer.rs create mode 100644 src/test/ui/dropck/issue-28498-ugeh-with-passed-to-fn.rs delete mode 100644 src/test/ui/editions-crate-root-2015.rs delete mode 100644 src/test/ui/editions-crate-root-2015.stderr create mode 100644 src/test/ui/editions/epoch-gate-feature.rs create mode 100644 src/test/ui/enum-discriminant/issue-51582.rs create mode 100644 src/test/ui/enum/issue-42747.rs delete mode 100644 src/test/ui/epoch-gate-feature.rs create mode 100644 src/test/ui/extern/issue-28324.mir.stderr create mode 100644 src/test/ui/extern/issue-28324.rs create mode 100644 src/test/ui/extern/issue-28324.thir.stderr create mode 100644 src/test/ui/for-loop-while/issue-51345.rs create mode 100644 src/test/ui/for-loop-while/long-while.rs create mode 100644 src/test/ui/foreign/nil-decl-in-foreign.rs create mode 100644 src/test/ui/generics/issue-1112.rs create mode 100644 src/test/ui/generics/issue-333.rs create mode 100644 src/test/ui/generics/issue-59508-1.rs create mode 100644 src/test/ui/generics/issue-59508-1.stderr create mode 100644 src/test/ui/generics/issue-59508.fixed create mode 100644 src/test/ui/generics/issue-59508.rs create mode 100644 src/test/ui/generics/issue-59508.stderr create mode 100644 src/test/ui/higher-rank-trait-bounds/issue-60283.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/issue-60283.stderr create mode 100644 src/test/ui/hygiene/lambda-var-hygiene.rs create mode 100644 src/test/ui/impl-trait/issue-49579.rs create mode 100644 src/test/ui/impl-trait/issue-49685.rs create mode 100644 src/test/ui/impl-trait/issue-51185.rs delete mode 100644 src/test/ui/in-band-lifetimes.rs create mode 100644 src/test/ui/in-band-lifetimes/in-band-lifetimes.rs create mode 100644 src/test/ui/inference/lub-glb-with-unbound-infer-var.rs delete mode 100644 src/test/ui/issues/auxiliary/issue-19163.rs delete mode 100644 src/test/ui/issues/auxiliary/issue-39823.rs delete mode 100644 src/test/ui/issues/auxiliary/xcrate-issue-43189-a.rs delete mode 100644 src/test/ui/issues/auxiliary/xcrate-issue-43189-b.rs delete mode 100644 src/test/ui/issues/auxiliary/xcrate-issue-46112-rexport-core.rs delete mode 100644 src/test/ui/issues/auxiliary/xcrate-issue-61711-b.rs delete mode 100644 src/test/ui/issues/issue-10398.rs delete mode 100644 src/test/ui/issues/issue-10398.stderr delete mode 100644 src/test/ui/issues/issue-1112.rs delete mode 100644 src/test/ui/issues/issue-11577.rs delete mode 100644 src/test/ui/issues/issue-11940.rs delete mode 100644 src/test/ui/issues/issue-12796.rs delete mode 100644 src/test/ui/issues/issue-12796.stderr delete mode 100644 src/test/ui/issues/issue-13483.rs delete mode 100644 src/test/ui/issues/issue-13483.stderr delete mode 100644 src/test/ui/issues/issue-13902.rs delete mode 100644 src/test/ui/issues/issue-14227.mir.stderr delete mode 100644 src/test/ui/issues/issue-14227.rs delete mode 100644 src/test/ui/issues/issue-14227.thir.stderr delete mode 100644 src/test/ui/issues/issue-14456.rs delete mode 100644 src/test/ui/issues/issue-14589.rs delete mode 100644 src/test/ui/issues/issue-14837.rs delete mode 100644 src/test/ui/issues/issue-15080.rs delete mode 100644 src/test/ui/issues/issue-16098.rs delete mode 100644 src/test/ui/issues/issue-16098.stderr delete mode 100644 src/test/ui/issues/issue-16272.rs delete mode 100644 src/test/ui/issues/issue-17074.rs delete mode 100644 src/test/ui/issues/issue-18060.rs delete mode 100644 src/test/ui/issues/issue-18294.rs delete mode 100644 src/test/ui/issues/issue-18294.stderr delete mode 100644 src/test/ui/issues/issue-18652.rs delete mode 100644 src/test/ui/issues/issue-19163.rs delete mode 100644 src/test/ui/issues/issue-19163.stderr delete mode 100644 src/test/ui/issues/issue-19358.rs delete mode 100644 src/test/ui/issues/issue-19660.rs delete mode 100644 src/test/ui/issues/issue-19660.stderr delete mode 100644 src/test/ui/issues/issue-20091.rs delete mode 100644 src/test/ui/issues/issue-20616-4.rs delete mode 100644 src/test/ui/issues/issue-20616-4.stderr delete mode 100644 src/test/ui/issues/issue-20616-5.rs delete mode 100644 src/test/ui/issues/issue-20616-5.stderr delete mode 100644 src/test/ui/issues/issue-20616-6.rs delete mode 100644 src/test/ui/issues/issue-20616-6.stderr delete mode 100644 src/test/ui/issues/issue-20616-7.rs delete mode 100644 src/test/ui/issues/issue-20616-7.stderr delete mode 100644 src/test/ui/issues/issue-20823.rs delete mode 100644 src/test/ui/issues/issue-21356.rs delete mode 100644 src/test/ui/issues/issue-21356.stderr delete mode 100644 src/test/ui/issues/issue-21475.rs delete mode 100644 src/test/ui/issues/issue-21520.rs delete mode 100644 src/test/ui/issues/issue-22066.rs delete mode 100644 src/test/ui/issues/issue-22463.rs delete mode 100644 src/test/ui/issues/issue-22828.rs delete mode 100644 src/test/ui/issues/issue-23458.rs delete mode 100644 src/test/ui/issues/issue-23458.stderr delete mode 100644 src/test/ui/issues/issue-23716.rs delete mode 100644 src/test/ui/issues/issue-23716.stderr delete mode 100644 src/test/ui/issues/issue-23968-const-not-overflow.rs delete mode 100644 src/test/ui/issues/issue-24010.rs delete mode 100644 src/test/ui/issues/issue-24313.rs delete mode 100644 src/test/ui/issues/issue-2444.rs delete mode 100644 src/test/ui/issues/issue-26251.rs delete mode 100644 src/test/ui/issues/issue-26448-1.rs delete mode 100644 src/test/ui/issues/issue-26448-2.rs delete mode 100644 src/test/ui/issues/issue-26448-3.rs delete mode 100644 src/test/ui/issues/issue-26638.rs delete mode 100644 src/test/ui/issues/issue-26638.stderr delete mode 100644 src/test/ui/issues/issue-26996.rs delete mode 100644 src/test/ui/issues/issue-2748-b.rs delete mode 100644 src/test/ui/issues/issue-28324.mir.stderr delete mode 100644 src/test/ui/issues/issue-28324.rs delete mode 100644 src/test/ui/issues/issue-28324.thir.stderr delete mode 100644 src/test/ui/issues/issue-28498-ugeh-with-passed-to-fn.rs delete mode 100644 src/test/ui/issues/issue-28871.rs delete mode 100644 src/test/ui/issues/issue-29084.rs delete mode 100644 src/test/ui/issues/issue-29084.stderr delete mode 100644 src/test/ui/issues/issue-3021-c.rs delete mode 100644 src/test/ui/issues/issue-3021-c.stderr delete mode 100644 src/test/ui/issues/issue-3021.rs delete mode 100644 src/test/ui/issues/issue-3021.stderr delete mode 100644 src/test/ui/issues/issue-30225.rs delete mode 100644 src/test/ui/issues/issue-30225.stderr delete mode 100644 src/test/ui/issues/issue-30355.rs delete mode 100644 src/test/ui/issues/issue-30355.stderr delete mode 100644 src/test/ui/issues/issue-31076.rs delete mode 100644 src/test/ui/issues/issue-31076.stderr delete mode 100644 src/test/ui/issues/issue-31804.rs delete mode 100644 src/test/ui/issues/issue-31804.stderr delete mode 100644 src/test/ui/issues/issue-31845.rs delete mode 100644 src/test/ui/issues/issue-31845.stderr delete mode 100644 src/test/ui/issues/issue-3211.rs delete mode 100644 src/test/ui/issues/issue-32201.rs delete mode 100644 src/test/ui/issues/issue-32201.stderr delete mode 100644 src/test/ui/issues/issue-333.rs delete mode 100644 src/test/ui/issues/issue-34028.rs delete mode 100644 src/test/ui/issues/issue-34171.rs delete mode 100644 src/test/ui/issues/issue-34255-1.rs delete mode 100644 src/test/ui/issues/issue-34255-1.stderr delete mode 100644 src/test/ui/issues/issue-35546.rs delete mode 100644 src/test/ui/issues/issue-37175.rs delete mode 100644 src/test/ui/issues/issue-37366.rs delete mode 100644 src/test/ui/issues/issue-37550.rs delete mode 100644 src/test/ui/issues/issue-37550.stderr delete mode 100644 src/test/ui/issues/issue-37991.rs delete mode 100644 src/test/ui/issues/issue-38604.rs delete mode 100644 src/test/ui/issues/issue-38604.stderr delete mode 100644 src/test/ui/issues/issue-39388.rs delete mode 100644 src/test/ui/issues/issue-39388.stderr delete mode 100644 src/test/ui/issues/issue-3973.rs delete mode 100644 src/test/ui/issues/issue-3973.stderr delete mode 100644 src/test/ui/issues/issue-39823.rs delete mode 100644 src/test/ui/issues/issue-40770.rs delete mode 100644 src/test/ui/issues/issue-40962.rs delete mode 100644 src/test/ui/issues/issue-42463.rs delete mode 100644 src/test/ui/issues/issue-42679.rs delete mode 100644 src/test/ui/issues/issue-42747.rs delete mode 100644 src/test/ui/issues/issue-43189.rs delete mode 100644 src/test/ui/issues/issue-43189.stderr delete mode 100644 src/test/ui/issues/issue-4401.rs delete mode 100644 src/test/ui/issues/issue-4448.rs delete mode 100644 src/test/ui/issues/issue-45124.rs delete mode 100644 src/test/ui/issues/issue-45152.rs delete mode 100644 src/test/ui/issues/issue-46095.rs delete mode 100644 src/test/ui/issues/issue-46112.rs delete mode 100644 src/test/ui/issues/issue-46112.stderr delete mode 100644 src/test/ui/issues/issue-47139-1.rs delete mode 100644 src/test/ui/issues/issue-49040.rs delete mode 100644 src/test/ui/issues/issue-49040.stderr delete mode 100644 src/test/ui/issues/issue-49579.rs delete mode 100644 src/test/ui/issues/issue-49685.rs delete mode 100644 src/test/ui/issues/issue-50731.rs delete mode 100644 src/test/ui/issues/issue-5099.rs delete mode 100644 src/test/ui/issues/issue-5099.stderr delete mode 100644 src/test/ui/issues/issue-50993.rs delete mode 100644 src/test/ui/issues/issue-50993.stderr delete mode 100644 src/test/ui/issues/issue-51185.rs delete mode 100644 src/test/ui/issues/issue-51345.rs delete mode 100644 src/test/ui/issues/issue-51582.rs delete mode 100644 src/test/ui/issues/issue-53787-inline-assembler-macro.rs delete mode 100644 src/test/ui/issues/issue-53787-inline-assembler-macro.stderr delete mode 100644 src/test/ui/issues/issue-54467.rs delete mode 100644 src/test/ui/issues/issue-56031.rs delete mode 100644 src/test/ui/issues/issue-56031.stderr delete mode 100644 src/test/ui/issues/issue-57410-1.rs delete mode 100644 src/test/ui/issues/issue-57597.rs delete mode 100644 src/test/ui/issues/issue-57597.stderr delete mode 100644 src/test/ui/issues/issue-58319.rs delete mode 100644 src/test/ui/issues/issue-59029-1.rs delete mode 100644 src/test/ui/issues/issue-59029-1.stderr delete mode 100644 src/test/ui/issues/issue-59508-1.rs delete mode 100644 src/test/ui/issues/issue-59508-1.stderr delete mode 100644 src/test/ui/issues/issue-59508.fixed delete mode 100644 src/test/ui/issues/issue-59508.rs delete mode 100644 src/test/ui/issues/issue-59508.stderr delete mode 100644 src/test/ui/issues/issue-60283.rs delete mode 100644 src/test/ui/issues/issue-60283.stderr delete mode 100644 src/test/ui/issues/issue-60662.rs delete mode 100644 src/test/ui/issues/issue-60662.stdout delete mode 100644 src/test/ui/issues/issue-61711-once-caused-rustc-inf-loop.rs delete mode 100644 src/test/ui/issues/issue-61882-2.rs delete mode 100644 src/test/ui/issues/issue-61882-2.stderr delete mode 100644 src/test/ui/issues/issue-61882.rs delete mode 100644 src/test/ui/issues/issue-61882.stderr delete mode 100644 src/test/ui/issues/issue-63364.rs delete mode 100644 src/test/ui/issues/issue-63364.stderr delete mode 100644 src/test/ui/issues/issue-6596-1.rs delete mode 100644 src/test/ui/issues/issue-6596-1.stderr delete mode 100644 src/test/ui/issues/issue-6804.rs delete mode 100644 src/test/ui/issues/issue-6804.stderr delete mode 100644 src/test/ui/issues/issue-72455.rs delete mode 100644 src/test/ui/issues/issue-72574-2.rs delete mode 100644 src/test/ui/issues/issue-72574-2.stderr delete mode 100644 src/test/ui/issues/issue-73541-1.rs delete mode 100644 src/test/ui/issues/issue-73541-1.stderr delete mode 100644 src/test/ui/issues/issue-73886.rs delete mode 100644 src/test/ui/issues/issue-73886.stderr delete mode 100644 src/test/ui/issues/issue-74739.rs delete mode 100644 src/test/ui/issues/issue-811.rs delete mode 100644 src/test/ui/issues/issue-8351-1.rs delete mode 100644 src/test/ui/issues/issue-8351-2.rs delete mode 100644 src/test/ui/issues/issue-86865.rs delete mode 100644 src/test/ui/issues/issue-86865.stderr delete mode 100644 src/test/ui/issues/issue-8827.rs delete mode 100644 src/test/ui/issues/issue-9396.rs delete mode 100644 src/test/ui/lambda-var-hygiene.rs create mode 100644 src/test/ui/lang-items/issue-19660.rs create mode 100644 src/test/ui/lang-items/issue-19660.stderr create mode 100644 src/test/ui/lang-items/issue-31076.rs create mode 100644 src/test/ui/lang-items/issue-31076.stderr create mode 100644 src/test/ui/lang-items/required-lang-item.rs create mode 100644 src/test/ui/lang-items/required-lang-item.stderr delete mode 100644 src/test/ui/legacy-const-generics-bad.rs delete mode 100644 src/test/ui/legacy-const-generics-bad.stderr delete mode 100644 src/test/ui/legacy-const-generics.rs create mode 100644 src/test/ui/lifetimes/issue-26638.rs create mode 100644 src/test/ui/lifetimes/issue-26638.stderr create mode 100644 src/test/ui/lint/issue-14837.rs create mode 100644 src/test/ui/lint/issue-57410-1.rs create mode 100644 src/test/ui/lint/issue-63364.rs create mode 100644 src/test/ui/lint/issue-63364.stderr create mode 100644 src/test/ui/lint/unnecessary-extern-crate.rs create mode 100644 src/test/ui/lint/unnecessary-extern-crate.stderr create mode 100644 src/test/ui/lint/warn-ctypes-inhibit.rs create mode 100644 src/test/ui/llvm-asm/issue-23458.rs create mode 100644 src/test/ui/llvm-asm/issue-23458.stderr create mode 100644 src/test/ui/llvm-asm/issue-37366.rs create mode 100644 src/test/ui/llvm-asm/issue-53787-inline-assembler-macro.rs create mode 100644 src/test/ui/llvm-asm/issue-53787-inline-assembler-macro.stderr delete mode 100644 src/test/ui/long-while.rs delete mode 100644 src/test/ui/lto-and-no-bitcode-in-rlib.rs delete mode 100644 src/test/ui/lto-and-no-bitcode-in-rlib.stderr delete mode 100644 src/test/ui/lto-duplicate-symbols.rs delete mode 100644 src/test/ui/lto-duplicate-symbols.stderr delete mode 100644 src/test/ui/lto-many-codegen-units.rs delete mode 100644 src/test/ui/lto-opt-level-s.rs delete mode 100644 src/test/ui/lto-opt-level-z.rs delete mode 100644 src/test/ui/lto-rustc-loads-linker-plugin.rs delete mode 100644 src/test/ui/lto-still-runs-thread-dtors.rs delete mode 100644 src/test/ui/lto-thin-rustc-loads-linker-plugin.rs create mode 100644 src/test/ui/lto/all-crates.rs create mode 100644 src/test/ui/lto/auxiliary/dylib.rs create mode 100644 src/test/ui/lto/auxiliary/lto-duplicate-symbols1.rs create mode 100644 src/test/ui/lto/auxiliary/lto-duplicate-symbols2.rs create mode 100644 src/test/ui/lto/auxiliary/lto-rustc-loads-linker-plugin.rs create mode 100644 src/test/ui/lto/auxiliary/msvc-imp-present.rs create mode 100644 src/test/ui/lto/auxiliary/thin-lto-inlines-aux.rs create mode 100644 src/test/ui/lto/dylib-works.rs create mode 100644 src/test/ui/lto/lto-and-no-bitcode-in-rlib.rs create mode 100644 src/test/ui/lto/lto-and-no-bitcode-in-rlib.stderr create mode 100644 src/test/ui/lto/lto-duplicate-symbols.rs create mode 100644 src/test/ui/lto/lto-duplicate-symbols.stderr create mode 100644 src/test/ui/lto/lto-many-codegen-units.rs create mode 100644 src/test/ui/lto/lto-opt-level-s.rs create mode 100644 src/test/ui/lto/lto-opt-level-z.rs create mode 100644 src/test/ui/lto/lto-rustc-loads-linker-plugin.rs create mode 100644 src/test/ui/lto/lto-still-runs-thread-dtors.rs create mode 100644 src/test/ui/lto/lto-thin-rustc-loads-linker-plugin.rs create mode 100644 src/test/ui/lto/msvc-imp-present.rs create mode 100644 src/test/ui/lto/thin-lto-global-allocator.rs create mode 100644 src/test/ui/lto/thin-lto-inlines.rs create mode 100644 src/test/ui/lto/thin-lto-inlines2.rs create mode 100644 src/test/ui/lto/weak-works.rs delete mode 100644 src/test/ui/lub-glb-with-unbound-infer-var.rs create mode 100644 src/test/ui/macros/auxiliary/issue-19163.rs create mode 100644 src/test/ui/macros/issue-16098.rs create mode 100644 src/test/ui/macros/issue-16098.stderr create mode 100644 src/test/ui/macros/issue-19163.rs create mode 100644 src/test/ui/macros/issue-19163.stderr create mode 100644 src/test/ui/macros/issue-21356.rs create mode 100644 src/test/ui/macros/issue-21356.stderr create mode 100644 src/test/ui/macros/issue-22463.rs create mode 100644 src/test/ui/macros/issue-29084.rs create mode 100644 src/test/ui/macros/issue-29084.stderr create mode 100644 src/test/ui/macros/issue-34171.rs create mode 100644 src/test/ui/macros/issue-37175.rs create mode 100644 src/test/ui/macros/issue-39388.rs create mode 100644 src/test/ui/macros/issue-39388.stderr create mode 100644 src/test/ui/macros/issue-40770.rs create mode 100644 src/test/ui/macros/issue-57597.rs create mode 100644 src/test/ui/macros/issue-57597.stderr create mode 100644 src/test/ui/macros/issue-6596-1.rs create mode 100644 src/test/ui/macros/issue-6596-1.stderr create mode 100644 src/test/ui/macros/issue-86865.rs create mode 100644 src/test/ui/macros/issue-86865.stderr create mode 100644 src/test/ui/macros/trace_macros-format.rs create mode 100644 src/test/ui/macros/trace_macros-format.stderr create mode 100644 src/test/ui/marker_trait_attr/overlap-doesnt-conflict-with-specialization.rs create mode 100644 src/test/ui/marker_trait_attr/overlap-doesnt-conflict-with-specialization.stderr create mode 100644 src/test/ui/marker_trait_attr/overlap-permitted-for-annotated-marker-traits.rs create mode 100644 src/test/ui/match/issue-11940.rs create mode 100644 src/test/ui/match/issue-18060.rs create mode 100644 src/test/ui/match/issue-26251.rs create mode 100644 src/test/ui/match/issue-26996.rs create mode 100644 src/test/ui/match/issue-42679.rs create mode 100644 src/test/ui/mir/issue-74739.rs delete mode 100644 src/test/ui/mut-vstore-expr.rs delete mode 100644 src/test/ui/negative.rs delete mode 100644 src/test/ui/nested_item_main.rs create mode 100644 src/test/ui/never_type/diverging-tuple-parts-39485.rs create mode 100644 src/test/ui/never_type/diverging-tuple-parts-39485.stderr delete mode 100644 src/test/ui/new-box.rs delete mode 100644 src/test/ui/nil-decl-in-foreign.rs create mode 100644 src/test/ui/numbers-arithmetic/unary-minus-suffix-inference.rs delete mode 100644 src/test/ui/object-does-not-impl-trait.rs delete mode 100644 src/test/ui/object-does-not-impl-trait.stderr delete mode 100644 src/test/ui/overlap-doesnt-conflict-with-specialization.rs delete mode 100644 src/test/ui/overlap-doesnt-conflict-with-specialization.stderr delete mode 100644 src/test/ui/overlap-permitted-for-annotated-marker-traits.rs create mode 100644 src/test/ui/packed/issue-46152.rs create mode 100644 src/test/ui/parser/bastion-of-the-turbofish.rs create mode 100644 src/test/ui/parser/issue-13483.rs create mode 100644 src/test/ui/parser/issue-13483.stderr create mode 100644 src/test/ui/parser/issue-20616-4.rs create mode 100644 src/test/ui/parser/issue-20616-4.stderr create mode 100644 src/test/ui/parser/issue-20616-5.rs create mode 100644 src/test/ui/parser/issue-20616-5.stderr create mode 100644 src/test/ui/parser/issue-20616-6.rs create mode 100644 src/test/ui/parser/issue-20616-6.stderr create mode 100644 src/test/ui/parser/issue-20616-7.rs create mode 100644 src/test/ui/parser/issue-20616-7.stderr create mode 100644 src/test/ui/parser/issue-21475.rs create mode 100644 src/test/ui/parser/issue-31804.rs create mode 100644 src/test/ui/parser/issue-31804.stderr create mode 100644 src/test/ui/parser/issue-34255-1.rs create mode 100644 src/test/ui/parser/issue-34255-1.stderr create mode 100644 src/test/ui/parser/issue-49040.rs create mode 100644 src/test/ui/parser/issue-49040.stderr create mode 100644 src/test/ui/parser/issue-56031.rs create mode 100644 src/test/ui/parser/issue-56031.stderr create mode 100644 src/test/ui/pattern/issue-11577.rs create mode 100644 src/test/ui/pattern/issue-15080.rs create mode 100644 src/test/ui/pattern/issue-72574-2.rs create mode 100644 src/test/ui/pattern/issue-72574-2.stderr create mode 100644 src/test/ui/pattern/issue-8351-1.rs create mode 100644 src/test/ui/pattern/issue-8351-2.rs create mode 100644 src/test/ui/process/issue-14456.rs create mode 100644 src/test/ui/process/issue-16272.rs create mode 100644 src/test/ui/process/issue-20091.rs create mode 100644 src/test/ui/process/signal-exit-status.rs create mode 100644 src/test/ui/regions/issue-21520.rs create mode 100644 src/test/ui/regions/issue-26448-1.rs create mode 100644 src/test/ui/regions/issue-26448-2.rs create mode 100644 src/test/ui/regions/issue-26448-3.rs delete mode 100644 src/test/ui/required-lang-item.rs delete mode 100644 src/test/ui/required-lang-item.stderr create mode 100644 src/test/ui/resolve/editions-crate-root-2015.rs create mode 100644 src/test/ui/resolve/editions-crate-root-2015.stderr create mode 100644 src/test/ui/resolve/issue-12796.rs create mode 100644 src/test/ui/resolve/issue-12796.stderr create mode 100644 src/test/ui/resolve/issue-23716.rs create mode 100644 src/test/ui/resolve/issue-23716.stderr create mode 100644 src/test/ui/resolve/issue-3021-c.rs create mode 100644 src/test/ui/resolve/issue-3021-c.stderr create mode 100644 src/test/ui/resolve/issue-3021.rs create mode 100644 src/test/ui/resolve/issue-3021.stderr create mode 100644 src/test/ui/resolve/issue-31845.rs create mode 100644 src/test/ui/resolve/issue-31845.stderr create mode 100644 src/test/ui/resolve/issue-5099.rs create mode 100644 src/test/ui/resolve/issue-5099.stderr create mode 100644 src/test/ui/rfc-1445-restrict-constants-in-patterns/issue-6804.rs create mode 100644 src/test/ui/rfc-1445-restrict-constants-in-patterns/issue-6804.stderr create mode 100644 src/test/ui/self/issue-61882-2.rs create mode 100644 src/test/ui/self/issue-61882-2.stderr create mode 100644 src/test/ui/self/issue-61882.rs create mode 100644 src/test/ui/self/issue-61882.stderr delete mode 100644 src/test/ui/signal-exit-status.rs create mode 100644 src/test/ui/specialization/transmute-specialization.rs create mode 100644 src/test/ui/specialization/transmute-specialization.stderr create mode 100644 src/test/ui/static/auxiliary/nested_item.rs create mode 100644 src/test/ui/static/nested_item_main.rs create mode 100644 src/test/ui/statics/issue-14227.mir.stderr create mode 100644 src/test/ui/statics/issue-14227.rs create mode 100644 src/test/ui/statics/issue-14227.thir.stderr create mode 100644 src/test/ui/structs-enums/issue-50731.rs delete mode 100644 src/test/ui/structured-compare.rs delete mode 100644 src/test/ui/supported-cast.rs create mode 100644 src/test/ui/svh/auxiliary/changing-crates-a1.rs create mode 100644 src/test/ui/svh/auxiliary/changing-crates-a2.rs create mode 100644 src/test/ui/svh/auxiliary/changing-crates-b.rs create mode 100644 src/test/ui/svh/changing-crates.rs create mode 100644 src/test/ui/svh/changing-crates.stderr delete mode 100644 src/test/ui/syntax-trait-polarity.rs delete mode 100644 src/test/ui/syntax-trait-polarity.stderr delete mode 100644 src/test/ui/terminate-in-initializer.rs create mode 100644 src/test/ui/test-attrs/issue-20823.rs delete mode 100644 src/test/ui/thin-lto-global-allocator.rs delete mode 100644 src/test/ui/thinlto/all-crates.rs delete mode 100644 src/test/ui/thinlto/auxiliary/dylib.rs delete mode 100644 src/test/ui/thinlto/auxiliary/msvc-imp-present.rs delete mode 100644 src/test/ui/thinlto/auxiliary/thin-lto-inlines-aux.rs delete mode 100644 src/test/ui/thinlto/dylib-works.rs delete mode 100644 src/test/ui/thinlto/msvc-imp-present.rs delete mode 100644 src/test/ui/thinlto/thin-lto-inlines.rs delete mode 100644 src/test/ui/thinlto/thin-lto-inlines2.rs delete mode 100644 src/test/ui/thinlto/weak-works.rs create mode 100644 src/test/ui/threads-sendsync/issue-24313.rs create mode 100644 src/test/ui/threads-sendsync/issue-4448.rs create mode 100644 src/test/ui/threads-sendsync/issue-8827.rs create mode 100644 src/test/ui/threads-sendsync/issue-9396.rs create mode 100644 src/test/ui/threads-sendsync/trivial-message.rs create mode 100644 src/test/ui/threads-sendsync/yield2.rs delete mode 100644 src/test/ui/trace_macros-format.rs delete mode 100644 src/test/ui/trace_macros-format.stderr create mode 100644 src/test/ui/traits/issue-24010.rs create mode 100644 src/test/ui/traits/issue-38604.rs create mode 100644 src/test/ui/traits/issue-38604.stderr create mode 100644 src/test/ui/traits/issue-3973.rs create mode 100644 src/test/ui/traits/issue-3973.stderr create mode 100644 src/test/ui/traits/issue-59029-1.rs create mode 100644 src/test/ui/traits/issue-59029-1.stderr create mode 100644 src/test/ui/traits/issue-72455.rs create mode 100644 src/test/ui/traits/object-does-not-impl-trait.rs create mode 100644 src/test/ui/traits/object-does-not-impl-trait.stderr create mode 100644 src/test/ui/traits/syntax-trait-polarity.rs create mode 100644 src/test/ui/traits/syntax-trait-polarity.stderr delete mode 100644 src/test/ui/transmute-specialization.rs delete mode 100644 src/test/ui/transmute-specialization.stderr delete mode 100644 src/test/ui/trivial-message.rs create mode 100644 src/test/ui/try-block/issue-45124.rs delete mode 100644 src/test/ui/try-macro-suggestion.rs delete mode 100644 src/test/ui/try-macro-suggestion.stderr create mode 100644 src/test/ui/type-alias-impl-trait/issue-60662.rs create mode 100644 src/test/ui/type-alias-impl-trait/issue-60662.stdout create mode 100644 src/test/ui/type-inference/issue-30225.rs create mode 100644 src/test/ui/type-inference/issue-30225.stderr create mode 100644 src/test/ui/typeck/auxiliary/xcrate-issue-43189-a.rs create mode 100644 src/test/ui/typeck/auxiliary/xcrate-issue-43189-b.rs create mode 100644 src/test/ui/typeck/auxiliary/xcrate-issue-46112-rexport-core.rs create mode 100644 src/test/ui/typeck/auxiliary/xcrate-issue-61711-b.rs create mode 100644 src/test/ui/typeck/issue-43189.rs create mode 100644 src/test/ui/typeck/issue-43189.stderr create mode 100644 src/test/ui/typeck/issue-46112.rs create mode 100644 src/test/ui/typeck/issue-46112.stderr create mode 100644 src/test/ui/typeck/issue-61711-once-caused-rustc-inf-loop.rs delete mode 100644 src/test/ui/unary-minus-suffix-inference.rs create mode 100644 src/test/ui/unboxed-closures/issue-18652.rs delete mode 100644 src/test/ui/unnecessary-extern-crate.rs delete mode 100644 src/test/ui/unnecessary-extern-crate.stderr delete mode 100644 src/test/ui/unrestricted-attribute-tokens.rs create mode 100644 src/test/ui/unsized/issue-30355.rs create mode 100644 src/test/ui/unsized/issue-30355.stderr delete mode 100644 src/test/ui/warn-ctypes-inhibit.rs delete mode 100644 src/test/ui/yield2.rs (limited to 'src/test/ui') diff --git a/src/test/ui/argument-passing.rs b/src/test/ui/argument-passing.rs deleted file mode 100644 index 74759a4a6bd..00000000000 --- a/src/test/ui/argument-passing.rs +++ /dev/null @@ -1,25 +0,0 @@ -// run-pass - -struct X { - x: isize -} - -fn f1(a: &mut X, b: &mut isize, c: isize) -> isize { - let r = a.x + *b + c; - a.x = 0; - *b = 10; - return r; -} - -fn f2(a: isize, f: F) -> isize where F: FnOnce(isize) { f(1); return a; } - -pub fn main() { - let mut a = X {x: 1}; - let mut b = 2; - let c = 3; - assert_eq!(f1(&mut a, &mut b, c), 6); - assert_eq!(a.x, 0); - assert_eq!(b, 10); - assert_eq!(f2(a.x, |_| a.x = 50), 0); - assert_eq!(a.x, 50); -} diff --git a/src/test/ui/array-slice-vec/mut-vstore-expr.rs b/src/test/ui/array-slice-vec/mut-vstore-expr.rs new file mode 100644 index 00000000000..75b309a4839 --- /dev/null +++ b/src/test/ui/array-slice-vec/mut-vstore-expr.rs @@ -0,0 +1,6 @@ +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main() { + let _x: &mut [isize] = &mut [ 1, 2, 3 ]; +} diff --git a/src/test/ui/associated-types/issue-22066.rs b/src/test/ui/associated-types/issue-22066.rs new file mode 100644 index 00000000000..8e8ba5dc46c --- /dev/null +++ b/src/test/ui/associated-types/issue-22066.rs @@ -0,0 +1,12 @@ +// check-pass +pub trait LineFormatter<'a> { + type Iter: Iterator + 'a; + fn iter(&'a self, line: &'a str) -> Self::Iter; + + fn dimensions(&'a self, line: &'a str) { + let iter: Self::Iter = self.iter(line); + <_ as IntoIterator>::into_iter(iter); + } +} + +fn main() {} diff --git a/src/test/ui/associated-types/issue-22828.rs b/src/test/ui/associated-types/issue-22828.rs new file mode 100644 index 00000000000..adf4dd6ce75 --- /dev/null +++ b/src/test/ui/associated-types/issue-22828.rs @@ -0,0 +1,23 @@ +// run-pass +#![allow(dead_code)] +// Test transitive analysis for associated types. Collected types +// should be normalized and new obligations generated. + +// pretty-expanded FIXME #23616 + +trait Foo { + type A; + fn foo(&self) {} +} + +impl Foo for usize { + type A = usize; +} + +struct Bar { inner: T::A } + +fn is_send() {} + +fn main() { + is_send::>(); +} diff --git a/src/test/ui/associated-types/issue-28871.rs b/src/test/ui/associated-types/issue-28871.rs new file mode 100644 index 00000000000..210c783de79 --- /dev/null +++ b/src/test/ui/associated-types/issue-28871.rs @@ -0,0 +1,24 @@ +// check-pass +// Regression test for #28871. The problem is that rustc encountered +// two ways to project, one from a where clause and one from the where +// clauses on the trait definition. (In fact, in this case, the where +// clauses originated from the trait definition as well.) The true +// cause of the error is that the trait definition where clauses are +// not being normalized, and hence the two sources are considered in +// conflict, and not a duplicate. Hacky solution is to prefer where +// clauses over the data found in the trait definition. + +trait T { + type T; +} + +struct S; +impl T for S { + type T = S; +} + +trait T2 { + type T: Iterator::T>; +} + +fn main() { } diff --git a/src/test/ui/associated-types/issue-47139-1.rs b/src/test/ui/associated-types/issue-47139-1.rs new file mode 100644 index 00000000000..c55fc34346c --- /dev/null +++ b/src/test/ui/associated-types/issue-47139-1.rs @@ -0,0 +1,78 @@ +// run-pass +// Regression test for issue #47139: +// +// Coherence was encountering an (unnecessary) overflow trying to +// decide if the two impls of dummy overlap. +// +// The overflow went something like: +// +// - `&'a ?T: Insertable` ? +// - let ?T = Option ? +// - `Option: Insertable` ? +// - `Option<&'a ?U>: Insertable` ? +// - `&'a ?U: Insertable` ? +// +// While somewhere in the middle, a projection would occur, which +// broke cycle detection. +// +// It turned out that this cycle was being kicked off due to some +// extended diagnostic attempts in coherence, so removing those +// sidestepped the issue for now. + +#![allow(dead_code)] + +pub trait Insertable { + type Values; + + fn values(self) -> Self::Values; +} + +impl Insertable for Option + where + T: Insertable, + T::Values: Default, +{ + type Values = T::Values; + + fn values(self) -> Self::Values { + self.map(Insertable::values).unwrap_or_default() + } +} + +impl<'a, T> Insertable for &'a Option + where + Option<&'a T>: Insertable, +{ + type Values = as Insertable>::Values; + + fn values(self) -> Self::Values { + self.as_ref().values() + } +} + +impl<'a, T> Insertable for &'a [T] +{ + type Values = Self; + + fn values(self) -> Self::Values { + self + } +} + +trait Unimplemented { } + +trait Dummy { } + +struct Foo { t: T } + +impl<'a, U> Dummy for Foo<&'a U> + where &'a U: Insertable +{ +} + +impl Dummy for T + where T: Unimplemented +{ } + +fn main() { +} diff --git a/src/test/ui/associated-types/issue-54467.rs b/src/test/ui/associated-types/issue-54467.rs new file mode 100644 index 00000000000..734bf2768c2 --- /dev/null +++ b/src/test/ui/associated-types/issue-54467.rs @@ -0,0 +1,46 @@ +// run-pass + +pub trait Stream { + type Item; + type Error; +} + +pub trait ParseError { + type Output; +} + +impl ParseError for u32 { + type Output = (); +} + +impl Stream for () { + type Item = char; + type Error = u32; +} + +pub struct Lex<'a, I> + where I: Stream, + I::Error: ParseError, + <::Error as ParseError>::Output: 'a +{ + x: &'a >::Output +} + +pub struct Reserved<'a, I> where + I: Stream + 'a, + I::Error: ParseError, + <::Error as ParseError>::Output: 'a + +{ + x: Lex<'a, I> +} + +fn main() { + let r: Reserved<()> = Reserved { + x: Lex { + x: &() + } + }; + + let _v = r.x.x; +} diff --git a/src/test/ui/async-await/issue-73541-1.rs b/src/test/ui/async-await/issue-73541-1.rs new file mode 100644 index 00000000000..7fb0d6c39ff --- /dev/null +++ b/src/test/ui/async-await/issue-73541-1.rs @@ -0,0 +1,12 @@ +// edition:2018 + +fn main() { + 'a: loop { + async { + loop { + continue 'a + //~^ ERROR use of unreachable label `'a` + } + }; + } +} diff --git a/src/test/ui/async-await/issue-73541-1.stderr b/src/test/ui/async-await/issue-73541-1.stderr new file mode 100644 index 00000000000..80c1fdf002a --- /dev/null +++ b/src/test/ui/async-await/issue-73541-1.stderr @@ -0,0 +1,14 @@ +error[E0767]: use of unreachable label `'a` + --> $DIR/issue-73541-1.rs:7:26 + | +LL | 'a: loop { + | -- unreachable label defined here +... +LL | continue 'a + | ^^ unreachable label `'a` + | + = note: labels are unreachable through functions, closures, async blocks and modules + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0767`. diff --git a/src/test/ui/attributes/issue-40962.rs b/src/test/ui/attributes/issue-40962.rs new file mode 100644 index 00000000000..7b91c06819f --- /dev/null +++ b/src/test/ui/attributes/issue-40962.rs @@ -0,0 +1,11 @@ +// check-pass +macro_rules! m { + ($i:meta) => { + #[derive($i)] + struct S; + } +} + +m!(Clone); + +fn main() {} diff --git a/src/test/ui/attributes/unrestricted-attribute-tokens.rs b/src/test/ui/attributes/unrestricted-attribute-tokens.rs new file mode 100644 index 00000000000..e31bc91a00a --- /dev/null +++ b/src/test/ui/attributes/unrestricted-attribute-tokens.rs @@ -0,0 +1,8 @@ +// build-pass (FIXME(62277): could be check-pass?) + +#![feature(rustc_attrs)] + +#[rustc_dummy(a b c d)] +#[rustc_dummy[a b c d]] +#[rustc_dummy{a b c d}] +fn main() {} diff --git a/src/test/ui/auxiliary/changing-crates-a1.rs b/src/test/ui/auxiliary/changing-crates-a1.rs deleted file mode 100644 index bc0559b8b80..00000000000 --- a/src/test/ui/auxiliary/changing-crates-a1.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_name = "a"] - -pub fn foo() {} diff --git a/src/test/ui/auxiliary/changing-crates-a2.rs b/src/test/ui/auxiliary/changing-crates-a2.rs deleted file mode 100644 index fafc6d5b169..00000000000 --- a/src/test/ui/auxiliary/changing-crates-a2.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_name = "a"] - -pub fn foo() { println!("hello!"); } diff --git a/src/test/ui/auxiliary/changing-crates-b.rs b/src/test/ui/auxiliary/changing-crates-b.rs deleted file mode 100644 index f9ce29e4c4c..00000000000 --- a/src/test/ui/auxiliary/changing-crates-b.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![crate_name = "b"] - -extern crate a; - -pub fn foo() { a::foo::(); } diff --git a/src/test/ui/auxiliary/legacy-const-generics.rs b/src/test/ui/auxiliary/legacy-const-generics.rs deleted file mode 100644 index 67352a2fbbb..00000000000 --- a/src/test/ui/auxiliary/legacy-const-generics.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![feature(rustc_attrs)] - -#[rustc_legacy_const_generics(1)] -pub fn foo(x: usize, z: usize) -> [usize; 3] { - [x, Y, z] -} diff --git a/src/test/ui/auxiliary/lto-duplicate-symbols1.rs b/src/test/ui/auxiliary/lto-duplicate-symbols1.rs deleted file mode 100644 index ec6d0560357..00000000000 --- a/src/test/ui/auxiliary/lto-duplicate-symbols1.rs +++ /dev/null @@ -1,6 +0,0 @@ -// no-prefer-dynamic - -#![crate_type = "rlib"] - -#[no_mangle] -pub extern "C" fn foo() {} diff --git a/src/test/ui/auxiliary/lto-duplicate-symbols2.rs b/src/test/ui/auxiliary/lto-duplicate-symbols2.rs deleted file mode 100644 index ec6d0560357..00000000000 --- a/src/test/ui/auxiliary/lto-duplicate-symbols2.rs +++ /dev/null @@ -1,6 +0,0 @@ -// no-prefer-dynamic - -#![crate_type = "rlib"] - -#[no_mangle] -pub extern "C" fn foo() {} diff --git a/src/test/ui/auxiliary/lto-rustc-loads-linker-plugin.rs b/src/test/ui/auxiliary/lto-rustc-loads-linker-plugin.rs deleted file mode 100644 index d24375b2d0a..00000000000 --- a/src/test/ui/auxiliary/lto-rustc-loads-linker-plugin.rs +++ /dev/null @@ -1,6 +0,0 @@ -// compile-flags: -Clinker-plugin-lto -// no-prefer-dynamic - -#![crate_type = "rlib"] - -pub fn foo() {} diff --git a/src/test/ui/auxiliary/nested_item.rs b/src/test/ui/auxiliary/nested_item.rs deleted file mode 100644 index 9db9d19d6f6..00000000000 --- a/src/test/ui/auxiliary/nested_item.rs +++ /dev/null @@ -1,30 +0,0 @@ -// original problem -pub fn foo() -> isize { - { - static foo: isize = 2; - foo - } -} - -// issue 8134 -struct Foo; -impl Foo { - pub fn foo(&self) { - static X: usize = 1; - } -} - -// issue 8134 -pub struct Parser(T); -impl> Parser { - fn in_doctype(&mut self) { - static DOCTYPEPattern: [char; 6] = ['O', 'C', 'T', 'Y', 'P', 'E']; - } -} - -struct Bar; -impl Foo { - pub fn bar(&self) { - static X: usize = 1; - } -} diff --git a/src/test/ui/bastion-of-the-turbofish.rs b/src/test/ui/bastion-of-the-turbofish.rs deleted file mode 100644 index e12857008a5..00000000000 --- a/src/test/ui/bastion-of-the-turbofish.rs +++ /dev/null @@ -1,43 +0,0 @@ -// check-pass - -// Bastion of the Turbofish -// ------------------------ -// Beware travellers, lest you venture into waters callous and unforgiving, -// where hope must be abandoned, ere it is cruelly torn from you. For here -// stands the bastion of the Turbofish: an impenetrable fortress holding -// unshaking against those who would dare suggest the supererogation of the -// Turbofish. -// -// Once I was young and foolish and had the impudence to imagine that I could -// shake free from the coils by which that creature had us tightly bound. I -// dared to suggest that there was a better way: a brighter future, in which -// Rustaceans both new and old could be rid of that vile beast. But alas! In -// my foolhardiness my ignorance was unveiled and my dreams were dashed -// unforgivingly against the rock of syntactic ambiguity. -// -// This humble program, small and insignificant though it might seem, -// demonstrates that to which we had previously cast a blind eye: an ambiguity -// in permitting generic arguments to be provided without the consent of the -// Great Turbofish. Should you be so naïve as to try to revolt against its -// mighty clutches, here shall its wrath be indomitably displayed. This -// program must pass for all eternity: forever watched by the guardian angel -// which gave this beast its name, and stands fundamentally at odds with the -// impetuous rebellion against the Turbofish. -// -// My heart aches in sorrow, for I know I am defeated. Let this be a warning -// to all those who come after: for they too must overcome the impassible -// hurdle of defeating the great beast, championed by a resolute winged -// guardian. -// -// Here stands the Bastion of the Turbofish, a memorial to Anna Harren, -// Guardian Angel of these Hallowed Grounds. <3 - -// See https://github.com/rust-lang/rust/pull/53562 -// and https://github.com/rust-lang/rfcs/pull/2527 -// and https://twitter.com/garblefart/status/1393236602856611843 -// for context. - -fn main() { - let (the, guardian, stands, resolute) = ("the", "Turbofish", "remains", "undefeated"); - let _: (bool, bool) = (the(resolute)); -} diff --git a/src/test/ui/binop/structured-compare.rs b/src/test/ui/binop/structured-compare.rs new file mode 100644 index 00000000000..63d30c4da89 --- /dev/null +++ b/src/test/ui/binop/structured-compare.rs @@ -0,0 +1,30 @@ +// run-pass + +#![allow(non_camel_case_types)] + + +#[derive(Copy, Clone, Debug)] +enum foo { large, small, } + +impl PartialEq for foo { + fn eq(&self, other: &foo) -> bool { + ((*self) as usize) == ((*other) as usize) + } + fn ne(&self, other: &foo) -> bool { !(*self).eq(other) } +} + +pub fn main() { + let a = (1, 2, 3); + let b = (1, 2, 3); + assert_eq!(a, b); + assert!((a != (1, 2, 4))); + assert!((a < (1, 2, 4))); + assert!((a <= (1, 2, 4))); + assert!(((1, 2, 4) > a)); + assert!(((1, 2, 4) >= a)); + let x = foo::large; + let y = foo::small; + assert!((x != y)); + assert_eq!(x, foo::large); + assert!((x != foo::small)); +} diff --git a/src/test/ui/borrowck/issue-46095.rs b/src/test/ui/borrowck/issue-46095.rs new file mode 100644 index 00000000000..59ddb60c9f2 --- /dev/null +++ b/src/test/ui/borrowck/issue-46095.rs @@ -0,0 +1,30 @@ +// run-pass +struct A; + +impl A { + fn take_mutably(&mut self) {} +} + +fn identity(t: T) -> T { + t +} + +// Issue 46095 +// Built-in indexing should be used even when the index is not +// trivially an integer +// Overloaded indexing would cause wrapped to be borrowed mutably + +fn main() { + let mut a1 = A; + let mut a2 = A; + + let wrapped = [&mut a1, &mut a2]; + + { + wrapped[0 + 1 - 1].take_mutably(); + } + + { + wrapped[identity(0)].take_mutably(); + } +} diff --git a/src/test/ui/box/new-box.rs b/src/test/ui/box/new-box.rs new file mode 100644 index 00000000000..96a3b197f46 --- /dev/null +++ b/src/test/ui/box/new-box.rs @@ -0,0 +1,30 @@ +// run-pass + +fn f(x: Box) { + let y: &isize = &*x; + println!("{}", *x); + println!("{}", *y); +} + +trait Trait { + fn printme(&self); +} + +struct Struct; + +impl Trait for Struct { + fn printme(&self) { + println!("hello world!"); + } +} + +fn g(x: Box) { + x.printme(); + let y: &dyn Trait = &*x; + y.printme(); +} + +fn main() { + f(Box::new(1234)); + g(Box::new(Struct) as Box); +} diff --git a/src/test/ui/c-variadic/issue-32201.rs b/src/test/ui/c-variadic/issue-32201.rs new file mode 100644 index 00000000000..f27bb1c2eb5 --- /dev/null +++ b/src/test/ui/c-variadic/issue-32201.rs @@ -0,0 +1,13 @@ +extern "C" { + fn foo(a: i32, ...); +} + +fn bar(_: *const u8) {} + +fn main() { + unsafe { + foo(0, bar); + //~^ ERROR can't pass `fn(*const u8) {bar}` to variadic function + //~| HELP cast the value to `fn(*const u8)` + } +} diff --git a/src/test/ui/c-variadic/issue-32201.stderr b/src/test/ui/c-variadic/issue-32201.stderr new file mode 100644 index 00000000000..cedb5878466 --- /dev/null +++ b/src/test/ui/c-variadic/issue-32201.stderr @@ -0,0 +1,9 @@ +error[E0617]: can't pass `fn(*const u8) {bar}` to variadic function + --> $DIR/issue-32201.rs:9:16 + | +LL | foo(0, bar); + | ^^^ help: cast the value to `fn(*const u8)`: `bar as fn(*const u8)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0617`. diff --git a/src/test/ui/cast/supported-cast.rs b/src/test/ui/cast/supported-cast.rs new file mode 100644 index 00000000000..ff41ce6c79a --- /dev/null +++ b/src/test/ui/cast/supported-cast.rs @@ -0,0 +1,206 @@ +// run-pass + +pub fn main() { + let f = 1_usize as *const String; + println!("{:?}", f as isize); + println!("{:?}", f as usize); + println!("{:?}", f as i8); + println!("{:?}", f as i16); + println!("{:?}", f as i32); + println!("{:?}", f as i64); + println!("{:?}", f as u8); + println!("{:?}", f as u16); + println!("{:?}", f as u32); + println!("{:?}", f as u64); + + println!("{:?}", 1 as isize); + println!("{:?}", 1 as usize); + println!("{:?}", 1 as *const String); + println!("{:?}", 1 as i8); + println!("{:?}", 1 as i16); + println!("{:?}", 1 as i32); + println!("{:?}", 1 as i64); + println!("{:?}", 1 as u8); + println!("{:?}", 1 as u16); + println!("{:?}", 1 as u32); + println!("{:?}", 1 as u64); + println!("{:?}", 1 as f32); + println!("{:?}", 1 as f64); + + println!("{:?}", 1_usize as isize); + println!("{:?}", 1_usize as usize); + println!("{:?}", 1_usize as *const String); + println!("{:?}", 1_usize as i8); + println!("{:?}", 1_usize as i16); + println!("{:?}", 1_usize as i32); + println!("{:?}", 1_usize as i64); + println!("{:?}", 1_usize as u8); + println!("{:?}", 1_usize as u16); + println!("{:?}", 1_usize as u32); + println!("{:?}", 1_usize as u64); + println!("{:?}", 1_usize as f32); + println!("{:?}", 1_usize as f64); + + println!("{:?}", 1i8 as isize); + println!("{:?}", 1i8 as usize); + println!("{:?}", 1i8 as *const String); + println!("{:?}", 1i8 as i8); + println!("{:?}", 1i8 as i16); + println!("{:?}", 1i8 as i32); + println!("{:?}", 1i8 as i64); + println!("{:?}", 1i8 as u8); + println!("{:?}", 1i8 as u16); + println!("{:?}", 1i8 as u32); + println!("{:?}", 1i8 as u64); + println!("{:?}", 1i8 as f32); + println!("{:?}", 1i8 as f64); + + println!("{:?}", 1u8 as isize); + println!("{:?}", 1u8 as usize); + println!("{:?}", 1u8 as *const String); + println!("{:?}", 1u8 as i8); + println!("{:?}", 1u8 as i16); + println!("{:?}", 1u8 as i32); + println!("{:?}", 1u8 as i64); + println!("{:?}", 1u8 as u8); + println!("{:?}", 1u8 as u16); + println!("{:?}", 1u8 as u32); + println!("{:?}", 1u8 as u64); + println!("{:?}", 1u8 as f32); + println!("{:?}", 1u8 as f64); + + println!("{:?}", 1i16 as isize); + println!("{:?}", 1i16 as usize); + println!("{:?}", 1i16 as *const String); + println!("{:?}", 1i16 as i8); + println!("{:?}", 1i16 as i16); + println!("{:?}", 1i16 as i32); + println!("{:?}", 1i16 as i64); + println!("{:?}", 1i16 as u8); + println!("{:?}", 1i16 as u16); + println!("{:?}", 1i16 as u32); + println!("{:?}", 1i16 as u64); + println!("{:?}", 1i16 as f32); + println!("{:?}", 1i16 as f64); + + println!("{:?}", 1u16 as isize); + println!("{:?}", 1u16 as usize); + println!("{:?}", 1u16 as *const String); + println!("{:?}", 1u16 as i8); + println!("{:?}", 1u16 as i16); + println!("{:?}", 1u16 as i32); + println!("{:?}", 1u16 as i64); + println!("{:?}", 1u16 as u8); + println!("{:?}", 1u16 as u16); + println!("{:?}", 1u16 as u32); + println!("{:?}", 1u16 as u64); + println!("{:?}", 1u16 as f32); + println!("{:?}", 1u16 as f64); + + println!("{:?}", 1i32 as isize); + println!("{:?}", 1i32 as usize); + println!("{:?}", 1i32 as *const String); + println!("{:?}", 1i32 as i8); + println!("{:?}", 1i32 as i16); + println!("{:?}", 1i32 as i32); + println!("{:?}", 1i32 as i64); + println!("{:?}", 1i32 as u8); + println!("{:?}", 1i32 as u16); + println!("{:?}", 1i32 as u32); + println!("{:?}", 1i32 as u64); + println!("{:?}", 1i32 as f32); + println!("{:?}", 1i32 as f64); + + println!("{:?}", 1u32 as isize); + println!("{:?}", 1u32 as usize); + println!("{:?}", 1u32 as *const String); + println!("{:?}", 1u32 as i8); + println!("{:?}", 1u32 as i16); + println!("{:?}", 1u32 as i32); + println!("{:?}", 1u32 as i64); + println!("{:?}", 1u32 as u8); + println!("{:?}", 1u32 as u16); + println!("{:?}", 1u32 as u32); + println!("{:?}", 1u32 as u64); + println!("{:?}", 1u32 as f32); + println!("{:?}", 1u32 as f64); + + println!("{:?}", 1i64 as isize); + println!("{:?}", 1i64 as usize); + println!("{:?}", 1i64 as *const String); + println!("{:?}", 1i64 as i8); + println!("{:?}", 1i64 as i16); + println!("{:?}", 1i64 as i32); + println!("{:?}", 1i64 as i64); + println!("{:?}", 1i64 as u8); + println!("{:?}", 1i64 as u16); + println!("{:?}", 1i64 as u32); + println!("{:?}", 1i64 as u64); + println!("{:?}", 1i64 as f32); + println!("{:?}", 1i64 as f64); + + println!("{:?}", 1u64 as isize); + println!("{:?}", 1u64 as usize); + println!("{:?}", 1u64 as *const String); + println!("{:?}", 1u64 as i8); + println!("{:?}", 1u64 as i16); + println!("{:?}", 1u64 as i32); + println!("{:?}", 1u64 as i64); + println!("{:?}", 1u64 as u8); + println!("{:?}", 1u64 as u16); + println!("{:?}", 1u64 as u32); + println!("{:?}", 1u64 as u64); + println!("{:?}", 1u64 as f32); + println!("{:?}", 1u64 as f64); + + println!("{:?}", 1u64 as isize); + println!("{:?}", 1u64 as usize); + println!("{:?}", 1u64 as *const String); + println!("{:?}", 1u64 as i8); + println!("{:?}", 1u64 as i16); + println!("{:?}", 1u64 as i32); + println!("{:?}", 1u64 as i64); + println!("{:?}", 1u64 as u8); + println!("{:?}", 1u64 as u16); + println!("{:?}", 1u64 as u32); + println!("{:?}", 1u64 as u64); + println!("{:?}", 1u64 as f32); + println!("{:?}", 1u64 as f64); + + println!("{:?}", true as isize); + println!("{:?}", true as usize); + println!("{:?}", true as i8); + println!("{:?}", true as i16); + println!("{:?}", true as i32); + println!("{:?}", true as i64); + println!("{:?}", true as u8); + println!("{:?}", true as u16); + println!("{:?}", true as u32); + println!("{:?}", true as u64); + + println!("{:?}", 1f32 as isize); + println!("{:?}", 1f32 as usize); + println!("{:?}", 1f32 as i8); + println!("{:?}", 1f32 as i16); + println!("{:?}", 1f32 as i32); + println!("{:?}", 1f32 as i64); + println!("{:?}", 1f32 as u8); + println!("{:?}", 1f32 as u16); + println!("{:?}", 1f32 as u32); + println!("{:?}", 1f32 as u64); + println!("{:?}", 1f32 as f32); + println!("{:?}", 1f32 as f64); + + println!("{:?}", 1f64 as isize); + println!("{:?}", 1f64 as usize); + println!("{:?}", 1f64 as i8); + println!("{:?}", 1f64 as i16); + println!("{:?}", 1f64 as i32); + println!("{:?}", 1f64 as i64); + println!("{:?}", 1f64 as u8); + println!("{:?}", 1f64 as u16); + println!("{:?}", 1f64 as u32); + println!("{:?}", 1f64 as u64); + println!("{:?}", 1f64 as f32); + println!("{:?}", 1f64 as f64); +} diff --git a/src/test/ui/changing-crates.rs b/src/test/ui/changing-crates.rs deleted file mode 100644 index 60c043bc43f..00000000000 --- a/src/test/ui/changing-crates.rs +++ /dev/null @@ -1,12 +0,0 @@ -// ignore-msvc FIXME #31306 - -// note that these aux-build directives must be in this order -// aux-build:changing-crates-a1.rs -// aux-build:changing-crates-b.rs -// aux-build:changing-crates-a2.rs -// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" - -extern crate a; -extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on - -fn main() {} diff --git a/src/test/ui/changing-crates.stderr b/src/test/ui/changing-crates.stderr deleted file mode 100644 index cc62a4d4d9d..00000000000 --- a/src/test/ui/changing-crates.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0460]: found possibly newer version of crate `a` which `b` depends on - --> $DIR/changing-crates.rs:10:1 - | -LL | extern crate b; - | ^^^^^^^^^^^^^^^ - | - = note: perhaps that crate needs to be recompiled? - = note: the following crate versions were found: - crate `a`: $PATH_a - crate `b`: $PATH_b - -error: aborting due to previous error - diff --git a/src/test/ui/closures/issue-10398.rs b/src/test/ui/closures/issue-10398.rs new file mode 100644 index 00000000000..0405b2d01e2 --- /dev/null +++ b/src/test/ui/closures/issue-10398.rs @@ -0,0 +1,11 @@ +#![feature(box_syntax)] + +fn main() { + let x: Box<_> = box 1; + let f = move|| { + let _a = x; + drop(x); + //~^ ERROR: use of moved value: `x` + }; + f(); +} diff --git a/src/test/ui/closures/issue-10398.stderr b/src/test/ui/closures/issue-10398.stderr new file mode 100644 index 00000000000..8d9faf324e8 --- /dev/null +++ b/src/test/ui/closures/issue-10398.stderr @@ -0,0 +1,13 @@ +error[E0382]: use of moved value: `x` + --> $DIR/issue-10398.rs:7:14 + | +LL | let _a = x; + | - value moved here +LL | drop(x); + | ^ value used here after move + | + = note: move occurs because `x` has type `Box`, which does not implement the `Copy` trait + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/src/test/ui/closures/issue-42463.rs b/src/test/ui/closures/issue-42463.rs new file mode 100644 index 00000000000..51d6ea3f7a8 --- /dev/null +++ b/src/test/ui/closures/issue-42463.rs @@ -0,0 +1,32 @@ +// run-pass +use std::ops::{Deref, DerefMut}; + +struct CheckedDeref { + value: T, + check: F +} + +impl bool, T> Deref for CheckedDeref { + type Target = T; + fn deref(&self) -> &T { + assert!((self.check)(&self.value)); + &self.value + } +} + +impl bool, T> DerefMut for CheckedDeref { + fn deref_mut(&mut self) -> &mut T { + assert!((self.check)(&self.value)); + &mut self.value + } +} + + +fn main() { + let mut v = CheckedDeref { + value: vec![0], + check: |v: &Vec<_>| !v.is_empty() + }; + v.push(1); + assert_eq!(*v, vec![0, 1]); +} diff --git a/src/test/ui/coercion/auxiliary/issue-39823.rs b/src/test/ui/coercion/auxiliary/issue-39823.rs new file mode 100644 index 00000000000..3af9c68f233 --- /dev/null +++ b/src/test/ui/coercion/auxiliary/issue-39823.rs @@ -0,0 +1,7 @@ +#![crate_type="rlib"] + +#[derive(Debug, PartialEq)] +pub struct RemoteC(pub u32); + +#[derive(Debug, PartialEq)] +pub struct RemoteG(pub T); diff --git a/src/test/ui/coercion/issue-14589.rs b/src/test/ui/coercion/issue-14589.rs new file mode 100644 index 00000000000..5d8aab2ce74 --- /dev/null +++ b/src/test/ui/coercion/issue-14589.rs @@ -0,0 +1,24 @@ +// run-pass +// All 3 expressions should work in that the argument gets +// coerced to a trait object + +// pretty-expanded FIXME #23616 + +fn main() { + send::>(Box::new(Output(0))); + Test::>::foo(Box::new(Output(0))); + Test::>::new().send(Box::new(Output(0))); +} + +fn send(_: T) {} + +struct Test { marker: std::marker::PhantomData } +impl Test { + fn new() -> Test { Test { marker: ::std::marker::PhantomData } } + fn foo(_: T) {} + fn send(&self, _: T) {} +} + +trait Foo { fn dummy(&self) { }} +struct Output(isize); +impl Foo for Output {} diff --git a/src/test/ui/coercion/issue-39823.rs b/src/test/ui/coercion/issue-39823.rs new file mode 100644 index 00000000000..148cf527e7c --- /dev/null +++ b/src/test/ui/coercion/issue-39823.rs @@ -0,0 +1,25 @@ +// run-pass +// aux-build:issue-39823.rs + +extern crate issue_39823; +use issue_39823::{RemoteC, RemoteG}; + +#[derive(Debug, PartialEq)] +struct LocalC(u32); + +#[derive(Debug, PartialEq)] +struct LocalG(T); + +fn main() { + let virtual_localc : &dyn Fn(_) -> LocalC = &LocalC; + assert_eq!(virtual_localc(1), LocalC(1)); + + let virtual_localg : &dyn Fn(_) -> LocalG = &LocalG; + assert_eq!(virtual_localg(1), LocalG(1)); + + let virtual_remotec : &dyn Fn(_) -> RemoteC = &RemoteC; + assert_eq!(virtual_remotec(1), RemoteC(1)); + + let virtual_remoteg : &dyn Fn(_) -> RemoteG = &RemoteG; + assert_eq!(virtual_remoteg(1), RemoteG(1)); +} diff --git a/src/test/ui/coercion/issue-73886.rs b/src/test/ui/coercion/issue-73886.rs new file mode 100644 index 00000000000..9c0c87a5cf2 --- /dev/null +++ b/src/test/ui/coercion/issue-73886.rs @@ -0,0 +1,6 @@ +fn main() { + let _ = &&[0] as &[_]; + //~^ ERROR non-primitive cast: `&&[i32; 1]` as `&[_]` + let _ = 7u32 as Option<_>; + //~^ ERROR non-primitive cast: `u32` as `Option<_>` +} diff --git a/src/test/ui/coercion/issue-73886.stderr b/src/test/ui/coercion/issue-73886.stderr new file mode 100644 index 00000000000..a6f8ba65ab5 --- /dev/null +++ b/src/test/ui/coercion/issue-73886.stderr @@ -0,0 +1,17 @@ +error[E0605]: non-primitive cast: `&&[i32; 1]` as `&[_]` + --> $DIR/issue-73886.rs:2:13 + | +LL | let _ = &&[0] as &[_]; + | ^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object + +error[E0605]: non-primitive cast: `u32` as `Option<_>` + --> $DIR/issue-73886.rs:4:13 + | +LL | let _ = 7u32 as Option<_>; + | ^^^^^^^^^^^^^^^^^ help: consider using the `From` trait instead: `Option<_>::from(7u32)` + | + = note: an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0605`. diff --git a/src/test/ui/conditional-compilation/issue-34028.rs b/src/test/ui/conditional-compilation/issue-34028.rs new file mode 100644 index 00000000000..d761c0c823b --- /dev/null +++ b/src/test/ui/conditional-compilation/issue-34028.rs @@ -0,0 +1,10 @@ +// check-pass + +macro_rules! m { + () => { #[cfg(any())] fn f() {} } +} + +trait T {} +impl T for () { m!(); } + +fn main() {} diff --git a/src/test/ui/const-generics/auxiliary/legacy-const-generics.rs b/src/test/ui/const-generics/auxiliary/legacy-const-generics.rs new file mode 100644 index 00000000000..67352a2fbbb --- /dev/null +++ b/src/test/ui/const-generics/auxiliary/legacy-const-generics.rs @@ -0,0 +1,6 @@ +#![feature(rustc_attrs)] + +#[rustc_legacy_const_generics(1)] +pub fn foo(x: usize, z: usize) -> [usize; 3] { + [x, Y, z] +} diff --git a/src/test/ui/const-generics/legacy-const-generics-bad.rs b/src/test/ui/const-generics/legacy-const-generics-bad.rs new file mode 100644 index 00000000000..538eee337cc --- /dev/null +++ b/src/test/ui/const-generics/legacy-const-generics-bad.rs @@ -0,0 +1,16 @@ +// aux-build:legacy-const-generics.rs + +extern crate legacy_const_generics; + +fn foo() { + let a = 1; + legacy_const_generics::foo(0, a, 2); + //~^ ERROR attempt to use a non-constant value in a constant + + legacy_const_generics::foo(0, N, 2); + + legacy_const_generics::foo(0, N + 1, 2); + //~^ ERROR generic parameters may not be used in const operations +} + +fn main() {} diff --git a/src/test/ui/const-generics/legacy-const-generics-bad.stderr b/src/test/ui/const-generics/legacy-const-generics-bad.stderr new file mode 100644 index 00000000000..3c78dd6c780 --- /dev/null +++ b/src/test/ui/const-generics/legacy-const-generics-bad.stderr @@ -0,0 +1,20 @@ +error[E0435]: attempt to use a non-constant value in a constant + --> $DIR/legacy-const-generics-bad.rs:7:35 + | +LL | let a = 1; + | ----- help: consider using `const` instead of `let`: `const a` +LL | legacy_const_generics::foo(0, a, 2); + | ^ non-constant value + +error: generic parameters may not be used in const operations + --> $DIR/legacy-const-generics-bad.rs:12:35 + | +LL | legacy_const_generics::foo(0, N + 1, 2); + | ^ cannot perform const operation using `N` + | + = help: const parameters may only be used as standalone arguments, i.e. `N` + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0435`. diff --git a/src/test/ui/const-generics/legacy-const-generics.rs b/src/test/ui/const-generics/legacy-const-generics.rs new file mode 100644 index 00000000000..9abc72d98e6 --- /dev/null +++ b/src/test/ui/const-generics/legacy-const-generics.rs @@ -0,0 +1,18 @@ +// aux-build:legacy-const-generics.rs +// run-pass + +#![feature(rustc_attrs)] + +extern crate legacy_const_generics; + +#[rustc_legacy_const_generics(1)] +pub fn bar(x: usize, z: usize) -> [usize; 3] { + [x, Y, z] +} + +fn main() { + assert_eq!(legacy_const_generics::foo(0 + 0, 1 + 1, 2 + 2), [0, 2, 4]); + assert_eq!(legacy_const_generics::foo::<{1 + 1}>(0 + 0, 2 + 2), [0, 2, 4]); + // FIXME: Only works cross-crate + //assert_eq!(bar(0, 1, 2), [0, 1, 2]); +} diff --git a/src/test/ui/consts/issue-13902.rs b/src/test/ui/consts/issue-13902.rs new file mode 100644 index 00000000000..1afde0ebe85 --- /dev/null +++ b/src/test/ui/consts/issue-13902.rs @@ -0,0 +1,16 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] + +const JSVAL_TAG_CLEAR: u32 = 0xFFFFFF80; +const JSVAL_TYPE_INT32: u8 = 0x01; +const JSVAL_TYPE_UNDEFINED: u8 = 0x02; +#[repr(u32)] +enum ValueTag { + JSVAL_TAG_INT32 = JSVAL_TAG_CLEAR | (JSVAL_TYPE_INT32 as u32), + JSVAL_TAG_UNDEFINED = JSVAL_TAG_CLEAR | (JSVAL_TYPE_UNDEFINED as u32), +} + +fn main() { + let _ = ValueTag::JSVAL_TAG_INT32; +} diff --git a/src/test/ui/consts/issue-17074.rs b/src/test/ui/consts/issue-17074.rs new file mode 100644 index 00000000000..0ed81132ec6 --- /dev/null +++ b/src/test/ui/consts/issue-17074.rs @@ -0,0 +1,15 @@ +// run-pass +#![allow(dead_code)] + +static X2: u64 = !0 as u16 as u64; +static Y2: u64 = !0 as u32 as u64; +const X: u64 = !0 as u16 as u64; +const Y: u64 = !0 as u32 as u64; + +fn main() { + assert_eq!(match 1 { + X => unreachable!(), + Y => unreachable!(), + _ => 1 + }, 1); +} diff --git a/src/test/ui/consts/issue-18294.rs b/src/test/ui/consts/issue-18294.rs new file mode 100644 index 00000000000..77355f0d7c9 --- /dev/null +++ b/src/test/ui/consts/issue-18294.rs @@ -0,0 +1,5 @@ +fn main() { + const X: u32 = 1; + const Y: usize = unsafe { &X as *const u32 as usize }; //~ ERROR pointers cannot be cast to integers + println!("{}", Y); +} diff --git a/src/test/ui/consts/issue-18294.stderr b/src/test/ui/consts/issue-18294.stderr new file mode 100644 index 00000000000..e0cbd2a216d --- /dev/null +++ b/src/test/ui/consts/issue-18294.stderr @@ -0,0 +1,11 @@ +error: pointers cannot be cast to integers during const eval + --> $DIR/issue-18294.rs:3:31 + | +LL | const Y: usize = unsafe { &X as *const u32 as usize }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: at compile-time, pointers do not have an integer value + = note: avoiding this restriction via `transmute`, `union`, or raw pointers leads to compile-time undefined behavior + +error: aborting due to previous error + diff --git a/src/test/ui/consts/issue-23968-const-not-overflow.rs b/src/test/ui/consts/issue-23968-const-not-overflow.rs new file mode 100644 index 00000000000..b9593021235 --- /dev/null +++ b/src/test/ui/consts/issue-23968-const-not-overflow.rs @@ -0,0 +1,12 @@ +// run-pass +const U8_MAX_HALF: u8 = !0u8 / 2; +const U16_MAX_HALF: u16 = !0u16 / 2; +const U32_MAX_HALF: u32 = !0u32 / 2; +const U64_MAX_HALF: u64 = !0u64 / 2; + +fn main() { + assert_eq!(U8_MAX_HALF, 0x7f); + assert_eq!(U16_MAX_HALF, 0x7fff); + assert_eq!(U32_MAX_HALF, 0x7fff_ffff); + assert_eq!(U64_MAX_HALF, 0x7fff_ffff_ffff_ffff); +} diff --git a/src/test/ui/consts/issue-37550-1.rs b/src/test/ui/consts/issue-37550-1.rs new file mode 100644 index 00000000000..35b63bddca2 --- /dev/null +++ b/src/test/ui/consts/issue-37550-1.rs @@ -0,0 +1,6 @@ +const fn x() { + let t = true; + let x = || t; //~ ERROR function pointer +} + +fn main() {} diff --git a/src/test/ui/consts/issue-37550-1.stderr b/src/test/ui/consts/issue-37550-1.stderr new file mode 100644 index 00000000000..f66d7067870 --- /dev/null +++ b/src/test/ui/consts/issue-37550-1.stderr @@ -0,0 +1,12 @@ +error[E0658]: function pointers cannot appear in constant functions + --> $DIR/issue-37550-1.rs:3:9 + | +LL | let x = || t; + | ^ + | + = note: see issue #57563 for more information + = help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/issue-37991.rs b/src/test/ui/consts/issue-37991.rs new file mode 100644 index 00000000000..a6ac4d5ca2e --- /dev/null +++ b/src/test/ui/consts/issue-37991.rs @@ -0,0 +1,17 @@ +// run-pass + +const fn foo() -> i64 { + 3 +} + +const fn bar(x: i64) -> i64 { + x*2 +} + +fn main() { + let val = &(foo() % 2); + assert_eq!(*val, 1); + + let val2 = &(bar(1+1) % 3); + assert_eq!(*val2, 1); +} diff --git a/src/test/ui/deprecation/try-macro-suggestion.rs b/src/test/ui/deprecation/try-macro-suggestion.rs new file mode 100644 index 00000000000..635ceac0b19 --- /dev/null +++ b/src/test/ui/deprecation/try-macro-suggestion.rs @@ -0,0 +1,9 @@ +// compile-flags: --edition 2018 +fn foo() -> Result<(), ()> { + Ok(try!()); //~ ERROR use of deprecated `try` macro + Ok(try!(Ok(()))) //~ ERROR use of deprecated `try` macro +} + +fn main() { + let _ = foo(); +} diff --git a/src/test/ui/deprecation/try-macro-suggestion.stderr b/src/test/ui/deprecation/try-macro-suggestion.stderr new file mode 100644 index 00000000000..c7dde7eeac3 --- /dev/null +++ b/src/test/ui/deprecation/try-macro-suggestion.stderr @@ -0,0 +1,31 @@ +error: use of deprecated `try` macro + --> $DIR/try-macro-suggestion.rs:3:8 + | +LL | Ok(try!()); + | ^^^^^^ + | + = note: in the 2018 edition `try` is a reserved keyword, and the `try!()` macro is deprecated +help: you can still access the deprecated `try!()` macro using the "raw identifier" syntax + | +LL | Ok(r#try!()); + | ++ + +error: use of deprecated `try` macro + --> $DIR/try-macro-suggestion.rs:4:8 + | +LL | Ok(try!(Ok(()))) + | ^^^^^^^^^^^^ + | + = note: in the 2018 edition `try` is a reserved keyword, and the `try!()` macro is deprecated +help: you can use the `?` operator instead + | +LL - Ok(try!(Ok(()))) +LL + Ok(Ok(())?) + | +help: alternatively, you can still access the deprecated `try!()` macro using the "raw identifier" syntax + | +LL | Ok(r#try!(Ok(()))) + | ++ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/deriving/issue-19358.rs b/src/test/ui/deriving/issue-19358.rs new file mode 100644 index 00000000000..3970a4155e9 --- /dev/null +++ b/src/test/ui/deriving/issue-19358.rs @@ -0,0 +1,23 @@ +// run-pass + +#![allow(dead_code)] + +trait Trait { fn dummy(&self) { } } + +#[derive(Debug)] +struct Foo { + foo: T, +} + +#[derive(Debug)] +struct Bar where T: Trait { + bar: T, +} + +impl Trait for isize {} + +fn main() { + let a = Foo { foo: 12 }; + let b = Bar { bar: 12 }; + println!("{:?} {:?}", a, b); +} diff --git a/src/test/ui/deriving/issue-58319.rs b/src/test/ui/deriving/issue-58319.rs new file mode 100644 index 00000000000..757307d944f --- /dev/null +++ b/src/test/ui/deriving/issue-58319.rs @@ -0,0 +1,621 @@ +// run-pass +fn main() {} +#[derive(Clone)] +pub struct Little; +#[derive(Clone)] +pub struct Big( + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, +); diff --git a/src/test/ui/diverging-tuple-parts-39485.rs b/src/test/ui/diverging-tuple-parts-39485.rs deleted file mode 100644 index 0cde6119308..00000000000 --- a/src/test/ui/diverging-tuple-parts-39485.rs +++ /dev/null @@ -1,15 +0,0 @@ -// After #39485, this test used to pass, but that change was reverted -// due to numerous inference failures like #39808, so it now fails -// again. #39485 made it so that diverging types never propagate -// upward; but we now do propagate such types upward in many more -// cases. - -fn g() { - &panic!() //~ ERROR mismatched types -} - -fn f() -> isize { - (return 1, return 2) //~ ERROR mismatched types -} - -fn main() {} diff --git a/src/test/ui/diverging-tuple-parts-39485.stderr b/src/test/ui/diverging-tuple-parts-39485.stderr deleted file mode 100644 index 32967b376ca..00000000000 --- a/src/test/ui/diverging-tuple-parts-39485.stderr +++ /dev/null @@ -1,32 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/diverging-tuple-parts-39485.rs:8:5 - | -LL | &panic!() - | ^^^^^^^^^ expected `()`, found reference - | - = note: expected unit type `()` - found reference `&_` -help: try adding a return type - | -LL | fn g() -> &_ { - | +++++ -help: consider removing the borrow - | -LL - &panic!() -LL + panic!() - | - -error[E0308]: mismatched types - --> $DIR/diverging-tuple-parts-39485.rs:12:5 - | -LL | fn f() -> isize { - | ----- expected `isize` because of return type -LL | (return 1, return 2) - | ^^^^^^^^^^^^^^^^^^^^ expected `isize`, found tuple - | - = note: expected type `isize` - found tuple `(!, !)` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/drop/issue-35546.rs b/src/test/ui/drop/issue-35546.rs new file mode 100644 index 00000000000..004679a6240 --- /dev/null +++ b/src/test/ui/drop/issue-35546.rs @@ -0,0 +1,20 @@ +// build-pass +#![allow(dead_code)] +// Regression test for #35546. Check that we are able to codegen +// this. Before we had problems because of the drop glue signature +// around dropping a trait object (specifically, when dropping the +// `value` field of `Node`). + +struct Node { + next: Option>>, + value: T, +} + +fn clear(head: &mut Option>>) { + match head.take() { + Some(node) => *head = node.next, + None => (), + } +} + +fn main() {} diff --git a/src/test/ui/drop/terminate-in-initializer.rs b/src/test/ui/drop/terminate-in-initializer.rs new file mode 100644 index 00000000000..c9cb932e62a --- /dev/null +++ b/src/test/ui/drop/terminate-in-initializer.rs @@ -0,0 +1,33 @@ +// run-pass +// ignore-emscripten no threads support + +// Issue #787 +// Don't try to clean up uninitialized locals + + +use std::thread; + +fn test_break() { loop { let _x: Box = break; } } + +fn test_cont() { let mut i = 0; while i < 1 { i += 1; let _x: Box = continue; } } + +fn test_ret() { let _x: Box = return; } + +fn test_panic() { + fn f() { let _x: Box = panic!(); } + thread::spawn(move|| f() ).join().unwrap_err(); +} + +fn test_panic_indirect() { + fn f() -> ! { panic!(); } + fn g() { let _x: Box = f(); } + thread::spawn(move|| g() ).join().unwrap_err(); +} + +pub fn main() { + test_break(); + test_cont(); + test_ret(); + test_panic(); + test_panic_indirect(); +} diff --git a/src/test/ui/dropck/issue-28498-ugeh-with-passed-to-fn.rs b/src/test/ui/dropck/issue-28498-ugeh-with-passed-to-fn.rs new file mode 100644 index 00000000000..23fd86a093b --- /dev/null +++ b/src/test/ui/dropck/issue-28498-ugeh-with-passed-to-fn.rs @@ -0,0 +1,46 @@ +// run-pass + +// Demonstrate the use of the unguarded escape hatch with a type param in negative position +// to assert that destructor will not access any dead data. +// +// Compare with ui/span/issue28498-reject-lifetime-param.rs + +// Demonstrate that a type param in negative position causes dropck to reject code +// that might indirectly access previously dropped value. +// +// Compare with run-pass/issue28498-ugeh-with-passed-to-fn.rs + +#![feature(dropck_eyepatch)] + +#[derive(Debug)] +struct ScribbleOnDrop(String); + +impl Drop for ScribbleOnDrop { + fn drop(&mut self) { + self.0 = format!("DROPPED"); + } +} + +struct Foo(u32, T, Box fn(&'r T) -> String>); + +unsafe impl<#[may_dangle] T> Drop for Foo { + fn drop(&mut self) { + // Use of `may_dangle` is sound, because destructor never passes a `self.1` + // to the callback (in `self.2`) despite having it available. + println!("Dropping Foo({}, _)", self.0); + } +} + +fn callback(s: & &ScribbleOnDrop) -> String { format!("{:?}", s) } + +fn main() { + let (last_dropped, foo0); + let (foo1, first_dropped); + + last_dropped = ScribbleOnDrop(format!("last")); + first_dropped = ScribbleOnDrop(format!("first")); + foo0 = Foo(0, &last_dropped, Box::new(callback)); + foo1 = Foo(1, &first_dropped, Box::new(callback)); + + println!("foo0.1: {:?} foo1.1: {:?}", foo0.1, foo1.1); +} diff --git a/src/test/ui/editions-crate-root-2015.rs b/src/test/ui/editions-crate-root-2015.rs deleted file mode 100644 index 4c890e3ae69..00000000000 --- a/src/test/ui/editions-crate-root-2015.rs +++ /dev/null @@ -1,21 +0,0 @@ -// edition:2015 - -mod inner { - fn global_inner(_: ::nonexistant::Foo) { - //~^ ERROR failed to resolve: maybe a missing crate `nonexistant`? - } - fn crate_inner(_: crate::nonexistant::Foo) { - //~^ ERROR failed to resolve: maybe a missing crate `nonexistant`? - } - - fn bare_global(_: ::nonexistant) { - //~^ ERROR cannot find type `nonexistant` in the crate root - } - fn bare_crate(_: crate::nonexistant) { - //~^ ERROR cannot find type `nonexistant` in the crate root - } -} - -fn main() { - -} diff --git a/src/test/ui/editions-crate-root-2015.stderr b/src/test/ui/editions-crate-root-2015.stderr deleted file mode 100644 index f8d65fec3d1..00000000000 --- a/src/test/ui/editions-crate-root-2015.stderr +++ /dev/null @@ -1,28 +0,0 @@ -error[E0433]: failed to resolve: maybe a missing crate `nonexistant`? - --> $DIR/editions-crate-root-2015.rs:4:26 - | -LL | fn global_inner(_: ::nonexistant::Foo) { - | ^^^^^^^^^^^ maybe a missing crate `nonexistant`? - -error[E0433]: failed to resolve: maybe a missing crate `nonexistant`? - --> $DIR/editions-crate-root-2015.rs:7:30 - | -LL | fn crate_inner(_: crate::nonexistant::Foo) { - | ^^^^^^^^^^^ maybe a missing crate `nonexistant`? - -error[E0412]: cannot find type `nonexistant` in the crate root - --> $DIR/editions-crate-root-2015.rs:11:25 - | -LL | fn bare_global(_: ::nonexistant) { - | ^^^^^^^^^^^ not found in the crate root - -error[E0412]: cannot find type `nonexistant` in the crate root - --> $DIR/editions-crate-root-2015.rs:14:29 - | -LL | fn bare_crate(_: crate::nonexistant) { - | ^^^^^^^^^^^ not found in the crate root - -error: aborting due to 4 previous errors - -Some errors have detailed explanations: E0412, E0433. -For more information about an error, try `rustc --explain E0412`. diff --git a/src/test/ui/editions/epoch-gate-feature.rs b/src/test/ui/editions/epoch-gate-feature.rs new file mode 100644 index 00000000000..5f7feb5347b --- /dev/null +++ b/src/test/ui/editions/epoch-gate-feature.rs @@ -0,0 +1,15 @@ +// run-pass + +#![allow(dead_code)] +#![allow(unused_variables)] +// Checks if the correct registers are being used to pass arguments +// when the sysv64 ABI is specified. + +#![feature(rust_2018_preview)] + +pub trait Foo {} + +// should compile without the dyn trait feature flag +fn foo(x: &dyn Foo) {} + +pub fn main() {} diff --git a/src/test/ui/enum-discriminant/issue-51582.rs b/src/test/ui/enum-discriminant/issue-51582.rs new file mode 100644 index 00000000000..40a70c623a7 --- /dev/null +++ b/src/test/ui/enum-discriminant/issue-51582.rs @@ -0,0 +1,18 @@ +// run-pass +#![feature(core_intrinsics)] + +#[repr(i8)] +pub enum Enum { + VariantA, + VariantB, +} + +fn make_b() -> Enum { Enum::VariantB } + +fn main() { + assert_eq!(1, make_b() as i8); + assert_eq!(1, make_b() as u8); + assert_eq!(1, make_b() as i32); + assert_eq!(1, make_b() as u32); + assert_eq!(1, std::intrinsics::discriminant_value(&make_b())); +} diff --git a/src/test/ui/enum/issue-42747.rs b/src/test/ui/enum/issue-42747.rs new file mode 100644 index 00000000000..fec65878210 --- /dev/null +++ b/src/test/ui/enum/issue-42747.rs @@ -0,0 +1,46 @@ +// run-pass +macro_rules! fooN { + ($cur:ident $prev:ty) => { + #[allow(dead_code)] + enum $cur { + Empty, + First($prev), + Second($prev), + Third($prev), + Fourth($prev), + } + } +} + +fooN!(Foo0 ()); +fooN!(Foo1 Foo0); +fooN!(Foo2 Foo1); +fooN!(Foo3 Foo2); +fooN!(Foo4 Foo3); +fooN!(Foo5 Foo4); +fooN!(Foo6 Foo5); +fooN!(Foo7 Foo6); +fooN!(Foo8 Foo7); +fooN!(Foo9 Foo8); +fooN!(Foo10 Foo9); +fooN!(Foo11 Foo10); +fooN!(Foo12 Foo11); +fooN!(Foo13 Foo12); +fooN!(Foo14 Foo13); +fooN!(Foo15 Foo14); +fooN!(Foo16 Foo15); +fooN!(Foo17 Foo16); +fooN!(Foo18 Foo17); +fooN!(Foo19 Foo18); +fooN!(Foo20 Foo19); +fooN!(Foo21 Foo20); +fooN!(Foo22 Foo21); +fooN!(Foo23 Foo22); +fooN!(Foo24 Foo23); +fooN!(Foo25 Foo24); +fooN!(Foo26 Foo25); +fooN!(Foo27 Foo26); + +fn main() { + let _foo = Foo27::Empty; +} diff --git a/src/test/ui/epoch-gate-feature.rs b/src/test/ui/epoch-gate-feature.rs deleted file mode 100644 index 5f7feb5347b..00000000000 --- a/src/test/ui/epoch-gate-feature.rs +++ /dev/null @@ -1,15 +0,0 @@ -// run-pass - -#![allow(dead_code)] -#![allow(unused_variables)] -// Checks if the correct registers are being used to pass arguments -// when the sysv64 ABI is specified. - -#![feature(rust_2018_preview)] - -pub trait Foo {} - -// should compile without the dyn trait feature flag -fn foo(x: &dyn Foo) {} - -pub fn main() {} diff --git a/src/test/ui/extern/issue-28324.mir.stderr b/src/test/ui/extern/issue-28324.mir.stderr new file mode 100644 index 00000000000..aff8bf7927d --- /dev/null +++ b/src/test/ui/extern/issue-28324.mir.stderr @@ -0,0 +1,11 @@ +error[E0133]: use of extern static is unsafe and requires unsafe function or block + --> $DIR/issue-28324.rs:8:24 + | +LL | pub static BAZ: u32 = *&error_message_count; + | ^^^^^^^^^^^^^^^^^^^^ use of extern static + | + = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/extern/issue-28324.rs b/src/test/ui/extern/issue-28324.rs new file mode 100644 index 00000000000..fbe83e325ed --- /dev/null +++ b/src/test/ui/extern/issue-28324.rs @@ -0,0 +1,11 @@ +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + +extern "C" { + static error_message_count: u32; +} + +pub static BAZ: u32 = *&error_message_count; +//~^ ERROR use of extern static is unsafe and requires + +fn main() {} diff --git a/src/test/ui/extern/issue-28324.thir.stderr b/src/test/ui/extern/issue-28324.thir.stderr new file mode 100644 index 00000000000..c696c359830 --- /dev/null +++ b/src/test/ui/extern/issue-28324.thir.stderr @@ -0,0 +1,11 @@ +error[E0133]: use of extern static is unsafe and requires unsafe function or block + --> $DIR/issue-28324.rs:8:25 + | +LL | pub static BAZ: u32 = *&error_message_count; + | ^^^^^^^^^^^^^^^^^^^ use of extern static + | + = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/for-loop-while/issue-51345.rs b/src/test/ui/for-loop-while/issue-51345.rs new file mode 100644 index 00000000000..15571e8bf5b --- /dev/null +++ b/src/test/ui/for-loop-while/issue-51345.rs @@ -0,0 +1,8 @@ +// run-pass +#![allow(unreachable_code)] + +fn main() { + let mut v = Vec::new(); + + loop { v.push(break) } +} diff --git a/src/test/ui/for-loop-while/long-while.rs b/src/test/ui/for-loop-while/long-while.rs new file mode 100644 index 00000000000..529cca7b731 --- /dev/null +++ b/src/test/ui/for-loop-while/long-while.rs @@ -0,0 +1,12 @@ +// run-pass +// pretty-expanded FIXME #23616 + +#![allow(unused_variables)] + +pub fn main() { + let mut i: isize = 0; + while i < 1000000 { + i += 1; + let x = 3; + } +} diff --git a/src/test/ui/foreign/nil-decl-in-foreign.rs b/src/test/ui/foreign/nil-decl-in-foreign.rs new file mode 100644 index 00000000000..f3be948781b --- /dev/null +++ b/src/test/ui/foreign/nil-decl-in-foreign.rs @@ -0,0 +1,14 @@ +// run-pass + +#![allow(improper_ctypes)] +#![allow(dead_code)] +// Issue #901 +// pretty-expanded FIXME #23616 + +mod libc { + extern "C" { + pub fn printf(x: ()); + } +} + +pub fn main() {} diff --git a/src/test/ui/generics/issue-1112.rs b/src/test/ui/generics/issue-1112.rs new file mode 100644 index 00000000000..3ba7bb21708 --- /dev/null +++ b/src/test/ui/generics/issue-1112.rs @@ -0,0 +1,37 @@ +// run-pass +#![allow(dead_code)] +// Issue #1112 +// Alignment of interior pointers to dynamic-size types + + +struct X { + a: T, + b: u8, + c: bool, + d: u8, + e: u16, + f: u8, + g: u8 +} + +pub fn main() { + let x: X = X { + a: 12345678, + b: 9, + c: true, + d: 10, + e: 11, + f: 12, + g: 13 + }; + bar(x); +} + +fn bar(x: X) { + assert_eq!(x.b, 9); + assert_eq!(x.c, true); + assert_eq!(x.d, 10); + assert_eq!(x.e, 11); + assert_eq!(x.f, 12); + assert_eq!(x.g, 13); +} diff --git a/src/test/ui/generics/issue-333.rs b/src/test/ui/generics/issue-333.rs new file mode 100644 index 00000000000..0753aaa0797 --- /dev/null +++ b/src/test/ui/generics/issue-333.rs @@ -0,0 +1,7 @@ +// run-pass + +fn quux(x: T) -> T { let f = id::; return f(x); } + +fn id(x: T) -> T { return x; } + +pub fn main() { assert_eq!(quux(10), 10); } diff --git a/src/test/ui/generics/issue-59508-1.rs b/src/test/ui/generics/issue-59508-1.rs new file mode 100644 index 00000000000..6376c429b28 --- /dev/null +++ b/src/test/ui/generics/issue-59508-1.rs @@ -0,0 +1,17 @@ +#![allow(dead_code)] +#![feature(const_generics_defaults)] + +// This test checks that generic parameter re-ordering diagnostic suggestions mention that +// consts come after types and lifetimes when the `const_generics_defaults` feature is enabled. +// We cannot run rustfix on this test because of the above const generics warning. + +struct A; + +impl A { + pub fn do_things() { + //~^ ERROR lifetime parameters must be declared prior to type parameters + println!("panic"); + } +} + +fn main() {} diff --git a/src/test/ui/generics/issue-59508-1.stderr b/src/test/ui/generics/issue-59508-1.stderr new file mode 100644 index 00000000000..df244f02dce --- /dev/null +++ b/src/test/ui/generics/issue-59508-1.stderr @@ -0,0 +1,8 @@ +error: lifetime parameters must be declared prior to type parameters + --> $DIR/issue-59508-1.rs:11:25 + | +LL | pub fn do_things() { + | ----^^--^^----- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b: 'a, T>` + +error: aborting due to previous error + diff --git a/src/test/ui/generics/issue-59508.fixed b/src/test/ui/generics/issue-59508.fixed new file mode 100644 index 00000000000..b5c60a1626f --- /dev/null +++ b/src/test/ui/generics/issue-59508.fixed @@ -0,0 +1,16 @@ +// run-rustfix + +#![allow(dead_code)] + +// This test checks that generic parameter re-ordering diagnostic suggestions contain bounds. + +struct A; + +impl A { + pub fn do_things<'a, 'b: 'a, T>() { + //~^ ERROR lifetime parameters must be declared prior to type parameters + println!("panic"); + } +} + +fn main() {} diff --git a/src/test/ui/generics/issue-59508.rs b/src/test/ui/generics/issue-59508.rs new file mode 100644 index 00000000000..0b39c5d8f2a --- /dev/null +++ b/src/test/ui/generics/issue-59508.rs @@ -0,0 +1,16 @@ +// run-rustfix + +#![allow(dead_code)] + +// This test checks that generic parameter re-ordering diagnostic suggestions contain bounds. + +struct A; + +impl A { + pub fn do_things() { + //~^ ERROR lifetime parameters must be declared prior to type parameters + println!("panic"); + } +} + +fn main() {} diff --git a/src/test/ui/generics/issue-59508.stderr b/src/test/ui/generics/issue-59508.stderr new file mode 100644 index 00000000000..33e967cebff --- /dev/null +++ b/src/test/ui/generics/issue-59508.stderr @@ -0,0 +1,8 @@ +error: lifetime parameters must be declared prior to type parameters + --> $DIR/issue-59508.rs:10:25 + | +LL | pub fn do_things() { + | ----^^--^^----- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b: 'a, T>` + +error: aborting due to previous error + diff --git a/src/test/ui/higher-rank-trait-bounds/issue-60283.rs b/src/test/ui/higher-rank-trait-bounds/issue-60283.rs new file mode 100644 index 00000000000..c63b1544a53 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/issue-60283.rs @@ -0,0 +1,20 @@ +pub trait Trait<'a> { + type Item; +} + +impl<'a> Trait<'a> for () { + type Item = (); +} + +pub fn foo(_: T, _: F) +where + T: for<'a> Trait<'a>, + F: for<'a> FnMut(>::Item), +{ +} + +fn main() { + foo((), drop) + //~^ ERROR type mismatch in function arguments + //~| ERROR size for values of type `<() as Trait<'_>>::Item` cannot be known at compilation time +} diff --git a/src/test/ui/higher-rank-trait-bounds/issue-60283.stderr b/src/test/ui/higher-rank-trait-bounds/issue-60283.stderr new file mode 100644 index 00000000000..34893cd8f19 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/issue-60283.stderr @@ -0,0 +1,42 @@ +error[E0631]: type mismatch in function arguments + --> $DIR/issue-60283.rs:17:13 + | +LL | foo((), drop) + | --- ^^^^ + | | | + | | expected signature of `for<'a> fn(<() as Trait<'a>>::Item) -> _` + | | found signature of `fn(()) -> _` + | required by a bound introduced by this call + | +note: required by a bound in `foo` + --> $DIR/issue-60283.rs:12:16 + | +LL | pub fn foo(_: T, _: F) + | --- required by a bound in this +... +LL | F: for<'a> FnMut(>::Item), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` + +error[E0277]: the size for values of type `<() as Trait<'_>>::Item` cannot be known at compilation time + --> $DIR/issue-60283.rs:17:13 + | +LL | foo((), drop) + | --- ^^^^ doesn't have a size known at compile-time + | | + | required by a bound introduced by this call + | + = help: the trait `Sized` is not implemented for `<() as Trait<'_>>::Item` +note: required by a bound in `std::mem::drop` + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL + | +LL | pub fn drop(_x: T) {} + | ^ required by this bound in `std::mem::drop` +help: consider further restricting the associated type + | +LL | fn main() where <() as Trait<'_>>::Item: Sized { + | ++++++++++++++++++++++++++++++++++++ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0277, E0631. +For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/hygiene/lambda-var-hygiene.rs b/src/test/ui/hygiene/lambda-var-hygiene.rs new file mode 100644 index 00000000000..bf06765e5dd --- /dev/null +++ b/src/test/ui/hygiene/lambda-var-hygiene.rs @@ -0,0 +1,12 @@ +// run-pass +// shouldn't affect evaluation of $ex: +macro_rules! bad_macro { + ($ex:expr) => ({(|_x| { $ex }) (9) }) +} + +fn takes_x(_x : isize) { + assert_eq!(bad_macro!(_x),8); +} +fn main() { + takes_x(8); +} diff --git a/src/test/ui/impl-trait/issue-49579.rs b/src/test/ui/impl-trait/issue-49579.rs new file mode 100644 index 00000000000..98de014e90b --- /dev/null +++ b/src/test/ui/impl-trait/issue-49579.rs @@ -0,0 +1,14 @@ +// check-pass + +fn fibs(n: u32) -> impl Iterator { + (0 .. n) + .scan((0, 1), |st, _| { + *st = (st.1, st.0 + st.1); + Some(*st) + }) + .map(&|(f, _)| f) +} + +fn main() { + println!("{:?}", fibs(10).collect::>()); +} diff --git a/src/test/ui/impl-trait/issue-49685.rs b/src/test/ui/impl-trait/issue-49685.rs new file mode 100644 index 00000000000..fb328d67b75 --- /dev/null +++ b/src/test/ui/impl-trait/issue-49685.rs @@ -0,0 +1,13 @@ +// run-pass +// Regression test for #49685: drop elaboration was not revealing the +// value of `impl Trait` returns, leading to an ICE. + +fn main() { + let _ = Some(()) + .into_iter() + .flat_map(|_| Some(()).into_iter().flat_map(func)); +} + +fn func(_: ()) -> impl Iterator { + Some(()).into_iter().flat_map(|_| vec![]) +} diff --git a/src/test/ui/impl-trait/issue-51185.rs b/src/test/ui/impl-trait/issue-51185.rs new file mode 100644 index 00000000000..52a2b25539d --- /dev/null +++ b/src/test/ui/impl-trait/issue-51185.rs @@ -0,0 +1,8 @@ +// run-pass +fn foo() -> impl Into fn(&'a ())> { + (|_| {}) as for<'a> fn(&'a ()) +} + +fn main() { + foo().into()(&()); +} diff --git a/src/test/ui/in-band-lifetimes.rs b/src/test/ui/in-band-lifetimes.rs deleted file mode 100644 index 9b2e1fe83c1..00000000000 --- a/src/test/ui/in-band-lifetimes.rs +++ /dev/null @@ -1,96 +0,0 @@ -// run-pass - -#![allow(warnings)] -#![feature(in_band_lifetimes)] - -fn foo(x: &'x u8) -> &'x u8 { x } -fn foo2(x: &'a u8, y: &u8) -> &'a u8 { x } - -fn check_in_band_can_be_late_bound() { - let _: for<'x> fn(&'x u8, &u8) -> &'x u8 = foo2; -} - -struct ForInherentNoParams; - -impl ForInherentNoParams { - fn foo(x: &'a u32, y: &u32) -> &'a u32 { x } -} - -struct X<'a>(&'a u8); - -impl<'a> X<'a> { - fn inner(&self) -> &'a u8 { - self.0 - } - - fn same_lifetime_as_parameter(&mut self, x: &'a u8) { - self.0 = x; - } -} - -impl X<'b> { - fn inner_2(&self) -> &'b u8 { - self.0 - } - - fn reference_already_introduced_in_band_from_method_with_explicit_binders<'a>( - &'b self, x: &'a u32 - ) {} -} - -struct Y(T); - -impl Y<&'a u8> { - fn inner(&self) -> &'a u8 { - self.0 - } -} - -trait MyTrait<'a> { - fn my_lifetime(&self) -> &'a u8; - fn any_lifetime() -> &'b u8; - fn borrowed_lifetime(&'b self) -> &'b u8; - fn default_impl(&self, x: &'b u32, y: &u32) -> &'b u32 { x } - fn in_band_def_explicit_impl(&self, x: &'b u8); -} - -impl MyTrait<'a> for Y<&'a u8> { - fn my_lifetime(&self) -> &'a u8 { self.0 } - fn any_lifetime() -> &'b u8 { &0 } - fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 } - fn in_band_def_explicit_impl<'b>(&self, x: &'b u8) {} -} - -fn test_hrtb_defined_lifetime_where(_: F) where for<'a> F: Fn(&'a u8) {} -fn test_hrtb_defined_lifetime_polytraitref(_: F) where F: for<'a> Fn(&'a u8) {} - -fn reference_in_band_from_locals(x: &'test u32) -> &'test u32 { - let y: &'test u32 = x; - y -} - -fn in_generics_in_band>(x: &T) {} -fn where_clause_in_band(x: &T) where T: MyTrait<'a> {} -fn impl_trait_in_band(x: &impl MyTrait<'a>) {} - -// Tests around using in-band lifetimes within existential traits. - -trait FunkyTrait<'a> { } -impl<'a, T> FunkyTrait<'a> for T { } -fn ret_pos_impl_trait_in_band_outlives(x: &'a u32) -> impl ::std::fmt::Debug + 'a { - x -} -fn ret_pos_impl_trait_in_band_param(x: &'a u32) -> impl FunkyTrait<'a> { - x -} -fn ret_pos_impl_trait_in_band_param_static(x: &'a u32) -> impl FunkyTrait<'static> + 'a { - x -} -fn ret_pos_impl_trait_in_band_param_outlives(x: &'a u32) -> impl FunkyTrait<'a> + 'a { - x -} -fn ret_pos_impl_trait_in_band_higher_ranked(x: &'a u32) -> impl for<'b> FunkyTrait<'b> + 'a { - x -} - -fn main() {} diff --git a/src/test/ui/in-band-lifetimes/in-band-lifetimes.rs b/src/test/ui/in-band-lifetimes/in-band-lifetimes.rs new file mode 100644 index 00000000000..9b2e1fe83c1 --- /dev/null +++ b/src/test/ui/in-band-lifetimes/in-band-lifetimes.rs @@ -0,0 +1,96 @@ +// run-pass + +#![allow(warnings)] +#![feature(in_band_lifetimes)] + +fn foo(x: &'x u8) -> &'x u8 { x } +fn foo2(x: &'a u8, y: &u8) -> &'a u8 { x } + +fn check_in_band_can_be_late_bound() { + let _: for<'x> fn(&'x u8, &u8) -> &'x u8 = foo2; +} + +struct ForInherentNoParams; + +impl ForInherentNoParams { + fn foo(x: &'a u32, y: &u32) -> &'a u32 { x } +} + +struct X<'a>(&'a u8); + +impl<'a> X<'a> { + fn inner(&self) -> &'a u8 { + self.0 + } + + fn same_lifetime_as_parameter(&mut self, x: &'a u8) { + self.0 = x; + } +} + +impl X<'b> { + fn inner_2(&self) -> &'b u8 { + self.0 + } + + fn reference_already_introduced_in_band_from_method_with_explicit_binders<'a>( + &'b self, x: &'a u32 + ) {} +} + +struct Y(T); + +impl Y<&'a u8> { + fn inner(&self) -> &'a u8 { + self.0 + } +} + +trait MyTrait<'a> { + fn my_lifetime(&self) -> &'a u8; + fn any_lifetime() -> &'b u8; + fn borrowed_lifetime(&'b self) -> &'b u8; + fn default_impl(&self, x: &'b u32, y: &u32) -> &'b u32 { x } + fn in_band_def_explicit_impl(&self, x: &'b u8); +} + +impl MyTrait<'a> for Y<&'a u8> { + fn my_lifetime(&self) -> &'a u8 { self.0 } + fn any_lifetime() -> &'b u8 { &0 } + fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 } + fn in_band_def_explicit_impl<'b>(&self, x: &'b u8) {} +} + +fn test_hrtb_defined_lifetime_where(_: F) where for<'a> F: Fn(&'a u8) {} +fn test_hrtb_defined_lifetime_polytraitref(_: F) where F: for<'a> Fn(&'a u8) {} + +fn reference_in_band_from_locals(x: &'test u32) -> &'test u32 { + let y: &'test u32 = x; + y +} + +fn in_generics_in_band>(x: &T) {} +fn where_clause_in_band(x: &T) where T: MyTrait<'a> {} +fn impl_trait_in_band(x: &impl MyTrait<'a>) {} + +// Tests around using in-band lifetimes within existential traits. + +trait FunkyTrait<'a> { } +impl<'a, T> FunkyTrait<'a> for T { } +fn ret_pos_impl_trait_in_band_outlives(x: &'a u32) -> impl ::std::fmt::Debug + 'a { + x +} +fn ret_pos_impl_trait_in_band_param(x: &'a u32) -> impl FunkyTrait<'a> { + x +} +fn ret_pos_impl_trait_in_band_param_static(x: &'a u32) -> impl FunkyTrait<'static> + 'a { + x +} +fn ret_pos_impl_trait_in_band_param_outlives(x: &'a u32) -> impl FunkyTrait<'a> + 'a { + x +} +fn ret_pos_impl_trait_in_band_higher_ranked(x: &'a u32) -> impl for<'b> FunkyTrait<'b> + 'a { + x +} + +fn main() {} diff --git a/src/test/ui/inference/lub-glb-with-unbound-infer-var.rs b/src/test/ui/inference/lub-glb-with-unbound-infer-var.rs new file mode 100644 index 00000000000..c9e117089f5 --- /dev/null +++ b/src/test/ui/inference/lub-glb-with-unbound-infer-var.rs @@ -0,0 +1,15 @@ +// run-pass +// Test for a specific corner case: when we compute the LUB of two fn +// types and their parameters have unbound variables. In that case, we +// wind up relating those two variables. This was causing an ICE in an +// in-progress PR. + +fn main() { + let a_f: fn(_) = |_| (); + let b_f: fn(_) = |_| (); + let c_f = match 22 { + 0 => a_f, + _ => b_f, + }; + c_f(4); +} diff --git a/src/test/ui/issues/auxiliary/issue-19163.rs b/src/test/ui/issues/auxiliary/issue-19163.rs deleted file mode 100644 index 0c0d9e43c1d..00000000000 --- a/src/test/ui/issues/auxiliary/issue-19163.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_type = "lib"] - -#[macro_export] -macro_rules! mywrite { - ($dst:expr, $($arg:tt)*) => ($dst.write_fmt(format_args!($($arg)*))) -} diff --git a/src/test/ui/issues/auxiliary/issue-39823.rs b/src/test/ui/issues/auxiliary/issue-39823.rs deleted file mode 100644 index 3af9c68f233..00000000000 --- a/src/test/ui/issues/auxiliary/issue-39823.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![crate_type="rlib"] - -#[derive(Debug, PartialEq)] -pub struct RemoteC(pub u32); - -#[derive(Debug, PartialEq)] -pub struct RemoteG(pub T); diff --git a/src/test/ui/issues/auxiliary/xcrate-issue-43189-a.rs b/src/test/ui/issues/auxiliary/xcrate-issue-43189-a.rs deleted file mode 100644 index 9ab570fd170..00000000000 --- a/src/test/ui/issues/auxiliary/xcrate-issue-43189-a.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![crate_type="lib"] - - -pub trait A { - fn a(&self) {} -} -impl A for () {} diff --git a/src/test/ui/issues/auxiliary/xcrate-issue-43189-b.rs b/src/test/ui/issues/auxiliary/xcrate-issue-43189-b.rs deleted file mode 100644 index 31dfb050b27..00000000000 --- a/src/test/ui/issues/auxiliary/xcrate-issue-43189-b.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type="lib"] - -pub extern crate xcrate_issue_43189_a; diff --git a/src/test/ui/issues/auxiliary/xcrate-issue-46112-rexport-core.rs b/src/test/ui/issues/auxiliary/xcrate-issue-46112-rexport-core.rs deleted file mode 100644 index 2b517b5784a..00000000000 --- a/src/test/ui/issues/auxiliary/xcrate-issue-46112-rexport-core.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type="lib"] - -pub extern crate core; diff --git a/src/test/ui/issues/auxiliary/xcrate-issue-61711-b.rs b/src/test/ui/issues/auxiliary/xcrate-issue-61711-b.rs deleted file mode 100644 index 88a040529e7..00000000000 --- a/src/test/ui/issues/auxiliary/xcrate-issue-61711-b.rs +++ /dev/null @@ -1,5 +0,0 @@ -// edition:2018 -#![crate_type="lib"] -#![crate_name="xcrate_issue_61711_b"] -pub struct Struct; -pub use crate as alias; diff --git a/src/test/ui/issues/issue-10398.rs b/src/test/ui/issues/issue-10398.rs deleted file mode 100644 index 0405b2d01e2..00000000000 --- a/src/test/ui/issues/issue-10398.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![feature(box_syntax)] - -fn main() { - let x: Box<_> = box 1; - let f = move|| { - let _a = x; - drop(x); - //~^ ERROR: use of moved value: `x` - }; - f(); -} diff --git a/src/test/ui/issues/issue-10398.stderr b/src/test/ui/issues/issue-10398.stderr deleted file mode 100644 index 8d9faf324e8..00000000000 --- a/src/test/ui/issues/issue-10398.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0382]: use of moved value: `x` - --> $DIR/issue-10398.rs:7:14 - | -LL | let _a = x; - | - value moved here -LL | drop(x); - | ^ value used here after move - | - = note: move occurs because `x` has type `Box`, which does not implement the `Copy` trait - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0382`. diff --git a/src/test/ui/issues/issue-1112.rs b/src/test/ui/issues/issue-1112.rs deleted file mode 100644 index 3ba7bb21708..00000000000 --- a/src/test/ui/issues/issue-1112.rs +++ /dev/null @@ -1,37 +0,0 @@ -// run-pass -#![allow(dead_code)] -// Issue #1112 -// Alignment of interior pointers to dynamic-size types - - -struct X { - a: T, - b: u8, - c: bool, - d: u8, - e: u16, - f: u8, - g: u8 -} - -pub fn main() { - let x: X = X { - a: 12345678, - b: 9, - c: true, - d: 10, - e: 11, - f: 12, - g: 13 - }; - bar(x); -} - -fn bar(x: X) { - assert_eq!(x.b, 9); - assert_eq!(x.c, true); - assert_eq!(x.d, 10); - assert_eq!(x.e, 11); - assert_eq!(x.f, 12); - assert_eq!(x.g, 13); -} diff --git a/src/test/ui/issues/issue-11577.rs b/src/test/ui/issues/issue-11577.rs deleted file mode 100644 index 70177c5ed0d..00000000000 --- a/src/test/ui/issues/issue-11577.rs +++ /dev/null @@ -1,18 +0,0 @@ -// run-pass -// Destructuring struct variants would ICE where regular structs wouldn't - -enum Foo { - VBar { num: isize } -} - -struct SBar { num: isize } - -pub fn main() { - let vbar = Foo::VBar { num: 1 }; - let Foo::VBar { num } = vbar; - assert_eq!(num, 1); - - let sbar = SBar { num: 2 }; - let SBar { num } = sbar; - assert_eq!(num, 2); -} diff --git a/src/test/ui/issues/issue-11940.rs b/src/test/ui/issues/issue-11940.rs deleted file mode 100644 index 6815c87edd8..00000000000 --- a/src/test/ui/issues/issue-11940.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass - -const TEST_STR: &'static str = "abcd"; - -fn main() { - let s = "abcd"; - match s { - TEST_STR => (), - _ => unreachable!() - } -} diff --git a/src/test/ui/issues/issue-12796.rs b/src/test/ui/issues/issue-12796.rs deleted file mode 100644 index 942d6b9a568..00000000000 --- a/src/test/ui/issues/issue-12796.rs +++ /dev/null @@ -1,9 +0,0 @@ -trait Trait { - fn outer(&self) { - fn inner(_: &Self) { - //~^ ERROR can't use generic parameters from outer function - } - } -} - -fn main() { } diff --git a/src/test/ui/issues/issue-12796.stderr b/src/test/ui/issues/issue-12796.stderr deleted file mode 100644 index a01fd2d6542..00000000000 --- a/src/test/ui/issues/issue-12796.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0401]: can't use generic parameters from outer function - --> $DIR/issue-12796.rs:3:22 - | -LL | fn inner(_: &Self) { - | ^^^^ - | | - | use of generic parameter from outer function - | can't use `Self` here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0401`. diff --git a/src/test/ui/issues/issue-13483.rs b/src/test/ui/issues/issue-13483.rs deleted file mode 100644 index a2fd9264b15..00000000000 --- a/src/test/ui/issues/issue-13483.rs +++ /dev/null @@ -1,17 +0,0 @@ -fn main() { - if true { - } else if { //~ ERROR missing condition - //~^ ERROR mismatched types - } else { - } -} - -fn foo() { - if true { - } else if { //~ ERROR missing condition - //~^ ERROR mismatched types - } - bar(); -} - -fn bar() {} diff --git a/src/test/ui/issues/issue-13483.stderr b/src/test/ui/issues/issue-13483.stderr deleted file mode 100644 index 5fd05b18ce0..00000000000 --- a/src/test/ui/issues/issue-13483.stderr +++ /dev/null @@ -1,33 +0,0 @@ -error: missing condition for `if` expression - --> $DIR/issue-13483.rs:3:14 - | -LL | } else if { - | ^ expected if condition here - -error: missing condition for `if` expression - --> $DIR/issue-13483.rs:11:14 - | -LL | } else if { - | ^ expected if condition here - -error[E0308]: mismatched types - --> $DIR/issue-13483.rs:3:15 - | -LL | } else if { - | _______________^ -LL | | -LL | | } else { - | |_____^ expected `bool`, found `()` - -error[E0308]: mismatched types - --> $DIR/issue-13483.rs:11:15 - | -LL | } else if { - | _______________^ -LL | | -LL | | } - | |_____^ expected `bool`, found `()` - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/issues/issue-13902.rs b/src/test/ui/issues/issue-13902.rs deleted file mode 100644 index 1afde0ebe85..00000000000 --- a/src/test/ui/issues/issue-13902.rs +++ /dev/null @@ -1,16 +0,0 @@ -// run-pass -#![allow(dead_code)] -#![allow(non_camel_case_types)] - -const JSVAL_TAG_CLEAR: u32 = 0xFFFFFF80; -const JSVAL_TYPE_INT32: u8 = 0x01; -const JSVAL_TYPE_UNDEFINED: u8 = 0x02; -#[repr(u32)] -enum ValueTag { - JSVAL_TAG_INT32 = JSVAL_TAG_CLEAR | (JSVAL_TYPE_INT32 as u32), - JSVAL_TAG_UNDEFINED = JSVAL_TAG_CLEAR | (JSVAL_TYPE_UNDEFINED as u32), -} - -fn main() { - let _ = ValueTag::JSVAL_TAG_INT32; -} diff --git a/src/test/ui/issues/issue-14227.mir.stderr b/src/test/ui/issues/issue-14227.mir.stderr deleted file mode 100644 index 8e7a2514dd6..00000000000 --- a/src/test/ui/issues/issue-14227.mir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/issue-14227.rs:7:21 - | -LL | static CRASH: u32 = symbol; - | ^^^^^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/issues/issue-14227.rs b/src/test/ui/issues/issue-14227.rs deleted file mode 100644 index 5f866ec9061..00000000000 --- a/src/test/ui/issues/issue-14227.rs +++ /dev/null @@ -1,10 +0,0 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - -extern "C" { - pub static symbol: u32; -} -static CRASH: u32 = symbol; -//~^ ERROR use of extern static is unsafe and requires - -fn main() {} diff --git a/src/test/ui/issues/issue-14227.thir.stderr b/src/test/ui/issues/issue-14227.thir.stderr deleted file mode 100644 index 8e7a2514dd6..00000000000 --- a/src/test/ui/issues/issue-14227.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/issue-14227.rs:7:21 - | -LL | static CRASH: u32 = symbol; - | ^^^^^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/issues/issue-14456.rs b/src/test/ui/issues/issue-14456.rs deleted file mode 100644 index 52a56eb77f7..00000000000 --- a/src/test/ui/issues/issue-14456.rs +++ /dev/null @@ -1,37 +0,0 @@ -// run-pass -#![allow(unused_mut)] -// ignore-emscripten no processes -// ignore-sgx no processes - -use std::env; -use std::io::prelude::*; -use std::io; -use std::process::{Command, Stdio}; - -fn main() { - let args: Vec = env::args().collect(); - if args.len() > 1 && args[1] == "child" { - return child() - } - - test(); -} - -fn child() { - writeln!(&mut io::stdout(), "foo").unwrap(); - writeln!(&mut io::stderr(), "bar").unwrap(); - let mut stdin = io::stdin(); - let mut s = String::new(); - stdin.lock().read_line(&mut s).unwrap(); - assert_eq!(s.len(), 0); -} - -fn test() { - let args: Vec = env::args().collect(); - let mut p = Command::new(&args[0]).arg("child") - .stdin(Stdio::piped()) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .spawn().unwrap(); - assert!(p.wait().unwrap().success()); -} diff --git a/src/test/ui/issues/issue-14589.rs b/src/test/ui/issues/issue-14589.rs deleted file mode 100644 index 5d8aab2ce74..00000000000 --- a/src/test/ui/issues/issue-14589.rs +++ /dev/null @@ -1,24 +0,0 @@ -// run-pass -// All 3 expressions should work in that the argument gets -// coerced to a trait object - -// pretty-expanded FIXME #23616 - -fn main() { - send::>(Box::new(Output(0))); - Test::>::foo(Box::new(Output(0))); - Test::>::new().send(Box::new(Output(0))); -} - -fn send(_: T) {} - -struct Test { marker: std::marker::PhantomData } -impl Test { - fn new() -> Test { Test { marker: ::std::marker::PhantomData } } - fn foo(_: T) {} - fn send(&self, _: T) {} -} - -trait Foo { fn dummy(&self) { }} -struct Output(isize); -impl Foo for Output {} diff --git a/src/test/ui/issues/issue-14837.rs b/src/test/ui/issues/issue-14837.rs deleted file mode 100644 index a83bc415002..00000000000 --- a/src/test/ui/issues/issue-14837.rs +++ /dev/null @@ -1,11 +0,0 @@ -// check-pass -// pretty-expanded FIXME #23616 - -#[deny(dead_code)] -pub enum Foo { - Bar { - baz: isize - } -} - -fn main() { } diff --git a/src/test/ui/issues/issue-15080.rs b/src/test/ui/issues/issue-15080.rs deleted file mode 100644 index 4dd6981d448..00000000000 --- a/src/test/ui/issues/issue-15080.rs +++ /dev/null @@ -1,22 +0,0 @@ -// run-pass - -fn main() { - let mut x: &[_] = &[1, 2, 3, 4]; - - let mut result = vec![]; - loop { - x = match *x { - [1, n, 3, ref rest @ ..] => { - result.push(n); - rest - } - [n, ref rest @ ..] => { - result.push(n); - rest - } - [] => - break - } - } - assert_eq!(result, [2, 4]); -} diff --git a/src/test/ui/issues/issue-16098.rs b/src/test/ui/issues/issue-16098.rs deleted file mode 100644 index 00acc20fc9e..00000000000 --- a/src/test/ui/issues/issue-16098.rs +++ /dev/null @@ -1,16 +0,0 @@ -macro_rules! prob1 { - (0) => { - 0 - }; - ($n:expr) => { - if ($n % 3 == 0) || ($n % 5 == 0) { - $n + prob1!($n - 1); //~ ERROR recursion limit reached while expanding `prob1!` - } else { - prob1!($n - 1); - } - }; -} - -fn main() { - println!("Problem 1: {}", prob1!(1000)); -} diff --git a/src/test/ui/issues/issue-16098.stderr b/src/test/ui/issues/issue-16098.stderr deleted file mode 100644 index 64280219d75..00000000000 --- a/src/test/ui/issues/issue-16098.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: recursion limit reached while expanding `prob1!` - --> $DIR/issue-16098.rs:7:18 - | -LL | $n + prob1!($n - 1); - | ^^^^^^^^^^^^^^ -... -LL | println!("Problem 1: {}", prob1!(1000)); - | ------------ in this macro invocation - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_16098`) - = note: this error originates in the macro `prob1` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to previous error - diff --git a/src/test/ui/issues/issue-16272.rs b/src/test/ui/issues/issue-16272.rs deleted file mode 100644 index 5cf3fd94928..00000000000 --- a/src/test/ui/issues/issue-16272.rs +++ /dev/null @@ -1,23 +0,0 @@ -// run-pass -// ignore-emscripten no processes -// ignore-sgx no processes - -use std::process::Command; -use std::env; - -fn main() { - let len = env::args().len(); - - if len == 1 { - test(); - } else { - assert_eq!(len, 3); - } -} - -fn test() { - let status = Command::new(&env::current_exe().unwrap()) - .arg("foo").arg("") - .status().unwrap(); - assert!(status.success()); -} diff --git a/src/test/ui/issues/issue-17074.rs b/src/test/ui/issues/issue-17074.rs deleted file mode 100644 index 0ed81132ec6..00000000000 --- a/src/test/ui/issues/issue-17074.rs +++ /dev/null @@ -1,15 +0,0 @@ -// run-pass -#![allow(dead_code)] - -static X2: u64 = !0 as u16 as u64; -static Y2: u64 = !0 as u32 as u64; -const X: u64 = !0 as u16 as u64; -const Y: u64 = !0 as u32 as u64; - -fn main() { - assert_eq!(match 1 { - X => unreachable!(), - Y => unreachable!(), - _ => 1 - }, 1); -} diff --git a/src/test/ui/issues/issue-18060.rs b/src/test/ui/issues/issue-18060.rs deleted file mode 100644 index b5f3d0f74bc..00000000000 --- a/src/test/ui/issues/issue-18060.rs +++ /dev/null @@ -1,8 +0,0 @@ -// run-pass -// Regression test for #18060: match arms were matching in the wrong order. - -fn main() { - assert_eq!(2, match (1, 3) { (0, 2..=5) => 1, (1, 3) => 2, (_, 2..=5) => 3, (_, _) => 4 }); - assert_eq!(2, match (1, 3) { (1, 3) => 2, (_, 2..=5) => 3, (_, _) => 4 }); - assert_eq!(2, match (1, 7) { (0, 2..=5) => 1, (1, 7) => 2, (_, 2..=5) => 3, (_, _) => 4 }); -} diff --git a/src/test/ui/issues/issue-18294.rs b/src/test/ui/issues/issue-18294.rs deleted file mode 100644 index 77355f0d7c9..00000000000 --- a/src/test/ui/issues/issue-18294.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn main() { - const X: u32 = 1; - const Y: usize = unsafe { &X as *const u32 as usize }; //~ ERROR pointers cannot be cast to integers - println!("{}", Y); -} diff --git a/src/test/ui/issues/issue-18294.stderr b/src/test/ui/issues/issue-18294.stderr deleted file mode 100644 index e0cbd2a216d..00000000000 --- a/src/test/ui/issues/issue-18294.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: pointers cannot be cast to integers during const eval - --> $DIR/issue-18294.rs:3:31 - | -LL | const Y: usize = unsafe { &X as *const u32 as usize }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: at compile-time, pointers do not have an integer value - = note: avoiding this restriction via `transmute`, `union`, or raw pointers leads to compile-time undefined behavior - -error: aborting due to previous error - diff --git a/src/test/ui/issues/issue-18652.rs b/src/test/ui/issues/issue-18652.rs deleted file mode 100644 index 59aa0156842..00000000000 --- a/src/test/ui/issues/issue-18652.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass -// Tests multiple free variables being passed by value into an unboxed -// once closure as an optimization by codegen. This used to hit an -// incorrect assert. - -fn main() { - let x = 2u8; - let y = 3u8; - assert_eq!((move || x + y)(), 5); -} diff --git a/src/test/ui/issues/issue-19163.rs b/src/test/ui/issues/issue-19163.rs deleted file mode 100644 index d98c5912af2..00000000000 --- a/src/test/ui/issues/issue-19163.rs +++ /dev/null @@ -1,11 +0,0 @@ -// aux-build:issue-19163.rs - -#[macro_use] extern crate issue_19163; - -use std::io::Write; - -fn main() { - let mut v = vec![]; - mywrite!(&v, "Hello world"); - //~^ ERROR cannot borrow data in a `&` reference as mutable -} diff --git a/src/test/ui/issues/issue-19163.stderr b/src/test/ui/issues/issue-19163.stderr deleted file mode 100644 index ae1ae14266f..00000000000 --- a/src/test/ui/issues/issue-19163.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/issue-19163.rs:9:5 - | -LL | mywrite!(&v, "Hello world"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable - | - = note: this error originates in the macro `mywrite` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0596`. diff --git a/src/test/ui/issues/issue-19358.rs b/src/test/ui/issues/issue-19358.rs deleted file mode 100644 index 3970a4155e9..00000000000 --- a/src/test/ui/issues/issue-19358.rs +++ /dev/null @@ -1,23 +0,0 @@ -// run-pass - -#![allow(dead_code)] - -trait Trait { fn dummy(&self) { } } - -#[derive(Debug)] -struct Foo { - foo: T, -} - -#[derive(Debug)] -struct Bar where T: Trait { - bar: T, -} - -impl Trait for isize {} - -fn main() { - let a = Foo { foo: 12 }; - let b = Bar { bar: 12 }; - println!("{:?} {:?}", a, b); -} diff --git a/src/test/ui/issues/issue-19660.rs b/src/test/ui/issues/issue-19660.rs deleted file mode 100644 index 400ac310b96..00000000000 --- a/src/test/ui/issues/issue-19660.rs +++ /dev/null @@ -1,15 +0,0 @@ -// error-pattern: requires `copy` lang_item - -#![feature(lang_items, start, no_core)] -#![no_core] - -#[lang = "sized"] -trait Sized { } - -struct S; - -#[start] -fn main(_: isize, _: *const *const u8) -> isize { - let _ = S; - 0 -} diff --git a/src/test/ui/issues/issue-19660.stderr b/src/test/ui/issues/issue-19660.stderr deleted file mode 100644 index f5d903f38eb..00000000000 --- a/src/test/ui/issues/issue-19660.stderr +++ /dev/null @@ -1,4 +0,0 @@ -error: requires `copy` lang_item - -error: aborting due to previous error - diff --git a/src/test/ui/issues/issue-20091.rs b/src/test/ui/issues/issue-20091.rs deleted file mode 100644 index 86cc79d6b42..00000000000 --- a/src/test/ui/issues/issue-20091.rs +++ /dev/null @@ -1,24 +0,0 @@ -// run-pass -#![allow(stable_features)] - -// ignore-emscripten no processes -// ignore-sgx no processes - -#![feature(os)] - -#[cfg(unix)] -fn main() { - use std::process::Command; - use std::env; - use std::os::unix::prelude::*; - use std::ffi::OsStr; - - if env::args().len() == 1 { - assert!(Command::new(&env::current_exe().unwrap()) - .arg(::from_bytes(b"\xff")) - .status().unwrap().success()) - } -} - -#[cfg(windows)] -fn main() {} diff --git a/src/test/ui/issues/issue-20616-4.rs b/src/test/ui/issues/issue-20616-4.rs deleted file mode 100644 index a71f47ca4bf..00000000000 --- a/src/test/ui/issues/issue-20616-4.rs +++ /dev/null @@ -1,35 +0,0 @@ -// We need all these 9 issue-20616-N.rs files -// because we can only catch one parsing error at a time - -type Type_1_<'a, T> = &'a T; - - -//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` - - -//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` - - -//type Type_3 = Box; // error: expected type, found `,` - - -type Type_4 = Type_1_<'static,, T>; -//~^ error: expected one of `>`, a const expression, lifetime, or type, found `,` - - -type Type_5_<'a> = Type_1_<'a, ()>; - - -//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` - - -//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` - - -//type Type_7 = Box<(),,>; // error: expected type, found `,` - - -//type Type_8<'a,,> = &'a (); // error: expected ident, found `,` - - -//type Type_9 = Box; // error: expected ident, found `,` diff --git a/src/test/ui/issues/issue-20616-4.stderr b/src/test/ui/issues/issue-20616-4.stderr deleted file mode 100644 index 2b3b75f3119..00000000000 --- a/src/test/ui/issues/issue-20616-4.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: expected one of `>`, a const expression, lifetime, or type, found `,` - --> $DIR/issue-20616-4.rs:16:34 - | -LL | type Type_4 = Type_1_<'static,, T>; - | ^ expected one of `>`, a const expression, lifetime, or type - -error: aborting due to previous error - diff --git a/src/test/ui/issues/issue-20616-5.rs b/src/test/ui/issues/issue-20616-5.rs deleted file mode 100644 index b96d09d59ae..00000000000 --- a/src/test/ui/issues/issue-20616-5.rs +++ /dev/null @@ -1,35 +0,0 @@ -// We need all these 9 issue-20616-N.rs files -// because we can only catch one parsing error at a time - -type Type_1_<'a, T> = &'a T; - - -//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` - - -//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` - - -//type Type_3 = Box; // error: expected type, found `,` - - -//type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` - - -type Type_5_<'a> = Type_1_<'a, ()>; - - -type Type_5<'a> = Type_1_<'a, (),,>; -//~^ error: expected one of `>`, a const expression, lifetime, or type, found `,` - - -//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` - - -//type Type_7 = Box<(),,>; // error: expected type, found `,` - - -//type Type_8<'a,,> = &'a (); // error: expected ident, found `,` - - -//type Type_9 = Box; // error: expected ident, found `,` diff --git a/src/test/ui/issues/issue-20616-5.stderr b/src/test/ui/issues/issue-20616-5.stderr deleted file mode 100644 index 1ec1dbde695..00000000000 --- a/src/test/ui/issues/issue-20616-5.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: expected one of `>`, a const expression, lifetime, or type, found `,` - --> $DIR/issue-20616-5.rs:22:34 - | -LL | type Type_5<'a> = Type_1_<'a, (),,>; - | ^ expected one of `>`, a const expression, lifetime, or type - -error: aborting due to previous error - diff --git a/src/test/ui/issues/issue-20616-6.rs b/src/test/ui/issues/issue-20616-6.rs deleted file mode 100644 index a2c45ecec7a..00000000000 --- a/src/test/ui/issues/issue-20616-6.rs +++ /dev/null @@ -1,35 +0,0 @@ -// We need all these 9 issue-20616-N.rs files -// because we can only catch one parsing error at a time - -type Type_1_<'a, T> = &'a T; - - -//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` - - -//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` - - -//type Type_3 = Box; // error: expected type, found `,` - - -//type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` - - -type Type_5_<'a> = Type_1_<'a, ()>; - - -//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` - - -type Type_6 = Type_5_<'a,,>; -//~^ error: expected one of `>`, a const expression, lifetime, or type, found `,` - - -//type Type_7 = Box<(),,>; // error: expected type, found `,` - - -//type Type_8<'a,,> = &'a (); // error: expected ident, found `,` - - -//type Type_9 = Box; // error: expected ident, found `,` diff --git a/src/test/ui/issues/issue-20616-6.stderr b/src/test/ui/issues/issue-20616-6.stderr deleted file mode 100644 index 7401abdd091..00000000000 --- a/src/test/ui/issues/issue-20616-6.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: expected one of `>`, a const expression, lifetime, or type, found `,` - --> $DIR/issue-20616-6.rs:25:26 - | -LL | type Type_6 = Type_5_<'a,,>; - | ^ expected one of `>`, a const expression, lifetime, or type - -error: aborting due to previous error - diff --git a/src/test/ui/issues/issue-20616-7.rs b/src/test/ui/issues/issue-20616-7.rs deleted file mode 100644 index 67209c02adf..00000000000 --- a/src/test/ui/issues/issue-20616-7.rs +++ /dev/null @@ -1,35 +0,0 @@ -// We need all these 9 issue-20616-N.rs files -// because we can only catch one parsing error at a time - -type Type_1_<'a, T> = &'a T; - - -//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` - - -//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` - - -//type Type_3 = Box; // error: expected type, found `,` - - -//type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` - - -type Type_5_<'a> = Type_1_<'a, ()>; - - -//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` - - -//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` - - -type Type_7 = Box<(),,>; -//~^ error: expected one of `>`, a const expression, lifetime, or type, found `,` - - -//type Type_8<'a,,> = &'a (); // error: expected ident, found `,` - - -//type Type_9 = Box; // error: expected ident, found `,` diff --git a/src/test/ui/issues/issue-20616-7.stderr b/src/test/ui/issues/issue-20616-7.stderr deleted file mode 100644 index e2c3efe8447..00000000000 --- a/src/test/ui/issues/issue-20616-7.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: expected one of `>`, a const expression, lifetime, or type, found `,` - --> $DIR/issue-20616-7.rs:28:22 - | -LL | type Type_7 = Box<(),,>; - | ^ expected one of `>`, a const expression, lifetime, or type - -error: aborting due to previous error - diff --git a/src/test/ui/issues/issue-20823.rs b/src/test/ui/issues/issue-20823.rs deleted file mode 100644 index 9e209d5d33a..00000000000 --- a/src/test/ui/issues/issue-20823.rs +++ /dev/null @@ -1,5 +0,0 @@ -// run-pass -// compile-flags: --test - -#[test] -pub fn foo() {} diff --git a/src/test/ui/issues/issue-21356.rs b/src/test/ui/issues/issue-21356.rs deleted file mode 100644 index ae623929d63..00000000000 --- a/src/test/ui/issues/issue-21356.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![allow(unused_macros)] - -macro_rules! test { ($wrong:t_ty ..) => () } - //~^ ERROR: invalid fragment specifier `t_ty` - -fn main() {} diff --git a/src/test/ui/issues/issue-21356.stderr b/src/test/ui/issues/issue-21356.stderr deleted file mode 100644 index 17014c6ceee..00000000000 --- a/src/test/ui/issues/issue-21356.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: invalid fragment specifier `t_ty` - --> $DIR/issue-21356.rs:3:22 - | -LL | macro_rules! test { ($wrong:t_ty ..) => () } - | ^^^^^^^^^^^ - | - = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis` - -error: aborting due to previous error - diff --git a/src/test/ui/issues/issue-21475.rs b/src/test/ui/issues/issue-21475.rs deleted file mode 100644 index b028fcae077..00000000000 --- a/src/test/ui/issues/issue-21475.rs +++ /dev/null @@ -1,19 +0,0 @@ -// run-pass -#![allow(unused_imports, overlapping_range_endpoints)] -// pretty-expanded FIXME #23616 - -use m::{START, END}; - -fn main() { - match 42 { - m::START..=m::END => {}, - 0..=m::END => {}, - m::START..=59 => {}, - _ => {}, - } -} - -mod m { - pub const START: u32 = 4; - pub const END: u32 = 14; -} diff --git a/src/test/ui/issues/issue-21520.rs b/src/test/ui/issues/issue-21520.rs deleted file mode 100644 index ab4ac7237c7..00000000000 --- a/src/test/ui/issues/issue-21520.rs +++ /dev/null @@ -1,22 +0,0 @@ -// check-pass -#![allow(dead_code)] -// Test that the requirement (in `Bar`) that `T::Bar : 'static` does -// not wind up propagating to `T`. - -// pretty-expanded FIXME #23616 - -pub trait Foo { - type Bar; - - fn foo(&self) -> Self; -} - -pub struct Static(T); - -struct Bar - where T::Bar : 'static -{ - x: Static> -} - -fn main() { } diff --git a/src/test/ui/issues/issue-22066.rs b/src/test/ui/issues/issue-22066.rs deleted file mode 100644 index 8e8ba5dc46c..00000000000 --- a/src/test/ui/issues/issue-22066.rs +++ /dev/null @@ -1,12 +0,0 @@ -// check-pass -pub trait LineFormatter<'a> { - type Iter: Iterator + 'a; - fn iter(&'a self, line: &'a str) -> Self::Iter; - - fn dimensions(&'a self, line: &'a str) { - let iter: Self::Iter = self.iter(line); - <_ as IntoIterator>::into_iter(iter); - } -} - -fn main() {} diff --git a/src/test/ui/issues/issue-22463.rs b/src/test/ui/issues/issue-22463.rs deleted file mode 100644 index fdf5a2fca72..00000000000 --- a/src/test/ui/issues/issue-22463.rs +++ /dev/null @@ -1,20 +0,0 @@ -// run-pass -macro_rules! items { - () => { - type A = (); - fn a() {} - } -} - -trait Foo { - type A; - fn a(); -} - -impl Foo for () { - items!(); -} - -fn main() { - -} diff --git a/src/test/ui/issues/issue-22828.rs b/src/test/ui/issues/issue-22828.rs deleted file mode 100644 index adf4dd6ce75..00000000000 --- a/src/test/ui/issues/issue-22828.rs +++ /dev/null @@ -1,23 +0,0 @@ -// run-pass -#![allow(dead_code)] -// Test transitive analysis for associated types. Collected types -// should be normalized and new obligations generated. - -// pretty-expanded FIXME #23616 - -trait Foo { - type A; - fn foo(&self) {} -} - -impl Foo for usize { - type A = usize; -} - -struct Bar { inner: T::A } - -fn is_send() {} - -fn main() { - is_send::>(); -} diff --git a/src/test/ui/issues/issue-23458.rs b/src/test/ui/issues/issue-23458.rs deleted file mode 100644 index d640828c16d..00000000000 --- a/src/test/ui/issues/issue-23458.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! -// compile-flags: -Ccodegen-units=1 -// build-fail -// only-x86_64 - -fn main() { - unsafe { - llvm_asm!("int $3"); //~ ERROR too few operands for instruction - //~| ERROR invalid operand in inline asm - } -} diff --git a/src/test/ui/issues/issue-23458.stderr b/src/test/ui/issues/issue-23458.stderr deleted file mode 100644 index 69e458f7ca0..00000000000 --- a/src/test/ui/issues/issue-23458.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: invalid operand in inline asm: 'int $3' - --> $DIR/issue-23458.rs:9:9 - | -LL | llvm_asm!("int $3"); - | ^ - -error: too few operands for instruction - --> $DIR/issue-23458.rs:9:9 - | -LL | llvm_asm!("int $3"); - | ^ - | -note: instantiated into assembly here - --> :1:2 - | -LL | int - | ^ - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/issues/issue-23716.rs b/src/test/ui/issues/issue-23716.rs deleted file mode 100644 index e9139c0aa14..00000000000 --- a/src/test/ui/issues/issue-23716.rs +++ /dev/null @@ -1,17 +0,0 @@ -static foo: i32 = 0; - -fn bar(foo: i32) {} -//~^ ERROR function parameters cannot shadow statics -//~| cannot be named the same as a static - -mod submod { - pub static answer: i32 = 42; -} - -use self::submod::answer; - -fn question(answer: i32) {} -//~^ ERROR function parameters cannot shadow statics -//~| cannot be named the same as a static -fn main() { -} diff --git a/src/test/ui/issues/issue-23716.stderr b/src/test/ui/issues/issue-23716.stderr deleted file mode 100644 index e7bebfbbcb5..00000000000 --- a/src/test/ui/issues/issue-23716.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0530]: function parameters cannot shadow statics - --> $DIR/issue-23716.rs:3:8 - | -LL | static foo: i32 = 0; - | -------------------- the static `foo` is defined here -LL | -LL | fn bar(foo: i32) {} - | ^^^ cannot be named the same as a static - -error[E0530]: function parameters cannot shadow statics - --> $DIR/issue-23716.rs:13:13 - | -LL | use self::submod::answer; - | -------------------- the static `answer` is imported here -LL | -LL | fn question(answer: i32) {} - | ^^^^^^ cannot be named the same as a static - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0530`. diff --git a/src/test/ui/issues/issue-23968-const-not-overflow.rs b/src/test/ui/issues/issue-23968-const-not-overflow.rs deleted file mode 100644 index b9593021235..00000000000 --- a/src/test/ui/issues/issue-23968-const-not-overflow.rs +++ /dev/null @@ -1,12 +0,0 @@ -// run-pass -const U8_MAX_HALF: u8 = !0u8 / 2; -const U16_MAX_HALF: u16 = !0u16 / 2; -const U32_MAX_HALF: u32 = !0u32 / 2; -const U64_MAX_HALF: u64 = !0u64 / 2; - -fn main() { - assert_eq!(U8_MAX_HALF, 0x7f); - assert_eq!(U16_MAX_HALF, 0x7fff); - assert_eq!(U32_MAX_HALF, 0x7fff_ffff); - assert_eq!(U64_MAX_HALF, 0x7fff_ffff_ffff_ffff); -} diff --git a/src/test/ui/issues/issue-24010.rs b/src/test/ui/issues/issue-24010.rs deleted file mode 100644 index f1818533487..00000000000 --- a/src/test/ui/issues/issue-24010.rs +++ /dev/null @@ -1,14 +0,0 @@ -// run-pass - -trait Foo: Fn(i32) -> i32 + Send {} - -impl i32 + Send> Foo for T {} - -fn wants_foo(f: Box) -> i32 { - f(42) -} - -fn main() { - let f = Box::new(|x| x); - assert_eq!(wants_foo(f), 42); -} diff --git a/src/test/ui/issues/issue-24313.rs b/src/test/ui/issues/issue-24313.rs deleted file mode 100644 index c28b4ca9601..00000000000 --- a/src/test/ui/issues/issue-24313.rs +++ /dev/null @@ -1,32 +0,0 @@ -// run-pass -// ignore-emscripten no threads -// ignore-sgx no processes - -use std::thread; -use std::env; -use std::process::Command; - -struct Handle(i32); - -impl Drop for Handle { - fn drop(&mut self) { panic!(); } -} - -thread_local!(static HANDLE: Handle = Handle(0)); - -fn main() { - let args = env::args().collect::>(); - if args.len() == 1 { - let out = Command::new(&args[0]).arg("test").output().unwrap(); - let stderr = std::str::from_utf8(&out.stderr).unwrap(); - assert!(stderr.contains("panicked at 'explicit panic'"), - "bad failure message:\n{}\n", stderr); - } else { - // TLS dtors are not always run on process exit - thread::spawn(|| { - HANDLE.with(|h| { - println!("{}", h.0); - }); - }).join().unwrap(); - } -} diff --git a/src/test/ui/issues/issue-2444.rs b/src/test/ui/issues/issue-2444.rs deleted file mode 100644 index ac0d0506a34..00000000000 --- a/src/test/ui/issues/issue-2444.rs +++ /dev/null @@ -1,17 +0,0 @@ -// run-fail -// error-pattern:explicit panic -// ignore-emscripten no processes - -use std::sync::Arc; - -enum Err { - Errr(Arc), -} - -fn foo() -> Err { - panic!(); -} - -fn main() { - let _f = foo(); -} diff --git a/src/test/ui/issues/issue-26251.rs b/src/test/ui/issues/issue-26251.rs deleted file mode 100644 index a3e26a41232..00000000000 --- a/src/test/ui/issues/issue-26251.rs +++ /dev/null @@ -1,15 +0,0 @@ -// run-pass -#![allow(overlapping_range_endpoints)] - -fn main() { - let x = 'a'; - - let y = match x { - 'a'..='b' if false => "one", - 'a' => "two", - 'a'..='b' => "three", - _ => panic!("what?"), - }; - - assert_eq!(y, "two"); -} diff --git a/src/test/ui/issues/issue-26448-1.rs b/src/test/ui/issues/issue-26448-1.rs deleted file mode 100644 index 7d2d75bf2e8..00000000000 --- a/src/test/ui/issues/issue-26448-1.rs +++ /dev/null @@ -1,13 +0,0 @@ -// run-pass - -pub trait Foo { - fn foo(self) -> T; -} - -impl<'a, T> Foo for &'a str where &'a str: Into { - fn foo(self) -> T { - panic!(); - } -} - -fn main() {} diff --git a/src/test/ui/issues/issue-26448-2.rs b/src/test/ui/issues/issue-26448-2.rs deleted file mode 100644 index c60e06c3ceb..00000000000 --- a/src/test/ui/issues/issue-26448-2.rs +++ /dev/null @@ -1,21 +0,0 @@ -// check-pass - -pub struct Bar { - items: Vec<&'static str>, - inner: T, -} - -pub trait IntoBar { - fn into_bar(self) -> Bar; -} - -impl<'a, T> IntoBar for &'a str where &'a str: Into { - fn into_bar(self) -> Bar { - Bar { - items: Vec::new(), - inner: self.into(), - } - } -} - -fn main() {} diff --git a/src/test/ui/issues/issue-26448-3.rs b/src/test/ui/issues/issue-26448-3.rs deleted file mode 100644 index d48022c09fe..00000000000 --- a/src/test/ui/issues/issue-26448-3.rs +++ /dev/null @@ -1,25 +0,0 @@ -// check-pass - -pub struct Item { - _inner: &'static str, -} - -pub struct Bar { - items: Vec, - inner: T, -} - -pub trait IntoBar { - fn into_bar(self) -> Bar; -} - -impl<'a, T> IntoBar for &'a str where &'a str: Into { - fn into_bar(self) -> Bar { - Bar { - items: Vec::new(), - inner: self.into(), - } - } -} - -fn main() {} diff --git a/src/test/ui/issues/issue-26638.rs b/src/test/ui/issues/issue-26638.rs deleted file mode 100644 index 72fe4286a06..00000000000 --- a/src/test/ui/issues/issue-26638.rs +++ /dev/null @@ -1,10 +0,0 @@ -fn parse_type(iter: Box+'static>) -> &str { iter.next() } -//~^ ERROR missing lifetime specifier [E0106] - -fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } -//~^ ERROR missing lifetime specifier [E0106] - -fn parse_type_3() -> &str { unimplemented!() } -//~^ ERROR missing lifetime specifier [E0106] - -fn main() {} diff --git a/src/test/ui/issues/issue-26638.stderr b/src/test/ui/issues/issue-26638.stderr deleted file mode 100644 index bb7cdcbb100..00000000000 --- a/src/test/ui/issues/issue-26638.stderr +++ /dev/null @@ -1,39 +0,0 @@ -error[E0106]: missing lifetime specifier - --> $DIR/issue-26638.rs:1:62 - | -LL | fn parse_type(iter: Box+'static>) -> &str { iter.next() } - | ------------------------------------ ^ expected named lifetime parameter - | - = help: this function's return type contains a borrowed value, but the signature does not say which one of `iter`'s 2 lifetimes it is borrowed from -help: consider introducing a named lifetime parameter - | -LL | fn parse_type<'a>(iter: Box+'static>) -> &'a str { iter.next() } - | ++++ ++ - -error[E0106]: missing lifetime specifier - --> $DIR/issue-26638.rs:4:40 - | -LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } - | ^ expected named lifetime parameter - | - = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments -help: consider using the `'static` lifetime - | -LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &'static str { iter() } - | ~~~~~~~~ - -error[E0106]: missing lifetime specifier - --> $DIR/issue-26638.rs:7:22 - | -LL | fn parse_type_3() -> &str { unimplemented!() } - | ^ expected named lifetime parameter - | - = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from -help: consider using the `'static` lifetime - | -LL | fn parse_type_3() -> &'static str { unimplemented!() } - | ~~~~~~~~ - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/issues/issue-26996.rs b/src/test/ui/issues/issue-26996.rs deleted file mode 100644 index 84037b72a27..00000000000 --- a/src/test/ui/issues/issue-26996.rs +++ /dev/null @@ -1,24 +0,0 @@ -// run-pass - -// This test is bogus (i.e., should be check-fail) during the period -// where #54986 is implemented and #54987 is *not* implemented. For -// now: just ignore it -// -// ignore-test - -// This test is checking that the write to `c.0` (which has been moved out of) -// won't overwrite the state in `c2`. -// -// That's a fine thing to test when this code is accepted by the -// compiler, and this code is being transcribed accordingly into -// the ui test issue-21232-partial-init-and-use.rs - -fn main() { - let mut c = (1, "".to_owned()); - match c { - c2 => { - c.0 = 2; - assert_eq!(c2.0, 1); - } - } -} diff --git a/src/test/ui/issues/issue-2748-b.rs b/src/test/ui/issues/issue-2748-b.rs deleted file mode 100644 index 8df735ac88e..00000000000 --- a/src/test/ui/issues/issue-2748-b.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass - -fn thing<'r>(x: &'r [isize]) -> &'r [isize] { x } - -pub fn main() { - let x = &[1,2,3]; - let y = x; - let z = thing(x); - assert_eq!(z[2], x[2]); - assert_eq!(z[1], y[1]); -} diff --git a/src/test/ui/issues/issue-28324.mir.stderr b/src/test/ui/issues/issue-28324.mir.stderr deleted file mode 100644 index aff8bf7927d..00000000000 --- a/src/test/ui/issues/issue-28324.mir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/issue-28324.rs:8:24 - | -LL | pub static BAZ: u32 = *&error_message_count; - | ^^^^^^^^^^^^^^^^^^^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/issues/issue-28324.rs b/src/test/ui/issues/issue-28324.rs deleted file mode 100644 index fbe83e325ed..00000000000 --- a/src/test/ui/issues/issue-28324.rs +++ /dev/null @@ -1,11 +0,0 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - -extern "C" { - static error_message_count: u32; -} - -pub static BAZ: u32 = *&error_message_count; -//~^ ERROR use of extern static is unsafe and requires - -fn main() {} diff --git a/src/test/ui/issues/issue-28324.thir.stderr b/src/test/ui/issues/issue-28324.thir.stderr deleted file mode 100644 index c696c359830..00000000000 --- a/src/test/ui/issues/issue-28324.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/issue-28324.rs:8:25 - | -LL | pub static BAZ: u32 = *&error_message_count; - | ^^^^^^^^^^^^^^^^^^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/issues/issue-28498-ugeh-with-passed-to-fn.rs b/src/test/ui/issues/issue-28498-ugeh-with-passed-to-fn.rs deleted file mode 100644 index 23fd86a093b..00000000000 --- a/src/test/ui/issues/issue-28498-ugeh-with-passed-to-fn.rs +++ /dev/null @@ -1,46 +0,0 @@ -// run-pass - -// Demonstrate the use of the unguarded escape hatch with a type param in negative position -// to assert that destructor will not access any dead data. -// -// Compare with ui/span/issue28498-reject-lifetime-param.rs - -// Demonstrate that a type param in negative position causes dropck to reject code -// that might indirectly access previously dropped value. -// -// Compare with run-pass/issue28498-ugeh-with-passed-to-fn.rs - -#![feature(dropck_eyepatch)] - -#[derive(Debug)] -struct ScribbleOnDrop(String); - -impl Drop for ScribbleOnDrop { - fn drop(&mut self) { - self.0 = format!("DROPPED"); - } -} - -struct Foo(u32, T, Box fn(&'r T) -> String>); - -unsafe impl<#[may_dangle] T> Drop for Foo { - fn drop(&mut self) { - // Use of `may_dangle` is sound, because destructor never passes a `self.1` - // to the callback (in `self.2`) despite having it available. - println!("Dropping Foo({}, _)", self.0); - } -} - -fn callback(s: & &ScribbleOnDrop) -> String { format!("{:?}", s) } - -fn main() { - let (last_dropped, foo0); - let (foo1, first_dropped); - - last_dropped = ScribbleOnDrop(format!("last")); - first_dropped = ScribbleOnDrop(format!("first")); - foo0 = Foo(0, &last_dropped, Box::new(callback)); - foo1 = Foo(1, &first_dropped, Box::new(callback)); - - println!("foo0.1: {:?} foo1.1: {:?}", foo0.1, foo1.1); -} diff --git a/src/test/ui/issues/issue-28871.rs b/src/test/ui/issues/issue-28871.rs deleted file mode 100644 index 210c783de79..00000000000 --- a/src/test/ui/issues/issue-28871.rs +++ /dev/null @@ -1,24 +0,0 @@ -// check-pass -// Regression test for #28871. The problem is that rustc encountered -// two ways to project, one from a where clause and one from the where -// clauses on the trait definition. (In fact, in this case, the where -// clauses originated from the trait definition as well.) The true -// cause of the error is that the trait definition where clauses are -// not being normalized, and hence the two sources are considered in -// conflict, and not a duplicate. Hacky solution is to prefer where -// clauses over the data found in the trait definition. - -trait T { - type T; -} - -struct S; -impl T for S { - type T = S; -} - -trait T2 { - type T: Iterator::T>; -} - -fn main() { } diff --git a/src/test/ui/issues/issue-29084.rs b/src/test/ui/issues/issue-29084.rs deleted file mode 100644 index d1625268669..00000000000 --- a/src/test/ui/issues/issue-29084.rs +++ /dev/null @@ -1,13 +0,0 @@ -macro_rules! foo { - ($d:expr) => {{ - fn bar(d: u8) { } - bar(&mut $d); - //~^ ERROR mismatched types - //~| expected `u8`, found `&mut u8` - }} -} - -fn main() { - foo!(0u8); - //~^ in this expansion of foo! -} diff --git a/src/test/ui/issues/issue-29084.stderr b/src/test/ui/issues/issue-29084.stderr deleted file mode 100644 index a973e23e29e..00000000000 --- a/src/test/ui/issues/issue-29084.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-29084.rs:4:13 - | -LL | bar(&mut $d); - | ^^^^^^^ expected `u8`, found `&mut u8` -... -LL | foo!(0u8); - | --------- in this macro invocation - | - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/issues/issue-3021-c.rs b/src/test/ui/issues/issue-3021-c.rs deleted file mode 100644 index 94ed1fdf781..00000000000 --- a/src/test/ui/issues/issue-3021-c.rs +++ /dev/null @@ -1,9 +0,0 @@ -fn siphash() { - - trait U { - fn g(&self, x: T) -> T; //~ ERROR can't use generic parameters from outer function - //~^ ERROR can't use generic parameters from outer function - } -} - -fn main() {} diff --git a/src/test/ui/issues/issue-3021-c.stderr b/src/test/ui/issues/issue-3021-c.stderr deleted file mode 100644 index 8764ac8a856..00000000000 --- a/src/test/ui/issues/issue-3021-c.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0401]: can't use generic parameters from outer function - --> $DIR/issue-3021-c.rs:4:24 - | -LL | fn siphash() { - | - type parameter from outer function -... -LL | fn g(&self, x: T) -> T; - | - ^ use of generic parameter from outer function - | | - | help: try using a local generic parameter instead: `g` - -error[E0401]: can't use generic parameters from outer function - --> $DIR/issue-3021-c.rs:4:30 - | -LL | fn siphash() { - | - type parameter from outer function -... -LL | fn g(&self, x: T) -> T; - | - ^ use of generic parameter from outer function - | | - | help: try using a local generic parameter instead: `g` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0401`. diff --git a/src/test/ui/issues/issue-3021.rs b/src/test/ui/issues/issue-3021.rs deleted file mode 100644 index a672261f8d6..00000000000 --- a/src/test/ui/issues/issue-3021.rs +++ /dev/null @@ -1,18 +0,0 @@ -trait SipHash { - fn reset(&self); -} - -fn siphash(k0 : u64) { - struct SipState { - v0: u64, - } - - impl SipHash for SipState { - fn reset(&self) { - self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment - } - } - panic!(); -} - -fn main() {} diff --git a/src/test/ui/issues/issue-3021.stderr b/src/test/ui/issues/issue-3021.stderr deleted file mode 100644 index d5b015eec35..00000000000 --- a/src/test/ui/issues/issue-3021.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/issue-3021.rs:12:22 - | -LL | self.v0 = k0 ^ 0x736f6d6570736575; - | ^^ - | - = help: use the `|| { ... }` closure form instead - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0434`. diff --git a/src/test/ui/issues/issue-30225.rs b/src/test/ui/issues/issue-30225.rs deleted file mode 100644 index 42315332c20..00000000000 --- a/src/test/ui/issues/issue-30225.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Regression test for #30225, which was an ICE that would trigger as -// a result of a poor interaction between trait result caching and -// type inference. Specifically, at that time, unification could cause -// unrelated type variables to become instantiated, if subtyping -// relationships existed. These relationships are now propagated -// through obligations and hence everything works out fine. - -trait Foo : Sized { - fn foo(self, u: Option, v: Option) {} -} - -struct A; -struct B; - -impl Foo for () {} // impl A -impl Foo for u32 {} // impl B, creating ambiguity - -fn toxic() { - // cache the resolution <() as Foo<$0,$1>> = impl A - let u = None; - let v = None; - Foo::foo((), u, v); -} - -fn bomb() { - let mut u = None; // type is Option<$0> - let mut v = None; // type is Option<$1> - let mut x = None; // type is Option<$2> - - Foo::foo(x.unwrap(),u,v); // register <$2 as Foo<$0, $1>> - u = v; // mark $0 and $1 in a subtype relationship - //~^ ERROR mismatched types - x = Some(()); // set $2 = (), allowing impl selection - // to proceed for <() as Foo<$0, $1>> = impl A. - // kaboom, this *used* to trigge an ICE -} - -fn main() {} diff --git a/src/test/ui/issues/issue-30225.stderr b/src/test/ui/issues/issue-30225.stderr deleted file mode 100644 index ccd05fa6bfb..00000000000 --- a/src/test/ui/issues/issue-30225.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-30225.rs:31:9 - | -LL | u = v; // mark $0 and $1 in a subtype relationship - | ^ expected struct `A`, found struct `B` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/issues/issue-30355.rs b/src/test/ui/issues/issue-30355.rs deleted file mode 100644 index 6ff5b37f6e5..00000000000 --- a/src/test/ui/issues/issue-30355.rs +++ /dev/null @@ -1,9 +0,0 @@ -pub struct X([u8]); - -pub static Y: &'static X = { - const Y: &'static [u8] = b""; - &X(*Y) - //~^ ERROR E0277 -}; - -fn main() {} diff --git a/src/test/ui/issues/issue-30355.stderr b/src/test/ui/issues/issue-30355.stderr deleted file mode 100644 index 71bbdf5dec7..00000000000 --- a/src/test/ui/issues/issue-30355.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/issue-30355.rs:5:8 - | -LL | &X(*Y) - | ^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `[u8]` - = note: all function arguments must have a statically known size - = help: unsized fn params are gated as an unstable feature - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/issues/issue-31076.rs b/src/test/ui/issues/issue-31076.rs deleted file mode 100644 index cdb196d4ff2..00000000000 --- a/src/test/ui/issues/issue-31076.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![feature(no_core, lang_items)] -#![no_core] - -#[lang="sized"] -trait Sized {} - -#[lang="add"] -trait Add {} - -impl Add for i32 {} - -fn main() { - let x = 5 + 6; - //~^ ERROR cannot add `i32` to `{integer}` - let y = 5i32 + 6i32; - //~^ ERROR cannot add `i32` to `i32` -} diff --git a/src/test/ui/issues/issue-31076.stderr b/src/test/ui/issues/issue-31076.stderr deleted file mode 100644 index ac0d9dc7528..00000000000 --- a/src/test/ui/issues/issue-31076.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0369]: cannot add `i32` to `{integer}` - --> $DIR/issue-31076.rs:13:15 - | -LL | let x = 5 + 6; - | - ^ - i32 - | | - | {integer} - -error[E0369]: cannot add `i32` to `i32` - --> $DIR/issue-31076.rs:15:18 - | -LL | let y = 5i32 + 6i32; - | ---- ^ ---- i32 - | | - | i32 - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0369`. diff --git a/src/test/ui/issues/issue-31804.rs b/src/test/ui/issues/issue-31804.rs deleted file mode 100644 index d056b77cf09..00000000000 --- a/src/test/ui/issues/issue-31804.rs +++ /dev/null @@ -1,6 +0,0 @@ -// Test that error recovery in the parser to an EOF does not give an infinite -// spew of errors. - -fn main() { - let -} //~ ERROR expected pattern, found `}` diff --git a/src/test/ui/issues/issue-31804.stderr b/src/test/ui/issues/issue-31804.stderr deleted file mode 100644 index 76e68b0b352..00000000000 --- a/src/test/ui/issues/issue-31804.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: expected pattern, found `}` - --> $DIR/issue-31804.rs:6:1 - | -LL | } - | ^ expected pattern - -error: aborting due to previous error - diff --git a/src/test/ui/issues/issue-31845.rs b/src/test/ui/issues/issue-31845.rs deleted file mode 100644 index f6dc11502ba..00000000000 --- a/src/test/ui/issues/issue-31845.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Checks lexical scopes cannot see through normal module boundaries - -fn f() { - fn g() {} - mod foo { - fn h() { - g(); //~ ERROR cannot find function `g` in this scope - } - } -} - -fn main() {} diff --git a/src/test/ui/issues/issue-31845.stderr b/src/test/ui/issues/issue-31845.stderr deleted file mode 100644 index 56281938559..00000000000 --- a/src/test/ui/issues/issue-31845.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0425]: cannot find function `g` in this scope - --> $DIR/issue-31845.rs:7:12 - | -LL | g(); - | ^ not found in this scope - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/issues/issue-3211.rs b/src/test/ui/issues/issue-3211.rs deleted file mode 100644 index 49dd4fa7360..00000000000 --- a/src/test/ui/issues/issue-3211.rs +++ /dev/null @@ -1,7 +0,0 @@ -// run-pass -pub fn main() { - let mut x = 0; - for _ in 0..4096 { x += 1; } - assert_eq!(x, 4096); - println!("x = {}", x); -} diff --git a/src/test/ui/issues/issue-32201.rs b/src/test/ui/issues/issue-32201.rs deleted file mode 100644 index f27bb1c2eb5..00000000000 --- a/src/test/ui/issues/issue-32201.rs +++ /dev/null @@ -1,13 +0,0 @@ -extern "C" { - fn foo(a: i32, ...); -} - -fn bar(_: *const u8) {} - -fn main() { - unsafe { - foo(0, bar); - //~^ ERROR can't pass `fn(*const u8) {bar}` to variadic function - //~| HELP cast the value to `fn(*const u8)` - } -} diff --git a/src/test/ui/issues/issue-32201.stderr b/src/test/ui/issues/issue-32201.stderr deleted file mode 100644 index cedb5878466..00000000000 --- a/src/test/ui/issues/issue-32201.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0617]: can't pass `fn(*const u8) {bar}` to variadic function - --> $DIR/issue-32201.rs:9:16 - | -LL | foo(0, bar); - | ^^^ help: cast the value to `fn(*const u8)`: `bar as fn(*const u8)` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0617`. diff --git a/src/test/ui/issues/issue-333.rs b/src/test/ui/issues/issue-333.rs deleted file mode 100644 index 0753aaa0797..00000000000 --- a/src/test/ui/issues/issue-333.rs +++ /dev/null @@ -1,7 +0,0 @@ -// run-pass - -fn quux(x: T) -> T { let f = id::; return f(x); } - -fn id(x: T) -> T { return x; } - -pub fn main() { assert_eq!(quux(10), 10); } diff --git a/src/test/ui/issues/issue-34028.rs b/src/test/ui/issues/issue-34028.rs deleted file mode 100644 index d761c0c823b..00000000000 --- a/src/test/ui/issues/issue-34028.rs +++ /dev/null @@ -1,10 +0,0 @@ -// check-pass - -macro_rules! m { - () => { #[cfg(any())] fn f() {} } -} - -trait T {} -impl T for () { m!(); } - -fn main() {} diff --git a/src/test/ui/issues/issue-34171.rs b/src/test/ui/issues/issue-34171.rs deleted file mode 100644 index 157c58c459d..00000000000 --- a/src/test/ui/issues/issue-34171.rs +++ /dev/null @@ -1,10 +0,0 @@ -// check-pass - -macro_rules! null { ($i:tt) => {} } -macro_rules! apply_null { - ($i:item) => { null! { $i } } -} - -fn main() { - apply_null!(#[cfg(all())] fn f() {}); -} diff --git a/src/test/ui/issues/issue-34255-1.rs b/src/test/ui/issues/issue-34255-1.rs deleted file mode 100644 index c70cd8b5077..00000000000 --- a/src/test/ui/issues/issue-34255-1.rs +++ /dev/null @@ -1,10 +0,0 @@ -enum Test { - Drill { - field: i32, - } -} - -fn main() { - Test::Drill(field: 42); - //~^ ERROR invalid `struct` delimiters or `fn` call arguments -} diff --git a/src/test/ui/issues/issue-34255-1.stderr b/src/test/ui/issues/issue-34255-1.stderr deleted file mode 100644 index fbff75e37d9..00000000000 --- a/src/test/ui/issues/issue-34255-1.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error: invalid `struct` delimiters or `fn` call arguments - --> $DIR/issue-34255-1.rs:8:5 - | -LL | Test::Drill(field: 42); - | ^^^^^^^^^^^^^^^^^^^^^^ - | -help: if `Test::Drill` is a struct, use braces as delimiters - | -LL | Test::Drill { field: 42 }; - | ~ ~ -help: if `Test::Drill` is a function, use the arguments directly - | -LL - Test::Drill(field: 42); -LL + Test::Drill(42); - | - -error: aborting due to previous error - diff --git a/src/test/ui/issues/issue-35546.rs b/src/test/ui/issues/issue-35546.rs deleted file mode 100644 index 004679a6240..00000000000 --- a/src/test/ui/issues/issue-35546.rs +++ /dev/null @@ -1,20 +0,0 @@ -// build-pass -#![allow(dead_code)] -// Regression test for #35546. Check that we are able to codegen -// this. Before we had problems because of the drop glue signature -// around dropping a trait object (specifically, when dropping the -// `value` field of `Node`). - -struct Node { - next: Option>>, - value: T, -} - -fn clear(head: &mut Option>>) { - match head.take() { - Some(node) => *head = node.next, - None => (), - } -} - -fn main() {} diff --git a/src/test/ui/issues/issue-37175.rs b/src/test/ui/issues/issue-37175.rs deleted file mode 100644 index 9ec9d48d18b..00000000000 --- a/src/test/ui/issues/issue-37175.rs +++ /dev/null @@ -1,5 +0,0 @@ -// run-pass -macro_rules! m { (<$t:ty>) => { stringify!($t) } } -fn main() { - println!("{}", m!(>)); -} diff --git a/src/test/ui/issues/issue-37366.rs b/src/test/ui/issues/issue-37366.rs deleted file mode 100644 index acc2f3e9f5f..00000000000 --- a/src/test/ui/issues/issue-37366.rs +++ /dev/null @@ -1,16 +0,0 @@ -// check-pass -// ignore-emscripten - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -macro_rules! interrupt_handler { - () => { - unsafe fn _interrupt_handler() { - llvm_asm!("pop eax" :::: "intel"); - } - } -} -interrupt_handler!{} - -fn main() {} diff --git a/src/test/ui/issues/issue-37550.rs b/src/test/ui/issues/issue-37550.rs deleted file mode 100644 index 35b63bddca2..00000000000 --- a/src/test/ui/issues/issue-37550.rs +++ /dev/null @@ -1,6 +0,0 @@ -const fn x() { - let t = true; - let x = || t; //~ ERROR function pointer -} - -fn main() {} diff --git a/src/test/ui/issues/issue-37550.stderr b/src/test/ui/issues/issue-37550.stderr deleted file mode 100644 index 54b60df70fd..00000000000 --- a/src/test/ui/issues/issue-37550.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: function pointers cannot appear in constant functions - --> $DIR/issue-37550.rs:3:9 - | -LL | let x = || t; - | ^ - | - = note: see issue #57563 for more information - = help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/issues/issue-37991.rs b/src/test/ui/issues/issue-37991.rs deleted file mode 100644 index a6ac4d5ca2e..00000000000 --- a/src/test/ui/issues/issue-37991.rs +++ /dev/null @@ -1,17 +0,0 @@ -// run-pass - -const fn foo() -> i64 { - 3 -} - -const fn bar(x: i64) -> i64 { - x*2 -} - -fn main() { - let val = &(foo() % 2); - assert_eq!(*val, 1); - - let val2 = &(bar(1+1) % 3); - assert_eq!(*val2, 1); -} diff --git a/src/test/ui/issues/issue-38604.rs b/src/test/ui/issues/issue-38604.rs deleted file mode 100644 index 002a3c43fcb..00000000000 --- a/src/test/ui/issues/issue-38604.rs +++ /dev/null @@ -1,16 +0,0 @@ -trait Q {} -trait Foo where u32: Q { - fn foo(&self); -} - -impl Q<()> for u32 {} -impl Foo for () { - fn foo(&self) { - println!("foo!"); - } -} - -fn main() { - let _f: Box = //~ ERROR `Foo` cannot be made into an object - Box::new(()); //~ ERROR `Foo` cannot be made into an object -} diff --git a/src/test/ui/issues/issue-38604.stderr b/src/test/ui/issues/issue-38604.stderr deleted file mode 100644 index d41488c15f7..00000000000 --- a/src/test/ui/issues/issue-38604.stderr +++ /dev/null @@ -1,33 +0,0 @@ -error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/issue-38604.rs:14:13 - | -LL | let _f: Box = - | ^^^^^^^^^^^^ `Foo` cannot be made into an object - | -note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit - --> $DIR/issue-38604.rs:2:22 - | -LL | trait Foo where u32: Q { - | --- ^^^^^^^ ...because it uses `Self` as a type parameter - | | - | this trait cannot be made into an object... - -error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/issue-38604.rs:15:9 - | -LL | Box::new(()); - | ^^^^^^^^^^^^ `Foo` cannot be made into an object - | -note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit - --> $DIR/issue-38604.rs:2:22 - | -LL | trait Foo where u32: Q { - | --- ^^^^^^^ ...because it uses `Self` as a type parameter - | | - | this trait cannot be made into an object... - = note: required because of the requirements on the impl of `CoerceUnsized>` for `Box<()>` - = note: required by cast to type `Box` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0038`. diff --git a/src/test/ui/issues/issue-39388.rs b/src/test/ui/issues/issue-39388.rs deleted file mode 100644 index a8e31a648c9..00000000000 --- a/src/test/ui/issues/issue-39388.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![allow(unused_macros)] - -macro_rules! assign { - (($($a:tt)*) = ($($b:tt))*) => { //~ ERROR expected one of: `*`, `+`, or `?` - $($a)* = $($b)* - } -} - -fn main() {} diff --git a/src/test/ui/issues/issue-39388.stderr b/src/test/ui/issues/issue-39388.stderr deleted file mode 100644 index 62e7dff5476..00000000000 --- a/src/test/ui/issues/issue-39388.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: expected one of: `*`, `+`, or `?` - --> $DIR/issue-39388.rs:4:22 - | -LL | (($($a:tt)*) = ($($b:tt))*) => { - | ^^^^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/issues/issue-3973.rs b/src/test/ui/issues/issue-3973.rs deleted file mode 100644 index a5ed5b87051..00000000000 --- a/src/test/ui/issues/issue-3973.rs +++ /dev/null @@ -1,25 +0,0 @@ -struct Point { - x: f64, - y: f64, -} - -trait ToString_ { - fn to_string(&self) -> String; -} - -impl ToString_ for Point { - fn new(x: f64, y: f64) -> Point { - //~^ ERROR method `new` is not a member of trait `ToString_` - Point { x: x, y: y } - } - - fn to_string(&self) -> String { - format!("({}, {})", self.x, self.y) - } -} - -fn main() { - let p = Point::new(0.0, 0.0); - //~^ ERROR no function or associated item named `new` found for struct `Point` - println!("{}", p.to_string()); -} diff --git a/src/test/ui/issues/issue-3973.stderr b/src/test/ui/issues/issue-3973.stderr deleted file mode 100644 index 63282e8d86d..00000000000 --- a/src/test/ui/issues/issue-3973.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error[E0407]: method `new` is not a member of trait `ToString_` - --> $DIR/issue-3973.rs:11:5 - | -LL | / fn new(x: f64, y: f64) -> Point { -LL | | -LL | | Point { x: x, y: y } -LL | | } - | |_____^ not a member of trait `ToString_` - -error[E0599]: no function or associated item named `new` found for struct `Point` in the current scope - --> $DIR/issue-3973.rs:22:20 - | -LL | struct Point { - | ------------ function or associated item `new` not found for this -... -LL | let p = Point::new(0.0, 0.0); - | ^^^ function or associated item not found in `Point` - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0407, E0599. -For more information about an error, try `rustc --explain E0407`. diff --git a/src/test/ui/issues/issue-39823.rs b/src/test/ui/issues/issue-39823.rs deleted file mode 100644 index 148cf527e7c..00000000000 --- a/src/test/ui/issues/issue-39823.rs +++ /dev/null @@ -1,25 +0,0 @@ -// run-pass -// aux-build:issue-39823.rs - -extern crate issue_39823; -use issue_39823::{RemoteC, RemoteG}; - -#[derive(Debug, PartialEq)] -struct LocalC(u32); - -#[derive(Debug, PartialEq)] -struct LocalG(T); - -fn main() { - let virtual_localc : &dyn Fn(_) -> LocalC = &LocalC; - assert_eq!(virtual_localc(1), LocalC(1)); - - let virtual_localg : &dyn Fn(_) -> LocalG = &LocalG; - assert_eq!(virtual_localg(1), LocalG(1)); - - let virtual_remotec : &dyn Fn(_) -> RemoteC = &RemoteC; - assert_eq!(virtual_remotec(1), RemoteC(1)); - - let virtual_remoteg : &dyn Fn(_) -> RemoteG = &RemoteG; - assert_eq!(virtual_remoteg(1), RemoteG(1)); -} diff --git a/src/test/ui/issues/issue-40770.rs b/src/test/ui/issues/issue-40770.rs deleted file mode 100644 index c9713c15798..00000000000 --- a/src/test/ui/issues/issue-40770.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass -#![allow(unused_macros)] -macro_rules! m { - ($e:expr) => { - macro_rules! n { () => { $e } } - } -} - -fn main() { - m!(foo!()); -} diff --git a/src/test/ui/issues/issue-40962.rs b/src/test/ui/issues/issue-40962.rs deleted file mode 100644 index 7b91c06819f..00000000000 --- a/src/test/ui/issues/issue-40962.rs +++ /dev/null @@ -1,11 +0,0 @@ -// check-pass -macro_rules! m { - ($i:meta) => { - #[derive($i)] - struct S; - } -} - -m!(Clone); - -fn main() {} diff --git a/src/test/ui/issues/issue-42463.rs b/src/test/ui/issues/issue-42463.rs deleted file mode 100644 index 51d6ea3f7a8..00000000000 --- a/src/test/ui/issues/issue-42463.rs +++ /dev/null @@ -1,32 +0,0 @@ -// run-pass -use std::ops::{Deref, DerefMut}; - -struct CheckedDeref { - value: T, - check: F -} - -impl bool, T> Deref for CheckedDeref { - type Target = T; - fn deref(&self) -> &T { - assert!((self.check)(&self.value)); - &self.value - } -} - -impl bool, T> DerefMut for CheckedDeref { - fn deref_mut(&mut self) -> &mut T { - assert!((self.check)(&self.value)); - &mut self.value - } -} - - -fn main() { - let mut v = CheckedDeref { - value: vec![0], - check: |v: &Vec<_>| !v.is_empty() - }; - v.push(1); - assert_eq!(*v, vec![0, 1]); -} diff --git a/src/test/ui/issues/issue-42679.rs b/src/test/ui/issues/issue-42679.rs deleted file mode 100644 index 596309f2568..00000000000 --- a/src/test/ui/issues/issue-42679.rs +++ /dev/null @@ -1,22 +0,0 @@ -// run-pass -#![feature(box_syntax)] -#![feature(box_patterns)] - -#[derive(Debug, PartialEq)] -enum Test { - Foo(usize), - Bar(isize), -} - -fn main() { - let a = box Test::Foo(10); - let b = box Test::Bar(-20); - match (a, b) { - (_, box Test::Foo(_)) => unreachable!(), - (box Test::Foo(x), b) => { - assert_eq!(x, 10); - assert_eq!(b, box Test::Bar(-20)); - }, - _ => unreachable!(), - } -} diff --git a/src/test/ui/issues/issue-42747.rs b/src/test/ui/issues/issue-42747.rs deleted file mode 100644 index fec65878210..00000000000 --- a/src/test/ui/issues/issue-42747.rs +++ /dev/null @@ -1,46 +0,0 @@ -// run-pass -macro_rules! fooN { - ($cur:ident $prev:ty) => { - #[allow(dead_code)] - enum $cur { - Empty, - First($prev), - Second($prev), - Third($prev), - Fourth($prev), - } - } -} - -fooN!(Foo0 ()); -fooN!(Foo1 Foo0); -fooN!(Foo2 Foo1); -fooN!(Foo3 Foo2); -fooN!(Foo4 Foo3); -fooN!(Foo5 Foo4); -fooN!(Foo6 Foo5); -fooN!(Foo7 Foo6); -fooN!(Foo8 Foo7); -fooN!(Foo9 Foo8); -fooN!(Foo10 Foo9); -fooN!(Foo11 Foo10); -fooN!(Foo12 Foo11); -fooN!(Foo13 Foo12); -fooN!(Foo14 Foo13); -fooN!(Foo15 Foo14); -fooN!(Foo16 Foo15); -fooN!(Foo17 Foo16); -fooN!(Foo18 Foo17); -fooN!(Foo19 Foo18); -fooN!(Foo20 Foo19); -fooN!(Foo21 Foo20); -fooN!(Foo22 Foo21); -fooN!(Foo23 Foo22); -fooN!(Foo24 Foo23); -fooN!(Foo25 Foo24); -fooN!(Foo26 Foo25); -fooN!(Foo27 Foo26); - -fn main() { - let _foo = Foo27::Empty; -} diff --git a/src/test/ui/issues/issue-43189.rs b/src/test/ui/issues/issue-43189.rs deleted file mode 100644 index ce667a5006e..00000000000 --- a/src/test/ui/issues/issue-43189.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Issue 46112: An extern crate pub re-exporting libcore was causing -// paths rooted from `std` to be misrendered in the diagnostic output. - -// ignore-windows -// aux-build:xcrate-issue-43189-a.rs -// aux-build:xcrate-issue-43189-b.rs - -extern crate xcrate_issue_43189_b; -fn main() { - ().a(); - //~^ ERROR no method named `a` found -} diff --git a/src/test/ui/issues/issue-43189.stderr b/src/test/ui/issues/issue-43189.stderr deleted file mode 100644 index caf7530b85a..00000000000 --- a/src/test/ui/issues/issue-43189.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0599]: no method named `a` found for unit type `()` in the current scope - --> $DIR/issue-43189.rs:10:8 - | -LL | ().a(); - | ^ method not found in `()` - | - ::: $DIR/auxiliary/xcrate-issue-43189-a.rs:5:8 - | -LL | fn a(&self) {} - | - the method is available for `()` here - | - = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: - | -LL | use xcrate_issue_43189_b::xcrate_issue_43189_a::A; - | - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/issues/issue-4401.rs b/src/test/ui/issues/issue-4401.rs deleted file mode 100644 index fef73fbe1f5..00000000000 --- a/src/test/ui/issues/issue-4401.rs +++ /dev/null @@ -1,7 +0,0 @@ -// run-pass -pub fn main() { - let mut count = 0; - for _ in 0..999_999 { count += 1; } - assert_eq!(count, 999_999); - println!("{}", count); -} diff --git a/src/test/ui/issues/issue-4448.rs b/src/test/ui/issues/issue-4448.rs deleted file mode 100644 index 27d0326891b..00000000000 --- a/src/test/ui/issues/issue-4448.rs +++ /dev/null @@ -1,16 +0,0 @@ -// run-pass -// ignore-emscripten no threads support - -use std::sync::mpsc::channel; -use std::thread; - -pub fn main() { - let (tx, rx) = channel::<&'static str>(); - - let t = thread::spawn(move|| { - assert_eq!(rx.recv().unwrap(), "hello, world"); - }); - - tx.send("hello, world").unwrap(); - t.join().ok().unwrap(); -} diff --git a/src/test/ui/issues/issue-45124.rs b/src/test/ui/issues/issue-45124.rs deleted file mode 100644 index 942014c9184..00000000000 --- a/src/test/ui/issues/issue-45124.rs +++ /dev/null @@ -1,18 +0,0 @@ -// run-pass -#![allow(unreachable_code)] -// compile-flags: --edition 2018 - -#![feature(try_blocks)] - -fn main() { - let mut a = 0; - let () = { - let _: Result<(), ()> = try { - let _ = Err(())?; - return - }; - a += 1; - }; - a += 2; - assert_eq!(a, 3); -} diff --git a/src/test/ui/issues/issue-45152.rs b/src/test/ui/issues/issue-45152.rs deleted file mode 100644 index fb1c9fb78f3..00000000000 --- a/src/test/ui/issues/issue-45152.rs +++ /dev/null @@ -1,24 +0,0 @@ -// run-pass -#![allow(dead_code)] -#![allow(unused_variables)] -#![feature(unsize, coerce_unsized)] - -#[repr(packed)] -struct UnalignedPtr<'a, T: ?Sized> - where T: 'a, -{ - data: &'a T, -} - -fn main() { - - impl<'a, T, U> std::ops::CoerceUnsized> for UnalignedPtr<'a, T> - where - T: std::marker::Unsize + ?Sized, - U: ?Sized, - { } - - let arr = [1, 2, 3]; - let arr_unaligned: UnalignedPtr<[i32; 3]> = UnalignedPtr { data: &arr }; - let arr_unaligned: UnalignedPtr<[i32]> = arr_unaligned; -} diff --git a/src/test/ui/issues/issue-46095.rs b/src/test/ui/issues/issue-46095.rs deleted file mode 100644 index 59ddb60c9f2..00000000000 --- a/src/test/ui/issues/issue-46095.rs +++ /dev/null @@ -1,30 +0,0 @@ -// run-pass -struct A; - -impl A { - fn take_mutably(&mut self) {} -} - -fn identity(t: T) -> T { - t -} - -// Issue 46095 -// Built-in indexing should be used even when the index is not -// trivially an integer -// Overloaded indexing would cause wrapped to be borrowed mutably - -fn main() { - let mut a1 = A; - let mut a2 = A; - - let wrapped = [&mut a1, &mut a2]; - - { - wrapped[0 + 1 - 1].take_mutably(); - } - - { - wrapped[identity(0)].take_mutably(); - } -} diff --git a/src/test/ui/issues/issue-46112.rs b/src/test/ui/issues/issue-46112.rs deleted file mode 100644 index 0cdd2c27ff7..00000000000 --- a/src/test/ui/issues/issue-46112.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Issue 46112: An extern crate pub re-exporting libcore was causing -// paths rooted from `std` to be misrendered in the diagnostic output. - -// ignore-windows -// aux-build:xcrate-issue-46112-rexport-core.rs - -extern crate xcrate_issue_46112_rexport_core; -fn test(r: Result, &'static str>) { } -fn main() { test(Ok(())); } -//~^ mismatched types diff --git a/src/test/ui/issues/issue-46112.stderr b/src/test/ui/issues/issue-46112.stderr deleted file mode 100644 index ec05fbe580e..00000000000 --- a/src/test/ui/issues/issue-46112.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-46112.rs:9:21 - | -LL | fn main() { test(Ok(())); } - | ^^ - | | - | expected enum `Option`, found `()` - | help: try using a variant of the expected enum: `Some(())` - | - = note: expected enum `Option<()>` - found unit type `()` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/issues/issue-47139-1.rs b/src/test/ui/issues/issue-47139-1.rs deleted file mode 100644 index c55fc34346c..00000000000 --- a/src/test/ui/issues/issue-47139-1.rs +++ /dev/null @@ -1,78 +0,0 @@ -// run-pass -// Regression test for issue #47139: -// -// Coherence was encountering an (unnecessary) overflow trying to -// decide if the two impls of dummy overlap. -// -// The overflow went something like: -// -// - `&'a ?T: Insertable` ? -// - let ?T = Option ? -// - `Option: Insertable` ? -// - `Option<&'a ?U>: Insertable` ? -// - `&'a ?U: Insertable` ? -// -// While somewhere in the middle, a projection would occur, which -// broke cycle detection. -// -// It turned out that this cycle was being kicked off due to some -// extended diagnostic attempts in coherence, so removing those -// sidestepped the issue for now. - -#![allow(dead_code)] - -pub trait Insertable { - type Values; - - fn values(self) -> Self::Values; -} - -impl Insertable for Option - where - T: Insertable, - T::Values: Default, -{ - type Values = T::Values; - - fn values(self) -> Self::Values { - self.map(Insertable::values).unwrap_or_default() - } -} - -impl<'a, T> Insertable for &'a Option - where - Option<&'a T>: Insertable, -{ - type Values = as Insertable>::Values; - - fn values(self) -> Self::Values { - self.as_ref().values() - } -} - -impl<'a, T> Insertable for &'a [T] -{ - type Values = Self; - - fn values(self) -> Self::Values { - self - } -} - -trait Unimplemented { } - -trait Dummy { } - -struct Foo { t: T } - -impl<'a, U> Dummy for Foo<&'a U> - where &'a U: Insertable -{ -} - -impl Dummy for T - where T: Unimplemented -{ } - -fn main() { -} diff --git a/src/test/ui/issues/issue-49040.rs b/src/test/ui/issues/issue-49040.rs deleted file mode 100644 index b7a541dd664..00000000000 --- a/src/test/ui/issues/issue-49040.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![allow(unused_variables)]; //~ ERROR expected item, found `;` -//~^ ERROR `main` function -fn foo() {} diff --git a/src/test/ui/issues/issue-49040.stderr b/src/test/ui/issues/issue-49040.stderr deleted file mode 100644 index 56befe3a0a7..00000000000 --- a/src/test/ui/issues/issue-49040.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error: expected item, found `;` - --> $DIR/issue-49040.rs:1:28 - | -LL | #![allow(unused_variables)]; - | ^ help: remove this semicolon - -error[E0601]: `main` function not found in crate `issue_49040` - --> $DIR/issue-49040.rs:1:1 - | -LL | #![allow(unused_variables)]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ consider adding a `main` function to `$DIR/issue-49040.rs` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/issues/issue-49579.rs b/src/test/ui/issues/issue-49579.rs deleted file mode 100644 index 98de014e90b..00000000000 --- a/src/test/ui/issues/issue-49579.rs +++ /dev/null @@ -1,14 +0,0 @@ -// check-pass - -fn fibs(n: u32) -> impl Iterator { - (0 .. n) - .scan((0, 1), |st, _| { - *st = (st.1, st.0 + st.1); - Some(*st) - }) - .map(&|(f, _)| f) -} - -fn main() { - println!("{:?}", fibs(10).collect::>()); -} diff --git a/src/test/ui/issues/issue-49685.rs b/src/test/ui/issues/issue-49685.rs deleted file mode 100644 index fb328d67b75..00000000000 --- a/src/test/ui/issues/issue-49685.rs +++ /dev/null @@ -1,13 +0,0 @@ -// run-pass -// Regression test for #49685: drop elaboration was not revealing the -// value of `impl Trait` returns, leading to an ICE. - -fn main() { - let _ = Some(()) - .into_iter() - .flat_map(|_| Some(()).into_iter().flat_map(func)); -} - -fn func(_: ()) -> impl Iterator { - Some(()).into_iter().flat_map(|_| vec![]) -} diff --git a/src/test/ui/issues/issue-50731.rs b/src/test/ui/issues/issue-50731.rs deleted file mode 100644 index 209c1e1279b..00000000000 --- a/src/test/ui/issues/issue-50731.rs +++ /dev/null @@ -1,6 +0,0 @@ -// run-pass -enum Void {} -fn foo(_: Result<(Void, u32), (Void, String)>) {} -fn main() { - let _: fn(_) = foo; -} diff --git a/src/test/ui/issues/issue-5099.rs b/src/test/ui/issues/issue-5099.rs deleted file mode 100644 index b5abccb4b19..00000000000 --- a/src/test/ui/issues/issue-5099.rs +++ /dev/null @@ -1,13 +0,0 @@ -trait B { - fn a() -> A { - this.a //~ ERROR cannot find value `this` in this scope - } - fn b(x: i32) { - this.b(x); //~ ERROR cannot find value `this` in this scope - } - fn c() { - let _ = || this.a; //~ ERROR cannot find value `this` in this scope - } -} - -fn main() {} diff --git a/src/test/ui/issues/issue-5099.stderr b/src/test/ui/issues/issue-5099.stderr deleted file mode 100644 index e9b2a9c4d48..00000000000 --- a/src/test/ui/issues/issue-5099.stderr +++ /dev/null @@ -1,48 +0,0 @@ -error[E0425]: cannot find value `this` in this scope - --> $DIR/issue-5099.rs:3:9 - | -LL | this.a - | ^^^^ not found in this scope - | -help: you might have meant to use `self` here instead - | -LL | self.a - | ~~~~ -help: if you meant to use `self`, you are also missing a `self` receiver argument - | -LL | fn a(&self) -> A { - | +++++ - -error[E0425]: cannot find value `this` in this scope - --> $DIR/issue-5099.rs:6:9 - | -LL | this.b(x); - | ^^^^ not found in this scope - | -help: you might have meant to use `self` here instead - | -LL | self.b(x); - | ~~~~ -help: if you meant to use `self`, you are also missing a `self` receiver argument - | -LL | fn b(&self, x: i32) { - | ++++++ - -error[E0425]: cannot find value `this` in this scope - --> $DIR/issue-5099.rs:9:20 - | -LL | let _ = || this.a; - | ^^^^ not found in this scope - | -help: you might have meant to use `self` here instead - | -LL | let _ = || self.a; - | ~~~~ -help: if you meant to use `self`, you are also missing a `self` receiver argument - | -LL | fn c(&self) { - | +++++ - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/issues/issue-50993.rs b/src/test/ui/issues/issue-50993.rs deleted file mode 100644 index e6a9451a060..00000000000 --- a/src/test/ui/issues/issue-50993.rs +++ /dev/null @@ -1,9 +0,0 @@ -// compile-flags: --crate-type dylib --target thumbv7em-none-eabihf -// needs-llvm-components: arm -// build-pass -// error-pattern: dropping unsupported crate type `dylib` for target `thumbv7em-none-eabihf` - -#![feature(no_core)] - -#![no_std] -#![no_core] diff --git a/src/test/ui/issues/issue-50993.stderr b/src/test/ui/issues/issue-50993.stderr deleted file mode 100644 index 45cbfef0709..00000000000 --- a/src/test/ui/issues/issue-50993.stderr +++ /dev/null @@ -1,4 +0,0 @@ -warning: dropping unsupported crate type `dylib` for target `thumbv7em-none-eabihf` - -warning: 1 warning emitted - diff --git a/src/test/ui/issues/issue-51185.rs b/src/test/ui/issues/issue-51185.rs deleted file mode 100644 index 52a2b25539d..00000000000 --- a/src/test/ui/issues/issue-51185.rs +++ /dev/null @@ -1,8 +0,0 @@ -// run-pass -fn foo() -> impl Into fn(&'a ())> { - (|_| {}) as for<'a> fn(&'a ()) -} - -fn main() { - foo().into()(&()); -} diff --git a/src/test/ui/issues/issue-51345.rs b/src/test/ui/issues/issue-51345.rs deleted file mode 100644 index 15571e8bf5b..00000000000 --- a/src/test/ui/issues/issue-51345.rs +++ /dev/null @@ -1,8 +0,0 @@ -// run-pass -#![allow(unreachable_code)] - -fn main() { - let mut v = Vec::new(); - - loop { v.push(break) } -} diff --git a/src/test/ui/issues/issue-51582.rs b/src/test/ui/issues/issue-51582.rs deleted file mode 100644 index 40a70c623a7..00000000000 --- a/src/test/ui/issues/issue-51582.rs +++ /dev/null @@ -1,18 +0,0 @@ -// run-pass -#![feature(core_intrinsics)] - -#[repr(i8)] -pub enum Enum { - VariantA, - VariantB, -} - -fn make_b() -> Enum { Enum::VariantB } - -fn main() { - assert_eq!(1, make_b() as i8); - assert_eq!(1, make_b() as u8); - assert_eq!(1, make_b() as i32); - assert_eq!(1, make_b() as u32); - assert_eq!(1, std::intrinsics::discriminant_value(&make_b())); -} diff --git a/src/test/ui/issues/issue-53787-inline-assembler-macro.rs b/src/test/ui/issues/issue-53787-inline-assembler-macro.rs deleted file mode 100644 index d9fe7cada27..00000000000 --- a/src/test/ui/issues/issue-53787-inline-assembler-macro.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Regression test for Issue #53787: Fix ICE when creating a label in inline assembler with macros. - -// build-fail -// ignore-emscripten - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -macro_rules! fake_jump { - ($id:expr) => { - unsafe { - llvm_asm!( - " - jmp $0 - lea eax, [ebx] - xor eax, 0xDEADBEEF - retn - $0: - "::"0"($id)::"volatile", "intel"); - } - }; -} - -fn main() { - fake_jump!("FirstFunc"); //~ ERROR invalid value for constraint in inline assembly - println!("Hello, world!"); -} diff --git a/src/test/ui/issues/issue-53787-inline-assembler-macro.stderr b/src/test/ui/issues/issue-53787-inline-assembler-macro.stderr deleted file mode 100644 index fd755e30d58..00000000000 --- a/src/test/ui/issues/issue-53787-inline-assembler-macro.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0669]: invalid value for constraint in inline assembly - --> $DIR/issue-53787-inline-assembler-macro.rs:25:16 - | -LL | fake_jump!("FirstFunc"); - | ^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0669`. diff --git a/src/test/ui/issues/issue-54467.rs b/src/test/ui/issues/issue-54467.rs deleted file mode 100644 index 734bf2768c2..00000000000 --- a/src/test/ui/issues/issue-54467.rs +++ /dev/null @@ -1,46 +0,0 @@ -// run-pass - -pub trait Stream { - type Item; - type Error; -} - -pub trait ParseError { - type Output; -} - -impl ParseError for u32 { - type Output = (); -} - -impl Stream for () { - type Item = char; - type Error = u32; -} - -pub struct Lex<'a, I> - where I: Stream, - I::Error: ParseError, - <::Error as ParseError>::Output: 'a -{ - x: &'a >::Output -} - -pub struct Reserved<'a, I> where - I: Stream + 'a, - I::Error: ParseError, - <::Error as ParseError>::Output: 'a - -{ - x: Lex<'a, I> -} - -fn main() { - let r: Reserved<()> = Reserved { - x: Lex { - x: &() - } - }; - - let _v = r.x.x; -} diff --git a/src/test/ui/issues/issue-56031.rs b/src/test/ui/issues/issue-56031.rs deleted file mode 100644 index b68f5681467..00000000000 --- a/src/test/ui/issues/issue-56031.rs +++ /dev/null @@ -1,6 +0,0 @@ -struct T; - -impl for T {} -//~^ ERROR missing trait in a trait impl - -fn main() {} diff --git a/src/test/ui/issues/issue-56031.stderr b/src/test/ui/issues/issue-56031.stderr deleted file mode 100644 index 7ee5bc6ec61..00000000000 --- a/src/test/ui/issues/issue-56031.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error: missing trait in a trait impl - --> $DIR/issue-56031.rs:3:5 - | -LL | impl for T {} - | ^ - | -help: add a trait here - | -LL | impl Trait for T {} - | +++++ -help: for an inherent impl, drop this `for` - | -LL - impl for T {} -LL + impl T {} - | - -error: aborting due to previous error - diff --git a/src/test/ui/issues/issue-57410-1.rs b/src/test/ui/issues/issue-57410-1.rs deleted file mode 100644 index d825cb18008..00000000000 --- a/src/test/ui/issues/issue-57410-1.rs +++ /dev/null @@ -1,18 +0,0 @@ -// check-pass - -// Originally from #53925. -// Tests that the `unreachable_pub` lint doesn't fire for `pub self::bar::Bar`. - -#![deny(unreachable_pub)] - -mod foo { - mod bar { - pub struct Bar; - } - - pub use self::bar::Bar; -} - -pub use foo::Bar; - -fn main() {} diff --git a/src/test/ui/issues/issue-57597.rs b/src/test/ui/issues/issue-57597.rs deleted file mode 100644 index ebeb3fe07ad..00000000000 --- a/src/test/ui/issues/issue-57597.rs +++ /dev/null @@ -1,80 +0,0 @@ -// Regression test for #57597. -// -// Make sure that nested matchers work correctly rather than causing an infinite loop or crash. - -// edition:2018 - -macro_rules! foo1 { - ($($($i:ident)?)+) => {}; - //~^ ERROR repetition matches empty token tree -} - -macro_rules! foo2 { - ($($($i:ident)?)*) => {}; - //~^ ERROR repetition matches empty token tree -} - -macro_rules! foo3 { - ($($($i:ident)?)?) => {}; - //~^ ERROR repetition matches empty token tree -} - -macro_rules! foo4 { - ($($($($i:ident)?)?)?) => {}; - //~^ ERROR repetition matches empty token tree -} - -macro_rules! foo5 { - ($($($($i:ident)*)?)?) => {}; - //~^ ERROR repetition matches empty token tree -} - -macro_rules! foo6 { - ($($($($i:ident)?)*)?) => {}; - //~^ ERROR repetition matches empty token tree -} - -macro_rules! foo7 { - ($($($($i:ident)?)?)*) => {}; - //~^ ERROR repetition matches empty token tree -} - -macro_rules! foo8 { - ($($($($i:ident)*)*)?) => {}; - //~^ ERROR repetition matches empty token tree -} - -macro_rules! foo9 { - ($($($($i:ident)?)*)*) => {}; - //~^ ERROR repetition matches empty token tree -} - -macro_rules! foo10 { - ($($($($i:ident)?)*)+) => {}; - //~^ ERROR repetition matches empty token tree -} - -macro_rules! foo11 { - ($($($($i:ident)+)?)*) => {}; - //~^ ERROR repetition matches empty token tree -} - -macro_rules! foo12 { - ($($($($i:ident)+)*)?) => {}; - //~^ ERROR repetition matches empty token tree -} - -fn main() { - foo1!(); - foo2!(); - foo3!(); - foo4!(); - foo5!(); - foo6!(); - foo7!(); - foo8!(); - foo9!(); - foo10!(); - foo11!(); - foo12!(); -} diff --git a/src/test/ui/issues/issue-57597.stderr b/src/test/ui/issues/issue-57597.stderr deleted file mode 100644 index 0a02ac8c499..00000000000 --- a/src/test/ui/issues/issue-57597.stderr +++ /dev/null @@ -1,74 +0,0 @@ -error: repetition matches empty token tree - --> $DIR/issue-57597.rs:8:7 - | -LL | ($($($i:ident)?)+) => {}; - | ^^^^^^^^^^^^^^ - -error: repetition matches empty token tree - --> $DIR/issue-57597.rs:13:7 - | -LL | ($($($i:ident)?)*) => {}; - | ^^^^^^^^^^^^^^ - -error: repetition matches empty token tree - --> $DIR/issue-57597.rs:18:7 - | -LL | ($($($i:ident)?)?) => {}; - | ^^^^^^^^^^^^^^ - -error: repetition matches empty token tree - --> $DIR/issue-57597.rs:23:7 - | -LL | ($($($($i:ident)?)?)?) => {}; - | ^^^^^^^^^^^^^^^^^^ - -error: repetition matches empty token tree - --> $DIR/issue-57597.rs:28:7 - | -LL | ($($($($i:ident)*)?)?) => {}; - | ^^^^^^^^^^^^^^^^^^ - -error: repetition matches empty token tree - --> $DIR/issue-57597.rs:33:7 - | -LL | ($($($($i:ident)?)*)?) => {}; - | ^^^^^^^^^^^^^^^^^^ - -error: repetition matches empty token tree - --> $DIR/issue-57597.rs:38:7 - | -LL | ($($($($i:ident)?)?)*) => {}; - | ^^^^^^^^^^^^^^^^^^ - -error: repetition matches empty token tree - --> $DIR/issue-57597.rs:43:7 - | -LL | ($($($($i:ident)*)*)?) => {}; - | ^^^^^^^^^^^^^^^^^^ - -error: repetition matches empty token tree - --> $DIR/issue-57597.rs:48:7 - | -LL | ($($($($i:ident)?)*)*) => {}; - | ^^^^^^^^^^^^^^^^^^ - -error: repetition matches empty token tree - --> $DIR/issue-57597.rs:53:7 - | -LL | ($($($($i:ident)?)*)+) => {}; - | ^^^^^^^^^^^^^^^^^^ - -error: repetition matches empty token tree - --> $DIR/issue-57597.rs:58:7 - | -LL | ($($($($i:ident)+)?)*) => {}; - | ^^^^^^^^^^^^^^^^^^ - -error: repetition matches empty token tree - --> $DIR/issue-57597.rs:63:7 - | -LL | ($($($($i:ident)+)*)?) => {}; - | ^^^^^^^^^^^^^^^^^^ - -error: aborting due to 12 previous errors - diff --git a/src/test/ui/issues/issue-58319.rs b/src/test/ui/issues/issue-58319.rs deleted file mode 100644 index 757307d944f..00000000000 --- a/src/test/ui/issues/issue-58319.rs +++ /dev/null @@ -1,621 +0,0 @@ -// run-pass -fn main() {} -#[derive(Clone)] -pub struct Little; -#[derive(Clone)] -pub struct Big( - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, - Little, -); diff --git a/src/test/ui/issues/issue-59029-1.rs b/src/test/ui/issues/issue-59029-1.rs deleted file mode 100644 index 8ab47a4af1d..00000000000 --- a/src/test/ui/issues/issue-59029-1.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![feature(trait_alias)] - -trait Svc { type Res; } - -trait MkSvc = Svc where Self::Res: Svc; -//~^ ERROR associated type `Res` not found for `Self` -//~| ERROR associated type `Res` not found for `Self` - -fn main() {} diff --git a/src/test/ui/issues/issue-59029-1.stderr b/src/test/ui/issues/issue-59029-1.stderr deleted file mode 100644 index 53cdb8b1baf..00000000000 --- a/src/test/ui/issues/issue-59029-1.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0220]: associated type `Res` not found for `Self` - --> $DIR/issue-59029-1.rs:5:52 - | -LL | trait MkSvc = Svc where Self::Res: Svc; - | ^^^ associated type `Res` not found - -error[E0220]: associated type `Res` not found for `Self` - --> $DIR/issue-59029-1.rs:5:52 - | -LL | trait MkSvc = Svc where Self::Res: Svc; - | ^^^ associated type `Res` not found - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0220`. diff --git a/src/test/ui/issues/issue-59508-1.rs b/src/test/ui/issues/issue-59508-1.rs deleted file mode 100644 index 6376c429b28..00000000000 --- a/src/test/ui/issues/issue-59508-1.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![allow(dead_code)] -#![feature(const_generics_defaults)] - -// This test checks that generic parameter re-ordering diagnostic suggestions mention that -// consts come after types and lifetimes when the `const_generics_defaults` feature is enabled. -// We cannot run rustfix on this test because of the above const generics warning. - -struct A; - -impl A { - pub fn do_things() { - //~^ ERROR lifetime parameters must be declared prior to type parameters - println!("panic"); - } -} - -fn main() {} diff --git a/src/test/ui/issues/issue-59508-1.stderr b/src/test/ui/issues/issue-59508-1.stderr deleted file mode 100644 index df244f02dce..00000000000 --- a/src/test/ui/issues/issue-59508-1.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: lifetime parameters must be declared prior to type parameters - --> $DIR/issue-59508-1.rs:11:25 - | -LL | pub fn do_things() { - | ----^^--^^----- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b: 'a, T>` - -error: aborting due to previous error - diff --git a/src/test/ui/issues/issue-59508.fixed b/src/test/ui/issues/issue-59508.fixed deleted file mode 100644 index b5c60a1626f..00000000000 --- a/src/test/ui/issues/issue-59508.fixed +++ /dev/null @@ -1,16 +0,0 @@ -// run-rustfix - -#![allow(dead_code)] - -// This test checks that generic parameter re-ordering diagnostic suggestions contain bounds. - -struct A; - -impl A { - pub fn do_things<'a, 'b: 'a, T>() { - //~^ ERROR lifetime parameters must be declared prior to type parameters - println!("panic"); - } -} - -fn main() {} diff --git a/src/test/ui/issues/issue-59508.rs b/src/test/ui/issues/issue-59508.rs deleted file mode 100644 index 0b39c5d8f2a..00000000000 --- a/src/test/ui/issues/issue-59508.rs +++ /dev/null @@ -1,16 +0,0 @@ -// run-rustfix - -#![allow(dead_code)] - -// This test checks that generic parameter re-ordering diagnostic suggestions contain bounds. - -struct A; - -impl A { - pub fn do_things() { - //~^ ERROR lifetime parameters must be declared prior to type parameters - println!("panic"); - } -} - -fn main() {} diff --git a/src/test/ui/issues/issue-59508.stderr b/src/test/ui/issues/issue-59508.stderr deleted file mode 100644 index 33e967cebff..00000000000 --- a/src/test/ui/issues/issue-59508.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: lifetime parameters must be declared prior to type parameters - --> $DIR/issue-59508.rs:10:25 - | -LL | pub fn do_things() { - | ----^^--^^----- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b: 'a, T>` - -error: aborting due to previous error - diff --git a/src/test/ui/issues/issue-60283.rs b/src/test/ui/issues/issue-60283.rs deleted file mode 100644 index c63b1544a53..00000000000 --- a/src/test/ui/issues/issue-60283.rs +++ /dev/null @@ -1,20 +0,0 @@ -pub trait Trait<'a> { - type Item; -} - -impl<'a> Trait<'a> for () { - type Item = (); -} - -pub fn foo(_: T, _: F) -where - T: for<'a> Trait<'a>, - F: for<'a> FnMut(>::Item), -{ -} - -fn main() { - foo((), drop) - //~^ ERROR type mismatch in function arguments - //~| ERROR size for values of type `<() as Trait<'_>>::Item` cannot be known at compilation time -} diff --git a/src/test/ui/issues/issue-60283.stderr b/src/test/ui/issues/issue-60283.stderr deleted file mode 100644 index 34893cd8f19..00000000000 --- a/src/test/ui/issues/issue-60283.stderr +++ /dev/null @@ -1,42 +0,0 @@ -error[E0631]: type mismatch in function arguments - --> $DIR/issue-60283.rs:17:13 - | -LL | foo((), drop) - | --- ^^^^ - | | | - | | expected signature of `for<'a> fn(<() as Trait<'a>>::Item) -> _` - | | found signature of `fn(()) -> _` - | required by a bound introduced by this call - | -note: required by a bound in `foo` - --> $DIR/issue-60283.rs:12:16 - | -LL | pub fn foo(_: T, _: F) - | --- required by a bound in this -... -LL | F: for<'a> FnMut(>::Item), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` - -error[E0277]: the size for values of type `<() as Trait<'_>>::Item` cannot be known at compilation time - --> $DIR/issue-60283.rs:17:13 - | -LL | foo((), drop) - | --- ^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call - | - = help: the trait `Sized` is not implemented for `<() as Trait<'_>>::Item` -note: required by a bound in `std::mem::drop` - --> $SRC_DIR/core/src/mem/mod.rs:LL:COL - | -LL | pub fn drop(_x: T) {} - | ^ required by this bound in `std::mem::drop` -help: consider further restricting the associated type - | -LL | fn main() where <() as Trait<'_>>::Item: Sized { - | ++++++++++++++++++++++++++++++++++++ - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0277, E0631. -For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/issues/issue-60662.rs b/src/test/ui/issues/issue-60662.rs deleted file mode 100644 index b9faa668b80..00000000000 --- a/src/test/ui/issues/issue-60662.rs +++ /dev/null @@ -1,10 +0,0 @@ -// check-pass -// compile-flags: -Z unpretty=hir - -#![feature(type_alias_impl_trait)] - -trait Animal {} - -fn main() { - pub type ServeFut = impl Animal; -} diff --git a/src/test/ui/issues/issue-60662.stdout b/src/test/ui/issues/issue-60662.stdout deleted file mode 100644 index 14a49f20e6b..00000000000 --- a/src/test/ui/issues/issue-60662.stdout +++ /dev/null @@ -1,14 +0,0 @@ -// check-pass -// compile-flags: -Z unpretty=hir - -#![feature(type_alias_impl_trait)] -#[prelude_import] -use ::std::prelude::rust_2015::*; -#[macro_use] -extern crate std; - -trait Animal { } - -fn main() { - pub type ServeFut = /*impl Trait*/; - } diff --git a/src/test/ui/issues/issue-61711-once-caused-rustc-inf-loop.rs b/src/test/ui/issues/issue-61711-once-caused-rustc-inf-loop.rs deleted file mode 100644 index de7d6a0d80c..00000000000 --- a/src/test/ui/issues/issue-61711-once-caused-rustc-inf-loop.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Issue 61711: A crate pub re-exporting `crate` was causing an -// infinite loop. - -// edition:2018 -// aux-build:xcrate-issue-61711-b.rs -// compile-flags:--extern xcrate_issue_61711_b - -// build-pass - -fn f(_: F) { } -fn main() { } diff --git a/src/test/ui/issues/issue-61882-2.rs b/src/test/ui/issues/issue-61882-2.rs deleted file mode 100644 index 1209b54bc41..00000000000 --- a/src/test/ui/issues/issue-61882-2.rs +++ /dev/null @@ -1,11 +0,0 @@ -struct A(T); - -impl A<&'static u8> { - fn f() { - let x = 0; - Self(&x); - //~^ ERROR `x` does not live long enough - } -} - -fn main() {} diff --git a/src/test/ui/issues/issue-61882-2.stderr b/src/test/ui/issues/issue-61882-2.stderr deleted file mode 100644 index 0b8e134c966..00000000000 --- a/src/test/ui/issues/issue-61882-2.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0597]: `x` does not live long enough - --> $DIR/issue-61882-2.rs:6:14 - | -LL | Self(&x); - | ^^ - | | - | borrowed value does not live long enough - | this usage requires that `x` is borrowed for `'static` -LL | -LL | } - | - `x` dropped here while still borrowed - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/issues/issue-61882.rs b/src/test/ui/issues/issue-61882.rs deleted file mode 100644 index 013398b4598..00000000000 --- a/src/test/ui/issues/issue-61882.rs +++ /dev/null @@ -1,9 +0,0 @@ -struct A(T); - -impl A { - const B: A = Self(0); - //~^ ERROR mismatched types - //~| ERROR mismatched types -} - -fn main() {} diff --git a/src/test/ui/issues/issue-61882.stderr b/src/test/ui/issues/issue-61882.stderr deleted file mode 100644 index 09ffe8e64b1..00000000000 --- a/src/test/ui/issues/issue-61882.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-61882.rs:4:27 - | -LL | const B: A = Self(0); - | ^ expected `bool`, found integer - -error[E0308]: mismatched types - --> $DIR/issue-61882.rs:4:22 - | -LL | const B: A = Self(0); - | ^^^^^^^ expected `u8`, found `bool` - | - = note: expected struct `A` - found struct `A` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/issues/issue-63364.rs b/src/test/ui/issues/issue-63364.rs deleted file mode 100644 index 5223267a69a..00000000000 --- a/src/test/ui/issues/issue-63364.rs +++ /dev/null @@ -1,10 +0,0 @@ -fn part(_: u16) -> u32 { - 1 -} - -fn main() { - for n in 100_000.. { - //~^ ERROR: literal out of range for `u16` - let _ = part(n); - } -} diff --git a/src/test/ui/issues/issue-63364.stderr b/src/test/ui/issues/issue-63364.stderr deleted file mode 100644 index 0375359aeab..00000000000 --- a/src/test/ui/issues/issue-63364.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: literal out of range for `u16` - --> $DIR/issue-63364.rs:6:14 - | -LL | for n in 100_000.. { - | ^^^^^^^ - | - = note: `#[deny(overflowing_literals)]` on by default - = note: the literal `100_000` does not fit into the type `u16` whose range is `0..=65535` - -error: aborting due to previous error - diff --git a/src/test/ui/issues/issue-6596-1.rs b/src/test/ui/issues/issue-6596-1.rs deleted file mode 100644 index 25f1d650072..00000000000 --- a/src/test/ui/issues/issue-6596-1.rs +++ /dev/null @@ -1,10 +0,0 @@ -macro_rules! e { - ($inp:ident) => ( - $nonexistent - //~^ ERROR expected expression, found `$` - ); -} - -fn main() { - e!(foo); -} diff --git a/src/test/ui/issues/issue-6596-1.stderr b/src/test/ui/issues/issue-6596-1.stderr deleted file mode 100644 index 7ab3685c5cb..00000000000 --- a/src/test/ui/issues/issue-6596-1.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: expected expression, found `$` - --> $DIR/issue-6596-1.rs:3:9 - | -LL | $nonexistent - | ^^^^^^^^^^^^ expected expression -... -LL | e!(foo); - | ------- in this macro invocation - | - = note: this error originates in the macro `e` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to previous error - diff --git a/src/test/ui/issues/issue-6804.rs b/src/test/ui/issues/issue-6804.rs deleted file mode 100644 index 0260caa82cb..00000000000 --- a/src/test/ui/issues/issue-6804.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Matching against NaN should result in a warning - -#![allow(unused)] -#![deny(illegal_floating_point_literal_pattern)] - -const NAN: f64 = f64::NAN; - -fn main() { - let x = NAN; - match x { - NAN => {}, //~ ERROR floating-point types cannot be used - //~| WARN this was previously accepted by the compiler but is being phased out - _ => {}, - }; - - match [x, 1.0] { - [NAN, _] => {}, //~ ERROR floating-point types cannot be used - //~| WARN this was previously accepted by the compiler but is being phased out - _ => {}, - }; -} diff --git a/src/test/ui/issues/issue-6804.stderr b/src/test/ui/issues/issue-6804.stderr deleted file mode 100644 index 4e2961e5e23..00000000000 --- a/src/test/ui/issues/issue-6804.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error: floating-point types cannot be used in patterns - --> $DIR/issue-6804.rs:11:9 - | -LL | NAN => {}, - | ^^^ - | -note: the lint level is defined here - --> $DIR/issue-6804.rs:4:9 - | -LL | #![deny(illegal_floating_point_literal_pattern)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #41620 - -error: floating-point types cannot be used in patterns - --> $DIR/issue-6804.rs:17:10 - | -LL | [NAN, _] => {}, - | ^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #41620 - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/issues/issue-72455.rs b/src/test/ui/issues/issue-72455.rs deleted file mode 100644 index b6c3bb22287..00000000000 --- a/src/test/ui/issues/issue-72455.rs +++ /dev/null @@ -1,27 +0,0 @@ -// check-pass - -pub trait ResultExt { - type Ok; - fn err_eprint_and_ignore(self) -> Option; -} - -impl ResultExt for std::result::Result -where - E: std::error::Error, -{ - type Ok = O; - fn err_eprint_and_ignore(self) -> Option - where - Self: , - { - match self { - Err(e) => { - eprintln!("{}", e); - None - } - Ok(o) => Some(o), - } - } -} - -fn main() {} diff --git a/src/test/ui/issues/issue-72574-2.rs b/src/test/ui/issues/issue-72574-2.rs deleted file mode 100644 index 0ad2db848b2..00000000000 --- a/src/test/ui/issues/issue-72574-2.rs +++ /dev/null @@ -1,12 +0,0 @@ -struct Binder(i32, i32, i32); - -fn main() { - let x = Binder(1, 2, 3); - match x { - Binder(_a, _x @ ..) => {} - _ => {} - } -} -//~^^^^ ERROR `_x @` is not allowed in a tuple struct -//~| ERROR: `..` patterns are not allowed here -//~| ERROR: this pattern has 2 fields, but the corresponding tuple struct has 3 fields diff --git a/src/test/ui/issues/issue-72574-2.stderr b/src/test/ui/issues/issue-72574-2.stderr deleted file mode 100644 index 05650f05cbf..00000000000 --- a/src/test/ui/issues/issue-72574-2.stderr +++ /dev/null @@ -1,37 +0,0 @@ -error: `_x @` is not allowed in a tuple struct - --> $DIR/issue-72574-2.rs:6:20 - | -LL | Binder(_a, _x @ ..) => {} - | ^^^^^^^ this is only allowed in slice patterns - | - = help: remove this and bind each tuple field independently -help: if you don't need to use the contents of _x, discard the tuple's remaining fields - | -LL | Binder(_a, ..) => {} - | ~~ - -error: `..` patterns are not allowed here - --> $DIR/issue-72574-2.rs:6:25 - | -LL | Binder(_a, _x @ ..) => {} - | ^^ - | - = note: only allowed in tuple, tuple struct, and slice patterns - -error[E0023]: this pattern has 2 fields, but the corresponding tuple struct has 3 fields - --> $DIR/issue-72574-2.rs:6:16 - | -LL | struct Binder(i32, i32, i32); - | --- --- --- tuple struct has 3 fields -... -LL | Binder(_a, _x @ ..) => {} - | ^^ ^^^^^^^ expected 3 fields, found 2 - | -help: use `_` to explicitly ignore each field - | -LL | Binder(_a, _x @ .., _) => {} - | +++ - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0023`. diff --git a/src/test/ui/issues/issue-73541-1.rs b/src/test/ui/issues/issue-73541-1.rs deleted file mode 100644 index 7fb0d6c39ff..00000000000 --- a/src/test/ui/issues/issue-73541-1.rs +++ /dev/null @@ -1,12 +0,0 @@ -// edition:2018 - -fn main() { - 'a: loop { - async { - loop { - continue 'a - //~^ ERROR use of unreachable label `'a` - } - }; - } -} diff --git a/src/test/ui/issues/issue-73541-1.stderr b/src/test/ui/issues/issue-73541-1.stderr deleted file mode 100644 index 80c1fdf002a..00000000000 --- a/src/test/ui/issues/issue-73541-1.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0767]: use of unreachable label `'a` - --> $DIR/issue-73541-1.rs:7:26 - | -LL | 'a: loop { - | -- unreachable label defined here -... -LL | continue 'a - | ^^ unreachable label `'a` - | - = note: labels are unreachable through functions, closures, async blocks and modules - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0767`. diff --git a/src/test/ui/issues/issue-73886.rs b/src/test/ui/issues/issue-73886.rs deleted file mode 100644 index 9c0c87a5cf2..00000000000 --- a/src/test/ui/issues/issue-73886.rs +++ /dev/null @@ -1,6 +0,0 @@ -fn main() { - let _ = &&[0] as &[_]; - //~^ ERROR non-primitive cast: `&&[i32; 1]` as `&[_]` - let _ = 7u32 as Option<_>; - //~^ ERROR non-primitive cast: `u32` as `Option<_>` -} diff --git a/src/test/ui/issues/issue-73886.stderr b/src/test/ui/issues/issue-73886.stderr deleted file mode 100644 index a6f8ba65ab5..00000000000 --- a/src/test/ui/issues/issue-73886.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0605]: non-primitive cast: `&&[i32; 1]` as `&[_]` - --> $DIR/issue-73886.rs:2:13 - | -LL | let _ = &&[0] as &[_]; - | ^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object - -error[E0605]: non-primitive cast: `u32` as `Option<_>` - --> $DIR/issue-73886.rs:4:13 - | -LL | let _ = 7u32 as Option<_>; - | ^^^^^^^^^^^^^^^^^ help: consider using the `From` trait instead: `Option<_>::from(7u32)` - | - = note: an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0605`. diff --git a/src/test/ui/issues/issue-74739.rs b/src/test/ui/issues/issue-74739.rs deleted file mode 100644 index 03622358ae1..00000000000 --- a/src/test/ui/issues/issue-74739.rs +++ /dev/null @@ -1,14 +0,0 @@ -// compile-flags: -O -// run-pass - -struct Foo { - x: i32, -} - -pub fn main() { - let mut foo = Foo { x: 42 }; - let x = &mut foo.x; - *x = 13; - let y = foo; - assert_eq!(y.x, 13); // used to print 42 due to mir-opt bug -} diff --git a/src/test/ui/issues/issue-811.rs b/src/test/ui/issues/issue-811.rs deleted file mode 100644 index f929d388819..00000000000 --- a/src/test/ui/issues/issue-811.rs +++ /dev/null @@ -1,26 +0,0 @@ -// run-fail -// error-pattern:quux -// ignore-emscripten no processes - -use std::marker::PhantomData; - -fn test00_start(ch: Chan, message: isize) { - send(ch, message); -} - -type TaskId = isize; -type PortId = isize; - -struct Chan { - task: TaskId, - port: PortId, - marker: PhantomData<*mut T>, -} - -fn send(_ch: Chan, _data: T) { - panic!(); -} - -fn main() { - panic!("quux"); -} diff --git a/src/test/ui/issues/issue-8351-1.rs b/src/test/ui/issues/issue-8351-1.rs deleted file mode 100644 index 139f027cb90..00000000000 --- a/src/test/ui/issues/issue-8351-1.rs +++ /dev/null @@ -1,16 +0,0 @@ -// run-pass -#![allow(dead_code)] - -enum E { - Foo{f: isize}, - Bar, -} - -pub fn main() { - let e = E::Foo{f: 0}; - match e { - E::Foo{f: 1} => panic!(), - E::Foo{..} => (), - _ => panic!(), - } -} diff --git a/src/test/ui/issues/issue-8351-2.rs b/src/test/ui/issues/issue-8351-2.rs deleted file mode 100644 index bc66cbb77c0..00000000000 --- a/src/test/ui/issues/issue-8351-2.rs +++ /dev/null @@ -1,16 +0,0 @@ -// run-pass -#![allow(dead_code)] - -enum E { - Foo{f: isize, b: bool}, - Bar, -} - -pub fn main() { - let e = E::Foo{f: 0, b: false}; - match e { - E::Foo{f: 1, b: true} => panic!(), - E::Foo{b: false, f: 0} => (), - _ => panic!(), - } -} diff --git a/src/test/ui/issues/issue-86865.rs b/src/test/ui/issues/issue-86865.rs deleted file mode 100644 index 01e0a20a511..00000000000 --- a/src/test/ui/issues/issue-86865.rs +++ /dev/null @@ -1,11 +0,0 @@ -use std::fmt::Write; - -fn main() { - println!(b"foo"); - //~^ ERROR format argument must be a string literal - //~| HELP consider removing the leading `b` - let mut s = String::new(); - write!(s, b"foo{}", "bar"); - //~^ ERROR format argument must be a string literal - //~| HELP consider removing the leading `b` -} diff --git a/src/test/ui/issues/issue-86865.stderr b/src/test/ui/issues/issue-86865.stderr deleted file mode 100644 index eed75536631..00000000000 --- a/src/test/ui/issues/issue-86865.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error: format argument must be a string literal - --> $DIR/issue-86865.rs:4:14 - | -LL | println!(b"foo"); - | -^^^^^ - | | - | help: consider removing the leading `b` - -error: format argument must be a string literal - --> $DIR/issue-86865.rs:8:15 - | -LL | write!(s, b"foo{}", "bar"); - | -^^^^^^^ - | | - | help: consider removing the leading `b` - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/issues/issue-8827.rs b/src/test/ui/issues/issue-8827.rs deleted file mode 100644 index 95be7616a4f..00000000000 --- a/src/test/ui/issues/issue-8827.rs +++ /dev/null @@ -1,53 +0,0 @@ -// run-pass -// ignore-emscripten no threads support - -use std::thread; -use std::sync::mpsc::{channel, Receiver}; - -fn periodical(n: isize) -> Receiver { - let (chan, port) = channel(); - thread::spawn(move|| { - loop { - for _ in 1..n { - match chan.send(false) { - Ok(()) => {} - Err(..) => break, - } - } - match chan.send(true) { - Ok(()) => {} - Err(..) => break - } - } - }); - return port; -} - -fn integers() -> Receiver { - let (chan, port) = channel(); - thread::spawn(move|| { - let mut i = 1; - loop { - match chan.send(i) { - Ok(()) => {} - Err(..) => break, - } - i = i + 1; - } - }); - return port; -} - -fn main() { - let ints = integers(); - let threes = periodical(3); - let fives = periodical(5); - for _ in 1..100 { - match (ints.recv().unwrap(), threes.recv().unwrap(), fives.recv().unwrap()) { - (_, true, true) => println!("FizzBuzz"), - (_, true, false) => println!("Fizz"), - (_, false, true) => println!("Buzz"), - (i, false, false) => println!("{}", i) - } - } -} diff --git a/src/test/ui/issues/issue-9396.rs b/src/test/ui/issues/issue-9396.rs deleted file mode 100644 index 3e7e9a51cdd..00000000000 --- a/src/test/ui/issues/issue-9396.rs +++ /dev/null @@ -1,23 +0,0 @@ -// run-pass -#![allow(unused_must_use)] -#![allow(deprecated)] -// ignore-emscripten no threads support - -use std::sync::mpsc::{TryRecvError, channel}; -use std::thread; - -pub fn main() { - let (tx, rx) = channel(); - let t = thread::spawn(move||{ - thread::sleep_ms(10); - tx.send(()).unwrap(); - }); - loop { - match rx.try_recv() { - Ok(()) => break, - Err(TryRecvError::Empty) => {} - Err(TryRecvError::Disconnected) => unreachable!() - } - } - t.join(); -} diff --git a/src/test/ui/lambda-var-hygiene.rs b/src/test/ui/lambda-var-hygiene.rs deleted file mode 100644 index bf06765e5dd..00000000000 --- a/src/test/ui/lambda-var-hygiene.rs +++ /dev/null @@ -1,12 +0,0 @@ -// run-pass -// shouldn't affect evaluation of $ex: -macro_rules! bad_macro { - ($ex:expr) => ({(|_x| { $ex }) (9) }) -} - -fn takes_x(_x : isize) { - assert_eq!(bad_macro!(_x),8); -} -fn main() { - takes_x(8); -} diff --git a/src/test/ui/lang-items/issue-19660.rs b/src/test/ui/lang-items/issue-19660.rs new file mode 100644 index 00000000000..400ac310b96 --- /dev/null +++ b/src/test/ui/lang-items/issue-19660.rs @@ -0,0 +1,15 @@ +// error-pattern: requires `copy` lang_item + +#![feature(lang_items, start, no_core)] +#![no_core] + +#[lang = "sized"] +trait Sized { } + +struct S; + +#[start] +fn main(_: isize, _: *const *const u8) -> isize { + let _ = S; + 0 +} diff --git a/src/test/ui/lang-items/issue-19660.stderr b/src/test/ui/lang-items/issue-19660.stderr new file mode 100644 index 00000000000..f5d903f38eb --- /dev/null +++ b/src/test/ui/lang-items/issue-19660.stderr @@ -0,0 +1,4 @@ +error: requires `copy` lang_item + +error: aborting due to previous error + diff --git a/src/test/ui/lang-items/issue-31076.rs b/src/test/ui/lang-items/issue-31076.rs new file mode 100644 index 00000000000..cdb196d4ff2 --- /dev/null +++ b/src/test/ui/lang-items/issue-31076.rs @@ -0,0 +1,17 @@ +#![feature(no_core, lang_items)] +#![no_core] + +#[lang="sized"] +trait Sized {} + +#[lang="add"] +trait Add {} + +impl Add for i32 {} + +fn main() { + let x = 5 + 6; + //~^ ERROR cannot add `i32` to `{integer}` + let y = 5i32 + 6i32; + //~^ ERROR cannot add `i32` to `i32` +} diff --git a/src/test/ui/lang-items/issue-31076.stderr b/src/test/ui/lang-items/issue-31076.stderr new file mode 100644 index 00000000000..ac0d9dc7528 --- /dev/null +++ b/src/test/ui/lang-items/issue-31076.stderr @@ -0,0 +1,19 @@ +error[E0369]: cannot add `i32` to `{integer}` + --> $DIR/issue-31076.rs:13:15 + | +LL | let x = 5 + 6; + | - ^ - i32 + | | + | {integer} + +error[E0369]: cannot add `i32` to `i32` + --> $DIR/issue-31076.rs:15:18 + | +LL | let y = 5i32 + 6i32; + | ---- ^ ---- i32 + | | + | i32 + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0369`. diff --git a/src/test/ui/lang-items/required-lang-item.rs b/src/test/ui/lang-items/required-lang-item.rs new file mode 100644 index 00000000000..3b17c5b7255 --- /dev/null +++ b/src/test/ui/lang-items/required-lang-item.rs @@ -0,0 +1,11 @@ +// build-fail + +#![feature(lang_items, no_core)] +#![no_core] + +#[lang="copy"] pub trait Copy { } +#[lang="sized"] pub trait Sized { } + +// error-pattern:requires `start` lang_item + +fn main() {} diff --git a/src/test/ui/lang-items/required-lang-item.stderr b/src/test/ui/lang-items/required-lang-item.stderr new file mode 100644 index 00000000000..83764a91ac7 --- /dev/null +++ b/src/test/ui/lang-items/required-lang-item.stderr @@ -0,0 +1,4 @@ +error: requires `start` lang_item + +error: aborting due to previous error + diff --git a/src/test/ui/legacy-const-generics-bad.rs b/src/test/ui/legacy-const-generics-bad.rs deleted file mode 100644 index 538eee337cc..00000000000 --- a/src/test/ui/legacy-const-generics-bad.rs +++ /dev/null @@ -1,16 +0,0 @@ -// aux-build:legacy-const-generics.rs - -extern crate legacy_const_generics; - -fn foo() { - let a = 1; - legacy_const_generics::foo(0, a, 2); - //~^ ERROR attempt to use a non-constant value in a constant - - legacy_const_generics::foo(0, N, 2); - - legacy_const_generics::foo(0, N + 1, 2); - //~^ ERROR generic parameters may not be used in const operations -} - -fn main() {} diff --git a/src/test/ui/legacy-const-generics-bad.stderr b/src/test/ui/legacy-const-generics-bad.stderr deleted file mode 100644 index 3c78dd6c780..00000000000 --- a/src/test/ui/legacy-const-generics-bad.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/legacy-const-generics-bad.rs:7:35 - | -LL | let a = 1; - | ----- help: consider using `const` instead of `let`: `const a` -LL | legacy_const_generics::foo(0, a, 2); - | ^ non-constant value - -error: generic parameters may not be used in const operations - --> $DIR/legacy-const-generics-bad.rs:12:35 - | -LL | legacy_const_generics::foo(0, N + 1, 2); - | ^ cannot perform const operation using `N` - | - = help: const parameters may only be used as standalone arguments, i.e. `N` - = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0435`. diff --git a/src/test/ui/legacy-const-generics.rs b/src/test/ui/legacy-const-generics.rs deleted file mode 100644 index 9abc72d98e6..00000000000 --- a/src/test/ui/legacy-const-generics.rs +++ /dev/null @@ -1,18 +0,0 @@ -// aux-build:legacy-const-generics.rs -// run-pass - -#![feature(rustc_attrs)] - -extern crate legacy_const_generics; - -#[rustc_legacy_const_generics(1)] -pub fn bar(x: usize, z: usize) -> [usize; 3] { - [x, Y, z] -} - -fn main() { - assert_eq!(legacy_const_generics::foo(0 + 0, 1 + 1, 2 + 2), [0, 2, 4]); - assert_eq!(legacy_const_generics::foo::<{1 + 1}>(0 + 0, 2 + 2), [0, 2, 4]); - // FIXME: Only works cross-crate - //assert_eq!(bar(0, 1, 2), [0, 1, 2]); -} diff --git a/src/test/ui/lifetimes/issue-26638.rs b/src/test/ui/lifetimes/issue-26638.rs new file mode 100644 index 00000000000..72fe4286a06 --- /dev/null +++ b/src/test/ui/lifetimes/issue-26638.rs @@ -0,0 +1,10 @@ +fn parse_type(iter: Box+'static>) -> &str { iter.next() } +//~^ ERROR missing lifetime specifier [E0106] + +fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } +//~^ ERROR missing lifetime specifier [E0106] + +fn parse_type_3() -> &str { unimplemented!() } +//~^ ERROR missing lifetime specifier [E0106] + +fn main() {} diff --git a/src/test/ui/lifetimes/issue-26638.stderr b/src/test/ui/lifetimes/issue-26638.stderr new file mode 100644 index 00000000000..bb7cdcbb100 --- /dev/null +++ b/src/test/ui/lifetimes/issue-26638.stderr @@ -0,0 +1,39 @@ +error[E0106]: missing lifetime specifier + --> $DIR/issue-26638.rs:1:62 + | +LL | fn parse_type(iter: Box+'static>) -> &str { iter.next() } + | ------------------------------------ ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say which one of `iter`'s 2 lifetimes it is borrowed from +help: consider introducing a named lifetime parameter + | +LL | fn parse_type<'a>(iter: Box+'static>) -> &'a str { iter.next() } + | ++++ ++ + +error[E0106]: missing lifetime specifier + --> $DIR/issue-26638.rs:4:40 + | +LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } + | ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments +help: consider using the `'static` lifetime + | +LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &'static str { iter() } + | ~~~~~~~~ + +error[E0106]: missing lifetime specifier + --> $DIR/issue-26638.rs:7:22 + | +LL | fn parse_type_3() -> &str { unimplemented!() } + | ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from +help: consider using the `'static` lifetime + | +LL | fn parse_type_3() -> &'static str { unimplemented!() } + | ~~~~~~~~ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/lint/issue-14837.rs b/src/test/ui/lint/issue-14837.rs new file mode 100644 index 00000000000..a83bc415002 --- /dev/null +++ b/src/test/ui/lint/issue-14837.rs @@ -0,0 +1,11 @@ +// check-pass +// pretty-expanded FIXME #23616 + +#[deny(dead_code)] +pub enum Foo { + Bar { + baz: isize + } +} + +fn main() { } diff --git a/src/test/ui/lint/issue-57410-1.rs b/src/test/ui/lint/issue-57410-1.rs new file mode 100644 index 00000000000..d825cb18008 --- /dev/null +++ b/src/test/ui/lint/issue-57410-1.rs @@ -0,0 +1,18 @@ +// check-pass + +// Originally from #53925. +// Tests that the `unreachable_pub` lint doesn't fire for `pub self::bar::Bar`. + +#![deny(unreachable_pub)] + +mod foo { + mod bar { + pub struct Bar; + } + + pub use self::bar::Bar; +} + +pub use foo::Bar; + +fn main() {} diff --git a/src/test/ui/lint/issue-63364.rs b/src/test/ui/lint/issue-63364.rs new file mode 100644 index 00000000000..5223267a69a --- /dev/null +++ b/src/test/ui/lint/issue-63364.rs @@ -0,0 +1,10 @@ +fn part(_: u16) -> u32 { + 1 +} + +fn main() { + for n in 100_000.. { + //~^ ERROR: literal out of range for `u16` + let _ = part(n); + } +} diff --git a/src/test/ui/lint/issue-63364.stderr b/src/test/ui/lint/issue-63364.stderr new file mode 100644 index 00000000000..0375359aeab --- /dev/null +++ b/src/test/ui/lint/issue-63364.stderr @@ -0,0 +1,11 @@ +error: literal out of range for `u16` + --> $DIR/issue-63364.rs:6:14 + | +LL | for n in 100_000.. { + | ^^^^^^^ + | + = note: `#[deny(overflowing_literals)]` on by default + = note: the literal `100_000` does not fit into the type `u16` whose range is `0..=65535` + +error: aborting due to previous error + diff --git a/src/test/ui/lint/unnecessary-extern-crate.rs b/src/test/ui/lint/unnecessary-extern-crate.rs new file mode 100644 index 00000000000..67eaaf4b6c2 --- /dev/null +++ b/src/test/ui/lint/unnecessary-extern-crate.rs @@ -0,0 +1,71 @@ +// edition:2018 + +#![deny(unused_extern_crates)] +#![feature(test, rustc_private, crate_visibility_modifier)] + +extern crate libc; +//~^ ERROR unused extern crate +//~| HELP remove +extern crate libc as x; +//~^ ERROR unused extern crate +//~| HELP remove + +extern crate proc_macro; + +#[macro_use] +extern crate test; + +pub extern crate test as y; + +pub extern crate alloc; + +pub(crate) extern crate alloc as a; + +crate extern crate alloc as b; + +mod foo { + pub(in crate::foo) extern crate alloc as c; + + pub(super) extern crate alloc as d; + + extern crate libc; + //~^ ERROR unused extern crate + //~| HELP remove + + extern crate libc as x; + //~^ ERROR unused extern crate + //~| HELP remove + + pub extern crate test; + + pub extern crate test as y; + + mod bar { + extern crate libc; + //~^ ERROR unused extern crate + //~| HELP remove + + extern crate libc as x; + //~^ ERROR unused extern crate + //~| HELP remove + + pub(in crate::foo::bar) extern crate alloc as e; + + fn dummy() { + e::string::String::new(); + } + } + + fn dummy() { + c::string::String::new(); + d::string::String::new(); + } +} + + +fn main() { + a::string::String::new(); + b::string::String::new(); + + proc_macro::TokenStream::new(); +} diff --git a/src/test/ui/lint/unnecessary-extern-crate.stderr b/src/test/ui/lint/unnecessary-extern-crate.stderr new file mode 100644 index 00000000000..14ba9d052f4 --- /dev/null +++ b/src/test/ui/lint/unnecessary-extern-crate.stderr @@ -0,0 +1,44 @@ +error: unused extern crate + --> $DIR/unnecessary-extern-crate.rs:6:1 + | +LL | extern crate libc; + | ^^^^^^^^^^^^^^^^^^ help: remove it + | +note: the lint level is defined here + --> $DIR/unnecessary-extern-crate.rs:3:9 + | +LL | #![deny(unused_extern_crates)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: unused extern crate + --> $DIR/unnecessary-extern-crate.rs:9:1 + | +LL | extern crate libc as x; + | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it + +error: unused extern crate + --> $DIR/unnecessary-extern-crate.rs:31:5 + | +LL | extern crate libc; + | ^^^^^^^^^^^^^^^^^^ help: remove it + +error: unused extern crate + --> $DIR/unnecessary-extern-crate.rs:35:5 + | +LL | extern crate libc as x; + | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it + +error: unused extern crate + --> $DIR/unnecessary-extern-crate.rs:44:9 + | +LL | extern crate libc; + | ^^^^^^^^^^^^^^^^^^ help: remove it + +error: unused extern crate + --> $DIR/unnecessary-extern-crate.rs:48:9 + | +LL | extern crate libc as x; + | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it + +error: aborting due to 6 previous errors + diff --git a/src/test/ui/lint/warn-ctypes-inhibit.rs b/src/test/ui/lint/warn-ctypes-inhibit.rs new file mode 100644 index 00000000000..15d8b09d2ec --- /dev/null +++ b/src/test/ui/lint/warn-ctypes-inhibit.rs @@ -0,0 +1,15 @@ +// run-pass + +#![allow(dead_code)] +// compile-flags:-D improper-ctypes + +// pretty-expanded FIXME #23616 +#![allow(improper_ctypes)] + +mod libc { + extern "C" { + pub fn malloc(size: isize) -> *const u8; + } +} + +pub fn main() {} diff --git a/src/test/ui/llvm-asm/issue-23458.rs b/src/test/ui/llvm-asm/issue-23458.rs new file mode 100644 index 00000000000..d640828c16d --- /dev/null +++ b/src/test/ui/llvm-asm/issue-23458.rs @@ -0,0 +1,12 @@ +#![feature(llvm_asm)] +#![allow(deprecated)] // llvm_asm! +// compile-flags: -Ccodegen-units=1 +// build-fail +// only-x86_64 + +fn main() { + unsafe { + llvm_asm!("int $3"); //~ ERROR too few operands for instruction + //~| ERROR invalid operand in inline asm + } +} diff --git a/src/test/ui/llvm-asm/issue-23458.stderr b/src/test/ui/llvm-asm/issue-23458.stderr new file mode 100644 index 00000000000..69e458f7ca0 --- /dev/null +++ b/src/test/ui/llvm-asm/issue-23458.stderr @@ -0,0 +1,20 @@ +error: invalid operand in inline asm: 'int $3' + --> $DIR/issue-23458.rs:9:9 + | +LL | llvm_asm!("int $3"); + | ^ + +error: too few operands for instruction + --> $DIR/issue-23458.rs:9:9 + | +LL | llvm_asm!("int $3"); + | ^ + | +note: instantiated into assembly here + --> :1:2 + | +LL | int + | ^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/llvm-asm/issue-37366.rs b/src/test/ui/llvm-asm/issue-37366.rs new file mode 100644 index 00000000000..acc2f3e9f5f --- /dev/null +++ b/src/test/ui/llvm-asm/issue-37366.rs @@ -0,0 +1,16 @@ +// check-pass +// ignore-emscripten + +#![feature(llvm_asm)] +#![allow(deprecated)] // llvm_asm! + +macro_rules! interrupt_handler { + () => { + unsafe fn _interrupt_handler() { + llvm_asm!("pop eax" :::: "intel"); + } + } +} +interrupt_handler!{} + +fn main() {} diff --git a/src/test/ui/llvm-asm/issue-53787-inline-assembler-macro.rs b/src/test/ui/llvm-asm/issue-53787-inline-assembler-macro.rs new file mode 100644 index 00000000000..d9fe7cada27 --- /dev/null +++ b/src/test/ui/llvm-asm/issue-53787-inline-assembler-macro.rs @@ -0,0 +1,27 @@ +// Regression test for Issue #53787: Fix ICE when creating a label in inline assembler with macros. + +// build-fail +// ignore-emscripten + +#![feature(llvm_asm)] +#![allow(deprecated)] // llvm_asm! + +macro_rules! fake_jump { + ($id:expr) => { + unsafe { + llvm_asm!( + " + jmp $0 + lea eax, [ebx] + xor eax, 0xDEADBEEF + retn + $0: + "::"0"($id)::"volatile", "intel"); + } + }; +} + +fn main() { + fake_jump!("FirstFunc"); //~ ERROR invalid value for constraint in inline assembly + println!("Hello, world!"); +} diff --git a/src/test/ui/llvm-asm/issue-53787-inline-assembler-macro.stderr b/src/test/ui/llvm-asm/issue-53787-inline-assembler-macro.stderr new file mode 100644 index 00000000000..fd755e30d58 --- /dev/null +++ b/src/test/ui/llvm-asm/issue-53787-inline-assembler-macro.stderr @@ -0,0 +1,9 @@ +error[E0669]: invalid value for constraint in inline assembly + --> $DIR/issue-53787-inline-assembler-macro.rs:25:16 + | +LL | fake_jump!("FirstFunc"); + | ^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0669`. diff --git a/src/test/ui/long-while.rs b/src/test/ui/long-while.rs deleted file mode 100644 index 529cca7b731..00000000000 --- a/src/test/ui/long-while.rs +++ /dev/null @@ -1,12 +0,0 @@ -// run-pass -// pretty-expanded FIXME #23616 - -#![allow(unused_variables)] - -pub fn main() { - let mut i: isize = 0; - while i < 1000000 { - i += 1; - let x = 3; - } -} diff --git a/src/test/ui/lto-and-no-bitcode-in-rlib.rs b/src/test/ui/lto-and-no-bitcode-in-rlib.rs deleted file mode 100644 index f381240e70a..00000000000 --- a/src/test/ui/lto-and-no-bitcode-in-rlib.rs +++ /dev/null @@ -1,3 +0,0 @@ -// compile-flags: -C lto -C embed-bitcode=no - -fn main() {} diff --git a/src/test/ui/lto-and-no-bitcode-in-rlib.stderr b/src/test/ui/lto-and-no-bitcode-in-rlib.stderr deleted file mode 100644 index 11e370e914c..00000000000 --- a/src/test/ui/lto-and-no-bitcode-in-rlib.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: options `-C embed-bitcode=no` and `-C lto` are incompatible - diff --git a/src/test/ui/lto-duplicate-symbols.rs b/src/test/ui/lto-duplicate-symbols.rs deleted file mode 100644 index 268cf261219..00000000000 --- a/src/test/ui/lto-duplicate-symbols.rs +++ /dev/null @@ -1,11 +0,0 @@ -// build-fail -// aux-build:lto-duplicate-symbols1.rs -// aux-build:lto-duplicate-symbols2.rs -// error-pattern:Linking globals named 'foo': symbol multiply defined! -// compile-flags: -C lto -// no-prefer-dynamic - -extern crate lto_duplicate_symbols1; -extern crate lto_duplicate_symbols2; - -fn main() {} diff --git a/src/test/ui/lto-duplicate-symbols.stderr b/src/test/ui/lto-duplicate-symbols.stderr deleted file mode 100644 index e4de04ef3cc..00000000000 --- a/src/test/ui/lto-duplicate-symbols.stderr +++ /dev/null @@ -1,6 +0,0 @@ -warning: Linking globals named 'foo': symbol multiply defined! - -error: failed to load bc of "lto-duplicate-symbols2.lto_duplicate_symbols2.693a75b4-cgu.0.rcgu.o": - -error: aborting due to previous error; 1 warning emitted - diff --git a/src/test/ui/lto-many-codegen-units.rs b/src/test/ui/lto-many-codegen-units.rs deleted file mode 100644 index f0f461ffec8..00000000000 --- a/src/test/ui/lto-many-codegen-units.rs +++ /dev/null @@ -1,6 +0,0 @@ -// run-pass -// compile-flags: -C lto -C codegen-units=8 -// no-prefer-dynamic - -fn main() { -} diff --git a/src/test/ui/lto-opt-level-s.rs b/src/test/ui/lto-opt-level-s.rs deleted file mode 100644 index a7d9d5024d3..00000000000 --- a/src/test/ui/lto-opt-level-s.rs +++ /dev/null @@ -1,7 +0,0 @@ -// compile-flags: -Clinker-plugin-lto -Copt-level=s -// build-pass -// no-prefer-dynamic - -#![crate_type = "rlib"] - -pub fn foo() {} diff --git a/src/test/ui/lto-opt-level-z.rs b/src/test/ui/lto-opt-level-z.rs deleted file mode 100644 index bf1f5e2b263..00000000000 --- a/src/test/ui/lto-opt-level-z.rs +++ /dev/null @@ -1,7 +0,0 @@ -// compile-flags: -Clinker-plugin-lto -Copt-level=z -// build-pass -// no-prefer-dynamic - -#![crate_type = "rlib"] - -pub fn foo() {} diff --git a/src/test/ui/lto-rustc-loads-linker-plugin.rs b/src/test/ui/lto-rustc-loads-linker-plugin.rs deleted file mode 100644 index 6ef1d4540b8..00000000000 --- a/src/test/ui/lto-rustc-loads-linker-plugin.rs +++ /dev/null @@ -1,17 +0,0 @@ -// compile-flags: -C lto -// aux-build:lto-rustc-loads-linker-plugin.rs -// run-pass -// no-prefer-dynamic - -// This test ensures that if a dependency was compiled with -// `-Clinker-plugin-lto` then we can compile with `-Clto` and still link against -// that upstream rlib. This should work because LTO implies we're not actually -// linking against upstream rlibs since we're generating the object code -// locally. This test will fail if rustc can't find bytecode in rlibs compiled -// with `-Clinker-plugin-lto`. - -extern crate lto_rustc_loads_linker_plugin; - -fn main() { - lto_rustc_loads_linker_plugin::foo(); -} diff --git a/src/test/ui/lto-still-runs-thread-dtors.rs b/src/test/ui/lto-still-runs-thread-dtors.rs deleted file mode 100644 index 1c7368b36e1..00000000000 --- a/src/test/ui/lto-still-runs-thread-dtors.rs +++ /dev/null @@ -1,34 +0,0 @@ -// run-pass -// compile-flags: -C lto -// no-prefer-dynamic -// ignore-emscripten no threads support -// revisions: mir thir -// [thir]compile-flags: -Zthir-unsafeck - -use std::thread; - -static mut HIT: usize = 0; - -thread_local!(static A: Foo = Foo); - -struct Foo; - -impl Drop for Foo { - fn drop(&mut self) { - unsafe { - HIT += 1; - } - } -} - -fn main() { - unsafe { - assert_eq!(HIT, 0); - thread::spawn(|| { - assert_eq!(HIT, 0); - A.with(|_| ()); - assert_eq!(HIT, 0); - }).join().unwrap(); - assert_eq!(HIT, 1); - } -} diff --git a/src/test/ui/lto-thin-rustc-loads-linker-plugin.rs b/src/test/ui/lto-thin-rustc-loads-linker-plugin.rs deleted file mode 100644 index 4d54ce32fb5..00000000000 --- a/src/test/ui/lto-thin-rustc-loads-linker-plugin.rs +++ /dev/null @@ -1,13 +0,0 @@ -// compile-flags: -C lto=thin -// aux-build:lto-rustc-loads-linker-plugin.rs -// run-pass -// no-prefer-dynamic - -// Same as the adjacent `lto-thin-rustc-loads-linker-plugin.rs` test, only with -// ThinLTO. - -extern crate lto_rustc_loads_linker_plugin; - -fn main() { - lto_rustc_loads_linker_plugin::foo(); -} diff --git a/src/test/ui/lto/all-crates.rs b/src/test/ui/lto/all-crates.rs new file mode 100644 index 00000000000..e910b2a9f96 --- /dev/null +++ b/src/test/ui/lto/all-crates.rs @@ -0,0 +1,8 @@ +// run-pass + +// compile-flags: -Clto=thin +// no-prefer-dynamic + +fn main() { + println!("hello!"); +} diff --git a/src/test/ui/lto/auxiliary/dylib.rs b/src/test/ui/lto/auxiliary/dylib.rs new file mode 100644 index 00000000000..e8b7f8f9f47 --- /dev/null +++ b/src/test/ui/lto/auxiliary/dylib.rs @@ -0,0 +1,6 @@ +// compile-flags: -Z thinlto -C codegen-units=8 + +#[inline] +pub fn foo(b: u8) { + b.to_string(); +} diff --git a/src/test/ui/lto/auxiliary/lto-duplicate-symbols1.rs b/src/test/ui/lto/auxiliary/lto-duplicate-symbols1.rs new file mode 100644 index 00000000000..ec6d0560357 --- /dev/null +++ b/src/test/ui/lto/auxiliary/lto-duplicate-symbols1.rs @@ -0,0 +1,6 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] + +#[no_mangle] +pub extern "C" fn foo() {} diff --git a/src/test/ui/lto/auxiliary/lto-duplicate-symbols2.rs b/src/test/ui/lto/auxiliary/lto-duplicate-symbols2.rs new file mode 100644 index 00000000000..ec6d0560357 --- /dev/null +++ b/src/test/ui/lto/auxiliary/lto-duplicate-symbols2.rs @@ -0,0 +1,6 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] + +#[no_mangle] +pub extern "C" fn foo() {} diff --git a/src/test/ui/lto/auxiliary/lto-rustc-loads-linker-plugin.rs b/src/test/ui/lto/auxiliary/lto-rustc-loads-linker-plugin.rs new file mode 100644 index 00000000000..d24375b2d0a --- /dev/null +++ b/src/test/ui/lto/auxiliary/lto-rustc-loads-linker-plugin.rs @@ -0,0 +1,6 @@ +// compile-flags: -Clinker-plugin-lto +// no-prefer-dynamic + +#![crate_type = "rlib"] + +pub fn foo() {} diff --git a/src/test/ui/lto/auxiliary/msvc-imp-present.rs b/src/test/ui/lto/auxiliary/msvc-imp-present.rs new file mode 100644 index 00000000000..933af050a6a --- /dev/null +++ b/src/test/ui/lto/auxiliary/msvc-imp-present.rs @@ -0,0 +1,11 @@ +// no-prefer-dynamic +// compile-flags: -Z thinlto -C codegen-units=8 -C prefer-dynamic + +#![crate_type = "rlib"] +#![crate_type = "dylib"] + +pub static A: u32 = 43; + +pub mod a { + pub static A: u32 = 43; +} diff --git a/src/test/ui/lto/auxiliary/thin-lto-inlines-aux.rs b/src/test/ui/lto/auxiliary/thin-lto-inlines-aux.rs new file mode 100644 index 00000000000..5fd3f1996dd --- /dev/null +++ b/src/test/ui/lto/auxiliary/thin-lto-inlines-aux.rs @@ -0,0 +1,7 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] + +pub fn bar() -> u32 { + 3 +} diff --git a/src/test/ui/lto/dylib-works.rs b/src/test/ui/lto/dylib-works.rs new file mode 100644 index 00000000000..9e0782b590e --- /dev/null +++ b/src/test/ui/lto/dylib-works.rs @@ -0,0 +1,9 @@ +// run-pass + +// aux-build:dylib.rs + +extern crate dylib; + +fn main() { + dylib::foo(1); +} diff --git a/src/test/ui/lto/lto-and-no-bitcode-in-rlib.rs b/src/test/ui/lto/lto-and-no-bitcode-in-rlib.rs new file mode 100644 index 00000000000..f381240e70a --- /dev/null +++ b/src/test/ui/lto/lto-and-no-bitcode-in-rlib.rs @@ -0,0 +1,3 @@ +// compile-flags: -C lto -C embed-bitcode=no + +fn main() {} diff --git a/src/test/ui/lto/lto-and-no-bitcode-in-rlib.stderr b/src/test/ui/lto/lto-and-no-bitcode-in-rlib.stderr new file mode 100644 index 00000000000..11e370e914c --- /dev/null +++ b/src/test/ui/lto/lto-and-no-bitcode-in-rlib.stderr @@ -0,0 +1,2 @@ +error: options `-C embed-bitcode=no` and `-C lto` are incompatible + diff --git a/src/test/ui/lto/lto-duplicate-symbols.rs b/src/test/ui/lto/lto-duplicate-symbols.rs new file mode 100644 index 00000000000..268cf261219 --- /dev/null +++ b/src/test/ui/lto/lto-duplicate-symbols.rs @@ -0,0 +1,11 @@ +// build-fail +// aux-build:lto-duplicate-symbols1.rs +// aux-build:lto-duplicate-symbols2.rs +// error-pattern:Linking globals named 'foo': symbol multiply defined! +// compile-flags: -C lto +// no-prefer-dynamic + +extern crate lto_duplicate_symbols1; +extern crate lto_duplicate_symbols2; + +fn main() {} diff --git a/src/test/ui/lto/lto-duplicate-symbols.stderr b/src/test/ui/lto/lto-duplicate-symbols.stderr new file mode 100644 index 00000000000..e4de04ef3cc --- /dev/null +++ b/src/test/ui/lto/lto-duplicate-symbols.stderr @@ -0,0 +1,6 @@ +warning: Linking globals named 'foo': symbol multiply defined! + +error: failed to load bc of "lto-duplicate-symbols2.lto_duplicate_symbols2.693a75b4-cgu.0.rcgu.o": + +error: aborting due to previous error; 1 warning emitted + diff --git a/src/test/ui/lto/lto-many-codegen-units.rs b/src/test/ui/lto/lto-many-codegen-units.rs new file mode 100644 index 00000000000..f0f461ffec8 --- /dev/null +++ b/src/test/ui/lto/lto-many-codegen-units.rs @@ -0,0 +1,6 @@ +// run-pass +// compile-flags: -C lto -C codegen-units=8 +// no-prefer-dynamic + +fn main() { +} diff --git a/src/test/ui/lto/lto-opt-level-s.rs b/src/test/ui/lto/lto-opt-level-s.rs new file mode 100644 index 00000000000..a7d9d5024d3 --- /dev/null +++ b/src/test/ui/lto/lto-opt-level-s.rs @@ -0,0 +1,7 @@ +// compile-flags: -Clinker-plugin-lto -Copt-level=s +// build-pass +// no-prefer-dynamic + +#![crate_type = "rlib"] + +pub fn foo() {} diff --git a/src/test/ui/lto/lto-opt-level-z.rs b/src/test/ui/lto/lto-opt-level-z.rs new file mode 100644 index 00000000000..bf1f5e2b263 --- /dev/null +++ b/src/test/ui/lto/lto-opt-level-z.rs @@ -0,0 +1,7 @@ +// compile-flags: -Clinker-plugin-lto -Copt-level=z +// build-pass +// no-prefer-dynamic + +#![crate_type = "rlib"] + +pub fn foo() {} diff --git a/src/test/ui/lto/lto-rustc-loads-linker-plugin.rs b/src/test/ui/lto/lto-rustc-loads-linker-plugin.rs new file mode 100644 index 00000000000..6ef1d4540b8 --- /dev/null +++ b/src/test/ui/lto/lto-rustc-loads-linker-plugin.rs @@ -0,0 +1,17 @@ +// compile-flags: -C lto +// aux-build:lto-rustc-loads-linker-plugin.rs +// run-pass +// no-prefer-dynamic + +// This test ensures that if a dependency was compiled with +// `-Clinker-plugin-lto` then we can compile with `-Clto` and still link against +// that upstream rlib. This should work because LTO implies we're not actually +// linking against upstream rlibs since we're generating the object code +// locally. This test will fail if rustc can't find bytecode in rlibs compiled +// with `-Clinker-plugin-lto`. + +extern crate lto_rustc_loads_linker_plugin; + +fn main() { + lto_rustc_loads_linker_plugin::foo(); +} diff --git a/src/test/ui/lto/lto-still-runs-thread-dtors.rs b/src/test/ui/lto/lto-still-runs-thread-dtors.rs new file mode 100644 index 00000000000..1c7368b36e1 --- /dev/null +++ b/src/test/ui/lto/lto-still-runs-thread-dtors.rs @@ -0,0 +1,34 @@ +// run-pass +// compile-flags: -C lto +// no-prefer-dynamic +// ignore-emscripten no threads support +// revisions: mir thir +// [thir]compile-flags: -Zthir-unsafeck + +use std::thread; + +static mut HIT: usize = 0; + +thread_local!(static A: Foo = Foo); + +struct Foo; + +impl Drop for Foo { + fn drop(&mut self) { + unsafe { + HIT += 1; + } + } +} + +fn main() { + unsafe { + assert_eq!(HIT, 0); + thread::spawn(|| { + assert_eq!(HIT, 0); + A.with(|_| ()); + assert_eq!(HIT, 0); + }).join().unwrap(); + assert_eq!(HIT, 1); + } +} diff --git a/src/test/ui/lto/lto-thin-rustc-loads-linker-plugin.rs b/src/test/ui/lto/lto-thin-rustc-loads-linker-plugin.rs new file mode 100644 index 00000000000..4d54ce32fb5 --- /dev/null +++ b/src/test/ui/lto/lto-thin-rustc-loads-linker-plugin.rs @@ -0,0 +1,13 @@ +// compile-flags: -C lto=thin +// aux-build:lto-rustc-loads-linker-plugin.rs +// run-pass +// no-prefer-dynamic + +// Same as the adjacent `lto-thin-rustc-loads-linker-plugin.rs` test, only with +// ThinLTO. + +extern crate lto_rustc_loads_linker_plugin; + +fn main() { + lto_rustc_loads_linker_plugin::foo(); +} diff --git a/src/test/ui/lto/msvc-imp-present.rs b/src/test/ui/lto/msvc-imp-present.rs new file mode 100644 index 00000000000..5498afb2937 --- /dev/null +++ b/src/test/ui/lto/msvc-imp-present.rs @@ -0,0 +1,22 @@ +// run-pass + +// aux-build:msvc-imp-present.rs +// compile-flags: -Z thinlto -C codegen-units=8 +// no-prefer-dynamic + +// On MSVC we have a "hack" where we emit symbols that look like `_imp_$name` +// for all exported statics. This is done because we apply `dllimport` to all +// imported constants and this allows everything to actually link correctly. +// +// The ThinLTO passes aggressively remove symbols if they can, and this test +// asserts that the ThinLTO passes don't remove these compiler-generated +// `_imp_*` symbols. The external library that we link in here is compiled with +// ThinLTO and multiple codegen units and has a few exported constants. Note +// that we also namely compile the library as both a dylib and an rlib, but we +// link the rlib to ensure that we assert those generated symbols exist. + +extern crate msvc_imp_present as bar; + +fn main() { + println!("{}", bar::A); +} diff --git a/src/test/ui/lto/thin-lto-global-allocator.rs b/src/test/ui/lto/thin-lto-global-allocator.rs new file mode 100644 index 00000000000..e00c5caf97c --- /dev/null +++ b/src/test/ui/lto/thin-lto-global-allocator.rs @@ -0,0 +1,7 @@ +// run-pass +// compile-flags: -Z thinlto -C codegen-units=2 + +#[global_allocator] +static A: std::alloc::System = std::alloc::System; + +fn main() {} diff --git a/src/test/ui/lto/thin-lto-inlines.rs b/src/test/ui/lto/thin-lto-inlines.rs new file mode 100644 index 00000000000..dca7918077e --- /dev/null +++ b/src/test/ui/lto/thin-lto-inlines.rs @@ -0,0 +1,30 @@ +// run-pass + +// compile-flags: -Z thinlto -C codegen-units=8 -O +// ignore-emscripten can't inspect instructions on emscripten + +// We want to assert here that ThinLTO will inline across codegen units. There's +// not really a great way to do that in general so we sort of hack around it by +// praying two functions go into separate codegen units and then assuming that +// if inlining *doesn't* happen the first byte of the functions will differ. + +pub fn foo() -> u32 { + bar::bar() +} + +mod bar { + pub fn bar() -> u32 { + 3 + } +} + +fn main() { + println!("{} {}", foo(), bar::bar()); + + unsafe { + let foo = foo as usize as *const u8; + let bar = bar::bar as usize as *const u8; + + assert_eq!(*foo, *bar); + } +} diff --git a/src/test/ui/lto/thin-lto-inlines2.rs b/src/test/ui/lto/thin-lto-inlines2.rs new file mode 100644 index 00000000000..1eb29657c70 --- /dev/null +++ b/src/test/ui/lto/thin-lto-inlines2.rs @@ -0,0 +1,28 @@ +// run-pass + +// compile-flags: -C codegen-units=8 -O -C lto=thin +// aux-build:thin-lto-inlines-aux.rs +// no-prefer-dynamic +// ignore-emscripten can't inspect instructions on emscripten + +// We want to assert here that ThinLTO will inline across codegen units. There's +// not really a great way to do that in general so we sort of hack around it by +// praying two functions go into separate codegen units and then assuming that +// if inlining *doesn't* happen the first byte of the functions will differ. + +extern crate thin_lto_inlines_aux as bar; + +pub fn foo() -> u32 { + bar::bar() +} + +fn main() { + println!("{} {}", foo(), bar::bar()); + + unsafe { + let foo = foo as usize as *const u8; + let bar = bar::bar as usize as *const u8; + + assert_eq!(*foo, *bar); + } +} diff --git a/src/test/ui/lto/weak-works.rs b/src/test/ui/lto/weak-works.rs new file mode 100644 index 00000000000..163a3870248 --- /dev/null +++ b/src/test/ui/lto/weak-works.rs @@ -0,0 +1,28 @@ +// run-pass + +// compile-flags: -C codegen-units=8 -Z thinlto +// ignore-windows + +#![feature(linkage)] + +pub mod foo { + #[linkage = "weak"] + #[no_mangle] + pub extern "C" fn FOO() -> i32 { + 0 + } +} + +mod bar { + extern "C" { + fn FOO() -> i32; + } + + pub fn bar() -> i32 { + unsafe { FOO() } + } +} + +fn main() { + bar::bar(); +} diff --git a/src/test/ui/lub-glb-with-unbound-infer-var.rs b/src/test/ui/lub-glb-with-unbound-infer-var.rs deleted file mode 100644 index c9e117089f5..00000000000 --- a/src/test/ui/lub-glb-with-unbound-infer-var.rs +++ /dev/null @@ -1,15 +0,0 @@ -// run-pass -// Test for a specific corner case: when we compute the LUB of two fn -// types and their parameters have unbound variables. In that case, we -// wind up relating those two variables. This was causing an ICE in an -// in-progress PR. - -fn main() { - let a_f: fn(_) = |_| (); - let b_f: fn(_) = |_| (); - let c_f = match 22 { - 0 => a_f, - _ => b_f, - }; - c_f(4); -} diff --git a/src/test/ui/macros/auxiliary/issue-19163.rs b/src/test/ui/macros/auxiliary/issue-19163.rs new file mode 100644 index 00000000000..0c0d9e43c1d --- /dev/null +++ b/src/test/ui/macros/auxiliary/issue-19163.rs @@ -0,0 +1,6 @@ +#![crate_type = "lib"] + +#[macro_export] +macro_rules! mywrite { + ($dst:expr, $($arg:tt)*) => ($dst.write_fmt(format_args!($($arg)*))) +} diff --git a/src/test/ui/macros/issue-16098.rs b/src/test/ui/macros/issue-16098.rs new file mode 100644 index 00000000000..00acc20fc9e --- /dev/null +++ b/src/test/ui/macros/issue-16098.rs @@ -0,0 +1,16 @@ +macro_rules! prob1 { + (0) => { + 0 + }; + ($n:expr) => { + if ($n % 3 == 0) || ($n % 5 == 0) { + $n + prob1!($n - 1); //~ ERROR recursion limit reached while expanding `prob1!` + } else { + prob1!($n - 1); + } + }; +} + +fn main() { + println!("Problem 1: {}", prob1!(1000)); +} diff --git a/src/test/ui/macros/issue-16098.stderr b/src/test/ui/macros/issue-16098.stderr new file mode 100644 index 00000000000..64280219d75 --- /dev/null +++ b/src/test/ui/macros/issue-16098.stderr @@ -0,0 +1,14 @@ +error: recursion limit reached while expanding `prob1!` + --> $DIR/issue-16098.rs:7:18 + | +LL | $n + prob1!($n - 1); + | ^^^^^^^^^^^^^^ +... +LL | println!("Problem 1: {}", prob1!(1000)); + | ------------ in this macro invocation + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_16098`) + = note: this error originates in the macro `prob1` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + diff --git a/src/test/ui/macros/issue-19163.rs b/src/test/ui/macros/issue-19163.rs new file mode 100644 index 00000000000..d98c5912af2 --- /dev/null +++ b/src/test/ui/macros/issue-19163.rs @@ -0,0 +1,11 @@ +// aux-build:issue-19163.rs + +#[macro_use] extern crate issue_19163; + +use std::io::Write; + +fn main() { + let mut v = vec![]; + mywrite!(&v, "Hello world"); + //~^ ERROR cannot borrow data in a `&` reference as mutable +} diff --git a/src/test/ui/macros/issue-19163.stderr b/src/test/ui/macros/issue-19163.stderr new file mode 100644 index 00000000000..ae1ae14266f --- /dev/null +++ b/src/test/ui/macros/issue-19163.stderr @@ -0,0 +1,11 @@ +error[E0596]: cannot borrow data in a `&` reference as mutable + --> $DIR/issue-19163.rs:9:5 + | +LL | mywrite!(&v, "Hello world"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable + | + = note: this error originates in the macro `mywrite` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0596`. diff --git a/src/test/ui/macros/issue-21356.rs b/src/test/ui/macros/issue-21356.rs new file mode 100644 index 00000000000..ae623929d63 --- /dev/null +++ b/src/test/ui/macros/issue-21356.rs @@ -0,0 +1,6 @@ +#![allow(unused_macros)] + +macro_rules! test { ($wrong:t_ty ..) => () } + //~^ ERROR: invalid fragment specifier `t_ty` + +fn main() {} diff --git a/src/test/ui/macros/issue-21356.stderr b/src/test/ui/macros/issue-21356.stderr new file mode 100644 index 00000000000..17014c6ceee --- /dev/null +++ b/src/test/ui/macros/issue-21356.stderr @@ -0,0 +1,10 @@ +error: invalid fragment specifier `t_ty` + --> $DIR/issue-21356.rs:3:22 + | +LL | macro_rules! test { ($wrong:t_ty ..) => () } + | ^^^^^^^^^^^ + | + = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis` + +error: aborting due to previous error + diff --git a/src/test/ui/macros/issue-22463.rs b/src/test/ui/macros/issue-22463.rs new file mode 100644 index 00000000000..fdf5a2fca72 --- /dev/null +++ b/src/test/ui/macros/issue-22463.rs @@ -0,0 +1,20 @@ +// run-pass +macro_rules! items { + () => { + type A = (); + fn a() {} + } +} + +trait Foo { + type A; + fn a(); +} + +impl Foo for () { + items!(); +} + +fn main() { + +} diff --git a/src/test/ui/macros/issue-29084.rs b/src/test/ui/macros/issue-29084.rs new file mode 100644 index 00000000000..d1625268669 --- /dev/null +++ b/src/test/ui/macros/issue-29084.rs @@ -0,0 +1,13 @@ +macro_rules! foo { + ($d:expr) => {{ + fn bar(d: u8) { } + bar(&mut $d); + //~^ ERROR mismatched types + //~| expected `u8`, found `&mut u8` + }} +} + +fn main() { + foo!(0u8); + //~^ in this expansion of foo! +} diff --git a/src/test/ui/macros/issue-29084.stderr b/src/test/ui/macros/issue-29084.stderr new file mode 100644 index 00000000000..a973e23e29e --- /dev/null +++ b/src/test/ui/macros/issue-29084.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/issue-29084.rs:4:13 + | +LL | bar(&mut $d); + | ^^^^^^^ expected `u8`, found `&mut u8` +... +LL | foo!(0u8); + | --------- in this macro invocation + | + = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/macros/issue-34171.rs b/src/test/ui/macros/issue-34171.rs new file mode 100644 index 00000000000..157c58c459d --- /dev/null +++ b/src/test/ui/macros/issue-34171.rs @@ -0,0 +1,10 @@ +// check-pass + +macro_rules! null { ($i:tt) => {} } +macro_rules! apply_null { + ($i:item) => { null! { $i } } +} + +fn main() { + apply_null!(#[cfg(all())] fn f() {}); +} diff --git a/src/test/ui/macros/issue-37175.rs b/src/test/ui/macros/issue-37175.rs new file mode 100644 index 00000000000..9ec9d48d18b --- /dev/null +++ b/src/test/ui/macros/issue-37175.rs @@ -0,0 +1,5 @@ +// run-pass +macro_rules! m { (<$t:ty>) => { stringify!($t) } } +fn main() { + println!("{}", m!(>)); +} diff --git a/src/test/ui/macros/issue-39388.rs b/src/test/ui/macros/issue-39388.rs new file mode 100644 index 00000000000..a8e31a648c9 --- /dev/null +++ b/src/test/ui/macros/issue-39388.rs @@ -0,0 +1,9 @@ +#![allow(unused_macros)] + +macro_rules! assign { + (($($a:tt)*) = ($($b:tt))*) => { //~ ERROR expected one of: `*`, `+`, or `?` + $($a)* = $($b)* + } +} + +fn main() {} diff --git a/src/test/ui/macros/issue-39388.stderr b/src/test/ui/macros/issue-39388.stderr new file mode 100644 index 00000000000..62e7dff5476 --- /dev/null +++ b/src/test/ui/macros/issue-39388.stderr @@ -0,0 +1,8 @@ +error: expected one of: `*`, `+`, or `?` + --> $DIR/issue-39388.rs:4:22 + | +LL | (($($a:tt)*) = ($($b:tt))*) => { + | ^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/macros/issue-40770.rs b/src/test/ui/macros/issue-40770.rs new file mode 100644 index 00000000000..c9713c15798 --- /dev/null +++ b/src/test/ui/macros/issue-40770.rs @@ -0,0 +1,11 @@ +// run-pass +#![allow(unused_macros)] +macro_rules! m { + ($e:expr) => { + macro_rules! n { () => { $e } } + } +} + +fn main() { + m!(foo!()); +} diff --git a/src/test/ui/macros/issue-57597.rs b/src/test/ui/macros/issue-57597.rs new file mode 100644 index 00000000000..ebeb3fe07ad --- /dev/null +++ b/src/test/ui/macros/issue-57597.rs @@ -0,0 +1,80 @@ +// Regression test for #57597. +// +// Make sure that nested matchers work correctly rather than causing an infinite loop or crash. + +// edition:2018 + +macro_rules! foo1 { + ($($($i:ident)?)+) => {}; + //~^ ERROR repetition matches empty token tree +} + +macro_rules! foo2 { + ($($($i:ident)?)*) => {}; + //~^ ERROR repetition matches empty token tree +} + +macro_rules! foo3 { + ($($($i:ident)?)?) => {}; + //~^ ERROR repetition matches empty token tree +} + +macro_rules! foo4 { + ($($($($i:ident)?)?)?) => {}; + //~^ ERROR repetition matches empty token tree +} + +macro_rules! foo5 { + ($($($($i:ident)*)?)?) => {}; + //~^ ERROR repetition matches empty token tree +} + +macro_rules! foo6 { + ($($($($i:ident)?)*)?) => {}; + //~^ ERROR repetition matches empty token tree +} + +macro_rules! foo7 { + ($($($($i:ident)?)?)*) => {}; + //~^ ERROR repetition matches empty token tree +} + +macro_rules! foo8 { + ($($($($i:ident)*)*)?) => {}; + //~^ ERROR repetition matches empty token tree +} + +macro_rules! foo9 { + ($($($($i:ident)?)*)*) => {}; + //~^ ERROR repetition matches empty token tree +} + +macro_rules! foo10 { + ($($($($i:ident)?)*)+) => {}; + //~^ ERROR repetition matches empty token tree +} + +macro_rules! foo11 { + ($($($($i:ident)+)?)*) => {}; + //~^ ERROR repetition matches empty token tree +} + +macro_rules! foo12 { + ($($($($i:ident)+)*)?) => {}; + //~^ ERROR repetition matches empty token tree +} + +fn main() { + foo1!(); + foo2!(); + foo3!(); + foo4!(); + foo5!(); + foo6!(); + foo7!(); + foo8!(); + foo9!(); + foo10!(); + foo11!(); + foo12!(); +} diff --git a/src/test/ui/macros/issue-57597.stderr b/src/test/ui/macros/issue-57597.stderr new file mode 100644 index 00000000000..0a02ac8c499 --- /dev/null +++ b/src/test/ui/macros/issue-57597.stderr @@ -0,0 +1,74 @@ +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:8:7 + | +LL | ($($($i:ident)?)+) => {}; + | ^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:13:7 + | +LL | ($($($i:ident)?)*) => {}; + | ^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:18:7 + | +LL | ($($($i:ident)?)?) => {}; + | ^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:23:7 + | +LL | ($($($($i:ident)?)?)?) => {}; + | ^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:28:7 + | +LL | ($($($($i:ident)*)?)?) => {}; + | ^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:33:7 + | +LL | ($($($($i:ident)?)*)?) => {}; + | ^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:38:7 + | +LL | ($($($($i:ident)?)?)*) => {}; + | ^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:43:7 + | +LL | ($($($($i:ident)*)*)?) => {}; + | ^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:48:7 + | +LL | ($($($($i:ident)?)*)*) => {}; + | ^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:53:7 + | +LL | ($($($($i:ident)?)*)+) => {}; + | ^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:58:7 + | +LL | ($($($($i:ident)+)?)*) => {}; + | ^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:63:7 + | +LL | ($($($($i:ident)+)*)?) => {}; + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to 12 previous errors + diff --git a/src/test/ui/macros/issue-6596-1.rs b/src/test/ui/macros/issue-6596-1.rs new file mode 100644 index 00000000000..25f1d650072 --- /dev/null +++ b/src/test/ui/macros/issue-6596-1.rs @@ -0,0 +1,10 @@ +macro_rules! e { + ($inp:ident) => ( + $nonexistent + //~^ ERROR expected expression, found `$` + ); +} + +fn main() { + e!(foo); +} diff --git a/src/test/ui/macros/issue-6596-1.stderr b/src/test/ui/macros/issue-6596-1.stderr new file mode 100644 index 00000000000..7ab3685c5cb --- /dev/null +++ b/src/test/ui/macros/issue-6596-1.stderr @@ -0,0 +1,13 @@ +error: expected expression, found `$` + --> $DIR/issue-6596-1.rs:3:9 + | +LL | $nonexistent + | ^^^^^^^^^^^^ expected expression +... +LL | e!(foo); + | ------- in this macro invocation + | + = note: this error originates in the macro `e` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + diff --git a/src/test/ui/macros/issue-86865.rs b/src/test/ui/macros/issue-86865.rs new file mode 100644 index 00000000000..01e0a20a511 --- /dev/null +++ b/src/test/ui/macros/issue-86865.rs @@ -0,0 +1,11 @@ +use std::fmt::Write; + +fn main() { + println!(b"foo"); + //~^ ERROR format argument must be a string literal + //~| HELP consider removing the leading `b` + let mut s = String::new(); + write!(s, b"foo{}", "bar"); + //~^ ERROR format argument must be a string literal + //~| HELP consider removing the leading `b` +} diff --git a/src/test/ui/macros/issue-86865.stderr b/src/test/ui/macros/issue-86865.stderr new file mode 100644 index 00000000000..eed75536631 --- /dev/null +++ b/src/test/ui/macros/issue-86865.stderr @@ -0,0 +1,18 @@ +error: format argument must be a string literal + --> $DIR/issue-86865.rs:4:14 + | +LL | println!(b"foo"); + | -^^^^^ + | | + | help: consider removing the leading `b` + +error: format argument must be a string literal + --> $DIR/issue-86865.rs:8:15 + | +LL | write!(s, b"foo{}", "bar"); + | -^^^^^^^ + | | + | help: consider removing the leading `b` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/macros/trace_macros-format.rs b/src/test/ui/macros/trace_macros-format.rs new file mode 100644 index 00000000000..afca45ca0f2 --- /dev/null +++ b/src/test/ui/macros/trace_macros-format.rs @@ -0,0 +1,18 @@ +#![feature(trace_macros)] + +fn main() { + trace_macros!(); //~ ERROR trace_macros! accepts only `true` or `false` + trace_macros!(1); //~ ERROR trace_macros! accepts only `true` or `false` + trace_macros!(ident); //~ ERROR trace_macros! accepts only `true` or `false` + trace_macros!(for); //~ ERROR trace_macros! accepts only `true` or `false` + trace_macros!(true,); //~ ERROR trace_macros! accepts only `true` or `false` + trace_macros!(false 1); //~ ERROR trace_macros! accepts only `true` or `false` + + + // should be fine: + macro_rules! expando { + ($x: ident) => { trace_macros!($x) } + } + + expando!(true); +} diff --git a/src/test/ui/macros/trace_macros-format.stderr b/src/test/ui/macros/trace_macros-format.stderr new file mode 100644 index 00000000000..c32027086aa --- /dev/null +++ b/src/test/ui/macros/trace_macros-format.stderr @@ -0,0 +1,38 @@ +error: trace_macros! accepts only `true` or `false` + --> $DIR/trace_macros-format.rs:4:5 + | +LL | trace_macros!(); + | ^^^^^^^^^^^^^^^ + +error: trace_macros! accepts only `true` or `false` + --> $DIR/trace_macros-format.rs:5:5 + | +LL | trace_macros!(1); + | ^^^^^^^^^^^^^^^^ + +error: trace_macros! accepts only `true` or `false` + --> $DIR/trace_macros-format.rs:6:5 + | +LL | trace_macros!(ident); + | ^^^^^^^^^^^^^^^^^^^^ + +error: trace_macros! accepts only `true` or `false` + --> $DIR/trace_macros-format.rs:7:5 + | +LL | trace_macros!(for); + | ^^^^^^^^^^^^^^^^^^ + +error: trace_macros! accepts only `true` or `false` + --> $DIR/trace_macros-format.rs:8:5 + | +LL | trace_macros!(true,); + | ^^^^^^^^^^^^^^^^^^^^ + +error: trace_macros! accepts only `true` or `false` + --> $DIR/trace_macros-format.rs:9:5 + | +LL | trace_macros!(false 1); + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 6 previous errors + diff --git a/src/test/ui/marker_trait_attr/overlap-doesnt-conflict-with-specialization.rs b/src/test/ui/marker_trait_attr/overlap-doesnt-conflict-with-specialization.rs new file mode 100644 index 00000000000..1e413120a37 --- /dev/null +++ b/src/test/ui/marker_trait_attr/overlap-doesnt-conflict-with-specialization.rs @@ -0,0 +1,20 @@ +// run-pass + +#![feature(marker_trait_attr)] +#![feature(specialization)] //~ WARN the feature `specialization` is incomplete + +#[marker] +trait MyMarker {} + +impl MyMarker for T {} +impl MyMarker for Vec {} + +fn foo(t: T) -> T { + t +} + +fn main() { + assert_eq!(1, foo(1)); + assert_eq!(2.0, foo(2.0)); + assert_eq!(vec![1], foo(vec![1])); +} diff --git a/src/test/ui/marker_trait_attr/overlap-doesnt-conflict-with-specialization.stderr b/src/test/ui/marker_trait_attr/overlap-doesnt-conflict-with-specialization.stderr new file mode 100644 index 00000000000..fca98662708 --- /dev/null +++ b/src/test/ui/marker_trait_attr/overlap-doesnt-conflict-with-specialization.stderr @@ -0,0 +1,12 @@ +warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/overlap-doesnt-conflict-with-specialization.rs:4:12 + | +LL | #![feature(specialization)] + | ^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + = note: see issue #31844 for more information + = help: consider using `min_specialization` instead, which is more stable and complete + +warning: 1 warning emitted + diff --git a/src/test/ui/marker_trait_attr/overlap-permitted-for-annotated-marker-traits.rs b/src/test/ui/marker_trait_attr/overlap-permitted-for-annotated-marker-traits.rs new file mode 100644 index 00000000000..38331390237 --- /dev/null +++ b/src/test/ui/marker_trait_attr/overlap-permitted-for-annotated-marker-traits.rs @@ -0,0 +1,26 @@ +// run-pass +// Tests for RFC 1268: we allow overlapping impls of marker traits, +// that is, traits with #[marker]. In this case, a type `T` is +// `MyMarker` if it is either `Debug` or `Display`. + +#![feature(marker_trait_attr)] + +use std::fmt::{Debug, Display}; + +#[marker] trait MyMarker {} + +impl MyMarker for T {} +impl MyMarker for T {} + +fn foo(t: T) -> T { + t +} + +fn main() { + // Debug && Display: + assert_eq!(1, foo(1)); + assert_eq!(2.0, foo(2.0)); + + // Debug && !Display: + assert_eq!(vec![1], foo(vec![1])); +} diff --git a/src/test/ui/match/issue-11940.rs b/src/test/ui/match/issue-11940.rs new file mode 100644 index 00000000000..6815c87edd8 --- /dev/null +++ b/src/test/ui/match/issue-11940.rs @@ -0,0 +1,11 @@ +// run-pass + +const TEST_STR: &'static str = "abcd"; + +fn main() { + let s = "abcd"; + match s { + TEST_STR => (), + _ => unreachable!() + } +} diff --git a/src/test/ui/match/issue-18060.rs b/src/test/ui/match/issue-18060.rs new file mode 100644 index 00000000000..b5f3d0f74bc --- /dev/null +++ b/src/test/ui/match/issue-18060.rs @@ -0,0 +1,8 @@ +// run-pass +// Regression test for #18060: match arms were matching in the wrong order. + +fn main() { + assert_eq!(2, match (1, 3) { (0, 2..=5) => 1, (1, 3) => 2, (_, 2..=5) => 3, (_, _) => 4 }); + assert_eq!(2, match (1, 3) { (1, 3) => 2, (_, 2..=5) => 3, (_, _) => 4 }); + assert_eq!(2, match (1, 7) { (0, 2..=5) => 1, (1, 7) => 2, (_, 2..=5) => 3, (_, _) => 4 }); +} diff --git a/src/test/ui/match/issue-26251.rs b/src/test/ui/match/issue-26251.rs new file mode 100644 index 00000000000..a3e26a41232 --- /dev/null +++ b/src/test/ui/match/issue-26251.rs @@ -0,0 +1,15 @@ +// run-pass +#![allow(overlapping_range_endpoints)] + +fn main() { + let x = 'a'; + + let y = match x { + 'a'..='b' if false => "one", + 'a' => "two", + 'a'..='b' => "three", + _ => panic!("what?"), + }; + + assert_eq!(y, "two"); +} diff --git a/src/test/ui/match/issue-26996.rs b/src/test/ui/match/issue-26996.rs new file mode 100644 index 00000000000..84037b72a27 --- /dev/null +++ b/src/test/ui/match/issue-26996.rs @@ -0,0 +1,24 @@ +// run-pass + +// This test is bogus (i.e., should be check-fail) during the period +// where #54986 is implemented and #54987 is *not* implemented. For +// now: just ignore it +// +// ignore-test + +// This test is checking that the write to `c.0` (which has been moved out of) +// won't overwrite the state in `c2`. +// +// That's a fine thing to test when this code is accepted by the +// compiler, and this code is being transcribed accordingly into +// the ui test issue-21232-partial-init-and-use.rs + +fn main() { + let mut c = (1, "".to_owned()); + match c { + c2 => { + c.0 = 2; + assert_eq!(c2.0, 1); + } + } +} diff --git a/src/test/ui/match/issue-42679.rs b/src/test/ui/match/issue-42679.rs new file mode 100644 index 00000000000..596309f2568 --- /dev/null +++ b/src/test/ui/match/issue-42679.rs @@ -0,0 +1,22 @@ +// run-pass +#![feature(box_syntax)] +#![feature(box_patterns)] + +#[derive(Debug, PartialEq)] +enum Test { + Foo(usize), + Bar(isize), +} + +fn main() { + let a = box Test::Foo(10); + let b = box Test::Bar(-20); + match (a, b) { + (_, box Test::Foo(_)) => unreachable!(), + (box Test::Foo(x), b) => { + assert_eq!(x, 10); + assert_eq!(b, box Test::Bar(-20)); + }, + _ => unreachable!(), + } +} diff --git a/src/test/ui/mir/issue-74739.rs b/src/test/ui/mir/issue-74739.rs new file mode 100644 index 00000000000..03622358ae1 --- /dev/null +++ b/src/test/ui/mir/issue-74739.rs @@ -0,0 +1,14 @@ +// compile-flags: -O +// run-pass + +struct Foo { + x: i32, +} + +pub fn main() { + let mut foo = Foo { x: 42 }; + let x = &mut foo.x; + *x = 13; + let y = foo; + assert_eq!(y.x, 13); // used to print 42 due to mir-opt bug +} diff --git a/src/test/ui/mut-vstore-expr.rs b/src/test/ui/mut-vstore-expr.rs deleted file mode 100644 index 75b309a4839..00000000000 --- a/src/test/ui/mut-vstore-expr.rs +++ /dev/null @@ -1,6 +0,0 @@ -// run-pass -// pretty-expanded FIXME #23616 - -pub fn main() { - let _x: &mut [isize] = &mut [ 1, 2, 3 ]; -} diff --git a/src/test/ui/negative.rs b/src/test/ui/negative.rs deleted file mode 100644 index 9601e9118aa..00000000000 --- a/src/test/ui/negative.rs +++ /dev/null @@ -1,8 +0,0 @@ -// run-pass - -pub fn main() { - match -5 { - -5 => {} - _ => { panic!() } - } -} diff --git a/src/test/ui/nested_item_main.rs b/src/test/ui/nested_item_main.rs deleted file mode 100644 index 2fe00aede00..00000000000 --- a/src/test/ui/nested_item_main.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass -// aux-build:nested_item.rs - - -extern crate nested_item; - -pub fn main() { - assert_eq!(2, nested_item::foo::<()>()); - assert_eq!(2, nested_item::foo::()); -} diff --git a/src/test/ui/never_type/diverging-tuple-parts-39485.rs b/src/test/ui/never_type/diverging-tuple-parts-39485.rs new file mode 100644 index 00000000000..0cde6119308 --- /dev/null +++ b/src/test/ui/never_type/diverging-tuple-parts-39485.rs @@ -0,0 +1,15 @@ +// After #39485, this test used to pass, but that change was reverted +// due to numerous inference failures like #39808, so it now fails +// again. #39485 made it so that diverging types never propagate +// upward; but we now do propagate such types upward in many more +// cases. + +fn g() { + &panic!() //~ ERROR mismatched types +} + +fn f() -> isize { + (return 1, return 2) //~ ERROR mismatched types +} + +fn main() {} diff --git a/src/test/ui/never_type/diverging-tuple-parts-39485.stderr b/src/test/ui/never_type/diverging-tuple-parts-39485.stderr new file mode 100644 index 00000000000..32967b376ca --- /dev/null +++ b/src/test/ui/never_type/diverging-tuple-parts-39485.stderr @@ -0,0 +1,32 @@ +error[E0308]: mismatched types + --> $DIR/diverging-tuple-parts-39485.rs:8:5 + | +LL | &panic!() + | ^^^^^^^^^ expected `()`, found reference + | + = note: expected unit type `()` + found reference `&_` +help: try adding a return type + | +LL | fn g() -> &_ { + | +++++ +help: consider removing the borrow + | +LL - &panic!() +LL + panic!() + | + +error[E0308]: mismatched types + --> $DIR/diverging-tuple-parts-39485.rs:12:5 + | +LL | fn f() -> isize { + | ----- expected `isize` because of return type +LL | (return 1, return 2) + | ^^^^^^^^^^^^^^^^^^^^ expected `isize`, found tuple + | + = note: expected type `isize` + found tuple `(!, !)` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/new-box.rs b/src/test/ui/new-box.rs deleted file mode 100644 index 96a3b197f46..00000000000 --- a/src/test/ui/new-box.rs +++ /dev/null @@ -1,30 +0,0 @@ -// run-pass - -fn f(x: Box) { - let y: &isize = &*x; - println!("{}", *x); - println!("{}", *y); -} - -trait Trait { - fn printme(&self); -} - -struct Struct; - -impl Trait for Struct { - fn printme(&self) { - println!("hello world!"); - } -} - -fn g(x: Box) { - x.printme(); - let y: &dyn Trait = &*x; - y.printme(); -} - -fn main() { - f(Box::new(1234)); - g(Box::new(Struct) as Box); -} diff --git a/src/test/ui/nil-decl-in-foreign.rs b/src/test/ui/nil-decl-in-foreign.rs deleted file mode 100644 index f3be948781b..00000000000 --- a/src/test/ui/nil-decl-in-foreign.rs +++ /dev/null @@ -1,14 +0,0 @@ -// run-pass - -#![allow(improper_ctypes)] -#![allow(dead_code)] -// Issue #901 -// pretty-expanded FIXME #23616 - -mod libc { - extern "C" { - pub fn printf(x: ()); - } -} - -pub fn main() {} diff --git a/src/test/ui/numbers-arithmetic/unary-minus-suffix-inference.rs b/src/test/ui/numbers-arithmetic/unary-minus-suffix-inference.rs new file mode 100644 index 00000000000..a4d0a849484 --- /dev/null +++ b/src/test/ui/numbers-arithmetic/unary-minus-suffix-inference.rs @@ -0,0 +1,23 @@ +// run-pass + +pub fn main() { + let a = 1; + let a_neg: i8 = -a; + println!("{}", a_neg); + + let b = 1; + let b_neg: i16 = -b; + println!("{}", b_neg); + + let c = 1; + let c_neg: i32 = -c; + println!("{}", c_neg); + + let d = 1; + let d_neg: i64 = -d; + println!("{}", d_neg); + + let e = 1; + let e_neg: isize = -e; + println!("{}", e_neg); +} diff --git a/src/test/ui/object-does-not-impl-trait.rs b/src/test/ui/object-does-not-impl-trait.rs deleted file mode 100644 index b3b679813c9..00000000000 --- a/src/test/ui/object-does-not-impl-trait.rs +++ /dev/null @@ -1,8 +0,0 @@ -// Test that an object type `Box` is not considered to implement the -// trait `Foo`. Issue #5087. - -trait Foo {} -fn take_foo(f: F) {} -fn take_object(f: Box) { take_foo(f); } -//~^ ERROR `Box: Foo` is not satisfied -fn main() {} diff --git a/src/test/ui/object-does-not-impl-trait.stderr b/src/test/ui/object-does-not-impl-trait.stderr deleted file mode 100644 index f1dd508a467..00000000000 --- a/src/test/ui/object-does-not-impl-trait.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0277]: the trait bound `Box: Foo` is not satisfied - --> $DIR/object-does-not-impl-trait.rs:6:44 - | -LL | fn take_object(f: Box) { take_foo(f); } - | -------- ^ the trait `Foo` is not implemented for `Box` - | | - | required by a bound introduced by this call - | -note: required by a bound in `take_foo` - --> $DIR/object-does-not-impl-trait.rs:5:15 - | -LL | fn take_foo(f: F) {} - | ^^^ required by this bound in `take_foo` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/overlap-doesnt-conflict-with-specialization.rs b/src/test/ui/overlap-doesnt-conflict-with-specialization.rs deleted file mode 100644 index 1e413120a37..00000000000 --- a/src/test/ui/overlap-doesnt-conflict-with-specialization.rs +++ /dev/null @@ -1,20 +0,0 @@ -// run-pass - -#![feature(marker_trait_attr)] -#![feature(specialization)] //~ WARN the feature `specialization` is incomplete - -#[marker] -trait MyMarker {} - -impl MyMarker for T {} -impl MyMarker for Vec {} - -fn foo(t: T) -> T { - t -} - -fn main() { - assert_eq!(1, foo(1)); - assert_eq!(2.0, foo(2.0)); - assert_eq!(vec![1], foo(vec![1])); -} diff --git a/src/test/ui/overlap-doesnt-conflict-with-specialization.stderr b/src/test/ui/overlap-doesnt-conflict-with-specialization.stderr deleted file mode 100644 index fca98662708..00000000000 --- a/src/test/ui/overlap-doesnt-conflict-with-specialization.stderr +++ /dev/null @@ -1,12 +0,0 @@ -warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/overlap-doesnt-conflict-with-specialization.rs:4:12 - | -LL | #![feature(specialization)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #31844 for more information - = help: consider using `min_specialization` instead, which is more stable and complete - -warning: 1 warning emitted - diff --git a/src/test/ui/overlap-permitted-for-annotated-marker-traits.rs b/src/test/ui/overlap-permitted-for-annotated-marker-traits.rs deleted file mode 100644 index 38331390237..00000000000 --- a/src/test/ui/overlap-permitted-for-annotated-marker-traits.rs +++ /dev/null @@ -1,26 +0,0 @@ -// run-pass -// Tests for RFC 1268: we allow overlapping impls of marker traits, -// that is, traits with #[marker]. In this case, a type `T` is -// `MyMarker` if it is either `Debug` or `Display`. - -#![feature(marker_trait_attr)] - -use std::fmt::{Debug, Display}; - -#[marker] trait MyMarker {} - -impl MyMarker for T {} -impl MyMarker for T {} - -fn foo(t: T) -> T { - t -} - -fn main() { - // Debug && Display: - assert_eq!(1, foo(1)); - assert_eq!(2.0, foo(2.0)); - - // Debug && !Display: - assert_eq!(vec![1], foo(vec![1])); -} diff --git a/src/test/ui/packed/issue-46152.rs b/src/test/ui/packed/issue-46152.rs new file mode 100644 index 00000000000..fb1c9fb78f3 --- /dev/null +++ b/src/test/ui/packed/issue-46152.rs @@ -0,0 +1,24 @@ +// run-pass +#![allow(dead_code)] +#![allow(unused_variables)] +#![feature(unsize, coerce_unsized)] + +#[repr(packed)] +struct UnalignedPtr<'a, T: ?Sized> + where T: 'a, +{ + data: &'a T, +} + +fn main() { + + impl<'a, T, U> std::ops::CoerceUnsized> for UnalignedPtr<'a, T> + where + T: std::marker::Unsize + ?Sized, + U: ?Sized, + { } + + let arr = [1, 2, 3]; + let arr_unaligned: UnalignedPtr<[i32; 3]> = UnalignedPtr { data: &arr }; + let arr_unaligned: UnalignedPtr<[i32]> = arr_unaligned; +} diff --git a/src/test/ui/parser/bastion-of-the-turbofish.rs b/src/test/ui/parser/bastion-of-the-turbofish.rs new file mode 100644 index 00000000000..e12857008a5 --- /dev/null +++ b/src/test/ui/parser/bastion-of-the-turbofish.rs @@ -0,0 +1,43 @@ +// check-pass + +// Bastion of the Turbofish +// ------------------------ +// Beware travellers, lest you venture into waters callous and unforgiving, +// where hope must be abandoned, ere it is cruelly torn from you. For here +// stands the bastion of the Turbofish: an impenetrable fortress holding +// unshaking against those who would dare suggest the supererogation of the +// Turbofish. +// +// Once I was young and foolish and had the impudence to imagine that I could +// shake free from the coils by which that creature had us tightly bound. I +// dared to suggest that there was a better way: a brighter future, in which +// Rustaceans both new and old could be rid of that vile beast. But alas! In +// my foolhardiness my ignorance was unveiled and my dreams were dashed +// unforgivingly against the rock of syntactic ambiguity. +// +// This humble program, small and insignificant though it might seem, +// demonstrates that to which we had previously cast a blind eye: an ambiguity +// in permitting generic arguments to be provided without the consent of the +// Great Turbofish. Should you be so naïve as to try to revolt against its +// mighty clutches, here shall its wrath be indomitably displayed. This +// program must pass for all eternity: forever watched by the guardian angel +// which gave this beast its name, and stands fundamentally at odds with the +// impetuous rebellion against the Turbofish. +// +// My heart aches in sorrow, for I know I am defeated. Let this be a warning +// to all those who come after: for they too must overcome the impassible +// hurdle of defeating the great beast, championed by a resolute winged +// guardian. +// +// Here stands the Bastion of the Turbofish, a memorial to Anna Harren, +// Guardian Angel of these Hallowed Grounds. <3 + +// See https://github.com/rust-lang/rust/pull/53562 +// and https://github.com/rust-lang/rfcs/pull/2527 +// and https://twitter.com/garblefart/status/1393236602856611843 +// for context. + +fn main() { + let (the, guardian, stands, resolute) = ("the", "Turbofish", "remains", "undefeated"); + let _: (bool, bool) = (the(resolute)); +} diff --git a/src/test/ui/parser/issue-13483.rs b/src/test/ui/parser/issue-13483.rs new file mode 100644 index 00000000000..a2fd9264b15 --- /dev/null +++ b/src/test/ui/parser/issue-13483.rs @@ -0,0 +1,17 @@ +fn main() { + if true { + } else if { //~ ERROR missing condition + //~^ ERROR mismatched types + } else { + } +} + +fn foo() { + if true { + } else if { //~ ERROR missing condition + //~^ ERROR mismatched types + } + bar(); +} + +fn bar() {} diff --git a/src/test/ui/parser/issue-13483.stderr b/src/test/ui/parser/issue-13483.stderr new file mode 100644 index 00000000000..5fd05b18ce0 --- /dev/null +++ b/src/test/ui/parser/issue-13483.stderr @@ -0,0 +1,33 @@ +error: missing condition for `if` expression + --> $DIR/issue-13483.rs:3:14 + | +LL | } else if { + | ^ expected if condition here + +error: missing condition for `if` expression + --> $DIR/issue-13483.rs:11:14 + | +LL | } else if { + | ^ expected if condition here + +error[E0308]: mismatched types + --> $DIR/issue-13483.rs:3:15 + | +LL | } else if { + | _______________^ +LL | | +LL | | } else { + | |_____^ expected `bool`, found `()` + +error[E0308]: mismatched types + --> $DIR/issue-13483.rs:11:15 + | +LL | } else if { + | _______________^ +LL | | +LL | | } + | |_____^ expected `bool`, found `()` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/parser/issue-20616-4.rs b/src/test/ui/parser/issue-20616-4.rs new file mode 100644 index 00000000000..a71f47ca4bf --- /dev/null +++ b/src/test/ui/parser/issue-20616-4.rs @@ -0,0 +1,35 @@ +// We need all these 9 issue-20616-N.rs files +// because we can only catch one parsing error at a time + +type Type_1_<'a, T> = &'a T; + + +//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` + + +//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` + + +//type Type_3 = Box; // error: expected type, found `,` + + +type Type_4 = Type_1_<'static,, T>; +//~^ error: expected one of `>`, a const expression, lifetime, or type, found `,` + + +type Type_5_<'a> = Type_1_<'a, ()>; + + +//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` + + +//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` + + +//type Type_7 = Box<(),,>; // error: expected type, found `,` + + +//type Type_8<'a,,> = &'a (); // error: expected ident, found `,` + + +//type Type_9 = Box; // error: expected ident, found `,` diff --git a/src/test/ui/parser/issue-20616-4.stderr b/src/test/ui/parser/issue-20616-4.stderr new file mode 100644 index 00000000000..2b3b75f3119 --- /dev/null +++ b/src/test/ui/parser/issue-20616-4.stderr @@ -0,0 +1,8 @@ +error: expected one of `>`, a const expression, lifetime, or type, found `,` + --> $DIR/issue-20616-4.rs:16:34 + | +LL | type Type_4 = Type_1_<'static,, T>; + | ^ expected one of `>`, a const expression, lifetime, or type + +error: aborting due to previous error + diff --git a/src/test/ui/parser/issue-20616-5.rs b/src/test/ui/parser/issue-20616-5.rs new file mode 100644 index 00000000000..b96d09d59ae --- /dev/null +++ b/src/test/ui/parser/issue-20616-5.rs @@ -0,0 +1,35 @@ +// We need all these 9 issue-20616-N.rs files +// because we can only catch one parsing error at a time + +type Type_1_<'a, T> = &'a T; + + +//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` + + +//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` + + +//type Type_3 = Box; // error: expected type, found `,` + + +//type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` + + +type Type_5_<'a> = Type_1_<'a, ()>; + + +type Type_5<'a> = Type_1_<'a, (),,>; +//~^ error: expected one of `>`, a const expression, lifetime, or type, found `,` + + +//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` + + +//type Type_7 = Box<(),,>; // error: expected type, found `,` + + +//type Type_8<'a,,> = &'a (); // error: expected ident, found `,` + + +//type Type_9 = Box; // error: expected ident, found `,` diff --git a/src/test/ui/parser/issue-20616-5.stderr b/src/test/ui/parser/issue-20616-5.stderr new file mode 100644 index 00000000000..1ec1dbde695 --- /dev/null +++ b/src/test/ui/parser/issue-20616-5.stderr @@ -0,0 +1,8 @@ +error: expected one of `>`, a const expression, lifetime, or type, found `,` + --> $DIR/issue-20616-5.rs:22:34 + | +LL | type Type_5<'a> = Type_1_<'a, (),,>; + | ^ expected one of `>`, a const expression, lifetime, or type + +error: aborting due to previous error + diff --git a/src/test/ui/parser/issue-20616-6.rs b/src/test/ui/parser/issue-20616-6.rs new file mode 100644 index 00000000000..a2c45ecec7a --- /dev/null +++ b/src/test/ui/parser/issue-20616-6.rs @@ -0,0 +1,35 @@ +// We need all these 9 issue-20616-N.rs files +// because we can only catch one parsing error at a time + +type Type_1_<'a, T> = &'a T; + + +//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` + + +//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` + + +//type Type_3 = Box; // error: expected type, found `,` + + +//type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` + + +type Type_5_<'a> = Type_1_<'a, ()>; + + +//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` + + +type Type_6 = Type_5_<'a,,>; +//~^ error: expected one of `>`, a const expression, lifetime, or type, found `,` + + +//type Type_7 = Box<(),,>; // error: expected type, found `,` + + +//type Type_8<'a,,> = &'a (); // error: expected ident, found `,` + + +//type Type_9 = Box; // error: expected ident, found `,` diff --git a/src/test/ui/parser/issue-20616-6.stderr b/src/test/ui/parser/issue-20616-6.stderr new file mode 100644 index 00000000000..7401abdd091 --- /dev/null +++ b/src/test/ui/parser/issue-20616-6.stderr @@ -0,0 +1,8 @@ +error: expected one of `>`, a const expression, lifetime, or type, found `,` + --> $DIR/issue-20616-6.rs:25:26 + | +LL | type Type_6 = Type_5_<'a,,>; + | ^ expected one of `>`, a const expression, lifetime, or type + +error: aborting due to previous error + diff --git a/src/test/ui/parser/issue-20616-7.rs b/src/test/ui/parser/issue-20616-7.rs new file mode 100644 index 00000000000..67209c02adf --- /dev/null +++ b/src/test/ui/parser/issue-20616-7.rs @@ -0,0 +1,35 @@ +// We need all these 9 issue-20616-N.rs files +// because we can only catch one parsing error at a time + +type Type_1_<'a, T> = &'a T; + + +//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` + + +//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` + + +//type Type_3 = Box; // error: expected type, found `,` + + +//type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` + + +type Type_5_<'a> = Type_1_<'a, ()>; + + +//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` + + +//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` + + +type Type_7 = Box<(),,>; +//~^ error: expected one of `>`, a const expression, lifetime, or type, found `,` + + +//type Type_8<'a,,> = &'a (); // error: expected ident, found `,` + + +//type Type_9 = Box; // error: expected ident, found `,` diff --git a/src/test/ui/parser/issue-20616-7.stderr b/src/test/ui/parser/issue-20616-7.stderr new file mode 100644 index 00000000000..e2c3efe8447 --- /dev/null +++ b/src/test/ui/parser/issue-20616-7.stderr @@ -0,0 +1,8 @@ +error: expected one of `>`, a const expression, lifetime, or type, found `,` + --> $DIR/issue-20616-7.rs:28:22 + | +LL | type Type_7 = Box<(),,>; + | ^ expected one of `>`, a const expression, lifetime, or type + +error: aborting due to previous error + diff --git a/src/test/ui/parser/issue-21475.rs b/src/test/ui/parser/issue-21475.rs new file mode 100644 index 00000000000..b028fcae077 --- /dev/null +++ b/src/test/ui/parser/issue-21475.rs @@ -0,0 +1,19 @@ +// run-pass +#![allow(unused_imports, overlapping_range_endpoints)] +// pretty-expanded FIXME #23616 + +use m::{START, END}; + +fn main() { + match 42 { + m::START..=m::END => {}, + 0..=m::END => {}, + m::START..=59 => {}, + _ => {}, + } +} + +mod m { + pub const START: u32 = 4; + pub const END: u32 = 14; +} diff --git a/src/test/ui/parser/issue-31804.rs b/src/test/ui/parser/issue-31804.rs new file mode 100644 index 00000000000..d056b77cf09 --- /dev/null +++ b/src/test/ui/parser/issue-31804.rs @@ -0,0 +1,6 @@ +// Test that error recovery in the parser to an EOF does not give an infinite +// spew of errors. + +fn main() { + let +} //~ ERROR expected pattern, found `}` diff --git a/src/test/ui/parser/issue-31804.stderr b/src/test/ui/parser/issue-31804.stderr new file mode 100644 index 00000000000..76e68b0b352 --- /dev/null +++ b/src/test/ui/parser/issue-31804.stderr @@ -0,0 +1,8 @@ +error: expected pattern, found `}` + --> $DIR/issue-31804.rs:6:1 + | +LL | } + | ^ expected pattern + +error: aborting due to previous error + diff --git a/src/test/ui/parser/issue-34255-1.rs b/src/test/ui/parser/issue-34255-1.rs new file mode 100644 index 00000000000..c70cd8b5077 --- /dev/null +++ b/src/test/ui/parser/issue-34255-1.rs @@ -0,0 +1,10 @@ +enum Test { + Drill { + field: i32, + } +} + +fn main() { + Test::Drill(field: 42); + //~^ ERROR invalid `struct` delimiters or `fn` call arguments +} diff --git a/src/test/ui/parser/issue-34255-1.stderr b/src/test/ui/parser/issue-34255-1.stderr new file mode 100644 index 00000000000..fbff75e37d9 --- /dev/null +++ b/src/test/ui/parser/issue-34255-1.stderr @@ -0,0 +1,18 @@ +error: invalid `struct` delimiters or `fn` call arguments + --> $DIR/issue-34255-1.rs:8:5 + | +LL | Test::Drill(field: 42); + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: if `Test::Drill` is a struct, use braces as delimiters + | +LL | Test::Drill { field: 42 }; + | ~ ~ +help: if `Test::Drill` is a function, use the arguments directly + | +LL - Test::Drill(field: 42); +LL + Test::Drill(42); + | + +error: aborting due to previous error + diff --git a/src/test/ui/parser/issue-49040.rs b/src/test/ui/parser/issue-49040.rs new file mode 100644 index 00000000000..b7a541dd664 --- /dev/null +++ b/src/test/ui/parser/issue-49040.rs @@ -0,0 +1,3 @@ +#![allow(unused_variables)]; //~ ERROR expected item, found `;` +//~^ ERROR `main` function +fn foo() {} diff --git a/src/test/ui/parser/issue-49040.stderr b/src/test/ui/parser/issue-49040.stderr new file mode 100644 index 00000000000..56befe3a0a7 --- /dev/null +++ b/src/test/ui/parser/issue-49040.stderr @@ -0,0 +1,15 @@ +error: expected item, found `;` + --> $DIR/issue-49040.rs:1:28 + | +LL | #![allow(unused_variables)]; + | ^ help: remove this semicolon + +error[E0601]: `main` function not found in crate `issue_49040` + --> $DIR/issue-49040.rs:1:1 + | +LL | #![allow(unused_variables)]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ consider adding a `main` function to `$DIR/issue-49040.rs` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/parser/issue-56031.rs b/src/test/ui/parser/issue-56031.rs new file mode 100644 index 00000000000..b68f5681467 --- /dev/null +++ b/src/test/ui/parser/issue-56031.rs @@ -0,0 +1,6 @@ +struct T; + +impl for T {} +//~^ ERROR missing trait in a trait impl + +fn main() {} diff --git a/src/test/ui/parser/issue-56031.stderr b/src/test/ui/parser/issue-56031.stderr new file mode 100644 index 00000000000..7ee5bc6ec61 --- /dev/null +++ b/src/test/ui/parser/issue-56031.stderr @@ -0,0 +1,18 @@ +error: missing trait in a trait impl + --> $DIR/issue-56031.rs:3:5 + | +LL | impl for T {} + | ^ + | +help: add a trait here + | +LL | impl Trait for T {} + | +++++ +help: for an inherent impl, drop this `for` + | +LL - impl for T {} +LL + impl T {} + | + +error: aborting due to previous error + diff --git a/src/test/ui/pattern/issue-11577.rs b/src/test/ui/pattern/issue-11577.rs new file mode 100644 index 00000000000..70177c5ed0d --- /dev/null +++ b/src/test/ui/pattern/issue-11577.rs @@ -0,0 +1,18 @@ +// run-pass +// Destructuring struct variants would ICE where regular structs wouldn't + +enum Foo { + VBar { num: isize } +} + +struct SBar { num: isize } + +pub fn main() { + let vbar = Foo::VBar { num: 1 }; + let Foo::VBar { num } = vbar; + assert_eq!(num, 1); + + let sbar = SBar { num: 2 }; + let SBar { num } = sbar; + assert_eq!(num, 2); +} diff --git a/src/test/ui/pattern/issue-15080.rs b/src/test/ui/pattern/issue-15080.rs new file mode 100644 index 00000000000..4dd6981d448 --- /dev/null +++ b/src/test/ui/pattern/issue-15080.rs @@ -0,0 +1,22 @@ +// run-pass + +fn main() { + let mut x: &[_] = &[1, 2, 3, 4]; + + let mut result = vec![]; + loop { + x = match *x { + [1, n, 3, ref rest @ ..] => { + result.push(n); + rest + } + [n, ref rest @ ..] => { + result.push(n); + rest + } + [] => + break + } + } + assert_eq!(result, [2, 4]); +} diff --git a/src/test/ui/pattern/issue-72574-2.rs b/src/test/ui/pattern/issue-72574-2.rs new file mode 100644 index 00000000000..0ad2db848b2 --- /dev/null +++ b/src/test/ui/pattern/issue-72574-2.rs @@ -0,0 +1,12 @@ +struct Binder(i32, i32, i32); + +fn main() { + let x = Binder(1, 2, 3); + match x { + Binder(_a, _x @ ..) => {} + _ => {} + } +} +//~^^^^ ERROR `_x @` is not allowed in a tuple struct +//~| ERROR: `..` patterns are not allowed here +//~| ERROR: this pattern has 2 fields, but the corresponding tuple struct has 3 fields diff --git a/src/test/ui/pattern/issue-72574-2.stderr b/src/test/ui/pattern/issue-72574-2.stderr new file mode 100644 index 00000000000..05650f05cbf --- /dev/null +++ b/src/test/ui/pattern/issue-72574-2.stderr @@ -0,0 +1,37 @@ +error: `_x @` is not allowed in a tuple struct + --> $DIR/issue-72574-2.rs:6:20 + | +LL | Binder(_a, _x @ ..) => {} + | ^^^^^^^ this is only allowed in slice patterns + | + = help: remove this and bind each tuple field independently +help: if you don't need to use the contents of _x, discard the tuple's remaining fields + | +LL | Binder(_a, ..) => {} + | ~~ + +error: `..` patterns are not allowed here + --> $DIR/issue-72574-2.rs:6:25 + | +LL | Binder(_a, _x @ ..) => {} + | ^^ + | + = note: only allowed in tuple, tuple struct, and slice patterns + +error[E0023]: this pattern has 2 fields, but the corresponding tuple struct has 3 fields + --> $DIR/issue-72574-2.rs:6:16 + | +LL | struct Binder(i32, i32, i32); + | --- --- --- tuple struct has 3 fields +... +LL | Binder(_a, _x @ ..) => {} + | ^^ ^^^^^^^ expected 3 fields, found 2 + | +help: use `_` to explicitly ignore each field + | +LL | Binder(_a, _x @ .., _) => {} + | +++ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0023`. diff --git a/src/test/ui/pattern/issue-8351-1.rs b/src/test/ui/pattern/issue-8351-1.rs new file mode 100644 index 00000000000..139f027cb90 --- /dev/null +++ b/src/test/ui/pattern/issue-8351-1.rs @@ -0,0 +1,16 @@ +// run-pass +#![allow(dead_code)] + +enum E { + Foo{f: isize}, + Bar, +} + +pub fn main() { + let e = E::Foo{f: 0}; + match e { + E::Foo{f: 1} => panic!(), + E::Foo{..} => (), + _ => panic!(), + } +} diff --git a/src/test/ui/pattern/issue-8351-2.rs b/src/test/ui/pattern/issue-8351-2.rs new file mode 100644 index 00000000000..bc66cbb77c0 --- /dev/null +++ b/src/test/ui/pattern/issue-8351-2.rs @@ -0,0 +1,16 @@ +// run-pass +#![allow(dead_code)] + +enum E { + Foo{f: isize, b: bool}, + Bar, +} + +pub fn main() { + let e = E::Foo{f: 0, b: false}; + match e { + E::Foo{f: 1, b: true} => panic!(), + E::Foo{b: false, f: 0} => (), + _ => panic!(), + } +} diff --git a/src/test/ui/process/issue-14456.rs b/src/test/ui/process/issue-14456.rs new file mode 100644 index 00000000000..52a56eb77f7 --- /dev/null +++ b/src/test/ui/process/issue-14456.rs @@ -0,0 +1,37 @@ +// run-pass +#![allow(unused_mut)] +// ignore-emscripten no processes +// ignore-sgx no processes + +use std::env; +use std::io::prelude::*; +use std::io; +use std::process::{Command, Stdio}; + +fn main() { + let args: Vec = env::args().collect(); + if args.len() > 1 && args[1] == "child" { + return child() + } + + test(); +} + +fn child() { + writeln!(&mut io::stdout(), "foo").unwrap(); + writeln!(&mut io::stderr(), "bar").unwrap(); + let mut stdin = io::stdin(); + let mut s = String::new(); + stdin.lock().read_line(&mut s).unwrap(); + assert_eq!(s.len(), 0); +} + +fn test() { + let args: Vec = env::args().collect(); + let mut p = Command::new(&args[0]).arg("child") + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn().unwrap(); + assert!(p.wait().unwrap().success()); +} diff --git a/src/test/ui/process/issue-16272.rs b/src/test/ui/process/issue-16272.rs new file mode 100644 index 00000000000..5cf3fd94928 --- /dev/null +++ b/src/test/ui/process/issue-16272.rs @@ -0,0 +1,23 @@ +// run-pass +// ignore-emscripten no processes +// ignore-sgx no processes + +use std::process::Command; +use std::env; + +fn main() { + let len = env::args().len(); + + if len == 1 { + test(); + } else { + assert_eq!(len, 3); + } +} + +fn test() { + let status = Command::new(&env::current_exe().unwrap()) + .arg("foo").arg("") + .status().unwrap(); + assert!(status.success()); +} diff --git a/src/test/ui/process/issue-20091.rs b/src/test/ui/process/issue-20091.rs new file mode 100644 index 00000000000..86cc79d6b42 --- /dev/null +++ b/src/test/ui/process/issue-20091.rs @@ -0,0 +1,24 @@ +// run-pass +#![allow(stable_features)] + +// ignore-emscripten no processes +// ignore-sgx no processes + +#![feature(os)] + +#[cfg(unix)] +fn main() { + use std::process::Command; + use std::env; + use std::os::unix::prelude::*; + use std::ffi::OsStr; + + if env::args().len() == 1 { + assert!(Command::new(&env::current_exe().unwrap()) + .arg(::from_bytes(b"\xff")) + .status().unwrap().success()) + } +} + +#[cfg(windows)] +fn main() {} diff --git a/src/test/ui/process/signal-exit-status.rs b/src/test/ui/process/signal-exit-status.rs new file mode 100644 index 00000000000..0963dcc80f6 --- /dev/null +++ b/src/test/ui/process/signal-exit-status.rs @@ -0,0 +1,18 @@ +// run-pass +// ignore-emscripten no processes +// ignore-sgx no processes +// ignore-windows + +use std::env; +use std::process::Command; + +pub fn main() { + let args: Vec = env::args().collect(); + if args.len() >= 2 && args[1] == "signal" { + // Raise a segfault. + unsafe { *(1 as *mut isize) = 0; } + } else { + let status = Command::new(&args[0]).arg("signal").status().unwrap(); + assert!(status.code().is_none()); + } +} diff --git a/src/test/ui/regions/issue-21520.rs b/src/test/ui/regions/issue-21520.rs new file mode 100644 index 00000000000..ab4ac7237c7 --- /dev/null +++ b/src/test/ui/regions/issue-21520.rs @@ -0,0 +1,22 @@ +// check-pass +#![allow(dead_code)] +// Test that the requirement (in `Bar`) that `T::Bar : 'static` does +// not wind up propagating to `T`. + +// pretty-expanded FIXME #23616 + +pub trait Foo { + type Bar; + + fn foo(&self) -> Self; +} + +pub struct Static(T); + +struct Bar + where T::Bar : 'static +{ + x: Static> +} + +fn main() { } diff --git a/src/test/ui/regions/issue-26448-1.rs b/src/test/ui/regions/issue-26448-1.rs new file mode 100644 index 00000000000..7d2d75bf2e8 --- /dev/null +++ b/src/test/ui/regions/issue-26448-1.rs @@ -0,0 +1,13 @@ +// run-pass + +pub trait Foo { + fn foo(self) -> T; +} + +impl<'a, T> Foo for &'a str where &'a str: Into { + fn foo(self) -> T { + panic!(); + } +} + +fn main() {} diff --git a/src/test/ui/regions/issue-26448-2.rs b/src/test/ui/regions/issue-26448-2.rs new file mode 100644 index 00000000000..c60e06c3ceb --- /dev/null +++ b/src/test/ui/regions/issue-26448-2.rs @@ -0,0 +1,21 @@ +// check-pass + +pub struct Bar { + items: Vec<&'static str>, + inner: T, +} + +pub trait IntoBar { + fn into_bar(self) -> Bar; +} + +impl<'a, T> IntoBar for &'a str where &'a str: Into { + fn into_bar(self) -> Bar { + Bar { + items: Vec::new(), + inner: self.into(), + } + } +} + +fn main() {} diff --git a/src/test/ui/regions/issue-26448-3.rs b/src/test/ui/regions/issue-26448-3.rs new file mode 100644 index 00000000000..d48022c09fe --- /dev/null +++ b/src/test/ui/regions/issue-26448-3.rs @@ -0,0 +1,25 @@ +// check-pass + +pub struct Item { + _inner: &'static str, +} + +pub struct Bar { + items: Vec, + inner: T, +} + +pub trait IntoBar { + fn into_bar(self) -> Bar; +} + +impl<'a, T> IntoBar for &'a str where &'a str: Into { + fn into_bar(self) -> Bar { + Bar { + items: Vec::new(), + inner: self.into(), + } + } +} + +fn main() {} diff --git a/src/test/ui/required-lang-item.rs b/src/test/ui/required-lang-item.rs deleted file mode 100644 index 3b17c5b7255..00000000000 --- a/src/test/ui/required-lang-item.rs +++ /dev/null @@ -1,11 +0,0 @@ -// build-fail - -#![feature(lang_items, no_core)] -#![no_core] - -#[lang="copy"] pub trait Copy { } -#[lang="sized"] pub trait Sized { } - -// error-pattern:requires `start` lang_item - -fn main() {} diff --git a/src/test/ui/required-lang-item.stderr b/src/test/ui/required-lang-item.stderr deleted file mode 100644 index 83764a91ac7..00000000000 --- a/src/test/ui/required-lang-item.stderr +++ /dev/null @@ -1,4 +0,0 @@ -error: requires `start` lang_item - -error: aborting due to previous error - diff --git a/src/test/ui/resolve/editions-crate-root-2015.rs b/src/test/ui/resolve/editions-crate-root-2015.rs new file mode 100644 index 00000000000..4c890e3ae69 --- /dev/null +++ b/src/test/ui/resolve/editions-crate-root-2015.rs @@ -0,0 +1,21 @@ +// edition:2015 + +mod inner { + fn global_inner(_: ::nonexistant::Foo) { + //~^ ERROR failed to resolve: maybe a missing crate `nonexistant`? + } + fn crate_inner(_: crate::nonexistant::Foo) { + //~^ ERROR failed to resolve: maybe a missing crate `nonexistant`? + } + + fn bare_global(_: ::nonexistant) { + //~^ ERROR cannot find type `nonexistant` in the crate root + } + fn bare_crate(_: crate::nonexistant) { + //~^ ERROR cannot find type `nonexistant` in the crate root + } +} + +fn main() { + +} diff --git a/src/test/ui/resolve/editions-crate-root-2015.stderr b/src/test/ui/resolve/editions-crate-root-2015.stderr new file mode 100644 index 00000000000..f8d65fec3d1 --- /dev/null +++ b/src/test/ui/resolve/editions-crate-root-2015.stderr @@ -0,0 +1,28 @@ +error[E0433]: failed to resolve: maybe a missing crate `nonexistant`? + --> $DIR/editions-crate-root-2015.rs:4:26 + | +LL | fn global_inner(_: ::nonexistant::Foo) { + | ^^^^^^^^^^^ maybe a missing crate `nonexistant`? + +error[E0433]: failed to resolve: maybe a missing crate `nonexistant`? + --> $DIR/editions-crate-root-2015.rs:7:30 + | +LL | fn crate_inner(_: crate::nonexistant::Foo) { + | ^^^^^^^^^^^ maybe a missing crate `nonexistant`? + +error[E0412]: cannot find type `nonexistant` in the crate root + --> $DIR/editions-crate-root-2015.rs:11:25 + | +LL | fn bare_global(_: ::nonexistant) { + | ^^^^^^^^^^^ not found in the crate root + +error[E0412]: cannot find type `nonexistant` in the crate root + --> $DIR/editions-crate-root-2015.rs:14:29 + | +LL | fn bare_crate(_: crate::nonexistant) { + | ^^^^^^^^^^^ not found in the crate root + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0412, E0433. +For more information about an error, try `rustc --explain E0412`. diff --git a/src/test/ui/resolve/issue-12796.rs b/src/test/ui/resolve/issue-12796.rs new file mode 100644 index 00000000000..942d6b9a568 --- /dev/null +++ b/src/test/ui/resolve/issue-12796.rs @@ -0,0 +1,9 @@ +trait Trait { + fn outer(&self) { + fn inner(_: &Self) { + //~^ ERROR can't use generic parameters from outer function + } + } +} + +fn main() { } diff --git a/src/test/ui/resolve/issue-12796.stderr b/src/test/ui/resolve/issue-12796.stderr new file mode 100644 index 00000000000..a01fd2d6542 --- /dev/null +++ b/src/test/ui/resolve/issue-12796.stderr @@ -0,0 +1,12 @@ +error[E0401]: can't use generic parameters from outer function + --> $DIR/issue-12796.rs:3:22 + | +LL | fn inner(_: &Self) { + | ^^^^ + | | + | use of generic parameter from outer function + | can't use `Self` here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0401`. diff --git a/src/test/ui/resolve/issue-23716.rs b/src/test/ui/resolve/issue-23716.rs new file mode 100644 index 00000000000..e9139c0aa14 --- /dev/null +++ b/src/test/ui/resolve/issue-23716.rs @@ -0,0 +1,17 @@ +static foo: i32 = 0; + +fn bar(foo: i32) {} +//~^ ERROR function parameters cannot shadow statics +//~| cannot be named the same as a static + +mod submod { + pub static answer: i32 = 42; +} + +use self::submod::answer; + +fn question(answer: i32) {} +//~^ ERROR function parameters cannot shadow statics +//~| cannot be named the same as a static +fn main() { +} diff --git a/src/test/ui/resolve/issue-23716.stderr b/src/test/ui/resolve/issue-23716.stderr new file mode 100644 index 00000000000..e7bebfbbcb5 --- /dev/null +++ b/src/test/ui/resolve/issue-23716.stderr @@ -0,0 +1,21 @@ +error[E0530]: function parameters cannot shadow statics + --> $DIR/issue-23716.rs:3:8 + | +LL | static foo: i32 = 0; + | -------------------- the static `foo` is defined here +LL | +LL | fn bar(foo: i32) {} + | ^^^ cannot be named the same as a static + +error[E0530]: function parameters cannot shadow statics + --> $DIR/issue-23716.rs:13:13 + | +LL | use self::submod::answer; + | -------------------- the static `answer` is imported here +LL | +LL | fn question(answer: i32) {} + | ^^^^^^ cannot be named the same as a static + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0530`. diff --git a/src/test/ui/resolve/issue-3021-c.rs b/src/test/ui/resolve/issue-3021-c.rs new file mode 100644 index 00000000000..94ed1fdf781 --- /dev/null +++ b/src/test/ui/resolve/issue-3021-c.rs @@ -0,0 +1,9 @@ +fn siphash() { + + trait U { + fn g(&self, x: T) -> T; //~ ERROR can't use generic parameters from outer function + //~^ ERROR can't use generic parameters from outer function + } +} + +fn main() {} diff --git a/src/test/ui/resolve/issue-3021-c.stderr b/src/test/ui/resolve/issue-3021-c.stderr new file mode 100644 index 00000000000..8764ac8a856 --- /dev/null +++ b/src/test/ui/resolve/issue-3021-c.stderr @@ -0,0 +1,25 @@ +error[E0401]: can't use generic parameters from outer function + --> $DIR/issue-3021-c.rs:4:24 + | +LL | fn siphash() { + | - type parameter from outer function +... +LL | fn g(&self, x: T) -> T; + | - ^ use of generic parameter from outer function + | | + | help: try using a local generic parameter instead: `g` + +error[E0401]: can't use generic parameters from outer function + --> $DIR/issue-3021-c.rs:4:30 + | +LL | fn siphash() { + | - type parameter from outer function +... +LL | fn g(&self, x: T) -> T; + | - ^ use of generic parameter from outer function + | | + | help: try using a local generic parameter instead: `g` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0401`. diff --git a/src/test/ui/resolve/issue-3021.rs b/src/test/ui/resolve/issue-3021.rs new file mode 100644 index 00000000000..a672261f8d6 --- /dev/null +++ b/src/test/ui/resolve/issue-3021.rs @@ -0,0 +1,18 @@ +trait SipHash { + fn reset(&self); +} + +fn siphash(k0 : u64) { + struct SipState { + v0: u64, + } + + impl SipHash for SipState { + fn reset(&self) { + self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment + } + } + panic!(); +} + +fn main() {} diff --git a/src/test/ui/resolve/issue-3021.stderr b/src/test/ui/resolve/issue-3021.stderr new file mode 100644 index 00000000000..d5b015eec35 --- /dev/null +++ b/src/test/ui/resolve/issue-3021.stderr @@ -0,0 +1,11 @@ +error[E0434]: can't capture dynamic environment in a fn item + --> $DIR/issue-3021.rs:12:22 + | +LL | self.v0 = k0 ^ 0x736f6d6570736575; + | ^^ + | + = help: use the `|| { ... }` closure form instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0434`. diff --git a/src/test/ui/resolve/issue-31845.rs b/src/test/ui/resolve/issue-31845.rs new file mode 100644 index 00000000000..f6dc11502ba --- /dev/null +++ b/src/test/ui/resolve/issue-31845.rs @@ -0,0 +1,12 @@ +// Checks lexical scopes cannot see through normal module boundaries + +fn f() { + fn g() {} + mod foo { + fn h() { + g(); //~ ERROR cannot find function `g` in this scope + } + } +} + +fn main() {} diff --git a/src/test/ui/resolve/issue-31845.stderr b/src/test/ui/resolve/issue-31845.stderr new file mode 100644 index 00000000000..56281938559 --- /dev/null +++ b/src/test/ui/resolve/issue-31845.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find function `g` in this scope + --> $DIR/issue-31845.rs:7:12 + | +LL | g(); + | ^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/resolve/issue-5099.rs b/src/test/ui/resolve/issue-5099.rs new file mode 100644 index 00000000000..b5abccb4b19 --- /dev/null +++ b/src/test/ui/resolve/issue-5099.rs @@ -0,0 +1,13 @@ +trait B { + fn a() -> A { + this.a //~ ERROR cannot find value `this` in this scope + } + fn b(x: i32) { + this.b(x); //~ ERROR cannot find value `this` in this scope + } + fn c() { + let _ = || this.a; //~ ERROR cannot find value `this` in this scope + } +} + +fn main() {} diff --git a/src/test/ui/resolve/issue-5099.stderr b/src/test/ui/resolve/issue-5099.stderr new file mode 100644 index 00000000000..e9b2a9c4d48 --- /dev/null +++ b/src/test/ui/resolve/issue-5099.stderr @@ -0,0 +1,48 @@ +error[E0425]: cannot find value `this` in this scope + --> $DIR/issue-5099.rs:3:9 + | +LL | this.a + | ^^^^ not found in this scope + | +help: you might have meant to use `self` here instead + | +LL | self.a + | ~~~~ +help: if you meant to use `self`, you are also missing a `self` receiver argument + | +LL | fn a(&self) -> A { + | +++++ + +error[E0425]: cannot find value `this` in this scope + --> $DIR/issue-5099.rs:6:9 + | +LL | this.b(x); + | ^^^^ not found in this scope + | +help: you might have meant to use `self` here instead + | +LL | self.b(x); + | ~~~~ +help: if you meant to use `self`, you are also missing a `self` receiver argument + | +LL | fn b(&self, x: i32) { + | ++++++ + +error[E0425]: cannot find value `this` in this scope + --> $DIR/issue-5099.rs:9:20 + | +LL | let _ = || this.a; + | ^^^^ not found in this scope + | +help: you might have meant to use `self` here instead + | +LL | let _ = || self.a; + | ~~~~ +help: if you meant to use `self`, you are also missing a `self` receiver argument + | +LL | fn c(&self) { + | +++++ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/rfc-1445-restrict-constants-in-patterns/issue-6804.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/issue-6804.rs new file mode 100644 index 00000000000..0260caa82cb --- /dev/null +++ b/src/test/ui/rfc-1445-restrict-constants-in-patterns/issue-6804.rs @@ -0,0 +1,21 @@ +// Matching against NaN should result in a warning + +#![allow(unused)] +#![deny(illegal_floating_point_literal_pattern)] + +const NAN: f64 = f64::NAN; + +fn main() { + let x = NAN; + match x { + NAN => {}, //~ ERROR floating-point types cannot be used + //~| WARN this was previously accepted by the compiler but is being phased out + _ => {}, + }; + + match [x, 1.0] { + [NAN, _] => {}, //~ ERROR floating-point types cannot be used + //~| WARN this was previously accepted by the compiler but is being phased out + _ => {}, + }; +} diff --git a/src/test/ui/rfc-1445-restrict-constants-in-patterns/issue-6804.stderr b/src/test/ui/rfc-1445-restrict-constants-in-patterns/issue-6804.stderr new file mode 100644 index 00000000000..4e2961e5e23 --- /dev/null +++ b/src/test/ui/rfc-1445-restrict-constants-in-patterns/issue-6804.stderr @@ -0,0 +1,25 @@ +error: floating-point types cannot be used in patterns + --> $DIR/issue-6804.rs:11:9 + | +LL | NAN => {}, + | ^^^ + | +note: the lint level is defined here + --> $DIR/issue-6804.rs:4:9 + | +LL | #![deny(illegal_floating_point_literal_pattern)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #41620 + +error: floating-point types cannot be used in patterns + --> $DIR/issue-6804.rs:17:10 + | +LL | [NAN, _] => {}, + | ^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #41620 + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/self/issue-61882-2.rs b/src/test/ui/self/issue-61882-2.rs new file mode 100644 index 00000000000..1209b54bc41 --- /dev/null +++ b/src/test/ui/self/issue-61882-2.rs @@ -0,0 +1,11 @@ +struct A(T); + +impl A<&'static u8> { + fn f() { + let x = 0; + Self(&x); + //~^ ERROR `x` does not live long enough + } +} + +fn main() {} diff --git a/src/test/ui/self/issue-61882-2.stderr b/src/test/ui/self/issue-61882-2.stderr new file mode 100644 index 00000000000..0b8e134c966 --- /dev/null +++ b/src/test/ui/self/issue-61882-2.stderr @@ -0,0 +1,15 @@ +error[E0597]: `x` does not live long enough + --> $DIR/issue-61882-2.rs:6:14 + | +LL | Self(&x); + | ^^ + | | + | borrowed value does not live long enough + | this usage requires that `x` is borrowed for `'static` +LL | +LL | } + | - `x` dropped here while still borrowed + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/self/issue-61882.rs b/src/test/ui/self/issue-61882.rs new file mode 100644 index 00000000000..013398b4598 --- /dev/null +++ b/src/test/ui/self/issue-61882.rs @@ -0,0 +1,9 @@ +struct A(T); + +impl A { + const B: A = Self(0); + //~^ ERROR mismatched types + //~| ERROR mismatched types +} + +fn main() {} diff --git a/src/test/ui/self/issue-61882.stderr b/src/test/ui/self/issue-61882.stderr new file mode 100644 index 00000000000..09ffe8e64b1 --- /dev/null +++ b/src/test/ui/self/issue-61882.stderr @@ -0,0 +1,18 @@ +error[E0308]: mismatched types + --> $DIR/issue-61882.rs:4:27 + | +LL | const B: A = Self(0); + | ^ expected `bool`, found integer + +error[E0308]: mismatched types + --> $DIR/issue-61882.rs:4:22 + | +LL | const B: A = Self(0); + | ^^^^^^^ expected `u8`, found `bool` + | + = note: expected struct `A` + found struct `A` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/signal-exit-status.rs b/src/test/ui/signal-exit-status.rs deleted file mode 100644 index 0963dcc80f6..00000000000 --- a/src/test/ui/signal-exit-status.rs +++ /dev/null @@ -1,18 +0,0 @@ -// run-pass -// ignore-emscripten no processes -// ignore-sgx no processes -// ignore-windows - -use std::env; -use std::process::Command; - -pub fn main() { - let args: Vec = env::args().collect(); - if args.len() >= 2 && args[1] == "signal" { - // Raise a segfault. - unsafe { *(1 as *mut isize) = 0; } - } else { - let status = Command::new(&args[0]).arg("signal").status().unwrap(); - assert!(status.code().is_none()); - } -} diff --git a/src/test/ui/specialization/transmute-specialization.rs b/src/test/ui/specialization/transmute-specialization.rs new file mode 100644 index 00000000000..499334d983b --- /dev/null +++ b/src/test/ui/specialization/transmute-specialization.rs @@ -0,0 +1,15 @@ +// run-pass + +#![feature(specialization)] //~ WARN the feature `specialization` is incomplete + +trait Specializable { type Output; } + +impl Specializable for T { + default type Output = u16; +} + +fn main() { + unsafe { + std::mem::transmute::::Output>(0); + } +} diff --git a/src/test/ui/specialization/transmute-specialization.stderr b/src/test/ui/specialization/transmute-specialization.stderr new file mode 100644 index 00000000000..a0ea72415a1 --- /dev/null +++ b/src/test/ui/specialization/transmute-specialization.stderr @@ -0,0 +1,12 @@ +warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/transmute-specialization.rs:3:12 + | +LL | #![feature(specialization)] + | ^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + = note: see issue #31844 for more information + = help: consider using `min_specialization` instead, which is more stable and complete + +warning: 1 warning emitted + diff --git a/src/test/ui/static/auxiliary/nested_item.rs b/src/test/ui/static/auxiliary/nested_item.rs new file mode 100644 index 00000000000..9db9d19d6f6 --- /dev/null +++ b/src/test/ui/static/auxiliary/nested_item.rs @@ -0,0 +1,30 @@ +// original problem +pub fn foo() -> isize { + { + static foo: isize = 2; + foo + } +} + +// issue 8134 +struct Foo; +impl Foo { + pub fn foo(&self) { + static X: usize = 1; + } +} + +// issue 8134 +pub struct Parser(T); +impl> Parser { + fn in_doctype(&mut self) { + static DOCTYPEPattern: [char; 6] = ['O', 'C', 'T', 'Y', 'P', 'E']; + } +} + +struct Bar; +impl Foo { + pub fn bar(&self) { + static X: usize = 1; + } +} diff --git a/src/test/ui/static/nested_item_main.rs b/src/test/ui/static/nested_item_main.rs new file mode 100644 index 00000000000..2fe00aede00 --- /dev/null +++ b/src/test/ui/static/nested_item_main.rs @@ -0,0 +1,10 @@ +// run-pass +// aux-build:nested_item.rs + + +extern crate nested_item; + +pub fn main() { + assert_eq!(2, nested_item::foo::<()>()); + assert_eq!(2, nested_item::foo::()); +} diff --git a/src/test/ui/statics/issue-14227.mir.stderr b/src/test/ui/statics/issue-14227.mir.stderr new file mode 100644 index 00000000000..8e7a2514dd6 --- /dev/null +++ b/src/test/ui/statics/issue-14227.mir.stderr @@ -0,0 +1,11 @@ +error[E0133]: use of extern static is unsafe and requires unsafe function or block + --> $DIR/issue-14227.rs:7:21 + | +LL | static CRASH: u32 = symbol; + | ^^^^^^ use of extern static + | + = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/statics/issue-14227.rs b/src/test/ui/statics/issue-14227.rs new file mode 100644 index 00000000000..5f866ec9061 --- /dev/null +++ b/src/test/ui/statics/issue-14227.rs @@ -0,0 +1,10 @@ +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + +extern "C" { + pub static symbol: u32; +} +static CRASH: u32 = symbol; +//~^ ERROR use of extern static is unsafe and requires + +fn main() {} diff --git a/src/test/ui/statics/issue-14227.thir.stderr b/src/test/ui/statics/issue-14227.thir.stderr new file mode 100644 index 00000000000..8e7a2514dd6 --- /dev/null +++ b/src/test/ui/statics/issue-14227.thir.stderr @@ -0,0 +1,11 @@ +error[E0133]: use of extern static is unsafe and requires unsafe function or block + --> $DIR/issue-14227.rs:7:21 + | +LL | static CRASH: u32 = symbol; + | ^^^^^^ use of extern static + | + = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/structs-enums/issue-50731.rs b/src/test/ui/structs-enums/issue-50731.rs new file mode 100644 index 00000000000..209c1e1279b --- /dev/null +++ b/src/test/ui/structs-enums/issue-50731.rs @@ -0,0 +1,6 @@ +// run-pass +enum Void {} +fn foo(_: Result<(Void, u32), (Void, String)>) {} +fn main() { + let _: fn(_) = foo; +} diff --git a/src/test/ui/structured-compare.rs b/src/test/ui/structured-compare.rs deleted file mode 100644 index 63d30c4da89..00000000000 --- a/src/test/ui/structured-compare.rs +++ /dev/null @@ -1,30 +0,0 @@ -// run-pass - -#![allow(non_camel_case_types)] - - -#[derive(Copy, Clone, Debug)] -enum foo { large, small, } - -impl PartialEq for foo { - fn eq(&self, other: &foo) -> bool { - ((*self) as usize) == ((*other) as usize) - } - fn ne(&self, other: &foo) -> bool { !(*self).eq(other) } -} - -pub fn main() { - let a = (1, 2, 3); - let b = (1, 2, 3); - assert_eq!(a, b); - assert!((a != (1, 2, 4))); - assert!((a < (1, 2, 4))); - assert!((a <= (1, 2, 4))); - assert!(((1, 2, 4) > a)); - assert!(((1, 2, 4) >= a)); - let x = foo::large; - let y = foo::small; - assert!((x != y)); - assert_eq!(x, foo::large); - assert!((x != foo::small)); -} diff --git a/src/test/ui/supported-cast.rs b/src/test/ui/supported-cast.rs deleted file mode 100644 index ff41ce6c79a..00000000000 --- a/src/test/ui/supported-cast.rs +++ /dev/null @@ -1,206 +0,0 @@ -// run-pass - -pub fn main() { - let f = 1_usize as *const String; - println!("{:?}", f as isize); - println!("{:?}", f as usize); - println!("{:?}", f as i8); - println!("{:?}", f as i16); - println!("{:?}", f as i32); - println!("{:?}", f as i64); - println!("{:?}", f as u8); - println!("{:?}", f as u16); - println!("{:?}", f as u32); - println!("{:?}", f as u64); - - println!("{:?}", 1 as isize); - println!("{:?}", 1 as usize); - println!("{:?}", 1 as *const String); - println!("{:?}", 1 as i8); - println!("{:?}", 1 as i16); - println!("{:?}", 1 as i32); - println!("{:?}", 1 as i64); - println!("{:?}", 1 as u8); - println!("{:?}", 1 as u16); - println!("{:?}", 1 as u32); - println!("{:?}", 1 as u64); - println!("{:?}", 1 as f32); - println!("{:?}", 1 as f64); - - println!("{:?}", 1_usize as isize); - println!("{:?}", 1_usize as usize); - println!("{:?}", 1_usize as *const String); - println!("{:?}", 1_usize as i8); - println!("{:?}", 1_usize as i16); - println!("{:?}", 1_usize as i32); - println!("{:?}", 1_usize as i64); - println!("{:?}", 1_usize as u8); - println!("{:?}", 1_usize as u16); - println!("{:?}", 1_usize as u32); - println!("{:?}", 1_usize as u64); - println!("{:?}", 1_usize as f32); - println!("{:?}", 1_usize as f64); - - println!("{:?}", 1i8 as isize); - println!("{:?}", 1i8 as usize); - println!("{:?}", 1i8 as *const String); - println!("{:?}", 1i8 as i8); - println!("{:?}", 1i8 as i16); - println!("{:?}", 1i8 as i32); - println!("{:?}", 1i8 as i64); - println!("{:?}", 1i8 as u8); - println!("{:?}", 1i8 as u16); - println!("{:?}", 1i8 as u32); - println!("{:?}", 1i8 as u64); - println!("{:?}", 1i8 as f32); - println!("{:?}", 1i8 as f64); - - println!("{:?}", 1u8 as isize); - println!("{:?}", 1u8 as usize); - println!("{:?}", 1u8 as *const String); - println!("{:?}", 1u8 as i8); - println!("{:?}", 1u8 as i16); - println!("{:?}", 1u8 as i32); - println!("{:?}", 1u8 as i64); - println!("{:?}", 1u8 as u8); - println!("{:?}", 1u8 as u16); - println!("{:?}", 1u8 as u32); - println!("{:?}", 1u8 as u64); - println!("{:?}", 1u8 as f32); - println!("{:?}", 1u8 as f64); - - println!("{:?}", 1i16 as isize); - println!("{:?}", 1i16 as usize); - println!("{:?}", 1i16 as *const String); - println!("{:?}", 1i16 as i8); - println!("{:?}", 1i16 as i16); - println!("{:?}", 1i16 as i32); - println!("{:?}", 1i16 as i64); - println!("{:?}", 1i16 as u8); - println!("{:?}", 1i16 as u16); - println!("{:?}", 1i16 as u32); - println!("{:?}", 1i16 as u64); - println!("{:?}", 1i16 as f32); - println!("{:?}", 1i16 as f64); - - println!("{:?}", 1u16 as isize); - println!("{:?}", 1u16 as usize); - println!("{:?}", 1u16 as *const String); - println!("{:?}", 1u16 as i8); - println!("{:?}", 1u16 as i16); - println!("{:?}", 1u16 as i32); - println!("{:?}", 1u16 as i64); - println!("{:?}", 1u16 as u8); - println!("{:?}", 1u16 as u16); - println!("{:?}", 1u16 as u32); - println!("{:?}", 1u16 as u64); - println!("{:?}", 1u16 as f32); - println!("{:?}", 1u16 as f64); - - println!("{:?}", 1i32 as isize); - println!("{:?}", 1i32 as usize); - println!("{:?}", 1i32 as *const String); - println!("{:?}", 1i32 as i8); - println!("{:?}", 1i32 as i16); - println!("{:?}", 1i32 as i32); - println!("{:?}", 1i32 as i64); - println!("{:?}", 1i32 as u8); - println!("{:?}", 1i32 as u16); - println!("{:?}", 1i32 as u32); - println!("{:?}", 1i32 as u64); - println!("{:?}", 1i32 as f32); - println!("{:?}", 1i32 as f64); - - println!("{:?}", 1u32 as isize); - println!("{:?}", 1u32 as usize); - println!("{:?}", 1u32 as *const String); - println!("{:?}", 1u32 as i8); - println!("{:?}", 1u32 as i16); - println!("{:?}", 1u32 as i32); - println!("{:?}", 1u32 as i64); - println!("{:?}", 1u32 as u8); - println!("{:?}", 1u32 as u16); - println!("{:?}", 1u32 as u32); - println!("{:?}", 1u32 as u64); - println!("{:?}", 1u32 as f32); - println!("{:?}", 1u32 as f64); - - println!("{:?}", 1i64 as isize); - println!("{:?}", 1i64 as usize); - println!("{:?}", 1i64 as *const String); - println!("{:?}", 1i64 as i8); - println!("{:?}", 1i64 as i16); - println!("{:?}", 1i64 as i32); - println!("{:?}", 1i64 as i64); - println!("{:?}", 1i64 as u8); - println!("{:?}", 1i64 as u16); - println!("{:?}", 1i64 as u32); - println!("{:?}", 1i64 as u64); - println!("{:?}", 1i64 as f32); - println!("{:?}", 1i64 as f64); - - println!("{:?}", 1u64 as isize); - println!("{:?}", 1u64 as usize); - println!("{:?}", 1u64 as *const String); - println!("{:?}", 1u64 as i8); - println!("{:?}", 1u64 as i16); - println!("{:?}", 1u64 as i32); - println!("{:?}", 1u64 as i64); - println!("{:?}", 1u64 as u8); - println!("{:?}", 1u64 as u16); - println!("{:?}", 1u64 as u32); - println!("{:?}", 1u64 as u64); - println!("{:?}", 1u64 as f32); - println!("{:?}", 1u64 as f64); - - println!("{:?}", 1u64 as isize); - println!("{:?}", 1u64 as usize); - println!("{:?}", 1u64 as *const String); - println!("{:?}", 1u64 as i8); - println!("{:?}", 1u64 as i16); - println!("{:?}", 1u64 as i32); - println!("{:?}", 1u64 as i64); - println!("{:?}", 1u64 as u8); - println!("{:?}", 1u64 as u16); - println!("{:?}", 1u64 as u32); - println!("{:?}", 1u64 as u64); - println!("{:?}", 1u64 as f32); - println!("{:?}", 1u64 as f64); - - println!("{:?}", true as isize); - println!("{:?}", true as usize); - println!("{:?}", true as i8); - println!("{:?}", true as i16); - println!("{:?}", true as i32); - println!("{:?}", true as i64); - println!("{:?}", true as u8); - println!("{:?}", true as u16); - println!("{:?}", true as u32); - println!("{:?}", true as u64); - - println!("{:?}", 1f32 as isize); - println!("{:?}", 1f32 as usize); - println!("{:?}", 1f32 as i8); - println!("{:?}", 1f32 as i16); - println!("{:?}", 1f32 as i32); - println!("{:?}", 1f32 as i64); - println!("{:?}", 1f32 as u8); - println!("{:?}", 1f32 as u16); - println!("{:?}", 1f32 as u32); - println!("{:?}", 1f32 as u64); - println!("{:?}", 1f32 as f32); - println!("{:?}", 1f32 as f64); - - println!("{:?}", 1f64 as isize); - println!("{:?}", 1f64 as usize); - println!("{:?}", 1f64 as i8); - println!("{:?}", 1f64 as i16); - println!("{:?}", 1f64 as i32); - println!("{:?}", 1f64 as i64); - println!("{:?}", 1f64 as u8); - println!("{:?}", 1f64 as u16); - println!("{:?}", 1f64 as u32); - println!("{:?}", 1f64 as u64); - println!("{:?}", 1f64 as f32); - println!("{:?}", 1f64 as f64); -} diff --git a/src/test/ui/svh/auxiliary/changing-crates-a1.rs b/src/test/ui/svh/auxiliary/changing-crates-a1.rs new file mode 100644 index 00000000000..bc0559b8b80 --- /dev/null +++ b/src/test/ui/svh/auxiliary/changing-crates-a1.rs @@ -0,0 +1,3 @@ +#![crate_name = "a"] + +pub fn foo() {} diff --git a/src/test/ui/svh/auxiliary/changing-crates-a2.rs b/src/test/ui/svh/auxiliary/changing-crates-a2.rs new file mode 100644 index 00000000000..fafc6d5b169 --- /dev/null +++ b/src/test/ui/svh/auxiliary/changing-crates-a2.rs @@ -0,0 +1,3 @@ +#![crate_name = "a"] + +pub fn foo() { println!("hello!"); } diff --git a/src/test/ui/svh/auxiliary/changing-crates-b.rs b/src/test/ui/svh/auxiliary/changing-crates-b.rs new file mode 100644 index 00000000000..f9ce29e4c4c --- /dev/null +++ b/src/test/ui/svh/auxiliary/changing-crates-b.rs @@ -0,0 +1,5 @@ +#![crate_name = "b"] + +extern crate a; + +pub fn foo() { a::foo::(); } diff --git a/src/test/ui/svh/changing-crates.rs b/src/test/ui/svh/changing-crates.rs new file mode 100644 index 00000000000..60c043bc43f --- /dev/null +++ b/src/test/ui/svh/changing-crates.rs @@ -0,0 +1,12 @@ +// ignore-msvc FIXME #31306 + +// note that these aux-build directives must be in this order +// aux-build:changing-crates-a1.rs +// aux-build:changing-crates-b.rs +// aux-build:changing-crates-a2.rs +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" + +extern crate a; +extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on + +fn main() {} diff --git a/src/test/ui/svh/changing-crates.stderr b/src/test/ui/svh/changing-crates.stderr new file mode 100644 index 00000000000..cc62a4d4d9d --- /dev/null +++ b/src/test/ui/svh/changing-crates.stderr @@ -0,0 +1,13 @@ +error[E0460]: found possibly newer version of crate `a` which `b` depends on + --> $DIR/changing-crates.rs:10:1 + | +LL | extern crate b; + | ^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `a`: $PATH_a + crate `b`: $PATH_b + +error: aborting due to previous error + diff --git a/src/test/ui/syntax-trait-polarity.rs b/src/test/ui/syntax-trait-polarity.rs deleted file mode 100644 index ed2947493b0..00000000000 --- a/src/test/ui/syntax-trait-polarity.rs +++ /dev/null @@ -1,25 +0,0 @@ -#![feature(negative_impls)] - -use std::marker::Send; - -struct TestType; - -impl !TestType {} -//~^ ERROR inherent impls cannot be negative - -trait TestTrait {} - -unsafe impl !Send for TestType {} -//~^ ERROR negative impls cannot be unsafe -impl !TestTrait for TestType {} - -struct TestType2(T); - -impl !TestType2 {} -//~^ ERROR inherent impls cannot be negative - -unsafe impl !Send for TestType2 {} -//~^ ERROR negative impls cannot be unsafe -impl !TestTrait for TestType2 {} - -fn main() {} diff --git a/src/test/ui/syntax-trait-polarity.stderr b/src/test/ui/syntax-trait-polarity.stderr deleted file mode 100644 index 1fd40fb6657..00000000000 --- a/src/test/ui/syntax-trait-polarity.stderr +++ /dev/null @@ -1,37 +0,0 @@ -error: inherent impls cannot be negative - --> $DIR/syntax-trait-polarity.rs:7:7 - | -LL | impl !TestType {} - | -^^^^^^^^ inherent impl for this type - | | - | negative because of this - -error[E0198]: negative impls cannot be unsafe - --> $DIR/syntax-trait-polarity.rs:12:13 - | -LL | unsafe impl !Send for TestType {} - | ------ -^^^^ - | | | - | | negative because of this - | unsafe because of this - -error: inherent impls cannot be negative - --> $DIR/syntax-trait-polarity.rs:18:10 - | -LL | impl !TestType2 {} - | -^^^^^^^^^^^^ inherent impl for this type - | | - | negative because of this - -error[E0198]: negative impls cannot be unsafe - --> $DIR/syntax-trait-polarity.rs:21:16 - | -LL | unsafe impl !Send for TestType2 {} - | ------ -^^^^ - | | | - | | negative because of this - | unsafe because of this - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0198`. diff --git a/src/test/ui/terminate-in-initializer.rs b/src/test/ui/terminate-in-initializer.rs deleted file mode 100644 index c9cb932e62a..00000000000 --- a/src/test/ui/terminate-in-initializer.rs +++ /dev/null @@ -1,33 +0,0 @@ -// run-pass -// ignore-emscripten no threads support - -// Issue #787 -// Don't try to clean up uninitialized locals - - -use std::thread; - -fn test_break() { loop { let _x: Box = break; } } - -fn test_cont() { let mut i = 0; while i < 1 { i += 1; let _x: Box = continue; } } - -fn test_ret() { let _x: Box = return; } - -fn test_panic() { - fn f() { let _x: Box = panic!(); } - thread::spawn(move|| f() ).join().unwrap_err(); -} - -fn test_panic_indirect() { - fn f() -> ! { panic!(); } - fn g() { let _x: Box = f(); } - thread::spawn(move|| g() ).join().unwrap_err(); -} - -pub fn main() { - test_break(); - test_cont(); - test_ret(); - test_panic(); - test_panic_indirect(); -} diff --git a/src/test/ui/test-attrs/issue-20823.rs b/src/test/ui/test-attrs/issue-20823.rs new file mode 100644 index 00000000000..9e209d5d33a --- /dev/null +++ b/src/test/ui/test-attrs/issue-20823.rs @@ -0,0 +1,5 @@ +// run-pass +// compile-flags: --test + +#[test] +pub fn foo() {} diff --git a/src/test/ui/thin-lto-global-allocator.rs b/src/test/ui/thin-lto-global-allocator.rs deleted file mode 100644 index e00c5caf97c..00000000000 --- a/src/test/ui/thin-lto-global-allocator.rs +++ /dev/null @@ -1,7 +0,0 @@ -// run-pass -// compile-flags: -Z thinlto -C codegen-units=2 - -#[global_allocator] -static A: std::alloc::System = std::alloc::System; - -fn main() {} diff --git a/src/test/ui/thinlto/all-crates.rs b/src/test/ui/thinlto/all-crates.rs deleted file mode 100644 index e910b2a9f96..00000000000 --- a/src/test/ui/thinlto/all-crates.rs +++ /dev/null @@ -1,8 +0,0 @@ -// run-pass - -// compile-flags: -Clto=thin -// no-prefer-dynamic - -fn main() { - println!("hello!"); -} diff --git a/src/test/ui/thinlto/auxiliary/dylib.rs b/src/test/ui/thinlto/auxiliary/dylib.rs deleted file mode 100644 index e8b7f8f9f47..00000000000 --- a/src/test/ui/thinlto/auxiliary/dylib.rs +++ /dev/null @@ -1,6 +0,0 @@ -// compile-flags: -Z thinlto -C codegen-units=8 - -#[inline] -pub fn foo(b: u8) { - b.to_string(); -} diff --git a/src/test/ui/thinlto/auxiliary/msvc-imp-present.rs b/src/test/ui/thinlto/auxiliary/msvc-imp-present.rs deleted file mode 100644 index 933af050a6a..00000000000 --- a/src/test/ui/thinlto/auxiliary/msvc-imp-present.rs +++ /dev/null @@ -1,11 +0,0 @@ -// no-prefer-dynamic -// compile-flags: -Z thinlto -C codegen-units=8 -C prefer-dynamic - -#![crate_type = "rlib"] -#![crate_type = "dylib"] - -pub static A: u32 = 43; - -pub mod a { - pub static A: u32 = 43; -} diff --git a/src/test/ui/thinlto/auxiliary/thin-lto-inlines-aux.rs b/src/test/ui/thinlto/auxiliary/thin-lto-inlines-aux.rs deleted file mode 100644 index 5fd3f1996dd..00000000000 --- a/src/test/ui/thinlto/auxiliary/thin-lto-inlines-aux.rs +++ /dev/null @@ -1,7 +0,0 @@ -// no-prefer-dynamic - -#![crate_type = "rlib"] - -pub fn bar() -> u32 { - 3 -} diff --git a/src/test/ui/thinlto/dylib-works.rs b/src/test/ui/thinlto/dylib-works.rs deleted file mode 100644 index 9e0782b590e..00000000000 --- a/src/test/ui/thinlto/dylib-works.rs +++ /dev/null @@ -1,9 +0,0 @@ -// run-pass - -// aux-build:dylib.rs - -extern crate dylib; - -fn main() { - dylib::foo(1); -} diff --git a/src/test/ui/thinlto/msvc-imp-present.rs b/src/test/ui/thinlto/msvc-imp-present.rs deleted file mode 100644 index 5498afb2937..00000000000 --- a/src/test/ui/thinlto/msvc-imp-present.rs +++ /dev/null @@ -1,22 +0,0 @@ -// run-pass - -// aux-build:msvc-imp-present.rs -// compile-flags: -Z thinlto -C codegen-units=8 -// no-prefer-dynamic - -// On MSVC we have a "hack" where we emit symbols that look like `_imp_$name` -// for all exported statics. This is done because we apply `dllimport` to all -// imported constants and this allows everything to actually link correctly. -// -// The ThinLTO passes aggressively remove symbols if they can, and this test -// asserts that the ThinLTO passes don't remove these compiler-generated -// `_imp_*` symbols. The external library that we link in here is compiled with -// ThinLTO and multiple codegen units and has a few exported constants. Note -// that we also namely compile the library as both a dylib and an rlib, but we -// link the rlib to ensure that we assert those generated symbols exist. - -extern crate msvc_imp_present as bar; - -fn main() { - println!("{}", bar::A); -} diff --git a/src/test/ui/thinlto/thin-lto-inlines.rs b/src/test/ui/thinlto/thin-lto-inlines.rs deleted file mode 100644 index dca7918077e..00000000000 --- a/src/test/ui/thinlto/thin-lto-inlines.rs +++ /dev/null @@ -1,30 +0,0 @@ -// run-pass - -// compile-flags: -Z thinlto -C codegen-units=8 -O -// ignore-emscripten can't inspect instructions on emscripten - -// We want to assert here that ThinLTO will inline across codegen units. There's -// not really a great way to do that in general so we sort of hack around it by -// praying two functions go into separate codegen units and then assuming that -// if inlining *doesn't* happen the first byte of the functions will differ. - -pub fn foo() -> u32 { - bar::bar() -} - -mod bar { - pub fn bar() -> u32 { - 3 - } -} - -fn main() { - println!("{} {}", foo(), bar::bar()); - - unsafe { - let foo = foo as usize as *const u8; - let bar = bar::bar as usize as *const u8; - - assert_eq!(*foo, *bar); - } -} diff --git a/src/test/ui/thinlto/thin-lto-inlines2.rs b/src/test/ui/thinlto/thin-lto-inlines2.rs deleted file mode 100644 index 1eb29657c70..00000000000 --- a/src/test/ui/thinlto/thin-lto-inlines2.rs +++ /dev/null @@ -1,28 +0,0 @@ -// run-pass - -// compile-flags: -C codegen-units=8 -O -C lto=thin -// aux-build:thin-lto-inlines-aux.rs -// no-prefer-dynamic -// ignore-emscripten can't inspect instructions on emscripten - -// We want to assert here that ThinLTO will inline across codegen units. There's -// not really a great way to do that in general so we sort of hack around it by -// praying two functions go into separate codegen units and then assuming that -// if inlining *doesn't* happen the first byte of the functions will differ. - -extern crate thin_lto_inlines_aux as bar; - -pub fn foo() -> u32 { - bar::bar() -} - -fn main() { - println!("{} {}", foo(), bar::bar()); - - unsafe { - let foo = foo as usize as *const u8; - let bar = bar::bar as usize as *const u8; - - assert_eq!(*foo, *bar); - } -} diff --git a/src/test/ui/thinlto/weak-works.rs b/src/test/ui/thinlto/weak-works.rs deleted file mode 100644 index 163a3870248..00000000000 --- a/src/test/ui/thinlto/weak-works.rs +++ /dev/null @@ -1,28 +0,0 @@ -// run-pass - -// compile-flags: -C codegen-units=8 -Z thinlto -// ignore-windows - -#![feature(linkage)] - -pub mod foo { - #[linkage = "weak"] - #[no_mangle] - pub extern "C" fn FOO() -> i32 { - 0 - } -} - -mod bar { - extern "C" { - fn FOO() -> i32; - } - - pub fn bar() -> i32 { - unsafe { FOO() } - } -} - -fn main() { - bar::bar(); -} diff --git a/src/test/ui/threads-sendsync/issue-24313.rs b/src/test/ui/threads-sendsync/issue-24313.rs new file mode 100644 index 00000000000..c28b4ca9601 --- /dev/null +++ b/src/test/ui/threads-sendsync/issue-24313.rs @@ -0,0 +1,32 @@ +// run-pass +// ignore-emscripten no threads +// ignore-sgx no processes + +use std::thread; +use std::env; +use std::process::Command; + +struct Handle(i32); + +impl Drop for Handle { + fn drop(&mut self) { panic!(); } +} + +thread_local!(static HANDLE: Handle = Handle(0)); + +fn main() { + let args = env::args().collect::>(); + if args.len() == 1 { + let out = Command::new(&args[0]).arg("test").output().unwrap(); + let stderr = std::str::from_utf8(&out.stderr).unwrap(); + assert!(stderr.contains("panicked at 'explicit panic'"), + "bad failure message:\n{}\n", stderr); + } else { + // TLS dtors are not always run on process exit + thread::spawn(|| { + HANDLE.with(|h| { + println!("{}", h.0); + }); + }).join().unwrap(); + } +} diff --git a/src/test/ui/threads-sendsync/issue-4448.rs b/src/test/ui/threads-sendsync/issue-4448.rs new file mode 100644 index 00000000000..27d0326891b --- /dev/null +++ b/src/test/ui/threads-sendsync/issue-4448.rs @@ -0,0 +1,16 @@ +// run-pass +// ignore-emscripten no threads support + +use std::sync::mpsc::channel; +use std::thread; + +pub fn main() { + let (tx, rx) = channel::<&'static str>(); + + let t = thread::spawn(move|| { + assert_eq!(rx.recv().unwrap(), "hello, world"); + }); + + tx.send("hello, world").unwrap(); + t.join().ok().unwrap(); +} diff --git a/src/test/ui/threads-sendsync/issue-8827.rs b/src/test/ui/threads-sendsync/issue-8827.rs new file mode 100644 index 00000000000..95be7616a4f --- /dev/null +++ b/src/test/ui/threads-sendsync/issue-8827.rs @@ -0,0 +1,53 @@ +// run-pass +// ignore-emscripten no threads support + +use std::thread; +use std::sync::mpsc::{channel, Receiver}; + +fn periodical(n: isize) -> Receiver { + let (chan, port) = channel(); + thread::spawn(move|| { + loop { + for _ in 1..n { + match chan.send(false) { + Ok(()) => {} + Err(..) => break, + } + } + match chan.send(true) { + Ok(()) => {} + Err(..) => break + } + } + }); + return port; +} + +fn integers() -> Receiver { + let (chan, port) = channel(); + thread::spawn(move|| { + let mut i = 1; + loop { + match chan.send(i) { + Ok(()) => {} + Err(..) => break, + } + i = i + 1; + } + }); + return port; +} + +fn main() { + let ints = integers(); + let threes = periodical(3); + let fives = periodical(5); + for _ in 1..100 { + match (ints.recv().unwrap(), threes.recv().unwrap(), fives.recv().unwrap()) { + (_, true, true) => println!("FizzBuzz"), + (_, true, false) => println!("Fizz"), + (_, false, true) => println!("Buzz"), + (i, false, false) => println!("{}", i) + } + } +} diff --git a/src/test/ui/threads-sendsync/issue-9396.rs b/src/test/ui/threads-sendsync/issue-9396.rs new file mode 100644 index 00000000000..3e7e9a51cdd --- /dev/null +++ b/src/test/ui/threads-sendsync/issue-9396.rs @@ -0,0 +1,23 @@ +// run-pass +#![allow(unused_must_use)] +#![allow(deprecated)] +// ignore-emscripten no threads support + +use std::sync::mpsc::{TryRecvError, channel}; +use std::thread; + +pub fn main() { + let (tx, rx) = channel(); + let t = thread::spawn(move||{ + thread::sleep_ms(10); + tx.send(()).unwrap(); + }); + loop { + match rx.try_recv() { + Ok(()) => break, + Err(TryRecvError::Empty) => {} + Err(TryRecvError::Disconnected) => unreachable!() + } + } + t.join(); +} diff --git a/src/test/ui/threads-sendsync/trivial-message.rs b/src/test/ui/threads-sendsync/trivial-message.rs new file mode 100644 index 00000000000..5831e867be5 --- /dev/null +++ b/src/test/ui/threads-sendsync/trivial-message.rs @@ -0,0 +1,16 @@ +// run-pass + +#![allow(unused_must_use)] +/* + This is about the simplest program that can successfully send a + message. + */ + +use std::sync::mpsc::channel; + +pub fn main() { + let (tx, rx) = channel(); + tx.send(42); + let r = rx.recv(); + println!("{:?}", r); +} diff --git a/src/test/ui/threads-sendsync/yield2.rs b/src/test/ui/threads-sendsync/yield2.rs new file mode 100644 index 00000000000..376faab0c48 --- /dev/null +++ b/src/test/ui/threads-sendsync/yield2.rs @@ -0,0 +1,8 @@ +// run-pass + +use std::thread; + +pub fn main() { + let mut i: isize = 0; + while i < 100 { i = i + 1; println!("{}", i); thread::yield_now(); } +} diff --git a/src/test/ui/trace_macros-format.rs b/src/test/ui/trace_macros-format.rs deleted file mode 100644 index afca45ca0f2..00000000000 --- a/src/test/ui/trace_macros-format.rs +++ /dev/null @@ -1,18 +0,0 @@ -#![feature(trace_macros)] - -fn main() { - trace_macros!(); //~ ERROR trace_macros! accepts only `true` or `false` - trace_macros!(1); //~ ERROR trace_macros! accepts only `true` or `false` - trace_macros!(ident); //~ ERROR trace_macros! accepts only `true` or `false` - trace_macros!(for); //~ ERROR trace_macros! accepts only `true` or `false` - trace_macros!(true,); //~ ERROR trace_macros! accepts only `true` or `false` - trace_macros!(false 1); //~ ERROR trace_macros! accepts only `true` or `false` - - - // should be fine: - macro_rules! expando { - ($x: ident) => { trace_macros!($x) } - } - - expando!(true); -} diff --git a/src/test/ui/trace_macros-format.stderr b/src/test/ui/trace_macros-format.stderr deleted file mode 100644 index c32027086aa..00000000000 --- a/src/test/ui/trace_macros-format.stderr +++ /dev/null @@ -1,38 +0,0 @@ -error: trace_macros! accepts only `true` or `false` - --> $DIR/trace_macros-format.rs:4:5 - | -LL | trace_macros!(); - | ^^^^^^^^^^^^^^^ - -error: trace_macros! accepts only `true` or `false` - --> $DIR/trace_macros-format.rs:5:5 - | -LL | trace_macros!(1); - | ^^^^^^^^^^^^^^^^ - -error: trace_macros! accepts only `true` or `false` - --> $DIR/trace_macros-format.rs:6:5 - | -LL | trace_macros!(ident); - | ^^^^^^^^^^^^^^^^^^^^ - -error: trace_macros! accepts only `true` or `false` - --> $DIR/trace_macros-format.rs:7:5 - | -LL | trace_macros!(for); - | ^^^^^^^^^^^^^^^^^^ - -error: trace_macros! accepts only `true` or `false` - --> $DIR/trace_macros-format.rs:8:5 - | -LL | trace_macros!(true,); - | ^^^^^^^^^^^^^^^^^^^^ - -error: trace_macros! accepts only `true` or `false` - --> $DIR/trace_macros-format.rs:9:5 - | -LL | trace_macros!(false 1); - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 6 previous errors - diff --git a/src/test/ui/traits/issue-24010.rs b/src/test/ui/traits/issue-24010.rs new file mode 100644 index 00000000000..f1818533487 --- /dev/null +++ b/src/test/ui/traits/issue-24010.rs @@ -0,0 +1,14 @@ +// run-pass + +trait Foo: Fn(i32) -> i32 + Send {} + +impl i32 + Send> Foo for T {} + +fn wants_foo(f: Box) -> i32 { + f(42) +} + +fn main() { + let f = Box::new(|x| x); + assert_eq!(wants_foo(f), 42); +} diff --git a/src/test/ui/traits/issue-38604.rs b/src/test/ui/traits/issue-38604.rs new file mode 100644 index 00000000000..002a3c43fcb --- /dev/null +++ b/src/test/ui/traits/issue-38604.rs @@ -0,0 +1,16 @@ +trait Q {} +trait Foo where u32: Q { + fn foo(&self); +} + +impl Q<()> for u32 {} +impl Foo for () { + fn foo(&self) { + println!("foo!"); + } +} + +fn main() { + let _f: Box = //~ ERROR `Foo` cannot be made into an object + Box::new(()); //~ ERROR `Foo` cannot be made into an object +} diff --git a/src/test/ui/traits/issue-38604.stderr b/src/test/ui/traits/issue-38604.stderr new file mode 100644 index 00000000000..d41488c15f7 --- /dev/null +++ b/src/test/ui/traits/issue-38604.stderr @@ -0,0 +1,33 @@ +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/issue-38604.rs:14:13 + | +LL | let _f: Box = + | ^^^^^^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/issue-38604.rs:2:22 + | +LL | trait Foo where u32: Q { + | --- ^^^^^^^ ...because it uses `Self` as a type parameter + | | + | this trait cannot be made into an object... + +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/issue-38604.rs:15:9 + | +LL | Box::new(()); + | ^^^^^^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/issue-38604.rs:2:22 + | +LL | trait Foo where u32: Q { + | --- ^^^^^^^ ...because it uses `Self` as a type parameter + | | + | this trait cannot be made into an object... + = note: required because of the requirements on the impl of `CoerceUnsized>` for `Box<()>` + = note: required by cast to type `Box` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0038`. diff --git a/src/test/ui/traits/issue-3973.rs b/src/test/ui/traits/issue-3973.rs new file mode 100644 index 00000000000..a5ed5b87051 --- /dev/null +++ b/src/test/ui/traits/issue-3973.rs @@ -0,0 +1,25 @@ +struct Point { + x: f64, + y: f64, +} + +trait ToString_ { + fn to_string(&self) -> String; +} + +impl ToString_ for Point { + fn new(x: f64, y: f64) -> Point { + //~^ ERROR method `new` is not a member of trait `ToString_` + Point { x: x, y: y } + } + + fn to_string(&self) -> String { + format!("({}, {})", self.x, self.y) + } +} + +fn main() { + let p = Point::new(0.0, 0.0); + //~^ ERROR no function or associated item named `new` found for struct `Point` + println!("{}", p.to_string()); +} diff --git a/src/test/ui/traits/issue-3973.stderr b/src/test/ui/traits/issue-3973.stderr new file mode 100644 index 00000000000..63282e8d86d --- /dev/null +++ b/src/test/ui/traits/issue-3973.stderr @@ -0,0 +1,22 @@ +error[E0407]: method `new` is not a member of trait `ToString_` + --> $DIR/issue-3973.rs:11:5 + | +LL | / fn new(x: f64, y: f64) -> Point { +LL | | +LL | | Point { x: x, y: y } +LL | | } + | |_____^ not a member of trait `ToString_` + +error[E0599]: no function or associated item named `new` found for struct `Point` in the current scope + --> $DIR/issue-3973.rs:22:20 + | +LL | struct Point { + | ------------ function or associated item `new` not found for this +... +LL | let p = Point::new(0.0, 0.0); + | ^^^ function or associated item not found in `Point` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0407, E0599. +For more information about an error, try `rustc --explain E0407`. diff --git a/src/test/ui/traits/issue-59029-1.rs b/src/test/ui/traits/issue-59029-1.rs new file mode 100644 index 00000000000..8ab47a4af1d --- /dev/null +++ b/src/test/ui/traits/issue-59029-1.rs @@ -0,0 +1,9 @@ +#![feature(trait_alias)] + +trait Svc { type Res; } + +trait MkSvc = Svc where Self::Res: Svc; +//~^ ERROR associated type `Res` not found for `Self` +//~| ERROR associated type `Res` not found for `Self` + +fn main() {} diff --git a/src/test/ui/traits/issue-59029-1.stderr b/src/test/ui/traits/issue-59029-1.stderr new file mode 100644 index 00000000000..53cdb8b1baf --- /dev/null +++ b/src/test/ui/traits/issue-59029-1.stderr @@ -0,0 +1,15 @@ +error[E0220]: associated type `Res` not found for `Self` + --> $DIR/issue-59029-1.rs:5:52 + | +LL | trait MkSvc = Svc where Self::Res: Svc; + | ^^^ associated type `Res` not found + +error[E0220]: associated type `Res` not found for `Self` + --> $DIR/issue-59029-1.rs:5:52 + | +LL | trait MkSvc = Svc where Self::Res: Svc; + | ^^^ associated type `Res` not found + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0220`. diff --git a/src/test/ui/traits/issue-72455.rs b/src/test/ui/traits/issue-72455.rs new file mode 100644 index 00000000000..b6c3bb22287 --- /dev/null +++ b/src/test/ui/traits/issue-72455.rs @@ -0,0 +1,27 @@ +// check-pass + +pub trait ResultExt { + type Ok; + fn err_eprint_and_ignore(self) -> Option; +} + +impl ResultExt for std::result::Result +where + E: std::error::Error, +{ + type Ok = O; + fn err_eprint_and_ignore(self) -> Option + where + Self: , + { + match self { + Err(e) => { + eprintln!("{}", e); + None + } + Ok(o) => Some(o), + } + } +} + +fn main() {} diff --git a/src/test/ui/traits/object-does-not-impl-trait.rs b/src/test/ui/traits/object-does-not-impl-trait.rs new file mode 100644 index 00000000000..b3b679813c9 --- /dev/null +++ b/src/test/ui/traits/object-does-not-impl-trait.rs @@ -0,0 +1,8 @@ +// Test that an object type `Box` is not considered to implement the +// trait `Foo`. Issue #5087. + +trait Foo {} +fn take_foo(f: F) {} +fn take_object(f: Box) { take_foo(f); } +//~^ ERROR `Box: Foo` is not satisfied +fn main() {} diff --git a/src/test/ui/traits/object-does-not-impl-trait.stderr b/src/test/ui/traits/object-does-not-impl-trait.stderr new file mode 100644 index 00000000000..f1dd508a467 --- /dev/null +++ b/src/test/ui/traits/object-does-not-impl-trait.stderr @@ -0,0 +1,17 @@ +error[E0277]: the trait bound `Box: Foo` is not satisfied + --> $DIR/object-does-not-impl-trait.rs:6:44 + | +LL | fn take_object(f: Box) { take_foo(f); } + | -------- ^ the trait `Foo` is not implemented for `Box` + | | + | required by a bound introduced by this call + | +note: required by a bound in `take_foo` + --> $DIR/object-does-not-impl-trait.rs:5:15 + | +LL | fn take_foo(f: F) {} + | ^^^ required by this bound in `take_foo` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/traits/syntax-trait-polarity.rs b/src/test/ui/traits/syntax-trait-polarity.rs new file mode 100644 index 00000000000..ed2947493b0 --- /dev/null +++ b/src/test/ui/traits/syntax-trait-polarity.rs @@ -0,0 +1,25 @@ +#![feature(negative_impls)] + +use std::marker::Send; + +struct TestType; + +impl !TestType {} +//~^ ERROR inherent impls cannot be negative + +trait TestTrait {} + +unsafe impl !Send for TestType {} +//~^ ERROR negative impls cannot be unsafe +impl !TestTrait for TestType {} + +struct TestType2(T); + +impl !TestType2 {} +//~^ ERROR inherent impls cannot be negative + +unsafe impl !Send for TestType2 {} +//~^ ERROR negative impls cannot be unsafe +impl !TestTrait for TestType2 {} + +fn main() {} diff --git a/src/test/ui/traits/syntax-trait-polarity.stderr b/src/test/ui/traits/syntax-trait-polarity.stderr new file mode 100644 index 00000000000..1fd40fb6657 --- /dev/null +++ b/src/test/ui/traits/syntax-trait-polarity.stderr @@ -0,0 +1,37 @@ +error: inherent impls cannot be negative + --> $DIR/syntax-trait-polarity.rs:7:7 + | +LL | impl !TestType {} + | -^^^^^^^^ inherent impl for this type + | | + | negative because of this + +error[E0198]: negative impls cannot be unsafe + --> $DIR/syntax-trait-polarity.rs:12:13 + | +LL | unsafe impl !Send for TestType {} + | ------ -^^^^ + | | | + | | negative because of this + | unsafe because of this + +error: inherent impls cannot be negative + --> $DIR/syntax-trait-polarity.rs:18:10 + | +LL | impl !TestType2 {} + | -^^^^^^^^^^^^ inherent impl for this type + | | + | negative because of this + +error[E0198]: negative impls cannot be unsafe + --> $DIR/syntax-trait-polarity.rs:21:16 + | +LL | unsafe impl !Send for TestType2 {} + | ------ -^^^^ + | | | + | | negative because of this + | unsafe because of this + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0198`. diff --git a/src/test/ui/transmute-specialization.rs b/src/test/ui/transmute-specialization.rs deleted file mode 100644 index 499334d983b..00000000000 --- a/src/test/ui/transmute-specialization.rs +++ /dev/null @@ -1,15 +0,0 @@ -// run-pass - -#![feature(specialization)] //~ WARN the feature `specialization` is incomplete - -trait Specializable { type Output; } - -impl Specializable for T { - default type Output = u16; -} - -fn main() { - unsafe { - std::mem::transmute::::Output>(0); - } -} diff --git a/src/test/ui/transmute-specialization.stderr b/src/test/ui/transmute-specialization.stderr deleted file mode 100644 index a0ea72415a1..00000000000 --- a/src/test/ui/transmute-specialization.stderr +++ /dev/null @@ -1,12 +0,0 @@ -warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/transmute-specialization.rs:3:12 - | -LL | #![feature(specialization)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #31844 for more information - = help: consider using `min_specialization` instead, which is more stable and complete - -warning: 1 warning emitted - diff --git a/src/test/ui/trivial-message.rs b/src/test/ui/trivial-message.rs deleted file mode 100644 index 5831e867be5..00000000000 --- a/src/test/ui/trivial-message.rs +++ /dev/null @@ -1,16 +0,0 @@ -// run-pass - -#![allow(unused_must_use)] -/* - This is about the simplest program that can successfully send a - message. - */ - -use std::sync::mpsc::channel; - -pub fn main() { - let (tx, rx) = channel(); - tx.send(42); - let r = rx.recv(); - println!("{:?}", r); -} diff --git a/src/test/ui/try-block/issue-45124.rs b/src/test/ui/try-block/issue-45124.rs new file mode 100644 index 00000000000..942014c9184 --- /dev/null +++ b/src/test/ui/try-block/issue-45124.rs @@ -0,0 +1,18 @@ +// run-pass +#![allow(unreachable_code)] +// compile-flags: --edition 2018 + +#![feature(try_blocks)] + +fn main() { + let mut a = 0; + let () = { + let _: Result<(), ()> = try { + let _ = Err(())?; + return + }; + a += 1; + }; + a += 2; + assert_eq!(a, 3); +} diff --git a/src/test/ui/try-macro-suggestion.rs b/src/test/ui/try-macro-suggestion.rs deleted file mode 100644 index 635ceac0b19..00000000000 --- a/src/test/ui/try-macro-suggestion.rs +++ /dev/null @@ -1,9 +0,0 @@ -// compile-flags: --edition 2018 -fn foo() -> Result<(), ()> { - Ok(try!()); //~ ERROR use of deprecated `try` macro - Ok(try!(Ok(()))) //~ ERROR use of deprecated `try` macro -} - -fn main() { - let _ = foo(); -} diff --git a/src/test/ui/try-macro-suggestion.stderr b/src/test/ui/try-macro-suggestion.stderr deleted file mode 100644 index c7dde7eeac3..00000000000 --- a/src/test/ui/try-macro-suggestion.stderr +++ /dev/null @@ -1,31 +0,0 @@ -error: use of deprecated `try` macro - --> $DIR/try-macro-suggestion.rs:3:8 - | -LL | Ok(try!()); - | ^^^^^^ - | - = note: in the 2018 edition `try` is a reserved keyword, and the `try!()` macro is deprecated -help: you can still access the deprecated `try!()` macro using the "raw identifier" syntax - | -LL | Ok(r#try!()); - | ++ - -error: use of deprecated `try` macro - --> $DIR/try-macro-suggestion.rs:4:8 - | -LL | Ok(try!(Ok(()))) - | ^^^^^^^^^^^^ - | - = note: in the 2018 edition `try` is a reserved keyword, and the `try!()` macro is deprecated -help: you can use the `?` operator instead - | -LL - Ok(try!(Ok(()))) -LL + Ok(Ok(())?) - | -help: alternatively, you can still access the deprecated `try!()` macro using the "raw identifier" syntax - | -LL | Ok(r#try!(Ok(()))) - | ++ - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/type-alias-impl-trait/issue-60662.rs b/src/test/ui/type-alias-impl-trait/issue-60662.rs new file mode 100644 index 00000000000..b9faa668b80 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/issue-60662.rs @@ -0,0 +1,10 @@ +// check-pass +// compile-flags: -Z unpretty=hir + +#![feature(type_alias_impl_trait)] + +trait Animal {} + +fn main() { + pub type ServeFut = impl Animal; +} diff --git a/src/test/ui/type-alias-impl-trait/issue-60662.stdout b/src/test/ui/type-alias-impl-trait/issue-60662.stdout new file mode 100644 index 00000000000..14a49f20e6b --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/issue-60662.stdout @@ -0,0 +1,14 @@ +// check-pass +// compile-flags: -Z unpretty=hir + +#![feature(type_alias_impl_trait)] +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; + +trait Animal { } + +fn main() { + pub type ServeFut = /*impl Trait*/; + } diff --git a/src/test/ui/type-inference/issue-30225.rs b/src/test/ui/type-inference/issue-30225.rs new file mode 100644 index 00000000000..42315332c20 --- /dev/null +++ b/src/test/ui/type-inference/issue-30225.rs @@ -0,0 +1,38 @@ +// Regression test for #30225, which was an ICE that would trigger as +// a result of a poor interaction between trait result caching and +// type inference. Specifically, at that time, unification could cause +// unrelated type variables to become instantiated, if subtyping +// relationships existed. These relationships are now propagated +// through obligations and hence everything works out fine. + +trait Foo : Sized { + fn foo(self, u: Option, v: Option) {} +} + +struct A; +struct B; + +impl Foo for () {} // impl A +impl Foo for u32 {} // impl B, creating ambiguity + +fn toxic() { + // cache the resolution <() as Foo<$0,$1>> = impl A + let u = None; + let v = None; + Foo::foo((), u, v); +} + +fn bomb() { + let mut u = None; // type is Option<$0> + let mut v = None; // type is Option<$1> + let mut x = None; // type is Option<$2> + + Foo::foo(x.unwrap(),u,v); // register <$2 as Foo<$0, $1>> + u = v; // mark $0 and $1 in a subtype relationship + //~^ ERROR mismatched types + x = Some(()); // set $2 = (), allowing impl selection + // to proceed for <() as Foo<$0, $1>> = impl A. + // kaboom, this *used* to trigge an ICE +} + +fn main() {} diff --git a/src/test/ui/type-inference/issue-30225.stderr b/src/test/ui/type-inference/issue-30225.stderr new file mode 100644 index 00000000000..ccd05fa6bfb --- /dev/null +++ b/src/test/ui/type-inference/issue-30225.stderr @@ -0,0 +1,9 @@ +error[E0308]: mismatched types + --> $DIR/issue-30225.rs:31:9 + | +LL | u = v; // mark $0 and $1 in a subtype relationship + | ^ expected struct `A`, found struct `B` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/typeck/auxiliary/xcrate-issue-43189-a.rs b/src/test/ui/typeck/auxiliary/xcrate-issue-43189-a.rs new file mode 100644 index 00000000000..9ab570fd170 --- /dev/null +++ b/src/test/ui/typeck/auxiliary/xcrate-issue-43189-a.rs @@ -0,0 +1,7 @@ +#![crate_type="lib"] + + +pub trait A { + fn a(&self) {} +} +impl A for () {} diff --git a/src/test/ui/typeck/auxiliary/xcrate-issue-43189-b.rs b/src/test/ui/typeck/auxiliary/xcrate-issue-43189-b.rs new file mode 100644 index 00000000000..31dfb050b27 --- /dev/null +++ b/src/test/ui/typeck/auxiliary/xcrate-issue-43189-b.rs @@ -0,0 +1,3 @@ +#![crate_type="lib"] + +pub extern crate xcrate_issue_43189_a; diff --git a/src/test/ui/typeck/auxiliary/xcrate-issue-46112-rexport-core.rs b/src/test/ui/typeck/auxiliary/xcrate-issue-46112-rexport-core.rs new file mode 100644 index 00000000000..2b517b5784a --- /dev/null +++ b/src/test/ui/typeck/auxiliary/xcrate-issue-46112-rexport-core.rs @@ -0,0 +1,3 @@ +#![crate_type="lib"] + +pub extern crate core; diff --git a/src/test/ui/typeck/auxiliary/xcrate-issue-61711-b.rs b/src/test/ui/typeck/auxiliary/xcrate-issue-61711-b.rs new file mode 100644 index 00000000000..88a040529e7 --- /dev/null +++ b/src/test/ui/typeck/auxiliary/xcrate-issue-61711-b.rs @@ -0,0 +1,5 @@ +// edition:2018 +#![crate_type="lib"] +#![crate_name="xcrate_issue_61711_b"] +pub struct Struct; +pub use crate as alias; diff --git a/src/test/ui/typeck/issue-43189.rs b/src/test/ui/typeck/issue-43189.rs new file mode 100644 index 00000000000..ce667a5006e --- /dev/null +++ b/src/test/ui/typeck/issue-43189.rs @@ -0,0 +1,12 @@ +// Issue 46112: An extern crate pub re-exporting libcore was causing +// paths rooted from `std` to be misrendered in the diagnostic output. + +// ignore-windows +// aux-build:xcrate-issue-43189-a.rs +// aux-build:xcrate-issue-43189-b.rs + +extern crate xcrate_issue_43189_b; +fn main() { + ().a(); + //~^ ERROR no method named `a` found +} diff --git a/src/test/ui/typeck/issue-43189.stderr b/src/test/ui/typeck/issue-43189.stderr new file mode 100644 index 00000000000..caf7530b85a --- /dev/null +++ b/src/test/ui/typeck/issue-43189.stderr @@ -0,0 +1,20 @@ +error[E0599]: no method named `a` found for unit type `()` in the current scope + --> $DIR/issue-43189.rs:10:8 + | +LL | ().a(); + | ^ method not found in `()` + | + ::: $DIR/auxiliary/xcrate-issue-43189-a.rs:5:8 + | +LL | fn a(&self) {} + | - the method is available for `()` here + | + = help: items from traits can only be used if the trait is in scope +help: the following trait is implemented but not in scope; perhaps add a `use` for it: + | +LL | use xcrate_issue_43189_b::xcrate_issue_43189_a::A; + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/typeck/issue-46112.rs b/src/test/ui/typeck/issue-46112.rs new file mode 100644 index 00000000000..0cdd2c27ff7 --- /dev/null +++ b/src/test/ui/typeck/issue-46112.rs @@ -0,0 +1,10 @@ +// Issue 46112: An extern crate pub re-exporting libcore was causing +// paths rooted from `std` to be misrendered in the diagnostic output. + +// ignore-windows +// aux-build:xcrate-issue-46112-rexport-core.rs + +extern crate xcrate_issue_46112_rexport_core; +fn test(r: Result, &'static str>) { } +fn main() { test(Ok(())); } +//~^ mismatched types diff --git a/src/test/ui/typeck/issue-46112.stderr b/src/test/ui/typeck/issue-46112.stderr new file mode 100644 index 00000000000..ec05fbe580e --- /dev/null +++ b/src/test/ui/typeck/issue-46112.stderr @@ -0,0 +1,15 @@ +error[E0308]: mismatched types + --> $DIR/issue-46112.rs:9:21 + | +LL | fn main() { test(Ok(())); } + | ^^ + | | + | expected enum `Option`, found `()` + | help: try using a variant of the expected enum: `Some(())` + | + = note: expected enum `Option<()>` + found unit type `()` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/typeck/issue-61711-once-caused-rustc-inf-loop.rs b/src/test/ui/typeck/issue-61711-once-caused-rustc-inf-loop.rs new file mode 100644 index 00000000000..de7d6a0d80c --- /dev/null +++ b/src/test/ui/typeck/issue-61711-once-caused-rustc-inf-loop.rs @@ -0,0 +1,11 @@ +// Issue 61711: A crate pub re-exporting `crate` was causing an +// infinite loop. + +// edition:2018 +// aux-build:xcrate-issue-61711-b.rs +// compile-flags:--extern xcrate_issue_61711_b + +// build-pass + +fn f(_: F) { } +fn main() { } diff --git a/src/test/ui/unary-minus-suffix-inference.rs b/src/test/ui/unary-minus-suffix-inference.rs deleted file mode 100644 index a4d0a849484..00000000000 --- a/src/test/ui/unary-minus-suffix-inference.rs +++ /dev/null @@ -1,23 +0,0 @@ -// run-pass - -pub fn main() { - let a = 1; - let a_neg: i8 = -a; - println!("{}", a_neg); - - let b = 1; - let b_neg: i16 = -b; - println!("{}", b_neg); - - let c = 1; - let c_neg: i32 = -c; - println!("{}", c_neg); - - let d = 1; - let d_neg: i64 = -d; - println!("{}", d_neg); - - let e = 1; - let e_neg: isize = -e; - println!("{}", e_neg); -} diff --git a/src/test/ui/unboxed-closures/issue-18652.rs b/src/test/ui/unboxed-closures/issue-18652.rs new file mode 100644 index 00000000000..59aa0156842 --- /dev/null +++ b/src/test/ui/unboxed-closures/issue-18652.rs @@ -0,0 +1,10 @@ +// run-pass +// Tests multiple free variables being passed by value into an unboxed +// once closure as an optimization by codegen. This used to hit an +// incorrect assert. + +fn main() { + let x = 2u8; + let y = 3u8; + assert_eq!((move || x + y)(), 5); +} diff --git a/src/test/ui/unnecessary-extern-crate.rs b/src/test/ui/unnecessary-extern-crate.rs deleted file mode 100644 index 67eaaf4b6c2..00000000000 --- a/src/test/ui/unnecessary-extern-crate.rs +++ /dev/null @@ -1,71 +0,0 @@ -// edition:2018 - -#![deny(unused_extern_crates)] -#![feature(test, rustc_private, crate_visibility_modifier)] - -extern crate libc; -//~^ ERROR unused extern crate -//~| HELP remove -extern crate libc as x; -//~^ ERROR unused extern crate -//~| HELP remove - -extern crate proc_macro; - -#[macro_use] -extern crate test; - -pub extern crate test as y; - -pub extern crate alloc; - -pub(crate) extern crate alloc as a; - -crate extern crate alloc as b; - -mod foo { - pub(in crate::foo) extern crate alloc as c; - - pub(super) extern crate alloc as d; - - extern crate libc; - //~^ ERROR unused extern crate - //~| HELP remove - - extern crate libc as x; - //~^ ERROR unused extern crate - //~| HELP remove - - pub extern crate test; - - pub extern crate test as y; - - mod bar { - extern crate libc; - //~^ ERROR unused extern crate - //~| HELP remove - - extern crate libc as x; - //~^ ERROR unused extern crate - //~| HELP remove - - pub(in crate::foo::bar) extern crate alloc as e; - - fn dummy() { - e::string::String::new(); - } - } - - fn dummy() { - c::string::String::new(); - d::string::String::new(); - } -} - - -fn main() { - a::string::String::new(); - b::string::String::new(); - - proc_macro::TokenStream::new(); -} diff --git a/src/test/ui/unnecessary-extern-crate.stderr b/src/test/ui/unnecessary-extern-crate.stderr deleted file mode 100644 index 14ba9d052f4..00000000000 --- a/src/test/ui/unnecessary-extern-crate.stderr +++ /dev/null @@ -1,44 +0,0 @@ -error: unused extern crate - --> $DIR/unnecessary-extern-crate.rs:6:1 - | -LL | extern crate libc; - | ^^^^^^^^^^^^^^^^^^ help: remove it - | -note: the lint level is defined here - --> $DIR/unnecessary-extern-crate.rs:3:9 - | -LL | #![deny(unused_extern_crates)] - | ^^^^^^^^^^^^^^^^^^^^ - -error: unused extern crate - --> $DIR/unnecessary-extern-crate.rs:9:1 - | -LL | extern crate libc as x; - | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it - -error: unused extern crate - --> $DIR/unnecessary-extern-crate.rs:31:5 - | -LL | extern crate libc; - | ^^^^^^^^^^^^^^^^^^ help: remove it - -error: unused extern crate - --> $DIR/unnecessary-extern-crate.rs:35:5 - | -LL | extern crate libc as x; - | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it - -error: unused extern crate - --> $DIR/unnecessary-extern-crate.rs:44:9 - | -LL | extern crate libc; - | ^^^^^^^^^^^^^^^^^^ help: remove it - -error: unused extern crate - --> $DIR/unnecessary-extern-crate.rs:48:9 - | -LL | extern crate libc as x; - | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it - -error: aborting due to 6 previous errors - diff --git a/src/test/ui/unrestricted-attribute-tokens.rs b/src/test/ui/unrestricted-attribute-tokens.rs deleted file mode 100644 index e31bc91a00a..00000000000 --- a/src/test/ui/unrestricted-attribute-tokens.rs +++ /dev/null @@ -1,8 +0,0 @@ -// build-pass (FIXME(62277): could be check-pass?) - -#![feature(rustc_attrs)] - -#[rustc_dummy(a b c d)] -#[rustc_dummy[a b c d]] -#[rustc_dummy{a b c d}] -fn main() {} diff --git a/src/test/ui/unsized/issue-30355.rs b/src/test/ui/unsized/issue-30355.rs new file mode 100644 index 00000000000..6ff5b37f6e5 --- /dev/null +++ b/src/test/ui/unsized/issue-30355.rs @@ -0,0 +1,9 @@ +pub struct X([u8]); + +pub static Y: &'static X = { + const Y: &'static [u8] = b""; + &X(*Y) + //~^ ERROR E0277 +}; + +fn main() {} diff --git a/src/test/ui/unsized/issue-30355.stderr b/src/test/ui/unsized/issue-30355.stderr new file mode 100644 index 00000000000..71bbdf5dec7 --- /dev/null +++ b/src/test/ui/unsized/issue-30355.stderr @@ -0,0 +1,13 @@ +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/issue-30355.rs:5:8 + | +LL | &X(*Y) + | ^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[u8]` + = note: all function arguments must have a statically known size + = help: unsized fn params are gated as an unstable feature + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/warn-ctypes-inhibit.rs b/src/test/ui/warn-ctypes-inhibit.rs deleted file mode 100644 index 15d8b09d2ec..00000000000 --- a/src/test/ui/warn-ctypes-inhibit.rs +++ /dev/null @@ -1,15 +0,0 @@ -// run-pass - -#![allow(dead_code)] -// compile-flags:-D improper-ctypes - -// pretty-expanded FIXME #23616 -#![allow(improper_ctypes)] - -mod libc { - extern "C" { - pub fn malloc(size: isize) -> *const u8; - } -} - -pub fn main() {} diff --git a/src/test/ui/yield2.rs b/src/test/ui/yield2.rs deleted file mode 100644 index 376faab0c48..00000000000 --- a/src/test/ui/yield2.rs +++ /dev/null @@ -1,8 +0,0 @@ -// run-pass - -use std::thread; - -pub fn main() { - let mut i: isize = 0; - while i < 100 { i = i + 1; println!("{}", i); thread::yield_now(); } -} -- cgit 1.4.1-3-g733a5