From fe30743c79018b2a73151440f5d8948d0979ac62 Mon Sep 17 00:00:00 2001 From: Alexander Regueiro Date: Tue, 12 Mar 2019 00:49:17 +0000 Subject: Moved issue tests to subdirs and normalised names. --- src/test/debuginfo/auxiliary/issue-13213-aux.rs | 19 ++ src/test/debuginfo/auxiliary/issue13213aux.rs | 19 -- src/test/debuginfo/issue-13213.rs | 6 +- .../incremental/auxiliary/issue-49482-macro-def.rs | 40 ++++ .../incremental/auxiliary/issue-49482-reexport.rs | 6 + src/test/incremental/auxiliary/issue-54059.rs | 50 +++++ .../incremental/auxiliary/issue_49482_macro_def.rs | 40 ---- .../incremental/auxiliary/issue_49482_reexport.rs | 6 - src/test/incremental/auxiliary/issue_54059.rs | 50 ----- src/test/incremental/issue-49482.rs | 4 +- src/test/incremental/issue-49595/issue-49595.rs | 31 +++ src/test/incremental/issue-49595/issue_49595.rs | 31 --- src/test/incremental/issue-54059.rs | 2 +- src/test/pretty/issue-12590-a.rs | 8 + src/test/pretty/issue-12590-b.rs | 5 + src/test/pretty/issue-12590-c.pp | 19 ++ src/test/pretty/issue-12590-c.rs | 10 + src/test/pretty/issue_12590_a.rs | 7 - src/test/pretty/issue_12590_b.rs | 4 - src/test/pretty/issue_12590_c.pp | 18 -- src/test/pretty/issue_12590_c.rs | 9 - .../auxiliary/custom-derive-partial-eq.rs | 71 +++++++ .../auxiliary/custom-derive-plugin-attr.rs | 84 +++++++++ .../auxiliary/custom-derive-plugin.rs | 76 ++++++++ .../auxiliary/custom_derive_partial_eq.rs | 71 ------- .../auxiliary/custom_derive_plugin.rs | 76 -------- .../auxiliary/custom_derive_plugin_attr.rs | 84 --------- .../run-pass-fulldeps/auxiliary/issue-24106.rs | 13 ++ .../run-pass-fulldeps/auxiliary/issue_24106.rs | 13 -- .../run-pass-fulldeps/auxiliary/lint-for-crate.rs | 72 +++++++ .../run-pass-fulldeps/auxiliary/lint_for_crate.rs | 72 ------- .../auxiliary/llvm-pass-plugin.rs | 19 ++ .../auxiliary/llvm_pass_plugin.rs | 19 -- .../auxiliary/macro-crate-test.rs | 34 ++++ .../auxiliary/macro_crate_test.rs | 34 ---- .../run-pass-fulldeps/auxiliary/plugin-args.rs | 52 ++++++ .../run-pass-fulldeps/auxiliary/plugin_args.rs | 52 ------ .../run-pass-fulldeps/auxiliary/roman-numerals.rs | 69 +++++++ .../run-pass-fulldeps/auxiliary/roman_numerals.rs | 69 ------- .../auxiliary/syntax-extension-with-dll-deps-1.rs | 7 + .../auxiliary/syntax_extension_with_dll_deps_1.rs | 7 - .../run-pass-fulldeps/custom-derive-partial-eq.rs | 2 +- src/test/run-pass-fulldeps/derive-totalsum-attr.rs | 2 +- src/test/run-pass-fulldeps/derive-totalsum.rs | 2 +- src/test/run-pass-fulldeps/issue-15778-pass.rs | 2 +- src/test/run-pass-fulldeps/issue-24106.rs | 7 + src/test/run-pass-fulldeps/issue-40663.rs | 2 +- src/test/run-pass-fulldeps/issue_24106.rs | 7 - src/test/run-pass-fulldeps/llvm-pass-plugin.rs | 2 +- .../macro-crate-multi-decorator.rs | 2 +- src/test/run-pass-fulldeps/plugin-args-1.rs | 2 +- src/test/run-pass-fulldeps/plugin-args-2.rs | 2 +- src/test/run-pass-fulldeps/plugin-args-3.rs | 2 +- src/test/run-pass-fulldeps/roman-numerals-macro.rs | 2 +- src/test/run-pass/auxiliary/rmeta-rlib.rs | 8 + src/test/run-pass/auxiliary/rmeta-rmeta.rs | 9 + src/test/run-pass/auxiliary/rmeta_rlib.rs | 8 - src/test/run-pass/auxiliary/rmeta_rmeta.rs | 9 - src/test/run-pass/issue-18952.rs | 56 ------ src/test/run-pass/issue-45510.rs | 32 ---- src/test/run-pass/issue-48006.rs | 13 -- src/test/run-pass/issue-53728.rs | 17 -- src/test/run-pass/issue-53843.rs | 24 --- .../issue-54462-mutable-noalias-correctness.rs | 24 --- src/test/run-pass/issue-54467.rs | 44 ----- src/test/run-pass/issue-55376.rs | 15 -- src/test/run-pass/issue-55380.rs | 28 --- src/test/run-pass/issue-56237.rs | 11 -- .../run-pass/issues/auxiliary/issue-10031-aux.rs | 1 + .../run-pass/issues/auxiliary/issue-12612-1.rs | 3 + .../run-pass/issues/auxiliary/issue-12612-2.rs | 1 + src/test/run-pass/issues/auxiliary/issue-13507.rs | 87 +++++++++ src/test/run-pass/issues/auxiliary/issue-19293.rs | 4 + src/test/run-pass/issues/auxiliary/issue-20389.rs | 4 + .../run-pass/issues/auxiliary/issue-2170-lib.rs | 18 ++ src/test/run-pass/issues/auxiliary/issue-2316-a.rs | 3 + src/test/run-pass/issues/auxiliary/issue-2316-b.rs | 11 ++ src/test/run-pass/issues/auxiliary/issue-2472-b.rs | 13 ++ src/test/run-pass/issues/auxiliary/issue-2723-a.rs | 3 + src/test/run-pass/issues/auxiliary/issue-3136-a.rc | 4 + src/test/run-pass/issues/auxiliary/issue-3136-a.rs | 14 ++ .../run-pass/issues/auxiliary/issue-34796-aux.rs | 20 ++ src/test/run-pass/issues/auxiliary/issue-38190.rs | 2 + .../run-pass/issues/auxiliary/issue-38226-aux.rs | 23 +++ .../issues/auxiliary/issue-38715-modern.rs | 7 + src/test/run-pass/issues/auxiliary/issue-38715.rs | 7 + .../run-pass/issues/auxiliary/issue-3979-traits.rs | 15 ++ src/test/run-pass/issues/auxiliary/issue-39823.rs | 7 + src/test/run-pass/issues/auxiliary/issue-40469.rs | 1 + src/test/run-pass/issues/auxiliary/issue-41053.rs | 1 + .../run-pass/issues/auxiliary/issue-42007-s.rs | 4 + src/test/run-pass/issues/auxiliary/issue-8401.rs | 16 ++ src/test/run-pass/issues/auxiliary/issue-9123.rs | 9 + src/test/run-pass/issues/auxiliary/issue-9155.rs | 7 + src/test/run-pass/issues/auxiliary/issue-9188.rs | 13 ++ src/test/run-pass/issues/auxiliary/issue13507.rs | 87 --------- src/test/run-pass/issues/auxiliary/issue2170lib.rs | 18 -- .../run-pass/issues/auxiliary/issue34796aux.rs | 20 -- .../run-pass/issues/auxiliary/issue_10031_aux.rs | 1 - .../run-pass/issues/auxiliary/issue_12612_1.rs | 3 - .../run-pass/issues/auxiliary/issue_12612_2.rs | 1 - src/test/run-pass/issues/auxiliary/issue_19293.rs | 4 - src/test/run-pass/issues/auxiliary/issue_20389.rs | 4 - src/test/run-pass/issues/auxiliary/issue_2316_a.rs | 3 - src/test/run-pass/issues/auxiliary/issue_2316_b.rs | 11 -- src/test/run-pass/issues/auxiliary/issue_2472_b.rs | 13 -- src/test/run-pass/issues/auxiliary/issue_2723_a.rs | 3 - src/test/run-pass/issues/auxiliary/issue_3136_a.rc | 3 - src/test/run-pass/issues/auxiliary/issue_3136_a.rs | 14 -- src/test/run-pass/issues/auxiliary/issue_38190.rs | 2 - .../run-pass/issues/auxiliary/issue_38226_aux.rs | 23 --- .../issues/auxiliary/issue_38715-modern.rs | 7 - src/test/run-pass/issues/auxiliary/issue_38715.rs | 7 - .../run-pass/issues/auxiliary/issue_3979_traits.rs | 15 -- src/test/run-pass/issues/auxiliary/issue_39823.rs | 7 - src/test/run-pass/issues/auxiliary/issue_40469.rs | 1 - src/test/run-pass/issues/auxiliary/issue_41053.rs | 1 - .../run-pass/issues/auxiliary/issue_42007_s.rs | 4 - src/test/run-pass/issues/auxiliary/issue_8401.rs | 16 -- src/test/run-pass/issues/auxiliary/issue_9123.rs | 9 - src/test/run-pass/issues/auxiliary/issue_9155.rs | 7 - src/test/run-pass/issues/auxiliary/issue_9188.rs | 13 -- src/test/run-pass/issues/issue-10031.rs | 2 +- src/test/run-pass/issues/issue-12612.rs | 4 +- src/test/run-pass/issues/issue-13507-2.rs | 10 +- src/test/run-pass/issues/issue-18952.rs | 56 ++++++ src/test/run-pass/issues/issue-19293.rs | 2 +- src/test/run-pass/issues/issue-20389.rs | 2 +- src/test/run-pass/issues/issue-2170-exe.rs | 9 + src/test/run-pass/issues/issue-2316-c.rs | 4 +- .../auxiliary/issue-24687-lib.rs | 11 ++ .../auxiliary/issue-24687-mbcs-in-comments.rs | 27 +++ .../issues/issue-24687-embed-debuginfo/main.rs | 13 ++ src/test/run-pass/issues/issue-2472.rs | 2 +- src/test/run-pass/issues/issue-26873-multifile.rs | 3 +- .../run-pass/issues/issue-26873-multifile/A/B.rs | 5 + .../run-pass/issues/issue-26873-multifile/A/C.rs | 7 + .../run-pass/issues/issue-26873-multifile/A/mod.rs | 6 + .../issue-26873-multifile/compiletest-ignore-dir | 0 .../run-pass/issues/issue-26873-multifile/mod.rs | 5 + src/test/run-pass/issues/issue-2723-b.rs | 2 +- .../run-pass/issues/issue-28498-must-work-ex1.rs | 18 ++ .../run-pass/issues/issue-28498-must-work-ex2.rs | 21 +++ src/test/run-pass/issues/issue-28498-ugeh-ex1.rs | 30 +++ .../issues/issue-28498-ugeh-with-lifetime-param.rs | 41 ++++ .../issues/issue-28498-ugeh-with-passed-to-fn.rs | 49 +++++ .../issues/issue-28498-ugeh-with-trait-bound.rs | 44 +++++ src/test/run-pass/issues/issue-29927-1.rs | 11 ++ src/test/run-pass/issues/issue-3136-b.rs | 8 + src/test/run-pass/issues/issue-34796.rs | 6 +- src/test/run-pass/issues/issue-38190.rs | 7 +- src/test/run-pass/issues/issue-38226.rs | 2 +- src/test/run-pass/issues/issue-38715.rs | 4 +- src/test/run-pass/issues/issue-3979-xcrate.rs | 2 +- src/test/run-pass/issues/issue-39823.rs | 2 +- src/test/run-pass/issues/issue-40469.rs | 2 +- src/test/run-pass/issues/issue-41053.rs | 2 +- src/test/run-pass/issues/issue-42007.rs | 2 +- src/test/run-pass/issues/issue-45510.rs | 32 ++++ src/test/run-pass/issues/issue-48006.rs | 13 ++ src/test/run-pass/issues/issue-53728.rs | 17 ++ src/test/run-pass/issues/issue-53843.rs | 24 +++ .../issue-54462-mutable-noalias-correctness.rs | 24 +++ src/test/run-pass/issues/issue-54467.rs | 44 +++++ src/test/run-pass/issues/issue-55376.rs | 15 ++ src/test/run-pass/issues/issue-55380.rs | 28 +++ src/test/run-pass/issues/issue-56237.rs | 11 ++ src/test/run-pass/issues/issue-8401.rs | 2 +- src/test/run-pass/issues/issue-9123.rs | 2 +- src/test/run-pass/issues/issue-9155.rs | 12 ++ src/test/run-pass/issues/issue-9188.rs | 2 +- src/test/run-pass/issues/issue2170exe.rs | 9 - .../auxiliary/issue24687_lib.rs | 10 - .../auxiliary/issue24687_mbcs_in_comments.rs | 27 --- .../issues/issue24687-embed-debuginfo/main.rs | 13 -- .../run-pass/issues/issue28498-must-work-ex1.rs | 18 -- .../run-pass/issues/issue28498-must-work-ex2.rs | 21 --- src/test/run-pass/issues/issue28498-ugeh-ex1.rs | 30 --- .../issues/issue28498-ugeh-with-lifetime-param.rs | 41 ---- .../issues/issue28498-ugeh-with-passed-to-fn.rs | 49 ----- .../issues/issue28498-ugeh-with-trait-bound.rs | 44 ----- src/test/run-pass/issues/issue29927-1.rs | 11 -- .../run-pass/issues/issue_26873_multifile/A/B.rs | 5 - .../run-pass/issues/issue_26873_multifile/A/C.rs | 7 - .../run-pass/issues/issue_26873_multifile/A/mod.rs | 6 - .../issue_26873_multifile/compiletest-ignore-dir | 0 .../run-pass/issues/issue_26873_multifile/mod.rs | 5 - src/test/run-pass/issues/issue_3136_b.rs | 7 - src/test/run-pass/issues/issue_9155.rs | 12 -- src/test/run-pass/rmeta.rs | 4 +- src/test/rustdoc/auxiliary/enum-primitive.rs | 207 +++++++++++++++++++++ src/test/rustdoc/auxiliary/enum_primitive.rs | 207 --------------------- src/test/rustdoc/auxiliary/reexp-stripped.rs | 11 ++ src/test/rustdoc/auxiliary/reexp_stripped.rs | 11 -- src/test/rustdoc/no-stack-overflow-25295.rs | 5 +- src/test/rustdoc/redirect.rs | 2 +- src/test/ui-fulldeps/auxiliary/attr-plugin-test.rs | 21 +++ src/test/ui-fulldeps/auxiliary/attr_plugin_test.rs | 21 --- src/test/ui-fulldeps/auxiliary/lint-for-crate.rs | 41 ++++ .../auxiliary/lint-group-plugin-test.rs | 45 +++++ src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs | 42 +++++ src/test/ui-fulldeps/auxiliary/lint-tool-test.rs | 49 +++++ src/test/ui-fulldeps/auxiliary/lint_for_crate.rs | 41 ---- .../auxiliary/lint_group_plugin_test.rs | 45 ----- src/test/ui-fulldeps/auxiliary/lint_plugin_test.rs | 42 ----- src/test/ui-fulldeps/auxiliary/lint_tool_test.rs | 49 ----- src/test/ui-fulldeps/auxiliary/rlib-crate-test.rs | 12 ++ src/test/ui-fulldeps/auxiliary/rlib_crate_test.rs | 12 -- .../ui-fulldeps/dropck-tarena-cycle-checked.rs | 117 ++++++++++++ .../ui-fulldeps/dropck-tarena-cycle-checked.stderr | 13 ++ src/test/ui-fulldeps/dropck-tarena-unsound-drop.rs | 43 +++++ .../ui-fulldeps/dropck-tarena-unsound-drop.stderr | 13 ++ .../ui-fulldeps/dropck_tarena_cycle_checked.rs | 117 ------------ .../ui-fulldeps/dropck_tarena_cycle_checked.stderr | 13 -- src/test/ui-fulldeps/dropck_tarena_unsound_drop.rs | 43 ----- .../ui-fulldeps/dropck_tarena_unsound_drop.stderr | 13 -- src/test/ui-fulldeps/gated-plugin.rs | 2 +- src/test/ui-fulldeps/issue-15778-fail.rs | 2 +- .../ui-fulldeps/lint-group-plugin-deny-cmdline.rs | 2 +- src/test/ui-fulldeps/lint-group-plugin.rs | 2 +- src/test/ui-fulldeps/lint-plugin-cmdline-allow.rs | 2 +- src/test/ui-fulldeps/lint-plugin-cmdline-load.rs | 2 +- src/test/ui-fulldeps/lint-plugin-deny-attr.rs | 2 +- src/test/ui-fulldeps/lint-plugin-deny-cmdline.rs | 2 +- src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs | 2 +- src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs | 2 +- src/test/ui-fulldeps/lint-plugin.rs | 2 +- src/test/ui-fulldeps/lint-tool-cmdline-allow.rs | 12 ++ .../ui-fulldeps/lint-tool-cmdline-allow.stderr | 25 +++ src/test/ui-fulldeps/lint-tool-test.rs | 30 +++ src/test/ui-fulldeps/lint-tool-test.stderr | 62 ++++++ src/test/ui-fulldeps/lint_tool_cmdline_allow.rs | 13 -- .../ui-fulldeps/lint_tool_cmdline_allow.stderr | 25 --- src/test/ui-fulldeps/lint_tool_test.rs | 30 --- src/test/ui-fulldeps/lint_tool_test.stderr | 62 ------ src/test/ui-fulldeps/macro-crate-rlib.rs | 2 +- src/test/ui-fulldeps/plugin-as-extern-crate.rs | 2 +- src/test/ui-fulldeps/plugin-attr-register-deny.rs | 2 +- .../default-ty-param-cross-crate-crate.rs | 10 + .../default_ty_param_cross_crate_crate.rs | 10 - src/test/ui/auxiliary/define-macro.rs | 6 + src/test/ui/auxiliary/define_macro.rs | 6 - src/test/ui/auxiliary/orphan-check-diagnostics.rs | 1 + src/test/ui/auxiliary/orphan_check_diagnostics.rs | 1 - src/test/ui/auxiliary/pub-and-stability.rs | 133 +++++++++++++ src/test/ui/auxiliary/pub_and_stability.rs | 133 ------------- src/test/ui/auxiliary/rmeta-meta.rs | 8 + src/test/ui/auxiliary/rmeta-rlib.rs | 5 + src/test/ui/auxiliary/rmeta_meta.rs | 8 - src/test/ui/auxiliary/rmeta_rlib.rs | 5 - src/test/ui/auxiliary/stability-cfg2.rs | 5 + src/test/ui/auxiliary/stability_cfg2.rs | 5 - src/test/ui/auxiliary/use_from_trait_xc.rs | 29 --- src/test/ui/auxiliary/xc-private-method-lib.rs | 33 ++++ src/test/ui/auxiliary/xc_private_method_lib.rs | 33 ---- src/test/ui/e0119/auxiliary/issue-23563-a.rs | 25 +++ src/test/ui/e0119/auxiliary/issue_23563_a.rs | 25 --- src/test/ui/e0119/issue-23563.rs | 2 +- src/test/ui/enable-unstable-lib-feature.rs | 2 +- src/test/ui/explore-issue-38412.rs | 3 +- src/test/ui/issue-18986.rs | 10 - src/test/ui/issue-18986.stderr | 9 - src/test/ui/issue-42944.rs | 19 -- src/test/ui/issue-42944.stderr | 20 -- src/test/ui/issue-53787-inline-assembler-macro.rs | 23 --- .../ui/issue-53787-inline-assembler-macro.stderr | 9 - src/test/ui/issue-54943-1.rs | 15 -- src/test/ui/issue-54943-2.rs | 18 -- src/test/ui/issue-54943-3.rs | 21 --- src/test/ui/issue-54943.rs | 13 -- src/test/ui/issue-54943.stderr | 11 -- src/test/ui/issue-55511.nll.stderr | 15 -- src/test/ui/issue-55511.rs | 19 -- src/test/ui/issue-55511.stderr | 14 -- src/test/ui/issue-55846.rs | 39 ---- src/test/ui/issues/issue-42944.rs | 19 ++ src/test/ui/issues/issue-42944.stderr | 20 ++ .../issues/issue-53787-inline-assembler-macro.rs | 23 +++ .../issue-53787-inline-assembler-macro.stderr | 9 + src/test/ui/issues/issue-54943-1.rs | 15 ++ src/test/ui/issues/issue-54943-2.rs | 18 ++ src/test/ui/issues/issue-54943-3.rs | 21 +++ src/test/ui/issues/issue-54943.rs | 13 ++ src/test/ui/issues/issue-54943.stderr | 11 ++ src/test/ui/issues/issue-55511.nll.stderr | 15 ++ src/test/ui/issues/issue-55511.rs | 19 ++ src/test/ui/issues/issue-55511.stderr | 14 ++ src/test/ui/issues/issue-55846.rs | 39 ++++ src/test/ui/issues/issue-56411-aux.rs | 5 + src/test/ui/issues/issue-56411.rs | 5 +- src/test/ui/issues/issue-56411.stderr | 12 +- src/test/ui/issues/issue_56411_aux.rs | 5 - src/test/ui/lint/auxiliary/stability-cfg2.rs | 5 + src/test/ui/lint/lint-stability-deprecated.rs | 2 +- src/test/ui/lint/lint-stability.rs | 2 +- src/test/ui/orphan-check-diagnostics.rs | 5 +- src/test/ui/orphan-check-diagnostics.stderr | 2 +- src/test/ui/out-of-order-shadowing.rs | 2 +- src/test/ui/proc-macro/auxiliary/issue-38586.rs | 11 ++ src/test/ui/proc-macro/auxiliary/issue-50493.rs | 21 +++ src/test/ui/proc-macro/auxiliary/issue_38586.rs | 11 -- src/test/ui/proc-macro/auxiliary/issue_50493.rs | 21 --- src/test/ui/proc-macro/issue-38586.rs | 2 +- src/test/ui/proc-macro/issue-50493.rs | 2 +- src/test/ui/resolve/auxiliary/issue-19452-aux.rs | 3 + src/test/ui/resolve/auxiliary/issue-3907.rs | 3 + src/test/ui/resolve/auxiliary/issue_19452_aux.rs | 3 - src/test/ui/resolve/auxiliary/issue_3907.rs | 3 - src/test/ui/resolve/issue-19452.rs | 3 +- src/test/ui/resolve/issue-19452.stderr | 4 +- src/test/ui/resolve/issue-3907-2.rs | 3 +- src/test/ui/resolve/issue-3907-2.stderr | 2 +- src/test/ui/resolve/issue-3907.rs | 3 +- src/test/ui/resolve/issue-3907.stderr | 2 +- src/test/ui/rmeta-lib-pass.rs | 2 +- src/test/ui/rmeta-pass.rs | 2 +- src/test/ui/rmeta_lib.rs | 2 +- src/test/ui/rmeta_meta_main.rs | 2 +- src/test/ui/use/auxiliary/use-from-trait-xc.rs | 29 +++ src/test/ui/use/auxiliary/use_from_trait_xc.rs | 29 --- src/test/ui/use/issue-18986.rs | 10 + src/test/ui/use/issue-18986.stderr | 9 + src/test/ui/use/use-from-trait-xc.rs | 2 +- src/test/ui/useless-comment.rs | 45 +++++ src/test/ui/useless-comment.stderr | 98 ++++++++++ src/test/ui/useless_comment.rs | 45 ----- src/test/ui/useless_comment.stderr | 98 ---------- src/test/ui/xc-private-method.rs | 2 +- src/test/ui/xc-private-method2.rs | 2 +- 329 files changed, 3141 insertions(+), 3152 deletions(-) create mode 100644 src/test/debuginfo/auxiliary/issue-13213-aux.rs delete mode 100644 src/test/debuginfo/auxiliary/issue13213aux.rs create mode 100644 src/test/incremental/auxiliary/issue-49482-macro-def.rs create mode 100644 src/test/incremental/auxiliary/issue-49482-reexport.rs create mode 100644 src/test/incremental/auxiliary/issue-54059.rs delete mode 100644 src/test/incremental/auxiliary/issue_49482_macro_def.rs delete mode 100644 src/test/incremental/auxiliary/issue_49482_reexport.rs delete mode 100644 src/test/incremental/auxiliary/issue_54059.rs create mode 100644 src/test/incremental/issue-49595/issue-49595.rs delete mode 100644 src/test/incremental/issue-49595/issue_49595.rs create mode 100644 src/test/pretty/issue-12590-a.rs create mode 100644 src/test/pretty/issue-12590-b.rs create mode 100644 src/test/pretty/issue-12590-c.pp create mode 100644 src/test/pretty/issue-12590-c.rs delete mode 100644 src/test/pretty/issue_12590_a.rs delete mode 100644 src/test/pretty/issue_12590_b.rs delete mode 100644 src/test/pretty/issue_12590_c.pp delete mode 100644 src/test/pretty/issue_12590_c.rs create mode 100644 src/test/run-pass-fulldeps/auxiliary/custom-derive-partial-eq.rs create mode 100644 src/test/run-pass-fulldeps/auxiliary/custom-derive-plugin-attr.rs create mode 100644 src/test/run-pass-fulldeps/auxiliary/custom-derive-plugin.rs delete mode 100644 src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs delete mode 100644 src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs delete mode 100644 src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs create mode 100644 src/test/run-pass-fulldeps/auxiliary/issue-24106.rs delete mode 100644 src/test/run-pass-fulldeps/auxiliary/issue_24106.rs create mode 100644 src/test/run-pass-fulldeps/auxiliary/lint-for-crate.rs delete mode 100644 src/test/run-pass-fulldeps/auxiliary/lint_for_crate.rs create mode 100644 src/test/run-pass-fulldeps/auxiliary/llvm-pass-plugin.rs delete mode 100644 src/test/run-pass-fulldeps/auxiliary/llvm_pass_plugin.rs create mode 100644 src/test/run-pass-fulldeps/auxiliary/macro-crate-test.rs delete mode 100644 src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs create mode 100644 src/test/run-pass-fulldeps/auxiliary/plugin-args.rs delete mode 100644 src/test/run-pass-fulldeps/auxiliary/plugin_args.rs create mode 100644 src/test/run-pass-fulldeps/auxiliary/roman-numerals.rs delete mode 100644 src/test/run-pass-fulldeps/auxiliary/roman_numerals.rs create mode 100644 src/test/run-pass-fulldeps/auxiliary/syntax-extension-with-dll-deps-1.rs delete mode 100644 src/test/run-pass-fulldeps/auxiliary/syntax_extension_with_dll_deps_1.rs create mode 100644 src/test/run-pass-fulldeps/issue-24106.rs delete mode 100644 src/test/run-pass-fulldeps/issue_24106.rs create mode 100644 src/test/run-pass/auxiliary/rmeta-rlib.rs create mode 100644 src/test/run-pass/auxiliary/rmeta-rmeta.rs delete mode 100644 src/test/run-pass/auxiliary/rmeta_rlib.rs delete mode 100644 src/test/run-pass/auxiliary/rmeta_rmeta.rs delete mode 100644 src/test/run-pass/issue-18952.rs delete mode 100644 src/test/run-pass/issue-45510.rs delete mode 100644 src/test/run-pass/issue-48006.rs delete mode 100644 src/test/run-pass/issue-53728.rs delete mode 100644 src/test/run-pass/issue-53843.rs delete mode 100644 src/test/run-pass/issue-54462-mutable-noalias-correctness.rs delete mode 100644 src/test/run-pass/issue-54467.rs delete mode 100644 src/test/run-pass/issue-55376.rs delete mode 100644 src/test/run-pass/issue-55380.rs delete mode 100644 src/test/run-pass/issue-56237.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-10031-aux.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-12612-1.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-12612-2.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-13507.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-19293.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-20389.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-2170-lib.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-2316-a.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-2316-b.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-2472-b.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-2723-a.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-3136-a.rc create mode 100644 src/test/run-pass/issues/auxiliary/issue-3136-a.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-34796-aux.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-38190.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-38226-aux.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-38715-modern.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-38715.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-3979-traits.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-39823.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-40469.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-41053.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-42007-s.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-8401.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-9123.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-9155.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-9188.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue13507.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue2170lib.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue34796aux.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue_10031_aux.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue_12612_1.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue_12612_2.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue_19293.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue_20389.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue_2316_a.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue_2316_b.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue_2472_b.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue_2723_a.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue_3136_a.rc delete mode 100644 src/test/run-pass/issues/auxiliary/issue_3136_a.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue_38190.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue_38226_aux.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue_38715-modern.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue_38715.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue_3979_traits.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue_39823.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue_40469.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue_41053.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue_42007_s.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue_8401.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue_9123.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue_9155.rs delete mode 100644 src/test/run-pass/issues/auxiliary/issue_9188.rs create mode 100644 src/test/run-pass/issues/issue-18952.rs create mode 100644 src/test/run-pass/issues/issue-2170-exe.rs create mode 100644 src/test/run-pass/issues/issue-24687-embed-debuginfo/auxiliary/issue-24687-lib.rs create mode 100644 src/test/run-pass/issues/issue-24687-embed-debuginfo/auxiliary/issue-24687-mbcs-in-comments.rs create mode 100644 src/test/run-pass/issues/issue-24687-embed-debuginfo/main.rs create mode 100644 src/test/run-pass/issues/issue-26873-multifile/A/B.rs create mode 100644 src/test/run-pass/issues/issue-26873-multifile/A/C.rs create mode 100644 src/test/run-pass/issues/issue-26873-multifile/A/mod.rs create mode 100644 src/test/run-pass/issues/issue-26873-multifile/compiletest-ignore-dir create mode 100644 src/test/run-pass/issues/issue-26873-multifile/mod.rs create mode 100644 src/test/run-pass/issues/issue-28498-must-work-ex1.rs create mode 100644 src/test/run-pass/issues/issue-28498-must-work-ex2.rs create mode 100644 src/test/run-pass/issues/issue-28498-ugeh-ex1.rs create mode 100644 src/test/run-pass/issues/issue-28498-ugeh-with-lifetime-param.rs create mode 100644 src/test/run-pass/issues/issue-28498-ugeh-with-passed-to-fn.rs create mode 100644 src/test/run-pass/issues/issue-28498-ugeh-with-trait-bound.rs create mode 100644 src/test/run-pass/issues/issue-29927-1.rs create mode 100644 src/test/run-pass/issues/issue-3136-b.rs create mode 100644 src/test/run-pass/issues/issue-45510.rs create mode 100644 src/test/run-pass/issues/issue-48006.rs create mode 100644 src/test/run-pass/issues/issue-53728.rs create mode 100644 src/test/run-pass/issues/issue-53843.rs create mode 100644 src/test/run-pass/issues/issue-54462-mutable-noalias-correctness.rs create mode 100644 src/test/run-pass/issues/issue-54467.rs create mode 100644 src/test/run-pass/issues/issue-55376.rs create mode 100644 src/test/run-pass/issues/issue-55380.rs create mode 100644 src/test/run-pass/issues/issue-56237.rs create mode 100644 src/test/run-pass/issues/issue-9155.rs delete mode 100644 src/test/run-pass/issues/issue2170exe.rs delete mode 100644 src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_lib.rs delete mode 100644 src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_mbcs_in_comments.rs delete mode 100644 src/test/run-pass/issues/issue24687-embed-debuginfo/main.rs delete mode 100644 src/test/run-pass/issues/issue28498-must-work-ex1.rs delete mode 100644 src/test/run-pass/issues/issue28498-must-work-ex2.rs delete mode 100644 src/test/run-pass/issues/issue28498-ugeh-ex1.rs delete mode 100644 src/test/run-pass/issues/issue28498-ugeh-with-lifetime-param.rs delete mode 100644 src/test/run-pass/issues/issue28498-ugeh-with-passed-to-fn.rs delete mode 100644 src/test/run-pass/issues/issue28498-ugeh-with-trait-bound.rs delete mode 100644 src/test/run-pass/issues/issue29927-1.rs delete mode 100644 src/test/run-pass/issues/issue_26873_multifile/A/B.rs delete mode 100644 src/test/run-pass/issues/issue_26873_multifile/A/C.rs delete mode 100644 src/test/run-pass/issues/issue_26873_multifile/A/mod.rs delete mode 100644 src/test/run-pass/issues/issue_26873_multifile/compiletest-ignore-dir delete mode 100644 src/test/run-pass/issues/issue_26873_multifile/mod.rs delete mode 100644 src/test/run-pass/issues/issue_3136_b.rs delete mode 100644 src/test/run-pass/issues/issue_9155.rs create mode 100644 src/test/rustdoc/auxiliary/enum-primitive.rs delete mode 100644 src/test/rustdoc/auxiliary/enum_primitive.rs create mode 100644 src/test/rustdoc/auxiliary/reexp-stripped.rs delete mode 100644 src/test/rustdoc/auxiliary/reexp_stripped.rs create mode 100644 src/test/ui-fulldeps/auxiliary/attr-plugin-test.rs delete mode 100644 src/test/ui-fulldeps/auxiliary/attr_plugin_test.rs create mode 100644 src/test/ui-fulldeps/auxiliary/lint-for-crate.rs create mode 100644 src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs create mode 100644 src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs create mode 100644 src/test/ui-fulldeps/auxiliary/lint-tool-test.rs delete mode 100644 src/test/ui-fulldeps/auxiliary/lint_for_crate.rs delete mode 100644 src/test/ui-fulldeps/auxiliary/lint_group_plugin_test.rs delete mode 100644 src/test/ui-fulldeps/auxiliary/lint_plugin_test.rs delete mode 100644 src/test/ui-fulldeps/auxiliary/lint_tool_test.rs create mode 100644 src/test/ui-fulldeps/auxiliary/rlib-crate-test.rs delete mode 100644 src/test/ui-fulldeps/auxiliary/rlib_crate_test.rs create mode 100644 src/test/ui-fulldeps/dropck-tarena-cycle-checked.rs create mode 100644 src/test/ui-fulldeps/dropck-tarena-cycle-checked.stderr create mode 100644 src/test/ui-fulldeps/dropck-tarena-unsound-drop.rs create mode 100644 src/test/ui-fulldeps/dropck-tarena-unsound-drop.stderr delete mode 100644 src/test/ui-fulldeps/dropck_tarena_cycle_checked.rs delete mode 100644 src/test/ui-fulldeps/dropck_tarena_cycle_checked.stderr delete mode 100644 src/test/ui-fulldeps/dropck_tarena_unsound_drop.rs delete mode 100644 src/test/ui-fulldeps/dropck_tarena_unsound_drop.stderr create mode 100644 src/test/ui-fulldeps/lint-tool-cmdline-allow.rs create mode 100644 src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr create mode 100644 src/test/ui-fulldeps/lint-tool-test.rs create mode 100644 src/test/ui-fulldeps/lint-tool-test.stderr delete mode 100644 src/test/ui-fulldeps/lint_tool_cmdline_allow.rs delete mode 100644 src/test/ui-fulldeps/lint_tool_cmdline_allow.stderr delete mode 100644 src/test/ui-fulldeps/lint_tool_test.rs delete mode 100644 src/test/ui-fulldeps/lint_tool_test.stderr create mode 100644 src/test/ui/auxiliary/default-ty-param-cross-crate-crate.rs delete mode 100644 src/test/ui/auxiliary/default_ty_param_cross_crate_crate.rs create mode 100644 src/test/ui/auxiliary/define-macro.rs delete mode 100644 src/test/ui/auxiliary/define_macro.rs create mode 100644 src/test/ui/auxiliary/orphan-check-diagnostics.rs delete mode 100644 src/test/ui/auxiliary/orphan_check_diagnostics.rs create mode 100644 src/test/ui/auxiliary/pub-and-stability.rs delete mode 100644 src/test/ui/auxiliary/pub_and_stability.rs create mode 100644 src/test/ui/auxiliary/rmeta-meta.rs create mode 100644 src/test/ui/auxiliary/rmeta-rlib.rs delete mode 100644 src/test/ui/auxiliary/rmeta_meta.rs delete mode 100644 src/test/ui/auxiliary/rmeta_rlib.rs create mode 100644 src/test/ui/auxiliary/stability-cfg2.rs delete mode 100644 src/test/ui/auxiliary/stability_cfg2.rs delete mode 100644 src/test/ui/auxiliary/use_from_trait_xc.rs create mode 100644 src/test/ui/auxiliary/xc-private-method-lib.rs delete mode 100644 src/test/ui/auxiliary/xc_private_method_lib.rs create mode 100644 src/test/ui/e0119/auxiliary/issue-23563-a.rs delete mode 100644 src/test/ui/e0119/auxiliary/issue_23563_a.rs delete mode 100644 src/test/ui/issue-18986.rs delete mode 100644 src/test/ui/issue-18986.stderr delete mode 100644 src/test/ui/issue-42944.rs delete mode 100644 src/test/ui/issue-42944.stderr delete mode 100644 src/test/ui/issue-53787-inline-assembler-macro.rs delete mode 100644 src/test/ui/issue-53787-inline-assembler-macro.stderr delete mode 100644 src/test/ui/issue-54943-1.rs delete mode 100644 src/test/ui/issue-54943-2.rs delete mode 100644 src/test/ui/issue-54943-3.rs delete mode 100644 src/test/ui/issue-54943.rs delete mode 100644 src/test/ui/issue-54943.stderr delete mode 100644 src/test/ui/issue-55511.nll.stderr delete mode 100644 src/test/ui/issue-55511.rs delete mode 100644 src/test/ui/issue-55511.stderr delete mode 100644 src/test/ui/issue-55846.rs create mode 100644 src/test/ui/issues/issue-42944.rs create mode 100644 src/test/ui/issues/issue-42944.stderr create mode 100644 src/test/ui/issues/issue-53787-inline-assembler-macro.rs create mode 100644 src/test/ui/issues/issue-53787-inline-assembler-macro.stderr create mode 100644 src/test/ui/issues/issue-54943-1.rs create mode 100644 src/test/ui/issues/issue-54943-2.rs create mode 100644 src/test/ui/issues/issue-54943-3.rs create mode 100644 src/test/ui/issues/issue-54943.rs create mode 100644 src/test/ui/issues/issue-54943.stderr create mode 100644 src/test/ui/issues/issue-55511.nll.stderr create mode 100644 src/test/ui/issues/issue-55511.rs create mode 100644 src/test/ui/issues/issue-55511.stderr create mode 100644 src/test/ui/issues/issue-55846.rs create mode 100644 src/test/ui/issues/issue-56411-aux.rs delete mode 100644 src/test/ui/issues/issue_56411_aux.rs create mode 100644 src/test/ui/lint/auxiliary/stability-cfg2.rs create mode 100644 src/test/ui/proc-macro/auxiliary/issue-38586.rs create mode 100644 src/test/ui/proc-macro/auxiliary/issue-50493.rs delete mode 100644 src/test/ui/proc-macro/auxiliary/issue_38586.rs delete mode 100644 src/test/ui/proc-macro/auxiliary/issue_50493.rs create mode 100644 src/test/ui/resolve/auxiliary/issue-19452-aux.rs create mode 100644 src/test/ui/resolve/auxiliary/issue-3907.rs delete mode 100644 src/test/ui/resolve/auxiliary/issue_19452_aux.rs delete mode 100644 src/test/ui/resolve/auxiliary/issue_3907.rs create mode 100644 src/test/ui/use/auxiliary/use-from-trait-xc.rs delete mode 100644 src/test/ui/use/auxiliary/use_from_trait_xc.rs create mode 100644 src/test/ui/use/issue-18986.rs create mode 100644 src/test/ui/use/issue-18986.stderr create mode 100644 src/test/ui/useless-comment.rs create mode 100644 src/test/ui/useless-comment.stderr delete mode 100644 src/test/ui/useless_comment.rs delete mode 100644 src/test/ui/useless_comment.stderr (limited to 'src') diff --git a/src/test/debuginfo/auxiliary/issue-13213-aux.rs b/src/test/debuginfo/auxiliary/issue-13213-aux.rs new file mode 100644 index 00000000000..bde98b44544 --- /dev/null +++ b/src/test/debuginfo/auxiliary/issue-13213-aux.rs @@ -0,0 +1,19 @@ +#![crate_type = "lib"] +// compile-flags:-g + +pub use private::P; + +#[derive(Copy, Clone)] +pub struct S { + p: P, +} + +mod private { + #[derive(Copy, Clone)] + pub struct P { + p: i32, + } + pub const THREE: P = P { p: 3 }; +} + +pub static A: S = S { p: private::THREE }; diff --git a/src/test/debuginfo/auxiliary/issue13213aux.rs b/src/test/debuginfo/auxiliary/issue13213aux.rs deleted file mode 100644 index bde98b44544..00000000000 --- a/src/test/debuginfo/auxiliary/issue13213aux.rs +++ /dev/null @@ -1,19 +0,0 @@ -#![crate_type = "lib"] -// compile-flags:-g - -pub use private::P; - -#[derive(Copy, Clone)] -pub struct S { - p: P, -} - -mod private { - #[derive(Copy, Clone)] - pub struct P { - p: i32, - } - pub const THREE: P = P { p: 3 }; -} - -pub static A: S = S { p: private::THREE }; diff --git a/src/test/debuginfo/issue-13213.rs b/src/test/debuginfo/issue-13213.rs index 898ebe547b3..3c9a365fd4f 100644 --- a/src/test/debuginfo/issue-13213.rs +++ b/src/test/debuginfo/issue-13213.rs @@ -1,8 +1,8 @@ // min-lldb-version: 310 -// aux-build:issue13213aux.rs +// aux-build:issue-13213-aux.rs -extern crate issue13213aux; +extern crate issue_13213_aux; // compile-flags:-g @@ -10,6 +10,6 @@ extern crate issue13213aux; // statics that are marked with AvailableExternallyLinkage in the importing crate, may actually not // be available because they have been optimized out from the exporting crate. fn main() { - let b: issue13213aux::S = issue13213aux::A; + let b: issue_13213_aux::S = issue_13213_aux::A; println!("Nothing to do here..."); } diff --git a/src/test/incremental/auxiliary/issue-49482-macro-def.rs b/src/test/incremental/auxiliary/issue-49482-macro-def.rs new file mode 100644 index 00000000000..bfa7abb1a9d --- /dev/null +++ b/src/test/incremental/auxiliary/issue-49482-macro-def.rs @@ -0,0 +1,40 @@ +// force-host +// no-prefer-dynamic + +#![crate_type="proc-macro"] +#![allow(non_snake_case)] + +extern crate proc_macro; + +macro_rules! proc_macro_expr_impl { + ($( + $( #[$attr:meta] )* + pub fn $func:ident($input:ident: &str) -> String; + )+) => { + $( + $( #[$attr] )* + #[proc_macro_derive($func)] + pub fn $func(_input: ::proc_macro::TokenStream) -> ::proc_macro::TokenStream { + panic!() + } + )+ + }; +} + +proc_macro_expr_impl! { + pub fn f1(input: &str) -> String; + pub fn f2(input: &str) -> String; + pub fn f3(input: &str) -> String; + pub fn f4(input: &str) -> String; + pub fn f5(input: &str) -> String; + pub fn f6(input: &str) -> String; + pub fn f7(input: &str) -> String; + pub fn f8(input: &str) -> String; + pub fn f9(input: &str) -> String; + pub fn fA(input: &str) -> String; + pub fn fB(input: &str) -> String; + pub fn fC(input: &str) -> String; + pub fn fD(input: &str) -> String; + pub fn fE(input: &str) -> String; + pub fn fF(input: &str) -> String; +} diff --git a/src/test/incremental/auxiliary/issue-49482-reexport.rs b/src/test/incremental/auxiliary/issue-49482-reexport.rs new file mode 100644 index 00000000000..39f19e3f15f --- /dev/null +++ b/src/test/incremental/auxiliary/issue-49482-reexport.rs @@ -0,0 +1,6 @@ +#[macro_use] +extern crate issue_49482_macro_def; + +pub use issue_49482_macro_def::*; + +pub fn foo() {} diff --git a/src/test/incremental/auxiliary/issue-54059.rs b/src/test/incremental/auxiliary/issue-54059.rs new file mode 100644 index 00000000000..fa2814a77f2 --- /dev/null +++ b/src/test/incremental/auxiliary/issue-54059.rs @@ -0,0 +1,50 @@ +// force-host +// no-prefer-dynamic + +// check that having extern "C" functions in a proc macro doesn't crash. + +#![crate_type="proc-macro"] +#![allow(non_snake_case)] + +extern crate proc_macro; + +macro_rules! proc_macro_tokenstream { + () => { + ::proc_macro::TokenStream + }; +} + +macro_rules! proc_macro_expr_impl { + ($( + $( #[$attr:meta] )* + pub fn $func:ident($input:ident: &str) -> String $body:block + )+) => { + $( + // Parses an input that looks like: + // + // ``` + // #[allow(unused)] + // enum ProcMacroHack { + // Input = (stringify!(ARGS), 0).1, + // } + // ``` + $( #[$attr] )* + #[proc_macro_derive($func)] + pub fn $func(input: proc_macro_tokenstream!()) -> proc_macro_tokenstream!() { + unsafe { rust_dbg_extern_identity_u64(0); } + panic!() + } + )+ + }; +} + +proc_macro_expr_impl! { + pub fn base2_impl(input: &str) -> String { + panic!() + } +} + +#[link(name="rust_test_helpers")] +extern "C" { + pub fn rust_dbg_extern_identity_u64(v: u64) -> u64; +} diff --git a/src/test/incremental/auxiliary/issue_49482_macro_def.rs b/src/test/incremental/auxiliary/issue_49482_macro_def.rs deleted file mode 100644 index bfa7abb1a9d..00000000000 --- a/src/test/incremental/auxiliary/issue_49482_macro_def.rs +++ /dev/null @@ -1,40 +0,0 @@ -// force-host -// no-prefer-dynamic - -#![crate_type="proc-macro"] -#![allow(non_snake_case)] - -extern crate proc_macro; - -macro_rules! proc_macro_expr_impl { - ($( - $( #[$attr:meta] )* - pub fn $func:ident($input:ident: &str) -> String; - )+) => { - $( - $( #[$attr] )* - #[proc_macro_derive($func)] - pub fn $func(_input: ::proc_macro::TokenStream) -> ::proc_macro::TokenStream { - panic!() - } - )+ - }; -} - -proc_macro_expr_impl! { - pub fn f1(input: &str) -> String; - pub fn f2(input: &str) -> String; - pub fn f3(input: &str) -> String; - pub fn f4(input: &str) -> String; - pub fn f5(input: &str) -> String; - pub fn f6(input: &str) -> String; - pub fn f7(input: &str) -> String; - pub fn f8(input: &str) -> String; - pub fn f9(input: &str) -> String; - pub fn fA(input: &str) -> String; - pub fn fB(input: &str) -> String; - pub fn fC(input: &str) -> String; - pub fn fD(input: &str) -> String; - pub fn fE(input: &str) -> String; - pub fn fF(input: &str) -> String; -} diff --git a/src/test/incremental/auxiliary/issue_49482_reexport.rs b/src/test/incremental/auxiliary/issue_49482_reexport.rs deleted file mode 100644 index 39f19e3f15f..00000000000 --- a/src/test/incremental/auxiliary/issue_49482_reexport.rs +++ /dev/null @@ -1,6 +0,0 @@ -#[macro_use] -extern crate issue_49482_macro_def; - -pub use issue_49482_macro_def::*; - -pub fn foo() {} diff --git a/src/test/incremental/auxiliary/issue_54059.rs b/src/test/incremental/auxiliary/issue_54059.rs deleted file mode 100644 index fa2814a77f2..00000000000 --- a/src/test/incremental/auxiliary/issue_54059.rs +++ /dev/null @@ -1,50 +0,0 @@ -// force-host -// no-prefer-dynamic - -// check that having extern "C" functions in a proc macro doesn't crash. - -#![crate_type="proc-macro"] -#![allow(non_snake_case)] - -extern crate proc_macro; - -macro_rules! proc_macro_tokenstream { - () => { - ::proc_macro::TokenStream - }; -} - -macro_rules! proc_macro_expr_impl { - ($( - $( #[$attr:meta] )* - pub fn $func:ident($input:ident: &str) -> String $body:block - )+) => { - $( - // Parses an input that looks like: - // - // ``` - // #[allow(unused)] - // enum ProcMacroHack { - // Input = (stringify!(ARGS), 0).1, - // } - // ``` - $( #[$attr] )* - #[proc_macro_derive($func)] - pub fn $func(input: proc_macro_tokenstream!()) -> proc_macro_tokenstream!() { - unsafe { rust_dbg_extern_identity_u64(0); } - panic!() - } - )+ - }; -} - -proc_macro_expr_impl! { - pub fn base2_impl(input: &str) -> String { - panic!() - } -} - -#[link(name="rust_test_helpers")] -extern "C" { - pub fn rust_dbg_extern_identity_u64(v: u64) -> u64; -} diff --git a/src/test/incremental/issue-49482.rs b/src/test/incremental/issue-49482.rs index 67d2c3876d7..042ecc0f279 100644 --- a/src/test/incremental/issue-49482.rs +++ b/src/test/incremental/issue-49482.rs @@ -1,5 +1,5 @@ -// aux-build:issue_49482_macro_def.rs -// aux-build:issue_49482_reexport.rs +// aux-build:issue-49482-macro-def.rs +// aux-build:issue-49482-reexport.rs // revisions: rpass1 extern crate issue_49482_reexport; diff --git a/src/test/incremental/issue-49595/issue-49595.rs b/src/test/incremental/issue-49595/issue-49595.rs new file mode 100644 index 00000000000..ada93f79b26 --- /dev/null +++ b/src/test/incremental/issue-49595/issue-49595.rs @@ -0,0 +1,31 @@ +// revisions:cfail1 cfail2 cfail3 +// compile-flags: -Z query-dep-graph --test +// compile-pass + +#![feature(rustc_attrs)] +#![crate_type = "rlib"] + +#![rustc_partition_codegened(module="issue_49595-tests", cfg="cfail2")] +#![rustc_partition_codegened(module="issue_49595-lit_test", cfg="cfail3")] + +mod tests { + #[cfg_attr(not(cfail1), test)] + fn test() { + } +} + + +// Checks that changing a string literal without changing its span +// takes effect. + +// replacing a module to have a stable span +#[cfg_attr(not(cfail3), path = "auxiliary/lit_a.rs")] +#[cfg_attr(cfail3, path = "auxiliary/lit_b.rs")] +mod lit; + +pub mod lit_test { + #[test] + fn lit_test() { + println!("{}", ::lit::A); + } +} diff --git a/src/test/incremental/issue-49595/issue_49595.rs b/src/test/incremental/issue-49595/issue_49595.rs deleted file mode 100644 index ada93f79b26..00000000000 --- a/src/test/incremental/issue-49595/issue_49595.rs +++ /dev/null @@ -1,31 +0,0 @@ -// revisions:cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph --test -// compile-pass - -#![feature(rustc_attrs)] -#![crate_type = "rlib"] - -#![rustc_partition_codegened(module="issue_49595-tests", cfg="cfail2")] -#![rustc_partition_codegened(module="issue_49595-lit_test", cfg="cfail3")] - -mod tests { - #[cfg_attr(not(cfail1), test)] - fn test() { - } -} - - -// Checks that changing a string literal without changing its span -// takes effect. - -// replacing a module to have a stable span -#[cfg_attr(not(cfail3), path = "auxiliary/lit_a.rs")] -#[cfg_attr(cfail3, path = "auxiliary/lit_b.rs")] -mod lit; - -pub mod lit_test { - #[test] - fn lit_test() { - println!("{}", ::lit::A); - } -} diff --git a/src/test/incremental/issue-54059.rs b/src/test/incremental/issue-54059.rs index d78bbccf1bc..0a5a547509f 100644 --- a/src/test/incremental/issue-54059.rs +++ b/src/test/incremental/issue-54059.rs @@ -1,4 +1,4 @@ -// aux-build:issue_54059.rs +// aux-build:issue-54059.rs // ignore-wasm32-bare no libc for ffi testing // ignore-windows - dealing with weird symbols issues on dylibs isn't worth it // revisions: rpass1 diff --git a/src/test/pretty/issue-12590-a.rs b/src/test/pretty/issue-12590-a.rs new file mode 100644 index 00000000000..1a9e85c42d8 --- /dev/null +++ b/src/test/pretty/issue-12590-a.rs @@ -0,0 +1,8 @@ +// pp-exact + +// The next line should not be expanded + +#[path = "issue-12590-b.rs"] +mod issue_12590_b; + +fn main() { } diff --git a/src/test/pretty/issue-12590-b.rs b/src/test/pretty/issue-12590-b.rs new file mode 100644 index 00000000000..b14c7afa221 --- /dev/null +++ b/src/test/pretty/issue-12590-b.rs @@ -0,0 +1,5 @@ +// Second part of two-file test + +fn b() { } + +fn main() { } diff --git a/src/test/pretty/issue-12590-c.pp b/src/test/pretty/issue-12590-c.pp new file mode 100644 index 00000000000..1761c0653ce --- /dev/null +++ b/src/test/pretty/issue-12590-c.pp @@ -0,0 +1,19 @@ +#![feature(prelude_import)] +#![no_std] +#[prelude_import] +use ::std::prelude::v1::*; +#[macro_use] +extern crate std; +// pretty-compare-only +// pretty-mode:expanded +// pp-exact:issue-12590-c.pp + +// The next line should be expanded + +#[path = "issue-12590-b.rs"] +mod issue_12590_b { + + fn b() { } + fn main() { } +} +fn main() { } diff --git a/src/test/pretty/issue-12590-c.rs b/src/test/pretty/issue-12590-c.rs new file mode 100644 index 00000000000..2cc444edda3 --- /dev/null +++ b/src/test/pretty/issue-12590-c.rs @@ -0,0 +1,10 @@ +// pretty-compare-only +// pretty-mode:expanded +// pp-exact:issue-12590-c.pp + +// The next line should be expanded + +#[path = "issue-12590-b.rs"] +mod issue_12590_b; + +fn main() { } diff --git a/src/test/pretty/issue_12590_a.rs b/src/test/pretty/issue_12590_a.rs deleted file mode 100644 index 1ddd3c04263..00000000000 --- a/src/test/pretty/issue_12590_a.rs +++ /dev/null @@ -1,7 +0,0 @@ -// pp-exact - -// The next line should not be expanded - -mod issue_12590_b; - -fn main() { } diff --git a/src/test/pretty/issue_12590_b.rs b/src/test/pretty/issue_12590_b.rs deleted file mode 100644 index f188f7bca69..00000000000 --- a/src/test/pretty/issue_12590_b.rs +++ /dev/null @@ -1,4 +0,0 @@ -// Second part of two file test -fn b() { } - -fn main() { } diff --git a/src/test/pretty/issue_12590_c.pp b/src/test/pretty/issue_12590_c.pp deleted file mode 100644 index 24182835303..00000000000 --- a/src/test/pretty/issue_12590_c.pp +++ /dev/null @@ -1,18 +0,0 @@ -#![feature(prelude_import)] -#![no_std] -#[prelude_import] -use ::std::prelude::v1::*; -#[macro_use] -extern crate std; -// pretty-compare-only -// pretty-mode:expanded -// pp-exact:issue_12590_c.pp - -// The next line should be expanded - -mod issue_12590_b { - - fn b() { } - fn main() { } -} -fn main() { } diff --git a/src/test/pretty/issue_12590_c.rs b/src/test/pretty/issue_12590_c.rs deleted file mode 100644 index c0da36c2100..00000000000 --- a/src/test/pretty/issue_12590_c.rs +++ /dev/null @@ -1,9 +0,0 @@ -// pretty-compare-only -// pretty-mode:expanded -// pp-exact:issue_12590_c.pp - -// The next line should be expanded - -mod issue_12590_b; - -fn main() { } diff --git a/src/test/run-pass-fulldeps/auxiliary/custom-derive-partial-eq.rs b/src/test/run-pass-fulldeps/auxiliary/custom-derive-partial-eq.rs new file mode 100644 index 00000000000..4d6ff47a3ee --- /dev/null +++ b/src/test/run-pass-fulldeps/auxiliary/custom-derive-partial-eq.rs @@ -0,0 +1,71 @@ +// force-host + +#![feature(plugin_registrar, rustc_private)] + +extern crate syntax; +extern crate syntax_ext; +extern crate rustc_plugin; + +use syntax_ext::deriving; +use deriving::generic::*; +use deriving::generic::ty::*; + +use rustc_plugin::Registry; +use syntax::ast::*; +use syntax::source_map::Span; +use syntax::ext::base::*; +use syntax::ext::build::AstBuilder; +use syntax::symbol::Symbol; +use syntax::ptr::P; + +#[plugin_registrar] +pub fn plugin_registrar(reg: &mut Registry) { + reg.register_syntax_extension(Symbol::intern("derive_CustomPartialEq"), + MultiDecorator(Box::new(expand_deriving_partial_eq))); +} + +fn expand_deriving_partial_eq(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: &Annotatable, + push: &mut FnMut(Annotatable)) { + // structures are equal if all fields are equal, and non equal, if + // any fields are not equal or if the enum variants are different + fn cs_eq(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> P { + cs_fold(true, + |cx, span, subexpr, self_f, other_fs| { + let other_f = (other_fs.len(), other_fs.get(0)).1.unwrap(); + let eq = cx.expr_binary(span, BinOpKind::Eq, self_f, other_f.clone()); + cx.expr_binary(span, BinOpKind::And, subexpr, eq) + }, + cx.expr_bool(span, true), + Box::new(|cx, span, _, _| cx.expr_bool(span, false)), + cx, + span, + substr) + } + + let inline = cx.meta_word(span, Symbol::intern("inline")); + let attrs = vec![cx.attribute(span, inline)]; + let methods = vec![MethodDef { + name: "eq", + generics: LifetimeBounds::empty(), + explicit_self: borrowed_explicit_self(), + args: vec![(borrowed_self(), "other")], + ret_ty: Literal(deriving::generic::ty::Path::new_local("bool")), + attributes: attrs, + is_unsafe: false, + unify_fieldless_variants: true, + combine_substructure: combine_substructure(Box::new(cs_eq)), + }]; + + let trait_def = TraitDef { + span: span, + attributes: Vec::new(), + path: deriving::generic::ty::Path::new(vec!["cmp", "PartialEq"]), + additional_bounds: Vec::new(), + generics: LifetimeBounds::empty(), + is_unsafe: false, + supports_unions: false, + methods: methods, + associated_types: Vec::new(), + }; + trait_def.expand(cx, mitem, item, push) +} diff --git a/src/test/run-pass-fulldeps/auxiliary/custom-derive-plugin-attr.rs b/src/test/run-pass-fulldeps/auxiliary/custom-derive-plugin-attr.rs new file mode 100644 index 00000000000..699972c9a85 --- /dev/null +++ b/src/test/run-pass-fulldeps/auxiliary/custom-derive-plugin-attr.rs @@ -0,0 +1,84 @@ +// force-host + +#![feature(plugin_registrar)] +#![feature(box_syntax)] +#![feature(rustc_private)] + +extern crate syntax; +extern crate syntax_ext; +extern crate syntax_pos; +extern crate rustc; +extern crate rustc_plugin; + +use syntax::ast; +use syntax::attr; +use syntax::ext::base::{MultiDecorator, ExtCtxt, Annotatable}; +use syntax::ext::build::AstBuilder; +use syntax::symbol::Symbol; +use syntax::ptr::P; +use syntax_ext::deriving::generic::{TraitDef, MethodDef, combine_substructure}; +use syntax_ext::deriving::generic::{Substructure, Struct, EnumMatching}; +use syntax_ext::deriving::generic::ty::{Literal, LifetimeBounds, Path, borrowed_explicit_self}; +use syntax_pos::Span; +use rustc_plugin::Registry; + +#[plugin_registrar] +pub fn plugin_registrar(reg: &mut Registry) { + reg.register_syntax_extension( + Symbol::intern("rustc_derive_TotalSum"), + MultiDecorator(box expand)); +} + +fn expand(cx: &mut ExtCtxt, + span: Span, + mitem: &ast::MetaItem, + item: &Annotatable, + push: &mut FnMut(Annotatable)) { + let trait_def = TraitDef { + span: span, + attributes: vec![], + path: Path::new_local("TotalSum"), + additional_bounds: vec![], + generics: LifetimeBounds::empty(), + associated_types: vec![], + is_unsafe: false, + supports_unions: false, + methods: vec![ + MethodDef { + name: "total_sum", + generics: LifetimeBounds::empty(), + explicit_self: borrowed_explicit_self(), + args: vec![], + ret_ty: Literal(Path::new_local("isize")), + attributes: vec![], + is_unsafe: false, + unify_fieldless_variants: true, + combine_substructure: combine_substructure(Box::new(totalsum_substructure)), + }, + ], + }; + + trait_def.expand(cx, mitem, item, push) +} + +// Mostly copied from syntax::ext::deriving::hash +/// Defines how the implementation for `trace()` is to be generated +fn totalsum_substructure(cx: &mut ExtCtxt, trait_span: Span, + substr: &Substructure) -> P { + let fields = match *substr.fields { + Struct(_, ref fs) | EnumMatching(.., ref fs) => fs, + _ => cx.span_bug(trait_span, "impossible substructure") + }; + + fields.iter().fold(cx.expr_isize(trait_span, 0), |acc, ref item| { + if attr::contains_name(&item.attrs, "ignore") { + acc + } else { + cx.expr_binary(item.span, ast::BinOpKind::Add, acc, + cx.expr_method_call(item.span, + item.self_.clone(), + substr.method_ident, + Vec::new())) + } + }) +} diff --git a/src/test/run-pass-fulldeps/auxiliary/custom-derive-plugin.rs b/src/test/run-pass-fulldeps/auxiliary/custom-derive-plugin.rs new file mode 100644 index 00000000000..874a0ec7c13 --- /dev/null +++ b/src/test/run-pass-fulldeps/auxiliary/custom-derive-plugin.rs @@ -0,0 +1,76 @@ +// force-host + +#![feature(plugin_registrar)] +#![feature(box_syntax)] +#![feature(rustc_private)] + +extern crate syntax; +extern crate syntax_ext; +extern crate syntax_pos; +extern crate rustc; +extern crate rustc_plugin; + +use syntax::ast; +use syntax::ext::base::{MultiDecorator, ExtCtxt, Annotatable}; +use syntax::ext::build::AstBuilder; +use syntax::symbol::Symbol; +use syntax_ext::deriving::generic::{cs_fold, TraitDef, MethodDef, combine_substructure}; +use syntax_ext::deriving::generic::ty::{Literal, LifetimeBounds, Path, borrowed_explicit_self}; +use syntax_pos::Span; +use rustc_plugin::Registry; + +#[plugin_registrar] +pub fn plugin_registrar(reg: &mut Registry) { + reg.register_syntax_extension( + Symbol::intern("derive_TotalSum"), + MultiDecorator(box expand)); + + reg.register_syntax_extension( + Symbol::intern("derive_Nothing"), + MultiDecorator(box noop)); +} + +fn noop(_: &mut ExtCtxt, _: Span, _: &ast::MetaItem, _: &Annotatable, _: &mut FnMut(Annotatable)) {} + +fn expand(cx: &mut ExtCtxt, + span: Span, + mitem: &ast::MetaItem, + item: &Annotatable, + push: &mut FnMut(Annotatable)) { + let trait_def = TraitDef { + span: span, + attributes: vec![], + path: Path::new_local("TotalSum"), + additional_bounds: vec![], + generics: LifetimeBounds::empty(), + associated_types: vec![], + is_unsafe: false, + supports_unions: false, + methods: vec![ + MethodDef { + name: "total_sum", + generics: LifetimeBounds::empty(), + explicit_self: borrowed_explicit_self(), + args: vec![], + ret_ty: Literal(Path::new_local("isize")), + attributes: vec![], + is_unsafe: false, + unify_fieldless_variants: true, + combine_substructure: combine_substructure(box |cx, span, substr| { + let zero = cx.expr_isize(span, 0); + cs_fold(false, + |cx, span, subexpr, field, _| { + cx.expr_binary(span, ast::BinOpKind::Add, subexpr, + cx.expr_method_call(span, field, + ast::Ident::from_str("total_sum"), vec![])) + }, + zero, + box |cx, span, _, _| { cx.span_bug(span, "wtf??"); }, + cx, span, substr) + }), + }, + ], + }; + + trait_def.expand(cx, mitem, item, push) +} diff --git a/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs b/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs deleted file mode 100644 index 4d6ff47a3ee..00000000000 --- a/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs +++ /dev/null @@ -1,71 +0,0 @@ -// force-host - -#![feature(plugin_registrar, rustc_private)] - -extern crate syntax; -extern crate syntax_ext; -extern crate rustc_plugin; - -use syntax_ext::deriving; -use deriving::generic::*; -use deriving::generic::ty::*; - -use rustc_plugin::Registry; -use syntax::ast::*; -use syntax::source_map::Span; -use syntax::ext::base::*; -use syntax::ext::build::AstBuilder; -use syntax::symbol::Symbol; -use syntax::ptr::P; - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_syntax_extension(Symbol::intern("derive_CustomPartialEq"), - MultiDecorator(Box::new(expand_deriving_partial_eq))); -} - -fn expand_deriving_partial_eq(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: &Annotatable, - push: &mut FnMut(Annotatable)) { - // structures are equal if all fields are equal, and non equal, if - // any fields are not equal or if the enum variants are different - fn cs_eq(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> P { - cs_fold(true, - |cx, span, subexpr, self_f, other_fs| { - let other_f = (other_fs.len(), other_fs.get(0)).1.unwrap(); - let eq = cx.expr_binary(span, BinOpKind::Eq, self_f, other_f.clone()); - cx.expr_binary(span, BinOpKind::And, subexpr, eq) - }, - cx.expr_bool(span, true), - Box::new(|cx, span, _, _| cx.expr_bool(span, false)), - cx, - span, - substr) - } - - let inline = cx.meta_word(span, Symbol::intern("inline")); - let attrs = vec![cx.attribute(span, inline)]; - let methods = vec![MethodDef { - name: "eq", - generics: LifetimeBounds::empty(), - explicit_self: borrowed_explicit_self(), - args: vec![(borrowed_self(), "other")], - ret_ty: Literal(deriving::generic::ty::Path::new_local("bool")), - attributes: attrs, - is_unsafe: false, - unify_fieldless_variants: true, - combine_substructure: combine_substructure(Box::new(cs_eq)), - }]; - - let trait_def = TraitDef { - span: span, - attributes: Vec::new(), - path: deriving::generic::ty::Path::new(vec!["cmp", "PartialEq"]), - additional_bounds: Vec::new(), - generics: LifetimeBounds::empty(), - is_unsafe: false, - supports_unions: false, - methods: methods, - associated_types: Vec::new(), - }; - trait_def.expand(cx, mitem, item, push) -} diff --git a/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs b/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs deleted file mode 100644 index 874a0ec7c13..00000000000 --- a/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs +++ /dev/null @@ -1,76 +0,0 @@ -// force-host - -#![feature(plugin_registrar)] -#![feature(box_syntax)] -#![feature(rustc_private)] - -extern crate syntax; -extern crate syntax_ext; -extern crate syntax_pos; -extern crate rustc; -extern crate rustc_plugin; - -use syntax::ast; -use syntax::ext::base::{MultiDecorator, ExtCtxt, Annotatable}; -use syntax::ext::build::AstBuilder; -use syntax::symbol::Symbol; -use syntax_ext::deriving::generic::{cs_fold, TraitDef, MethodDef, combine_substructure}; -use syntax_ext::deriving::generic::ty::{Literal, LifetimeBounds, Path, borrowed_explicit_self}; -use syntax_pos::Span; -use rustc_plugin::Registry; - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_syntax_extension( - Symbol::intern("derive_TotalSum"), - MultiDecorator(box expand)); - - reg.register_syntax_extension( - Symbol::intern("derive_Nothing"), - MultiDecorator(box noop)); -} - -fn noop(_: &mut ExtCtxt, _: Span, _: &ast::MetaItem, _: &Annotatable, _: &mut FnMut(Annotatable)) {} - -fn expand(cx: &mut ExtCtxt, - span: Span, - mitem: &ast::MetaItem, - item: &Annotatable, - push: &mut FnMut(Annotatable)) { - let trait_def = TraitDef { - span: span, - attributes: vec![], - path: Path::new_local("TotalSum"), - additional_bounds: vec![], - generics: LifetimeBounds::empty(), - associated_types: vec![], - is_unsafe: false, - supports_unions: false, - methods: vec![ - MethodDef { - name: "total_sum", - generics: LifetimeBounds::empty(), - explicit_self: borrowed_explicit_self(), - args: vec![], - ret_ty: Literal(Path::new_local("isize")), - attributes: vec![], - is_unsafe: false, - unify_fieldless_variants: true, - combine_substructure: combine_substructure(box |cx, span, substr| { - let zero = cx.expr_isize(span, 0); - cs_fold(false, - |cx, span, subexpr, field, _| { - cx.expr_binary(span, ast::BinOpKind::Add, subexpr, - cx.expr_method_call(span, field, - ast::Ident::from_str("total_sum"), vec![])) - }, - zero, - box |cx, span, _, _| { cx.span_bug(span, "wtf??"); }, - cx, span, substr) - }), - }, - ], - }; - - trait_def.expand(cx, mitem, item, push) -} diff --git a/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs b/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs deleted file mode 100644 index 699972c9a85..00000000000 --- a/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs +++ /dev/null @@ -1,84 +0,0 @@ -// force-host - -#![feature(plugin_registrar)] -#![feature(box_syntax)] -#![feature(rustc_private)] - -extern crate syntax; -extern crate syntax_ext; -extern crate syntax_pos; -extern crate rustc; -extern crate rustc_plugin; - -use syntax::ast; -use syntax::attr; -use syntax::ext::base::{MultiDecorator, ExtCtxt, Annotatable}; -use syntax::ext::build::AstBuilder; -use syntax::symbol::Symbol; -use syntax::ptr::P; -use syntax_ext::deriving::generic::{TraitDef, MethodDef, combine_substructure}; -use syntax_ext::deriving::generic::{Substructure, Struct, EnumMatching}; -use syntax_ext::deriving::generic::ty::{Literal, LifetimeBounds, Path, borrowed_explicit_self}; -use syntax_pos::Span; -use rustc_plugin::Registry; - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_syntax_extension( - Symbol::intern("rustc_derive_TotalSum"), - MultiDecorator(box expand)); -} - -fn expand(cx: &mut ExtCtxt, - span: Span, - mitem: &ast::MetaItem, - item: &Annotatable, - push: &mut FnMut(Annotatable)) { - let trait_def = TraitDef { - span: span, - attributes: vec![], - path: Path::new_local("TotalSum"), - additional_bounds: vec![], - generics: LifetimeBounds::empty(), - associated_types: vec![], - is_unsafe: false, - supports_unions: false, - methods: vec![ - MethodDef { - name: "total_sum", - generics: LifetimeBounds::empty(), - explicit_self: borrowed_explicit_self(), - args: vec![], - ret_ty: Literal(Path::new_local("isize")), - attributes: vec![], - is_unsafe: false, - unify_fieldless_variants: true, - combine_substructure: combine_substructure(Box::new(totalsum_substructure)), - }, - ], - }; - - trait_def.expand(cx, mitem, item, push) -} - -// Mostly copied from syntax::ext::deriving::hash -/// Defines how the implementation for `trace()` is to be generated -fn totalsum_substructure(cx: &mut ExtCtxt, trait_span: Span, - substr: &Substructure) -> P { - let fields = match *substr.fields { - Struct(_, ref fs) | EnumMatching(.., ref fs) => fs, - _ => cx.span_bug(trait_span, "impossible substructure") - }; - - fields.iter().fold(cx.expr_isize(trait_span, 0), |acc, ref item| { - if attr::contains_name(&item.attrs, "ignore") { - acc - } else { - cx.expr_binary(item.span, ast::BinOpKind::Add, acc, - cx.expr_method_call(item.span, - item.self_.clone(), - substr.method_ident, - Vec::new())) - } - }) -} diff --git a/src/test/run-pass-fulldeps/auxiliary/issue-24106.rs b/src/test/run-pass-fulldeps/auxiliary/issue-24106.rs new file mode 100644 index 00000000000..2c6a6034806 --- /dev/null +++ b/src/test/run-pass-fulldeps/auxiliary/issue-24106.rs @@ -0,0 +1,13 @@ +#![crate_type="lib"] + +enum E { E0 = 0, E1 = 1 } +const E0_U8: u8 = E::E0 as u8; +const E1_U8: u8 = E::E1 as u8; + +pub fn go() { + match 0 { + E0_U8 => (), + E1_U8 => (), + _ => (), + } +} diff --git a/src/test/run-pass-fulldeps/auxiliary/issue_24106.rs b/src/test/run-pass-fulldeps/auxiliary/issue_24106.rs deleted file mode 100644 index 2c6a6034806..00000000000 --- a/src/test/run-pass-fulldeps/auxiliary/issue_24106.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![crate_type="lib"] - -enum E { E0 = 0, E1 = 1 } -const E0_U8: u8 = E::E0 as u8; -const E1_U8: u8 = E::E1 as u8; - -pub fn go() { - match 0 { - E0_U8 => (), - E1_U8 => (), - _ => (), - } -} diff --git a/src/test/run-pass-fulldeps/auxiliary/lint-for-crate.rs b/src/test/run-pass-fulldeps/auxiliary/lint-for-crate.rs new file mode 100644 index 00000000000..f34e10218d4 --- /dev/null +++ b/src/test/run-pass-fulldeps/auxiliary/lint-for-crate.rs @@ -0,0 +1,72 @@ +// force-host + +#![feature(plugin_registrar, rustc_private)] +#![feature(box_syntax)] + +#[macro_use] extern crate rustc; +extern crate rustc_plugin; +extern crate syntax; + +use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray}; +use rustc_plugin::Registry; +use rustc::hir; +use syntax::attr; + +macro_rules! fake_lint_pass { + ($struct:ident, $lints:expr, $($attr:expr),*) => { + struct $struct; + + impl LintPass for $struct { + fn name(&self) -> &'static str { + stringify!($struct) + } + + fn get_lints(&self) -> LintArray { + $lints + } + } + + impl<'a, 'tcx> LateLintPass<'a, 'tcx> for $struct { + fn check_crate(&mut self, cx: &LateContext, krate: &hir::Crate) { + $( + if !attr::contains_name(&krate.attrs, $attr) { + cx.span_lint(CRATE_NOT_OKAY, krate.span, + &format!("crate is not marked with #![{}]", $attr)); + } + )* + } + } + + } +} + +declare_lint!(CRATE_NOT_OKAY, Warn, "crate not marked with #![crate_okay]"); +declare_lint!(CRATE_NOT_RED, Warn, "crate not marked with #![crate_red]"); +declare_lint!(CRATE_NOT_BLUE, Warn, "crate not marked with #![crate_blue]"); +declare_lint!(CRATE_NOT_GREY, Warn, "crate not marked with #![crate_grey]"); +declare_lint!(CRATE_NOT_GREEN, Warn, "crate not marked with #![crate_green]"); + +fake_lint_pass! { + PassOkay, + lint_array!(CRATE_NOT_OKAY), // Single lint + "rustc_crate_okay" +} + +fake_lint_pass! { + PassRedBlue, + lint_array!(CRATE_NOT_RED, CRATE_NOT_BLUE), // Multiple lints + "rustc_crate_red", "rustc_crate_blue" +} + +fake_lint_pass! { + PassGreyGreen, + lint_array!(CRATE_NOT_GREY, CRATE_NOT_GREEN, ), // Trailing comma + "rustc_crate_grey", "rustc_crate_green" +} + +#[plugin_registrar] +pub fn plugin_registrar(reg: &mut Registry) { + reg.register_late_lint_pass(box PassOkay); + reg.register_late_lint_pass(box PassRedBlue); + reg.register_late_lint_pass(box PassGreyGreen); +} diff --git a/src/test/run-pass-fulldeps/auxiliary/lint_for_crate.rs b/src/test/run-pass-fulldeps/auxiliary/lint_for_crate.rs deleted file mode 100644 index f34e10218d4..00000000000 --- a/src/test/run-pass-fulldeps/auxiliary/lint_for_crate.rs +++ /dev/null @@ -1,72 +0,0 @@ -// force-host - -#![feature(plugin_registrar, rustc_private)] -#![feature(box_syntax)] - -#[macro_use] extern crate rustc; -extern crate rustc_plugin; -extern crate syntax; - -use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray}; -use rustc_plugin::Registry; -use rustc::hir; -use syntax::attr; - -macro_rules! fake_lint_pass { - ($struct:ident, $lints:expr, $($attr:expr),*) => { - struct $struct; - - impl LintPass for $struct { - fn name(&self) -> &'static str { - stringify!($struct) - } - - fn get_lints(&self) -> LintArray { - $lints - } - } - - impl<'a, 'tcx> LateLintPass<'a, 'tcx> for $struct { - fn check_crate(&mut self, cx: &LateContext, krate: &hir::Crate) { - $( - if !attr::contains_name(&krate.attrs, $attr) { - cx.span_lint(CRATE_NOT_OKAY, krate.span, - &format!("crate is not marked with #![{}]", $attr)); - } - )* - } - } - - } -} - -declare_lint!(CRATE_NOT_OKAY, Warn, "crate not marked with #![crate_okay]"); -declare_lint!(CRATE_NOT_RED, Warn, "crate not marked with #![crate_red]"); -declare_lint!(CRATE_NOT_BLUE, Warn, "crate not marked with #![crate_blue]"); -declare_lint!(CRATE_NOT_GREY, Warn, "crate not marked with #![crate_grey]"); -declare_lint!(CRATE_NOT_GREEN, Warn, "crate not marked with #![crate_green]"); - -fake_lint_pass! { - PassOkay, - lint_array!(CRATE_NOT_OKAY), // Single lint - "rustc_crate_okay" -} - -fake_lint_pass! { - PassRedBlue, - lint_array!(CRATE_NOT_RED, CRATE_NOT_BLUE), // Multiple lints - "rustc_crate_red", "rustc_crate_blue" -} - -fake_lint_pass! { - PassGreyGreen, - lint_array!(CRATE_NOT_GREY, CRATE_NOT_GREEN, ), // Trailing comma - "rustc_crate_grey", "rustc_crate_green" -} - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_late_lint_pass(box PassOkay); - reg.register_late_lint_pass(box PassRedBlue); - reg.register_late_lint_pass(box PassGreyGreen); -} diff --git a/src/test/run-pass-fulldeps/auxiliary/llvm-pass-plugin.rs b/src/test/run-pass-fulldeps/auxiliary/llvm-pass-plugin.rs new file mode 100644 index 00000000000..b5307446bca --- /dev/null +++ b/src/test/run-pass-fulldeps/auxiliary/llvm-pass-plugin.rs @@ -0,0 +1,19 @@ +// force-host + +#![feature(plugin_registrar)] +#![feature(rustc_private)] + +extern crate rustc; +extern crate rustc_plugin; + +use rustc_plugin::Registry; + +#[plugin_registrar] +pub fn plugin_registrar(reg: &mut Registry) { + // This pass is built in to LLVM. + // + // Normally, we would name a pass that was registered through + // C++ static object constructors in the same .so file as the + // plugin registrar. + reg.register_llvm_pass("gvn"); +} diff --git a/src/test/run-pass-fulldeps/auxiliary/llvm_pass_plugin.rs b/src/test/run-pass-fulldeps/auxiliary/llvm_pass_plugin.rs deleted file mode 100644 index b5307446bca..00000000000 --- a/src/test/run-pass-fulldeps/auxiliary/llvm_pass_plugin.rs +++ /dev/null @@ -1,19 +0,0 @@ -// force-host - -#![feature(plugin_registrar)] -#![feature(rustc_private)] - -extern crate rustc; -extern crate rustc_plugin; - -use rustc_plugin::Registry; - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - // This pass is built in to LLVM. - // - // Normally, we would name a pass that was registered through - // C++ static object constructors in the same .so file as the - // plugin registrar. - reg.register_llvm_pass("gvn"); -} diff --git a/src/test/run-pass-fulldeps/auxiliary/macro-crate-test.rs b/src/test/run-pass-fulldeps/auxiliary/macro-crate-test.rs new file mode 100644 index 00000000000..a2b1d6976d0 --- /dev/null +++ b/src/test/run-pass-fulldeps/auxiliary/macro-crate-test.rs @@ -0,0 +1,34 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![feature(rustc_private)] + +extern crate syntax; +extern crate rustc; +extern crate rustc_plugin; +extern crate syntax_pos; +extern crate proc_macro; + +use proc_macro::{TokenTree, TokenStream}; + +#[proc_macro_attribute] +pub fn rustc_duplicate(attr: TokenStream, item: TokenStream) -> TokenStream { + let mut new_name = Some(attr.into_iter().nth(0).unwrap()); + let mut encountered_idents = 0; + let input = item.to_string(); + let ret = item.into_iter().map(move |token| match token { + TokenTree::Ident(_) if encountered_idents == 1 => { + encountered_idents += 1; + new_name.take().unwrap() + } + TokenTree::Ident(_) => { + encountered_idents += 1; + token + } + _ => token + }).collect::(); + let mut input_again = input.parse::().unwrap(); + input_again.extend(ret); + input_again +} diff --git a/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs b/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs deleted file mode 100644 index a2b1d6976d0..00000000000 --- a/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs +++ /dev/null @@ -1,34 +0,0 @@ -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] -#![feature(rustc_private)] - -extern crate syntax; -extern crate rustc; -extern crate rustc_plugin; -extern crate syntax_pos; -extern crate proc_macro; - -use proc_macro::{TokenTree, TokenStream}; - -#[proc_macro_attribute] -pub fn rustc_duplicate(attr: TokenStream, item: TokenStream) -> TokenStream { - let mut new_name = Some(attr.into_iter().nth(0).unwrap()); - let mut encountered_idents = 0; - let input = item.to_string(); - let ret = item.into_iter().map(move |token| match token { - TokenTree::Ident(_) if encountered_idents == 1 => { - encountered_idents += 1; - new_name.take().unwrap() - } - TokenTree::Ident(_) => { - encountered_idents += 1; - token - } - _ => token - }).collect::(); - let mut input_again = input.parse::().unwrap(); - input_again.extend(ret); - input_again -} diff --git a/src/test/run-pass-fulldeps/auxiliary/plugin-args.rs b/src/test/run-pass-fulldeps/auxiliary/plugin-args.rs new file mode 100644 index 00000000000..309acb25184 --- /dev/null +++ b/src/test/run-pass-fulldeps/auxiliary/plugin-args.rs @@ -0,0 +1,52 @@ +// force-host + +#![feature(plugin_registrar)] +#![feature(box_syntax, rustc_private)] + +extern crate syntax; +extern crate syntax_pos; +extern crate rustc; +extern crate rustc_plugin; + +use std::borrow::ToOwned; +use syntax::ast; +use syntax::ext::hygiene; +use syntax::ext::build::AstBuilder; +use syntax::ext::base::{TTMacroExpander, ExtCtxt, MacResult, MacEager, NormalTT}; +use syntax::print::pprust; +use syntax::ptr::P; +use syntax::symbol::Symbol; +use syntax_pos::Span; +use syntax::tokenstream::TokenStream; +use rustc_plugin::Registry; + +struct Expander { + args: Vec, +} + +impl TTMacroExpander for Expander { + fn expand<'cx>(&self, + ecx: &'cx mut ExtCtxt, + sp: Span, + _: TokenStream, + _: Option) -> Box { + let args = self.args.iter().map(|i| pprust::meta_list_item_to_string(i)) + .collect::>().join(", "); + MacEager::expr(ecx.expr_str(sp, Symbol::intern(&args))) + } +} + +#[plugin_registrar] +pub fn plugin_registrar(reg: &mut Registry) { + let args = reg.args().to_owned(); + reg.register_syntax_extension(Symbol::intern("plugin_args"), + NormalTT { + expander: Box::new(Expander { args: args, }), + def_info: None, + allow_internal_unstable: None, + allow_internal_unsafe: false, + local_inner_macros: false, + unstable_feature: None, + edition: hygiene::default_edition(), + }); +} diff --git a/src/test/run-pass-fulldeps/auxiliary/plugin_args.rs b/src/test/run-pass-fulldeps/auxiliary/plugin_args.rs deleted file mode 100644 index 309acb25184..00000000000 --- a/src/test/run-pass-fulldeps/auxiliary/plugin_args.rs +++ /dev/null @@ -1,52 +0,0 @@ -// force-host - -#![feature(plugin_registrar)] -#![feature(box_syntax, rustc_private)] - -extern crate syntax; -extern crate syntax_pos; -extern crate rustc; -extern crate rustc_plugin; - -use std::borrow::ToOwned; -use syntax::ast; -use syntax::ext::hygiene; -use syntax::ext::build::AstBuilder; -use syntax::ext::base::{TTMacroExpander, ExtCtxt, MacResult, MacEager, NormalTT}; -use syntax::print::pprust; -use syntax::ptr::P; -use syntax::symbol::Symbol; -use syntax_pos::Span; -use syntax::tokenstream::TokenStream; -use rustc_plugin::Registry; - -struct Expander { - args: Vec, -} - -impl TTMacroExpander for Expander { - fn expand<'cx>(&self, - ecx: &'cx mut ExtCtxt, - sp: Span, - _: TokenStream, - _: Option) -> Box { - let args = self.args.iter().map(|i| pprust::meta_list_item_to_string(i)) - .collect::>().join(", "); - MacEager::expr(ecx.expr_str(sp, Symbol::intern(&args))) - } -} - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - let args = reg.args().to_owned(); - reg.register_syntax_extension(Symbol::intern("plugin_args"), - NormalTT { - expander: Box::new(Expander { args: args, }), - def_info: None, - allow_internal_unstable: None, - allow_internal_unsafe: false, - local_inner_macros: false, - unstable_feature: None, - edition: hygiene::default_edition(), - }); -} diff --git a/src/test/run-pass-fulldeps/auxiliary/roman-numerals.rs b/src/test/run-pass-fulldeps/auxiliary/roman-numerals.rs new file mode 100644 index 00000000000..216c81ca34c --- /dev/null +++ b/src/test/run-pass-fulldeps/auxiliary/roman-numerals.rs @@ -0,0 +1,69 @@ +// force-host + +#![crate_type="dylib"] +#![feature(plugin_registrar, rustc_private)] + +extern crate syntax; +extern crate syntax_pos; +extern crate rustc; +extern crate rustc_plugin; + +use syntax::parse::token; +use syntax::tokenstream::TokenTree; +use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacEager}; +use syntax::ext::build::AstBuilder; // trait for expr_usize +use syntax_pos::Span; +use rustc_plugin::Registry; + +// WARNING WARNING WARNING WARNING WARNING +// ======================================= +// +// This code also appears in src/doc/unstable-book/src/language-features/plugin.md. +// Please keep the two copies in sync! FIXME: have rustdoc read this file + +fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree]) + -> Box { + + static NUMERALS: &'static [(&'static str, usize)] = &[ + ("M", 1000), ("CM", 900), ("D", 500), ("CD", 400), + ("C", 100), ("XC", 90), ("L", 50), ("XL", 40), + ("X", 10), ("IX", 9), ("V", 5), ("IV", 4), + ("I", 1)]; + + if args.len() != 1 { + cx.span_err( + sp, + &format!("argument should be a single identifier, but got {} arguments", args.len())); + return DummyResult::any(sp); + } + + let text = match args[0] { + TokenTree::Token(_, token::Ident(s, _)) => s.to_string(), + _ => { + cx.span_err(sp, "argument should be a single identifier"); + return DummyResult::any(sp); + } + }; + + let mut text = &*text; + let mut total = 0; + while !text.is_empty() { + match NUMERALS.iter().find(|&&(rn, _)| text.starts_with(rn)) { + Some(&(rn, val)) => { + total += val; + text = &text[rn.len()..]; + } + None => { + cx.span_err(sp, "invalid Roman numeral"); + return DummyResult::any(sp); + } + } + } + + MacEager::expr(cx.expr_usize(sp, total)) +} + +#[plugin_registrar] +pub fn plugin_registrar(reg: &mut Registry) { + reg.register_macro("rn", expand_rn); +} diff --git a/src/test/run-pass-fulldeps/auxiliary/roman_numerals.rs b/src/test/run-pass-fulldeps/auxiliary/roman_numerals.rs deleted file mode 100644 index 216c81ca34c..00000000000 --- a/src/test/run-pass-fulldeps/auxiliary/roman_numerals.rs +++ /dev/null @@ -1,69 +0,0 @@ -// force-host - -#![crate_type="dylib"] -#![feature(plugin_registrar, rustc_private)] - -extern crate syntax; -extern crate syntax_pos; -extern crate rustc; -extern crate rustc_plugin; - -use syntax::parse::token; -use syntax::tokenstream::TokenTree; -use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacEager}; -use syntax::ext::build::AstBuilder; // trait for expr_usize -use syntax_pos::Span; -use rustc_plugin::Registry; - -// WARNING WARNING WARNING WARNING WARNING -// ======================================= -// -// This code also appears in src/doc/unstable-book/src/language-features/plugin.md. -// Please keep the two copies in sync! FIXME: have rustdoc read this file - -fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree]) - -> Box { - - static NUMERALS: &'static [(&'static str, usize)] = &[ - ("M", 1000), ("CM", 900), ("D", 500), ("CD", 400), - ("C", 100), ("XC", 90), ("L", 50), ("XL", 40), - ("X", 10), ("IX", 9), ("V", 5), ("IV", 4), - ("I", 1)]; - - if args.len() != 1 { - cx.span_err( - sp, - &format!("argument should be a single identifier, but got {} arguments", args.len())); - return DummyResult::any(sp); - } - - let text = match args[0] { - TokenTree::Token(_, token::Ident(s, _)) => s.to_string(), - _ => { - cx.span_err(sp, "argument should be a single identifier"); - return DummyResult::any(sp); - } - }; - - let mut text = &*text; - let mut total = 0; - while !text.is_empty() { - match NUMERALS.iter().find(|&&(rn, _)| text.starts_with(rn)) { - Some(&(rn, val)) => { - total += val; - text = &text[rn.len()..]; - } - None => { - cx.span_err(sp, "invalid Roman numeral"); - return DummyResult::any(sp); - } - } - } - - MacEager::expr(cx.expr_usize(sp, total)) -} - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_macro("rn", expand_rn); -} diff --git a/src/test/run-pass-fulldeps/auxiliary/syntax-extension-with-dll-deps-1.rs b/src/test/run-pass-fulldeps/auxiliary/syntax-extension-with-dll-deps-1.rs new file mode 100644 index 00000000000..8b00fb81cd2 --- /dev/null +++ b/src/test/run-pass-fulldeps/auxiliary/syntax-extension-with-dll-deps-1.rs @@ -0,0 +1,7 @@ +// force-host + +#![crate_type = "dylib"] + +pub fn the_answer() -> isize { + 2 +} diff --git a/src/test/run-pass-fulldeps/auxiliary/syntax_extension_with_dll_deps_1.rs b/src/test/run-pass-fulldeps/auxiliary/syntax_extension_with_dll_deps_1.rs deleted file mode 100644 index 8b00fb81cd2..00000000000 --- a/src/test/run-pass-fulldeps/auxiliary/syntax_extension_with_dll_deps_1.rs +++ /dev/null @@ -1,7 +0,0 @@ -// force-host - -#![crate_type = "dylib"] - -pub fn the_answer() -> isize { - 2 -} diff --git a/src/test/run-pass-fulldeps/custom-derive-partial-eq.rs b/src/test/run-pass-fulldeps/custom-derive-partial-eq.rs index 21b8ec7be98..ac8fff4f6bf 100644 --- a/src/test/run-pass-fulldeps/custom-derive-partial-eq.rs +++ b/src/test/run-pass-fulldeps/custom-derive-partial-eq.rs @@ -1,4 +1,4 @@ -// aux-build:custom_derive_partial_eq.rs +// aux-build:custom-derive-partial-eq.rs // ignore-stage1 #![feature(plugin)] #![plugin(custom_derive_partial_eq)] diff --git a/src/test/run-pass-fulldeps/derive-totalsum-attr.rs b/src/test/run-pass-fulldeps/derive-totalsum-attr.rs index 769861e7c94..38eaa71dd6a 100644 --- a/src/test/run-pass-fulldeps/derive-totalsum-attr.rs +++ b/src/test/run-pass-fulldeps/derive-totalsum-attr.rs @@ -1,4 +1,4 @@ -// aux-build:custom_derive_plugin_attr.rs +// aux-build:custom-derive-plugin-attr.rs // ignore-stage1 #![feature(plugin, rustc_attrs)] diff --git a/src/test/run-pass-fulldeps/derive-totalsum.rs b/src/test/run-pass-fulldeps/derive-totalsum.rs index be26943b6dc..2b0bb51d90a 100644 --- a/src/test/run-pass-fulldeps/derive-totalsum.rs +++ b/src/test/run-pass-fulldeps/derive-totalsum.rs @@ -1,4 +1,4 @@ -// aux-build:custom_derive_plugin.rs +// aux-build:custom-derive-plugin.rs // ignore-stage1 #![feature(plugin)] diff --git a/src/test/run-pass-fulldeps/issue-15778-pass.rs b/src/test/run-pass-fulldeps/issue-15778-pass.rs index 50e9b14b268..2add3ccbe36 100644 --- a/src/test/run-pass-fulldeps/issue-15778-pass.rs +++ b/src/test/run-pass-fulldeps/issue-15778-pass.rs @@ -1,4 +1,4 @@ -// aux-build:lint_for_crate.rs +// aux-build:lint-for-crate.rs // ignore-stage1 // compile-flags: -D crate-not-okay diff --git a/src/test/run-pass-fulldeps/issue-24106.rs b/src/test/run-pass-fulldeps/issue-24106.rs new file mode 100644 index 00000000000..e8e85ff3377 --- /dev/null +++ b/src/test/run-pass-fulldeps/issue-24106.rs @@ -0,0 +1,7 @@ +// aux-build:issue-24106.rs + +extern crate issue_24106; + +fn main() { + issue_24106::go::<()>(); +} diff --git a/src/test/run-pass-fulldeps/issue-40663.rs b/src/test/run-pass-fulldeps/issue-40663.rs index cb01eddd7e4..133f6302bde 100644 --- a/src/test/run-pass-fulldeps/issue-40663.rs +++ b/src/test/run-pass-fulldeps/issue-40663.rs @@ -1,5 +1,5 @@ #![allow(dead_code)] -// aux-build:custom_derive_plugin.rs +// aux-build:custom-derive-plugin.rs // ignore-stage1 #![feature(plugin)] diff --git a/src/test/run-pass-fulldeps/issue_24106.rs b/src/test/run-pass-fulldeps/issue_24106.rs deleted file mode 100644 index a497d9f33ae..00000000000 --- a/src/test/run-pass-fulldeps/issue_24106.rs +++ /dev/null @@ -1,7 +0,0 @@ -// aux-build:issue_24106.rs - -extern crate issue_24106; - -fn main() { - issue_24106::go::<()>(); -} diff --git a/src/test/run-pass-fulldeps/llvm-pass-plugin.rs b/src/test/run-pass-fulldeps/llvm-pass-plugin.rs index 3aad40ecfe8..411631104a4 100644 --- a/src/test/run-pass-fulldeps/llvm-pass-plugin.rs +++ b/src/test/run-pass-fulldeps/llvm-pass-plugin.rs @@ -1,4 +1,4 @@ -// aux-build:llvm_pass_plugin.rs +// aux-build:llvm-pass-plugin.rs // ignore-stage1 #![feature(plugin)] diff --git a/src/test/run-pass-fulldeps/macro-crate-multi-decorator.rs b/src/test/run-pass-fulldeps/macro-crate-multi-decorator.rs index dcac160c4c9..573bfca3168 100644 --- a/src/test/run-pass-fulldeps/macro-crate-multi-decorator.rs +++ b/src/test/run-pass-fulldeps/macro-crate-multi-decorator.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(unused_variables)] #![allow(unused_imports)] -// aux-build:macro_crate_test.rs +// aux-build:macro-crate-test.rs // ignore-stage1 #![feature(rustc_attrs)] diff --git a/src/test/run-pass-fulldeps/plugin-args-1.rs b/src/test/run-pass-fulldeps/plugin-args-1.rs index 0111af1c768..1bdf004e305 100644 --- a/src/test/run-pass-fulldeps/plugin-args-1.rs +++ b/src/test/run-pass-fulldeps/plugin-args-1.rs @@ -1,4 +1,4 @@ -// aux-build:plugin_args.rs +// aux-build:plugin-args.rs // ignore-stage1 #![feature(plugin)] diff --git a/src/test/run-pass-fulldeps/plugin-args-2.rs b/src/test/run-pass-fulldeps/plugin-args-2.rs index e4a3dfab566..83091df0582 100644 --- a/src/test/run-pass-fulldeps/plugin-args-2.rs +++ b/src/test/run-pass-fulldeps/plugin-args-2.rs @@ -1,4 +1,4 @@ -// aux-build:plugin_args.rs +// aux-build:plugin-args.rs // ignore-stage1 #![feature(plugin)] diff --git a/src/test/run-pass-fulldeps/plugin-args-3.rs b/src/test/run-pass-fulldeps/plugin-args-3.rs index 4696233f281..9cd9bee5a0f 100644 --- a/src/test/run-pass-fulldeps/plugin-args-3.rs +++ b/src/test/run-pass-fulldeps/plugin-args-3.rs @@ -1,4 +1,4 @@ -// aux-build:plugin_args.rs +// aux-build:plugin-args.rs // ignore-stage1 #![feature(plugin)] diff --git a/src/test/run-pass-fulldeps/roman-numerals-macro.rs b/src/test/run-pass-fulldeps/roman-numerals-macro.rs index 59a2d132cdc..49c12e426fe 100644 --- a/src/test/run-pass-fulldeps/roman-numerals-macro.rs +++ b/src/test/run-pass-fulldeps/roman-numerals-macro.rs @@ -1,4 +1,4 @@ -// aux-build:roman_numerals.rs +// aux-build:roman-numerals.rs // ignore-stage1 #![feature(plugin)] diff --git a/src/test/run-pass/auxiliary/rmeta-rlib.rs b/src/test/run-pass/auxiliary/rmeta-rlib.rs new file mode 100644 index 00000000000..f5e8c3d2a5c --- /dev/null +++ b/src/test/run-pass/auxiliary/rmeta-rlib.rs @@ -0,0 +1,8 @@ +// no-prefer-dynamic + +#![crate_type="rlib"] +#![crate_name="rmeta_aux"] + +pub struct Foo { + pub field: i32, +} diff --git a/src/test/run-pass/auxiliary/rmeta-rmeta.rs b/src/test/run-pass/auxiliary/rmeta-rmeta.rs new file mode 100644 index 00000000000..4a6d055a81f --- /dev/null +++ b/src/test/run-pass/auxiliary/rmeta-rmeta.rs @@ -0,0 +1,9 @@ +// no-prefer-dynamic +// compile-flags: --emit=metadata + +#![crate_type="rlib"] +#![crate_name="rmeta_aux"] + +pub struct Foo { + pub field2: i32, +} diff --git a/src/test/run-pass/auxiliary/rmeta_rlib.rs b/src/test/run-pass/auxiliary/rmeta_rlib.rs deleted file mode 100644 index f5e8c3d2a5c..00000000000 --- a/src/test/run-pass/auxiliary/rmeta_rlib.rs +++ /dev/null @@ -1,8 +0,0 @@ -// no-prefer-dynamic - -#![crate_type="rlib"] -#![crate_name="rmeta_aux"] - -pub struct Foo { - pub field: i32, -} diff --git a/src/test/run-pass/auxiliary/rmeta_rmeta.rs b/src/test/run-pass/auxiliary/rmeta_rmeta.rs deleted file mode 100644 index 4a6d055a81f..00000000000 --- a/src/test/run-pass/auxiliary/rmeta_rmeta.rs +++ /dev/null @@ -1,9 +0,0 @@ -// no-prefer-dynamic -// compile-flags: --emit=metadata - -#![crate_type="rlib"] -#![crate_name="rmeta_aux"] - -pub struct Foo { - pub field2: i32, -} diff --git a/src/test/run-pass/issue-18952.rs b/src/test/run-pass/issue-18952.rs deleted file mode 100644 index 56378b59e36..00000000000 --- a/src/test/run-pass/issue-18952.rs +++ /dev/null @@ -1,56 +0,0 @@ -// This issue tests fn_traits overloading on arity. -// run-pass - -#![feature(fn_traits)] -#![feature(unboxed_closures)] - -struct Foo; - -impl Fn<(isize, isize)> for Foo { - extern "rust-call" fn call(&self, args: (isize, isize)) -> Self::Output { - println!("{:?}", args); - (args.0 + 1, args.1 + 1) - } -} - -impl FnMut<(isize, isize)> for Foo { - extern "rust-call" fn call_mut(&mut self, args: (isize, isize)) -> Self::Output { - println!("{:?}", args); - (args.0 + 1, args.1 + 1) - } -} - -impl FnOnce<(isize, isize)> for Foo { - type Output = (isize, isize); - extern "rust-call" fn call_once(self, args: (isize, isize)) -> Self::Output { - println!("{:?}", args); - (args.0 + 1, args.1 + 1) - } -} - -impl Fn<(isize, isize, isize)> for Foo { - extern "rust-call" fn call(&self, args: (isize, isize, isize)) -> Self::Output { - println!("{:?}", args); - (args.0 + 3, args.1 + 3, args.2 + 3) - } -} - -impl FnMut<(isize, isize, isize)> for Foo { - extern "rust-call" fn call_mut(&mut self, args: (isize, isize, isize)) -> Self::Output { - println!("{:?}", args); - (args.0 + 3, args.1 + 3, args.2 + 3) - } -} -impl FnOnce<(isize, isize, isize)> for Foo { - type Output = (isize, isize, isize); - extern "rust-call" fn call_once(self, args: (isize, isize, isize)) -> Self::Output { - println!("{:?}", args); - (args.0 + 3, args.1 + 3, args.2 + 3) - } -} - -fn main() { - let foo = Foo; - assert_eq!(foo(1, 1), (2, 2)); - assert_eq!(foo(1, 1, 1), (4, 4, 4)); -} diff --git a/src/test/run-pass/issue-45510.rs b/src/test/run-pass/issue-45510.rs deleted file mode 100644 index 9e104ce6c4f..00000000000 --- a/src/test/run-pass/issue-45510.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Test overloaded resolution of fn_traits. -// run-pass - -#![feature(fn_traits)] -#![feature(unboxed_closures)] - -#[derive(Debug, PartialEq, Eq)] -struct Ishmael; -#[derive(Debug, PartialEq, Eq)] -struct Maybe; -struct CallMe; - -impl FnOnce<(Ishmael,)> for CallMe { - type Output = Ishmael; - extern "rust-call" fn call_once(self, _args: (Ishmael,)) -> Ishmael { - println!("Split your lungs with blood and thunder!"); - Ishmael - } -} - -impl FnOnce<(Maybe,)> for CallMe { - type Output = Maybe; - extern "rust-call" fn call_once(self, _args: (Maybe,)) -> Maybe { - println!("So we just met, and this is crazy"); - Maybe - } -} - -fn main() { - assert_eq!(CallMe(Ishmael), Ishmael); - assert_eq!(CallMe(Maybe), Maybe); -} diff --git a/src/test/run-pass/issue-48006.rs b/src/test/run-pass/issue-48006.rs deleted file mode 100644 index 8e7105cf10c..00000000000 --- a/src/test/run-pass/issue-48006.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![feature(step_trait)] - -use std::iter::Step; - -#[cfg(target_pointer_width = "16")] -fn main() { - assert!(Step::steps_between(&0u32, &::std::u32::MAX).is_none()); -} - -#[cfg(any(target_pointer_width = "32", target_pointer_width = "64"))] -fn main() { - assert!(Step::steps_between(&0u32, &::std::u32::MAX).is_some()); -} diff --git a/src/test/run-pass/issue-53728.rs b/src/test/run-pass/issue-53728.rs deleted file mode 100644 index 00666972e25..00000000000 --- a/src/test/run-pass/issue-53728.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![allow(dead_code)] -#[repr(u16)] -enum DeviceKind { - Nil = 0, -} - -#[repr(packed)] -struct DeviceInfo { - endianness: u8, - device_kind: DeviceKind, -} - -fn main() { - let _x = None::<(DeviceInfo, u8)>; - let _y = None::<(DeviceInfo, u16)>; - let _z = None::<(DeviceInfo, u64)>; -} diff --git a/src/test/run-pass/issue-53843.rs b/src/test/run-pass/issue-53843.rs deleted file mode 100644 index 53728ec4d9f..00000000000 --- a/src/test/run-pass/issue-53843.rs +++ /dev/null @@ -1,24 +0,0 @@ -use std::ops::Deref; - -pub struct Pin

(P); - -impl Deref for Pin

-where - P: Deref, -{ - type Target = T; - - fn deref(&self) -> &T { - &*self.0 - } -} - -impl

Pin

{ - fn poll(self) {} -} - -fn main() { - let mut unit = (); - let pin = Pin(&mut unit); - pin.poll(); -} diff --git a/src/test/run-pass/issue-54462-mutable-noalias-correctness.rs b/src/test/run-pass/issue-54462-mutable-noalias-correctness.rs deleted file mode 100644 index e7966b2978f..00000000000 --- a/src/test/run-pass/issue-54462-mutable-noalias-correctness.rs +++ /dev/null @@ -1,24 +0,0 @@ -// -// compile-flags: -Ccodegen-units=1 -O - -fn linidx(row: usize, col: usize) -> usize { - row * 1 + col * 3 -} - -fn main() { - let mut mat = [1.0f32, 5.0, 9.0, 2.0, 6.0, 10.0, 3.0, 7.0, 11.0, 4.0, 8.0, 12.0]; - - for i in 0..2 { - for j in i+1..3 { - if mat[linidx(j, 3)] > mat[linidx(i, 3)] { - for k in 0..4 { - let (x, rest) = mat.split_at_mut(linidx(i, k) + 1); - let a = x.last_mut().unwrap(); - let b = rest.get_mut(linidx(j, k) - linidx(i, k) - 1).unwrap(); - ::std::mem::swap(a, b); - } - } - } - } - assert_eq!([9.0, 5.0, 1.0, 10.0, 6.0, 2.0, 11.0, 7.0, 3.0, 12.0, 8.0, 4.0], mat); -} diff --git a/src/test/run-pass/issue-54467.rs b/src/test/run-pass/issue-54467.rs deleted file mode 100644 index 52a9828b548..00000000000 --- a/src/test/run-pass/issue-54467.rs +++ /dev/null @@ -1,44 +0,0 @@ -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/run-pass/issue-55376.rs b/src/test/run-pass/issue-55376.rs deleted file mode 100644 index fa92a85a445..00000000000 --- a/src/test/run-pass/issue-55376.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Tests that paths in `pub(...)` don't fail HIR verification. - -#![allow(unused_imports)] -#![allow(dead_code)] - -pub(self) use self::my_mod::Foo; - -mod my_mod { - pub(super) use self::Foo as Bar; - pub(in super::my_mod) use self::Foo as Baz; - - pub struct Foo; -} - -fn main() {} diff --git a/src/test/run-pass/issue-55380.rs b/src/test/run-pass/issue-55380.rs deleted file mode 100644 index 862218e2192..00000000000 --- a/src/test/run-pass/issue-55380.rs +++ /dev/null @@ -1,28 +0,0 @@ -// run-pass - -#![feature(specialization)] - -pub trait Foo { - fn abc() -> u32; - fn def() -> u32; -} - -pub trait Marker {} - -impl Marker for () {} - -impl Foo for T { - default fn abc() -> u32 { 16 } - default fn def() -> u32 { 42 } -} - -impl Foo for T { - fn def() -> u32 { - Self::abc() - } -} - -fn main() { - assert_eq!(<()>::def(), 16); - assert_eq!(::def(), 42); -} diff --git a/src/test/run-pass/issue-56237.rs b/src/test/run-pass/issue-56237.rs deleted file mode 100644 index 87e10e83612..00000000000 --- a/src/test/run-pass/issue-56237.rs +++ /dev/null @@ -1,11 +0,0 @@ -use std::ops::Deref; - -fn foo

(_value:

::Target) -where - P: Deref, -

::Target: Sized, -{} - -fn main() { - foo::>(2); -} diff --git a/src/test/run-pass/issues/auxiliary/issue-10031-aux.rs b/src/test/run-pass/issues/auxiliary/issue-10031-aux.rs new file mode 100644 index 00000000000..e2abeb99ea8 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-10031-aux.rs @@ -0,0 +1 @@ +pub struct Wrap(pub A); diff --git a/src/test/run-pass/issues/auxiliary/issue-12612-1.rs b/src/test/run-pass/issues/auxiliary/issue-12612-1.rs new file mode 100644 index 00000000000..01f5a784bb7 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-12612-1.rs @@ -0,0 +1,3 @@ +pub mod bar { + pub fn foo() {} +} diff --git a/src/test/run-pass/issues/auxiliary/issue-12612-2.rs b/src/test/run-pass/issues/auxiliary/issue-12612-2.rs new file mode 100644 index 00000000000..2c724787193 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-12612-2.rs @@ -0,0 +1 @@ +pub fn baz() {} diff --git a/src/test/run-pass/issues/auxiliary/issue-13507.rs b/src/test/run-pass/issues/auxiliary/issue-13507.rs new file mode 100644 index 00000000000..c91013043eb --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-13507.rs @@ -0,0 +1,87 @@ +pub mod testtypes { + use std::any::TypeId; + + pub fn type_ids() -> Vec { + vec![ + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::() + ] + } + + // Tests Bool + pub type FooBool = bool; + + // Tests Char + pub type FooChar = char; + + // Tests Int (does not test all variants of IntTy) + pub type FooInt = isize; + + // Tests Uint (does not test all variants of UintTy) + pub type FooUint = usize; + + // Tests Float (does not test all variants of FloatTy) + pub type FooFloat = f64; + + // Tests Str + pub type FooStr = str; + + // Tests Array + pub type FooArray = [u8; 1]; + + // Tests Slice + pub type FooSlice = [u8]; + + // Tests Box (of u8) + pub type FooBox = Box; + + // Tests RawPtr + pub type FooPtr = *const u8; + + // Tests Ref + pub type FooRef = &'static u8; + + // Tests FnPtr + pub type FooFnPtr = fn(u8) -> bool; + + // Tests Dynamic + pub trait FooTrait { + fn foo_method(&self) -> usize; + } + + // Tests struct + pub struct FooStruct { + pub pub_foo_field: usize, + foo_field: usize + } + + // Tests enum + pub enum FooEnum { + VarA(usize), + VarB(usize, usize) + } + + // Tests Tuple + pub type FooNil = (); + pub type FooTuple = (u8, i8, bool); + + // Skipping Param + + // Skipping Infer + + // Skipping Error +} diff --git a/src/test/run-pass/issues/auxiliary/issue-19293.rs b/src/test/run-pass/issues/auxiliary/issue-19293.rs new file mode 100644 index 00000000000..31359e86559 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-19293.rs @@ -0,0 +1,4 @@ +pub struct Foo (pub isize); +pub enum MyEnum { + Foo(Foo), +} diff --git a/src/test/run-pass/issues/auxiliary/issue-20389.rs b/src/test/run-pass/issues/auxiliary/issue-20389.rs new file mode 100644 index 00000000000..ae6d44eeb77 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-20389.rs @@ -0,0 +1,4 @@ +pub trait T { + type C; + fn dummy(&self) { } +} diff --git a/src/test/run-pass/issues/auxiliary/issue-2170-lib.rs b/src/test/run-pass/issues/auxiliary/issue-2170-lib.rs new file mode 100644 index 00000000000..a99385a834d --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-2170-lib.rs @@ -0,0 +1,18 @@ +fn foo(_x: i32) { +} + +pub struct rsrc { + x: i32, +} + +impl Drop for rsrc { + fn drop(&mut self) { + foo(self.x); + } +} + +pub fn rsrc(x: i32) -> rsrc { + rsrc { + x: x + } +} diff --git a/src/test/run-pass/issues/auxiliary/issue-2316-a.rs b/src/test/run-pass/issues/auxiliary/issue-2316-a.rs new file mode 100644 index 00000000000..418ddc0b069 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-2316-a.rs @@ -0,0 +1,3 @@ +enum cat { + tabby, calico, tortoiseshell +} diff --git a/src/test/run-pass/issues/auxiliary/issue-2316-b.rs b/src/test/run-pass/issues/auxiliary/issue-2316-b.rs new file mode 100644 index 00000000000..550c2d6eb22 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-2316-b.rs @@ -0,0 +1,11 @@ +#![allow(unused_imports)] + +extern crate issue_2316_a; + +pub mod cloth { + use issue_2316_a::*; + + pub enum fabric { + gingham, flannel, calico + } +} diff --git a/src/test/run-pass/issues/auxiliary/issue-2472-b.rs b/src/test/run-pass/issues/auxiliary/issue-2472-b.rs new file mode 100644 index 00000000000..0d151520fe0 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-2472-b.rs @@ -0,0 +1,13 @@ +pub struct S(pub ()); + +impl S { + pub fn foo(&self) { } +} + +pub trait T { + fn bar(&self); +} + +impl T for S { + fn bar(&self) { } +} diff --git a/src/test/run-pass/issues/auxiliary/issue-2723-a.rs b/src/test/run-pass/issues/auxiliary/issue-2723-a.rs new file mode 100644 index 00000000000..661b46d829d --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-2723-a.rs @@ -0,0 +1,3 @@ +pub unsafe fn f(xs: Vec ) { + xs.iter().map(|_x| { unsafe fn q() { panic!(); } }).collect::>(); +} diff --git a/src/test/run-pass/issues/auxiliary/issue-3136-a.rc b/src/test/run-pass/issues/auxiliary/issue-3136-a.rc new file mode 100644 index 00000000000..cd5fd314505 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-3136-a.rc @@ -0,0 +1,4 @@ +#![crate_type = "lib"] + +#[path = "issue-3136-a.rs"] +pub mod issue_3136_a; diff --git a/src/test/run-pass/issues/auxiliary/issue-3136-a.rs b/src/test/run-pass/issues/auxiliary/issue-3136-a.rs new file mode 100644 index 00000000000..9bb546ab393 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-3136-a.rs @@ -0,0 +1,14 @@ +trait x { + fn use_x(&self); +} +struct y(()); +impl x for y { + fn use_x(&self) { + struct foo { //~ ERROR quux + i: () + } + fn new_foo(i: ()) -> foo { + foo { i: i } + } + } +} diff --git a/src/test/run-pass/issues/auxiliary/issue-34796-aux.rs b/src/test/run-pass/issues/auxiliary/issue-34796-aux.rs new file mode 100644 index 00000000000..09c69b90329 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-34796-aux.rs @@ -0,0 +1,20 @@ +#![crate_type = "lib"] +pub trait Future { + type Item; + type Error; +} + +impl Future for u32 { + type Item = (); + type Error = Box<()>; +} + +fn foo() -> Box>> { + Box::new(0u32) +} + +pub fn bar(_s: F) + where F: Fn(A) -> B, +{ + foo(); +} diff --git a/src/test/run-pass/issues/auxiliary/issue-38190.rs b/src/test/run-pass/issues/auxiliary/issue-38190.rs new file mode 100644 index 00000000000..373e646ba2c --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-38190.rs @@ -0,0 +1,2 @@ +#[macro_export] +macro_rules! m { ([$i:item]) => {} } diff --git a/src/test/run-pass/issues/auxiliary/issue-38226-aux.rs b/src/test/run-pass/issues/auxiliary/issue-38226-aux.rs new file mode 100644 index 00000000000..f968017199f --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-38226-aux.rs @@ -0,0 +1,23 @@ +#![crate_type="rlib"] + +#[inline(never)] +pub fn foo() { + let _: Box = Box::new(SomeTraitImpl); +} + +pub fn bar() { + SomeTraitImpl.bar(); +} + +mod submod { + pub trait SomeTrait { + fn bar(&self) { + panic!("NO") + } + } +} + +use self::submod::SomeTrait; + +pub struct SomeTraitImpl; +impl SomeTrait for SomeTraitImpl {} diff --git a/src/test/run-pass/issues/auxiliary/issue-38715-modern.rs b/src/test/run-pass/issues/auxiliary/issue-38715-modern.rs new file mode 100644 index 00000000000..15d072957cb --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-38715-modern.rs @@ -0,0 +1,7 @@ +#![allow(duplicate_macro_exports)] + +#[macro_export] +macro_rules! foo_modern { ($i:ident) => {} } + +#[macro_export] +macro_rules! foo_modern { () => {} } diff --git a/src/test/run-pass/issues/auxiliary/issue-38715.rs b/src/test/run-pass/issues/auxiliary/issue-38715.rs new file mode 100644 index 00000000000..5c15073f5a5 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-38715.rs @@ -0,0 +1,7 @@ +#![allow(duplicate_macro_exports)] + +#[macro_export] +macro_rules! foo { ($i:ident) => {} } + +#[macro_export] +macro_rules! foo { () => {} } diff --git a/src/test/run-pass/issues/auxiliary/issue-3979-traits.rs b/src/test/run-pass/issues/auxiliary/issue-3979-traits.rs new file mode 100644 index 00000000000..5d03a0e9e99 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-3979-traits.rs @@ -0,0 +1,15 @@ +#![crate_name="issue_3979_traits"] + +#![crate_type = "lib"] + +pub trait Positioned { + fn SetX(&mut self, _: isize); + fn X(&self) -> isize; +} + +pub trait Movable: Positioned { + fn translate(&mut self, dx: isize) { + let x = self.X() + dx; + self.SetX(x); + } +} diff --git a/src/test/run-pass/issues/auxiliary/issue-39823.rs b/src/test/run-pass/issues/auxiliary/issue-39823.rs new file mode 100644 index 00000000000..3af9c68f233 --- /dev/null +++ b/src/test/run-pass/issues/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/run-pass/issues/auxiliary/issue-40469.rs b/src/test/run-pass/issues/auxiliary/issue-40469.rs new file mode 100644 index 00000000000..4f2f41f2cde --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-40469.rs @@ -0,0 +1 @@ +macro_rules! m { () => { $crate::main(); } } diff --git a/src/test/run-pass/issues/auxiliary/issue-41053.rs b/src/test/run-pass/issues/auxiliary/issue-41053.rs new file mode 100644 index 00000000000..ae73c3e780f --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-41053.rs @@ -0,0 +1 @@ +pub struct Test; diff --git a/src/test/run-pass/issues/auxiliary/issue-42007-s.rs b/src/test/run-pass/issues/auxiliary/issue-42007-s.rs new file mode 100644 index 00000000000..95119a589c9 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-42007-s.rs @@ -0,0 +1,4 @@ +#[repr(u8)] +pub enum E { + B = 1 as u8, +} diff --git a/src/test/run-pass/issues/auxiliary/issue-8401.rs b/src/test/run-pass/issues/auxiliary/issue-8401.rs new file mode 100644 index 00000000000..e35dbbfabfc --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-8401.rs @@ -0,0 +1,16 @@ +// for this issue, this code must be built in a library + +use std::mem; + +trait A { + fn dummy(&self) { } +} +struct B; +impl A for B {} + +fn bar(_: &mut A, _: &T) {} + +fn foo(t: &T) { + let mut b = B; + bar(&mut b as &mut A, t) +} diff --git a/src/test/run-pass/issues/auxiliary/issue-9123.rs b/src/test/run-pass/issues/auxiliary/issue-9123.rs new file mode 100644 index 00000000000..60af53359e8 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-9123.rs @@ -0,0 +1,9 @@ +#![crate_type = "lib"] + +pub trait X { + fn x() { + fn f() { } + f(); + } + fn dummy(&self) { } +} diff --git a/src/test/run-pass/issues/auxiliary/issue-9155.rs b/src/test/run-pass/issues/auxiliary/issue-9155.rs new file mode 100644 index 00000000000..049a96a655a --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-9155.rs @@ -0,0 +1,7 @@ +pub struct Foo(T); + +impl Foo { + pub fn new(t: T) -> Foo { + Foo(t) + } +} diff --git a/src/test/run-pass/issues/auxiliary/issue-9188.rs b/src/test/run-pass/issues/auxiliary/issue-9188.rs new file mode 100644 index 00000000000..3bc5697a1a6 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-9188.rs @@ -0,0 +1,13 @@ +pub fn foo() -> &'static isize { + if false { + static a: isize = 4; + return &a; + } else { + static a: isize = 5; + return &a; + } +} + +pub fn bar() -> &'static isize { + foo::() +} diff --git a/src/test/run-pass/issues/auxiliary/issue13507.rs b/src/test/run-pass/issues/auxiliary/issue13507.rs deleted file mode 100644 index c91013043eb..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue13507.rs +++ /dev/null @@ -1,87 +0,0 @@ -pub mod testtypes { - use std::any::TypeId; - - pub fn type_ids() -> Vec { - vec![ - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::() - ] - } - - // Tests Bool - pub type FooBool = bool; - - // Tests Char - pub type FooChar = char; - - // Tests Int (does not test all variants of IntTy) - pub type FooInt = isize; - - // Tests Uint (does not test all variants of UintTy) - pub type FooUint = usize; - - // Tests Float (does not test all variants of FloatTy) - pub type FooFloat = f64; - - // Tests Str - pub type FooStr = str; - - // Tests Array - pub type FooArray = [u8; 1]; - - // Tests Slice - pub type FooSlice = [u8]; - - // Tests Box (of u8) - pub type FooBox = Box; - - // Tests RawPtr - pub type FooPtr = *const u8; - - // Tests Ref - pub type FooRef = &'static u8; - - // Tests FnPtr - pub type FooFnPtr = fn(u8) -> bool; - - // Tests Dynamic - pub trait FooTrait { - fn foo_method(&self) -> usize; - } - - // Tests struct - pub struct FooStruct { - pub pub_foo_field: usize, - foo_field: usize - } - - // Tests enum - pub enum FooEnum { - VarA(usize), - VarB(usize, usize) - } - - // Tests Tuple - pub type FooNil = (); - pub type FooTuple = (u8, i8, bool); - - // Skipping Param - - // Skipping Infer - - // Skipping Error -} diff --git a/src/test/run-pass/issues/auxiliary/issue2170lib.rs b/src/test/run-pass/issues/auxiliary/issue2170lib.rs deleted file mode 100644 index a99385a834d..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue2170lib.rs +++ /dev/null @@ -1,18 +0,0 @@ -fn foo(_x: i32) { -} - -pub struct rsrc { - x: i32, -} - -impl Drop for rsrc { - fn drop(&mut self) { - foo(self.x); - } -} - -pub fn rsrc(x: i32) -> rsrc { - rsrc { - x: x - } -} diff --git a/src/test/run-pass/issues/auxiliary/issue34796aux.rs b/src/test/run-pass/issues/auxiliary/issue34796aux.rs deleted file mode 100644 index 09c69b90329..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue34796aux.rs +++ /dev/null @@ -1,20 +0,0 @@ -#![crate_type = "lib"] -pub trait Future { - type Item; - type Error; -} - -impl Future for u32 { - type Item = (); - type Error = Box<()>; -} - -fn foo() -> Box>> { - Box::new(0u32) -} - -pub fn bar(_s: F) - where F: Fn(A) -> B, -{ - foo(); -} diff --git a/src/test/run-pass/issues/auxiliary/issue_10031_aux.rs b/src/test/run-pass/issues/auxiliary/issue_10031_aux.rs deleted file mode 100644 index e2abeb99ea8..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue_10031_aux.rs +++ /dev/null @@ -1 +0,0 @@ -pub struct Wrap(pub A); diff --git a/src/test/run-pass/issues/auxiliary/issue_12612_1.rs b/src/test/run-pass/issues/auxiliary/issue_12612_1.rs deleted file mode 100644 index 01f5a784bb7..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue_12612_1.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod bar { - pub fn foo() {} -} diff --git a/src/test/run-pass/issues/auxiliary/issue_12612_2.rs b/src/test/run-pass/issues/auxiliary/issue_12612_2.rs deleted file mode 100644 index 2c724787193..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue_12612_2.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn baz() {} diff --git a/src/test/run-pass/issues/auxiliary/issue_19293.rs b/src/test/run-pass/issues/auxiliary/issue_19293.rs deleted file mode 100644 index 31359e86559..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue_19293.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub struct Foo (pub isize); -pub enum MyEnum { - Foo(Foo), -} diff --git a/src/test/run-pass/issues/auxiliary/issue_20389.rs b/src/test/run-pass/issues/auxiliary/issue_20389.rs deleted file mode 100644 index ae6d44eeb77..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue_20389.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub trait T { - type C; - fn dummy(&self) { } -} diff --git a/src/test/run-pass/issues/auxiliary/issue_2316_a.rs b/src/test/run-pass/issues/auxiliary/issue_2316_a.rs deleted file mode 100644 index 418ddc0b069..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue_2316_a.rs +++ /dev/null @@ -1,3 +0,0 @@ -enum cat { - tabby, calico, tortoiseshell -} diff --git a/src/test/run-pass/issues/auxiliary/issue_2316_b.rs b/src/test/run-pass/issues/auxiliary/issue_2316_b.rs deleted file mode 100644 index 550c2d6eb22..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue_2316_b.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![allow(unused_imports)] - -extern crate issue_2316_a; - -pub mod cloth { - use issue_2316_a::*; - - pub enum fabric { - gingham, flannel, calico - } -} diff --git a/src/test/run-pass/issues/auxiliary/issue_2472_b.rs b/src/test/run-pass/issues/auxiliary/issue_2472_b.rs deleted file mode 100644 index 0d151520fe0..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue_2472_b.rs +++ /dev/null @@ -1,13 +0,0 @@ -pub struct S(pub ()); - -impl S { - pub fn foo(&self) { } -} - -pub trait T { - fn bar(&self); -} - -impl T for S { - fn bar(&self) { } -} diff --git a/src/test/run-pass/issues/auxiliary/issue_2723_a.rs b/src/test/run-pass/issues/auxiliary/issue_2723_a.rs deleted file mode 100644 index 661b46d829d..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue_2723_a.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub unsafe fn f(xs: Vec ) { - xs.iter().map(|_x| { unsafe fn q() { panic!(); } }).collect::>(); -} diff --git a/src/test/run-pass/issues/auxiliary/issue_3136_a.rc b/src/test/run-pass/issues/auxiliary/issue_3136_a.rc deleted file mode 100644 index 46da4132b82..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue_3136_a.rc +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type = "lib"] - -pub mod issue_3136_a; diff --git a/src/test/run-pass/issues/auxiliary/issue_3136_a.rs b/src/test/run-pass/issues/auxiliary/issue_3136_a.rs deleted file mode 100644 index 9bb546ab393..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue_3136_a.rs +++ /dev/null @@ -1,14 +0,0 @@ -trait x { - fn use_x(&self); -} -struct y(()); -impl x for y { - fn use_x(&self) { - struct foo { //~ ERROR quux - i: () - } - fn new_foo(i: ()) -> foo { - foo { i: i } - } - } -} diff --git a/src/test/run-pass/issues/auxiliary/issue_38190.rs b/src/test/run-pass/issues/auxiliary/issue_38190.rs deleted file mode 100644 index 373e646ba2c..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue_38190.rs +++ /dev/null @@ -1,2 +0,0 @@ -#[macro_export] -macro_rules! m { ([$i:item]) => {} } diff --git a/src/test/run-pass/issues/auxiliary/issue_38226_aux.rs b/src/test/run-pass/issues/auxiliary/issue_38226_aux.rs deleted file mode 100644 index f968017199f..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue_38226_aux.rs +++ /dev/null @@ -1,23 +0,0 @@ -#![crate_type="rlib"] - -#[inline(never)] -pub fn foo() { - let _: Box = Box::new(SomeTraitImpl); -} - -pub fn bar() { - SomeTraitImpl.bar(); -} - -mod submod { - pub trait SomeTrait { - fn bar(&self) { - panic!("NO") - } - } -} - -use self::submod::SomeTrait; - -pub struct SomeTraitImpl; -impl SomeTrait for SomeTraitImpl {} diff --git a/src/test/run-pass/issues/auxiliary/issue_38715-modern.rs b/src/test/run-pass/issues/auxiliary/issue_38715-modern.rs deleted file mode 100644 index 15d072957cb..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue_38715-modern.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![allow(duplicate_macro_exports)] - -#[macro_export] -macro_rules! foo_modern { ($i:ident) => {} } - -#[macro_export] -macro_rules! foo_modern { () => {} } diff --git a/src/test/run-pass/issues/auxiliary/issue_38715.rs b/src/test/run-pass/issues/auxiliary/issue_38715.rs deleted file mode 100644 index 5c15073f5a5..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue_38715.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![allow(duplicate_macro_exports)] - -#[macro_export] -macro_rules! foo { ($i:ident) => {} } - -#[macro_export] -macro_rules! foo { () => {} } diff --git a/src/test/run-pass/issues/auxiliary/issue_3979_traits.rs b/src/test/run-pass/issues/auxiliary/issue_3979_traits.rs deleted file mode 100644 index 5d03a0e9e99..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue_3979_traits.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![crate_name="issue_3979_traits"] - -#![crate_type = "lib"] - -pub trait Positioned { - fn SetX(&mut self, _: isize); - fn X(&self) -> isize; -} - -pub trait Movable: Positioned { - fn translate(&mut self, dx: isize) { - let x = self.X() + dx; - self.SetX(x); - } -} diff --git a/src/test/run-pass/issues/auxiliary/issue_39823.rs b/src/test/run-pass/issues/auxiliary/issue_39823.rs deleted file mode 100644 index 3af9c68f233..00000000000 --- a/src/test/run-pass/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/run-pass/issues/auxiliary/issue_40469.rs b/src/test/run-pass/issues/auxiliary/issue_40469.rs deleted file mode 100644 index 4f2f41f2cde..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue_40469.rs +++ /dev/null @@ -1 +0,0 @@ -macro_rules! m { () => { $crate::main(); } } diff --git a/src/test/run-pass/issues/auxiliary/issue_41053.rs b/src/test/run-pass/issues/auxiliary/issue_41053.rs deleted file mode 100644 index ae73c3e780f..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue_41053.rs +++ /dev/null @@ -1 +0,0 @@ -pub struct Test; diff --git a/src/test/run-pass/issues/auxiliary/issue_42007_s.rs b/src/test/run-pass/issues/auxiliary/issue_42007_s.rs deleted file mode 100644 index 95119a589c9..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue_42007_s.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[repr(u8)] -pub enum E { - B = 1 as u8, -} diff --git a/src/test/run-pass/issues/auxiliary/issue_8401.rs b/src/test/run-pass/issues/auxiliary/issue_8401.rs deleted file mode 100644 index e35dbbfabfc..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue_8401.rs +++ /dev/null @@ -1,16 +0,0 @@ -// for this issue, this code must be built in a library - -use std::mem; - -trait A { - fn dummy(&self) { } -} -struct B; -impl A for B {} - -fn bar(_: &mut A, _: &T) {} - -fn foo(t: &T) { - let mut b = B; - bar(&mut b as &mut A, t) -} diff --git a/src/test/run-pass/issues/auxiliary/issue_9123.rs b/src/test/run-pass/issues/auxiliary/issue_9123.rs deleted file mode 100644 index 60af53359e8..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue_9123.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![crate_type = "lib"] - -pub trait X { - fn x() { - fn f() { } - f(); - } - fn dummy(&self) { } -} diff --git a/src/test/run-pass/issues/auxiliary/issue_9155.rs b/src/test/run-pass/issues/auxiliary/issue_9155.rs deleted file mode 100644 index 049a96a655a..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue_9155.rs +++ /dev/null @@ -1,7 +0,0 @@ -pub struct Foo(T); - -impl Foo { - pub fn new(t: T) -> Foo { - Foo(t) - } -} diff --git a/src/test/run-pass/issues/auxiliary/issue_9188.rs b/src/test/run-pass/issues/auxiliary/issue_9188.rs deleted file mode 100644 index 3bc5697a1a6..00000000000 --- a/src/test/run-pass/issues/auxiliary/issue_9188.rs +++ /dev/null @@ -1,13 +0,0 @@ -pub fn foo() -> &'static isize { - if false { - static a: isize = 4; - return &a; - } else { - static a: isize = 5; - return &a; - } -} - -pub fn bar() -> &'static isize { - foo::() -} diff --git a/src/test/run-pass/issues/issue-10031.rs b/src/test/run-pass/issues/issue-10031.rs index ba1fbac4845..136df05c239 100644 --- a/src/test/run-pass/issues/issue-10031.rs +++ b/src/test/run-pass/issues/issue-10031.rs @@ -1,5 +1,5 @@ // run-pass -// aux-build:issue_10031_aux.rs +// aux-build:issue-10031-aux.rs // pretty-expanded FIXME #23616 extern crate issue_10031_aux; diff --git a/src/test/run-pass/issues/issue-12612.rs b/src/test/run-pass/issues/issue-12612.rs index 158c2aed137..d254f6941a3 100644 --- a/src/test/run-pass/issues/issue-12612.rs +++ b/src/test/run-pass/issues/issue-12612.rs @@ -1,7 +1,7 @@ // run-pass #![allow(unused_imports)] -// aux-build:issue_12612_1.rs -// aux-build:issue_12612_2.rs +// aux-build:issue-12612-1.rs +// aux-build:issue-12612-2.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-13507-2.rs b/src/test/run-pass/issues/issue-13507-2.rs index 4ea95149dc6..ce920a3ccab 100644 --- a/src/test/run-pass/issues/issue-13507-2.rs +++ b/src/test/run-pass/issues/issue-13507-2.rs @@ -1,14 +1,14 @@ // run-pass #![allow(unused_imports)] -// aux-build:issue13507.rs +// aux-build:issue-13507.rs -extern crate issue13507; -use issue13507::testtypes; +extern crate issue_13507; +use issue_13507::testtypes; use std::any::TypeId; pub fn type_ids() -> Vec { - use issue13507::testtypes::*; + use issue_13507::testtypes::*; vec![ TypeId::of::(), TypeId::of::(), @@ -30,7 +30,7 @@ pub fn type_ids() -> Vec { } pub fn main() { - let othercrate = issue13507::testtypes::type_ids(); + let othercrate = issue_13507::testtypes::type_ids(); let thiscrate = type_ids(); assert_eq!(thiscrate, othercrate); } diff --git a/src/test/run-pass/issues/issue-18952.rs b/src/test/run-pass/issues/issue-18952.rs new file mode 100644 index 00000000000..56378b59e36 --- /dev/null +++ b/src/test/run-pass/issues/issue-18952.rs @@ -0,0 +1,56 @@ +// This issue tests fn_traits overloading on arity. +// run-pass + +#![feature(fn_traits)] +#![feature(unboxed_closures)] + +struct Foo; + +impl Fn<(isize, isize)> for Foo { + extern "rust-call" fn call(&self, args: (isize, isize)) -> Self::Output { + println!("{:?}", args); + (args.0 + 1, args.1 + 1) + } +} + +impl FnMut<(isize, isize)> for Foo { + extern "rust-call" fn call_mut(&mut self, args: (isize, isize)) -> Self::Output { + println!("{:?}", args); + (args.0 + 1, args.1 + 1) + } +} + +impl FnOnce<(isize, isize)> for Foo { + type Output = (isize, isize); + extern "rust-call" fn call_once(self, args: (isize, isize)) -> Self::Output { + println!("{:?}", args); + (args.0 + 1, args.1 + 1) + } +} + +impl Fn<(isize, isize, isize)> for Foo { + extern "rust-call" fn call(&self, args: (isize, isize, isize)) -> Self::Output { + println!("{:?}", args); + (args.0 + 3, args.1 + 3, args.2 + 3) + } +} + +impl FnMut<(isize, isize, isize)> for Foo { + extern "rust-call" fn call_mut(&mut self, args: (isize, isize, isize)) -> Self::Output { + println!("{:?}", args); + (args.0 + 3, args.1 + 3, args.2 + 3) + } +} +impl FnOnce<(isize, isize, isize)> for Foo { + type Output = (isize, isize, isize); + extern "rust-call" fn call_once(self, args: (isize, isize, isize)) -> Self::Output { + println!("{:?}", args); + (args.0 + 3, args.1 + 3, args.2 + 3) + } +} + +fn main() { + let foo = Foo; + assert_eq!(foo(1, 1), (2, 2)); + assert_eq!(foo(1, 1, 1), (4, 4, 4)); +} diff --git a/src/test/run-pass/issues/issue-19293.rs b/src/test/run-pass/issues/issue-19293.rs index 90f96566f38..b6e9e3d065a 100644 --- a/src/test/run-pass/issues/issue-19293.rs +++ b/src/test/run-pass/issues/issue-19293.rs @@ -1,5 +1,5 @@ // run-pass -// aux-build:issue_19293.rs +// aux-build:issue-19293.rs // pretty-expanded FIXME #23616 extern crate issue_19293; diff --git a/src/test/run-pass/issues/issue-20389.rs b/src/test/run-pass/issues/issue-20389.rs index 9c5a1844e29..9bc3efcc1c4 100644 --- a/src/test/run-pass/issues/issue-20389.rs +++ b/src/test/run-pass/issues/issue-20389.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// aux-build:issue_20389.rs +// aux-build:issue-20389.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-2170-exe.rs b/src/test/run-pass/issues/issue-2170-exe.rs new file mode 100644 index 00000000000..a89579706c8 --- /dev/null +++ b/src/test/run-pass/issues/issue-2170-exe.rs @@ -0,0 +1,9 @@ +// run-pass +// aux-build:issue-2170-lib.rs +// pretty-expanded FIXME #23616 + +extern crate issue_2170_lib; + +pub fn main() { + // let _ = issue_2170_lib::rsrc(2); +} diff --git a/src/test/run-pass/issues/issue-2316-c.rs b/src/test/run-pass/issues/issue-2316-c.rs index 6783f3fcfc6..d975aa695c8 100644 --- a/src/test/run-pass/issues/issue-2316-c.rs +++ b/src/test/run-pass/issues/issue-2316-c.rs @@ -1,6 +1,6 @@ // run-pass -// aux-build:issue_2316_a.rs -// aux-build:issue_2316_b.rs +// aux-build:issue-2316-a.rs +// aux-build:issue-2316-b.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-24687-embed-debuginfo/auxiliary/issue-24687-lib.rs b/src/test/run-pass/issues/issue-24687-embed-debuginfo/auxiliary/issue-24687-lib.rs new file mode 100644 index 00000000000..2275a8da696 --- /dev/null +++ b/src/test/run-pass/issues/issue-24687-embed-debuginfo/auxiliary/issue-24687-lib.rs @@ -0,0 +1,11 @@ +#![crate_type="lib"] + +// This is a file that pulls in a separate file as a submodule, where +// that separate file has many multi-byte characters, to try to +// encourage the compiler to trip on them. + +#[path = "issue-24687-mbcs-in-comments.rs"] +mod issue_24687_mbcs_in_comments; + +pub use issue_24687_mbcs_in_comments::D; + diff --git a/src/test/run-pass/issues/issue-24687-embed-debuginfo/auxiliary/issue-24687-mbcs-in-comments.rs b/src/test/run-pass/issues/issue-24687-embed-debuginfo/auxiliary/issue-24687-mbcs-in-comments.rs new file mode 100644 index 00000000000..215145a64b1 --- /dev/null +++ b/src/test/run-pass/issues/issue-24687-embed-debuginfo/auxiliary/issue-24687-mbcs-in-comments.rs @@ -0,0 +1,27 @@ +use std::fmt; + +// This ia file with many multi-byte characters, to try to encourage +// the compiler to trip on them. The Drop implementation below will +// need to have its source location embedded into the debug info for +// the output file. + +// αααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααα +// ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ +// γγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγ +// δδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδ +// εεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεε + +// ζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζ +// ηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηη +// θθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθ +// ιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιι +// κκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκ + +pub struct D(pub X); + +impl Drop for D { + fn drop(&mut self) { + // λλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλ + println!("Dropping D({:?})", self.0); + } +} diff --git a/src/test/run-pass/issues/issue-24687-embed-debuginfo/main.rs b/src/test/run-pass/issues/issue-24687-embed-debuginfo/main.rs new file mode 100644 index 00000000000..773792c7a3f --- /dev/null +++ b/src/test/run-pass/issues/issue-24687-embed-debuginfo/main.rs @@ -0,0 +1,13 @@ +// run-pass +// aux-build:issue-24687-lib.rs +// compile-flags:-g + +extern crate issue_24687_lib as d; + +fn main() { + // Create a `D`, which has a destructor whose body will be codegen'ed + // into the generated code here, and thus the local debuginfo will + // need references into the original source locations from + // `importer` above. + let _d = d::D("Hi"); +} diff --git a/src/test/run-pass/issues/issue-2472.rs b/src/test/run-pass/issues/issue-2472.rs index cadd0151b4e..c790bc2d095 100644 --- a/src/test/run-pass/issues/issue-2472.rs +++ b/src/test/run-pass/issues/issue-2472.rs @@ -1,5 +1,5 @@ // run-pass -// aux-build:issue_2472_b.rs +// aux-build:issue-2472-b.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-26873-multifile.rs b/src/test/run-pass/issues/issue-26873-multifile.rs index 7b19713fcc6..da2acf6c9f7 100644 --- a/src/test/run-pass/issues/issue-26873-multifile.rs +++ b/src/test/run-pass/issues/issue-26873-multifile.rs @@ -5,6 +5,7 @@ // ignore-pretty issue #37195 -mod issue_26873_multifile; +#[path = "issue-26873-multifile/mod.rs"] +mod multifile; fn main() {} diff --git a/src/test/run-pass/issues/issue-26873-multifile/A/B.rs b/src/test/run-pass/issues/issue-26873-multifile/A/B.rs new file mode 100644 index 00000000000..d1b802ff3cd --- /dev/null +++ b/src/test/run-pass/issues/issue-26873-multifile/A/B.rs @@ -0,0 +1,5 @@ +// run-pass +use super::*; + +pub struct S; + diff --git a/src/test/run-pass/issues/issue-26873-multifile/A/C.rs b/src/test/run-pass/issues/issue-26873-multifile/A/C.rs new file mode 100644 index 00000000000..88f3eb04afb --- /dev/null +++ b/src/test/run-pass/issues/issue-26873-multifile/A/C.rs @@ -0,0 +1,7 @@ +// run-pass +use super::*; + +use super::B::S; + +pub struct T { i: i32 } + diff --git a/src/test/run-pass/issues/issue-26873-multifile/A/mod.rs b/src/test/run-pass/issues/issue-26873-multifile/A/mod.rs new file mode 100644 index 00000000000..20f40a06782 --- /dev/null +++ b/src/test/run-pass/issues/issue-26873-multifile/A/mod.rs @@ -0,0 +1,6 @@ +// run-pass +pub mod B; +pub mod C; + +pub use self::C::T; + diff --git a/src/test/run-pass/issues/issue-26873-multifile/compiletest-ignore-dir b/src/test/run-pass/issues/issue-26873-multifile/compiletest-ignore-dir new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/test/run-pass/issues/issue-26873-multifile/mod.rs b/src/test/run-pass/issues/issue-26873-multifile/mod.rs new file mode 100644 index 00000000000..52deea79a20 --- /dev/null +++ b/src/test/run-pass/issues/issue-26873-multifile/mod.rs @@ -0,0 +1,5 @@ +// run-pass +mod A; + +use self::A::*; + diff --git a/src/test/run-pass/issues/issue-2723-b.rs b/src/test/run-pass/issues/issue-2723-b.rs index 41f264b6dc0..1910561d0ba 100644 --- a/src/test/run-pass/issues/issue-2723-b.rs +++ b/src/test/run-pass/issues/issue-2723-b.rs @@ -1,5 +1,5 @@ // run-pass -// aux-build:issue_2723_a.rs +// aux-build:issue-2723-a.rs extern crate issue_2723_a; use issue_2723_a::f; diff --git a/src/test/run-pass/issues/issue-28498-must-work-ex1.rs b/src/test/run-pass/issues/issue-28498-must-work-ex1.rs new file mode 100644 index 00000000000..4699d3352ad --- /dev/null +++ b/src/test/run-pass/issues/issue-28498-must-work-ex1.rs @@ -0,0 +1,18 @@ +// run-pass +// Example taken from RFC 1238 text + +// https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md +// #examples-of-code-that-must-continue-to-work + +use std::cell::Cell; + +struct Concrete<'a>(u32, Cell>>); + +fn main() { + let mut data = Vec::new(); + data.push(Concrete(0, Cell::new(None))); + data.push(Concrete(0, Cell::new(None))); + + data[0].1.set(Some(&data[1])); + data[1].1.set(Some(&data[0])); +} diff --git a/src/test/run-pass/issues/issue-28498-must-work-ex2.rs b/src/test/run-pass/issues/issue-28498-must-work-ex2.rs new file mode 100644 index 00000000000..17111308555 --- /dev/null +++ b/src/test/run-pass/issues/issue-28498-must-work-ex2.rs @@ -0,0 +1,21 @@ +// run-pass +// Example taken from RFC 1238 text + +// https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md +// #examples-of-code-that-must-continue-to-work + +use std::cell::Cell; + +struct Concrete<'a>(u32, Cell>>); + +struct Foo { data: Vec } + +fn main() { + let mut foo = Foo { data: Vec::new() }; + foo.data.push(Concrete(0, Cell::new(None))); + foo.data.push(Concrete(0, Cell::new(None))); + + foo.data[0].1.set(Some(&foo.data[1])); + foo.data[1].1.set(Some(&foo.data[0])); +} + diff --git a/src/test/run-pass/issues/issue-28498-ugeh-ex1.rs b/src/test/run-pass/issues/issue-28498-ugeh-ex1.rs new file mode 100644 index 00000000000..65d5588871b --- /dev/null +++ b/src/test/run-pass/issues/issue-28498-ugeh-ex1.rs @@ -0,0 +1,30 @@ +// run-pass +#![allow(deprecated)] // FIXME: switch to `#[may_dangle]` below. + +// Example taken from RFC 1238 text + +// https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md +// #example-of-the-unguarded-escape-hatch + +#![feature(dropck_parametricity)] +use std::cell::Cell; + +struct Concrete<'a>(u32, Cell>>); + +struct Foo { data: Vec } + +impl Drop for Foo { + // Below is the UGEH attribute + #[unsafe_destructor_blind_to_params] + fn drop(&mut self) { } +} + +fn main() { + let mut foo = Foo { data: Vec::new() }; + foo.data.push(Concrete(0, Cell::new(None))); + foo.data.push(Concrete(0, Cell::new(None))); + + foo.data[0].1.set(Some(&foo.data[1])); + foo.data[1].1.set(Some(&foo.data[0])); +} + diff --git a/src/test/run-pass/issues/issue-28498-ugeh-with-lifetime-param.rs b/src/test/run-pass/issues/issue-28498-ugeh-with-lifetime-param.rs new file mode 100644 index 00000000000..573ec8f6131 --- /dev/null +++ b/src/test/run-pass/issues/issue-28498-ugeh-with-lifetime-param.rs @@ -0,0 +1,41 @@ +// run-pass +#![allow(deprecated)] // FIXME: switch to `#[may_dangle]` below. + +// Demonstrate the use of the unguarded escape hatch with a lifetime param +// to assert that destructor will not access any dead data. +// +// Compare with compile-fail/issue28498-reject-lifetime-param.rs + +#![feature(dropck_parametricity)] + +#[derive(Debug)] +struct ScribbleOnDrop(String); + +impl Drop for ScribbleOnDrop { + fn drop(&mut self) { + self.0 = format!("DROPPED"); + } +} + +struct Foo<'a>(u32, &'a ScribbleOnDrop); + +impl<'a> Drop for Foo<'a> { + #[unsafe_destructor_blind_to_params] + fn drop(&mut self) { + // Use of `unsafe_destructor_blind_to_params` is sound, + // because destructor never accesses `self.1`. + println!("Dropping Foo({}, _)", self.0); + } +} + +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); + foo1 = Foo(1, &first_dropped); + + println!("foo0.1: {:?} foo1.1: {:?}", foo0.1, foo1.1); +} diff --git a/src/test/run-pass/issues/issue-28498-ugeh-with-passed-to-fn.rs b/src/test/run-pass/issues/issue-28498-ugeh-with-passed-to-fn.rs new file mode 100644 index 00000000000..e0863fa9947 --- /dev/null +++ b/src/test/run-pass/issues/issue-28498-ugeh-with-passed-to-fn.rs @@ -0,0 +1,49 @@ +// run-pass +#![allow(deprecated)] // FIXME: switch to `#[may_dangle]` below. + +// 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 compile-fail/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_parametricity)] + +#[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>); + +impl Drop for Foo { + #[unsafe_destructor_blind_to_params] + fn drop(&mut self) { + // Use of `unsafe_destructor_blind_to_params` 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/run-pass/issues/issue-28498-ugeh-with-trait-bound.rs b/src/test/run-pass/issues/issue-28498-ugeh-with-trait-bound.rs new file mode 100644 index 00000000000..01d884584f6 --- /dev/null +++ b/src/test/run-pass/issues/issue-28498-ugeh-with-trait-bound.rs @@ -0,0 +1,44 @@ +// run-pass +#![allow(deprecated)] // FIXME: switch to `#[may_dangle]` below. + +// Demonstrate the use of the unguarded escape hatch with a trait bound +// to assert that destructor will not access any dead data. +// +// Compare with compile-fail/issue28498-reject-trait-bound.rs + +#![feature(dropck_parametricity)] + +use std::fmt; + +#[derive(Debug)] +struct ScribbleOnDrop(String); + +impl Drop for ScribbleOnDrop { + fn drop(&mut self) { + self.0 = format!("DROPPED"); + } +} + +struct Foo(u32, T); + +impl Drop for Foo { + #[unsafe_destructor_blind_to_params] + fn drop(&mut self) { + // Use of `unsafe_destructor_blind_to_params` is sound, + // because destructor never accesses the `Debug::fmt` method + // of `T`, despite having it available. + println!("Dropping Foo({}, _)", self.0); + } +} + +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); + foo1 = Foo(1, &first_dropped); + + println!("foo0.1: {:?} foo1.1: {:?}", foo0.1, foo1.1); +} diff --git a/src/test/run-pass/issues/issue-29927-1.rs b/src/test/run-pass/issues/issue-29927-1.rs new file mode 100644 index 00000000000..a236e491375 --- /dev/null +++ b/src/test/run-pass/issues/issue-29927-1.rs @@ -0,0 +1,11 @@ +// run-pass +#![allow(dead_code)] +const fn f() -> usize { + 5 +} +struct A { + field: usize, +} +fn main() { + let _ = [0; f()]; +} diff --git a/src/test/run-pass/issues/issue-3136-b.rs b/src/test/run-pass/issues/issue-3136-b.rs new file mode 100644 index 00000000000..c4ca7236e76 --- /dev/null +++ b/src/test/run-pass/issues/issue-3136-b.rs @@ -0,0 +1,8 @@ +// run-pass +// aux-build:issue-3136-a.rc + +// pretty-expanded FIXME #23616 + +extern crate issue_3136_a; + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-34796.rs b/src/test/run-pass/issues/issue-34796.rs index a81040b8f4d..88d5c50a27d 100644 --- a/src/test/run-pass/issues/issue-34796.rs +++ b/src/test/run-pass/issues/issue-34796.rs @@ -8,8 +8,8 @@ // the symbol name. // The fix was to make the order in which predicates get encoded stable. -// aux-build:issue34796aux.rs -extern crate issue34796aux; +// aux-build:issue-34796-aux.rs +extern crate issue_34796_aux; fn mk() -> T { loop {} } @@ -19,7 +19,7 @@ struct Data { } fn main() { - issue34796aux::bar(|()| { + issue_34796_aux::bar(|()| { Data::<(), std::io::Error> { data: mk(), error: mk(), diff --git a/src/test/run-pass/issues/issue-38190.rs b/src/test/run-pass/issues/issue-38190.rs index 4f83dd26383..cfa0420c80d 100644 --- a/src/test/run-pass/issues/issue-38190.rs +++ b/src/test/run-pass/issues/issue-38190.rs @@ -1,12 +1,15 @@ // run-pass -// aux-build:issue_38190.rs +// aux-build:issue-38190.rs // ignore-pretty issue #37195 #[macro_use] extern crate issue_38190; mod auxiliary { - m!([mod issue_38190;]); + m!([ + #[path = "issue-38190.rs"] + mod issue_38190; + ]); } fn main() {} diff --git a/src/test/run-pass/issues/issue-38226.rs b/src/test/run-pass/issues/issue-38226.rs index cd569c583f3..3213e3618a8 100644 --- a/src/test/run-pass/issues/issue-38226.rs +++ b/src/test/run-pass/issues/issue-38226.rs @@ -2,7 +2,7 @@ // This test makes sure that we don't run into a linker error because of the // middle::reachable pass missing trait methods with default impls. -// aux-build:issue_38226_aux.rs +// aux-build:issue-38226-aux.rs // Need -Cno-prepopulate-passes to really disable inlining, otherwise the faulty // code gets optimized out: diff --git a/src/test/run-pass/issues/issue-38715.rs b/src/test/run-pass/issues/issue-38715.rs index 9d793147e24..e3c3a027f3c 100644 --- a/src/test/run-pass/issues/issue-38715.rs +++ b/src/test/run-pass/issues/issue-38715.rs @@ -1,6 +1,6 @@ // run-pass -// aux-build:issue_38715.rs -// aux-build:issue_38715-modern.rs +// aux-build:issue-38715.rs +// aux-build:issue-38715-modern.rs // Test that `#[macro_export] macro_rules!` shadow earlier `#[macro_export] macro_rules!` diff --git a/src/test/run-pass/issues/issue-3979-xcrate.rs b/src/test/run-pass/issues/issue-3979-xcrate.rs index 0e47dee5b65..fcb1f55c32f 100644 --- a/src/test/run-pass/issues/issue-3979-xcrate.rs +++ b/src/test/run-pass/issues/issue-3979-xcrate.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// aux-build:issue_3979_traits.rs +// aux-build:issue-3979-traits.rs extern crate issue_3979_traits; use issue_3979_traits::{Positioned, Movable}; diff --git a/src/test/run-pass/issues/issue-39823.rs b/src/test/run-pass/issues/issue-39823.rs index 8a52399273b..0dfa8a75c4f 100644 --- a/src/test/run-pass/issues/issue-39823.rs +++ b/src/test/run-pass/issues/issue-39823.rs @@ -1,5 +1,5 @@ // run-pass -// aux-build:issue_39823.rs +// aux-build:issue-39823.rs extern crate issue_39823; use issue_39823::{RemoteC, RemoteG}; diff --git a/src/test/run-pass/issues/issue-40469.rs b/src/test/run-pass/issues/issue-40469.rs index 2e8247e032b..25e08ef85e9 100644 --- a/src/test/run-pass/issues/issue-40469.rs +++ b/src/test/run-pass/issues/issue-40469.rs @@ -3,7 +3,7 @@ #![allow(dead_code)] -include!("auxiliary/issue_40469.rs"); +include!("auxiliary/issue-40469.rs"); fn f() { m!(); } fn main() {} diff --git a/src/test/run-pass/issues/issue-41053.rs b/src/test/run-pass/issues/issue-41053.rs index b9d8f00ff21..cd7a0a22623 100644 --- a/src/test/run-pass/issues/issue-41053.rs +++ b/src/test/run-pass/issues/issue-41053.rs @@ -1,5 +1,5 @@ // run-pass -// aux-build:issue_41053.rs +// aux-build:issue-41053.rs pub trait Trait { fn foo(&self) {} } diff --git a/src/test/run-pass/issues/issue-42007.rs b/src/test/run-pass/issues/issue-42007.rs index de1367ec80f..a477e476eb9 100644 --- a/src/test/run-pass/issues/issue-42007.rs +++ b/src/test/run-pass/issues/issue-42007.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// aux-build:issue_42007_s.rs +// aux-build:issue-42007-s.rs extern crate issue_42007_s; diff --git a/src/test/run-pass/issues/issue-45510.rs b/src/test/run-pass/issues/issue-45510.rs new file mode 100644 index 00000000000..9e104ce6c4f --- /dev/null +++ b/src/test/run-pass/issues/issue-45510.rs @@ -0,0 +1,32 @@ +// Test overloaded resolution of fn_traits. +// run-pass + +#![feature(fn_traits)] +#![feature(unboxed_closures)] + +#[derive(Debug, PartialEq, Eq)] +struct Ishmael; +#[derive(Debug, PartialEq, Eq)] +struct Maybe; +struct CallMe; + +impl FnOnce<(Ishmael,)> for CallMe { + type Output = Ishmael; + extern "rust-call" fn call_once(self, _args: (Ishmael,)) -> Ishmael { + println!("Split your lungs with blood and thunder!"); + Ishmael + } +} + +impl FnOnce<(Maybe,)> for CallMe { + type Output = Maybe; + extern "rust-call" fn call_once(self, _args: (Maybe,)) -> Maybe { + println!("So we just met, and this is crazy"); + Maybe + } +} + +fn main() { + assert_eq!(CallMe(Ishmael), Ishmael); + assert_eq!(CallMe(Maybe), Maybe); +} diff --git a/src/test/run-pass/issues/issue-48006.rs b/src/test/run-pass/issues/issue-48006.rs new file mode 100644 index 00000000000..8e7105cf10c --- /dev/null +++ b/src/test/run-pass/issues/issue-48006.rs @@ -0,0 +1,13 @@ +#![feature(step_trait)] + +use std::iter::Step; + +#[cfg(target_pointer_width = "16")] +fn main() { + assert!(Step::steps_between(&0u32, &::std::u32::MAX).is_none()); +} + +#[cfg(any(target_pointer_width = "32", target_pointer_width = "64"))] +fn main() { + assert!(Step::steps_between(&0u32, &::std::u32::MAX).is_some()); +} diff --git a/src/test/run-pass/issues/issue-53728.rs b/src/test/run-pass/issues/issue-53728.rs new file mode 100644 index 00000000000..00666972e25 --- /dev/null +++ b/src/test/run-pass/issues/issue-53728.rs @@ -0,0 +1,17 @@ +#![allow(dead_code)] +#[repr(u16)] +enum DeviceKind { + Nil = 0, +} + +#[repr(packed)] +struct DeviceInfo { + endianness: u8, + device_kind: DeviceKind, +} + +fn main() { + let _x = None::<(DeviceInfo, u8)>; + let _y = None::<(DeviceInfo, u16)>; + let _z = None::<(DeviceInfo, u64)>; +} diff --git a/src/test/run-pass/issues/issue-53843.rs b/src/test/run-pass/issues/issue-53843.rs new file mode 100644 index 00000000000..53728ec4d9f --- /dev/null +++ b/src/test/run-pass/issues/issue-53843.rs @@ -0,0 +1,24 @@ +use std::ops::Deref; + +pub struct Pin

(P); + +impl Deref for Pin

+where + P: Deref, +{ + type Target = T; + + fn deref(&self) -> &T { + &*self.0 + } +} + +impl

Pin

{ + fn poll(self) {} +} + +fn main() { + let mut unit = (); + let pin = Pin(&mut unit); + pin.poll(); +} diff --git a/src/test/run-pass/issues/issue-54462-mutable-noalias-correctness.rs b/src/test/run-pass/issues/issue-54462-mutable-noalias-correctness.rs new file mode 100644 index 00000000000..e7966b2978f --- /dev/null +++ b/src/test/run-pass/issues/issue-54462-mutable-noalias-correctness.rs @@ -0,0 +1,24 @@ +// +// compile-flags: -Ccodegen-units=1 -O + +fn linidx(row: usize, col: usize) -> usize { + row * 1 + col * 3 +} + +fn main() { + let mut mat = [1.0f32, 5.0, 9.0, 2.0, 6.0, 10.0, 3.0, 7.0, 11.0, 4.0, 8.0, 12.0]; + + for i in 0..2 { + for j in i+1..3 { + if mat[linidx(j, 3)] > mat[linidx(i, 3)] { + for k in 0..4 { + let (x, rest) = mat.split_at_mut(linidx(i, k) + 1); + let a = x.last_mut().unwrap(); + let b = rest.get_mut(linidx(j, k) - linidx(i, k) - 1).unwrap(); + ::std::mem::swap(a, b); + } + } + } + } + assert_eq!([9.0, 5.0, 1.0, 10.0, 6.0, 2.0, 11.0, 7.0, 3.0, 12.0, 8.0, 4.0], mat); +} diff --git a/src/test/run-pass/issues/issue-54467.rs b/src/test/run-pass/issues/issue-54467.rs new file mode 100644 index 00000000000..52a9828b548 --- /dev/null +++ b/src/test/run-pass/issues/issue-54467.rs @@ -0,0 +1,44 @@ +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/run-pass/issues/issue-55376.rs b/src/test/run-pass/issues/issue-55376.rs new file mode 100644 index 00000000000..fa92a85a445 --- /dev/null +++ b/src/test/run-pass/issues/issue-55376.rs @@ -0,0 +1,15 @@ +// Tests that paths in `pub(...)` don't fail HIR verification. + +#![allow(unused_imports)] +#![allow(dead_code)] + +pub(self) use self::my_mod::Foo; + +mod my_mod { + pub(super) use self::Foo as Bar; + pub(in super::my_mod) use self::Foo as Baz; + + pub struct Foo; +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-55380.rs b/src/test/run-pass/issues/issue-55380.rs new file mode 100644 index 00000000000..862218e2192 --- /dev/null +++ b/src/test/run-pass/issues/issue-55380.rs @@ -0,0 +1,28 @@ +// run-pass + +#![feature(specialization)] + +pub trait Foo { + fn abc() -> u32; + fn def() -> u32; +} + +pub trait Marker {} + +impl Marker for () {} + +impl Foo for T { + default fn abc() -> u32 { 16 } + default fn def() -> u32 { 42 } +} + +impl Foo for T { + fn def() -> u32 { + Self::abc() + } +} + +fn main() { + assert_eq!(<()>::def(), 16); + assert_eq!(::def(), 42); +} diff --git a/src/test/run-pass/issues/issue-56237.rs b/src/test/run-pass/issues/issue-56237.rs new file mode 100644 index 00000000000..87e10e83612 --- /dev/null +++ b/src/test/run-pass/issues/issue-56237.rs @@ -0,0 +1,11 @@ +use std::ops::Deref; + +fn foo

(_value:

::Target) +where + P: Deref, +

::Target: Sized, +{} + +fn main() { + foo::>(2); +} diff --git a/src/test/run-pass/issues/issue-8401.rs b/src/test/run-pass/issues/issue-8401.rs index 97d66c5e40f..1257bab6c0c 100644 --- a/src/test/run-pass/issues/issue-8401.rs +++ b/src/test/run-pass/issues/issue-8401.rs @@ -1,5 +1,5 @@ // run-pass -// aux-build:issue_8401.rs +// aux-build:issue-8401.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-9123.rs b/src/test/run-pass/issues/issue-9123.rs index 5072ca6ba53..8c21d06c477 100644 --- a/src/test/run-pass/issues/issue-9123.rs +++ b/src/test/run-pass/issues/issue-9123.rs @@ -1,5 +1,5 @@ // run-pass -// aux-build:issue_9123.rs +// aux-build:issue-9123.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-9155.rs b/src/test/run-pass/issues/issue-9155.rs new file mode 100644 index 00000000000..4b5c451e853 --- /dev/null +++ b/src/test/run-pass/issues/issue-9155.rs @@ -0,0 +1,12 @@ +// run-pass +// aux-build:issue-9155.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_9155; + +struct Baz; + +pub fn main() { + issue_9155::Foo::new(Baz); +} diff --git a/src/test/run-pass/issues/issue-9188.rs b/src/test/run-pass/issues/issue-9188.rs index d7c39e9d505..34e61fdf68b 100644 --- a/src/test/run-pass/issues/issue-9188.rs +++ b/src/test/run-pass/issues/issue-9188.rs @@ -1,5 +1,5 @@ // run-pass -// aux-build:issue_9188.rs +// aux-build:issue-9188.rs extern crate issue_9188; diff --git a/src/test/run-pass/issues/issue2170exe.rs b/src/test/run-pass/issues/issue2170exe.rs deleted file mode 100644 index 4169ddf9bb7..00000000000 --- a/src/test/run-pass/issues/issue2170exe.rs +++ /dev/null @@ -1,9 +0,0 @@ -// run-pass -// aux-build:issue2170lib.rs -// pretty-expanded FIXME #23616 - -extern crate issue2170lib; - -pub fn main() { - // let _ = issue2170lib::rsrc(2); -} diff --git a/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_lib.rs b/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_lib.rs deleted file mode 100644 index 3ae53baa82a..00000000000 --- a/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_lib.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![crate_type="lib"] - -// This is a file that pulls in a separate file as a submodule, where -// that separate file has many multi-byte characters, to try to -// encourage the compiler to trip on them. - -mod issue24687_mbcs_in_comments; - -pub use issue24687_mbcs_in_comments::D; - diff --git a/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_mbcs_in_comments.rs b/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_mbcs_in_comments.rs deleted file mode 100644 index 215145a64b1..00000000000 --- a/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_mbcs_in_comments.rs +++ /dev/null @@ -1,27 +0,0 @@ -use std::fmt; - -// This ia file with many multi-byte characters, to try to encourage -// the compiler to trip on them. The Drop implementation below will -// need to have its source location embedded into the debug info for -// the output file. - -// αααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααα -// ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ -// γγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγ -// δδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδ -// εεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεε - -// ζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζ -// ηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηη -// θθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθ -// ιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιι -// κκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκ - -pub struct D(pub X); - -impl Drop for D { - fn drop(&mut self) { - // λλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλ - println!("Dropping D({:?})", self.0); - } -} diff --git a/src/test/run-pass/issues/issue24687-embed-debuginfo/main.rs b/src/test/run-pass/issues/issue24687-embed-debuginfo/main.rs deleted file mode 100644 index a0cda4fad26..00000000000 --- a/src/test/run-pass/issues/issue24687-embed-debuginfo/main.rs +++ /dev/null @@ -1,13 +0,0 @@ -// run-pass -// aux-build:issue24687_lib.rs -// compile-flags:-g - -extern crate issue24687_lib as d; - -fn main() { - // Create a d, which has a destructor whose body will be codegen'ed - // into the generated code here, and thus the local debuginfo will - // need references into the original source locations from - // `importer` above. - let _d = d::D("Hi"); -} diff --git a/src/test/run-pass/issues/issue28498-must-work-ex1.rs b/src/test/run-pass/issues/issue28498-must-work-ex1.rs deleted file mode 100644 index 4699d3352ad..00000000000 --- a/src/test/run-pass/issues/issue28498-must-work-ex1.rs +++ /dev/null @@ -1,18 +0,0 @@ -// run-pass -// Example taken from RFC 1238 text - -// https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md -// #examples-of-code-that-must-continue-to-work - -use std::cell::Cell; - -struct Concrete<'a>(u32, Cell>>); - -fn main() { - let mut data = Vec::new(); - data.push(Concrete(0, Cell::new(None))); - data.push(Concrete(0, Cell::new(None))); - - data[0].1.set(Some(&data[1])); - data[1].1.set(Some(&data[0])); -} diff --git a/src/test/run-pass/issues/issue28498-must-work-ex2.rs b/src/test/run-pass/issues/issue28498-must-work-ex2.rs deleted file mode 100644 index 17111308555..00000000000 --- a/src/test/run-pass/issues/issue28498-must-work-ex2.rs +++ /dev/null @@ -1,21 +0,0 @@ -// run-pass -// Example taken from RFC 1238 text - -// https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md -// #examples-of-code-that-must-continue-to-work - -use std::cell::Cell; - -struct Concrete<'a>(u32, Cell>>); - -struct Foo { data: Vec } - -fn main() { - let mut foo = Foo { data: Vec::new() }; - foo.data.push(Concrete(0, Cell::new(None))); - foo.data.push(Concrete(0, Cell::new(None))); - - foo.data[0].1.set(Some(&foo.data[1])); - foo.data[1].1.set(Some(&foo.data[0])); -} - diff --git a/src/test/run-pass/issues/issue28498-ugeh-ex1.rs b/src/test/run-pass/issues/issue28498-ugeh-ex1.rs deleted file mode 100644 index 65d5588871b..00000000000 --- a/src/test/run-pass/issues/issue28498-ugeh-ex1.rs +++ /dev/null @@ -1,30 +0,0 @@ -// run-pass -#![allow(deprecated)] // FIXME: switch to `#[may_dangle]` below. - -// Example taken from RFC 1238 text - -// https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md -// #example-of-the-unguarded-escape-hatch - -#![feature(dropck_parametricity)] -use std::cell::Cell; - -struct Concrete<'a>(u32, Cell>>); - -struct Foo { data: Vec } - -impl Drop for Foo { - // Below is the UGEH attribute - #[unsafe_destructor_blind_to_params] - fn drop(&mut self) { } -} - -fn main() { - let mut foo = Foo { data: Vec::new() }; - foo.data.push(Concrete(0, Cell::new(None))); - foo.data.push(Concrete(0, Cell::new(None))); - - foo.data[0].1.set(Some(&foo.data[1])); - foo.data[1].1.set(Some(&foo.data[0])); -} - diff --git a/src/test/run-pass/issues/issue28498-ugeh-with-lifetime-param.rs b/src/test/run-pass/issues/issue28498-ugeh-with-lifetime-param.rs deleted file mode 100644 index 573ec8f6131..00000000000 --- a/src/test/run-pass/issues/issue28498-ugeh-with-lifetime-param.rs +++ /dev/null @@ -1,41 +0,0 @@ -// run-pass -#![allow(deprecated)] // FIXME: switch to `#[may_dangle]` below. - -// Demonstrate the use of the unguarded escape hatch with a lifetime param -// to assert that destructor will not access any dead data. -// -// Compare with compile-fail/issue28498-reject-lifetime-param.rs - -#![feature(dropck_parametricity)] - -#[derive(Debug)] -struct ScribbleOnDrop(String); - -impl Drop for ScribbleOnDrop { - fn drop(&mut self) { - self.0 = format!("DROPPED"); - } -} - -struct Foo<'a>(u32, &'a ScribbleOnDrop); - -impl<'a> Drop for Foo<'a> { - #[unsafe_destructor_blind_to_params] - fn drop(&mut self) { - // Use of `unsafe_destructor_blind_to_params` is sound, - // because destructor never accesses `self.1`. - println!("Dropping Foo({}, _)", self.0); - } -} - -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); - foo1 = Foo(1, &first_dropped); - - println!("foo0.1: {:?} foo1.1: {:?}", foo0.1, foo1.1); -} diff --git a/src/test/run-pass/issues/issue28498-ugeh-with-passed-to-fn.rs b/src/test/run-pass/issues/issue28498-ugeh-with-passed-to-fn.rs deleted file mode 100644 index e0863fa9947..00000000000 --- a/src/test/run-pass/issues/issue28498-ugeh-with-passed-to-fn.rs +++ /dev/null @@ -1,49 +0,0 @@ -// run-pass -#![allow(deprecated)] // FIXME: switch to `#[may_dangle]` below. - -// 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 compile-fail/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_parametricity)] - -#[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>); - -impl Drop for Foo { - #[unsafe_destructor_blind_to_params] - fn drop(&mut self) { - // Use of `unsafe_destructor_blind_to_params` 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/run-pass/issues/issue28498-ugeh-with-trait-bound.rs b/src/test/run-pass/issues/issue28498-ugeh-with-trait-bound.rs deleted file mode 100644 index 01d884584f6..00000000000 --- a/src/test/run-pass/issues/issue28498-ugeh-with-trait-bound.rs +++ /dev/null @@ -1,44 +0,0 @@ -// run-pass -#![allow(deprecated)] // FIXME: switch to `#[may_dangle]` below. - -// Demonstrate the use of the unguarded escape hatch with a trait bound -// to assert that destructor will not access any dead data. -// -// Compare with compile-fail/issue28498-reject-trait-bound.rs - -#![feature(dropck_parametricity)] - -use std::fmt; - -#[derive(Debug)] -struct ScribbleOnDrop(String); - -impl Drop for ScribbleOnDrop { - fn drop(&mut self) { - self.0 = format!("DROPPED"); - } -} - -struct Foo(u32, T); - -impl Drop for Foo { - #[unsafe_destructor_blind_to_params] - fn drop(&mut self) { - // Use of `unsafe_destructor_blind_to_params` is sound, - // because destructor never accesses the `Debug::fmt` method - // of `T`, despite having it available. - println!("Dropping Foo({}, _)", self.0); - } -} - -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); - foo1 = Foo(1, &first_dropped); - - println!("foo0.1: {:?} foo1.1: {:?}", foo0.1, foo1.1); -} diff --git a/src/test/run-pass/issues/issue29927-1.rs b/src/test/run-pass/issues/issue29927-1.rs deleted file mode 100644 index a236e491375..00000000000 --- a/src/test/run-pass/issues/issue29927-1.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass -#![allow(dead_code)] -const fn f() -> usize { - 5 -} -struct A { - field: usize, -} -fn main() { - let _ = [0; f()]; -} diff --git a/src/test/run-pass/issues/issue_26873_multifile/A/B.rs b/src/test/run-pass/issues/issue_26873_multifile/A/B.rs deleted file mode 100644 index d1b802ff3cd..00000000000 --- a/src/test/run-pass/issues/issue_26873_multifile/A/B.rs +++ /dev/null @@ -1,5 +0,0 @@ -// run-pass -use super::*; - -pub struct S; - diff --git a/src/test/run-pass/issues/issue_26873_multifile/A/C.rs b/src/test/run-pass/issues/issue_26873_multifile/A/C.rs deleted file mode 100644 index 88f3eb04afb..00000000000 --- a/src/test/run-pass/issues/issue_26873_multifile/A/C.rs +++ /dev/null @@ -1,7 +0,0 @@ -// run-pass -use super::*; - -use super::B::S; - -pub struct T { i: i32 } - diff --git a/src/test/run-pass/issues/issue_26873_multifile/A/mod.rs b/src/test/run-pass/issues/issue_26873_multifile/A/mod.rs deleted file mode 100644 index 20f40a06782..00000000000 --- a/src/test/run-pass/issues/issue_26873_multifile/A/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -// run-pass -pub mod B; -pub mod C; - -pub use self::C::T; - diff --git a/src/test/run-pass/issues/issue_26873_multifile/compiletest-ignore-dir b/src/test/run-pass/issues/issue_26873_multifile/compiletest-ignore-dir deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/test/run-pass/issues/issue_26873_multifile/mod.rs b/src/test/run-pass/issues/issue_26873_multifile/mod.rs deleted file mode 100644 index 52deea79a20..00000000000 --- a/src/test/run-pass/issues/issue_26873_multifile/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -// run-pass -mod A; - -use self::A::*; - diff --git a/src/test/run-pass/issues/issue_3136_b.rs b/src/test/run-pass/issues/issue_3136_b.rs deleted file mode 100644 index f0bdd2b5ec0..00000000000 --- a/src/test/run-pass/issues/issue_3136_b.rs +++ /dev/null @@ -1,7 +0,0 @@ -// run-pass -// aux-build:issue_3136_a.rc - -// pretty-expanded FIXME #23616 - -extern crate issue_3136_a; -pub fn main() {} diff --git a/src/test/run-pass/issues/issue_9155.rs b/src/test/run-pass/issues/issue_9155.rs deleted file mode 100644 index 87c453be142..00000000000 --- a/src/test/run-pass/issues/issue_9155.rs +++ /dev/null @@ -1,12 +0,0 @@ -// run-pass -// aux-build:issue_9155.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_9155; - -struct Baz; - -pub fn main() { - issue_9155::Foo::new(Baz); -} diff --git a/src/test/run-pass/rmeta.rs b/src/test/run-pass/rmeta.rs index bd8125bbb56..cbbdd78dc20 100644 --- a/src/test/run-pass/rmeta.rs +++ b/src/test/run-pass/rmeta.rs @@ -1,8 +1,8 @@ // Test that using rlibs and rmeta dep crates work together. Specifically, that // there can be both an rmeta and an rlib file and rustc will prefer the rlib. -// aux-build:rmeta_rmeta.rs -// aux-build:rmeta_rlib.rs +// aux-build:rmeta-rmeta.rs +// aux-build:rmeta-rlib.rs extern crate rmeta_aux; use rmeta_aux::Foo; diff --git a/src/test/rustdoc/auxiliary/enum-primitive.rs b/src/test/rustdoc/auxiliary/enum-primitive.rs new file mode 100644 index 00000000000..ed1da253a97 --- /dev/null +++ b/src/test/rustdoc/auxiliary/enum-primitive.rs @@ -0,0 +1,207 @@ +// Copyright (c) 2015 Anders Kaseorg + +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// “Software”), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: + +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +//! This crate exports a macro `enum_from_primitive!` that wraps an +//! `enum` declaration and automatically adds an implementation of +//! `num::FromPrimitive` (reexported here), to allow conversion from +//! primitive integers to the enum. It therefore provides an +//! alternative to the built-in `#[derive(FromPrimitive)]`, which +//! requires the unstable `std::num::FromPrimitive` and is disabled in +//! Rust 1.0. +//! +//! # Example +//! +//! ``` +//! #[macro_use] extern crate enum_primitive; +//! extern crate num_traits; +//! use num_traits::FromPrimitive; +//! +//! enum_from_primitive! { +//! #[derive(Debug, PartialEq)] +//! enum FooBar { +//! Foo = 17, +//! Bar = 42, +//! Baz, +//! } +//! } +//! +//! fn main() { +//! assert_eq!(FooBar::from_i32(17), Some(FooBar::Foo)); +//! assert_eq!(FooBar::from_i32(42), Some(FooBar::Bar)); +//! assert_eq!(FooBar::from_i32(43), Some(FooBar::Baz)); +//! assert_eq!(FooBar::from_i32(91), None); +//! } +//! ``` + +pub mod num_traits { + pub trait FromPrimitive: Sized { + fn from_i64(n: i64) -> Option; + fn from_u64(n: u64) -> Option; + } +} + +pub use std::option::Option; +pub use num_traits::FromPrimitive; + +/// Helper macro for internal use by `enum_from_primitive!`. +#[macro_export] +macro_rules! enum_from_primitive_impl_ty { + ($meth:ident, $ty:ty, $name:ident, $( $variant:ident )*) => { + #[allow(non_upper_case_globals, unused)] + fn $meth(n: $ty) -> $crate::Option { + $( if n == $name::$variant as $ty { + $crate::Option::Some($name::$variant) + } else )* { + $crate::Option::None + } + } + }; +} + +/// Helper macro for internal use by `enum_from_primitive!`. +#[macro_export] +#[macro_use(enum_from_primitive_impl_ty)] +macro_rules! enum_from_primitive_impl { + ($name:ident, $( $variant:ident )*) => { + impl $crate::FromPrimitive for $name { + enum_from_primitive_impl_ty! { from_i64, i64, $name, $( $variant )* } + enum_from_primitive_impl_ty! { from_u64, u64, $name, $( $variant )* } + } + }; +} + +/// Wrap this macro around an `enum` declaration to get an +/// automatically generated implementation of `num::FromPrimitive`. +#[macro_export] +#[macro_use(enum_from_primitive_impl)] +macro_rules! enum_from_primitive { + ( + $( #[$enum_attr:meta] )* + enum $name:ident { + $( $( #[$variant_attr:meta] )* $variant:ident ),+ + $( = $discriminator:expr, $( $( #[$variant_two_attr:meta] )* $variant_two:ident ),+ )* + } + ) => { + $( #[$enum_attr] )* + enum $name { + $( $( #[$variant_attr] )* $variant ),+ + $( = $discriminator, $( $( #[$variant_two_attr] )* $variant_two ),+ )* + } + enum_from_primitive_impl! { $name, $( $variant )+ $( $( $variant_two )+ )* } + }; + + ( + $( #[$enum_attr:meta] )* + enum $name:ident { + $( $( $( #[$variant_attr:meta] )* $variant:ident ),+ = $discriminator:expr ),* + } + ) => { + $( #[$enum_attr] )* + enum $name { + $( $( $( #[$variant_attr] )* $variant ),+ = $discriminator ),* + } + enum_from_primitive_impl! { $name, $( $( $variant )+ )* } + }; + + ( + $( #[$enum_attr:meta] )* + enum $name:ident { + $( $( #[$variant_attr:meta] )* $variant:ident ),+ + $( = $discriminator:expr, $( $( #[$variant_two_attr:meta] )* $variant_two:ident ),+ )*, + } + ) => { + $( #[$enum_attr] )* + enum $name { + $( $( #[$variant_attr] )* $variant ),+ + $( = $discriminator, $( $( #[$variant_two_attr] )* $variant_two ),+ )*, + } + enum_from_primitive_impl! { $name, $( $variant )+ $( $( $variant_two )+ )* } + }; + + ( + $( #[$enum_attr:meta] )* + enum $name:ident { + $( $( $( #[$variant_attr:meta] )* $variant:ident ),+ = $discriminator:expr ),+, + } + ) => { + $( #[$enum_attr] )* + enum $name { + $( $( $( #[$variant_attr] )* $variant ),+ = $discriminator ),+, + } + enum_from_primitive_impl! { $name, $( $( $variant )+ )+ } + }; + + ( + $( #[$enum_attr:meta] )* + pub enum $name:ident { + $( $( #[$variant_attr:meta] )* $variant:ident ),+ + $( = $discriminator:expr, $( $( #[$variant_two_attr:meta] )* $variant_two:ident ),+ )* + } + ) => { + $( #[$enum_attr] )* + pub enum $name { + $( $( #[$variant_attr] )* $variant ),+ + $( = $discriminator, $( $( #[$variant_two_attr] )* $variant_two ),+ )* + } + enum_from_primitive_impl! { $name, $( $variant )+ $( $( $variant_two )+ )* } + }; + + ( + $( #[$enum_attr:meta] )* + pub enum $name:ident { + $( $( $( #[$variant_attr:meta] )* $variant:ident ),+ = $discriminator:expr ),* + } + ) => { + $( #[$enum_attr] )* + pub enum $name { + $( $( $( #[$variant_attr] )* $variant ),+ = $discriminator ),* + } + enum_from_primitive_impl! { $name, $( $( $variant )+ )* } + }; + + ( + $( #[$enum_attr:meta] )* + pub enum $name:ident { + $( $( #[$variant_attr:meta] )* $variant:ident ),+ + $( = $discriminator:expr, $( $( #[$variant_two_attr:meta] )* $variant_two:ident ),+ )*, + } + ) => { + $( #[$enum_attr] )* + pub enum $name { + $( $( #[$variant_attr] )* $variant ),+ + $( = $discriminator, $( $( #[$variant_two_attr] )* $variant_two ),+ )*, + } + enum_from_primitive_impl! { $name, $( $variant )+ $( $( $variant_two )+ )* } + }; + + ( + $( #[$enum_attr:meta] )* + pub enum $name:ident { + $( $( $( #[$variant_attr:meta] )* $variant:ident ),+ = $discriminator:expr ),+, + } + ) => { + $( #[$enum_attr] )* + pub enum $name { + $( $( $( #[$variant_attr] )* $variant ),+ = $discriminator ),+, + } + enum_from_primitive_impl! { $name, $( $( $variant )+ )+ } + }; +} diff --git a/src/test/rustdoc/auxiliary/enum_primitive.rs b/src/test/rustdoc/auxiliary/enum_primitive.rs deleted file mode 100644 index ed1da253a97..00000000000 --- a/src/test/rustdoc/auxiliary/enum_primitive.rs +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright (c) 2015 Anders Kaseorg - -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// “Software”), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: - -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -//! This crate exports a macro `enum_from_primitive!` that wraps an -//! `enum` declaration and automatically adds an implementation of -//! `num::FromPrimitive` (reexported here), to allow conversion from -//! primitive integers to the enum. It therefore provides an -//! alternative to the built-in `#[derive(FromPrimitive)]`, which -//! requires the unstable `std::num::FromPrimitive` and is disabled in -//! Rust 1.0. -//! -//! # Example -//! -//! ``` -//! #[macro_use] extern crate enum_primitive; -//! extern crate num_traits; -//! use num_traits::FromPrimitive; -//! -//! enum_from_primitive! { -//! #[derive(Debug, PartialEq)] -//! enum FooBar { -//! Foo = 17, -//! Bar = 42, -//! Baz, -//! } -//! } -//! -//! fn main() { -//! assert_eq!(FooBar::from_i32(17), Some(FooBar::Foo)); -//! assert_eq!(FooBar::from_i32(42), Some(FooBar::Bar)); -//! assert_eq!(FooBar::from_i32(43), Some(FooBar::Baz)); -//! assert_eq!(FooBar::from_i32(91), None); -//! } -//! ``` - -pub mod num_traits { - pub trait FromPrimitive: Sized { - fn from_i64(n: i64) -> Option; - fn from_u64(n: u64) -> Option; - } -} - -pub use std::option::Option; -pub use num_traits::FromPrimitive; - -/// Helper macro for internal use by `enum_from_primitive!`. -#[macro_export] -macro_rules! enum_from_primitive_impl_ty { - ($meth:ident, $ty:ty, $name:ident, $( $variant:ident )*) => { - #[allow(non_upper_case_globals, unused)] - fn $meth(n: $ty) -> $crate::Option { - $( if n == $name::$variant as $ty { - $crate::Option::Some($name::$variant) - } else )* { - $crate::Option::None - } - } - }; -} - -/// Helper macro for internal use by `enum_from_primitive!`. -#[macro_export] -#[macro_use(enum_from_primitive_impl_ty)] -macro_rules! enum_from_primitive_impl { - ($name:ident, $( $variant:ident )*) => { - impl $crate::FromPrimitive for $name { - enum_from_primitive_impl_ty! { from_i64, i64, $name, $( $variant )* } - enum_from_primitive_impl_ty! { from_u64, u64, $name, $( $variant )* } - } - }; -} - -/// Wrap this macro around an `enum` declaration to get an -/// automatically generated implementation of `num::FromPrimitive`. -#[macro_export] -#[macro_use(enum_from_primitive_impl)] -macro_rules! enum_from_primitive { - ( - $( #[$enum_attr:meta] )* - enum $name:ident { - $( $( #[$variant_attr:meta] )* $variant:ident ),+ - $( = $discriminator:expr, $( $( #[$variant_two_attr:meta] )* $variant_two:ident ),+ )* - } - ) => { - $( #[$enum_attr] )* - enum $name { - $( $( #[$variant_attr] )* $variant ),+ - $( = $discriminator, $( $( #[$variant_two_attr] )* $variant_two ),+ )* - } - enum_from_primitive_impl! { $name, $( $variant )+ $( $( $variant_two )+ )* } - }; - - ( - $( #[$enum_attr:meta] )* - enum $name:ident { - $( $( $( #[$variant_attr:meta] )* $variant:ident ),+ = $discriminator:expr ),* - } - ) => { - $( #[$enum_attr] )* - enum $name { - $( $( $( #[$variant_attr] )* $variant ),+ = $discriminator ),* - } - enum_from_primitive_impl! { $name, $( $( $variant )+ )* } - }; - - ( - $( #[$enum_attr:meta] )* - enum $name:ident { - $( $( #[$variant_attr:meta] )* $variant:ident ),+ - $( = $discriminator:expr, $( $( #[$variant_two_attr:meta] )* $variant_two:ident ),+ )*, - } - ) => { - $( #[$enum_attr] )* - enum $name { - $( $( #[$variant_attr] )* $variant ),+ - $( = $discriminator, $( $( #[$variant_two_attr] )* $variant_two ),+ )*, - } - enum_from_primitive_impl! { $name, $( $variant )+ $( $( $variant_two )+ )* } - }; - - ( - $( #[$enum_attr:meta] )* - enum $name:ident { - $( $( $( #[$variant_attr:meta] )* $variant:ident ),+ = $discriminator:expr ),+, - } - ) => { - $( #[$enum_attr] )* - enum $name { - $( $( $( #[$variant_attr] )* $variant ),+ = $discriminator ),+, - } - enum_from_primitive_impl! { $name, $( $( $variant )+ )+ } - }; - - ( - $( #[$enum_attr:meta] )* - pub enum $name:ident { - $( $( #[$variant_attr:meta] )* $variant:ident ),+ - $( = $discriminator:expr, $( $( #[$variant_two_attr:meta] )* $variant_two:ident ),+ )* - } - ) => { - $( #[$enum_attr] )* - pub enum $name { - $( $( #[$variant_attr] )* $variant ),+ - $( = $discriminator, $( $( #[$variant_two_attr] )* $variant_two ),+ )* - } - enum_from_primitive_impl! { $name, $( $variant )+ $( $( $variant_two )+ )* } - }; - - ( - $( #[$enum_attr:meta] )* - pub enum $name:ident { - $( $( $( #[$variant_attr:meta] )* $variant:ident ),+ = $discriminator:expr ),* - } - ) => { - $( #[$enum_attr] )* - pub enum $name { - $( $( $( #[$variant_attr] )* $variant ),+ = $discriminator ),* - } - enum_from_primitive_impl! { $name, $( $( $variant )+ )* } - }; - - ( - $( #[$enum_attr:meta] )* - pub enum $name:ident { - $( $( #[$variant_attr:meta] )* $variant:ident ),+ - $( = $discriminator:expr, $( $( #[$variant_two_attr:meta] )* $variant_two:ident ),+ )*, - } - ) => { - $( #[$enum_attr] )* - pub enum $name { - $( $( #[$variant_attr] )* $variant ),+ - $( = $discriminator, $( $( #[$variant_two_attr] )* $variant_two ),+ )*, - } - enum_from_primitive_impl! { $name, $( $variant )+ $( $( $variant_two )+ )* } - }; - - ( - $( #[$enum_attr:meta] )* - pub enum $name:ident { - $( $( $( #[$variant_attr:meta] )* $variant:ident ),+ = $discriminator:expr ),+, - } - ) => { - $( #[$enum_attr] )* - pub enum $name { - $( $( $( #[$variant_attr] )* $variant ),+ = $discriminator ),+, - } - enum_from_primitive_impl! { $name, $( $( $variant )+ )+ } - }; -} diff --git a/src/test/rustdoc/auxiliary/reexp-stripped.rs b/src/test/rustdoc/auxiliary/reexp-stripped.rs new file mode 100644 index 00000000000..ccc3dc11fd1 --- /dev/null +++ b/src/test/rustdoc/auxiliary/reexp-stripped.rs @@ -0,0 +1,11 @@ +pub use private::Quz; +pub use hidden::Bar; + +mod private { + pub struct Quz; +} + +#[doc(hidden)] +pub mod hidden { + pub struct Bar; +} diff --git a/src/test/rustdoc/auxiliary/reexp_stripped.rs b/src/test/rustdoc/auxiliary/reexp_stripped.rs deleted file mode 100644 index ccc3dc11fd1..00000000000 --- a/src/test/rustdoc/auxiliary/reexp_stripped.rs +++ /dev/null @@ -1,11 +0,0 @@ -pub use private::Quz; -pub use hidden::Bar; - -mod private { - pub struct Quz; -} - -#[doc(hidden)] -pub mod hidden { - pub struct Bar; -} diff --git a/src/test/rustdoc/no-stack-overflow-25295.rs b/src/test/rustdoc/no-stack-overflow-25295.rs index 7e5c0279031..dd79f1e4baa 100644 --- a/src/test/rustdoc/no-stack-overflow-25295.rs +++ b/src/test/rustdoc/no-stack-overflow-25295.rs @@ -1,5 +1,5 @@ -// ensure this code doesn't stack overflow -// aux-build:enum_primitive.rs +// Ensure this code doesn't stack overflow. +// aux-build:enum-primitive.rs #[macro_use] extern crate enum_primitive; @@ -33,4 +33,3 @@ enum_from_primitive! { Z1,Z2,Z3,Z4,Z5,Z6, } } - diff --git a/src/test/rustdoc/redirect.rs b/src/test/rustdoc/redirect.rs index 65c57ab65be..e3a14c7a74a 100644 --- a/src/test/rustdoc/redirect.rs +++ b/src/test/rustdoc/redirect.rs @@ -1,4 +1,4 @@ -// aux-build:reexp_stripped.rs +// aux-build:reexp-stripped.rs // build-aux-docs // ignore-cross-compile diff --git a/src/test/ui-fulldeps/auxiliary/attr-plugin-test.rs b/src/test/ui-fulldeps/auxiliary/attr-plugin-test.rs new file mode 100644 index 00000000000..c83e7bdb998 --- /dev/null +++ b/src/test/ui-fulldeps/auxiliary/attr-plugin-test.rs @@ -0,0 +1,21 @@ +// force-host + +#![feature(plugin_registrar)] +#![feature(rustc_private)] + +extern crate syntax; + +extern crate rustc; +extern crate rustc_plugin; + +use syntax::feature_gate::AttributeType; +use rustc_plugin::Registry; + + + +#[plugin_registrar] +pub fn plugin_registrar(reg: &mut Registry) { + reg.register_attribute("foo".to_owned(), AttributeType::Normal); + reg.register_attribute("bar".to_owned(), AttributeType::CrateLevel); + reg.register_attribute("baz".to_owned(), AttributeType::Whitelisted); +} diff --git a/src/test/ui-fulldeps/auxiliary/attr_plugin_test.rs b/src/test/ui-fulldeps/auxiliary/attr_plugin_test.rs deleted file mode 100644 index c83e7bdb998..00000000000 --- a/src/test/ui-fulldeps/auxiliary/attr_plugin_test.rs +++ /dev/null @@ -1,21 +0,0 @@ -// force-host - -#![feature(plugin_registrar)] -#![feature(rustc_private)] - -extern crate syntax; - -extern crate rustc; -extern crate rustc_plugin; - -use syntax::feature_gate::AttributeType; -use rustc_plugin::Registry; - - - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_attribute("foo".to_owned(), AttributeType::Normal); - reg.register_attribute("bar".to_owned(), AttributeType::CrateLevel); - reg.register_attribute("baz".to_owned(), AttributeType::Whitelisted); -} diff --git a/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs b/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs new file mode 100644 index 00000000000..82aa28b26b6 --- /dev/null +++ b/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs @@ -0,0 +1,41 @@ +// force-host + +#![feature(plugin_registrar, rustc_private)] +#![feature(box_syntax)] + +#[macro_use] extern crate rustc; +extern crate rustc_plugin; +extern crate syntax; + +use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray}; +use rustc_plugin::Registry; +use rustc::hir; +use syntax::attr; + +declare_lint!(CRATE_NOT_OKAY, Warn, "crate not marked with #![crate_okay]"); + +struct Pass; + +impl LintPass for Pass { + fn name(&self) -> &'static str { + "Pass" + } + + fn get_lints(&self) -> LintArray { + lint_array!(CRATE_NOT_OKAY) + } +} + +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_crate(&mut self, cx: &LateContext, krate: &hir::Crate) { + if !attr::contains_name(&krate.attrs, "crate_okay") { + cx.span_lint(CRATE_NOT_OKAY, krate.span, + "crate is not marked with #![crate_okay]"); + } + } +} + +#[plugin_registrar] +pub fn plugin_registrar(reg: &mut Registry) { + reg.register_late_lint_pass(box Pass); +} diff --git a/src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs b/src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs new file mode 100644 index 00000000000..16630e2b312 --- /dev/null +++ b/src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs @@ -0,0 +1,45 @@ +// force-host + +#![feature(plugin_registrar)] +#![feature(box_syntax, rustc_private)] + +// Load rustc as a plugin to get macros. +#[macro_use] +extern crate rustc; +extern crate rustc_plugin; + +use rustc::hir; +use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray}; +use rustc_plugin::Registry; + +declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'"); + +declare_lint!(PLEASE_LINT, Warn, "Warn about items named 'pleaselintme'"); + +struct Pass; + +impl LintPass for Pass { + fn name(&self) -> &'static str { + "Pass" + } + + fn get_lints(&self) -> LintArray { + lint_array!(TEST_LINT, PLEASE_LINT) + } +} + +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_item(&mut self, cx: &LateContext, it: &hir::Item) { + match &*it.ident.as_str() { + "lintme" => cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"), + "pleaselintme" => cx.span_lint(PLEASE_LINT, it.span, "item is named 'pleaselintme'"), + _ => {} + } + } +} + +#[plugin_registrar] +pub fn plugin_registrar(reg: &mut Registry) { + reg.register_late_lint_pass(box Pass); + reg.register_lint_group("lint_me", None, vec![TEST_LINT, PLEASE_LINT]); +} diff --git a/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs b/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs new file mode 100644 index 00000000000..4e45189b424 --- /dev/null +++ b/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs @@ -0,0 +1,42 @@ +// force-host + +#![feature(plugin_registrar)] +#![feature(box_syntax, rustc_private)] + +extern crate syntax; + +// Load rustc as a plugin to get macros +#[macro_use] +extern crate rustc; +extern crate rustc_plugin; + +use rustc::lint::{EarlyContext, LintContext, LintPass, EarlyLintPass, + EarlyLintPassObject, LintArray}; +use rustc_plugin::Registry; +use syntax::ast; +declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'"); + +struct Pass; + +impl LintPass for Pass { + fn name(&self) -> &'static str { + "Pass" + } + + fn get_lints(&self) -> LintArray { + lint_array!(TEST_LINT) + } +} + +impl EarlyLintPass for Pass { + fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) { + if it.ident.name == "lintme" { + cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"); + } + } +} + +#[plugin_registrar] +pub fn plugin_registrar(reg: &mut Registry) { + reg.register_early_lint_pass(box Pass as EarlyLintPassObject); +} diff --git a/src/test/ui-fulldeps/auxiliary/lint-tool-test.rs b/src/test/ui-fulldeps/auxiliary/lint-tool-test.rs new file mode 100644 index 00000000000..d25a5ea3746 --- /dev/null +++ b/src/test/ui-fulldeps/auxiliary/lint-tool-test.rs @@ -0,0 +1,49 @@ +#![feature(plugin_registrar)] +#![feature(box_syntax, rustc_private)] + +extern crate syntax; + +// Load rustc as a plugin to get macros +#[macro_use] +extern crate rustc; +extern crate rustc_plugin; + +use rustc::lint::{EarlyContext, LintContext, LintPass, EarlyLintPass, + LintArray}; +use rustc_plugin::Registry; +use syntax::ast; +declare_tool_lint!(pub clippy::TEST_LINT, Warn, "Warn about stuff"); +declare_tool_lint!( + /// Some docs + pub clippy::TEST_GROUP, + Warn, "Warn about other stuff" +); + +struct Pass; + +impl LintPass for Pass { + fn name(&self) -> &'static str { + "Pass" + } + + fn get_lints(&self) -> LintArray { + lint_array!(TEST_LINT, TEST_GROUP) + } +} + +impl EarlyLintPass for Pass { + fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) { + if it.ident.name == "lintme" { + cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"); + } + if it.ident.name == "lintmetoo" { + cx.span_lint(TEST_GROUP, it.span, "item is named 'lintmetoo'"); + } + } +} + +#[plugin_registrar] +pub fn plugin_registrar(reg: &mut Registry) { + reg.register_early_lint_pass(box Pass); + reg.register_lint_group("clippy::group", Some("clippy_group"), vec![TEST_LINT, TEST_GROUP]); +} diff --git a/src/test/ui-fulldeps/auxiliary/lint_for_crate.rs b/src/test/ui-fulldeps/auxiliary/lint_for_crate.rs deleted file mode 100644 index 82aa28b26b6..00000000000 --- a/src/test/ui-fulldeps/auxiliary/lint_for_crate.rs +++ /dev/null @@ -1,41 +0,0 @@ -// force-host - -#![feature(plugin_registrar, rustc_private)] -#![feature(box_syntax)] - -#[macro_use] extern crate rustc; -extern crate rustc_plugin; -extern crate syntax; - -use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray}; -use rustc_plugin::Registry; -use rustc::hir; -use syntax::attr; - -declare_lint!(CRATE_NOT_OKAY, Warn, "crate not marked with #![crate_okay]"); - -struct Pass; - -impl LintPass for Pass { - fn name(&self) -> &'static str { - "Pass" - } - - fn get_lints(&self) -> LintArray { - lint_array!(CRATE_NOT_OKAY) - } -} - -impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { - fn check_crate(&mut self, cx: &LateContext, krate: &hir::Crate) { - if !attr::contains_name(&krate.attrs, "crate_okay") { - cx.span_lint(CRATE_NOT_OKAY, krate.span, - "crate is not marked with #![crate_okay]"); - } - } -} - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_late_lint_pass(box Pass); -} diff --git a/src/test/ui-fulldeps/auxiliary/lint_group_plugin_test.rs b/src/test/ui-fulldeps/auxiliary/lint_group_plugin_test.rs deleted file mode 100644 index 16630e2b312..00000000000 --- a/src/test/ui-fulldeps/auxiliary/lint_group_plugin_test.rs +++ /dev/null @@ -1,45 +0,0 @@ -// force-host - -#![feature(plugin_registrar)] -#![feature(box_syntax, rustc_private)] - -// Load rustc as a plugin to get macros. -#[macro_use] -extern crate rustc; -extern crate rustc_plugin; - -use rustc::hir; -use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray}; -use rustc_plugin::Registry; - -declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'"); - -declare_lint!(PLEASE_LINT, Warn, "Warn about items named 'pleaselintme'"); - -struct Pass; - -impl LintPass for Pass { - fn name(&self) -> &'static str { - "Pass" - } - - fn get_lints(&self) -> LintArray { - lint_array!(TEST_LINT, PLEASE_LINT) - } -} - -impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { - fn check_item(&mut self, cx: &LateContext, it: &hir::Item) { - match &*it.ident.as_str() { - "lintme" => cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"), - "pleaselintme" => cx.span_lint(PLEASE_LINT, it.span, "item is named 'pleaselintme'"), - _ => {} - } - } -} - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_late_lint_pass(box Pass); - reg.register_lint_group("lint_me", None, vec![TEST_LINT, PLEASE_LINT]); -} diff --git a/src/test/ui-fulldeps/auxiliary/lint_plugin_test.rs b/src/test/ui-fulldeps/auxiliary/lint_plugin_test.rs deleted file mode 100644 index 4e45189b424..00000000000 --- a/src/test/ui-fulldeps/auxiliary/lint_plugin_test.rs +++ /dev/null @@ -1,42 +0,0 @@ -// force-host - -#![feature(plugin_registrar)] -#![feature(box_syntax, rustc_private)] - -extern crate syntax; - -// Load rustc as a plugin to get macros -#[macro_use] -extern crate rustc; -extern crate rustc_plugin; - -use rustc::lint::{EarlyContext, LintContext, LintPass, EarlyLintPass, - EarlyLintPassObject, LintArray}; -use rustc_plugin::Registry; -use syntax::ast; -declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'"); - -struct Pass; - -impl LintPass for Pass { - fn name(&self) -> &'static str { - "Pass" - } - - fn get_lints(&self) -> LintArray { - lint_array!(TEST_LINT) - } -} - -impl EarlyLintPass for Pass { - fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) { - if it.ident.name == "lintme" { - cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"); - } - } -} - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_early_lint_pass(box Pass as EarlyLintPassObject); -} diff --git a/src/test/ui-fulldeps/auxiliary/lint_tool_test.rs b/src/test/ui-fulldeps/auxiliary/lint_tool_test.rs deleted file mode 100644 index d25a5ea3746..00000000000 --- a/src/test/ui-fulldeps/auxiliary/lint_tool_test.rs +++ /dev/null @@ -1,49 +0,0 @@ -#![feature(plugin_registrar)] -#![feature(box_syntax, rustc_private)] - -extern crate syntax; - -// Load rustc as a plugin to get macros -#[macro_use] -extern crate rustc; -extern crate rustc_plugin; - -use rustc::lint::{EarlyContext, LintContext, LintPass, EarlyLintPass, - LintArray}; -use rustc_plugin::Registry; -use syntax::ast; -declare_tool_lint!(pub clippy::TEST_LINT, Warn, "Warn about stuff"); -declare_tool_lint!( - /// Some docs - pub clippy::TEST_GROUP, - Warn, "Warn about other stuff" -); - -struct Pass; - -impl LintPass for Pass { - fn name(&self) -> &'static str { - "Pass" - } - - fn get_lints(&self) -> LintArray { - lint_array!(TEST_LINT, TEST_GROUP) - } -} - -impl EarlyLintPass for Pass { - fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) { - if it.ident.name == "lintme" { - cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"); - } - if it.ident.name == "lintmetoo" { - cx.span_lint(TEST_GROUP, it.span, "item is named 'lintmetoo'"); - } - } -} - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_early_lint_pass(box Pass); - reg.register_lint_group("clippy::group", Some("clippy_group"), vec![TEST_LINT, TEST_GROUP]); -} diff --git a/src/test/ui-fulldeps/auxiliary/rlib-crate-test.rs b/src/test/ui-fulldeps/auxiliary/rlib-crate-test.rs new file mode 100644 index 00000000000..3df40df7b33 --- /dev/null +++ b/src/test/ui-fulldeps/auxiliary/rlib-crate-test.rs @@ -0,0 +1,12 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] +#![feature(plugin_registrar, rustc_private)] + +extern crate rustc; +extern crate rustc_plugin; + +use rustc_plugin::Registry; + +#[plugin_registrar] +pub fn plugin_registrar(_: &mut Registry) {} diff --git a/src/test/ui-fulldeps/auxiliary/rlib_crate_test.rs b/src/test/ui-fulldeps/auxiliary/rlib_crate_test.rs deleted file mode 100644 index 3df40df7b33..00000000000 --- a/src/test/ui-fulldeps/auxiliary/rlib_crate_test.rs +++ /dev/null @@ -1,12 +0,0 @@ -// no-prefer-dynamic - -#![crate_type = "rlib"] -#![feature(plugin_registrar, rustc_private)] - -extern crate rustc; -extern crate rustc_plugin; - -use rustc_plugin::Registry; - -#[plugin_registrar] -pub fn plugin_registrar(_: &mut Registry) {} diff --git a/src/test/ui-fulldeps/dropck-tarena-cycle-checked.rs b/src/test/ui-fulldeps/dropck-tarena-cycle-checked.rs new file mode 100644 index 00000000000..a7e8131342f --- /dev/null +++ b/src/test/ui-fulldeps/dropck-tarena-cycle-checked.rs @@ -0,0 +1,117 @@ +// Reject mixing cyclic structure and Drop when using TypedArena. +// +// (Compare against compile-fail/dropck_vec_cycle_checked.rs) +// +// (Also compare against compile-fail/dropck_tarena_unsound_drop.rs, +// which is a reduction of this code to more directly show the reason +// for the error message we see here.) + +#![feature(rustc_private)] + +extern crate arena; + +use arena::TypedArena; +use std::cell::Cell; +use id::Id; + +mod s { + use std::sync::atomic::{AtomicUsize, Ordering}; + + static S_COUNT: AtomicUsize = AtomicUsize::new(0); + + pub fn next_count() -> usize { + S_COUNT.fetch_add(1, Ordering::SeqCst) + 1 + } +} + +mod id { + use s; + #[derive(Debug)] + pub struct Id { + orig_count: usize, + count: usize, + } + + impl Id { + pub fn new() -> Id { + let c = s::next_count(); + println!("building Id {}", c); + Id { orig_count: c, count: c } + } + pub fn count(&self) -> usize { + println!("Id::count on {} returns {}", self.orig_count, self.count); + self.count + } + } + + impl Drop for Id { + fn drop(&mut self) { + println!("dropping Id {}", self.count); + self.count = 0; + } + } +} + +trait HasId { + fn count(&self) -> usize; +} + +#[derive(Debug)] +struct CheckId { + v: T +} + +#[allow(non_snake_case)] +fn CheckId(t: T) -> CheckId { CheckId{ v: t } } + +impl Drop for CheckId { + fn drop(&mut self) { + assert!(self.v.count() > 0); + } +} + +#[derive(Debug)] +struct C<'a> { + id: Id, + v: Vec>>>>, +} + +impl<'a> HasId for Cell>> { + fn count(&self) -> usize { + match self.get() { + None => 1, + Some(c) => c.id.count(), + } + } +} + +impl<'a> C<'a> { + fn new() -> C<'a> { + C { id: Id::new(), v: Vec::new() } + } +} + +fn f<'a>(arena: &'a TypedArena>) { + let c1 = arena.alloc(C::new()); + let c2 = arena.alloc(C::new()); + let c3 = arena.alloc(C::new()); + + c1.v.push(CheckId(Cell::new(None))); + c1.v.push(CheckId(Cell::new(None))); + c2.v.push(CheckId(Cell::new(None))); + c2.v.push(CheckId(Cell::new(None))); + c3.v.push(CheckId(Cell::new(None))); + c3.v.push(CheckId(Cell::new(None))); + + c1.v[0].v.set(Some(c2)); + c1.v[1].v.set(Some(c3)); + c2.v[0].v.set(Some(c2)); + c2.v[1].v.set(Some(c3)); + c3.v[0].v.set(Some(c1)); + c3.v[1].v.set(Some(c2)); +} + +fn main() { + let arena = TypedArena::default(); + f(&arena); +} //~^ ERROR `arena` does not live long enough diff --git a/src/test/ui-fulldeps/dropck-tarena-cycle-checked.stderr b/src/test/ui-fulldeps/dropck-tarena-cycle-checked.stderr new file mode 100644 index 00000000000..b6d5ee0cafe --- /dev/null +++ b/src/test/ui-fulldeps/dropck-tarena-cycle-checked.stderr @@ -0,0 +1,13 @@ +error[E0597]: `arena` does not live long enough + --> $DIR/dropck-tarena-cycle-checked.rs:116:8 + | +LL | f(&arena); + | ^^^^^ borrowed value does not live long enough +LL | } + | - `arena` dropped here while still borrowed + | + = note: values in a scope are dropped in the opposite order they are created + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui-fulldeps/dropck-tarena-unsound-drop.rs b/src/test/ui-fulldeps/dropck-tarena-unsound-drop.rs new file mode 100644 index 00000000000..3103aef36cb --- /dev/null +++ b/src/test/ui-fulldeps/dropck-tarena-unsound-drop.rs @@ -0,0 +1,43 @@ +// Check that an arena (TypedArena) cannot carry elements whose drop +// methods might access borrowed data of lifetime that does not +// strictly outlive the arena itself. +// +// Compare against run-pass/dropck_tarena_sound_drop.rs, which shows a +// similar setup, but loosens `f` so that the struct `C<'a>` can be +// fed a lifetime longer than that of the arena. +// +// (Also compare against dropck_tarena_cycle_checked.rs, from which +// this was reduced to better understand its error message.) + +#![feature(rustc_private)] + +extern crate arena; + +use arena::TypedArena; + +trait HasId { fn count(&self) -> usize; } + +struct CheckId { v: T } + +// In the code below, the impl of HasId for `&'a usize` does not +// actually access the borrowed data, but the point is that the +// interface to CheckId does not (and cannot) know that, and therefore +// when encountering a value V of type CheckId, we must +// conservatively force the type S to strictly outlive V. +impl Drop for CheckId { + fn drop(&mut self) { + assert!(self.v.count() > 0); + } +} + +struct C<'a> { v: CheckId<&'a usize>, } + +impl<'a> HasId for &'a usize { fn count(&self) -> usize { 1 } } + +fn f<'a>(_arena: &'a TypedArena>) {} + +fn main() { + let arena: TypedArena = TypedArena::default(); + f(&arena); +} //~^ ERROR `arena` does not live long enough + diff --git a/src/test/ui-fulldeps/dropck-tarena-unsound-drop.stderr b/src/test/ui-fulldeps/dropck-tarena-unsound-drop.stderr new file mode 100644 index 00000000000..1e612f04983 --- /dev/null +++ b/src/test/ui-fulldeps/dropck-tarena-unsound-drop.stderr @@ -0,0 +1,13 @@ +error[E0597]: `arena` does not live long enough + --> $DIR/dropck-tarena-unsound-drop.rs:41:8 + | +LL | f(&arena); + | ^^^^^ borrowed value does not live long enough +LL | } + | - `arena` dropped here while still borrowed + | + = note: values in a scope are dropped in the opposite order they are created + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui-fulldeps/dropck_tarena_cycle_checked.rs b/src/test/ui-fulldeps/dropck_tarena_cycle_checked.rs deleted file mode 100644 index a7e8131342f..00000000000 --- a/src/test/ui-fulldeps/dropck_tarena_cycle_checked.rs +++ /dev/null @@ -1,117 +0,0 @@ -// Reject mixing cyclic structure and Drop when using TypedArena. -// -// (Compare against compile-fail/dropck_vec_cycle_checked.rs) -// -// (Also compare against compile-fail/dropck_tarena_unsound_drop.rs, -// which is a reduction of this code to more directly show the reason -// for the error message we see here.) - -#![feature(rustc_private)] - -extern crate arena; - -use arena::TypedArena; -use std::cell::Cell; -use id::Id; - -mod s { - use std::sync::atomic::{AtomicUsize, Ordering}; - - static S_COUNT: AtomicUsize = AtomicUsize::new(0); - - pub fn next_count() -> usize { - S_COUNT.fetch_add(1, Ordering::SeqCst) + 1 - } -} - -mod id { - use s; - #[derive(Debug)] - pub struct Id { - orig_count: usize, - count: usize, - } - - impl Id { - pub fn new() -> Id { - let c = s::next_count(); - println!("building Id {}", c); - Id { orig_count: c, count: c } - } - pub fn count(&self) -> usize { - println!("Id::count on {} returns {}", self.orig_count, self.count); - self.count - } - } - - impl Drop for Id { - fn drop(&mut self) { - println!("dropping Id {}", self.count); - self.count = 0; - } - } -} - -trait HasId { - fn count(&self) -> usize; -} - -#[derive(Debug)] -struct CheckId { - v: T -} - -#[allow(non_snake_case)] -fn CheckId(t: T) -> CheckId { CheckId{ v: t } } - -impl Drop for CheckId { - fn drop(&mut self) { - assert!(self.v.count() > 0); - } -} - -#[derive(Debug)] -struct C<'a> { - id: Id, - v: Vec>>>>, -} - -impl<'a> HasId for Cell>> { - fn count(&self) -> usize { - match self.get() { - None => 1, - Some(c) => c.id.count(), - } - } -} - -impl<'a> C<'a> { - fn new() -> C<'a> { - C { id: Id::new(), v: Vec::new() } - } -} - -fn f<'a>(arena: &'a TypedArena>) { - let c1 = arena.alloc(C::new()); - let c2 = arena.alloc(C::new()); - let c3 = arena.alloc(C::new()); - - c1.v.push(CheckId(Cell::new(None))); - c1.v.push(CheckId(Cell::new(None))); - c2.v.push(CheckId(Cell::new(None))); - c2.v.push(CheckId(Cell::new(None))); - c3.v.push(CheckId(Cell::new(None))); - c3.v.push(CheckId(Cell::new(None))); - - c1.v[0].v.set(Some(c2)); - c1.v[1].v.set(Some(c3)); - c2.v[0].v.set(Some(c2)); - c2.v[1].v.set(Some(c3)); - c3.v[0].v.set(Some(c1)); - c3.v[1].v.set(Some(c2)); -} - -fn main() { - let arena = TypedArena::default(); - f(&arena); -} //~^ ERROR `arena` does not live long enough diff --git a/src/test/ui-fulldeps/dropck_tarena_cycle_checked.stderr b/src/test/ui-fulldeps/dropck_tarena_cycle_checked.stderr deleted file mode 100644 index 37d8b964c24..00000000000 --- a/src/test/ui-fulldeps/dropck_tarena_cycle_checked.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0597]: `arena` does not live long enough - --> $DIR/dropck_tarena_cycle_checked.rs:116:8 - | -LL | f(&arena); - | ^^^^^ borrowed value does not live long enough -LL | } - | - `arena` dropped here while still borrowed - | - = note: values in a scope are dropped in the opposite order they are created - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui-fulldeps/dropck_tarena_unsound_drop.rs b/src/test/ui-fulldeps/dropck_tarena_unsound_drop.rs deleted file mode 100644 index 3103aef36cb..00000000000 --- a/src/test/ui-fulldeps/dropck_tarena_unsound_drop.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Check that an arena (TypedArena) cannot carry elements whose drop -// methods might access borrowed data of lifetime that does not -// strictly outlive the arena itself. -// -// Compare against run-pass/dropck_tarena_sound_drop.rs, which shows a -// similar setup, but loosens `f` so that the struct `C<'a>` can be -// fed a lifetime longer than that of the arena. -// -// (Also compare against dropck_tarena_cycle_checked.rs, from which -// this was reduced to better understand its error message.) - -#![feature(rustc_private)] - -extern crate arena; - -use arena::TypedArena; - -trait HasId { fn count(&self) -> usize; } - -struct CheckId { v: T } - -// In the code below, the impl of HasId for `&'a usize` does not -// actually access the borrowed data, but the point is that the -// interface to CheckId does not (and cannot) know that, and therefore -// when encountering a value V of type CheckId, we must -// conservatively force the type S to strictly outlive V. -impl Drop for CheckId { - fn drop(&mut self) { - assert!(self.v.count() > 0); - } -} - -struct C<'a> { v: CheckId<&'a usize>, } - -impl<'a> HasId for &'a usize { fn count(&self) -> usize { 1 } } - -fn f<'a>(_arena: &'a TypedArena>) {} - -fn main() { - let arena: TypedArena = TypedArena::default(); - f(&arena); -} //~^ ERROR `arena` does not live long enough - diff --git a/src/test/ui-fulldeps/dropck_tarena_unsound_drop.stderr b/src/test/ui-fulldeps/dropck_tarena_unsound_drop.stderr deleted file mode 100644 index c791b8b451e..00000000000 --- a/src/test/ui-fulldeps/dropck_tarena_unsound_drop.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0597]: `arena` does not live long enough - --> $DIR/dropck_tarena_unsound_drop.rs:41:8 - | -LL | f(&arena); - | ^^^^^ borrowed value does not live long enough -LL | } - | - `arena` dropped here while still borrowed - | - = note: values in a scope are dropped in the opposite order they are created - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui-fulldeps/gated-plugin.rs b/src/test/ui-fulldeps/gated-plugin.rs index a647585e621..be1ec061480 100644 --- a/src/test/ui-fulldeps/gated-plugin.rs +++ b/src/test/ui-fulldeps/gated-plugin.rs @@ -1,4 +1,4 @@ -// aux-build:attr_plugin_test.rs +// aux-build:attr-plugin-test.rs #![plugin(attr_plugin_test)] //~^ ERROR compiler plugins are experimental and possibly buggy diff --git a/src/test/ui-fulldeps/issue-15778-fail.rs b/src/test/ui-fulldeps/issue-15778-fail.rs index 91c379673b3..75c52fdb4bd 100644 --- a/src/test/ui-fulldeps/issue-15778-fail.rs +++ b/src/test/ui-fulldeps/issue-15778-fail.rs @@ -1,4 +1,4 @@ -// aux-build:lint_for_crate.rs +// aux-build:lint-for-crate.rs // ignore-stage1 // compile-flags: -D crate-not-okay diff --git a/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.rs b/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.rs index 75e0a8fc31f..c9d8654a909 100644 --- a/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.rs +++ b/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.rs @@ -1,4 +1,4 @@ -// aux-build:lint_group_plugin_test.rs +// aux-build:lint-group-plugin-test.rs // ignore-stage1 // compile-flags: -D lint-me diff --git a/src/test/ui-fulldeps/lint-group-plugin.rs b/src/test/ui-fulldeps/lint-group-plugin.rs index 7a650afe5f8..55a880be0f9 100644 --- a/src/test/ui-fulldeps/lint-group-plugin.rs +++ b/src/test/ui-fulldeps/lint-group-plugin.rs @@ -1,5 +1,5 @@ // run-pass -// aux-build:lint_group_plugin_test.rs +// aux-build:lint-group-plugin-test.rs // ignore-stage1 #![feature(plugin)] diff --git a/src/test/ui-fulldeps/lint-plugin-cmdline-allow.rs b/src/test/ui-fulldeps/lint-plugin-cmdline-allow.rs index 21042c5e7d0..8017379ab3d 100644 --- a/src/test/ui-fulldeps/lint-plugin-cmdline-allow.rs +++ b/src/test/ui-fulldeps/lint-plugin-cmdline-allow.rs @@ -1,5 +1,5 @@ // run-pass -// aux-build:lint_plugin_test.rs +// aux-build:lint-plugin-test.rs // ignore-stage1 // compile-flags: -A test-lint diff --git a/src/test/ui-fulldeps/lint-plugin-cmdline-load.rs b/src/test/ui-fulldeps/lint-plugin-cmdline-load.rs index 0dca00040bf..fd681536b5b 100644 --- a/src/test/ui-fulldeps/lint-plugin-cmdline-load.rs +++ b/src/test/ui-fulldeps/lint-plugin-cmdline-load.rs @@ -1,5 +1,5 @@ // run-pass -// aux-build:lint_plugin_test.rs +// aux-build:lint-plugin-test.rs // ignore-stage1 // compile-flags: -Z extra-plugins=lint_plugin_test diff --git a/src/test/ui-fulldeps/lint-plugin-deny-attr.rs b/src/test/ui-fulldeps/lint-plugin-deny-attr.rs index 65a36236180..2d424af8707 100644 --- a/src/test/ui-fulldeps/lint-plugin-deny-attr.rs +++ b/src/test/ui-fulldeps/lint-plugin-deny-attr.rs @@ -1,4 +1,4 @@ -// aux-build:lint_plugin_test.rs +// aux-build:lint-plugin-test.rs // ignore-stage1 #![feature(plugin)] diff --git a/src/test/ui-fulldeps/lint-plugin-deny-cmdline.rs b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.rs index b0c4dc0bce5..87324e85b3b 100644 --- a/src/test/ui-fulldeps/lint-plugin-deny-cmdline.rs +++ b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.rs @@ -1,4 +1,4 @@ -// aux-build:lint_plugin_test.rs +// aux-build:lint-plugin-test.rs // ignore-stage1 // compile-flags: -D test-lint diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs index 964fed3b37d..c7f7f2be99e 100644 --- a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs +++ b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs @@ -1,4 +1,4 @@ -// aux-build:lint_plugin_test.rs +// aux-build:lint-plugin-test.rs // ignore-stage1 #![feature(plugin)] diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs index 07bd785ee71..91fe3b65be6 100644 --- a/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs +++ b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs @@ -1,4 +1,4 @@ -// aux-build:lint_plugin_test.rs +// aux-build:lint-plugin-test.rs // ignore-stage1 // compile-flags: -F test-lint diff --git a/src/test/ui-fulldeps/lint-plugin.rs b/src/test/ui-fulldeps/lint-plugin.rs index 031f3b86b14..5f8bc16301a 100644 --- a/src/test/ui-fulldeps/lint-plugin.rs +++ b/src/test/ui-fulldeps/lint-plugin.rs @@ -1,5 +1,5 @@ // run-pass -// aux-build:lint_plugin_test.rs +// aux-build:lint-plugin-test.rs // ignore-stage1 #![feature(plugin)] #![plugin(lint_plugin_test)] diff --git a/src/test/ui-fulldeps/lint-tool-cmdline-allow.rs b/src/test/ui-fulldeps/lint-tool-cmdline-allow.rs new file mode 100644 index 00000000000..529f04c6fc4 --- /dev/null +++ b/src/test/ui-fulldeps/lint-tool-cmdline-allow.rs @@ -0,0 +1,12 @@ +// run-pass +// aux-build:lint-tool-test.rs +// ignore-stage1 +// compile-flags: -A test-lint + +#![feature(plugin)] +#![warn(unused)] +#![plugin(lint_tool_test)] + +fn lintme() {} + +pub fn main() {} diff --git a/src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr b/src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr new file mode 100644 index 00000000000..1d851013831 --- /dev/null +++ b/src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr @@ -0,0 +1,25 @@ +warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint + | + = note: requested on the command line with `-A test_lint` + +warning: item is named 'lintme' + --> $DIR/lint-tool-cmdline-allow.rs:10:1 + | +LL | fn lintme() {} + | ^^^^^^^^^^^^^^ + | + = note: #[warn(clippy::test_lint)] on by default + +warning: function is never used: `lintme` + --> $DIR/lint-tool-cmdline-allow.rs:10:1 + | +LL | fn lintme() {} + | ^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/lint-tool-cmdline-allow.rs:7:9 + | +LL | #![warn(unused)] + | ^^^^^^ + = note: #[warn(dead_code)] implied by #[warn(unused)] + diff --git a/src/test/ui-fulldeps/lint-tool-test.rs b/src/test/ui-fulldeps/lint-tool-test.rs new file mode 100644 index 00000000000..8bd06d1f1e3 --- /dev/null +++ b/src/test/ui-fulldeps/lint-tool-test.rs @@ -0,0 +1,30 @@ +// aux-build:lint-tool-test.rs +// ignore-stage1 +// compile-flags: --cfg foo + +#![feature(plugin)] +#![plugin(lint_tool_test)] +#![allow(dead_code)] +#![cfg_attr(foo, warn(test_lint))] +//~^ WARNING lint name `test_lint` is deprecated and may not have an effect in the future +//~^^ WARNING lint name `test_lint` is deprecated and may not have an effect in the future +#![deny(clippy_group)] +//~^ WARNING lint name `clippy_group` is deprecated and may not have an effect in the future + +fn lintme() { } //~ ERROR item is named 'lintme' + +#[allow(clippy::group)] +fn lintmetoo() {} + +#[allow(clippy::test_lint)] +pub fn main() { + fn lintme() { } + fn lintmetoo() { } //~ ERROR item is named 'lintmetoo' +} + +#[allow(test_group)] +//~^ WARNING lint name `test_group` is deprecated and may not have an effect in the future +#[deny(this_lint_does_not_exist)] //~ WARNING unknown lint: `this_lint_does_not_exist` +fn hello() { + fn lintmetoo() { } +} diff --git a/src/test/ui-fulldeps/lint-tool-test.stderr b/src/test/ui-fulldeps/lint-tool-test.stderr new file mode 100644 index 00000000000..67e55e65c7e --- /dev/null +++ b/src/test/ui-fulldeps/lint-tool-test.stderr @@ -0,0 +1,62 @@ +warning: lint name `test_lint` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore + --> $DIR/lint-tool-test.rs:8:23 + | +LL | #![cfg_attr(foo, warn(test_lint))] + | ^^^^^^^^^ help: change it to: `clippy::test_lint` + | + = note: #[warn(renamed_and_removed_lints)] on by default + +warning: lint name `clippy_group` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore + --> $DIR/lint-tool-test.rs:11:9 + | +LL | #![deny(clippy_group)] + | ^^^^^^^^^^^^ help: change it to: `clippy::group` + +warning: lint name `test_group` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore + --> $DIR/lint-tool-test.rs:25:9 + | +LL | #[allow(test_group)] + | ^^^^^^^^^^ help: change it to: `clippy::test_group` + +warning: unknown lint: `this_lint_does_not_exist` + --> $DIR/lint-tool-test.rs:27:8 + | +LL | #[deny(this_lint_does_not_exist)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: #[warn(unknown_lints)] on by default + +warning: lint name `test_lint` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore + --> $DIR/lint-tool-test.rs:8:23 + | +LL | #![cfg_attr(foo, warn(test_lint))] + | ^^^^^^^^^ help: change it to: `clippy::test_lint` + +error: item is named 'lintme' + --> $DIR/lint-tool-test.rs:14:1 + | +LL | fn lintme() { } + | ^^^^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/lint-tool-test.rs:11:9 + | +LL | #![deny(clippy_group)] + | ^^^^^^^^^^^^ + = note: #[deny(clippy::test_lint)] implied by #[deny(clippy::group)] + +error: item is named 'lintmetoo' + --> $DIR/lint-tool-test.rs:22:5 + | +LL | fn lintmetoo() { } + | ^^^^^^^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/lint-tool-test.rs:11:9 + | +LL | #![deny(clippy_group)] + | ^^^^^^^^^^^^ + = note: #[deny(clippy::test_group)] implied by #[deny(clippy::group)] + +error: aborting due to 2 previous errors + diff --git a/src/test/ui-fulldeps/lint_tool_cmdline_allow.rs b/src/test/ui-fulldeps/lint_tool_cmdline_allow.rs deleted file mode 100644 index d60f41dd5a3..00000000000 --- a/src/test/ui-fulldeps/lint_tool_cmdline_allow.rs +++ /dev/null @@ -1,13 +0,0 @@ -// run-pass -// aux-build:lint_tool_test.rs -// ignore-stage1 -// compile-flags: -A test-lint - -#![feature(plugin)] -#![warn(unused)] -#![plugin(lint_tool_test)] - -fn lintme() { } - -pub fn main() { -} diff --git a/src/test/ui-fulldeps/lint_tool_cmdline_allow.stderr b/src/test/ui-fulldeps/lint_tool_cmdline_allow.stderr deleted file mode 100644 index 9634f1d572f..00000000000 --- a/src/test/ui-fulldeps/lint_tool_cmdline_allow.stderr +++ /dev/null @@ -1,25 +0,0 @@ -warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint - | - = note: requested on the command line with `-A test_lint` - -warning: item is named 'lintme' - --> $DIR/lint_tool_cmdline_allow.rs:10:1 - | -LL | fn lintme() { } - | ^^^^^^^^^^^^^^^ - | - = note: #[warn(clippy::test_lint)] on by default - -warning: function is never used: `lintme` - --> $DIR/lint_tool_cmdline_allow.rs:10:1 - | -LL | fn lintme() { } - | ^^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/lint_tool_cmdline_allow.rs:7:9 - | -LL | #![warn(unused)] - | ^^^^^^ - = note: #[warn(dead_code)] implied by #[warn(unused)] - diff --git a/src/test/ui-fulldeps/lint_tool_test.rs b/src/test/ui-fulldeps/lint_tool_test.rs deleted file mode 100644 index 04608b62f43..00000000000 --- a/src/test/ui-fulldeps/lint_tool_test.rs +++ /dev/null @@ -1,30 +0,0 @@ -// aux-build:lint_tool_test.rs -// ignore-stage1 -// compile-flags: --cfg foo - -#![feature(plugin)] -#![plugin(lint_tool_test)] -#![allow(dead_code)] -#![cfg_attr(foo, warn(test_lint))] -//~^ WARNING lint name `test_lint` is deprecated and may not have an effect in the future -//~^^ WARNING lint name `test_lint` is deprecated and may not have an effect in the future -#![deny(clippy_group)] -//~^ WARNING lint name `clippy_group` is deprecated and may not have an effect in the future - -fn lintme() { } //~ ERROR item is named 'lintme' - -#[allow(clippy::group)] -fn lintmetoo() {} - -#[allow(clippy::test_lint)] -pub fn main() { - fn lintme() { } - fn lintmetoo() { } //~ ERROR item is named 'lintmetoo' -} - -#[allow(test_group)] -//~^ WARNING lint name `test_group` is deprecated and may not have an effect in the future -#[deny(this_lint_does_not_exist)] //~ WARNING unknown lint: `this_lint_does_not_exist` -fn hello() { - fn lintmetoo() { } -} diff --git a/src/test/ui-fulldeps/lint_tool_test.stderr b/src/test/ui-fulldeps/lint_tool_test.stderr deleted file mode 100644 index cec8800a25c..00000000000 --- a/src/test/ui-fulldeps/lint_tool_test.stderr +++ /dev/null @@ -1,62 +0,0 @@ -warning: lint name `test_lint` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore - --> $DIR/lint_tool_test.rs:8:23 - | -LL | #![cfg_attr(foo, warn(test_lint))] - | ^^^^^^^^^ help: change it to: `clippy::test_lint` - | - = note: #[warn(renamed_and_removed_lints)] on by default - -warning: lint name `clippy_group` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore - --> $DIR/lint_tool_test.rs:11:9 - | -LL | #![deny(clippy_group)] - | ^^^^^^^^^^^^ help: change it to: `clippy::group` - -warning: lint name `test_group` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore - --> $DIR/lint_tool_test.rs:25:9 - | -LL | #[allow(test_group)] - | ^^^^^^^^^^ help: change it to: `clippy::test_group` - -warning: unknown lint: `this_lint_does_not_exist` - --> $DIR/lint_tool_test.rs:27:8 - | -LL | #[deny(this_lint_does_not_exist)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: #[warn(unknown_lints)] on by default - -warning: lint name `test_lint` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore - --> $DIR/lint_tool_test.rs:8:23 - | -LL | #![cfg_attr(foo, warn(test_lint))] - | ^^^^^^^^^ help: change it to: `clippy::test_lint` - -error: item is named 'lintme' - --> $DIR/lint_tool_test.rs:14:1 - | -LL | fn lintme() { } - | ^^^^^^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/lint_tool_test.rs:11:9 - | -LL | #![deny(clippy_group)] - | ^^^^^^^^^^^^ - = note: #[deny(clippy::test_lint)] implied by #[deny(clippy::group)] - -error: item is named 'lintmetoo' - --> $DIR/lint_tool_test.rs:22:5 - | -LL | fn lintmetoo() { } - | ^^^^^^^^^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/lint_tool_test.rs:11:9 - | -LL | #![deny(clippy_group)] - | ^^^^^^^^^^^^ - = note: #[deny(clippy::test_group)] implied by #[deny(clippy::group)] - -error: aborting due to 2 previous errors - diff --git a/src/test/ui-fulldeps/macro-crate-rlib.rs b/src/test/ui-fulldeps/macro-crate-rlib.rs index 21e62171f0f..2962bb51fc4 100644 --- a/src/test/ui-fulldeps/macro-crate-rlib.rs +++ b/src/test/ui-fulldeps/macro-crate-rlib.rs @@ -1,4 +1,4 @@ -// aux-build:rlib_crate_test.rs +// aux-build:rlib-crate-test.rs // ignore-tidy-linelength // ignore-cross-compile gives a different error message diff --git a/src/test/ui-fulldeps/plugin-as-extern-crate.rs b/src/test/ui-fulldeps/plugin-as-extern-crate.rs index 37ac8dfa391..c671ab581ef 100644 --- a/src/test/ui-fulldeps/plugin-as-extern-crate.rs +++ b/src/test/ui-fulldeps/plugin-as-extern-crate.rs @@ -1,4 +1,4 @@ -// aux-build:attr_plugin_test.rs +// aux-build:attr-plugin-test.rs // ignore-cross-compile // // attr_plugin_test will not compile on a cross-compiled target because diff --git a/src/test/ui-fulldeps/plugin-attr-register-deny.rs b/src/test/ui-fulldeps/plugin-attr-register-deny.rs index f9922f7f606..8be73e330ab 100644 --- a/src/test/ui-fulldeps/plugin-attr-register-deny.rs +++ b/src/test/ui-fulldeps/plugin-attr-register-deny.rs @@ -1,4 +1,4 @@ -// aux-build:attr_plugin_test.rs +// aux-build:attr-plugin-test.rs // ignore-stage1 #![feature(plugin)] diff --git a/src/test/ui/auxiliary/default-ty-param-cross-crate-crate.rs b/src/test/ui/auxiliary/default-ty-param-cross-crate-crate.rs new file mode 100644 index 00000000000..612f99dbcf8 --- /dev/null +++ b/src/test/ui/auxiliary/default-ty-param-cross-crate-crate.rs @@ -0,0 +1,10 @@ +#![crate_type = "lib"] +#![crate_name = "default_param_test"] +#![feature(default_type_parameter_fallback)] + +use std::marker::PhantomData; + +pub struct Foo(PhantomData<(A, B)>); + +pub fn bleh() -> Foo { Foo(PhantomData) } + diff --git a/src/test/ui/auxiliary/default_ty_param_cross_crate_crate.rs b/src/test/ui/auxiliary/default_ty_param_cross_crate_crate.rs deleted file mode 100644 index 612f99dbcf8..00000000000 --- a/src/test/ui/auxiliary/default_ty_param_cross_crate_crate.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![crate_type = "lib"] -#![crate_name = "default_param_test"] -#![feature(default_type_parameter_fallback)] - -use std::marker::PhantomData; - -pub struct Foo(PhantomData<(A, B)>); - -pub fn bleh() -> Foo { Foo(PhantomData) } - diff --git a/src/test/ui/auxiliary/define-macro.rs b/src/test/ui/auxiliary/define-macro.rs new file mode 100644 index 00000000000..4956907c55e --- /dev/null +++ b/src/test/ui/auxiliary/define-macro.rs @@ -0,0 +1,6 @@ +#[macro_export] +macro_rules! define_macro { + ($i:ident) => { + macro_rules! $i { () => {} } + } +} diff --git a/src/test/ui/auxiliary/define_macro.rs b/src/test/ui/auxiliary/define_macro.rs deleted file mode 100644 index 4956907c55e..00000000000 --- a/src/test/ui/auxiliary/define_macro.rs +++ /dev/null @@ -1,6 +0,0 @@ -#[macro_export] -macro_rules! define_macro { - ($i:ident) => { - macro_rules! $i { () => {} } - } -} diff --git a/src/test/ui/auxiliary/orphan-check-diagnostics.rs b/src/test/ui/auxiliary/orphan-check-diagnostics.rs new file mode 100644 index 00000000000..6b2c42b69b9 --- /dev/null +++ b/src/test/ui/auxiliary/orphan-check-diagnostics.rs @@ -0,0 +1 @@ +pub trait RemoteTrait { fn dummy(&self) { } } diff --git a/src/test/ui/auxiliary/orphan_check_diagnostics.rs b/src/test/ui/auxiliary/orphan_check_diagnostics.rs deleted file mode 100644 index 6b2c42b69b9..00000000000 --- a/src/test/ui/auxiliary/orphan_check_diagnostics.rs +++ /dev/null @@ -1 +0,0 @@ -pub trait RemoteTrait { fn dummy(&self) { } } diff --git a/src/test/ui/auxiliary/pub-and-stability.rs b/src/test/ui/auxiliary/pub-and-stability.rs new file mode 100644 index 00000000000..ee05a07dbb2 --- /dev/null +++ b/src/test/ui/auxiliary/pub-and-stability.rs @@ -0,0 +1,133 @@ +// This crate attempts to enumerate the various scenarios for how a +// type can define fields and methods with various visibilities and +// stabilities. +// +// The basic stability pattern in this file has four cases: +// 1. no stability attribute at all +// 2. a stable attribute (feature "unit_test") +// 3. an unstable attribute that unit test declares (feature "unstable_declared") +// 4. an unstable attribute that unit test fails to declare (feature "unstable_undeclared") +// +// This file also covers four kinds of visibility: private, +// pub(module), pub(crate), and pub. +// +// However, since stability attributes can only be observed in +// cross-crate linkage scenarios, there is little reason to take the +// cross-product (4 stability cases * 4 visibility cases), because the +// first three visibility cases cannot be accessed outside this crate, +// and therefore stability is only relevant when the visibility is pub +// to the whole universe. +// +// (The only reason to do so would be if one were worried about the +// compiler having some subtle bug where adding a stability attribute +// introduces a privacy violation. As a way to provide evidence that +// this is not occurring, I have put stability attributes on some +// non-pub fields, marked with SILLY below) + +#![feature(staged_api)] + +#![stable(feature = "unit_test", since = "1.0.0")] + +#[stable(feature = "unit_test", since = "1.0.0")] +pub use m::{Record, Trait, Tuple}; + +mod m { + #[derive(Default)] + #[stable(feature = "unit_test", since = "1.0.0")] + pub struct Record { + #[stable(feature = "unit_test", since = "1.0.0")] + pub a_stable_pub: i32, + #[unstable(feature = "unstable_declared", issue = "38412")] + pub a_unstable_declared_pub: i32, + #[unstable(feature = "unstable_undeclared", issue = "38412")] + pub a_unstable_undeclared_pub: i32, + #[unstable(feature = "unstable_undeclared", issue = "38412")] // SILLY + pub(crate) b_crate: i32, + #[unstable(feature = "unstable_declared", issue = "38412")] // SILLY + pub(in m) c_mod: i32, + #[stable(feature = "unit_test", since = "1.0.0")] // SILLY + d_priv: i32 + } + + #[derive(Default)] + #[stable(feature = "unit_test", since = "1.0.0")] + pub struct Tuple( + #[stable(feature = "unit_test", since = "1.0.0")] + pub i32, + #[unstable(feature = "unstable_declared", issue = "38412")] + pub i32, + #[unstable(feature = "unstable_undeclared", issue = "38412")] + pub i32, + + pub(crate) i32, + pub(in m) i32, + i32); + + impl Record { + #[stable(feature = "unit_test", since = "1.0.0")] + pub fn new() -> Self { Default::default() } + } + + impl Tuple { + #[stable(feature = "unit_test", since = "1.0.0")] + pub fn new() -> Self { Default::default() } + } + + + #[stable(feature = "unit_test", since = "1.0.0")] + pub trait Trait { + #[stable(feature = "unit_test", since = "1.0.0")] + type Type; + #[stable(feature = "unit_test", since = "1.0.0")] + fn stable_trait_method(&self) -> Self::Type; + #[unstable(feature = "unstable_undeclared", issue = "38412")] + fn unstable_undeclared_trait_method(&self) -> Self::Type; + #[unstable(feature = "unstable_declared", issue = "38412")] + fn unstable_declared_trait_method(&self) -> Self::Type; + } + + #[stable(feature = "unit_test", since = "1.0.0")] + impl Trait for Record { + type Type = i32; + fn stable_trait_method(&self) -> i32 { self.d_priv } + fn unstable_undeclared_trait_method(&self) -> i32 { self.d_priv } + fn unstable_declared_trait_method(&self) -> i32 { self.d_priv } + } + + #[stable(feature = "unit_test", since = "1.0.0")] + impl Trait for Tuple { + type Type = i32; + fn stable_trait_method(&self) -> i32 { self.3 } + fn unstable_undeclared_trait_method(&self) -> i32 { self.3 } + fn unstable_declared_trait_method(&self) -> i32 { self.3 } + } + + impl Record { + #[unstable(feature = "unstable_undeclared", issue = "38412")] + pub fn unstable_undeclared(&self) -> i32 { self.d_priv } + #[unstable(feature = "unstable_declared", issue = "38412")] + pub fn unstable_declared(&self) -> i32 { self.d_priv } + #[stable(feature = "unit_test", since = "1.0.0")] + pub fn stable(&self) -> i32 { self.d_priv } + + #[unstable(feature = "unstable_undeclared", issue = "38412")] // SILLY + pub(crate) fn pub_crate(&self) -> i32 { self.d_priv } + #[unstable(feature = "unstable_declared", issue = "38412")] // SILLY + pub(in m) fn pub_mod(&self) -> i32 { self.d_priv } + #[stable(feature = "unit_test", since = "1.0.0")] // SILLY + fn private(&self) -> i32 { self.d_priv } + } + + impl Tuple { + #[unstable(feature = "unstable_undeclared", issue = "38412")] + pub fn unstable_undeclared(&self) -> i32 { self.0 } + #[unstable(feature = "unstable_declared", issue = "38412")] + pub fn unstable_declared(&self) -> i32 { self.0 } + #[stable(feature = "unit_test", since = "1.0.0")] + pub fn stable(&self) -> i32 { self.0 } + + pub(crate) fn pub_crate(&self) -> i32 { self.0 } + pub(in m) fn pub_mod(&self) -> i32 { self.0 } + fn private(&self) -> i32 { self.0 } + } +} diff --git a/src/test/ui/auxiliary/pub_and_stability.rs b/src/test/ui/auxiliary/pub_and_stability.rs deleted file mode 100644 index ee05a07dbb2..00000000000 --- a/src/test/ui/auxiliary/pub_and_stability.rs +++ /dev/null @@ -1,133 +0,0 @@ -// This crate attempts to enumerate the various scenarios for how a -// type can define fields and methods with various visibilities and -// stabilities. -// -// The basic stability pattern in this file has four cases: -// 1. no stability attribute at all -// 2. a stable attribute (feature "unit_test") -// 3. an unstable attribute that unit test declares (feature "unstable_declared") -// 4. an unstable attribute that unit test fails to declare (feature "unstable_undeclared") -// -// This file also covers four kinds of visibility: private, -// pub(module), pub(crate), and pub. -// -// However, since stability attributes can only be observed in -// cross-crate linkage scenarios, there is little reason to take the -// cross-product (4 stability cases * 4 visibility cases), because the -// first three visibility cases cannot be accessed outside this crate, -// and therefore stability is only relevant when the visibility is pub -// to the whole universe. -// -// (The only reason to do so would be if one were worried about the -// compiler having some subtle bug where adding a stability attribute -// introduces a privacy violation. As a way to provide evidence that -// this is not occurring, I have put stability attributes on some -// non-pub fields, marked with SILLY below) - -#![feature(staged_api)] - -#![stable(feature = "unit_test", since = "1.0.0")] - -#[stable(feature = "unit_test", since = "1.0.0")] -pub use m::{Record, Trait, Tuple}; - -mod m { - #[derive(Default)] - #[stable(feature = "unit_test", since = "1.0.0")] - pub struct Record { - #[stable(feature = "unit_test", since = "1.0.0")] - pub a_stable_pub: i32, - #[unstable(feature = "unstable_declared", issue = "38412")] - pub a_unstable_declared_pub: i32, - #[unstable(feature = "unstable_undeclared", issue = "38412")] - pub a_unstable_undeclared_pub: i32, - #[unstable(feature = "unstable_undeclared", issue = "38412")] // SILLY - pub(crate) b_crate: i32, - #[unstable(feature = "unstable_declared", issue = "38412")] // SILLY - pub(in m) c_mod: i32, - #[stable(feature = "unit_test", since = "1.0.0")] // SILLY - d_priv: i32 - } - - #[derive(Default)] - #[stable(feature = "unit_test", since = "1.0.0")] - pub struct Tuple( - #[stable(feature = "unit_test", since = "1.0.0")] - pub i32, - #[unstable(feature = "unstable_declared", issue = "38412")] - pub i32, - #[unstable(feature = "unstable_undeclared", issue = "38412")] - pub i32, - - pub(crate) i32, - pub(in m) i32, - i32); - - impl Record { - #[stable(feature = "unit_test", since = "1.0.0")] - pub fn new() -> Self { Default::default() } - } - - impl Tuple { - #[stable(feature = "unit_test", since = "1.0.0")] - pub fn new() -> Self { Default::default() } - } - - - #[stable(feature = "unit_test", since = "1.0.0")] - pub trait Trait { - #[stable(feature = "unit_test", since = "1.0.0")] - type Type; - #[stable(feature = "unit_test", since = "1.0.0")] - fn stable_trait_method(&self) -> Self::Type; - #[unstable(feature = "unstable_undeclared", issue = "38412")] - fn unstable_undeclared_trait_method(&self) -> Self::Type; - #[unstable(feature = "unstable_declared", issue = "38412")] - fn unstable_declared_trait_method(&self) -> Self::Type; - } - - #[stable(feature = "unit_test", since = "1.0.0")] - impl Trait for Record { - type Type = i32; - fn stable_trait_method(&self) -> i32 { self.d_priv } - fn unstable_undeclared_trait_method(&self) -> i32 { self.d_priv } - fn unstable_declared_trait_method(&self) -> i32 { self.d_priv } - } - - #[stable(feature = "unit_test", since = "1.0.0")] - impl Trait for Tuple { - type Type = i32; - fn stable_trait_method(&self) -> i32 { self.3 } - fn unstable_undeclared_trait_method(&self) -> i32 { self.3 } - fn unstable_declared_trait_method(&self) -> i32 { self.3 } - } - - impl Record { - #[unstable(feature = "unstable_undeclared", issue = "38412")] - pub fn unstable_undeclared(&self) -> i32 { self.d_priv } - #[unstable(feature = "unstable_declared", issue = "38412")] - pub fn unstable_declared(&self) -> i32 { self.d_priv } - #[stable(feature = "unit_test", since = "1.0.0")] - pub fn stable(&self) -> i32 { self.d_priv } - - #[unstable(feature = "unstable_undeclared", issue = "38412")] // SILLY - pub(crate) fn pub_crate(&self) -> i32 { self.d_priv } - #[unstable(feature = "unstable_declared", issue = "38412")] // SILLY - pub(in m) fn pub_mod(&self) -> i32 { self.d_priv } - #[stable(feature = "unit_test", since = "1.0.0")] // SILLY - fn private(&self) -> i32 { self.d_priv } - } - - impl Tuple { - #[unstable(feature = "unstable_undeclared", issue = "38412")] - pub fn unstable_undeclared(&self) -> i32 { self.0 } - #[unstable(feature = "unstable_declared", issue = "38412")] - pub fn unstable_declared(&self) -> i32 { self.0 } - #[stable(feature = "unit_test", since = "1.0.0")] - pub fn stable(&self) -> i32 { self.0 } - - pub(crate) fn pub_crate(&self) -> i32 { self.0 } - pub(in m) fn pub_mod(&self) -> i32 { self.0 } - fn private(&self) -> i32 { self.0 } - } -} diff --git a/src/test/ui/auxiliary/rmeta-meta.rs b/src/test/ui/auxiliary/rmeta-meta.rs new file mode 100644 index 00000000000..6d8ed95bd38 --- /dev/null +++ b/src/test/ui/auxiliary/rmeta-meta.rs @@ -0,0 +1,8 @@ +// no-prefer-dynamic +// compile-flags: --emit=metadata + +#![crate_type="rlib"] + +pub struct Foo { + pub field: i32, +} diff --git a/src/test/ui/auxiliary/rmeta-rlib.rs b/src/test/ui/auxiliary/rmeta-rlib.rs new file mode 100644 index 00000000000..4a05710db66 --- /dev/null +++ b/src/test/ui/auxiliary/rmeta-rlib.rs @@ -0,0 +1,5 @@ +#![crate_type="rlib"] + +pub struct Foo { + pub field: i32, +} diff --git a/src/test/ui/auxiliary/rmeta_meta.rs b/src/test/ui/auxiliary/rmeta_meta.rs deleted file mode 100644 index 6d8ed95bd38..00000000000 --- a/src/test/ui/auxiliary/rmeta_meta.rs +++ /dev/null @@ -1,8 +0,0 @@ -// no-prefer-dynamic -// compile-flags: --emit=metadata - -#![crate_type="rlib"] - -pub struct Foo { - pub field: i32, -} diff --git a/src/test/ui/auxiliary/rmeta_rlib.rs b/src/test/ui/auxiliary/rmeta_rlib.rs deleted file mode 100644 index 4a05710db66..00000000000 --- a/src/test/ui/auxiliary/rmeta_rlib.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![crate_type="rlib"] - -pub struct Foo { - pub field: i32, -} diff --git a/src/test/ui/auxiliary/stability-cfg2.rs b/src/test/ui/auxiliary/stability-cfg2.rs new file mode 100644 index 00000000000..8a2899584b9 --- /dev/null +++ b/src/test/ui/auxiliary/stability-cfg2.rs @@ -0,0 +1,5 @@ +// compile-flags:--cfg foo + +#![cfg_attr(foo, unstable(feature = "unstable_test_feature", issue = "0"))] +#![cfg_attr(not(foo), stable(feature = "test_feature", since = "1.0.0"))] +#![feature(staged_api)] diff --git a/src/test/ui/auxiliary/stability_cfg2.rs b/src/test/ui/auxiliary/stability_cfg2.rs deleted file mode 100644 index 8a2899584b9..00000000000 --- a/src/test/ui/auxiliary/stability_cfg2.rs +++ /dev/null @@ -1,5 +0,0 @@ -// compile-flags:--cfg foo - -#![cfg_attr(foo, unstable(feature = "unstable_test_feature", issue = "0"))] -#![cfg_attr(not(foo), stable(feature = "test_feature", since = "1.0.0"))] -#![feature(staged_api)] diff --git a/src/test/ui/auxiliary/use_from_trait_xc.rs b/src/test/ui/auxiliary/use_from_trait_xc.rs deleted file mode 100644 index 4abe11941b1..00000000000 --- a/src/test/ui/auxiliary/use_from_trait_xc.rs +++ /dev/null @@ -1,29 +0,0 @@ -pub use self::sub::{Bar, Baz}; - -pub trait Trait { - fn foo(&self); - type Assoc; - const CONST: u32; -} - -struct Foo; - -impl Foo { - pub fn new() {} - - pub const C: u32 = 0; -} - -mod sub { - pub struct Bar; - - impl Bar { - pub fn new() {} - } - - pub enum Baz {} - - impl Baz { - pub fn new() {} - } -} diff --git a/src/test/ui/auxiliary/xc-private-method-lib.rs b/src/test/ui/auxiliary/xc-private-method-lib.rs new file mode 100644 index 00000000000..4d5ec6de392 --- /dev/null +++ b/src/test/ui/auxiliary/xc-private-method-lib.rs @@ -0,0 +1,33 @@ +#![crate_type="lib"] + +pub struct Struct { + pub x: isize +} + +impl Struct { + fn static_meth_struct() -> Struct { + Struct { x: 1 } + } + + fn meth_struct(&self) -> isize { + self.x + } +} + +pub enum Enum { + Variant1(isize), + Variant2(isize) +} + +impl Enum { + fn static_meth_enum() -> Enum { + Enum::Variant2(10) + } + + fn meth_enum(&self) -> isize { + match *self { + Enum::Variant1(x) | + Enum::Variant2(x) => x + } + } +} diff --git a/src/test/ui/auxiliary/xc_private_method_lib.rs b/src/test/ui/auxiliary/xc_private_method_lib.rs deleted file mode 100644 index 4d5ec6de392..00000000000 --- a/src/test/ui/auxiliary/xc_private_method_lib.rs +++ /dev/null @@ -1,33 +0,0 @@ -#![crate_type="lib"] - -pub struct Struct { - pub x: isize -} - -impl Struct { - fn static_meth_struct() -> Struct { - Struct { x: 1 } - } - - fn meth_struct(&self) -> isize { - self.x - } -} - -pub enum Enum { - Variant1(isize), - Variant2(isize) -} - -impl Enum { - fn static_meth_enum() -> Enum { - Enum::Variant2(10) - } - - fn meth_enum(&self) -> isize { - match *self { - Enum::Variant1(x) | - Enum::Variant2(x) => x - } - } -} diff --git a/src/test/ui/e0119/auxiliary/issue-23563-a.rs b/src/test/ui/e0119/auxiliary/issue-23563-a.rs new file mode 100644 index 00000000000..4e85bcc4ba6 --- /dev/null +++ b/src/test/ui/e0119/auxiliary/issue-23563-a.rs @@ -0,0 +1,25 @@ +// Ref: https://github.com/rust-lang/rust/issues/23563#issuecomment-260751672 + +pub trait LolTo { + fn convert_to(&self) -> T; +} + +pub trait LolInto: Sized { + fn convert_into(self) -> T; +} + +pub trait LolFrom { + fn from(T) -> Self; +} + +impl<'a, T: ?Sized, U> LolInto for &'a T where T: LolTo { + fn convert_into(self) -> U { + self.convert_to() + } +} + +impl LolFrom for U where T: LolInto { + fn from(t: T) -> U { + t.convert_into() + } +} diff --git a/src/test/ui/e0119/auxiliary/issue_23563_a.rs b/src/test/ui/e0119/auxiliary/issue_23563_a.rs deleted file mode 100644 index 4e85bcc4ba6..00000000000 --- a/src/test/ui/e0119/auxiliary/issue_23563_a.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Ref: https://github.com/rust-lang/rust/issues/23563#issuecomment-260751672 - -pub trait LolTo { - fn convert_to(&self) -> T; -} - -pub trait LolInto: Sized { - fn convert_into(self) -> T; -} - -pub trait LolFrom { - fn from(T) -> Self; -} - -impl<'a, T: ?Sized, U> LolInto for &'a T where T: LolTo { - fn convert_into(self) -> U { - self.convert_to() - } -} - -impl LolFrom for U where T: LolInto { - fn from(t: T) -> U { - t.convert_into() - } -} diff --git a/src/test/ui/e0119/issue-23563.rs b/src/test/ui/e0119/issue-23563.rs index a2804fcf1cc..f578560c552 100644 --- a/src/test/ui/e0119/issue-23563.rs +++ b/src/test/ui/e0119/issue-23563.rs @@ -1,4 +1,4 @@ -// aux-build:issue_23563_a.rs +// aux-build:issue-23563-a.rs // Ref: https://github.com/rust-lang/rust/issues/23563#issuecomment-260751672 diff --git a/src/test/ui/enable-unstable-lib-feature.rs b/src/test/ui/enable-unstable-lib-feature.rs index 2f248bf14c1..383c6868ce2 100644 --- a/src/test/ui/enable-unstable-lib-feature.rs +++ b/src/test/ui/enable-unstable-lib-feature.rs @@ -1,6 +1,6 @@ // Test that enabling an unstable feature disables warnings -// aux-build:stability_cfg2.rs +// aux-build:stability-cfg2.rs #![feature(unstable_test_feature)] #![deny(non_snake_case)] // To trigger a hard error diff --git a/src/test/ui/explore-issue-38412.rs b/src/test/ui/explore-issue-38412.rs index cd0a69b0d8b..e7bcd7c6bfe 100644 --- a/src/test/ui/explore-issue-38412.rs +++ b/src/test/ui/explore-issue-38412.rs @@ -1,4 +1,4 @@ -// aux-build:pub_and_stability.rs +// aux-build:pub-and-stability.rs #![feature(unused_feature)] @@ -63,5 +63,4 @@ fn main() { t.pub_crate(); //~ ERROR `pub_crate` is private t.pub_mod(); //~ ERROR `pub_mod` is private t.private(); //~ ERROR `private` is private - } diff --git a/src/test/ui/issue-18986.rs b/src/test/ui/issue-18986.rs deleted file mode 100644 index 1c431a45ab2..00000000000 --- a/src/test/ui/issue-18986.rs +++ /dev/null @@ -1,10 +0,0 @@ -// aux-build:use_from_trait_xc.rs - -extern crate use_from_trait_xc; -pub use use_from_trait_xc::Trait; - -fn main() { - match () { - Trait { x: 42 } => () //~ ERROR expected struct, variant or union type, found trait `Trait` - } -} diff --git a/src/test/ui/issue-18986.stderr b/src/test/ui/issue-18986.stderr deleted file mode 100644 index 6c23178c700..00000000000 --- a/src/test/ui/issue-18986.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0574]: expected struct, variant or union type, found trait `Trait` - --> $DIR/issue-18986.rs:8:9 - | -LL | Trait { x: 42 } => () - | ^^^^^ not a struct, variant or union type - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0574`. diff --git a/src/test/ui/issue-42944.rs b/src/test/ui/issue-42944.rs deleted file mode 100644 index 9d746673f4d..00000000000 --- a/src/test/ui/issue-42944.rs +++ /dev/null @@ -1,19 +0,0 @@ -mod foo { - pub struct B(()); -} - -mod bar { - use foo::B; - - fn foo() { - B(()); //~ ERROR expected function, found struct `B` [E0423] - } -} - -mod baz { - fn foo() { - B(()); //~ ERROR cannot find function `B` in this scope [E0425] - } -} - -fn main() {} diff --git a/src/test/ui/issue-42944.stderr b/src/test/ui/issue-42944.stderr deleted file mode 100644 index 0613be0b3d0..00000000000 --- a/src/test/ui/issue-42944.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0423]: expected function, found struct `B` - --> $DIR/issue-42944.rs:9:9 - | -LL | B(()); - | ^ constructor is not visible here due to private fields - -error[E0425]: cannot find function `B` in this scope - --> $DIR/issue-42944.rs:15:9 - | -LL | B(()); - | ^ not found in this scope -help: possible candidate is found in another module, you can import it into scope - | -LL | use foo::B; - | - -error: aborting due to 2 previous errors - -Some errors occurred: E0423, E0425. -For more information about an error, try `rustc --explain E0423`. diff --git a/src/test/ui/issue-53787-inline-assembler-macro.rs b/src/test/ui/issue-53787-inline-assembler-macro.rs deleted file mode 100644 index 937bce1b655..00000000000 --- a/src/test/ui/issue-53787-inline-assembler-macro.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Regression test for Issue #53787: Fix ICE when creating a label in inline assembler with macros. - -#![feature(asm)] - -macro_rules! fake_jump { - ($id:expr) => { - unsafe { - 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/issue-53787-inline-assembler-macro.stderr b/src/test/ui/issue-53787-inline-assembler-macro.stderr deleted file mode 100644 index 047ba341cfc..00000000000 --- a/src/test/ui/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:21: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/issue-54943-1.rs b/src/test/ui/issue-54943-1.rs deleted file mode 100644 index 7750e340361..00000000000 --- a/src/test/ui/issue-54943-1.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![feature(nll)] - -// This test is a minimal version of an ICE in the dropck-eyepatch tests -// found in the fix for #54943. - -// compile-pass - -fn foo(_t: T) { -} - -fn main() { - struct A<'a, B: 'a>(&'a B); - let (a1, a2): (String, A<_>) = (String::from("auto"), A(&"this")); - foo((a1, a2)); -} diff --git a/src/test/ui/issue-54943-2.rs b/src/test/ui/issue-54943-2.rs deleted file mode 100644 index f829c38c35d..00000000000 --- a/src/test/ui/issue-54943-2.rs +++ /dev/null @@ -1,18 +0,0 @@ -#![feature(nll)] - -// This test is a minimal version of an ICE in the dropck-eyepatch tests -// found in the fix for #54943. In particular, this test is in unreachable -// code as the initial fix for this ICE only worked if the code was reachable. - -// compile-pass - -fn foo(_t: T) { -} - -fn main() { - return; - - struct A<'a, B: 'a>(&'a B); - let (a1, a2): (String, A<_>) = (String::from("auto"), A(&"this")); - foo((a1, a2)); -} diff --git a/src/test/ui/issue-54943-3.rs b/src/test/ui/issue-54943-3.rs deleted file mode 100644 index 185077bd684..00000000000 --- a/src/test/ui/issue-54943-3.rs +++ /dev/null @@ -1,21 +0,0 @@ -// compile-pass -// FIXME(#54943) This test targets the scenario where proving the WF requirements requires -// knowing the value of the `_` type present in the user type annotation - unfortunately, figuring -// out the value of that `_` requires type-checking the surrounding code, but that code is dead, -// so our NLL region checker doesn't have access to it. This test should actually fail to compile. - -#![feature(nll)] -#![allow(warnings)] - -use std::fmt::Debug; - -fn foo(_: T) { } - -fn bar<'a>() { - return; - - let _x = foo::>(Vec::<&'a u32>::new()); - //~^ ERROR the type `&'a u32` does not fulfill the required lifetime [E0477] -} - -fn main() {} diff --git a/src/test/ui/issue-54943.rs b/src/test/ui/issue-54943.rs deleted file mode 100644 index ce4e0106743..00000000000 --- a/src/test/ui/issue-54943.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![feature(nll)] -#![allow(warnings)] - -fn foo() { } - -fn boo<'a>() { - return; - - let x = foo::<&'a u32>(); - //~^ ERROR lifetime may not live long enough -} - -fn main() {} diff --git a/src/test/ui/issue-54943.stderr b/src/test/ui/issue-54943.stderr deleted file mode 100644 index aa68177bcdb..00000000000 --- a/src/test/ui/issue-54943.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/issue-54943.rs:9:13 - | -LL | fn boo<'a>() { - | -- lifetime `'a` defined here -... -LL | let x = foo::<&'a u32>(); - | ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` - -error: aborting due to previous error - diff --git a/src/test/ui/issue-55511.nll.stderr b/src/test/ui/issue-55511.nll.stderr deleted file mode 100644 index bf3e58e8cdb..00000000000 --- a/src/test/ui/issue-55511.nll.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0597]: `a` does not live long enough - --> $DIR/issue-55511.rs:13:28 - | -LL | let b = Some(Cell::new(&a)); - | ^^ borrowed value does not live long enough -... -LL | <() as Foo<'static>>::C => { } - | ----------------------- type annotation requires that `a` is borrowed for `'static` -... -LL | } - | - `a` 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/issue-55511.rs b/src/test/ui/issue-55511.rs deleted file mode 100644 index 4b9475ba627..00000000000 --- a/src/test/ui/issue-55511.rs +++ /dev/null @@ -1,19 +0,0 @@ -use std::cell::Cell; - -trait Foo<'a> { - const C: Option>; -} - -impl<'a, T> Foo<'a> for T { - const C: Option> = None; -} - -fn main() { - let a = 22; - let b = Some(Cell::new(&a)); - //~^ ERROR `a` does not live long enough [E0597] - match b { - <() as Foo<'static>>::C => { } - _ => { } - } -} diff --git a/src/test/ui/issue-55511.stderr b/src/test/ui/issue-55511.stderr deleted file mode 100644 index 24668f04551..00000000000 --- a/src/test/ui/issue-55511.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0597]: `a` does not live long enough - --> $DIR/issue-55511.rs:13:29 - | -LL | let b = Some(Cell::new(&a)); - | ^ borrowed value does not live long enough -... -LL | } - | - borrowed value only lives until here - | - = note: borrowed value must be valid for the static lifetime... - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/issue-55846.rs b/src/test/ui/issue-55846.rs deleted file mode 100644 index bd766752360..00000000000 --- a/src/test/ui/issue-55846.rs +++ /dev/null @@ -1,39 +0,0 @@ -// run-pass - -// Regression test for #55846, which once caused an ICE. - -use std::marker::PhantomData; - -struct Foo; - -struct Bar { - a: PhantomData, -} - -impl Fooifier for Foo { - type Assoc = Foo; -} - -trait Fooifier { - type Assoc; -} - -trait Barifier { - fn barify(); -} - -impl Barifier for Bar { - fn barify() { - println!("All correct!"); - } -} - -impl Bar<::Assoc> { - fn this_shouldnt_crash() { - ::Assoc>>::barify(); - } -} - -fn main() { - Bar::::this_shouldnt_crash(); -} diff --git a/src/test/ui/issues/issue-42944.rs b/src/test/ui/issues/issue-42944.rs new file mode 100644 index 00000000000..9d746673f4d --- /dev/null +++ b/src/test/ui/issues/issue-42944.rs @@ -0,0 +1,19 @@ +mod foo { + pub struct B(()); +} + +mod bar { + use foo::B; + + fn foo() { + B(()); //~ ERROR expected function, found struct `B` [E0423] + } +} + +mod baz { + fn foo() { + B(()); //~ ERROR cannot find function `B` in this scope [E0425] + } +} + +fn main() {} diff --git a/src/test/ui/issues/issue-42944.stderr b/src/test/ui/issues/issue-42944.stderr new file mode 100644 index 00000000000..0613be0b3d0 --- /dev/null +++ b/src/test/ui/issues/issue-42944.stderr @@ -0,0 +1,20 @@ +error[E0423]: expected function, found struct `B` + --> $DIR/issue-42944.rs:9:9 + | +LL | B(()); + | ^ constructor is not visible here due to private fields + +error[E0425]: cannot find function `B` in this scope + --> $DIR/issue-42944.rs:15:9 + | +LL | B(()); + | ^ not found in this scope +help: possible candidate is found in another module, you can import it into scope + | +LL | use foo::B; + | + +error: aborting due to 2 previous errors + +Some errors occurred: E0423, E0425. +For more information about an error, try `rustc --explain E0423`. diff --git a/src/test/ui/issues/issue-53787-inline-assembler-macro.rs b/src/test/ui/issues/issue-53787-inline-assembler-macro.rs new file mode 100644 index 00000000000..937bce1b655 --- /dev/null +++ b/src/test/ui/issues/issue-53787-inline-assembler-macro.rs @@ -0,0 +1,23 @@ +// Regression test for Issue #53787: Fix ICE when creating a label in inline assembler with macros. + +#![feature(asm)] + +macro_rules! fake_jump { + ($id:expr) => { + unsafe { + 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 new file mode 100644 index 00000000000..047ba341cfc --- /dev/null +++ b/src/test/ui/issues/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:21: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-54943-1.rs b/src/test/ui/issues/issue-54943-1.rs new file mode 100644 index 00000000000..7750e340361 --- /dev/null +++ b/src/test/ui/issues/issue-54943-1.rs @@ -0,0 +1,15 @@ +#![feature(nll)] + +// This test is a minimal version of an ICE in the dropck-eyepatch tests +// found in the fix for #54943. + +// compile-pass + +fn foo(_t: T) { +} + +fn main() { + struct A<'a, B: 'a>(&'a B); + let (a1, a2): (String, A<_>) = (String::from("auto"), A(&"this")); + foo((a1, a2)); +} diff --git a/src/test/ui/issues/issue-54943-2.rs b/src/test/ui/issues/issue-54943-2.rs new file mode 100644 index 00000000000..f829c38c35d --- /dev/null +++ b/src/test/ui/issues/issue-54943-2.rs @@ -0,0 +1,18 @@ +#![feature(nll)] + +// This test is a minimal version of an ICE in the dropck-eyepatch tests +// found in the fix for #54943. In particular, this test is in unreachable +// code as the initial fix for this ICE only worked if the code was reachable. + +// compile-pass + +fn foo(_t: T) { +} + +fn main() { + return; + + struct A<'a, B: 'a>(&'a B); + let (a1, a2): (String, A<_>) = (String::from("auto"), A(&"this")); + foo((a1, a2)); +} diff --git a/src/test/ui/issues/issue-54943-3.rs b/src/test/ui/issues/issue-54943-3.rs new file mode 100644 index 00000000000..185077bd684 --- /dev/null +++ b/src/test/ui/issues/issue-54943-3.rs @@ -0,0 +1,21 @@ +// compile-pass +// FIXME(#54943) This test targets the scenario where proving the WF requirements requires +// knowing the value of the `_` type present in the user type annotation - unfortunately, figuring +// out the value of that `_` requires type-checking the surrounding code, but that code is dead, +// so our NLL region checker doesn't have access to it. This test should actually fail to compile. + +#![feature(nll)] +#![allow(warnings)] + +use std::fmt::Debug; + +fn foo(_: T) { } + +fn bar<'a>() { + return; + + let _x = foo::>(Vec::<&'a u32>::new()); + //~^ ERROR the type `&'a u32` does not fulfill the required lifetime [E0477] +} + +fn main() {} diff --git a/src/test/ui/issues/issue-54943.rs b/src/test/ui/issues/issue-54943.rs new file mode 100644 index 00000000000..ce4e0106743 --- /dev/null +++ b/src/test/ui/issues/issue-54943.rs @@ -0,0 +1,13 @@ +#![feature(nll)] +#![allow(warnings)] + +fn foo() { } + +fn boo<'a>() { + return; + + let x = foo::<&'a u32>(); + //~^ ERROR lifetime may not live long enough +} + +fn main() {} diff --git a/src/test/ui/issues/issue-54943.stderr b/src/test/ui/issues/issue-54943.stderr new file mode 100644 index 00000000000..aa68177bcdb --- /dev/null +++ b/src/test/ui/issues/issue-54943.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/issue-54943.rs:9:13 + | +LL | fn boo<'a>() { + | -- lifetime `'a` defined here +... +LL | let x = foo::<&'a u32>(); + | ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-55511.nll.stderr b/src/test/ui/issues/issue-55511.nll.stderr new file mode 100644 index 00000000000..bf3e58e8cdb --- /dev/null +++ b/src/test/ui/issues/issue-55511.nll.stderr @@ -0,0 +1,15 @@ +error[E0597]: `a` does not live long enough + --> $DIR/issue-55511.rs:13:28 + | +LL | let b = Some(Cell::new(&a)); + | ^^ borrowed value does not live long enough +... +LL | <() as Foo<'static>>::C => { } + | ----------------------- type annotation requires that `a` is borrowed for `'static` +... +LL | } + | - `a` 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-55511.rs b/src/test/ui/issues/issue-55511.rs new file mode 100644 index 00000000000..4b9475ba627 --- /dev/null +++ b/src/test/ui/issues/issue-55511.rs @@ -0,0 +1,19 @@ +use std::cell::Cell; + +trait Foo<'a> { + const C: Option>; +} + +impl<'a, T> Foo<'a> for T { + const C: Option> = None; +} + +fn main() { + let a = 22; + let b = Some(Cell::new(&a)); + //~^ ERROR `a` does not live long enough [E0597] + match b { + <() as Foo<'static>>::C => { } + _ => { } + } +} diff --git a/src/test/ui/issues/issue-55511.stderr b/src/test/ui/issues/issue-55511.stderr new file mode 100644 index 00000000000..24668f04551 --- /dev/null +++ b/src/test/ui/issues/issue-55511.stderr @@ -0,0 +1,14 @@ +error[E0597]: `a` does not live long enough + --> $DIR/issue-55511.rs:13:29 + | +LL | let b = Some(Cell::new(&a)); + | ^ borrowed value does not live long enough +... +LL | } + | - borrowed value only lives until here + | + = note: borrowed value must be valid for the static lifetime... + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/issues/issue-55846.rs b/src/test/ui/issues/issue-55846.rs new file mode 100644 index 00000000000..bd766752360 --- /dev/null +++ b/src/test/ui/issues/issue-55846.rs @@ -0,0 +1,39 @@ +// run-pass + +// Regression test for #55846, which once caused an ICE. + +use std::marker::PhantomData; + +struct Foo; + +struct Bar { + a: PhantomData, +} + +impl Fooifier for Foo { + type Assoc = Foo; +} + +trait Fooifier { + type Assoc; +} + +trait Barifier { + fn barify(); +} + +impl Barifier for Bar { + fn barify() { + println!("All correct!"); + } +} + +impl Bar<::Assoc> { + fn this_shouldnt_crash() { + ::Assoc>>::barify(); + } +} + +fn main() { + Bar::::this_shouldnt_crash(); +} diff --git a/src/test/ui/issues/issue-56411-aux.rs b/src/test/ui/issues/issue-56411-aux.rs new file mode 100644 index 00000000000..bd689e913ab --- /dev/null +++ b/src/test/ui/issues/issue-56411-aux.rs @@ -0,0 +1,5 @@ +// compile-pass + +struct T {} + +fn main() {} diff --git a/src/test/ui/issues/issue-56411.rs b/src/test/ui/issues/issue-56411.rs index 3561c21cc7e..163651a7ef6 100644 --- a/src/test/ui/issues/issue-56411.rs +++ b/src/test/ui/issues/issue-56411.rs @@ -1,6 +1,7 @@ macro_rules! import { - ( $($name:ident),* ) => { + ( $(($path:expr, $name:ident)),* ) => { $( + #[path = $path] mod $name; pub use self::$name; //~^ ERROR the name `issue_56411_aux` is defined multiple times @@ -10,7 +11,7 @@ macro_rules! import { } } -import!(issue_56411_aux); +import!(("issue-56411-aux.rs", issue_56411_aux)); fn main() { println!("Hello, world!"); diff --git a/src/test/ui/issues/issue-56411.stderr b/src/test/ui/issues/issue-56411.stderr index dd05852c091..7b23b3766be 100644 --- a/src/test/ui/issues/issue-56411.stderr +++ b/src/test/ui/issues/issue-56411.stderr @@ -1,5 +1,5 @@ error[E0255]: the name `issue_56411_aux` is defined multiple times - --> $DIR/issue-56411.rs:5:21 + --> $DIR/issue-56411.rs:6:21 | LL | mod $name; | ---------- previous definition of the module `issue_56411_aux` here @@ -9,19 +9,19 @@ LL | pub use self::$name; | `issue_56411_aux` reimported here | you can use `as` to change the binding name of the import ... -LL | import!(issue_56411_aux); - | ------------------------- in this macro invocation +LL | import!(("issue-56411-aux.rs", issue_56411_aux)); + | ------------------------------------------------- in this macro invocation | = note: `issue_56411_aux` must be defined only once in the type namespace of this module error[E0365]: `issue_56411_aux` is private, and cannot be re-exported - --> $DIR/issue-56411.rs:5:21 + --> $DIR/issue-56411.rs:6:21 | LL | pub use self::$name; | ^^^^^^^^^^^ re-export of private `issue_56411_aux` ... -LL | import!(issue_56411_aux); - | ------------------------- in this macro invocation +LL | import!(("issue-56411-aux.rs", issue_56411_aux)); + | ------------------------------------------------- in this macro invocation | = note: consider declaring type or module `issue_56411_aux` with `pub` diff --git a/src/test/ui/issues/issue_56411_aux.rs b/src/test/ui/issues/issue_56411_aux.rs deleted file mode 100644 index bd689e913ab..00000000000 --- a/src/test/ui/issues/issue_56411_aux.rs +++ /dev/null @@ -1,5 +0,0 @@ -// compile-pass - -struct T {} - -fn main() {} diff --git a/src/test/ui/lint/auxiliary/stability-cfg2.rs b/src/test/ui/lint/auxiliary/stability-cfg2.rs new file mode 100644 index 00000000000..8a2899584b9 --- /dev/null +++ b/src/test/ui/lint/auxiliary/stability-cfg2.rs @@ -0,0 +1,5 @@ +// compile-flags:--cfg foo + +#![cfg_attr(foo, unstable(feature = "unstable_test_feature", issue = "0"))] +#![cfg_attr(not(foo), stable(feature = "test_feature", since = "1.0.0"))] +#![feature(staged_api)] diff --git a/src/test/ui/lint/lint-stability-deprecated.rs b/src/test/ui/lint/lint-stability-deprecated.rs index 8f6425bcc77..bf574d7144d 100644 --- a/src/test/ui/lint/lint-stability-deprecated.rs +++ b/src/test/ui/lint/lint-stability-deprecated.rs @@ -2,7 +2,7 @@ // aux-build:lint_stability.rs // aux-build:inherited_stability.rs // aux-build:stability_cfg1.rs -// aux-build:stability_cfg2.rs +// aux-build:stability-cfg2.rs // ignore-tidy-linelength #![warn(deprecated)] #![allow(dead_code, unused_extern_crates)] diff --git a/src/test/ui/lint/lint-stability.rs b/src/test/ui/lint/lint-stability.rs index 6ff79083f46..3e4a3874d2c 100644 --- a/src/test/ui/lint/lint-stability.rs +++ b/src/test/ui/lint/lint-stability.rs @@ -1,7 +1,7 @@ // aux-build:lint_stability.rs // aux-build:inherited_stability.rs // aux-build:stability_cfg1.rs -// aux-build:stability_cfg2.rs +// aux-build:stability-cfg2.rs #![allow(deprecated)] #![allow(dead_code)] diff --git a/src/test/ui/orphan-check-diagnostics.rs b/src/test/ui/orphan-check-diagnostics.rs index 9a29620ae65..c8803b9ae5d 100644 --- a/src/test/ui/orphan-check-diagnostics.rs +++ b/src/test/ui/orphan-check-diagnostics.rs @@ -1,5 +1,6 @@ -// aux-build:orphan_check_diagnostics.rs -// see #22388 +// aux-build:orphan-check-diagnostics.rs + +// See issue #22388. extern crate orphan_check_diagnostics; diff --git a/src/test/ui/orphan-check-diagnostics.stderr b/src/test/ui/orphan-check-diagnostics.stderr index 4bd6aa2c154..3f868422c7f 100644 --- a/src/test/ui/orphan-check-diagnostics.stderr +++ b/src/test/ui/orphan-check-diagnostics.stderr @@ -1,5 +1,5 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/orphan-check-diagnostics.rs:10:1 + --> $DIR/orphan-check-diagnostics.rs:11:1 | LL | impl RemoteTrait for T where T: LocalTrait {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type diff --git a/src/test/ui/out-of-order-shadowing.rs b/src/test/ui/out-of-order-shadowing.rs index b4cb6a23830..a0d1a973764 100644 --- a/src/test/ui/out-of-order-shadowing.rs +++ b/src/test/ui/out-of-order-shadowing.rs @@ -1,4 +1,4 @@ -// aux-build:define_macro.rs +// aux-build:define-macro.rs macro_rules! bar { () => {} } define_macro!(bar); diff --git a/src/test/ui/proc-macro/auxiliary/issue-38586.rs b/src/test/ui/proc-macro/auxiliary/issue-38586.rs new file mode 100644 index 00000000000..f3a19081c47 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/issue-38586.rs @@ -0,0 +1,11 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +#[proc_macro_derive(A)] +pub fn derive_a(_: proc_macro::TokenStream) -> proc_macro::TokenStream { + "fn f() { println!(\"{}\", foo); }".parse().unwrap() +} diff --git a/src/test/ui/proc-macro/auxiliary/issue-50493.rs b/src/test/ui/proc-macro/auxiliary/issue-50493.rs new file mode 100644 index 00000000000..f72024948a9 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/issue-50493.rs @@ -0,0 +1,21 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; +use proc_macro::TokenStream; + +#[proc_macro_derive(Derive)] +pub fn derive(_: TokenStream) -> TokenStream { + let code = " + fn one(r: Restricted) { + r.field; + } + fn two(r: Restricted) { + r.field; + } + "; + + code.parse().unwrap() +} diff --git a/src/test/ui/proc-macro/auxiliary/issue_38586.rs b/src/test/ui/proc-macro/auxiliary/issue_38586.rs deleted file mode 100644 index f3a19081c47..00000000000 --- a/src/test/ui/proc-macro/auxiliary/issue_38586.rs +++ /dev/null @@ -1,11 +0,0 @@ -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -#[proc_macro_derive(A)] -pub fn derive_a(_: proc_macro::TokenStream) -> proc_macro::TokenStream { - "fn f() { println!(\"{}\", foo); }".parse().unwrap() -} diff --git a/src/test/ui/proc-macro/auxiliary/issue_50493.rs b/src/test/ui/proc-macro/auxiliary/issue_50493.rs deleted file mode 100644 index f72024948a9..00000000000 --- a/src/test/ui/proc-macro/auxiliary/issue_50493.rs +++ /dev/null @@ -1,21 +0,0 @@ -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; -use proc_macro::TokenStream; - -#[proc_macro_derive(Derive)] -pub fn derive(_: TokenStream) -> TokenStream { - let code = " - fn one(r: Restricted) { - r.field; - } - fn two(r: Restricted) { - r.field; - } - "; - - code.parse().unwrap() -} diff --git a/src/test/ui/proc-macro/issue-38586.rs b/src/test/ui/proc-macro/issue-38586.rs index 4f291ba990a..24e88ed93ca 100644 --- a/src/test/ui/proc-macro/issue-38586.rs +++ b/src/test/ui/proc-macro/issue-38586.rs @@ -1,4 +1,4 @@ -// aux-build:issue_38586.rs +// aux-build:issue-38586.rs #[macro_use] extern crate issue_38586; diff --git a/src/test/ui/proc-macro/issue-50493.rs b/src/test/ui/proc-macro/issue-50493.rs index f504dbdfce2..eeb08f5eebd 100644 --- a/src/test/ui/proc-macro/issue-50493.rs +++ b/src/test/ui/proc-macro/issue-50493.rs @@ -1,4 +1,4 @@ -// aux-build:issue_50493.rs +// aux-build:issue-50493.rs #[macro_use] extern crate issue_50493; diff --git a/src/test/ui/resolve/auxiliary/issue-19452-aux.rs b/src/test/ui/resolve/auxiliary/issue-19452-aux.rs new file mode 100644 index 00000000000..9c7bcec51df --- /dev/null +++ b/src/test/ui/resolve/auxiliary/issue-19452-aux.rs @@ -0,0 +1,3 @@ +pub enum Homura { + Madoka { age: u32 } +} diff --git a/src/test/ui/resolve/auxiliary/issue-3907.rs b/src/test/ui/resolve/auxiliary/issue-3907.rs new file mode 100644 index 00000000000..5dc502930ae --- /dev/null +++ b/src/test/ui/resolve/auxiliary/issue-3907.rs @@ -0,0 +1,3 @@ +pub trait Foo { + fn bar(); +} diff --git a/src/test/ui/resolve/auxiliary/issue_19452_aux.rs b/src/test/ui/resolve/auxiliary/issue_19452_aux.rs deleted file mode 100644 index 9c7bcec51df..00000000000 --- a/src/test/ui/resolve/auxiliary/issue_19452_aux.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub enum Homura { - Madoka { age: u32 } -} diff --git a/src/test/ui/resolve/auxiliary/issue_3907.rs b/src/test/ui/resolve/auxiliary/issue_3907.rs deleted file mode 100644 index 5dc502930ae..00000000000 --- a/src/test/ui/resolve/auxiliary/issue_3907.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub trait Foo { - fn bar(); -} diff --git a/src/test/ui/resolve/issue-19452.rs b/src/test/ui/resolve/issue-19452.rs index 5c58cabb3cd..1d3aa49eac6 100644 --- a/src/test/ui/resolve/issue-19452.rs +++ b/src/test/ui/resolve/issue-19452.rs @@ -1,4 +1,5 @@ -// aux-build:issue_19452_aux.rs +// aux-build:issue-19452-aux.rs + extern crate issue_19452_aux; enum Homura { diff --git a/src/test/ui/resolve/issue-19452.stderr b/src/test/ui/resolve/issue-19452.stderr index ef96fffee92..56a0e397b85 100644 --- a/src/test/ui/resolve/issue-19452.stderr +++ b/src/test/ui/resolve/issue-19452.stderr @@ -1,11 +1,11 @@ error[E0423]: expected value, found struct variant `Homura::Madoka` - --> $DIR/issue-19452.rs:9:18 + --> $DIR/issue-19452.rs:10:18 | LL | let homura = Homura::Madoka; | ^^^^^^^^^^^^^^ did you mean `Homura::Madoka { /* fields */ }`? error[E0423]: expected value, found struct variant `issue_19452_aux::Homura::Madoka` - --> $DIR/issue-19452.rs:12:18 + --> $DIR/issue-19452.rs:13:18 | LL | let homura = issue_19452_aux::Homura::Madoka; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ did you mean `issue_19452_aux::Homura::Madoka { /* fields */ }`? diff --git a/src/test/ui/resolve/issue-3907-2.rs b/src/test/ui/resolve/issue-3907-2.rs index 89e10ca4f2c..dc9624698df 100644 --- a/src/test/ui/resolve/issue-3907-2.rs +++ b/src/test/ui/resolve/issue-3907-2.rs @@ -1,4 +1,5 @@ -// aux-build:issue_3907.rs +// aux-build:issue-3907.rs + extern crate issue_3907; type Foo = issue_3907::Foo+'static; diff --git a/src/test/ui/resolve/issue-3907-2.stderr b/src/test/ui/resolve/issue-3907-2.stderr index 4fce898dfa9..968c1f3e463 100644 --- a/src/test/ui/resolve/issue-3907-2.stderr +++ b/src/test/ui/resolve/issue-3907-2.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `issue_3907::Foo` cannot be made into an object - --> $DIR/issue-3907-2.rs:10:1 + --> $DIR/issue-3907-2.rs:11:1 | LL | fn bar(_x: Foo) {} | ^^^^^^^^^^^^^^^ the trait `issue_3907::Foo` cannot be made into an object diff --git a/src/test/ui/resolve/issue-3907.rs b/src/test/ui/resolve/issue-3907.rs index a76c3134c0c..87e465489a4 100644 --- a/src/test/ui/resolve/issue-3907.rs +++ b/src/test/ui/resolve/issue-3907.rs @@ -1,4 +1,5 @@ -// aux-build:issue_3907.rs +// aux-build:issue-3907.rs + extern crate issue_3907; type Foo = issue_3907::Foo; diff --git a/src/test/ui/resolve/issue-3907.stderr b/src/test/ui/resolve/issue-3907.stderr index 49f7ae84491..384df571e2a 100644 --- a/src/test/ui/resolve/issue-3907.stderr +++ b/src/test/ui/resolve/issue-3907.stderr @@ -1,5 +1,5 @@ error[E0404]: expected trait, found type alias `Foo` - --> $DIR/issue-3907.rs:10:6 + --> $DIR/issue-3907.rs:11:6 | LL | impl Foo for S { | ^^^ type aliases cannot be used as traits diff --git a/src/test/ui/rmeta-lib-pass.rs b/src/test/ui/rmeta-lib-pass.rs index 6149b1685f5..4ab4117dd6c 100644 --- a/src/test/ui/rmeta-lib-pass.rs +++ b/src/test/ui/rmeta-lib-pass.rs @@ -1,5 +1,5 @@ // compile-flags: --emit=metadata -// aux-build:rmeta_rlib.rs +// aux-build:rmeta-rlib.rs // no-prefer-dynamic // compile-pass diff --git a/src/test/ui/rmeta-pass.rs b/src/test/ui/rmeta-pass.rs index bcd40144f72..9c88de7a033 100644 --- a/src/test/ui/rmeta-pass.rs +++ b/src/test/ui/rmeta-pass.rs @@ -1,5 +1,5 @@ // compile-flags: --emit=metadata -// aux-build:rmeta_meta.rs +// aux-build:rmeta-meta.rs // no-prefer-dynamic // compile-pass diff --git a/src/test/ui/rmeta_lib.rs b/src/test/ui/rmeta_lib.rs index 345b712e37e..6c74aec32e3 100644 --- a/src/test/ui/rmeta_lib.rs +++ b/src/test/ui/rmeta_lib.rs @@ -1,4 +1,4 @@ -// aux-build:rmeta_meta.rs +// aux-build:rmeta-meta.rs // no-prefer-dynamic // error-pattern: crate `rmeta_meta` required to be available in rlib format, but was not found diff --git a/src/test/ui/rmeta_meta_main.rs b/src/test/ui/rmeta_meta_main.rs index df550775ee4..52cd0c2f53f 100644 --- a/src/test/ui/rmeta_meta_main.rs +++ b/src/test/ui/rmeta_meta_main.rs @@ -1,5 +1,5 @@ // compile-flags: --emit=metadata -// aux-build:rmeta_meta.rs +// aux-build:rmeta-meta.rs // no-prefer-dynamic // Check that building a metadata crate finds an error with a dependent, diff --git a/src/test/ui/use/auxiliary/use-from-trait-xc.rs b/src/test/ui/use/auxiliary/use-from-trait-xc.rs new file mode 100644 index 00000000000..4abe11941b1 --- /dev/null +++ b/src/test/ui/use/auxiliary/use-from-trait-xc.rs @@ -0,0 +1,29 @@ +pub use self::sub::{Bar, Baz}; + +pub trait Trait { + fn foo(&self); + type Assoc; + const CONST: u32; +} + +struct Foo; + +impl Foo { + pub fn new() {} + + pub const C: u32 = 0; +} + +mod sub { + pub struct Bar; + + impl Bar { + pub fn new() {} + } + + pub enum Baz {} + + impl Baz { + pub fn new() {} + } +} diff --git a/src/test/ui/use/auxiliary/use_from_trait_xc.rs b/src/test/ui/use/auxiliary/use_from_trait_xc.rs deleted file mode 100644 index 4abe11941b1..00000000000 --- a/src/test/ui/use/auxiliary/use_from_trait_xc.rs +++ /dev/null @@ -1,29 +0,0 @@ -pub use self::sub::{Bar, Baz}; - -pub trait Trait { - fn foo(&self); - type Assoc; - const CONST: u32; -} - -struct Foo; - -impl Foo { - pub fn new() {} - - pub const C: u32 = 0; -} - -mod sub { - pub struct Bar; - - impl Bar { - pub fn new() {} - } - - pub enum Baz {} - - impl Baz { - pub fn new() {} - } -} diff --git a/src/test/ui/use/issue-18986.rs b/src/test/ui/use/issue-18986.rs new file mode 100644 index 00000000000..f0b292f2911 --- /dev/null +++ b/src/test/ui/use/issue-18986.rs @@ -0,0 +1,10 @@ +// aux-build:use-from-trait-xc.rs + +extern crate use_from_trait_xc; +pub use use_from_trait_xc::Trait; + +fn main() { + match () { + Trait { x: 42 } => () //~ ERROR expected struct, variant or union type, found trait `Trait` + } +} diff --git a/src/test/ui/use/issue-18986.stderr b/src/test/ui/use/issue-18986.stderr new file mode 100644 index 00000000000..6c23178c700 --- /dev/null +++ b/src/test/ui/use/issue-18986.stderr @@ -0,0 +1,9 @@ +error[E0574]: expected struct, variant or union type, found trait `Trait` + --> $DIR/issue-18986.rs:8:9 + | +LL | Trait { x: 42 } => () + | ^^^^^ not a struct, variant or union type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0574`. diff --git a/src/test/ui/use/use-from-trait-xc.rs b/src/test/ui/use/use-from-trait-xc.rs index e6f102f6269..695ed66a1c1 100644 --- a/src/test/ui/use/use-from-trait-xc.rs +++ b/src/test/ui/use/use-from-trait-xc.rs @@ -1,4 +1,4 @@ -// aux-build:use_from_trait_xc.rs +// aux-build:use-from-trait-xc.rs extern crate use_from_trait_xc; diff --git a/src/test/ui/useless-comment.rs b/src/test/ui/useless-comment.rs new file mode 100644 index 00000000000..7d2e5ab6f2b --- /dev/null +++ b/src/test/ui/useless-comment.rs @@ -0,0 +1,45 @@ +#![feature(stmt_expr_attributes)] + +#![deny(unused_doc_comments)] + +macro_rules! mac { + () => {} +} + +/// foo //~ ERROR unused doc comment +mac!(); + +fn foo() { + /// a //~ ERROR unused doc comment + let x = 12; + + /// multi-line //~ unused doc comment + /// doc comment + /// that is unused + match x { + /// c //~ ERROR unused doc comment + 1 => {}, + _ => {} + } + + /// foo //~ ERROR unused doc comment + unsafe {} + + #[doc = "foo"] //~ ERROR unused doc comment + #[doc = "bar"] //~ ERROR unused doc comment + 3; + + /// bar //~ ERROR unused doc comment + mac!(); + + let x = /** comment */ 47; //~ ERROR unused doc comment + + /// dox //~ ERROR unused doc comment + { + + } +} + +fn main() { + foo(); +} diff --git a/src/test/ui/useless-comment.stderr b/src/test/ui/useless-comment.stderr new file mode 100644 index 00000000000..925e3079636 --- /dev/null +++ b/src/test/ui/useless-comment.stderr @@ -0,0 +1,98 @@ +error: unused doc comment + --> $DIR/useless-comment.rs:9:1 + | +LL | /// foo + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | mac!(); + | ------- rustdoc does not generate documentation for macro expansions + | +note: lint level defined here + --> $DIR/useless-comment.rs:3:9 + | +LL | #![deny(unused_doc_comments)] + | ^^^^^^^^^^^^^^^^^^^ + = help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion + +error: unused doc comment + --> $DIR/useless-comment.rs:13:5 + | +LL | /// a + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | let x = 12; + | ----------- rustdoc does not generate documentation for statements + +error: unused doc comment + --> $DIR/useless-comment.rs:16:5 + | +LL | / /// multi-line +LL | | /// doc comment +LL | | /// that is unused + | |______________________^ +LL | / match x { +LL | | /// c +LL | | 1 => {}, +LL | | _ => {} +LL | | } + | |_____- rustdoc does not generate documentation for expressions + +error: unused doc comment + --> $DIR/useless-comment.rs:20:9 + | +LL | /// c + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | 1 => {}, + | ------- rustdoc does not generate documentation for match arms + +error: unused doc comment + --> $DIR/useless-comment.rs:25:5 + | +LL | /// foo + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | unsafe {} + | --------- rustdoc does not generate documentation for expressions + +error: unused doc comment + --> $DIR/useless-comment.rs:28:5 + | +LL | #[doc = "foo"] + | ^^^^^^^^^^^^^^ +LL | #[doc = "bar"] +LL | 3; + | - rustdoc does not generate documentation for expressions + +error: unused doc comment + --> $DIR/useless-comment.rs:29:5 + | +LL | #[doc = "bar"] + | ^^^^^^^^^^^^^^ +LL | 3; + | - rustdoc does not generate documentation for expressions + +error: unused doc comment + --> $DIR/useless-comment.rs:32:5 + | +LL | /// bar + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | mac!(); + | ------- rustdoc does not generate documentation for macro expansions + | + = help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion + +error: unused doc comment + --> $DIR/useless-comment.rs:35:13 + | +LL | let x = /** comment */ 47; + | ^^^^^^^^^^^^^^ -- rustdoc does not generate documentation for expressions + +error: unused doc comment + --> $DIR/useless-comment.rs:37:5 + | +LL | /// dox + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / { +LL | | +LL | | } + | |_____- rustdoc does not generate documentation for expressions + +error: aborting due to 10 previous errors + diff --git a/src/test/ui/useless_comment.rs b/src/test/ui/useless_comment.rs deleted file mode 100644 index 7d2e5ab6f2b..00000000000 --- a/src/test/ui/useless_comment.rs +++ /dev/null @@ -1,45 +0,0 @@ -#![feature(stmt_expr_attributes)] - -#![deny(unused_doc_comments)] - -macro_rules! mac { - () => {} -} - -/// foo //~ ERROR unused doc comment -mac!(); - -fn foo() { - /// a //~ ERROR unused doc comment - let x = 12; - - /// multi-line //~ unused doc comment - /// doc comment - /// that is unused - match x { - /// c //~ ERROR unused doc comment - 1 => {}, - _ => {} - } - - /// foo //~ ERROR unused doc comment - unsafe {} - - #[doc = "foo"] //~ ERROR unused doc comment - #[doc = "bar"] //~ ERROR unused doc comment - 3; - - /// bar //~ ERROR unused doc comment - mac!(); - - let x = /** comment */ 47; //~ ERROR unused doc comment - - /// dox //~ ERROR unused doc comment - { - - } -} - -fn main() { - foo(); -} diff --git a/src/test/ui/useless_comment.stderr b/src/test/ui/useless_comment.stderr deleted file mode 100644 index 10d8ee60f99..00000000000 --- a/src/test/ui/useless_comment.stderr +++ /dev/null @@ -1,98 +0,0 @@ -error: unused doc comment - --> $DIR/useless_comment.rs:9:1 - | -LL | /// foo - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | mac!(); - | ------- rustdoc does not generate documentation for macro expansions - | -note: lint level defined here - --> $DIR/useless_comment.rs:3:9 - | -LL | #![deny(unused_doc_comments)] - | ^^^^^^^^^^^^^^^^^^^ - = help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion - -error: unused doc comment - --> $DIR/useless_comment.rs:13:5 - | -LL | /// a - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | let x = 12; - | ----------- rustdoc does not generate documentation for statements - -error: unused doc comment - --> $DIR/useless_comment.rs:16:5 - | -LL | / /// multi-line -LL | | /// doc comment -LL | | /// that is unused - | |______________________^ -LL | / match x { -LL | | /// c -LL | | 1 => {}, -LL | | _ => {} -LL | | } - | |_____- rustdoc does not generate documentation for expressions - -error: unused doc comment - --> $DIR/useless_comment.rs:20:9 - | -LL | /// c - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | 1 => {}, - | ------- rustdoc does not generate documentation for match arms - -error: unused doc comment - --> $DIR/useless_comment.rs:25:5 - | -LL | /// foo - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | unsafe {} - | --------- rustdoc does not generate documentation for expressions - -error: unused doc comment - --> $DIR/useless_comment.rs:28:5 - | -LL | #[doc = "foo"] - | ^^^^^^^^^^^^^^ -LL | #[doc = "bar"] -LL | 3; - | - rustdoc does not generate documentation for expressions - -error: unused doc comment - --> $DIR/useless_comment.rs:29:5 - | -LL | #[doc = "bar"] - | ^^^^^^^^^^^^^^ -LL | 3; - | - rustdoc does not generate documentation for expressions - -error: unused doc comment - --> $DIR/useless_comment.rs:32:5 - | -LL | /// bar - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | mac!(); - | ------- rustdoc does not generate documentation for macro expansions - | - = help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion - -error: unused doc comment - --> $DIR/useless_comment.rs:35:13 - | -LL | let x = /** comment */ 47; - | ^^^^^^^^^^^^^^ -- rustdoc does not generate documentation for expressions - -error: unused doc comment - --> $DIR/useless_comment.rs:37:5 - | -LL | /// dox - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | / { -LL | | -LL | | } - | |_____- rustdoc does not generate documentation for expressions - -error: aborting due to 10 previous errors - diff --git a/src/test/ui/xc-private-method.rs b/src/test/ui/xc-private-method.rs index 157249194a3..e95cab93d75 100644 --- a/src/test/ui/xc-private-method.rs +++ b/src/test/ui/xc-private-method.rs @@ -1,4 +1,4 @@ -// aux-build:xc_private_method_lib.rs +// aux-build:xc-private-method-lib.rs extern crate xc_private_method_lib; diff --git a/src/test/ui/xc-private-method2.rs b/src/test/ui/xc-private-method2.rs index 6d73570318a..f11b251082b 100644 --- a/src/test/ui/xc-private-method2.rs +++ b/src/test/ui/xc-private-method2.rs @@ -1,4 +1,4 @@ -// aux-build:xc_private_method_lib.rs +// aux-build:xc-private-method-lib.rs extern crate xc_private_method_lib; -- cgit 1.4.1-3-g733a5