From 01e137c4eddf4b26e6eca2884a5f1475d27a35c7 Mon Sep 17 00:00:00 2001 From: Rust timing bot Date: Tue, 26 Jan 2021 22:50:48 +0100 Subject: [PATCH 1/2] Revert to 57a71ac0e17e4f7070b090ab7bdc5474d8e37ecc --- .github/ISSUE_TEMPLATE/tracking_issue.md | 2 - Cargo.lock | 3 +- compiler/rustc_ast/src/tokenstream.rs | 11 + compiler/rustc_ast_lowering/src/expr.rs | 50 +- compiler/rustc_ast_pretty/Cargo.toml | 1 + compiler/rustc_attr/Cargo.toml | 1 + compiler/rustc_attr/src/builtin.rs | 38 +- compiler/rustc_builtin_macros/src/assert.rs | 26 +- .../rustc_builtin_macros/src/source_util.rs | 5 +- compiler/rustc_codegen_llvm/src/attributes.rs | 45 +- compiler/rustc_codegen_ssa/src/back/link.rs | 28 +- compiler/rustc_codegen_ssa/src/base.rs | 2 +- compiler/rustc_codegen_ssa/src/lib.rs | 3 +- compiler/rustc_codegen_ssa/src/mir/analyze.rs | 2 +- compiler/rustc_codegen_ssa/src/mir/place.rs | 2 +- .../src/graph/dominators/mod.rs | 16 +- .../src/stable_hasher.rs | 1 - compiler/rustc_data_structures/src/steal.rs | 1 - compiler/rustc_expand/src/expand.rs | 4 +- compiler/rustc_expand/src/parse/tests.rs | 5 +- compiler/rustc_expand/src/proc_macro.rs | 3 +- compiler/rustc_feature/src/active.rs | 2 +- compiler/rustc_hir/src/definitions.rs | 4 - compiler/rustc_hir/src/hir.rs | 4 +- compiler/rustc_hir/src/intravisit.rs | 2 +- compiler/rustc_hir/src/lang_items.rs | 2 +- compiler/rustc_hir_pretty/src/lib.rs | 2 +- compiler/rustc_interface/src/passes.rs | 7 + compiler/rustc_interface/src/queries.rs | 16 +- compiler/rustc_lint/src/builtin.rs | 12 +- compiler/rustc_lint/src/context.rs | 2 +- compiler/rustc_lint/src/early.rs | 14 +- compiler/rustc_lint/src/levels.rs | 3 +- compiler/rustc_lint_defs/src/builtin.rs | 33 +- compiler/rustc_metadata/src/rmeta/decoder.rs | 78 +- .../src/rmeta/decoder/cstore_impl.rs | 2 +- compiler/rustc_metadata/src/rmeta/encoder.rs | 345 +- compiler/rustc_metadata/src/rmeta/mod.rs | 3 +- .../rustc_middle/src/dep_graph/dep_node.rs | 17 +- compiler/rustc_middle/src/hir/map/mod.rs | 102 +- compiler/rustc_middle/src/hir/mod.rs | 8 +- compiler/rustc_middle/src/ich/hcx.rs | 8 - compiler/rustc_middle/src/lint.rs | 5 +- .../src/middle/codegen_fn_attrs.rs | 2 +- compiler/rustc_middle/src/middle/cstore.rs | 2 +- compiler/rustc_middle/src/middle/mod.rs | 2 +- .../src/middle/resolve_lifetime.rs | 2 +- compiler/rustc_middle/src/middle/stability.rs | 4 +- .../rustc_middle/src/mir/interpret/error.rs | 3 - .../rustc_middle/src/mir/interpret/value.rs | 2 +- compiler/rustc_middle/src/mir/mod.rs | 2 +- compiler/rustc_middle/src/mir/mono.rs | 1 - compiler/rustc_middle/src/mir/query.rs | 8 +- compiler/rustc_middle/src/query/mod.rs | 23 +- .../src/traits/specialization_graph.rs | 4 +- .../src/ty/inhabitedness/def_id_forest.rs | 2 +- compiler/rustc_middle/src/ty/layout.rs | 163 +- compiler/rustc_middle/src/ty/mod.rs | 8 +- compiler/rustc_middle/src/ty/query/keys.rs | 11 - compiler/rustc_middle/src/ty/query/mod.rs | 16 - compiler/rustc_middle/src/ty/trait_def.rs | 2 +- .../diagnostics/conflict_errors.rs | 4 +- compiler/rustc_mir/src/borrow_check/mod.rs | 8 +- .../rustc_mir/src/borrow_check/prefixes.rs | 2 +- compiler/rustc_mir/src/interpret/step.rs | 12 +- compiler/rustc_mir/src/lib.rs | 2 - compiler/rustc_mir/src/shim.rs | 2 +- .../src/transform/check_consts/ops.rs | 71 +- .../src/transform/check_consts/validation.rs | 29 +- .../rustc_mir/src/transform/const_prop.rs | 10 +- .../src/transform/coverage/counters.rs | 2 +- compiler/rustc_mir/src/transform/inline.rs | 91 +- .../rustc_mir/src/transform/inline/cycle.rs | 157 - .../rustc_mir/src/transform/instcombine.rs | 361 +- compiler/rustc_mir/src/transform/mod.rs | 18 +- .../src/transform/no_landing_pads.rs | 27 +- .../rustc_mir/src/transform/promote_consts.rs | 112 +- .../src/transform/remove_unneeded_drops.rs | 61 +- compiler/rustc_mir_build/src/thir/cx/expr.rs | 4 +- compiler/rustc_parse/src/lib.rs | 2 +- .../rustc_parse/src/parser/diagnostics.rs | 21 +- compiler/rustc_parse/src/parser/expr.rs | 60 +- compiler/rustc_parse/src/parser/item.rs | 89 +- compiler/rustc_parse/src/parser/mod.rs | 81 +- .../rustc_parse/src/parser/nonterminal.rs | 6 +- compiler/rustc_parse/src/parser/path.rs | 55 +- compiler/rustc_parse/src/parser/stmt.rs | 187 +- compiler/rustc_passes/src/check_const.rs | 2 +- compiler/rustc_passes/src/dead.rs | 2 +- compiler/rustc_passes/src/liveness.rs | 2 +- compiler/rustc_passes/src/loops.rs | 94 +- compiler/rustc_passes/src/reachable.rs | 1 - compiler/rustc_passes/src/region.rs | 2 +- .../rustc_query_system/src/query/caches.rs | 9 +- .../rustc_query_system/src/query/plumbing.rs | 5 +- compiler/rustc_resolve/src/late.rs | 13 - .../rustc_resolve/src/late/diagnostics.rs | 26 +- compiler/rustc_resolve/src/late/lifetimes.rs | 2 +- compiler/rustc_resolve/src/lib.rs | 32 +- compiler/rustc_session/src/config.rs | 4 +- compiler/rustc_span/src/hygiene.rs | 157 +- compiler/rustc_span/src/lib.rs | 22 +- compiler/rustc_target/src/abi/call/mod.rs | 48 +- .../rustc_target/src/spec/i386_apple_ios.rs | 8 +- .../src/spec/i686_apple_darwin.rs | 4 +- .../src/spec/i686_linux_android.rs | 4 +- .../src/spec/i686_unknown_freebsd.rs | 4 +- .../src/spec/i686_unknown_haiku.rs | 4 +- .../src/spec/i686_unknown_linux_gnu.rs | 4 +- .../src/spec/i686_unknown_linux_musl.rs | 4 +- .../src/spec/i686_unknown_netbsd.rs | 4 +- .../src/spec/i686_unknown_openbsd.rs | 4 +- .../rustc_target/src/spec/i686_wrs_vxworks.rs | 4 +- .../src/spec/linux_kernel_base.rs | 6 +- compiler/rustc_target/src/spec/mod.rs | 98 +- .../rustc_target/src/spec/uefi_msvc_base.rs | 6 +- .../src/spec/x86_64_apple_darwin.rs | 4 +- .../rustc_target/src/spec/x86_64_apple_ios.rs | 8 +- .../src/spec/x86_64_apple_ios_macabi.rs | 8 +- .../src/spec/x86_64_apple_tvos.rs | 8 +- .../rustc_target/src/spec/x86_64_fuchsia.rs | 4 +- .../src/spec/x86_64_linux_android.rs | 4 +- .../src/spec/x86_64_rumprun_netbsd.rs | 4 +- .../src/spec/x86_64_sun_solaris.rs | 4 +- .../src/spec/x86_64_unknown_dragonfly.rs | 4 +- .../src/spec/x86_64_unknown_freebsd.rs | 4 +- .../src/spec/x86_64_unknown_haiku.rs | 4 +- .../src/spec/x86_64_unknown_hermit.rs | 4 +- .../src/spec/x86_64_unknown_hermit_kernel.rs | 4 +- .../src/spec/x86_64_unknown_linux_gnu.rs | 4 +- .../src/spec/x86_64_unknown_linux_gnux32.rs | 4 +- .../src/spec/x86_64_unknown_linux_musl.rs | 4 +- .../src/spec/x86_64_unknown_netbsd.rs | 4 +- .../src/spec/x86_64_unknown_openbsd.rs | 4 +- .../src/spec/x86_64_unknown_redox.rs | 4 +- .../src/spec/x86_64_wrs_vxworks.rs | 4 +- compiler/rustc_ty_utils/src/ty.rs | 5 + compiler/rustc_typeck/src/check/check.rs | 244 +- compiler/rustc_typeck/src/check/coercion.rs | 10 +- compiler/rustc_typeck/src/check/expr.rs | 10 +- .../rustc_typeck/src/check/fn_ctxt/checks.rs | 9 +- .../rustc_typeck/src/check/fn_ctxt/mod.rs | 8 +- compiler/rustc_typeck/src/check/mod.rs | 4 +- compiler/rustc_typeck/src/expr_use_visitor.rs | 2 +- .../rustc_typeck/src/variance/constraints.rs | 19 +- library/alloc/src/boxed.rs | 7 +- library/alloc/src/collections/btree/node.rs | 43 +- .../alloc/src/collections/btree/node/tests.rs | 12 +- library/alloc/src/collections/btree/search.rs | 11 +- .../alloc/src/collections/vec_deque/mod.rs | 10 +- .../alloc/src/collections/vec_deque/tests.rs | 40 - library/alloc/src/fmt.rs | 9 +- library/alloc/src/lib.rs | 7 + library/alloc/src/macros.rs | 18 +- library/alloc/src/raw_vec.rs | 31 +- library/alloc/src/string.rs | 2 - library/alloc/src/vec/mod.rs | 29 - .../alloc/src/vec/spec_from_iter_nested.rs | 2 +- library/core/benches/iter.rs | 24 +- library/core/src/convert/mod.rs | 1 + library/core/src/iter/adapters/chain.rs | 2 +- library/core/src/iter/adapters/intersperse.rs | 17 +- library/core/src/iter/adapters/skip.rs | 10 +- library/core/src/iter/range.rs | 2 - library/core/src/iter/traits/iterator.rs | 55 +- library/core/src/iter/traits/marker.rs | 2 + library/core/src/lib.rs | 1 - library/core/src/num/dec2flt/mod.rs | 2 +- library/core/src/num/f32.rs | 64 +- library/core/src/num/f64.rs | 64 +- library/core/src/num/int_macros.rs | 16 +- library/core/src/num/shells/i128.rs | 9 +- library/core/src/num/shells/i16.rs | 9 +- library/core/src/num/shells/i32.rs | 9 +- library/core/src/num/shells/i64.rs | 9 +- library/core/src/num/shells/i8.rs | 9 +- library/core/src/num/shells/int_macros.rs | 2 - library/core/src/num/shells/isize.rs | 9 +- library/core/src/num/shells/u128.rs | 10 +- library/core/src/num/shells/u16.rs | 9 +- library/core/src/num/shells/u32.rs | 9 +- library/core/src/num/shells/u64.rs | 9 +- library/core/src/num/shells/u8.rs | 9 +- library/core/src/num/shells/usize.rs | 9 +- library/core/src/num/uint_macros.rs | 14 +- library/core/src/ptr/non_null.rs | 19 +- library/core/src/slice/mod.rs | 7 +- library/core/src/time.rs | 20 +- library/core/tests/iter.rs | 3640 +++++++++++++++++ library/core/tests/iter/adapters/chain.rs | 272 -- library/core/tests/iter/adapters/cloned.rs | 52 - library/core/tests/iter/adapters/copied.rs | 18 - library/core/tests/iter/adapters/cycle.rs | 31 - library/core/tests/iter/adapters/enumerate.rs | 107 - library/core/tests/iter/adapters/filter.rs | 52 - .../core/tests/iter/adapters/filter_map.rs | 50 - library/core/tests/iter/adapters/flat_map.rs | 74 - library/core/tests/iter/adapters/flatten.rs | 94 - library/core/tests/iter/adapters/fuse.rs | 75 - library/core/tests/iter/adapters/inspect.rs | 38 - .../core/tests/iter/adapters/intersperse.rs | 154 - library/core/tests/iter/adapters/map.rs | 27 - library/core/tests/iter/adapters/mod.rs | 185 - library/core/tests/iter/adapters/peekable.rs | 272 -- library/core/tests/iter/adapters/scan.rs | 20 - library/core/tests/iter/adapters/skip.rs | 181 - .../core/tests/iter/adapters/skip_while.rs | 50 - library/core/tests/iter/adapters/step_by.rs | 248 -- library/core/tests/iter/adapters/take.rs | 126 - .../core/tests/iter/adapters/take_while.rs | 29 - library/core/tests/iter/adapters/zip.rs | 247 -- library/core/tests/iter/mod.rs | 102 - library/core/tests/iter/range.rs | 446 -- library/core/tests/iter/sources.rs | 108 - library/core/tests/iter/traits/accum.rs | 66 - .../core/tests/iter/traits/double_ended.rs | 90 - library/core/tests/iter/traits/iterator.rs | 470 --- library/core/tests/iter/traits/mod.rs | 4 - library/core/tests/iter/traits/step.rs | 89 - library/std/src/env.rs | 15 +- library/std/src/error.rs | 21 - library/std/src/f32.rs | 23 +- library/std/src/f64.rs | 23 +- library/std/src/ffi/os_str.rs | 34 - library/std/src/future.rs | 17 + library/std/src/io/prelude.rs | 2 +- library/std/src/lib.rs | 17 +- library/std/src/macros.rs | 4 - library/std/src/net/ip.rs | 8 +- library/std/src/net/ip/tests.rs | 3 - library/std/src/panic.rs | 4 +- library/std/src/path.rs | 69 - library/std/src/prelude/mod.rs | 28 +- library/std/src/sys/unix/ext/process.rs | 18 - .../src/sys/unix/process/process_common.rs | 9 - .../std/src/sys/unix/process/process_unix.rs | 21 +- library/std/src/sys/unix/process/zircon.rs | 1 + library/std/src/sys/windows/c.rs | 116 +- library/std/src/sys/windows/mutex.rs | 110 +- library/test/src/lib.rs | 88 +- src/bootstrap/check.rs | 7 - src/ci/pgo.sh | 14 - src/librustdoc/clean/inline.rs | 10 +- src/librustdoc/clean/mod.rs | 28 +- src/librustdoc/clean/types.rs | 8 +- src/librustdoc/config.rs | 9 +- src/librustdoc/doctest.rs | 14 +- src/librustdoc/doctree.rs | 20 + src/librustdoc/formats/renderer.rs | 55 +- src/librustdoc/html/layout.rs | 5 +- src/librustdoc/html/markdown.rs | 16 +- src/librustdoc/html/render/mod.rs | 99 +- src/librustdoc/json/conversions.rs | 19 +- src/librustdoc/json/mod.rs | 23 +- src/librustdoc/json/types.rs | 6 +- src/librustdoc/lib.rs | 15 +- .../passes/check_code_block_syntax.rs | 2 +- .../passes/collect_intra_doc_links.rs | 6 +- src/test/mir-opt/inline/cycle.f.Inline.diff | 42 - src/test/mir-opt/inline/cycle.g.Inline.diff | 25 - .../mir-opt/inline/cycle.main.Inline.diff | 25 - src/test/mir-opt/inline/cycle.rs | 18 - .../mir-opt/inline/inline-cycle-generic.rs | 40 - ...e_closure_borrows_arg.foo.Inline.after.mir | 2 +- .../inline_cycle_generic.main.Inline.diff | 29 - src/test/mir-opt/inst_combine_deref.rs | 69 + .../rustdoc-ui/run-directory.correct.stdout | 6 - .../rustdoc-ui/run-directory.incorrect.stdout | 6 - src/test/rustdoc-ui/run-directory.rs | 23 - .../rustdoc/implementor-stable-version.rs | 19 - src/test/rustdoc/reexport-check.rs | 2 +- src/test/rustdoc/visibility.rs | 32 - src/test/ui-fulldeps/lint-tool-test.stderr | 18 +- .../ast-json/ast-json-noexpand-output.stdout | 2 +- src/test/ui/ast-json/ast-json-output.stdout | 2 +- src/test/ui/attributes/key-value-non-ascii.rs | 4 - .../ui/attributes/key-value-non-ascii.stderr | 8 - .../ui/check-static-immutable-mut-slices.rs | 2 +- .../check-static-immutable-mut-slices.stderr | 4 +- src/test/ui/closures/local-type-mix.rs | 17 - src/test/ui/closures/local-type-mix.stderr | 51 - src/test/ui/command/command-setgroups.rs | 26 - .../const_prop/inline_spans_lint_attribute.rs | 15 - src/test/ui/consts/array-literal-index-oob.rs | 2 + .../ui/consts/array-literal-index-oob.stderr | 22 +- .../ui/consts/const-address-of-mut.stderr | 24 +- .../const-eval/const-eval-query-stack.rs | 10 +- .../const-eval/const-eval-query-stack.stderr | 34 +- .../ui/consts/const-eval/issue-65394.stderr | 9 +- .../const-eval/promoted_errors.noopt.stderr | 100 +- .../const-eval/promoted_errors.opt.stderr | 94 +- ...ted_errors.opt_with_overflow_checks.stderr | 100 +- .../ui/consts/const-eval/promoted_errors.rs | 45 +- src/test/ui/consts/const-multi-ref.stderr | 10 +- .../const-mut-refs/const_mut_address_of.rs | 3 +- .../const_mut_address_of.stderr | 15 + .../consts/const-mut-refs/const_mut_refs.rs | 4 +- .../const-mut-refs/const_mut_refs.stderr | 21 + .../consts/const-mut-refs/mut_ref_in_final.rs | 57 - .../const-mut-refs/mut_ref_in_final.stderr | 60 - .../mut_ref_in_final_dynamic_check.rs | 28 - .../mut_ref_in_final_dynamic_check.stderr | 23 - src/test/ui/consts/const_let_assign3.stderr | 17 +- .../ui/consts/issue-17718-const-bad-values.rs | 3 +- .../issue-17718-const-bad-values.stderr | 12 +- .../consts/projection_qualif.mut_refs.stderr | 19 + ...o_mut_ref_dest.rs => projection_qualif.rs} | 2 +- .../ui/consts/projection_qualif.stock.stderr | 19 + src/test/ui/consts/promote-not.rs | 7 - src/test/ui/consts/promote-not.stderr | 59 +- src/test/ui/consts/promoted_div_by_zero.rs | 9 + src/test/ui/consts/promotion.rs | 37 +- .../ui/consts/read_from_static_mut_ref.rs | 9 + .../ui/consts/read_from_static_mut_ref.stderr | 9 + ...ic_mut_containing_mut_ref2.mut_refs.stderr | 8 +- .../consts/static_mut_containing_mut_ref2.rs | 3 +- ...tatic_mut_containing_mut_ref2.stock.stderr | 9 +- .../write_to_mut_ref_dest.mut_refs.stderr | 12 - .../consts/write_to_mut_ref_dest.stock.stderr | 21 - .../ui/consts/write_to_static_via_mut_ref.rs | 8 - .../consts/write_to_static_via_mut_ref.stderr | 16 - .../edition-imports-virtual-2015-gated.stderr | 2 +- src/test/ui/error-codes/E0017.rs | 9 +- src/test/ui/error-codes/E0017.stderr | 35 +- src/test/ui/error-codes/E0388.rs | 7 +- src/test/ui/error-codes/E0388.stderr | 29 +- .../extern/extern-compare-with-return-type.rs | 1 - .../feature-gates/feature-gate-cfg-version.rs | 30 +- .../feature-gate-cfg-version.stderr | 110 +- .../parse/trait-path-expected-token.stderr | 4 +- .../parse/trait-path-expressions.rs | 2 +- .../parse/trait-path-expressions.stderr | 8 +- .../parse/trait-path-missing-gen_arg.stderr | 4 +- .../parse/trait-path-segments.rs | 6 +- .../parse/trait-path-segments.stderr | 26 +- .../parse/trait-path-types.rs | 6 +- .../parse/trait-path-types.stderr | 24 +- .../variance_constraints.rs | 24 - .../ui/hygiene/no_implicit_prelude-2021.rs | 9 - src/test/ui/issues/issue-1962.fixed | 4 +- src/test/ui/issues/issue-1962.rs | 4 +- src/test/ui/issues/issue-1962.stderr | 4 +- src/test/ui/issues/issue-27042.stderr | 2 +- src/test/ui/issues/issue-34334.rs | 4 +- src/test/ui/issues/issue-34334.stderr | 11 +- src/test/ui/issues/issue-46604.rs | 2 +- src/test/ui/issues/issue-46604.stderr | 4 +- src/test/ui/label/label_misspelled.rs | 50 +- src/test/ui/label/label_misspelled.stderr | 211 +- src/test/ui/label/label_misspelled_2.rs | 16 - src/test/ui/label/label_misspelled_2.stderr | 37 - src/test/ui/lint/dead-code/const-and-self.rs | 21 +- .../ui/lint/dead-code/const-and-self.stderr | 20 - .../ui/lint/lint-const-item-mutation.stderr | 10 +- src/test/ui/lint/lint-removed-cmdline.stderr | 8 +- src/test/ui/lint/lint-removed.stderr | 2 +- .../ui/lint/lint-unexported-no-mangle.stderr | 16 +- .../loops/loop-break-value-no-repeat.stderr | 4 +- src/test/ui/loops/loop-break-value.rs | 1 + src/test/ui/loops/loop-break-value.stderr | 70 +- src/test/ui/mir/issue-80742.rs | 33 - src/test/ui/mir/issue-80742.stderr | 70 - src/test/ui/never_type/issue-52443.stderr | 9 +- ...ing-closing-angle-bracket-eq-constraint.rs | 23 - ...closing-angle-bracket-eq-constraint.stderr | 49 - .../nested-missing-closing-angle-bracket.rs | 4 - ...ested-missing-closing-angle-bracket.stderr | 8 - .../ui/proc-macro/issue-81007-item-attrs.rs | 31 - .../proc-macro/issue-81007-item-attrs.stdout | 99 - .../ui/resolve/crate-called-as-function.rs | 3 - .../resolve/crate-called-as-function.stderr | 9 - src/test/ui/resolve/missing-in-namespace.rs | 4 - .../ui/resolve/missing-in-namespace.stderr | 14 - .../non-existent-2.rs | 2 +- .../non-existent-2.stderr | 4 +- .../ui/traits/mutual-recursion-issue-75860.rs | 15 - .../mutual-recursion-issue-75860.stderr | 16 - src/test/ui/unsafe/ranged_ints2_const.rs | 6 - src/test/ui/unsafe/ranged_ints2_const.stderr | 11 +- src/tools/cargo | 2 +- src/tools/clippy/clippy_lints/src/doc.rs | 3 +- src/tools/clippy/clippy_lints/src/loops.rs | 8 +- .../clippy_lints/src/needless_continue.rs | 2 +- src/tools/clippy/clippy_lints/src/shadow.rs | 2 +- .../clippy/clippy_lints/src/utils/author.rs | 2 +- .../clippy/clippy_lints/src/utils/higher.rs | 4 +- .../clippy_lints/src/utils/hir_utils.rs | 4 +- src/tools/clippy/tests/ui/deprecated.stderr | 26 +- .../clippy/tests/ui/deprecated_old.stderr | 8 +- src/tools/jsondocck/src/main.rs | 17 +- src/tools/miri | 2 +- 391 files changed, 6451 insertions(+), 8988 deletions(-) delete mode 100644 compiler/rustc_mir/src/transform/inline/cycle.rs create mode 100644 library/core/tests/iter.rs delete mode 100644 library/core/tests/iter/adapters/chain.rs delete mode 100644 library/core/tests/iter/adapters/cloned.rs delete mode 100644 library/core/tests/iter/adapters/copied.rs delete mode 100644 library/core/tests/iter/adapters/cycle.rs delete mode 100644 library/core/tests/iter/adapters/enumerate.rs delete mode 100644 library/core/tests/iter/adapters/filter.rs delete mode 100644 library/core/tests/iter/adapters/filter_map.rs delete mode 100644 library/core/tests/iter/adapters/flat_map.rs delete mode 100644 library/core/tests/iter/adapters/flatten.rs delete mode 100644 library/core/tests/iter/adapters/fuse.rs delete mode 100644 library/core/tests/iter/adapters/inspect.rs delete mode 100644 library/core/tests/iter/adapters/intersperse.rs delete mode 100644 library/core/tests/iter/adapters/map.rs delete mode 100644 library/core/tests/iter/adapters/mod.rs delete mode 100644 library/core/tests/iter/adapters/peekable.rs delete mode 100644 library/core/tests/iter/adapters/scan.rs delete mode 100644 library/core/tests/iter/adapters/skip.rs delete mode 100644 library/core/tests/iter/adapters/skip_while.rs delete mode 100644 library/core/tests/iter/adapters/step_by.rs delete mode 100644 library/core/tests/iter/adapters/take.rs delete mode 100644 library/core/tests/iter/adapters/take_while.rs delete mode 100644 library/core/tests/iter/adapters/zip.rs delete mode 100644 library/core/tests/iter/mod.rs delete mode 100644 library/core/tests/iter/range.rs delete mode 100644 library/core/tests/iter/sources.rs delete mode 100644 library/core/tests/iter/traits/accum.rs delete mode 100644 library/core/tests/iter/traits/double_ended.rs delete mode 100644 library/core/tests/iter/traits/iterator.rs delete mode 100644 library/core/tests/iter/traits/mod.rs delete mode 100644 library/core/tests/iter/traits/step.rs create mode 100644 library/std/src/future.rs delete mode 100644 src/test/mir-opt/inline/cycle.f.Inline.diff delete mode 100644 src/test/mir-opt/inline/cycle.g.Inline.diff delete mode 100644 src/test/mir-opt/inline/cycle.main.Inline.diff delete mode 100644 src/test/mir-opt/inline/cycle.rs delete mode 100644 src/test/mir-opt/inline/inline-cycle-generic.rs delete mode 100644 src/test/mir-opt/inline/inline_cycle_generic.main.Inline.diff create mode 100644 src/test/mir-opt/inst_combine_deref.rs delete mode 100644 src/test/rustdoc-ui/run-directory.correct.stdout delete mode 100644 src/test/rustdoc-ui/run-directory.incorrect.stdout delete mode 100644 src/test/rustdoc-ui/run-directory.rs delete mode 100644 src/test/rustdoc/implementor-stable-version.rs delete mode 100644 src/test/ui/attributes/key-value-non-ascii.rs delete mode 100644 src/test/ui/attributes/key-value-non-ascii.stderr delete mode 100644 src/test/ui/closures/local-type-mix.rs delete mode 100644 src/test/ui/closures/local-type-mix.stderr delete mode 100644 src/test/ui/command/command-setgroups.rs delete mode 100644 src/test/ui/const_prop/inline_spans_lint_attribute.rs create mode 100644 src/test/ui/consts/const-mut-refs/const_mut_address_of.stderr create mode 100644 src/test/ui/consts/const-mut-refs/const_mut_refs.stderr delete mode 100644 src/test/ui/consts/const-mut-refs/mut_ref_in_final.rs delete mode 100644 src/test/ui/consts/const-mut-refs/mut_ref_in_final.stderr delete mode 100644 src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs delete mode 100644 src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr create mode 100644 src/test/ui/consts/projection_qualif.mut_refs.stderr rename src/test/ui/consts/{write_to_mut_ref_dest.rs => projection_qualif.rs} (72%) create mode 100644 src/test/ui/consts/projection_qualif.stock.stderr create mode 100644 src/test/ui/consts/promoted_div_by_zero.rs create mode 100644 src/test/ui/consts/read_from_static_mut_ref.rs create mode 100644 src/test/ui/consts/read_from_static_mut_ref.stderr delete mode 100644 src/test/ui/consts/write_to_mut_ref_dest.mut_refs.stderr delete mode 100644 src/test/ui/consts/write_to_mut_ref_dest.stock.stderr delete mode 100644 src/test/ui/consts/write_to_static_via_mut_ref.rs delete mode 100644 src/test/ui/consts/write_to_static_via_mut_ref.stderr delete mode 100644 src/test/ui/generic-associated-types/variance_constraints.rs delete mode 100644 src/test/ui/hygiene/no_implicit_prelude-2021.rs delete mode 100644 src/test/ui/label/label_misspelled_2.rs delete mode 100644 src/test/ui/label/label_misspelled_2.stderr delete mode 100644 src/test/ui/lint/dead-code/const-and-self.stderr delete mode 100644 src/test/ui/mir/issue-80742.rs delete mode 100644 src/test/ui/mir/issue-80742.stderr delete mode 100644 src/test/ui/parser/missing-closing-angle-bracket-eq-constraint.rs delete mode 100644 src/test/ui/parser/missing-closing-angle-bracket-eq-constraint.stderr delete mode 100644 src/test/ui/parser/nested-missing-closing-angle-bracket.rs delete mode 100644 src/test/ui/parser/nested-missing-closing-angle-bracket.stderr delete mode 100644 src/test/ui/proc-macro/issue-81007-item-attrs.rs delete mode 100644 src/test/ui/proc-macro/issue-81007-item-attrs.stdout delete mode 100644 src/test/ui/resolve/crate-called-as-function.rs delete mode 100644 src/test/ui/resolve/crate-called-as-function.stderr delete mode 100644 src/test/ui/resolve/missing-in-namespace.rs delete mode 100644 src/test/ui/resolve/missing-in-namespace.stderr delete mode 100644 src/test/ui/traits/mutual-recursion-issue-75860.rs delete mode 100644 src/test/ui/traits/mutual-recursion-issue-75860.stderr diff --git a/.github/ISSUE_TEMPLATE/tracking_issue.md b/.github/ISSUE_TEMPLATE/tracking_issue.md index 0065960507179..24f4321389713 100644 --- a/.github/ISSUE_TEMPLATE/tracking_issue.md +++ b/.github/ISSUE_TEMPLATE/tracking_issue.md @@ -5,8 +5,6 @@ title: Tracking Issue for XXX labels: C-tracking-issue --- $DIR/lint-tool-test.rs:9:23 | LL | #![cfg_attr(foo, warn(test_lint))] @@ -6,13 +6,13 @@ LL | #![cfg_attr(foo, warn(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. +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:13: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. +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:29:9 | LL | #[allow(test_group)] @@ -26,19 +26,19 @@ 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. +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:9:23 | LL | #![cfg_attr(foo, warn(test_lint))] | ^^^^^^^^^ help: change it to: `clippy::test_lint` -warning: lint name `clippy_group` is deprecated and may not have an effect in the future. +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:13: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. +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:29:9 | LL | #[allow(test_group)] @@ -52,13 +52,13 @@ LL | #![plugin(lint_tool_test)] | = note: `#[warn(deprecated)]` on by default -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. Also `cfg_attr(cargo-clippy)` won't be necessary anymore --> $DIR/lint-tool-test.rs:9:23 | LL | #![cfg_attr(foo, warn(test_lint))] | ^^^^^^^^^ help: change it to: `clippy::test_lint` -warning: lint name `clippy_group` is deprecated and may not have an effect in the future. +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:13:9 | LL | #![deny(clippy_group)] @@ -90,7 +90,7 @@ LL | #![deny(clippy_group)] | ^^^^^^^^^^^^ = note: `#[deny(clippy::test_group)]` implied by `#[deny(clippy::group)]` -warning: lint name `test_group` is deprecated and may not have an effect in the future. +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:29:9 | LL | #[allow(test_group)] diff --git a/src/test/ui/ast-json/ast-json-noexpand-output.stdout b/src/test/ui/ast-json/ast-json-noexpand-output.stdout index 02342af8dc53e..9c29a5f2337cd 100644 --- a/src/test/ui/ast-json/ast-json-noexpand-output.stdout +++ b/src/test/ui/ast-json/ast-json-noexpand-output.stdout @@ -1 +1 @@ -{"module":{"inner":{"lo":0,"hi":0},"unsafety":"No","items":[{"attrs":[],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"core","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null}],"inline":true},"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"crate_type","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":{"variant":"Eq","fields":[{"lo":0,"hi":0},{"kind":{"variant":"Interpolated","fields":[{"variant":"NtExpr","fields":[{"id":0,"kind":{"variant":"Lit","fields":[{"token":{"kind":"Str","symbol":"lib","suffix":null},"kind":{"variant":"Str","fields":["lib","Cooked"]},"span":{"lo":0,"hi":0}}]},"span":{"lo":0,"hi":0},"attrs":{"0":null},"tokens":{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}}]}]},"span":{"lo":0,"hi":0}}]},"tokens":null},{"0":[[{"variant":"Token","fields":[{"kind":"Pound","span":{"lo":0,"hi":0}}]},"Joint"],[{"variant":"Token","fields":[{"kind":"Not","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Delimited","fields":[{"open":{"lo":0,"hi":0},"close":{"lo":0,"hi":0}},"Bracket",{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["crate_type",false]},"span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":"Eq","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}]},"Alone"]]}]},"id":null,"style":"Inner","span":{"lo":0,"hi":0}}],"span":{"lo":0,"hi":0},"proc_macros":[]} +{"module":{"inner":{"lo":0,"hi":0},"unsafety":"No","items":[{"attrs":[],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"core","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null}],"inline":true},"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"crate_type","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":{"variant":"Eq","fields":[{"lo":0,"hi":0},{"kind":{"variant":"Interpolated","fields":[{"variant":"NtExpr","fields":[{"id":0,"kind":{"variant":"Lit","fields":[{"token":{"kind":"Str","symbol":"lib","suffix":null},"kind":{"variant":"Str","fields":["lib","Cooked"]},"span":{"lo":0,"hi":0}}]},"span":{"lo":0,"hi":0},"attrs":{"0":null},"tokens":null}]}]},"span":{"lo":0,"hi":0}}]},"tokens":null},{"0":[[{"variant":"Token","fields":[{"kind":"Pound","span":{"lo":0,"hi":0}}]},"Joint"],[{"variant":"Token","fields":[{"kind":"Not","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Delimited","fields":[{"open":{"lo":0,"hi":0},"close":{"lo":0,"hi":0}},"Bracket",{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["crate_type",false]},"span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":"Eq","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}]},"Alone"]]}]},"id":null,"style":"Inner","span":{"lo":0,"hi":0}}],"span":{"lo":0,"hi":0},"proc_macros":[]} diff --git a/src/test/ui/ast-json/ast-json-output.stdout b/src/test/ui/ast-json/ast-json-output.stdout index 235f39c567b8e..cccd51985dc83 100644 --- a/src/test/ui/ast-json/ast-json-output.stdout +++ b/src/test/ui/ast-json/ast-json-output.stdout @@ -1 +1 @@ -{"module":{"inner":{"lo":0,"hi":0},"unsafety":"No","items":[{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"prelude_import","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":"Empty","tokens":null},null]},"id":null,"style":"Outer","span":{"lo":0,"hi":0}}],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"","span":{"lo":0,"hi":0}},"kind":{"variant":"Use","fields":[{"prefix":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"{{root}}","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"std","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"prelude","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"v1","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"kind":"Glob","span":{"lo":0,"hi":0}}]},"tokens":null},{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"macro_use","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":"Empty","tokens":null},null]},"id":null,"style":"Outer","span":{"lo":0,"hi":0}}],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"std","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null},{"attrs":[],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"core","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null}],"inline":true},"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"crate_type","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":{"variant":"Eq","fields":[{"lo":0,"hi":0},{"kind":{"variant":"Interpolated","fields":[{"variant":"NtExpr","fields":[{"id":0,"kind":{"variant":"Lit","fields":[{"token":{"kind":"Str","symbol":"lib","suffix":null},"kind":{"variant":"Str","fields":["lib","Cooked"]},"span":{"lo":0,"hi":0}}]},"span":{"lo":0,"hi":0},"attrs":{"0":null},"tokens":{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}}]}]},"span":{"lo":0,"hi":0}}]},"tokens":null},{"0":[[{"variant":"Token","fields":[{"kind":"Pound","span":{"lo":0,"hi":0}}]},"Joint"],[{"variant":"Token","fields":[{"kind":"Not","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Delimited","fields":[{"open":{"lo":0,"hi":0},"close":{"lo":0,"hi":0}},"Bracket",{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["crate_type",false]},"span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":"Eq","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}]},"Alone"]]}]},"id":null,"style":"Inner","span":{"lo":0,"hi":0}}],"span":{"lo":0,"hi":0},"proc_macros":[]} +{"module":{"inner":{"lo":0,"hi":0},"unsafety":"No","items":[{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"prelude_import","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":"Empty","tokens":null},null]},"id":null,"style":"Outer","span":{"lo":0,"hi":0}}],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"","span":{"lo":0,"hi":0}},"kind":{"variant":"Use","fields":[{"prefix":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"{{root}}","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"std","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"prelude","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"v1","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"kind":"Glob","span":{"lo":0,"hi":0}}]},"tokens":null},{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"macro_use","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":"Empty","tokens":null},null]},"id":null,"style":"Outer","span":{"lo":0,"hi":0}}],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"std","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null},{"attrs":[],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"core","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null}],"inline":true},"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"crate_type","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":{"variant":"Eq","fields":[{"lo":0,"hi":0},{"kind":{"variant":"Interpolated","fields":[{"variant":"NtExpr","fields":[{"id":0,"kind":{"variant":"Lit","fields":[{"token":{"kind":"Str","symbol":"lib","suffix":null},"kind":{"variant":"Str","fields":["lib","Cooked"]},"span":{"lo":0,"hi":0}}]},"span":{"lo":0,"hi":0},"attrs":{"0":null},"tokens":null}]}]},"span":{"lo":0,"hi":0}}]},"tokens":null},{"0":[[{"variant":"Token","fields":[{"kind":"Pound","span":{"lo":0,"hi":0}}]},"Joint"],[{"variant":"Token","fields":[{"kind":"Not","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Delimited","fields":[{"open":{"lo":0,"hi":0},"close":{"lo":0,"hi":0}},"Bracket",{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["crate_type",false]},"span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":"Eq","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}]},"Alone"]]}]},"id":null,"style":"Inner","span":{"lo":0,"hi":0}}],"span":{"lo":0,"hi":0},"proc_macros":[]} diff --git a/src/test/ui/attributes/key-value-non-ascii.rs b/src/test/ui/attributes/key-value-non-ascii.rs deleted file mode 100644 index 91c917e7db56f..0000000000000 --- a/src/test/ui/attributes/key-value-non-ascii.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![feature(rustc_attrs)] - -#[rustc_dummy = b"ffi.rs"] //~ ERROR byte constant must be ASCII -fn main() {} diff --git a/src/test/ui/attributes/key-value-non-ascii.stderr b/src/test/ui/attributes/key-value-non-ascii.stderr deleted file mode 100644 index 3e082139f895b..0000000000000 --- a/src/test/ui/attributes/key-value-non-ascii.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: byte constant must be ASCII. Use a \xHH escape for a non-ASCII byte - --> $DIR/key-value-non-ascii.rs:3:19 - | -LL | #[rustc_dummy = b"ffi.rs"] - | ^ - -error: aborting due to previous error - diff --git a/src/test/ui/check-static-immutable-mut-slices.rs b/src/test/ui/check-static-immutable-mut-slices.rs index 8f9680778aa03..3be02f6a0f674 100644 --- a/src/test/ui/check-static-immutable-mut-slices.rs +++ b/src/test/ui/check-static-immutable-mut-slices.rs @@ -1,6 +1,6 @@ // Checks that immutable static items can't have mutable slices static TEST: &'static mut [isize] = &mut []; -//~^ ERROR mutable references are not allowed +//~^ ERROR mutable references are not allowed in statics pub fn main() { } diff --git a/src/test/ui/check-static-immutable-mut-slices.stderr b/src/test/ui/check-static-immutable-mut-slices.stderr index a32a94c1315ab..9ffbb483d139d 100644 --- a/src/test/ui/check-static-immutable-mut-slices.stderr +++ b/src/test/ui/check-static-immutable-mut-slices.stderr @@ -1,8 +1,8 @@ -error[E0764]: mutable references are not allowed in the final value of statics +error[E0764]: mutable references are not allowed in statics --> $DIR/check-static-immutable-mut-slices.rs:3:37 | LL | static TEST: &'static mut [isize] = &mut []; - | ^^^^^^^ + | ^^^^^^^ `&mut` is only allowed in `const fn` error: aborting due to previous error diff --git a/src/test/ui/closures/local-type-mix.rs b/src/test/ui/closures/local-type-mix.rs deleted file mode 100644 index 006e6f490f06b..0000000000000 --- a/src/test/ui/closures/local-type-mix.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Check that using the parameter name in its type does not ICE. -// edition:2018 - -#![feature(async_closure)] - -fn main() { - let _ = |x: x| x; //~ ERROR expected type - let _ = |x: bool| -> x { x }; //~ ERROR expected type - let _ = async move |x: x| x; //~ ERROR expected type - let _ = async move |x: bool| -> x { x }; //~ ERROR expected type -} - -fn foo(x: x) {} //~ ERROR expected type -fn foo_ret(x: bool) -> x {} //~ ERROR expected type - -async fn async_foo(x: x) {} //~ ERROR expected type -async fn async_foo_ret(x: bool) -> x {} //~ ERROR expected type diff --git a/src/test/ui/closures/local-type-mix.stderr b/src/test/ui/closures/local-type-mix.stderr deleted file mode 100644 index 68c320a065d57..0000000000000 --- a/src/test/ui/closures/local-type-mix.stderr +++ /dev/null @@ -1,51 +0,0 @@ -error[E0573]: expected type, found local variable `x` - --> $DIR/local-type-mix.rs:7:17 - | -LL | let _ = |x: x| x; - | ^ not a type - -error[E0573]: expected type, found local variable `x` - --> $DIR/local-type-mix.rs:8:26 - | -LL | let _ = |x: bool| -> x { x }; - | ^ not a type - -error[E0573]: expected type, found local variable `x` - --> $DIR/local-type-mix.rs:9:28 - | -LL | let _ = async move |x: x| x; - | ^ not a type - -error[E0573]: expected type, found local variable `x` - --> $DIR/local-type-mix.rs:10:37 - | -LL | let _ = async move |x: bool| -> x { x }; - | ^ not a type - -error[E0573]: expected type, found local variable `x` - --> $DIR/local-type-mix.rs:13:11 - | -LL | fn foo(x: x) {} - | ^ not a type - -error[E0573]: expected type, found local variable `x` - --> $DIR/local-type-mix.rs:14:24 - | -LL | fn foo_ret(x: bool) -> x {} - | ^ not a type - -error[E0573]: expected type, found local variable `x` - --> $DIR/local-type-mix.rs:16:23 - | -LL | async fn async_foo(x: x) {} - | ^ not a type - -error[E0573]: expected type, found local variable `x` - --> $DIR/local-type-mix.rs:17:36 - | -LL | async fn async_foo_ret(x: bool) -> x {} - | ^ not a type - -error: aborting due to 8 previous errors - -For more information about this error, try `rustc --explain E0573`. diff --git a/src/test/ui/command/command-setgroups.rs b/src/test/ui/command/command-setgroups.rs deleted file mode 100644 index 28f2bfdd3a776..0000000000000 --- a/src/test/ui/command/command-setgroups.rs +++ /dev/null @@ -1,26 +0,0 @@ -// run-pass -// ignore-windows - this is a unix-specific test -// ignore-cloudabi -// ignore-emscripten -// ignore-sgx - -#![feature(rustc_private)] -#![feature(setgroups)] - -extern crate libc; -use std::process::Command; -use std::os::unix::process::CommandExt; - -fn main() { - #[cfg(unix)] - run() -} - -#[cfg(unix)] -fn run() { - let max_ngroups = unsafe { libc::sysconf(libc::_SC_NGROUPS_MAX) }; - let max_ngroups = max_ngroups as u32 + 1; - let vec: Vec = (0..max_ngroups).collect(); - let p = Command::new("/bin/id").groups(&vec[..]).spawn(); - assert!(p.is_err()); -} diff --git a/src/test/ui/const_prop/inline_spans_lint_attribute.rs b/src/test/ui/const_prop/inline_spans_lint_attribute.rs deleted file mode 100644 index 656ff02dc67ef..0000000000000 --- a/src/test/ui/const_prop/inline_spans_lint_attribute.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Must be build-pass, because check-pass will not run const prop and thus not emit the lint anyway. -// build-pass -// compile-flags: -Zmir-opt-level=2 - -#![deny(warnings)] - -fn main() { - #[allow(arithmetic_overflow)] - let _ = add(u8::MAX, 1); -} - -#[inline(always)] -fn add(x: u8, y: u8) -> u8 { - x + y -} diff --git a/src/test/ui/consts/array-literal-index-oob.rs b/src/test/ui/consts/array-literal-index-oob.rs index 9b3f735b1f849..f36ebf38db4fe 100644 --- a/src/test/ui/consts/array-literal-index-oob.rs +++ b/src/test/ui/consts/array-literal-index-oob.rs @@ -6,4 +6,6 @@ fn main() { &{ [1, 2, 3][4] }; //~^ WARN operation will panic + //~| WARN reaching this expression at runtime will panic or abort + //~| WARN erroneous constant used [const_err] } diff --git a/src/test/ui/consts/array-literal-index-oob.stderr b/src/test/ui/consts/array-literal-index-oob.stderr index f96b8d48b3e7c..5916ea6d323e6 100644 --- a/src/test/ui/consts/array-literal-index-oob.stderr +++ b/src/test/ui/consts/array-literal-index-oob.stderr @@ -10,5 +10,25 @@ note: the lint level is defined here LL | #![warn(const_err, unconditional_panic)] | ^^^^^^^^^^^^^^^^^^^ -warning: 1 warning emitted +warning: reaching this expression at runtime will panic or abort + --> $DIR/array-literal-index-oob.rs:7:8 + | +LL | &{ [1, 2, 3][4] }; + | ---^^^^^^^^^^^^-- + | | + | indexing out of bounds: the len is 3 but the index is 4 + | +note: the lint level is defined here + --> $DIR/array-literal-index-oob.rs:4:9 + | +LL | #![warn(const_err, unconditional_panic)] + | ^^^^^^^^^ + +warning: erroneous constant used + --> $DIR/array-literal-index-oob.rs:7:5 + | +LL | &{ [1, 2, 3][4] }; + | ^^^^^^^^^^^^^^^^^ referenced constant has errors + +warning: 3 warnings emitted diff --git a/src/test/ui/consts/const-address-of-mut.stderr b/src/test/ui/consts/const-address-of-mut.stderr index 60cdcc7df7449..ec2dac5a7d16f 100644 --- a/src/test/ui/consts/const-address-of-mut.stderr +++ b/src/test/ui/consts/const-address-of-mut.stderr @@ -1,29 +1,20 @@ -error[E0658]: raw mutable references are not allowed in constants +error[E0764]: raw mutable references are not allowed in constants --> $DIR/const-address-of-mut.rs:3:32 | LL | const A: () = { let mut x = 2; &raw mut x; }; - | ^^^^^^^^^^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + | ^^^^^^^^^^ `&raw mut` is only allowed in `const fn` -error[E0658]: raw mutable references are not allowed in statics +error[E0764]: raw mutable references are not allowed in statics --> $DIR/const-address-of-mut.rs:5:33 | LL | static B: () = { let mut x = 2; &raw mut x; }; - | ^^^^^^^^^^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + | ^^^^^^^^^^ `&raw mut` is only allowed in `const fn` -error[E0658]: raw mutable references are not allowed in statics +error[E0764]: raw mutable references are not allowed in statics --> $DIR/const-address-of-mut.rs:7:37 | LL | static mut C: () = { let mut x = 2; &raw mut x; }; - | ^^^^^^^^^^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + | ^^^^^^^^^^ `&raw mut` is only allowed in `const fn` error[E0658]: raw mutable references are not allowed in constant functions --> $DIR/const-address-of-mut.rs:11:13 @@ -36,4 +27,5 @@ LL | let y = &raw mut x; error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors have detailed explanations: E0658, E0764. +For more information about an error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/const-eval/const-eval-query-stack.rs b/src/test/ui/consts/const-eval/const-eval-query-stack.rs index 39803c8f257e0..8a6f7de1c9fbd 100644 --- a/src/test/ui/consts/const-eval/const-eval-query-stack.rs +++ b/src/test/ui/consts/const-eval/const-eval-query-stack.rs @@ -1,5 +1,4 @@ -//~ERROR constructed but no error reported -// compile-flags: -Ztreat-err-as-bug=2 +// compile-flags: -Ztreat-err-as-bug // build-fail // failure-status: 101 // rustc-env:RUST_BACKTRACE=1 @@ -16,11 +15,8 @@ #![allow(unconditional_panic)] -#[warn(const_err)] -const X: i32 = 1 / 0; //~WARN any use of this value will cause an error - fn main() { - let x: &'static i32 = &X; - //~^ ERROR evaluation of constant expression failed + let x: &'static i32 = &(1 / 0); + //~^ ERROR reaching this expression at runtime will panic or abort [const_err] println!("x={}", x); } diff --git a/src/test/ui/consts/const-eval/const-eval-query-stack.stderr b/src/test/ui/consts/const-eval/const-eval-query-stack.stderr index 0016d301e598c..8c57fd37e88f6 100644 --- a/src/test/ui/consts/const-eval/const-eval-query-stack.stderr +++ b/src/test/ui/consts/const-eval/const-eval-query-stack.stderr @@ -1,26 +1,18 @@ -warning: any use of this value will cause an error - --> $DIR/const-eval-query-stack.rs:20:16 +error: reaching this expression at runtime will panic or abort + --> $DIR/const-eval-query-stack.rs:19:28 | -LL | const X: i32 = 1 / 0; - | ---------------^^^^^- - | | - | attempt to divide `1_i32` by zero - | -note: the lint level is defined here - --> $DIR/const-eval-query-stack.rs:19:8 +LL | let x: &'static i32 = &(1 / 0); + | -^^^^^^^ + | | + | dividing by zero | -LL | #[warn(const_err)] - | ^^^^^^^^^ + = note: `#[deny(const_err)]` on by default -error[E0080]: evaluation of constant expression failed - --> $DIR/const-eval-query-stack.rs:23:27 - | -LL | let x: &'static i32 = &X; - | ^- - | | - | referenced constant has errors query stack during panic: -#0 [normalize_generic_arg_after_erasing_regions] normalizing `main::promoted[1]` -#1 [optimized_mir] optimizing MIR for `main` -#2 [collect_and_partition_mono_items] collect_and_partition_mono_items +#0 [eval_to_allocation_raw] const-evaluating + checking `main::promoted[1]` +#1 [eval_to_const_value_raw] simplifying constant for the type system `main::promoted[1]` +#2 [eval_to_const_value_raw] simplifying constant for the type system `main::promoted[1]` +#3 [normalize_generic_arg_after_erasing_regions] normalizing `main::promoted[1]` +#4 [optimized_mir] optimizing MIR for `main` +#5 [collect_and_partition_mono_items] collect_and_partition_mono_items end of query stack diff --git a/src/test/ui/consts/const-eval/issue-65394.stderr b/src/test/ui/consts/const-eval/issue-65394.stderr index ec229d7f53a0f..771d368d78391 100644 --- a/src/test/ui/consts/const-eval/issue-65394.stderr +++ b/src/test/ui/consts/const-eval/issue-65394.stderr @@ -1,11 +1,8 @@ -error[E0658]: mutable references are not allowed in constants +error[E0764]: mutable references are not allowed in constants --> $DIR/issue-65394.rs:8:13 | LL | let r = &mut x; - | ^^^^^^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + | ^^^^^^ `&mut` is only allowed in `const fn` error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/issue-65394.rs:7:9 @@ -18,5 +15,5 @@ LL | }; error: aborting due to 2 previous errors -Some errors have detailed explanations: E0493, E0658. +Some errors have detailed explanations: E0493, E0764. For more information about an error, try `rustc --explain E0493`. diff --git a/src/test/ui/consts/const-eval/promoted_errors.noopt.stderr b/src/test/ui/consts/const-eval/promoted_errors.noopt.stderr index 1cd1be5309b90..ce83d8e9bb0c9 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.noopt.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors.noopt.stderr @@ -1,21 +1,38 @@ -warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:13:5 - | -LL | 0 - 1 - | ^^^^^ - | | - | attempt to compute `0_u32 - 1_u32`, which would overflow - | inside `overflow` at $DIR/promoted_errors.rs:13:5 - | inside `X` at $DIR/promoted_errors.rs:31:29 -... -LL | / const X: () = { -LL | | let _x: &'static u32 = &overflow(); -LL | | -LL | | let _x: &'static i32 = &div_by_zero1(); -... | -LL | | let _x: &'static i32 = &oob(); -LL | | }; - | |__- +warning: this arithmetic operation will overflow + --> $DIR/promoted_errors.rs:12:20 + | +LL | println!("{}", 0u32 - 1); + | ^^^^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow + | +note: the lint level is defined here + --> $DIR/promoted_errors.rs:9:20 + | +LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] + | ^^^^^^^^^^^^^^^^^^^ + +warning: this arithmetic operation will overflow + --> $DIR/promoted_errors.rs:14:14 + | +LL | let _x = 0u32 - 1; + | ^^^^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow + +warning: this operation will panic at runtime + --> $DIR/promoted_errors.rs:16:20 + | +LL | println!("{}", 1 / (1 - 1)); + | ^^^^^^^^^^^ attempt to divide `1_i32` by zero + | +note: the lint level is defined here + --> $DIR/promoted_errors.rs:9:41 + | +LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] + | ^^^^^^^^^^^^^^^^^^^ + +warning: reaching this expression at runtime will panic or abort + --> $DIR/promoted_errors.rs:16:20 + | +LL | println!("{}", 1 / (1 - 1)); + | ^^^^^^^^^^^ dividing by zero | note: the lint level is defined here --> $DIR/promoted_errors.rs:9:9 @@ -23,18 +40,41 @@ note: the lint level is defined here LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] | ^^^^^^^^^ -warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:31:28 +warning: erroneous constant used + --> $DIR/promoted_errors.rs:16:20 + | +LL | println!("{}", 1 / (1 - 1)); + | ^^^^^^^^^^^ referenced constant has errors + +warning: this operation will panic at runtime + --> $DIR/promoted_errors.rs:20:14 + | +LL | let _x = 1 / (1 - 1); + | ^^^^^^^^^^^ attempt to divide `1_i32` by zero + +warning: this operation will panic at runtime + --> $DIR/promoted_errors.rs:22:20 + | +LL | println!("{}", 1 / (false as u32)); + | ^^^^^^^^^^^^^^^^^^ attempt to divide `1_u32` by zero + +warning: reaching this expression at runtime will panic or abort + --> $DIR/promoted_errors.rs:22:20 + | +LL | println!("{}", 1 / (false as u32)); + | ^^^^^^^^^^^^^^^^^^ dividing by zero + +warning: erroneous constant used + --> $DIR/promoted_errors.rs:22:20 + | +LL | println!("{}", 1 / (false as u32)); + | ^^^^^^^^^^^^^^^^^^ referenced constant has errors + +warning: this operation will panic at runtime + --> $DIR/promoted_errors.rs:26:14 | -LL | / const X: () = { -LL | | let _x: &'static u32 = &overflow(); - | | ^^^^^^^^^^^ referenced constant has errors -LL | | -LL | | let _x: &'static i32 = &div_by_zero1(); -... | -LL | | let _x: &'static i32 = &oob(); -LL | | }; - | |__- +LL | let _x = 1 / (false as u32); + | ^^^^^^^^^^^^^^^^^^ attempt to divide `1_u32` by zero -warning: 2 warnings emitted +warning: 10 warnings emitted diff --git a/src/test/ui/consts/const-eval/promoted_errors.opt.stderr b/src/test/ui/consts/const-eval/promoted_errors.opt.stderr index ca62e21b61385..2c66b175cfc2b 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.opt.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors.opt.stderr @@ -1,21 +1,32 @@ -warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:17:5 - | -LL | 1 / 0 - | ^^^^^ - | | - | attempt to divide `1_i32` by zero - | inside `div_by_zero1` at $DIR/promoted_errors.rs:17:5 - | inside `X` at $DIR/promoted_errors.rs:33:29 -... -LL | / const X: () = { -LL | | let _x: &'static u32 = &overflow(); -LL | | -LL | | let _x: &'static i32 = &div_by_zero1(); -... | -LL | | let _x: &'static i32 = &oob(); -LL | | }; - | |__- +warning: this arithmetic operation will overflow + --> $DIR/promoted_errors.rs:14:14 + | +LL | let _x = 0u32 - 1; + | ^^^^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow + | +note: the lint level is defined here + --> $DIR/promoted_errors.rs:9:20 + | +LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] + | ^^^^^^^^^^^^^^^^^^^ + +warning: this operation will panic at runtime + --> $DIR/promoted_errors.rs:16:20 + | +LL | println!("{}", 1 / (1 - 1)); + | ^^^^^^^^^^^ attempt to divide `1_i32` by zero + | +note: the lint level is defined here + --> $DIR/promoted_errors.rs:9:41 + | +LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] + | ^^^^^^^^^^^^^^^^^^^ + +warning: reaching this expression at runtime will panic or abort + --> $DIR/promoted_errors.rs:16:20 + | +LL | println!("{}", 1 / (1 - 1)); + | ^^^^^^^^^^^ dividing by zero | note: the lint level is defined here --> $DIR/promoted_errors.rs:9:9 @@ -23,18 +34,41 @@ note: the lint level is defined here LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] | ^^^^^^^^^ -warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:33:28 +warning: erroneous constant used + --> $DIR/promoted_errors.rs:16:20 + | +LL | println!("{}", 1 / (1 - 1)); + | ^^^^^^^^^^^ referenced constant has errors + +warning: this operation will panic at runtime + --> $DIR/promoted_errors.rs:20:14 + | +LL | let _x = 1 / (1 - 1); + | ^^^^^^^^^^^ attempt to divide `1_i32` by zero + +warning: this operation will panic at runtime + --> $DIR/promoted_errors.rs:22:20 + | +LL | println!("{}", 1 / (false as u32)); + | ^^^^^^^^^^^^^^^^^^ attempt to divide `1_u32` by zero + +warning: reaching this expression at runtime will panic or abort + --> $DIR/promoted_errors.rs:22:20 + | +LL | println!("{}", 1 / (false as u32)); + | ^^^^^^^^^^^^^^^^^^ dividing by zero + +warning: erroneous constant used + --> $DIR/promoted_errors.rs:22:20 + | +LL | println!("{}", 1 / (false as u32)); + | ^^^^^^^^^^^^^^^^^^ referenced constant has errors + +warning: this operation will panic at runtime + --> $DIR/promoted_errors.rs:26:14 | -LL | / const X: () = { -LL | | let _x: &'static u32 = &overflow(); -LL | | -LL | | let _x: &'static i32 = &div_by_zero1(); - | | ^^^^^^^^^^^^^^^ referenced constant has errors -... | -LL | | let _x: &'static i32 = &oob(); -LL | | }; - | |__- +LL | let _x = 1 / (false as u32); + | ^^^^^^^^^^^^^^^^^^ attempt to divide `1_u32` by zero -warning: 2 warnings emitted +warning: 9 warnings emitted diff --git a/src/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr b/src/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr index 1cd1be5309b90..ce83d8e9bb0c9 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr @@ -1,21 +1,38 @@ -warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:13:5 - | -LL | 0 - 1 - | ^^^^^ - | | - | attempt to compute `0_u32 - 1_u32`, which would overflow - | inside `overflow` at $DIR/promoted_errors.rs:13:5 - | inside `X` at $DIR/promoted_errors.rs:31:29 -... -LL | / const X: () = { -LL | | let _x: &'static u32 = &overflow(); -LL | | -LL | | let _x: &'static i32 = &div_by_zero1(); -... | -LL | | let _x: &'static i32 = &oob(); -LL | | }; - | |__- +warning: this arithmetic operation will overflow + --> $DIR/promoted_errors.rs:12:20 + | +LL | println!("{}", 0u32 - 1); + | ^^^^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow + | +note: the lint level is defined here + --> $DIR/promoted_errors.rs:9:20 + | +LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] + | ^^^^^^^^^^^^^^^^^^^ + +warning: this arithmetic operation will overflow + --> $DIR/promoted_errors.rs:14:14 + | +LL | let _x = 0u32 - 1; + | ^^^^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow + +warning: this operation will panic at runtime + --> $DIR/promoted_errors.rs:16:20 + | +LL | println!("{}", 1 / (1 - 1)); + | ^^^^^^^^^^^ attempt to divide `1_i32` by zero + | +note: the lint level is defined here + --> $DIR/promoted_errors.rs:9:41 + | +LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] + | ^^^^^^^^^^^^^^^^^^^ + +warning: reaching this expression at runtime will panic or abort + --> $DIR/promoted_errors.rs:16:20 + | +LL | println!("{}", 1 / (1 - 1)); + | ^^^^^^^^^^^ dividing by zero | note: the lint level is defined here --> $DIR/promoted_errors.rs:9:9 @@ -23,18 +40,41 @@ note: the lint level is defined here LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] | ^^^^^^^^^ -warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:31:28 +warning: erroneous constant used + --> $DIR/promoted_errors.rs:16:20 + | +LL | println!("{}", 1 / (1 - 1)); + | ^^^^^^^^^^^ referenced constant has errors + +warning: this operation will panic at runtime + --> $DIR/promoted_errors.rs:20:14 + | +LL | let _x = 1 / (1 - 1); + | ^^^^^^^^^^^ attempt to divide `1_i32` by zero + +warning: this operation will panic at runtime + --> $DIR/promoted_errors.rs:22:20 + | +LL | println!("{}", 1 / (false as u32)); + | ^^^^^^^^^^^^^^^^^^ attempt to divide `1_u32` by zero + +warning: reaching this expression at runtime will panic or abort + --> $DIR/promoted_errors.rs:22:20 + | +LL | println!("{}", 1 / (false as u32)); + | ^^^^^^^^^^^^^^^^^^ dividing by zero + +warning: erroneous constant used + --> $DIR/promoted_errors.rs:22:20 + | +LL | println!("{}", 1 / (false as u32)); + | ^^^^^^^^^^^^^^^^^^ referenced constant has errors + +warning: this operation will panic at runtime + --> $DIR/promoted_errors.rs:26:14 | -LL | / const X: () = { -LL | | let _x: &'static u32 = &overflow(); - | | ^^^^^^^^^^^ referenced constant has errors -LL | | -LL | | let _x: &'static i32 = &div_by_zero1(); -... | -LL | | let _x: &'static i32 = &oob(); -LL | | }; - | |__- +LL | let _x = 1 / (false as u32); + | ^^^^^^^^^^^^^^^^^^ attempt to divide `1_u32` by zero -warning: 2 warnings emitted +warning: 10 warnings emitted diff --git a/src/test/ui/consts/const-eval/promoted_errors.rs b/src/test/ui/consts/const-eval/promoted_errors.rs index a2136c8d09be4..142ce75eebc80 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.rs +++ b/src/test/ui/consts/const-eval/promoted_errors.rs @@ -8,34 +8,21 @@ #![warn(const_err, arithmetic_overflow, unconditional_panic)] -// The only way to have promoteds that fail is in `const fn` called from `const`/`static`. -const fn overflow() -> u32 { - 0 - 1 - //[opt_with_overflow_checks,noopt]~^ WARN any use of this value will cause an error -} -const fn div_by_zero1() -> i32 { - 1 / 0 - //[opt]~^ WARN any use of this value will cause an error -} -const fn div_by_zero2() -> i32 { - 1 / (1-1) -} -const fn div_by_zero3() -> i32 { - 1 / (false as i32) -} -const fn oob() -> i32 { - [1,2,3][4] -} - -const X: () = { - let _x: &'static u32 = &overflow(); - //[opt_with_overflow_checks,noopt]~^ WARN any use of this value will cause an error - let _x: &'static i32 = &div_by_zero1(); - //[opt]~^ WARN any use of this value will cause an error - let _x: &'static i32 = &div_by_zero2(); - let _x: &'static i32 = &div_by_zero3(); - let _x: &'static i32 = &oob(); -}; - fn main() { + println!("{}", 0u32 - 1); + //[opt_with_overflow_checks,noopt]~^ WARN [arithmetic_overflow] + let _x = 0u32 - 1; + //~^ WARN [arithmetic_overflow] + println!("{}", 1 / (1 - 1)); + //~^ WARN [unconditional_panic] + //~| WARN panic or abort [const_err] + //~| WARN erroneous constant used [const_err] + let _x = 1 / (1 - 1); + //~^ WARN [unconditional_panic] + println!("{}", 1 / (false as u32)); + //~^ WARN [unconditional_panic] + //~| WARN panic or abort [const_err] + //~| WARN erroneous constant used [const_err] + let _x = 1 / (false as u32); + //~^ WARN [unconditional_panic] } diff --git a/src/test/ui/consts/const-multi-ref.stderr b/src/test/ui/consts/const-multi-ref.stderr index dd5cadfe2951e..c0a320d46cbf9 100644 --- a/src/test/ui/consts/const-multi-ref.stderr +++ b/src/test/ui/consts/const-multi-ref.stderr @@ -1,11 +1,8 @@ -error[E0658]: mutable references are not allowed in constants +error[E0764]: mutable references are not allowed in constants --> $DIR/const-multi-ref.rs:6:13 | LL | let p = &mut a; - | ^^^^^^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + | ^^^^^^ `&mut` is only allowed in `const fn` error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability --> $DIR/const-multi-ref.rs:16:13 @@ -18,4 +15,5 @@ LL | let p = &a; error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors have detailed explanations: E0658, E0764. +For more information about an error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/const-mut-refs/const_mut_address_of.rs b/src/test/ui/consts/const-mut-refs/const_mut_address_of.rs index 24df647f05b7e..5819daa817af0 100644 --- a/src/test/ui/consts/const-mut-refs/const_mut_address_of.rs +++ b/src/test/ui/consts/const-mut-refs/const_mut_address_of.rs @@ -1,4 +1,3 @@ -// check-pass #![feature(const_mut_refs)] #![feature(const_fn)] #![feature(raw_ref_op)] @@ -23,7 +22,9 @@ const fn baz(foo: &mut Foo)-> *mut usize { const _: () = { foo().bar(); + //~^ ERROR mutable references are not allowed in constants baz(&mut foo()); + //~^ ERROR mutable references are not allowed in constants }; fn main() {} diff --git a/src/test/ui/consts/const-mut-refs/const_mut_address_of.stderr b/src/test/ui/consts/const-mut-refs/const_mut_address_of.stderr new file mode 100644 index 0000000000000..2214ce6ee1c87 --- /dev/null +++ b/src/test/ui/consts/const-mut-refs/const_mut_address_of.stderr @@ -0,0 +1,15 @@ +error[E0764]: mutable references are not allowed in constants + --> $DIR/const_mut_address_of.rs:24:5 + | +LL | foo().bar(); + | ^^^^^ `&mut` is only allowed in `const fn` + +error[E0764]: mutable references are not allowed in constants + --> $DIR/const_mut_address_of.rs:26:9 + | +LL | baz(&mut foo()); + | ^^^^^^^^^^ `&mut` is only allowed in `const fn` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0764`. diff --git a/src/test/ui/consts/const-mut-refs/const_mut_refs.rs b/src/test/ui/consts/const-mut-refs/const_mut_refs.rs index 544458dfcd8bb..9099d5a1b8ea6 100644 --- a/src/test/ui/consts/const-mut-refs/const_mut_refs.rs +++ b/src/test/ui/consts/const-mut-refs/const_mut_refs.rs @@ -1,4 +1,3 @@ -// check-pass #![feature(const_mut_refs)] struct Foo { @@ -30,6 +29,9 @@ const fn bazz(foo: &mut Foo) -> usize { fn main() { let _: [(); foo().bar()] = [(); 1]; + //~^ ERROR mutable references are not allowed in constants let _: [(); baz(&mut foo())] = [(); 2]; + //~^ ERROR mutable references are not allowed in constants let _: [(); bazz(&mut foo())] = [(); 3]; + //~^ ERROR mutable references are not allowed in constants } diff --git a/src/test/ui/consts/const-mut-refs/const_mut_refs.stderr b/src/test/ui/consts/const-mut-refs/const_mut_refs.stderr new file mode 100644 index 0000000000000..4ca7b128b7c4b --- /dev/null +++ b/src/test/ui/consts/const-mut-refs/const_mut_refs.stderr @@ -0,0 +1,21 @@ +error[E0764]: mutable references are not allowed in constants + --> $DIR/const_mut_refs.rs:31:17 + | +LL | let _: [(); foo().bar()] = [(); 1]; + | ^^^^^ `&mut` is only allowed in `const fn` + +error[E0764]: mutable references are not allowed in constants + --> $DIR/const_mut_refs.rs:33:21 + | +LL | let _: [(); baz(&mut foo())] = [(); 2]; + | ^^^^^^^^^^ `&mut` is only allowed in `const fn` + +error[E0764]: mutable references are not allowed in constants + --> $DIR/const_mut_refs.rs:35:22 + | +LL | let _: [(); bazz(&mut foo())] = [(); 3]; + | ^^^^^^^^^^ `&mut` is only allowed in `const fn` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0764`. diff --git a/src/test/ui/consts/const-mut-refs/mut_ref_in_final.rs b/src/test/ui/consts/const-mut-refs/mut_ref_in_final.rs deleted file mode 100644 index 166ba20f124e6..0000000000000 --- a/src/test/ui/consts/const-mut-refs/mut_ref_in_final.rs +++ /dev/null @@ -1,57 +0,0 @@ -#![feature(const_mut_refs)] -#![feature(const_fn)] -#![feature(raw_ref_op)] -#![feature(const_raw_ptr_deref)] - -const NULL: *mut i32 = std::ptr::null_mut(); -const A: *const i32 = &4; - -// It could be made sound to allow it to compile, -// but we do not want to allow this to compile, -// as that would be an enormous footgun in oli-obk's opinion. -const B: *mut i32 = &mut 4; //~ ERROR mutable references are not allowed - -// Ok, no actual mutable allocation exists -const B2: Option<&mut i32> = None; - -// Not ok, can't prove that no mutable allocation ends up in final value -const B3: Option<&mut i32> = Some(&mut 42); //~ ERROR temporary value dropped while borrowed - -const fn helper(x: &mut i32) -> Option<&mut i32> { Some(x) } -const B4: Option<&mut i32> = helper(&mut 42); //~ ERROR temporary value dropped while borrowed - -// Ok, because no references to mutable data exist here, since the `{}` moves -// its value and then takes a reference to that. -const C: *const i32 = &{ - let mut x = 42; - x += 3; - x -}; - -use std::cell::UnsafeCell; -struct NotAMutex(UnsafeCell); - -unsafe impl Sync for NotAMutex {} - -const FOO: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42)); -//~^ ERROR temporary value dropped while borrowed - -static FOO2: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42)); -//~^ ERROR temporary value dropped while borrowed - -static mut FOO3: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42)); -//~^ ERROR temporary value dropped while borrowed - -// `BAR` works, because `&42` promotes immediately instead of relying on -// the enclosing scope rule. -const BAR: NotAMutex<&i32> = NotAMutex(UnsafeCell::new(&42)); - -fn main() { - println!("{}", unsafe { *A }); - unsafe { *B = 4 } // Bad news - - unsafe { - **FOO.0.get() = 99; - assert_eq!(**FOO.0.get(), 99); - } -} diff --git a/src/test/ui/consts/const-mut-refs/mut_ref_in_final.stderr b/src/test/ui/consts/const-mut-refs/mut_ref_in_final.stderr deleted file mode 100644 index cbae74cce6f6b..0000000000000 --- a/src/test/ui/consts/const-mut-refs/mut_ref_in_final.stderr +++ /dev/null @@ -1,60 +0,0 @@ -error[E0764]: mutable references are not allowed in the final value of constants - --> $DIR/mut_ref_in_final.rs:12:21 - | -LL | const B: *mut i32 = &mut 4; - | ^^^^^^ - -error[E0716]: temporary value dropped while borrowed - --> $DIR/mut_ref_in_final.rs:18:40 - | -LL | const B3: Option<&mut i32> = Some(&mut 42); - | ----------^^- - | | | | - | | | temporary value is freed at the end of this statement - | | creates a temporary which is freed while still in use - | using this value as a constant requires that borrow lasts for `'static` - -error[E0716]: temporary value dropped while borrowed - --> $DIR/mut_ref_in_final.rs:21:42 - | -LL | const B4: Option<&mut i32> = helper(&mut 42); - | ------------^^- - | | | | - | | | temporary value is freed at the end of this statement - | | creates a temporary which is freed while still in use - | using this value as a constant requires that borrow lasts for `'static` - -error[E0716]: temporary value dropped while borrowed - --> $DIR/mut_ref_in_final.rs:36:65 - | -LL | const FOO: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42)); - | -------------------------------^^-- - | | | | - | | | temporary value is freed at the end of this statement - | | creates a temporary which is freed while still in use - | using this value as a constant requires that borrow lasts for `'static` - -error[E0716]: temporary value dropped while borrowed - --> $DIR/mut_ref_in_final.rs:39:67 - | -LL | static FOO2: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42)); - | -------------------------------^^-- - | | | | - | | | temporary value is freed at the end of this statement - | | creates a temporary which is freed while still in use - | using this value as a static requires that borrow lasts for `'static` - -error[E0716]: temporary value dropped while borrowed - --> $DIR/mut_ref_in_final.rs:42:71 - | -LL | static mut FOO3: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42)); - | -------------------------------^^-- - | | | | - | | | temporary value is freed at the end of this statement - | | creates a temporary which is freed while still in use - | using this value as a static requires that borrow lasts for `'static` - -error: aborting due to 6 previous errors - -Some errors have detailed explanations: E0716, E0764. -For more information about an error, try `rustc --explain E0716`. diff --git a/src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs b/src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs deleted file mode 100644 index 1e856ec0a0acc..0000000000000 --- a/src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs +++ /dev/null @@ -1,28 +0,0 @@ -#![feature(const_mut_refs)] -#![feature(const_fn)] -#![feature(raw_ref_op)] -#![feature(const_raw_ptr_deref)] - -// This file checks that our dynamic checks catch things that the static checks miss. -// We do not have static checks for these, because we do not look into function bodies. -// We treat all functions as not returning a mutable reference, because there is no way to -// do that without causing the borrow checker to complain (see the B4/helper test in -// mut_ref_in_final.rs). - -const fn helper() -> Option<&'static mut i32> { unsafe { - // Undefined behaviour (integer as pointer), who doesn't love tests like this. - // This code never gets executed, because the static checks fail before that. - Some(&mut *(42 as *mut i32)) //~ ERROR any use of this value will cause an error -} } -// The error is an evaluation error and not a validation error, so the error is reported -// directly at the site where it occurs. -const A: Option<&mut i32> = helper(); - -const fn helper2() -> Option<&'static mut i32> { unsafe { - // Undefined behaviour (dangling pointer), who doesn't love tests like this. - // This code never gets executed, because the static checks fail before that. - Some(&mut *(&mut 42 as *mut i32)) -} } -const B: Option<&mut i32> = helper2(); //~ ERROR encountered dangling pointer in final constant - -fn main() {} diff --git a/src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr b/src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr deleted file mode 100644 index 0bbf84b71bb68..0000000000000 --- a/src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error: any use of this value will cause an error - --> $DIR/mut_ref_in_final_dynamic_check.rs:15:10 - | -LL | Some(&mut *(42 as *mut i32)) - | ^^^^^^^^^^^^^^^^^^^^^^ - | | - | unable to turn bytes into a pointer - | inside `helper` at $DIR/mut_ref_in_final_dynamic_check.rs:15:10 - | inside `A` at $DIR/mut_ref_in_final_dynamic_check.rs:19:29 -... -LL | const A: Option<&mut i32> = helper(); - | ------------------------------------- - | - = note: `#[deny(const_err)]` on by default - -error: encountered dangling pointer in final constant - --> $DIR/mut_ref_in_final_dynamic_check.rs:26:1 - | -LL | const B: Option<&mut i32> = helper2(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/consts/const_let_assign3.stderr b/src/test/ui/consts/const_let_assign3.stderr index 3eac61c0ce670..dc86e178a42c3 100644 --- a/src/test/ui/consts/const_let_assign3.stderr +++ b/src/test/ui/consts/const_let_assign3.stderr @@ -7,24 +7,19 @@ LL | const fn foo(&mut self, x: u32) { = note: see issue #57349 for more information = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable -error[E0658]: mutable references are not allowed in constants +error[E0764]: mutable references are not allowed in constants --> $DIR/const_let_assign3.rs:16:5 | LL | s.foo(3); - | ^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + | ^ `&mut` is only allowed in `const fn` -error[E0658]: mutable references are not allowed in constants +error[E0764]: mutable references are not allowed in constants --> $DIR/const_let_assign3.rs:22:13 | LL | let y = &mut x; - | ^^^^^^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + | ^^^^^^ `&mut` is only allowed in `const fn` error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors have detailed explanations: E0658, E0764. +For more information about an error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/issue-17718-const-bad-values.rs b/src/test/ui/consts/issue-17718-const-bad-values.rs index 62bbb3b569c37..49023f18ddbfb 100644 --- a/src/test/ui/consts/issue-17718-const-bad-values.rs +++ b/src/test/ui/consts/issue-17718-const-bad-values.rs @@ -1,9 +1,10 @@ const C1: &'static mut [usize] = &mut []; -//~^ ERROR: mutable references are not allowed +//~^ ERROR: mutable references are not allowed in constants static mut S: usize = 3; const C2: &'static mut usize = unsafe { &mut S }; //~^ ERROR: constants cannot refer to statics //~| ERROR: constants cannot refer to statics +//~| ERROR: mutable references are not allowed in constants fn main() {} diff --git a/src/test/ui/consts/issue-17718-const-bad-values.stderr b/src/test/ui/consts/issue-17718-const-bad-values.stderr index ce60aaa0797f8..7c50978d4ebb8 100644 --- a/src/test/ui/consts/issue-17718-const-bad-values.stderr +++ b/src/test/ui/consts/issue-17718-const-bad-values.stderr @@ -1,8 +1,8 @@ -error[E0764]: mutable references are not allowed in the final value of constants +error[E0764]: mutable references are not allowed in constants --> $DIR/issue-17718-const-bad-values.rs:1:34 | LL | const C1: &'static mut [usize] = &mut []; - | ^^^^^^^ + | ^^^^^^^ `&mut` is only allowed in `const fn` error[E0013]: constants cannot refer to statics --> $DIR/issue-17718-const-bad-values.rs:5:46 @@ -20,7 +20,13 @@ LL | const C2: &'static mut usize = unsafe { &mut S }; | = help: consider extracting the value of the `static` to a `const`, and referring to that -error: aborting due to 3 previous errors +error[E0764]: mutable references are not allowed in constants + --> $DIR/issue-17718-const-bad-values.rs:5:41 + | +LL | const C2: &'static mut usize = unsafe { &mut S }; + | ^^^^^^ `&mut` is only allowed in `const fn` + +error: aborting due to 4 previous errors Some errors have detailed explanations: E0013, E0764. For more information about an error, try `rustc --explain E0013`. diff --git a/src/test/ui/consts/projection_qualif.mut_refs.stderr b/src/test/ui/consts/projection_qualif.mut_refs.stderr new file mode 100644 index 0000000000000..fad8f011f75f5 --- /dev/null +++ b/src/test/ui/consts/projection_qualif.mut_refs.stderr @@ -0,0 +1,19 @@ +error[E0764]: mutable references are not allowed in constants + --> $DIR/projection_qualif.rs:10:27 + | +LL | let b: *mut u32 = &mut a; + | ^^^^^^ `&mut` is only allowed in `const fn` + +error[E0658]: dereferencing raw pointers in constants is unstable + --> $DIR/projection_qualif.rs:11:18 + | +LL | unsafe { *b = 5; } + | ^^^^^^ + | + = note: see issue #51911 for more information + = help: add `#![feature(const_raw_ptr_deref)]` to the crate attributes to enable + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0658, E0764. +For more information about an error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/write_to_mut_ref_dest.rs b/src/test/ui/consts/projection_qualif.rs similarity index 72% rename from src/test/ui/consts/write_to_mut_ref_dest.rs rename to src/test/ui/consts/projection_qualif.rs index d35df330bb8c3..5e2584a6e951a 100644 --- a/src/test/ui/consts/write_to_mut_ref_dest.rs +++ b/src/test/ui/consts/projection_qualif.rs @@ -7,7 +7,7 @@ use std::cell::Cell; const FOO: &u32 = { let mut a = 42; { - let b: *mut u32 = &mut a; //[stock]~ ERROR mutable references are not allowed in constants + let b: *mut u32 = &mut a; //~ ERROR mutable references are not allowed in constants unsafe { *b = 5; } //~ ERROR dereferencing raw pointers in constants } &{a} diff --git a/src/test/ui/consts/projection_qualif.stock.stderr b/src/test/ui/consts/projection_qualif.stock.stderr new file mode 100644 index 0000000000000..fad8f011f75f5 --- /dev/null +++ b/src/test/ui/consts/projection_qualif.stock.stderr @@ -0,0 +1,19 @@ +error[E0764]: mutable references are not allowed in constants + --> $DIR/projection_qualif.rs:10:27 + | +LL | let b: *mut u32 = &mut a; + | ^^^^^^ `&mut` is only allowed in `const fn` + +error[E0658]: dereferencing raw pointers in constants is unstable + --> $DIR/projection_qualif.rs:11:18 + | +LL | unsafe { *b = 5; } + | ^^^^^^ + | + = note: see issue #51911 for more information + = help: add `#![feature(const_raw_ptr_deref)]` to the crate attributes to enable + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0658, E0764. +For more information about an error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/promote-not.rs b/src/test/ui/consts/promote-not.rs index 0d0c78b0fc260..1e4d8586b872c 100644 --- a/src/test/ui/consts/promote-not.rs +++ b/src/test/ui/consts/promote-not.rs @@ -44,11 +44,4 @@ fn main() { // We must not promote things with interior mutability. Not even if we "project it away". let _val: &'static _ = &(Cell::new(1), 2).0; //~ ERROR temporary value dropped while borrowed let _val: &'static _ = &(Cell::new(1), 2).1; //~ ERROR temporary value dropped while borrowed - - // No promotion of fallible operations. - let _val: &'static _ = &(1/0); //~ ERROR temporary value dropped while borrowed - let _val: &'static _ = &(1/(1-1)); //~ ERROR temporary value dropped while borrowed - let _val: &'static _ = &(1%0); //~ ERROR temporary value dropped while borrowed - let _val: &'static _ = &(1%(1-1)); //~ ERROR temporary value dropped while borrowed - let _val: &'static _ = &([1,2,3][4]+1); //~ ERROR temporary value dropped while borrowed } diff --git a/src/test/ui/consts/promote-not.stderr b/src/test/ui/consts/promote-not.stderr index 108d0da7a674a..6e76d9ee6c165 100644 --- a/src/test/ui/consts/promote-not.stderr +++ b/src/test/ui/consts/promote-not.stderr @@ -65,7 +65,7 @@ LL | let _val: &'static _ = &(Cell::new(1), 2).0; | ---------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -... +LL | let _val: &'static _ = &(Cell::new(1), 2).1; LL | } | - temporary value is freed at the end of this statement @@ -76,64 +76,9 @@ LL | let _val: &'static _ = &(Cell::new(1), 2).1; | ---------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -... -LL | } - | - temporary value is freed at the end of this statement - -error[E0716]: temporary value dropped while borrowed - --> $DIR/promote-not.rs:49:29 - | -LL | let _val: &'static _ = &(1/0); - | ---------- ^^^^^ creates a temporary which is freed while still in use - | | - | type annotation requires that borrow lasts for `'static` -... -LL | } - | - temporary value is freed at the end of this statement - -error[E0716]: temporary value dropped while borrowed - --> $DIR/promote-not.rs:50:29 - | -LL | let _val: &'static _ = &(1/(1-1)); - | ---------- ^^^^^^^^^ creates a temporary which is freed while still in use - | | - | type annotation requires that borrow lasts for `'static` -... -LL | } - | - temporary value is freed at the end of this statement - -error[E0716]: temporary value dropped while borrowed - --> $DIR/promote-not.rs:51:29 - | -LL | let _val: &'static _ = &(1%0); - | ---------- ^^^^^ creates a temporary which is freed while still in use - | | - | type annotation requires that borrow lasts for `'static` -... -LL | } - | - temporary value is freed at the end of this statement - -error[E0716]: temporary value dropped while borrowed - --> $DIR/promote-not.rs:52:29 - | -LL | let _val: &'static _ = &(1%(1-1)); - | ---------- ^^^^^^^^^ creates a temporary which is freed while still in use - | | - | type annotation requires that borrow lasts for `'static` -LL | let _val: &'static _ = &([1,2,3][4]+1); -LL | } - | - temporary value is freed at the end of this statement - -error[E0716]: temporary value dropped while borrowed - --> $DIR/promote-not.rs:53:29 - | -LL | let _val: &'static _ = &([1,2,3][4]+1); - | ---------- ^^^^^^^^^^^^^^ creates a temporary which is freed while still in use - | | - | type annotation requires that borrow lasts for `'static` LL | } | - temporary value is freed at the end of this statement -error: aborting due to 13 previous errors +error: aborting due to 8 previous errors For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/consts/promoted_div_by_zero.rs b/src/test/ui/consts/promoted_div_by_zero.rs new file mode 100644 index 0000000000000..b4503f691ffd9 --- /dev/null +++ b/src/test/ui/consts/promoted_div_by_zero.rs @@ -0,0 +1,9 @@ +#![allow(unconditional_panic, const_err)] + +// run-fail +// error-pattern: attempt to divide by zero +// ignore-emscripten no processes + +fn main() { + let x = &(1 / (1 - 1)); +} diff --git a/src/test/ui/consts/promotion.rs b/src/test/ui/consts/promotion.rs index 580c6d62f10af..b6e7127a9b779 100644 --- a/src/test/ui/consts/promotion.rs +++ b/src/test/ui/consts/promotion.rs @@ -1,43 +1,28 @@ -// revisions: noopt opt opt_with_overflow_checks -//[noopt]compile-flags: -C opt-level=0 -//[opt]compile-flags: -O -//[opt_with_overflow_checks]compile-flags: -C overflow-checks=on -O +// check-pass -// build-pass -#[allow(arithmetic_overflow)] +// compile-flags: -O -const fn assert_static(_: &'static T) {} +fn foo(_: &'static [&'static str]) {} +fn bar(_: &'static [&'static str; 3]) {} +const fn baz_i32(_: &'static i32) {} +const fn baz_u32(_: &'static u32) {} const fn fail() -> i32 { 1/0 } const C: i32 = { // Promoted that fails to evaluate in dead code -- this must work // (for backwards compatibility reasons). if false { - assert_static(&fail()); + baz_i32(&fail()); } 42 }; fn main() { - assert_static(&["a", "b", "c"]); - assert_static(&["d", "e", "f"]); + foo(&["a", "b", "c"]); + bar(&["d", "e", "f"]); assert_eq!(C, 42); // make sure that these do not cause trouble despite overflowing - assert_static(&(0-1)); - assert_static(&-i32::MIN); - - // div-by-non-0 is okay - assert_static(&(1/1)); - assert_static(&(1%1)); - - // in-bounds array access is okay - assert_static(&([1,2,3][0] + 1)); - assert_static(&[[1,2][1]]); - - // Top-level projections are not part of the promoted, so no error here. - if false { - #[allow(unconditional_panic)] - assert_static(&[1,2,3][4]); - } + baz_u32(&(0-1)); + baz_i32(&-i32::MIN); } diff --git a/src/test/ui/consts/read_from_static_mut_ref.rs b/src/test/ui/consts/read_from_static_mut_ref.rs new file mode 100644 index 0000000000000..5faa983ab09f7 --- /dev/null +++ b/src/test/ui/consts/read_from_static_mut_ref.rs @@ -0,0 +1,9 @@ +// We are keeping this test in case we decide to allow mutable references in statics again +#![feature(const_mut_refs)] +#![allow(const_err)] + +static OH_NO: &mut i32 = &mut 42; +//~^ ERROR mutable references are not allowed in statics +fn main() { + assert_eq!(*OH_NO, 42); +} diff --git a/src/test/ui/consts/read_from_static_mut_ref.stderr b/src/test/ui/consts/read_from_static_mut_ref.stderr new file mode 100644 index 0000000000000..c936ac0b7d585 --- /dev/null +++ b/src/test/ui/consts/read_from_static_mut_ref.stderr @@ -0,0 +1,9 @@ +error[E0764]: mutable references are not allowed in statics + --> $DIR/read_from_static_mut_ref.rs:5:26 + | +LL | static OH_NO: &mut i32 = &mut 42; + | ^^^^^^^ `&mut` is only allowed in `const fn` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0764`. diff --git a/src/test/ui/consts/static_mut_containing_mut_ref2.mut_refs.stderr b/src/test/ui/consts/static_mut_containing_mut_ref2.mut_refs.stderr index 8db75dd63cf2a..36c280ca5c607 100644 --- a/src/test/ui/consts/static_mut_containing_mut_ref2.mut_refs.stderr +++ b/src/test/ui/consts/static_mut_containing_mut_ref2.mut_refs.stderr @@ -1,9 +1,9 @@ -error[E0080]: could not evaluate static initializer - --> $DIR/static_mut_containing_mut_ref2.rs:7:45 +error[E0764]: mutable references are not allowed in statics + --> $DIR/static_mut_containing_mut_ref2.rs:7:46 | LL | pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ modifying a static's initial value from another static's initializer + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `&mut` is only allowed in `const fn` error: aborting due to previous error -For more information about this error, try `rustc --explain E0080`. +For more information about this error, try `rustc --explain E0764`. diff --git a/src/test/ui/consts/static_mut_containing_mut_ref2.rs b/src/test/ui/consts/static_mut_containing_mut_ref2.rs index 61368546083db..2821d1a015435 100644 --- a/src/test/ui/consts/static_mut_containing_mut_ref2.rs +++ b/src/test/ui/consts/static_mut_containing_mut_ref2.rs @@ -5,7 +5,6 @@ static mut STDERR_BUFFER_SPACE: u8 = 0; pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; }; -//[mut_refs]~^ ERROR could not evaluate static initializer -//[stock]~^^ ERROR mutable references are not allowed in statics +//~^ ERROR mutable references are not allowed in statics fn main() {} diff --git a/src/test/ui/consts/static_mut_containing_mut_ref2.stock.stderr b/src/test/ui/consts/static_mut_containing_mut_ref2.stock.stderr index 5cdcea2323109..36c280ca5c607 100644 --- a/src/test/ui/consts/static_mut_containing_mut_ref2.stock.stderr +++ b/src/test/ui/consts/static_mut_containing_mut_ref2.stock.stderr @@ -1,12 +1,9 @@ -error[E0658]: mutable references are not allowed in statics +error[E0764]: mutable references are not allowed in statics --> $DIR/static_mut_containing_mut_ref2.rs:7:46 | LL | pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `&mut` is only allowed in `const fn` error: aborting due to previous error -For more information about this error, try `rustc --explain E0658`. +For more information about this error, try `rustc --explain E0764`. diff --git a/src/test/ui/consts/write_to_mut_ref_dest.mut_refs.stderr b/src/test/ui/consts/write_to_mut_ref_dest.mut_refs.stderr deleted file mode 100644 index 3ee50907461ca..0000000000000 --- a/src/test/ui/consts/write_to_mut_ref_dest.mut_refs.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: dereferencing raw pointers in constants is unstable - --> $DIR/write_to_mut_ref_dest.rs:11:18 - | -LL | unsafe { *b = 5; } - | ^^^^^^ - | - = note: see issue #51911 for more information - = help: add `#![feature(const_raw_ptr_deref)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/write_to_mut_ref_dest.stock.stderr b/src/test/ui/consts/write_to_mut_ref_dest.stock.stderr deleted file mode 100644 index 2b6d1d3267b61..0000000000000 --- a/src/test/ui/consts/write_to_mut_ref_dest.stock.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0658]: mutable references are not allowed in constants - --> $DIR/write_to_mut_ref_dest.rs:10:27 - | -LL | let b: *mut u32 = &mut a; - | ^^^^^^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - -error[E0658]: dereferencing raw pointers in constants is unstable - --> $DIR/write_to_mut_ref_dest.rs:11:18 - | -LL | unsafe { *b = 5; } - | ^^^^^^ - | - = note: see issue #51911 for more information - = help: add `#![feature(const_raw_ptr_deref)]` to the crate attributes to enable - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/write_to_static_via_mut_ref.rs b/src/test/ui/consts/write_to_static_via_mut_ref.rs deleted file mode 100644 index 665c305e9617f..0000000000000 --- a/src/test/ui/consts/write_to_static_via_mut_ref.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![feature(const_mut_refs)] -#![allow(const_err)] - -static OH_NO: &mut i32 = &mut 42; //~ ERROR mutable references are not allowed -fn main() { - assert_eq!(*OH_NO, 42); - *OH_NO = 43; //~ ERROR cannot assign to `*OH_NO`, as `OH_NO` is an immutable static -} diff --git a/src/test/ui/consts/write_to_static_via_mut_ref.stderr b/src/test/ui/consts/write_to_static_via_mut_ref.stderr deleted file mode 100644 index d19e998d61736..0000000000000 --- a/src/test/ui/consts/write_to_static_via_mut_ref.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0764]: mutable references are not allowed in the final value of statics - --> $DIR/write_to_static_via_mut_ref.rs:4:26 - | -LL | static OH_NO: &mut i32 = &mut 42; - | ^^^^^^^ - -error[E0594]: cannot assign to `*OH_NO`, as `OH_NO` is an immutable static item - --> $DIR/write_to_static_via_mut_ref.rs:7:5 - | -LL | *OH_NO = 43; - | ^^^^^^^^^^^ cannot assign - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0594, E0764. -For more information about an error, try `rustc --explain E0594`. diff --git a/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr b/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr index 06605c6f2082e..56cbd882cca60 100644 --- a/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr +++ b/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `E` --> $DIR/edition-imports-virtual-2015-gated.rs:8:5 | LL | gen_gated!(); - | ^^^^^^^^^^^^^ could not find `E` in crate root + | ^^^^^^^^^^^^^ could not find `E` in `{{root}}` | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/error-codes/E0017.rs b/src/test/ui/error-codes/E0017.rs index c211ad1a2f8f6..262f7bc72c739 100644 --- a/src/test/ui/error-codes/E0017.rs +++ b/src/test/ui/error-codes/E0017.rs @@ -2,13 +2,12 @@ static X: i32 = 1; const C: i32 = 2; static mut M: i32 = 3; -const CR: &'static mut i32 = &mut C; //~ ERROR mutable references are not allowed +const CR: &'static mut i32 = &mut C; //~ ERROR E0764 //~| WARN taking a mutable -static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0658 +static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0764 //~| ERROR cannot borrow - //~| ERROR mutable references are not allowed -static CONST_REF: &'static mut i32 = &mut C; //~ ERROR mutable references are not allowed +static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0764 //~| WARN taking a mutable -static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M }; //~ ERROR mutable references are not +static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M }; //~ ERROR E0764 fn main() {} diff --git a/src/test/ui/error-codes/E0017.stderr b/src/test/ui/error-codes/E0017.stderr index 7d959b6d148ed..ea591587e6daa 100644 --- a/src/test/ui/error-codes/E0017.stderr +++ b/src/test/ui/error-codes/E0017.stderr @@ -13,26 +13,17 @@ note: `const` item defined here LL | const C: i32 = 2; | ^^^^^^^^^^^^^^^^^ -error[E0764]: mutable references are not allowed in the final value of constants +error[E0764]: mutable references are not allowed in constants --> $DIR/E0017.rs:5:30 | LL | const CR: &'static mut i32 = &mut C; - | ^^^^^^ + | ^^^^^^ `&mut` is only allowed in `const fn` -error[E0658]: mutation through a reference is not allowed in statics +error[E0764]: mutable references are not allowed in statics --> $DIR/E0017.rs:7:39 | LL | static STATIC_REF: &'static mut i32 = &mut X; - | ^^^^^^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - -error[E0764]: mutable references are not allowed in the final value of statics - --> $DIR/E0017.rs:7:39 - | -LL | static STATIC_REF: &'static mut i32 = &mut X; - | ^^^^^^ + | ^^^^^^ `&mut` is only allowed in `const fn` error[E0596]: cannot borrow immutable static item `X` as mutable --> $DIR/E0017.rs:7:39 @@ -41,7 +32,7 @@ LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ cannot borrow as mutable warning: taking a mutable reference to a `const` item - --> $DIR/E0017.rs:11:38 + --> $DIR/E0017.rs:10:38 | LL | static CONST_REF: &'static mut i32 = &mut C; | ^^^^^^ @@ -54,19 +45,19 @@ note: `const` item defined here LL | const C: i32 = 2; | ^^^^^^^^^^^^^^^^^ -error[E0764]: mutable references are not allowed in the final value of statics - --> $DIR/E0017.rs:11:38 +error[E0764]: mutable references are not allowed in statics + --> $DIR/E0017.rs:10:38 | LL | static CONST_REF: &'static mut i32 = &mut C; - | ^^^^^^ + | ^^^^^^ `&mut` is only allowed in `const fn` -error[E0764]: mutable references are not allowed in the final value of statics - --> $DIR/E0017.rs:13:52 +error[E0764]: mutable references are not allowed in statics + --> $DIR/E0017.rs:12:52 | LL | static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M }; - | ^^^^^^ + | ^^^^^^ `&mut` is only allowed in `const fn` -error: aborting due to 6 previous errors; 2 warnings emitted +error: aborting due to 5 previous errors; 2 warnings emitted -Some errors have detailed explanations: E0596, E0658, E0764. +Some errors have detailed explanations: E0596, E0764. For more information about an error, try `rustc --explain E0596`. diff --git a/src/test/ui/error-codes/E0388.rs b/src/test/ui/error-codes/E0388.rs index 6049d95f0d277..bb0c4979b9ac9 100644 --- a/src/test/ui/error-codes/E0388.rs +++ b/src/test/ui/error-codes/E0388.rs @@ -1,13 +1,12 @@ static X: i32 = 1; const C: i32 = 2; -const CR: &'static mut i32 = &mut C; //~ ERROR mutable references are not allowed +const CR: &'static mut i32 = &mut C; //~ ERROR E0764 //~| WARN taking a mutable static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR cannot borrow - //~| ERROR E0658 - //~| ERROR mutable references are not allowed + //~| ERROR E0764 -static CONST_REF: &'static mut i32 = &mut C; //~ ERROR mutable references are not allowed +static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0764 //~| WARN taking a mutable fn main() {} diff --git a/src/test/ui/error-codes/E0388.stderr b/src/test/ui/error-codes/E0388.stderr index 4886a156d2ea5..73e0b139cd056 100644 --- a/src/test/ui/error-codes/E0388.stderr +++ b/src/test/ui/error-codes/E0388.stderr @@ -13,26 +13,17 @@ note: `const` item defined here LL | const C: i32 = 2; | ^^^^^^^^^^^^^^^^^ -error[E0764]: mutable references are not allowed in the final value of constants +error[E0764]: mutable references are not allowed in constants --> $DIR/E0388.rs:4:30 | LL | const CR: &'static mut i32 = &mut C; - | ^^^^^^ + | ^^^^^^ `&mut` is only allowed in `const fn` -error[E0658]: mutation through a reference is not allowed in statics +error[E0764]: mutable references are not allowed in statics --> $DIR/E0388.rs:6:39 | LL | static STATIC_REF: &'static mut i32 = &mut X; - | ^^^^^^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - -error[E0764]: mutable references are not allowed in the final value of statics - --> $DIR/E0388.rs:6:39 - | -LL | static STATIC_REF: &'static mut i32 = &mut X; - | ^^^^^^ + | ^^^^^^ `&mut` is only allowed in `const fn` error[E0596]: cannot borrow immutable static item `X` as mutable --> $DIR/E0388.rs:6:39 @@ -41,7 +32,7 @@ LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ cannot borrow as mutable warning: taking a mutable reference to a `const` item - --> $DIR/E0388.rs:10:38 + --> $DIR/E0388.rs:9:38 | LL | static CONST_REF: &'static mut i32 = &mut C; | ^^^^^^ @@ -54,13 +45,13 @@ note: `const` item defined here LL | const C: i32 = 2; | ^^^^^^^^^^^^^^^^^ -error[E0764]: mutable references are not allowed in the final value of statics - --> $DIR/E0388.rs:10:38 +error[E0764]: mutable references are not allowed in statics + --> $DIR/E0388.rs:9:38 | LL | static CONST_REF: &'static mut i32 = &mut C; - | ^^^^^^ + | ^^^^^^ `&mut` is only allowed in `const fn` -error: aborting due to 5 previous errors; 2 warnings emitted +error: aborting due to 4 previous errors; 2 warnings emitted -Some errors have detailed explanations: E0596, E0658, E0764. +Some errors have detailed explanations: E0596, E0764. For more information about an error, try `rustc --explain E0596`. diff --git a/src/test/ui/extern/extern-compare-with-return-type.rs b/src/test/ui/extern/extern-compare-with-return-type.rs index 42693d3a061c8..1ddfc77a4c43a 100644 --- a/src/test/ui/extern/extern-compare-with-return-type.rs +++ b/src/test/ui/extern/extern-compare-with-return-type.rs @@ -1,5 +1,4 @@ // run-pass - // Tests that we can compare various kinds of extern fn signatures. #![allow(non_camel_case_types)] diff --git a/src/test/ui/feature-gates/feature-gate-cfg-version.rs b/src/test/ui/feature-gates/feature-gate-cfg-version.rs index e35784a68d101..c29ef99945e71 100644 --- a/src/test/ui/feature-gates/feature-gate-cfg-version.rs +++ b/src/test/ui/feature-gates/feature-gate-cfg-version.rs @@ -1,9 +1,3 @@ -#[cfg(version(42))] //~ ERROR: expected a version literal -//~^ ERROR `cfg(version)` is experimental and subject to change -fn foo() {} -#[cfg(version(1.20))] //~ ERROR: expected a version literal -//~^ ERROR `cfg(version)` is experimental and subject to change -fn foo() -> bool { true } #[cfg(version("1.44"))] //~^ ERROR `cfg(version)` is experimental and subject to change fn foo() -> bool { true } @@ -17,32 +11,30 @@ fn bar() -> bool { false } #[cfg(version(false))] //~ ERROR: expected a version literal //~^ ERROR `cfg(version)` is experimental and subject to change fn bar() -> bool { false } -#[cfg(version("foo"))] //~ WARNING: unknown version literal format +#[cfg(version("foo"))] //~ ERROR: invalid version literal //~^ ERROR `cfg(version)` is experimental and subject to change fn bar() -> bool { false } -#[cfg(version("999"))] //~ WARNING: unknown version literal format +#[cfg(version("999"))] //~^ ERROR `cfg(version)` is experimental and subject to change fn bar() -> bool { false } -#[cfg(version("-1"))] //~ WARNING: unknown version literal format +#[cfg(version("-1"))] //~ ERROR: invalid version literal //~^ ERROR `cfg(version)` is experimental and subject to change fn bar() -> bool { false } -#[cfg(version("65536"))] //~ WARNING: unknown version literal format +#[cfg(version("65536"))] //~ ERROR: invalid version literal //~^ ERROR `cfg(version)` is experimental and subject to change fn bar() -> bool { false } -#[cfg(version("0"))] //~ WARNING: unknown version literal format -//~^ ERROR `cfg(version)` is experimental and subject to change -fn bar() -> bool { true } -#[cfg(version("1.0"))] +#[cfg(version("0"))] //~^ ERROR `cfg(version)` is experimental and subject to change fn bar() -> bool { true } -#[cfg(version("1.65536.2"))] //~ WARNING: unknown version literal format -//~^ ERROR `cfg(version)` is experimental and subject to change -fn bar() -> bool { false } -#[cfg(version("1.20.0-stable"))] //~ WARNING: unknown version literal format + +#[cfg(version("1.65536.2"))] //~^ ERROR `cfg(version)` is experimental and subject to change -fn bar() {} +fn version_check_bug() {} fn main() { + // This should fail but due to a bug in version_check `1.65536.2` is interpreted as `1.2`. + // See https://github.com/SergioBenitez/version_check/issues/11 + version_check_bug(); assert!(foo()); assert!(bar()); assert!(cfg!(version("1.42"))); //~ ERROR `cfg(version)` is experimental and subject to change diff --git a/src/test/ui/feature-gates/feature-gate-cfg-version.stderr b/src/test/ui/feature-gates/feature-gate-cfg-version.stderr index ae899d409ecf9..bdf160b5a0270 100644 --- a/src/test/ui/feature-gates/feature-gate-cfg-version.stderr +++ b/src/test/ui/feature-gates/feature-gate-cfg-version.stderr @@ -1,36 +1,6 @@ error[E0658]: `cfg(version)` is experimental and subject to change --> $DIR/feature-gate-cfg-version.rs:1:7 | -LL | #[cfg(version(42))] - | ^^^^^^^^^^^ - | - = note: see issue #64796 for more information - = help: add `#![feature(cfg_version)]` to the crate attributes to enable - -error: expected a version literal - --> $DIR/feature-gate-cfg-version.rs:1:15 - | -LL | #[cfg(version(42))] - | ^^ - -error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:4:7 - | -LL | #[cfg(version(1.20))] - | ^^^^^^^^^^^^^ - | - = note: see issue #64796 for more information - = help: add `#![feature(cfg_version)]` to the crate attributes to enable - -error: expected a version literal - --> $DIR/feature-gate-cfg-version.rs:4:15 - | -LL | #[cfg(version(1.20))] - | ^^^^ - -error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:7:7 - | LL | #[cfg(version("1.44"))] | ^^^^^^^^^^^^^^^ | @@ -38,7 +8,7 @@ LL | #[cfg(version("1.44"))] = help: add `#![feature(cfg_version)]` to the crate attributes to enable error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:10:11 + --> $DIR/feature-gate-cfg-version.rs:4:11 | LL | #[cfg(not(version("1.44")))] | ^^^^^^^^^^^^^^^ @@ -47,7 +17,7 @@ LL | #[cfg(not(version("1.44")))] = help: add `#![feature(cfg_version)]` to the crate attributes to enable error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:14:7 + --> $DIR/feature-gate-cfg-version.rs:8:7 | LL | #[cfg(version("1.43", "1.44", "1.45"))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -56,13 +26,13 @@ LL | #[cfg(version("1.43", "1.44", "1.45"))] = help: add `#![feature(cfg_version)]` to the crate attributes to enable error: expected single version literal - --> $DIR/feature-gate-cfg-version.rs:14:7 + --> $DIR/feature-gate-cfg-version.rs:8:7 | LL | #[cfg(version("1.43", "1.44", "1.45"))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:17:7 + --> $DIR/feature-gate-cfg-version.rs:11:7 | LL | #[cfg(version(false))] | ^^^^^^^^^^^^^^ @@ -71,13 +41,13 @@ LL | #[cfg(version(false))] = help: add `#![feature(cfg_version)]` to the crate attributes to enable error: expected a version literal - --> $DIR/feature-gate-cfg-version.rs:17:15 + --> $DIR/feature-gate-cfg-version.rs:11:15 | LL | #[cfg(version(false))] | ^^^^^ error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:20:7 + --> $DIR/feature-gate-cfg-version.rs:14:7 | LL | #[cfg(version("foo"))] | ^^^^^^^^^^^^^^ @@ -85,14 +55,14 @@ LL | #[cfg(version("foo"))] = note: see issue #64796 for more information = help: add `#![feature(cfg_version)]` to the crate attributes to enable -warning: unknown version literal format, assuming it refers to a future version - --> $DIR/feature-gate-cfg-version.rs:20:15 +error: invalid version literal + --> $DIR/feature-gate-cfg-version.rs:14:15 | LL | #[cfg(version("foo"))] | ^^^^^ error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:23:7 + --> $DIR/feature-gate-cfg-version.rs:17:7 | LL | #[cfg(version("999"))] | ^^^^^^^^^^^^^^ @@ -100,14 +70,8 @@ LL | #[cfg(version("999"))] = note: see issue #64796 for more information = help: add `#![feature(cfg_version)]` to the crate attributes to enable -warning: unknown version literal format, assuming it refers to a future version - --> $DIR/feature-gate-cfg-version.rs:23:15 - | -LL | #[cfg(version("999"))] - | ^^^^^ - error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:26:7 + --> $DIR/feature-gate-cfg-version.rs:20:7 | LL | #[cfg(version("-1"))] | ^^^^^^^^^^^^^ @@ -115,14 +79,14 @@ LL | #[cfg(version("-1"))] = note: see issue #64796 for more information = help: add `#![feature(cfg_version)]` to the crate attributes to enable -warning: unknown version literal format, assuming it refers to a future version - --> $DIR/feature-gate-cfg-version.rs:26:15 +error: invalid version literal + --> $DIR/feature-gate-cfg-version.rs:20:15 | LL | #[cfg(version("-1"))] | ^^^^ error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:29:7 + --> $DIR/feature-gate-cfg-version.rs:23:7 | LL | #[cfg(version("65536"))] | ^^^^^^^^^^^^^^^^ @@ -130,14 +94,14 @@ LL | #[cfg(version("65536"))] = note: see issue #64796 for more information = help: add `#![feature(cfg_version)]` to the crate attributes to enable -warning: unknown version literal format, assuming it refers to a future version - --> $DIR/feature-gate-cfg-version.rs:29:15 +error: invalid version literal + --> $DIR/feature-gate-cfg-version.rs:23:15 | LL | #[cfg(version("65536"))] | ^^^^^^^ error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:32:7 + --> $DIR/feature-gate-cfg-version.rs:26:7 | LL | #[cfg(version("0"))] | ^^^^^^^^^^^^ @@ -145,23 +109,8 @@ LL | #[cfg(version("0"))] = note: see issue #64796 for more information = help: add `#![feature(cfg_version)]` to the crate attributes to enable -warning: unknown version literal format, assuming it refers to a future version - --> $DIR/feature-gate-cfg-version.rs:32:15 - | -LL | #[cfg(version("0"))] - | ^^^ - -error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:35:7 - | -LL | #[cfg(version("1.0"))] - | ^^^^^^^^^^^^^^ - | - = note: see issue #64796 for more information - = help: add `#![feature(cfg_version)]` to the crate attributes to enable - error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:38:7 + --> $DIR/feature-gate-cfg-version.rs:30:7 | LL | #[cfg(version("1.65536.2"))] | ^^^^^^^^^^^^^^^^^^^^ @@ -169,29 +118,8 @@ LL | #[cfg(version("1.65536.2"))] = note: see issue #64796 for more information = help: add `#![feature(cfg_version)]` to the crate attributes to enable -warning: unknown version literal format, assuming it refers to a future version - --> $DIR/feature-gate-cfg-version.rs:38:15 - | -LL | #[cfg(version("1.65536.2"))] - | ^^^^^^^^^^^ - -error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:41:7 - | -LL | #[cfg(version("1.20.0-stable"))] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #64796 for more information - = help: add `#![feature(cfg_version)]` to the crate attributes to enable - -warning: unknown version literal format, assuming it refers to a future version - --> $DIR/feature-gate-cfg-version.rs:41:15 - | -LL | #[cfg(version("1.20.0-stable"))] - | ^^^^^^^^^^^^^^^ - error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:48:18 + --> $DIR/feature-gate-cfg-version.rs:40:18 | LL | assert!(cfg!(version("1.42"))); | ^^^^^^^^^^^^^^^ @@ -199,6 +127,6 @@ LL | assert!(cfg!(version("1.42"))); = note: see issue #64796 for more information = help: add `#![feature(cfg_version)]` to the crate attributes to enable -error: aborting due to 19 previous errors; 7 warnings emitted +error: aborting due to 16 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/generic-associated-types/parse/trait-path-expected-token.stderr b/src/test/ui/generic-associated-types/parse/trait-path-expected-token.stderr index 8abc4ccc9a5fa..051253cadc652 100644 --- a/src/test/ui/generic-associated-types/parse/trait-path-expected-token.stderr +++ b/src/test/ui/generic-associated-types/parse/trait-path-expected-token.stderr @@ -2,9 +2,7 @@ error: expected one of `!`, `(`, `+`, `,`, `::`, `<`, or `>`, found `=` --> $DIR/trait-path-expected-token.rs:8:33 | LL | fn f1<'a>(arg : Box>) {} - | - ^ expected one of 7 possible tokens - | | - | maybe try to close unmatched angle bracket + | ^ expected one of 7 possible tokens warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/trait-path-expected-token.rs:1:12 diff --git a/src/test/ui/generic-associated-types/parse/trait-path-expressions.rs b/src/test/ui/generic-associated-types/parse/trait-path-expressions.rs index 5e50c6b35c960..de61cfa1cf718 100644 --- a/src/test/ui/generic-associated-types/parse/trait-path-expressions.rs +++ b/src/test/ui/generic-associated-types/parse/trait-path-expressions.rs @@ -17,7 +17,7 @@ mod error2 { } fn f2<'a>(arg : Box>) {} - //~^ ERROR: expected one of + //~^ ERROR: only types can be used in associated type constraints } fn main() {} diff --git a/src/test/ui/generic-associated-types/parse/trait-path-expressions.stderr b/src/test/ui/generic-associated-types/parse/trait-path-expressions.stderr index 27e1a750b2131..a9ba8adcaba3f 100644 --- a/src/test/ui/generic-associated-types/parse/trait-path-expressions.stderr +++ b/src/test/ui/generic-associated-types/parse/trait-path-expressions.stderr @@ -6,13 +6,11 @@ LL | fn f1<'a>(arg : Box>) {} | | | while parsing a const generic argument starting here -error: expected one of `,`, `:`, or `>`, found `=` - --> $DIR/trait-path-expressions.rs:19:36 +error: only types can be used in associated type constraints + --> $DIR/trait-path-expressions.rs:19:30 | LL | fn f2<'a>(arg : Box>) {} - | - ^ expected one of `,`, `:`, or `>` - | | - | maybe try to close unmatched angle bracket + | ^^^^^ warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/trait-path-expressions.rs:1:12 diff --git a/src/test/ui/generic-associated-types/parse/trait-path-missing-gen_arg.stderr b/src/test/ui/generic-associated-types/parse/trait-path-missing-gen_arg.stderr index f6038566e5b5e..8a5e2c29c3665 100644 --- a/src/test/ui/generic-associated-types/parse/trait-path-missing-gen_arg.stderr +++ b/src/test/ui/generic-associated-types/parse/trait-path-missing-gen_arg.stderr @@ -28,9 +28,7 @@ error: expected one of `>`, a const expression, lifetime, or type, found `=` --> $DIR/trait-path-missing-gen_arg.rs:17:30 | LL | fn f1<'a>(arg : Box>) {} - | - ^ expected one of `>`, a const expression, lifetime, or type - | | - | maybe try to close unmatched angle bracket + | ^ expected one of `>`, a const expression, lifetime, or type warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/trait-path-missing-gen_arg.rs:1:12 diff --git a/src/test/ui/generic-associated-types/parse/trait-path-segments.rs b/src/test/ui/generic-associated-types/parse/trait-path-segments.rs index eba30e1438f04..0bf48b1f41810 100644 --- a/src/test/ui/generic-associated-types/parse/trait-path-segments.rs +++ b/src/test/ui/generic-associated-types/parse/trait-path-segments.rs @@ -7,7 +7,7 @@ const _: () = { } fn f1<'a>(arg : Box>) {} - //~^ ERROR: expected one of + //~^ ERROR: paths with multiple segments cannot be used in associated type constraints }; const _: () = { @@ -18,7 +18,7 @@ const _: () = { trait Z {} impl::Y<'a> = &'a u32>> Z for T {} - //~^ ERROR: expected one of + //~^ ERROR: qualified paths cannot be used in associated type constraints }; const _: () = { @@ -29,7 +29,7 @@ const _: () = { trait Z {} impl = &'a u32>> Z for T {} - //~^ ERROR: expected one of + //~^ ERROR: paths with multiple segments cannot be used in associated type constraints }; fn main() {} diff --git a/src/test/ui/generic-associated-types/parse/trait-path-segments.stderr b/src/test/ui/generic-associated-types/parse/trait-path-segments.stderr index c82953aaed7dd..4e2b84d018239 100644 --- a/src/test/ui/generic-associated-types/parse/trait-path-segments.stderr +++ b/src/test/ui/generic-associated-types/parse/trait-path-segments.stderr @@ -1,26 +1,22 @@ -error: expected one of `!`, `(`, `+`, `,`, `::`, `:`, `<`, or `>`, found `=` - --> $DIR/trait-path-segments.rs:9:36 +error: paths with multiple segments cannot be used in associated type constraints + --> $DIR/trait-path-segments.rs:9:31 | LL | fn f1<'a>(arg : Box>) {} - | - ^ expected one of 8 possible tokens - | | - | maybe try to close unmatched angle bracket + | ^^^^ -error: expected one of `,`, `::`, `:`, or `>`, found `=` - --> $DIR/trait-path-segments.rs:20:35 +error: qualified paths cannot be used in associated type constraints + --> $DIR/trait-path-segments.rs:20:16 | LL | impl::Y<'a> = &'a u32>> Z for T {} - | - ^ expected one of `,`, `::`, `:`, or `>` - | | - | maybe try to close unmatched angle bracket + | ^^^^^^^^^-^^^^^^^^ + | | + | not allowed in associated type constraints -error: expected one of `!`, `+`, `,`, `::`, `:`, or `>`, found `=` - --> $DIR/trait-path-segments.rs:31:25 +error: paths with multiple segments cannot be used in associated type constraints + --> $DIR/trait-path-segments.rs:31:16 | LL | impl = &'a u32>> Z for T {} - | - ^ expected one of `!`, `+`, `,`, `::`, `:`, or `>` - | | - | maybe try to close unmatched angle bracket + | ^^^^^^^^ warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/trait-path-segments.rs:1:12 diff --git a/src/test/ui/generic-associated-types/parse/trait-path-types.rs b/src/test/ui/generic-associated-types/parse/trait-path-types.rs index 522b3edc638ea..6cdb501ec65fb 100644 --- a/src/test/ui/generic-associated-types/parse/trait-path-types.rs +++ b/src/test/ui/generic-associated-types/parse/trait-path-types.rs @@ -7,17 +7,17 @@ trait X { const _: () = { fn f<'a>(arg : Box>) {} - //~^ ERROR: expected one of + //~^ ERROR: only path types can be used in associated type constraints }; const _: () = { fn f1<'a>(arg : Box) = &'a ()>>) {} - //~^ ERROR: expected one of + //~^ ERROR: only path types can be used in associated type constraints }; const _: () = { fn f1<'a>(arg : Box>) {} - //~^ ERROR: expected one of + //~^ ERROR: only types can be used in associated type constraints }; fn main() {} diff --git a/src/test/ui/generic-associated-types/parse/trait-path-types.stderr b/src/test/ui/generic-associated-types/parse/trait-path-types.stderr index ac791c224810e..f5be084613b4c 100644 --- a/src/test/ui/generic-associated-types/parse/trait-path-types.stderr +++ b/src/test/ui/generic-associated-types/parse/trait-path-types.stderr @@ -1,26 +1,20 @@ -error: expected one of `,`, `:`, or `>`, found `=` - --> $DIR/trait-path-types.rs:9:37 +error: only path types can be used in associated type constraints + --> $DIR/trait-path-types.rs:9:29 | LL | fn f<'a>(arg : Box>) {} - | - ^ expected one of `,`, `:`, or `>` - | | - | maybe try to close unmatched angle bracket + | ^^^^^^^ -error: expected one of `,`, `:`, or `>`, found `=` - --> $DIR/trait-path-types.rs:14:37 +error: only path types can be used in associated type constraints + --> $DIR/trait-path-types.rs:14:29 | LL | fn f1<'a>(arg : Box) = &'a ()>>) {} - | - ^ expected one of `,`, `:`, or `>` - | | - | maybe try to close unmatched angle bracket + | ^^^^^^^ -error: expected one of `,`, `:`, or `>`, found `=` - --> $DIR/trait-path-types.rs:19:33 +error: only types can be used in associated type constraints + --> $DIR/trait-path-types.rs:19:30 | LL | fn f1<'a>(arg : Box>) {} - | -- ^ expected one of `,`, `:`, or `>` - | | - | maybe try to close unmatched angle bracket + | ^^ warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/trait-path-types.rs:1:12 diff --git a/src/test/ui/generic-associated-types/variance_constraints.rs b/src/test/ui/generic-associated-types/variance_constraints.rs deleted file mode 100644 index 36db80706b499..0000000000000 --- a/src/test/ui/generic-associated-types/variance_constraints.rs +++ /dev/null @@ -1,24 +0,0 @@ -// check-pass -// issue #69184 -#![feature(generic_associated_types)] -#![allow(incomplete_features)] - -trait A { - type B<'a>; - - fn make_b<'a>(&'a self) -> Self::B<'a>; -} - -struct S {} -impl A for S { - type B<'a> = &'a S; - fn make_b<'a>(&'a self) -> &'a Self { - self - } -} - -enum E<'a> { - S(::B<'a>), -} - -fn main() {} diff --git a/src/test/ui/hygiene/no_implicit_prelude-2021.rs b/src/test/ui/hygiene/no_implicit_prelude-2021.rs deleted file mode 100644 index 0fe9ae56c6564..0000000000000 --- a/src/test/ui/hygiene/no_implicit_prelude-2021.rs +++ /dev/null @@ -1,9 +0,0 @@ -// check-pass -// edition:2021 - -#![no_implicit_prelude] - -fn main() { - assert!(true, "hoi"); - assert!(false, "hoi {}", 123); -} diff --git a/src/test/ui/issues/issue-1962.fixed b/src/test/ui/issues/issue-1962.fixed index 897fd172b29f3..b810a90ef37f9 100644 --- a/src/test/ui/issues/issue-1962.fixed +++ b/src/test/ui/issues/issue-1962.fixed @@ -3,8 +3,8 @@ fn main() { let mut i = 0; - 'a: loop { //~ ERROR denote infinite loops with `loop + loop { //~ ERROR denote infinite loops with `loop i += 1; - if i == 5 { break 'a; } + if i == 5 { break; } } } diff --git a/src/test/ui/issues/issue-1962.rs b/src/test/ui/issues/issue-1962.rs index 71e874100874f..00d2bbd28506e 100644 --- a/src/test/ui/issues/issue-1962.rs +++ b/src/test/ui/issues/issue-1962.rs @@ -3,8 +3,8 @@ fn main() { let mut i = 0; - 'a: while true { //~ ERROR denote infinite loops with `loop + while true { //~ ERROR denote infinite loops with `loop i += 1; - if i == 5 { break 'a; } + if i == 5 { break; } } } diff --git a/src/test/ui/issues/issue-1962.stderr b/src/test/ui/issues/issue-1962.stderr index 4c32a4cf3dd59..17142912696a7 100644 --- a/src/test/ui/issues/issue-1962.stderr +++ b/src/test/ui/issues/issue-1962.stderr @@ -1,8 +1,8 @@ error: denote infinite loops with `loop { ... }` --> $DIR/issue-1962.rs:6:5 | -LL | 'a: while true { - | ^^^^^^^^^^^^^^ help: use `loop` +LL | while true { + | ^^^^^^^^^^ help: use `loop` | = note: requested on the command line with `-D while-true` diff --git a/src/test/ui/issues/issue-27042.stderr b/src/test/ui/issues/issue-27042.stderr index 59ef28481d0e6..7dee1a6a5f044 100644 --- a/src/test/ui/issues/issue-27042.stderr +++ b/src/test/ui/issues/issue-27042.stderr @@ -4,7 +4,7 @@ warning: denote infinite loops with `loop { ... }` LL | / 'b: LL | | LL | | while true { break }; // but here we cite the whole loop - | |__________________^ help: use `loop` + | |____________________________^ help: use `loop` | = note: `#[warn(while_true)]` on by default diff --git a/src/test/ui/issues/issue-34334.rs b/src/test/ui/issues/issue-34334.rs index 51486bc40de0c..b45c00f694321 100644 --- a/src/test/ui/issues/issue-34334.rs +++ b/src/test/ui/issues/issue-34334.rs @@ -1,8 +1,6 @@ fn main () { let sr: Vec<(u32, _, _) = vec![]; - //~^ ERROR expected one of - + //~^ ERROR only path types can be used in associated type constraints let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect(); //~^ ERROR a value of type `Vec<(u32, _, _)>` cannot be built - } diff --git a/src/test/ui/issues/issue-34334.stderr b/src/test/ui/issues/issue-34334.stderr index acb44ce2c3545..a9b9bf06d7f42 100644 --- a/src/test/ui/issues/issue-34334.stderr +++ b/src/test/ui/issues/issue-34334.stderr @@ -1,14 +1,13 @@ -error: expected one of `,`, `:`, or `>`, found `=` - --> $DIR/issue-34334.rs:2:29 +error: only path types can be used in associated type constraints + --> $DIR/issue-34334.rs:2:17 | LL | let sr: Vec<(u32, _, _) = vec![]; - | -- - ^ expected one of `,`, `:`, or `>` - | | | - | | maybe try to close unmatched angle bracket + | -- ^^^^^^^^^^^ + | | | while parsing the type for `sr` error[E0277]: a value of type `Vec<(u32, _, _)>` cannot be built from an iterator over elements of type `()` - --> $DIR/issue-34334.rs:5:87 + --> $DIR/issue-34334.rs:4:87 | LL | let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect(); | ^^^^^^^ value of type `Vec<(u32, _, _)>` cannot be built from `std::iter::Iterator` diff --git a/src/test/ui/issues/issue-46604.rs b/src/test/ui/issues/issue-46604.rs index 6ec6e7bdcb81e..273187a5a13be 100644 --- a/src/test/ui/issues/issue-46604.rs +++ b/src/test/ui/issues/issue-46604.rs @@ -1,4 +1,4 @@ -static buf: &mut [u8] = &mut [1u8,2,3,4,5,7]; //~ ERROR mutable references are not allowed +static buf: &mut [u8] = &mut [1u8,2,3,4,5,7]; //~ ERROR E0764 fn write>(buffer: T) { } fn main() { diff --git a/src/test/ui/issues/issue-46604.stderr b/src/test/ui/issues/issue-46604.stderr index 7faa2d79ba483..5421721dec2e3 100644 --- a/src/test/ui/issues/issue-46604.stderr +++ b/src/test/ui/issues/issue-46604.stderr @@ -1,8 +1,8 @@ -error[E0764]: mutable references are not allowed in the final value of statics +error[E0764]: mutable references are not allowed in statics --> $DIR/issue-46604.rs:1:25 | LL | static buf: &mut [u8] = &mut [1u8,2,3,4,5,7]; - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^ `&mut` is only allowed in `const fn` error[E0594]: cannot assign to `buf[_]`, as `buf` is an immutable static item --> $DIR/issue-46604.rs:6:5 diff --git a/src/test/ui/label/label_misspelled.rs b/src/test/ui/label/label_misspelled.rs index e3180b06ecb2b..ebfd5642c9fa8 100644 --- a/src/test/ui/label/label_misspelled.rs +++ b/src/test/ui/label/label_misspelled.rs @@ -1,62 +1,18 @@ -#![warn(unused_labels)] - fn main() { - 'while_loop: while true { //~ WARN denote infinite loops with - //~^ WARN unused label - while_loop; - //~^ ERROR cannot find value `while_loop` in this scope - }; - 'while_let: while let Some(_) = Some(()) { - //~^ WARN unused label - while_let; - //~^ ERROR cannot find value `while_let` in this scope - } - 'for_loop: for _ in 0..3 { - //~^ WARN unused label - for_loop; - //~^ ERROR cannot find value `for_loop` in this scope - }; 'LOOP: loop { - //~^ WARN unused label LOOP; //~^ ERROR cannot find value `LOOP` in this scope }; -} - -fn foo() { - 'LOOP: loop { - break LOOP; - //~^ ERROR cannot find value `LOOP` in this scope - }; 'while_loop: while true { //~ WARN denote infinite loops with - break while_loop; + while_loop; //~^ ERROR cannot find value `while_loop` in this scope }; 'while_let: while let Some(_) = Some(()) { - break while_let; + while_let; //~^ ERROR cannot find value `while_let` in this scope } 'for_loop: for _ in 0..3 { - break for_loop; + for_loop; //~^ ERROR cannot find value `for_loop` in this scope }; } - -fn bar() { - let foo = (); - 'while_loop: while true { //~ WARN denote infinite loops with - //~^ WARN unused label - break foo; - //~^ ERROR `break` with value from a `while` loop - }; - 'while_let: while let Some(_) = Some(()) { - //~^ WARN unused label - break foo; - //~^ ERROR `break` with value from a `while` loop - } - 'for_loop: for _ in 0..3 { - //~^ WARN unused label - break foo; - //~^ ERROR `break` with value from a `for` loop - }; -} diff --git a/src/test/ui/label/label_misspelled.stderr b/src/test/ui/label/label_misspelled.stderr index b09695787a443..1368ca4126cdd 100644 --- a/src/test/ui/label/label_misspelled.stderr +++ b/src/test/ui/label/label_misspelled.stderr @@ -1,206 +1,47 @@ -error[E0425]: cannot find value `while_loop` in this scope - --> $DIR/label_misspelled.rs:6:9 - | -LL | 'while_loop: while true { - | ----------- a label with a similar name exists -LL | -LL | while_loop; - | ^^^^^^^^^^ not found in this scope - -error[E0425]: cannot find value `while_let` in this scope - --> $DIR/label_misspelled.rs:11:9 - | -LL | 'while_let: while let Some(_) = Some(()) { - | ---------- a label with a similar name exists -LL | -LL | while_let; - | ^^^^^^^^^ not found in this scope - -error[E0425]: cannot find value `for_loop` in this scope - --> $DIR/label_misspelled.rs:16:9 - | -LL | 'for_loop: for _ in 0..3 { - | --------- a label with a similar name exists -LL | -LL | for_loop; - | ^^^^^^^^ not found in this scope - error[E0425]: cannot find value `LOOP` in this scope - --> $DIR/label_misspelled.rs:21:9 + --> $DIR/label_misspelled.rs:3:9 | -LL | 'LOOP: loop { - | ----- a label with a similar name exists -LL | LL | LOOP; - | ^^^^ not found in this scope - -error[E0425]: cannot find value `LOOP` in this scope - --> $DIR/label_misspelled.rs:28:15 - | -LL | 'LOOP: loop { - | ----- a label with a similar name exists -LL | break LOOP; - | ^^^^ - | | - | not found in this scope - | help: use the similarly named label: `'LOOP` + | ^^^^ + | | + | not found in this scope + | help: a label with a similar name exists: `'LOOP` error[E0425]: cannot find value `while_loop` in this scope - --> $DIR/label_misspelled.rs:32:15 + --> $DIR/label_misspelled.rs:7:9 | -LL | 'while_loop: while true { - | ----------- a label with a similar name exists -LL | break while_loop; - | ^^^^^^^^^^ - | | - | not found in this scope - | help: use the similarly named label: `'while_loop` +LL | while_loop; + | ^^^^^^^^^^ + | | + | not found in this scope + | help: a label with a similar name exists: `'while_loop` error[E0425]: cannot find value `while_let` in this scope - --> $DIR/label_misspelled.rs:36:15 + --> $DIR/label_misspelled.rs:11:9 | -LL | 'while_let: while let Some(_) = Some(()) { - | ---------- a label with a similar name exists -LL | break while_let; - | ^^^^^^^^^ - | | - | not found in this scope - | help: use the similarly named label: `'while_let` +LL | while_let; + | ^^^^^^^^^ + | | + | not found in this scope + | help: a label with a similar name exists: `'while_let` error[E0425]: cannot find value `for_loop` in this scope - --> $DIR/label_misspelled.rs:40:15 - | -LL | 'for_loop: for _ in 0..3 { - | --------- a label with a similar name exists -LL | break for_loop; - | ^^^^^^^^ - | | - | not found in this scope - | help: use the similarly named label: `'for_loop` - -warning: unused label - --> $DIR/label_misspelled.rs:4:5 - | -LL | 'while_loop: while true { - | ^^^^^^^^^^^ + --> $DIR/label_misspelled.rs:15:9 | -note: the lint level is defined here - --> $DIR/label_misspelled.rs:1:9 - | -LL | #![warn(unused_labels)] - | ^^^^^^^^^^^^^ +LL | for_loop; + | ^^^^^^^^ + | | + | not found in this scope + | help: a label with a similar name exists: `'for_loop` warning: denote infinite loops with `loop { ... }` - --> $DIR/label_misspelled.rs:4:5 + --> $DIR/label_misspelled.rs:6:5 | LL | 'while_loop: while true { | ^^^^^^^^^^^^^^^^^^^^^^^ help: use `loop` | = note: `#[warn(while_true)]` on by default -warning: unused label - --> $DIR/label_misspelled.rs:9:5 - | -LL | 'while_let: while let Some(_) = Some(()) { - | ^^^^^^^^^^ - -warning: unused label - --> $DIR/label_misspelled.rs:14:5 - | -LL | 'for_loop: for _ in 0..3 { - | ^^^^^^^^^ - -warning: unused label - --> $DIR/label_misspelled.rs:19:5 - | -LL | 'LOOP: loop { - | ^^^^^ - -warning: denote infinite loops with `loop { ... }` - --> $DIR/label_misspelled.rs:31:5 - | -LL | 'while_loop: while true { - | ^^^^^^^^^^^^^^^^^^^^^^^ help: use `loop` - -warning: unused label - --> $DIR/label_misspelled.rs:47:5 - | -LL | 'while_loop: while true { - | ^^^^^^^^^^^ - -warning: denote infinite loops with `loop { ... }` - --> $DIR/label_misspelled.rs:47:5 - | -LL | 'while_loop: while true { - | ^^^^^^^^^^^^^^^^^^^^^^^ help: use `loop` - -warning: unused label - --> $DIR/label_misspelled.rs:52:5 - | -LL | 'while_let: while let Some(_) = Some(()) { - | ^^^^^^^^^^ - -warning: unused label - --> $DIR/label_misspelled.rs:57:5 - | -LL | 'for_loop: for _ in 0..3 { - | ^^^^^^^^^ - -error[E0571]: `break` with value from a `while` loop - --> $DIR/label_misspelled.rs:49:9 - | -LL | 'while_loop: while true { - | ----------------------- you can't `break` with a value in a `while` loop -LL | -LL | break foo; - | ^^^^^^^^^ can only break with a value inside `loop` or breakable block - | -help: use `break` on its own without a value inside this `while` loop - | -LL | break; - | ^^^^^ -help: alternatively, you might have meant to use the available loop label - | -LL | break 'while_loop; - | ^^^^^^^^^^^ - -error[E0571]: `break` with value from a `while` loop - --> $DIR/label_misspelled.rs:54:9 - | -LL | 'while_let: while let Some(_) = Some(()) { - | ---------------------------------------- you can't `break` with a value in a `while` loop -LL | -LL | break foo; - | ^^^^^^^^^ can only break with a value inside `loop` or breakable block - | -help: use `break` on its own without a value inside this `while` loop - | -LL | break; - | ^^^^^ -help: alternatively, you might have meant to use the available loop label - | -LL | break 'while_let; - | ^^^^^^^^^^ - -error[E0571]: `break` with value from a `for` loop - --> $DIR/label_misspelled.rs:59:9 - | -LL | 'for_loop: for _ in 0..3 { - | ------------------------ you can't `break` with a value in a `for` loop -LL | -LL | break foo; - | ^^^^^^^^^ can only break with a value inside `loop` or breakable block - | -help: use `break` on its own without a value inside this `for` loop - | -LL | break; - | ^^^^^ -help: alternatively, you might have meant to use the available loop label - | -LL | break 'for_loop; - | ^^^^^^^^^ - -error: aborting due to 11 previous errors; 10 warnings emitted +error: aborting due to 4 previous errors; 1 warning emitted -Some errors have detailed explanations: E0425, E0571. -For more information about an error, try `rustc --explain E0425`. +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/label/label_misspelled_2.rs b/src/test/ui/label/label_misspelled_2.rs deleted file mode 100644 index 55bbe6b30a593..0000000000000 --- a/src/test/ui/label/label_misspelled_2.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![warn(unused_labels)] - -fn main() { - 'a: for _ in 0..1 { - break 'a; - } - 'b: for _ in 0..1 { - break b; //~ ERROR cannot find value `b` in this scope - } - c: for _ in 0..1 { //~ ERROR malformed loop label - break 'c; - } - d: for _ in 0..1 { //~ ERROR malformed loop label - break d; //~ ERROR cannot find value `d` in this scope - } -} diff --git a/src/test/ui/label/label_misspelled_2.stderr b/src/test/ui/label/label_misspelled_2.stderr deleted file mode 100644 index 960646d9894d1..0000000000000 --- a/src/test/ui/label/label_misspelled_2.stderr +++ /dev/null @@ -1,37 +0,0 @@ -error: malformed loop label - --> $DIR/label_misspelled_2.rs:10:5 - | -LL | c: for _ in 0..1 { - | ^ help: use the correct loop label format: `'c` - -error: malformed loop label - --> $DIR/label_misspelled_2.rs:13:5 - | -LL | d: for _ in 0..1 { - | ^ help: use the correct loop label format: `'d` - -error[E0425]: cannot find value `b` in this scope - --> $DIR/label_misspelled_2.rs:8:15 - | -LL | 'b: for _ in 0..1 { - | -- a label with a similar name exists -LL | break b; - | ^ - | | - | not found in this scope - | help: use the similarly named label: `'b` - -error[E0425]: cannot find value `d` in this scope - --> $DIR/label_misspelled_2.rs:14:15 - | -LL | d: for _ in 0..1 { - | - a label with a similar name exists -LL | break d; - | ^ - | | - | not found in this scope - | help: use the similarly named label: `'d` - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/lint/dead-code/const-and-self.rs b/src/test/ui/lint/dead-code/const-and-self.rs index 0bcdd6edf0d66..1a7b3f43cda14 100644 --- a/src/test/ui/lint/dead-code/const-and-self.rs +++ b/src/test/ui/lint/dead-code/const-and-self.rs @@ -1,6 +1,6 @@ // check-pass -#![warn(dead_code)] +#![deny(dead_code)] const TLC: usize = 4; @@ -28,27 +28,8 @@ impl Foo for X { } } -enum E { - A, - B, //~ WARN variant is never constructed: `B` - C, //~ WARN variant is never constructed: `C` -} - -type F = E; - -impl E { - fn check(&self) -> bool { - match self { - Self::A => true, - Self::B => false, - F::C => false, - } - } -} - fn main() { let s = [0,1,2,3]; s.doit(); X::foo(); - E::A.check(); } diff --git a/src/test/ui/lint/dead-code/const-and-self.stderr b/src/test/ui/lint/dead-code/const-and-self.stderr deleted file mode 100644 index c0e406189e8ab..0000000000000 --- a/src/test/ui/lint/dead-code/const-and-self.stderr +++ /dev/null @@ -1,20 +0,0 @@ -warning: variant is never constructed: `B` - --> $DIR/const-and-self.rs:33:5 - | -LL | B, - | ^ - | -note: the lint level is defined here - --> $DIR/const-and-self.rs:3:9 - | -LL | #![warn(dead_code)] - | ^^^^^^^^^ - -warning: variant is never constructed: `C` - --> $DIR/const-and-self.rs:34:5 - | -LL | C, - | ^ - -warning: 2 warnings emitted - diff --git a/src/test/ui/lint/lint-const-item-mutation.stderr b/src/test/ui/lint/lint-const-item-mutation.stderr index 540e076c7e4c6..3973af540c81f 100644 --- a/src/test/ui/lint/lint-const-item-mutation.stderr +++ b/src/test/ui/lint/lint-const-item-mutation.stderr @@ -109,8 +109,14 @@ LL | VEC.push(0); note: mutable reference created due to call to this method --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | -LL | pub fn push(&mut self, value: T) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / pub fn push(&mut self, value: T) { +LL | | // This will panic or abort if we would allocate > isize::MAX bytes +LL | | // or if the length increment would overflow for zero-sized types. +LL | | if self.len == self.buf.capacity() { +... | +LL | | } +LL | | } + | |_____^ note: `const` item defined here --> $DIR/lint-const-item-mutation.rs:31:1 | diff --git a/src/test/ui/lint/lint-removed-cmdline.stderr b/src/test/ui/lint/lint-removed-cmdline.stderr index fc2ba92479cc6..1c45c38774e5a 100644 --- a/src/test/ui/lint/lint-removed-cmdline.stderr +++ b/src/test/ui/lint/lint-removed-cmdline.stderr @@ -1,16 +1,16 @@ -warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok +warning: lint `raw_pointer_derive` has been removed: `using derive with raw pointers is ok` | = note: requested on the command line with `-D raw_pointer_derive` -warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok +warning: lint `raw_pointer_derive` has been removed: `using derive with raw pointers is ok` | = note: requested on the command line with `-D raw_pointer_derive` -warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok +warning: lint `raw_pointer_derive` has been removed: `using derive with raw pointers is ok` | = note: requested on the command line with `-D raw_pointer_derive` -warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok +warning: lint `raw_pointer_derive` has been removed: `using derive with raw pointers is ok` | = note: requested on the command line with `-D raw_pointer_derive` diff --git a/src/test/ui/lint/lint-removed.stderr b/src/test/ui/lint/lint-removed.stderr index dc0515b84820b..44480d84203bd 100644 --- a/src/test/ui/lint/lint-removed.stderr +++ b/src/test/ui/lint/lint-removed.stderr @@ -1,4 +1,4 @@ -warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok +warning: lint `raw_pointer_derive` has been removed: `using derive with raw pointers is ok` --> $DIR/lint-removed.rs:6:8 | LL | #[deny(raw_pointer_derive)] diff --git a/src/test/ui/lint/lint-unexported-no-mangle.stderr b/src/test/ui/lint/lint-unexported-no-mangle.stderr index 66d64e8937a2b..48d9b38a99b65 100644 --- a/src/test/ui/lint/lint-unexported-no-mangle.stderr +++ b/src/test/ui/lint/lint-unexported-no-mangle.stderr @@ -1,32 +1,32 @@ -warning: lint `private_no_mangle_fns` has been removed: no longer a warning, `#[no_mangle]` functions always exported +warning: lint `private_no_mangle_fns` has been removed: `no longer a warning, `#[no_mangle]` functions always exported` | = note: requested on the command line with `-F private_no_mangle_fns` -warning: lint `private_no_mangle_statics` has been removed: no longer a warning, `#[no_mangle]` statics always exported +warning: lint `private_no_mangle_statics` has been removed: `no longer a warning, `#[no_mangle]` statics always exported` | = note: requested on the command line with `-F private_no_mangle_statics` -warning: lint `private_no_mangle_fns` has been removed: no longer a warning, `#[no_mangle]` functions always exported +warning: lint `private_no_mangle_fns` has been removed: `no longer a warning, `#[no_mangle]` functions always exported` | = note: requested on the command line with `-F private_no_mangle_fns` -warning: lint `private_no_mangle_statics` has been removed: no longer a warning, `#[no_mangle]` statics always exported +warning: lint `private_no_mangle_statics` has been removed: `no longer a warning, `#[no_mangle]` statics always exported` | = note: requested on the command line with `-F private_no_mangle_statics` -warning: lint `private_no_mangle_fns` has been removed: no longer a warning, `#[no_mangle]` functions always exported +warning: lint `private_no_mangle_fns` has been removed: `no longer a warning, `#[no_mangle]` functions always exported` | = note: requested on the command line with `-F private_no_mangle_fns` -warning: lint `private_no_mangle_statics` has been removed: no longer a warning, `#[no_mangle]` statics always exported +warning: lint `private_no_mangle_statics` has been removed: `no longer a warning, `#[no_mangle]` statics always exported` | = note: requested on the command line with `-F private_no_mangle_statics` -warning: lint `private_no_mangle_fns` has been removed: no longer a warning, `#[no_mangle]` functions always exported +warning: lint `private_no_mangle_fns` has been removed: `no longer a warning, `#[no_mangle]` functions always exported` | = note: requested on the command line with `-F private_no_mangle_fns` -warning: lint `private_no_mangle_statics` has been removed: no longer a warning, `#[no_mangle]` statics always exported +warning: lint `private_no_mangle_statics` has been removed: `no longer a warning, `#[no_mangle]` statics always exported` | = note: requested on the command line with `-F private_no_mangle_statics` diff --git a/src/test/ui/loops/loop-break-value-no-repeat.stderr b/src/test/ui/loops/loop-break-value-no-repeat.stderr index 1c0d39a6e5ad7..ff93e9220e986 100644 --- a/src/test/ui/loops/loop-break-value-no-repeat.stderr +++ b/src/test/ui/loops/loop-break-value-no-repeat.stderr @@ -1,12 +1,10 @@ error[E0571]: `break` with value from a `for` loop --> $DIR/loop-break-value-no-repeat.rs:12:9 | -LL | for _ in &[1,2,3] { - | ----------------- you can't `break` with a value in a `for` loop LL | break 22 | ^^^^^^^^ can only break with a value inside `loop` or breakable block | -help: use `break` on its own without a value inside this `for` loop +help: instead, use `break` on its own without a value inside this `for` loop | LL | break | ^^^^^ diff --git a/src/test/ui/loops/loop-break-value.rs b/src/test/ui/loops/loop-break-value.rs index 51c9a36a03956..8a080cfdf494a 100644 --- a/src/test/ui/loops/loop-break-value.rs +++ b/src/test/ui/loops/loop-break-value.rs @@ -94,5 +94,6 @@ fn main() { 'LOOP: for _ in 0 .. 9 { break LOOP; //~^ ERROR cannot find value `LOOP` in this scope + //~| ERROR `break` with value from a `for` loop } } diff --git a/src/test/ui/loops/loop-break-value.stderr b/src/test/ui/loops/loop-break-value.stderr index adb099f9b1769..0237435c8b46a 100644 --- a/src/test/ui/loops/loop-break-value.stderr +++ b/src/test/ui/loops/loop-break-value.stderr @@ -1,13 +1,11 @@ error[E0425]: cannot find value `LOOP` in this scope --> $DIR/loop-break-value.rs:95:15 | -LL | 'LOOP: for _ in 0 .. 9 { - | ----- a label with a similar name exists LL | break LOOP; | ^^^^ | | | not found in this scope - | help: use the similarly named label: `'LOOP` + | help: a label with a similar name exists: `'LOOP` warning: denote infinite loops with `loop { ... }` --> $DIR/loop-break-value.rs:26:5 @@ -20,44 +18,32 @@ LL | 'while_loop: while true { error[E0571]: `break` with value from a `while` loop --> $DIR/loop-break-value.rs:28:9 | -LL | 'while_loop: while true { - | ----------------------- you can't `break` with a value in a `while` loop -LL | break; LL | break (); | ^^^^^^^^ can only break with a value inside `loop` or breakable block | -help: use `break` on its own without a value inside this `while` loop +help: instead, use `break` on its own without a value inside this `while` loop | LL | break; | ^^^^^ -help: alternatively, you might have meant to use the available loop label - | -LL | break 'while_loop; - | ^^^^^^^^^^^ error[E0571]: `break` with value from a `while` loop --> $DIR/loop-break-value.rs:30:13 | -LL | 'while_loop: while true { - | ----------------------- you can't `break` with a value in a `while` loop -... LL | break 'while_loop 123; | ^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block | -help: use `break` on its own without a value inside this `while` loop +help: instead, use `break` on its own without a value inside this `while` loop | -LL | break 'while_loop; - | ^^^^^^^^^^^^^^^^^ +LL | break; + | ^^^^^ error[E0571]: `break` with value from a `while` loop --> $DIR/loop-break-value.rs:38:12 | -LL | while let Some(_) = Some(()) { - | ---------------------------- you can't `break` with a value in a `while` loop LL | if break () { | ^^^^^^^^ can only break with a value inside `loop` or breakable block | -help: use `break` on its own without a value inside this `while` loop +help: instead, use `break` on its own without a value inside this `while` loop | LL | if break { | ^^^^^ @@ -65,12 +51,10 @@ LL | if break { error[E0571]: `break` with value from a `while` loop --> $DIR/loop-break-value.rs:43:9 | -LL | while let Some(_) = Some(()) { - | ---------------------------- you can't `break` with a value in a `while` loop LL | break None; | ^^^^^^^^^^ can only break with a value inside `loop` or breakable block | -help: use `break` on its own without a value inside this `while` loop +help: instead, use `break` on its own without a value inside this `while` loop | LL | break; | ^^^^^ @@ -78,26 +62,21 @@ LL | break; error[E0571]: `break` with value from a `while` loop --> $DIR/loop-break-value.rs:49:13 | -LL | 'while_let_loop: while let Some(_) = Some(()) { - | --------------------------------------------- you can't `break` with a value in a `while` loop -LL | loop { LL | break 'while_let_loop "nope"; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block | -help: use `break` on its own without a value inside this `while` loop +help: instead, use `break` on its own without a value inside this `while` loop | -LL | break 'while_let_loop; - | ^^^^^^^^^^^^^^^^^^^^^ +LL | break; + | ^^^^^ error[E0571]: `break` with value from a `for` loop --> $DIR/loop-break-value.rs:56:9 | -LL | for _ in &[1,2,3] { - | ----------------- you can't `break` with a value in a `for` loop LL | break (); | ^^^^^^^^ can only break with a value inside `loop` or breakable block | -help: use `break` on its own without a value inside this `for` loop +help: instead, use `break` on its own without a value inside this `for` loop | LL | break; | ^^^^^ @@ -105,13 +84,10 @@ LL | break; error[E0571]: `break` with value from a `for` loop --> $DIR/loop-break-value.rs:57:9 | -LL | for _ in &[1,2,3] { - | ----------------- you can't `break` with a value in a `for` loop -LL | break (); LL | break [()]; | ^^^^^^^^^^ can only break with a value inside `loop` or breakable block | -help: use `break` on its own without a value inside this `for` loop +help: instead, use `break` on its own without a value inside this `for` loop | LL | break; | ^^^^^ @@ -119,16 +95,24 @@ LL | break; error[E0571]: `break` with value from a `for` loop --> $DIR/loop-break-value.rs:64:13 | -LL | 'for_loop: for _ in &[1,2,3] { - | ---------------------------- you can't `break` with a value in a `for` loop -... LL | break 'for_loop Some(17); | ^^^^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block | -help: use `break` on its own without a value inside this `for` loop +help: instead, use `break` on its own without a value inside this `for` loop + | +LL | break; + | ^^^^^ + +error[E0571]: `break` with value from a `for` loop + --> $DIR/loop-break-value.rs:95:9 + | +LL | break LOOP; + | ^^^^^^^^^^ can only break with a value inside `loop` or breakable block | -LL | break 'for_loop; - | ^^^^^^^^^^^^^^^ +help: instead, use `break` on its own without a value inside this `for` loop + | +LL | break; + | ^^^^^ error[E0308]: mismatched types --> $DIR/loop-break-value.rs:4:31 @@ -187,7 +171,7 @@ LL | break; | expected integer, found `()` | help: give it a value of the expected type: `break value` -error: aborting due to 17 previous errors; 1 warning emitted +error: aborting due to 18 previous errors; 1 warning emitted Some errors have detailed explanations: E0308, E0425, E0571. For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/mir/issue-80742.rs b/src/test/ui/mir/issue-80742.rs deleted file mode 100644 index c06d182fd567d..0000000000000 --- a/src/test/ui/mir/issue-80742.rs +++ /dev/null @@ -1,33 +0,0 @@ -// check-fail - -// This test used to cause an ICE in rustc_mir::interpret::step::eval_rvalue_into_place - -#![allow(incomplete_features)] -#![feature(const_evaluatable_checked)] -#![feature(const_generics)] - -use std::fmt::Debug; -use std::marker::PhantomData; -use std::mem::size_of; - -struct Inline -where - [u8; size_of::() + 1]: , -{ - _phantom: PhantomData, - buf: [u8; size_of::() + 1], -} - -impl Inline -where - [u8; size_of::() + 1]: , -{ - pub fn new(val: T) -> Inline { - todo!() - } -} - -fn main() { - let dst = Inline::::new(0); //~ ERROR - //~^ ERROR -} diff --git a/src/test/ui/mir/issue-80742.stderr b/src/test/ui/mir/issue-80742.stderr deleted file mode 100644 index 26f9c786ba13b..0000000000000 --- a/src/test/ui/mir/issue-80742.stderr +++ /dev/null @@ -1,70 +0,0 @@ -error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/mem/mod.rs:LL:COL - | -LL | intrinsics::size_of::() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | size_of called on unsized type `dyn Debug` - | inside `std::mem::size_of::` at $SRC_DIR/core/src/mem/mod.rs:LL:COL - | - ::: $DIR/issue-80742.rs:23:10 - | -LL | [u8; size_of::() + 1]: , - | -------------- inside `Inline::::{constant#0}` at $DIR/issue-80742.rs:23:10 - -error[E0599]: no function or associated item named `new` found for struct `Inline` in the current scope - --> $DIR/issue-80742.rs:31:36 - | -LL | / struct Inline -LL | | where -LL | | [u8; size_of::() + 1]: , -LL | | { -LL | | _phantom: PhantomData, -LL | | buf: [u8; size_of::() + 1], -LL | | } - | |_- function or associated item `new` not found for this -... -LL | let dst = Inline::::new(0); - | ^^^ function or associated item not found in `Inline` - | - ::: $SRC_DIR/core/src/fmt/mod.rs:LL:COL - | -LL | pub trait Debug { - | --------------- doesn't satisfy `dyn Debug: Sized` - | - = note: the method `new` exists but the following trait bounds were not satisfied: - `dyn Debug: Sized` - -error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/mem/mod.rs:LL:COL - | -LL | intrinsics::size_of::() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | size_of called on unsized type `dyn Debug` - | inside `std::mem::size_of::` at $SRC_DIR/core/src/mem/mod.rs:LL:COL - | - ::: $DIR/issue-80742.rs:15:10 - | -LL | [u8; size_of::() + 1]: , - | -------------- inside `Inline::::{constant#0}` at $DIR/issue-80742.rs:15:10 - -error[E0277]: the size for values of type `dyn Debug` cannot be known at compilation time - --> $DIR/issue-80742.rs:31:15 - | -LL | struct Inline - | - required by this bound in `Inline` -... -LL | let dst = Inline::::new(0); - | ^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `dyn Debug` -help: consider relaxing the implicit `Sized` restriction - | -LL | struct Inline - | ^^^^^^^^ - -error: aborting due to 4 previous errors - -Some errors have detailed explanations: E0080, E0277, E0599. -For more information about an error, try `rustc --explain E0080`. diff --git a/src/test/ui/never_type/issue-52443.stderr b/src/test/ui/never_type/issue-52443.stderr index 1683841e9d781..051896cb89c8f 100644 --- a/src/test/ui/never_type/issue-52443.stderr +++ b/src/test/ui/never_type/issue-52443.stderr @@ -39,14 +39,11 @@ error[E0015]: calls in constants are limited to constant functions, tuple struct LL | [(); { for _ in 0usize.. {}; 0}]; | ^^^^^^^^ -error[E0658]: mutable references are not allowed in constants +error[E0764]: mutable references are not allowed in constants --> $DIR/issue-52443.rs:9:21 | LL | [(); { for _ in 0usize.. {}; 0}]; - | ^^^^^^^^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + | ^^^^^^^^ `&mut` is only allowed in `const fn` error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants --> $DIR/issue-52443.rs:9:21 @@ -56,5 +53,5 @@ LL | [(); { for _ in 0usize.. {}; 0}]; error: aborting due to 6 previous errors; 1 warning emitted -Some errors have detailed explanations: E0015, E0308, E0658, E0744. +Some errors have detailed explanations: E0015, E0308, E0744, E0764. For more information about an error, try `rustc --explain E0015`. diff --git a/src/test/ui/parser/missing-closing-angle-bracket-eq-constraint.rs b/src/test/ui/parser/missing-closing-angle-bracket-eq-constraint.rs deleted file mode 100644 index da95c1bfa2709..0000000000000 --- a/src/test/ui/parser/missing-closing-angle-bracket-eq-constraint.rs +++ /dev/null @@ -1,23 +0,0 @@ -struct Foo { - _a : T1, - _b : T2, -} - -fn test1(arg : T) { - let v : Vec<(u32,_) = vec![]; - //~^ ERROR: expected one of - //~| ERROR: type annotations needed -} - -fn test2(arg1 : T1, arg2 : T2) { - let foo : Foo::(arg : &'a u32) { - let v : Vec<'a = vec![]; - //~^ ERROR: expected one of - //~| ERROR: type annotations needed for `Vec` -} - -fn main() {} diff --git a/src/test/ui/parser/missing-closing-angle-bracket-eq-constraint.stderr b/src/test/ui/parser/missing-closing-angle-bracket-eq-constraint.stderr deleted file mode 100644 index ae53334f5e02a..0000000000000 --- a/src/test/ui/parser/missing-closing-angle-bracket-eq-constraint.stderr +++ /dev/null @@ -1,49 +0,0 @@ -error: expected one of `,`, `:`, or `>`, found `=` - --> $DIR/missing-closing-angle-bracket-eq-constraint.rs:7:23 - | -LL | let v : Vec<(u32,_) = vec![]; - | - - ^ expected one of `,`, `:`, or `>` - | | | - | | maybe try to close unmatched angle bracket - | while parsing the type for `v` - -error: expected one of `!`, `(`, `+`, `,`, `::`, `<`, or `>`, found `{` - --> $DIR/missing-closing-angle-bracket-eq-constraint.rs:13:32 - | -LL | let foo : Foo::`, found `=` - --> $DIR/missing-closing-angle-bracket-eq-constraint.rs:18:18 - | -LL | let v : Vec<'a = vec![]; - | - -- ^ expected one of `,`, `:`, or `>` - | | | - | | maybe try to close unmatched angle bracket - | while parsing the type for `v` - -error[E0282]: type annotations needed for `Vec` - --> $DIR/missing-closing-angle-bracket-eq-constraint.rs:7:25 - | -LL | let v : Vec<(u32,_) = vec![]; - | - ^^^^^^ cannot infer type for type parameter `T` - | | - | consider giving `v` the explicit type `Vec`, where the type parameter `T` is specified - | - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0282]: type annotations needed for `Vec` - --> $DIR/missing-closing-angle-bracket-eq-constraint.rs:18:20 - | -LL | let v : Vec<'a = vec![]; - | - ^^^^^^ cannot infer type for type parameter `T` - | | - | consider giving `v` the explicit type `Vec`, where the type parameter `T` is specified - | - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 5 previous errors - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/parser/nested-missing-closing-angle-bracket.rs b/src/test/ui/parser/nested-missing-closing-angle-bracket.rs deleted file mode 100644 index 84ffdd176aea0..0000000000000 --- a/src/test/ui/parser/nested-missing-closing-angle-bracket.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - let v : Vec:: = vec![vec![]]; - //~^ ERROR: expected one of -} diff --git a/src/test/ui/parser/nested-missing-closing-angle-bracket.stderr b/src/test/ui/parser/nested-missing-closing-angle-bracket.stderr deleted file mode 100644 index b85bc02568c77..0000000000000 --- a/src/test/ui/parser/nested-missing-closing-angle-bracket.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: expected one of `,` or `>`, found `;` - --> $DIR/nested-missing-closing-angle-bracket.rs:2:46 - | -LL | let v : Vec:: = vec![vec![]]; - | - while parsing the type for `v` ^ expected one of `,` or `>` - -error: aborting due to previous error - diff --git a/src/test/ui/proc-macro/issue-81007-item-attrs.rs b/src/test/ui/proc-macro/issue-81007-item-attrs.rs deleted file mode 100644 index ea27d54ee4148..0000000000000 --- a/src/test/ui/proc-macro/issue-81007-item-attrs.rs +++ /dev/null @@ -1,31 +0,0 @@ -// check-pass -// edition:2018 -// compile-flags: -Z span-debug -// aux-build:test-macros.rs - -#![feature(rustc_attrs)] - -#![no_std] // Don't load unnecessary hygiene information from std -extern crate std; - -#[macro_use] extern crate test_macros; - -macro_rules! capture_item { - ($item:item) => { - #[print_attr] - $item - } -} - -capture_item! { - /// A doc comment - struct Foo {} -} - -capture_item! { - #[rustc_dummy] - /// Another comment comment - struct Bar {} -} - -fn main() {} diff --git a/src/test/ui/proc-macro/issue-81007-item-attrs.stdout b/src/test/ui/proc-macro/issue-81007-item-attrs.stdout deleted file mode 100644 index 6f880a1202170..0000000000000 --- a/src/test/ui/proc-macro/issue-81007-item-attrs.stdout +++ /dev/null @@ -1,99 +0,0 @@ -PRINT-ATTR INPUT (DISPLAY): #[doc = r" A doc comment"] struct Foo { } -PRINT-ATTR INPUT (DEBUG): TokenStream [ - Punct { - ch: '#', - spacing: Alone, - span: $DIR/issue-81007-item-attrs.rs:21:5: 21:22 (#0), - }, - Group { - delimiter: Bracket, - stream: TokenStream [ - Ident { - ident: "doc", - span: $DIR/issue-81007-item-attrs.rs:21:5: 21:22 (#0), - }, - Punct { - ch: '=', - spacing: Alone, - span: $DIR/issue-81007-item-attrs.rs:21:5: 21:22 (#0), - }, - Literal { - kind: StrRaw(0), - symbol: " A doc comment", - suffix: None, - span: $DIR/issue-81007-item-attrs.rs:21:5: 21:22 (#0), - }, - ], - span: $DIR/issue-81007-item-attrs.rs:21:5: 21:22 (#0), - }, - Ident { - ident: "struct", - span: $DIR/issue-81007-item-attrs.rs:22:5: 22:11 (#0), - }, - Ident { - ident: "Foo", - span: $DIR/issue-81007-item-attrs.rs:22:12: 22:15 (#0), - }, - Group { - delimiter: Brace, - stream: TokenStream [], - span: $DIR/issue-81007-item-attrs.rs:22:16: 22:18 (#0), - }, -] -PRINT-ATTR INPUT (DISPLAY): #[rustc_dummy] #[doc = r" Another comment comment"] struct Bar { } -PRINT-ATTR INPUT (DEBUG): TokenStream [ - Punct { - ch: '#', - spacing: Alone, - span: $DIR/issue-81007-item-attrs.rs:26:5: 26:6 (#0), - }, - Group { - delimiter: Bracket, - stream: TokenStream [ - Ident { - ident: "rustc_dummy", - span: $DIR/issue-81007-item-attrs.rs:26:7: 26:18 (#0), - }, - ], - span: $DIR/issue-81007-item-attrs.rs:26:6: 26:19 (#0), - }, - Punct { - ch: '#', - spacing: Alone, - span: $DIR/issue-81007-item-attrs.rs:27:5: 27:32 (#0), - }, - Group { - delimiter: Bracket, - stream: TokenStream [ - Ident { - ident: "doc", - span: $DIR/issue-81007-item-attrs.rs:27:5: 27:32 (#0), - }, - Punct { - ch: '=', - spacing: Alone, - span: $DIR/issue-81007-item-attrs.rs:27:5: 27:32 (#0), - }, - Literal { - kind: StrRaw(0), - symbol: " Another comment comment", - suffix: None, - span: $DIR/issue-81007-item-attrs.rs:27:5: 27:32 (#0), - }, - ], - span: $DIR/issue-81007-item-attrs.rs:27:5: 27:32 (#0), - }, - Ident { - ident: "struct", - span: $DIR/issue-81007-item-attrs.rs:28:5: 28:11 (#0), - }, - Ident { - ident: "Bar", - span: $DIR/issue-81007-item-attrs.rs:28:12: 28:15 (#0), - }, - Group { - delimiter: Brace, - stream: TokenStream [], - span: $DIR/issue-81007-item-attrs.rs:28:16: 28:18 (#0), - }, -] diff --git a/src/test/ui/resolve/crate-called-as-function.rs b/src/test/ui/resolve/crate-called-as-function.rs deleted file mode 100644 index e8f52c0c029aa..0000000000000 --- a/src/test/ui/resolve/crate-called-as-function.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - ::foo() //~ cannot find external crate `foo` in the crate root -} diff --git a/src/test/ui/resolve/crate-called-as-function.stderr b/src/test/ui/resolve/crate-called-as-function.stderr deleted file mode 100644 index eb42349aff1b6..0000000000000 --- a/src/test/ui/resolve/crate-called-as-function.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0425]: cannot find external crate `foo` in the crate root - --> $DIR/crate-called-as-function.rs:2:7 - | -LL | ::foo() - | ^^^ not found in the crate root - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/resolve/missing-in-namespace.rs b/src/test/ui/resolve/missing-in-namespace.rs deleted file mode 100644 index e1dedb072b77b..0000000000000 --- a/src/test/ui/resolve/missing-in-namespace.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - let _map = std::hahmap::HashMap::new(); - //~^ ERROR failed to resolve: could not find `hahmap` in `std -} diff --git a/src/test/ui/resolve/missing-in-namespace.stderr b/src/test/ui/resolve/missing-in-namespace.stderr deleted file mode 100644 index 8b292aeda5074..0000000000000 --- a/src/test/ui/resolve/missing-in-namespace.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0433]: failed to resolve: could not find `hahmap` in `std` - --> $DIR/missing-in-namespace.rs:2:29 - | -LL | let _map = std::hahmap::HashMap::new(); - | ^^^^^^^ not found in `std::hahmap` - | -help: consider importing this struct - | -LL | use std::collections::HashMap; - | - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0433`. diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.rs b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.rs index 61212f299bec7..4f53108b3a938 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.rs +++ b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.rs @@ -2,5 +2,5 @@ fn main() { let s = ::xcrate::S; - //~^ ERROR failed to resolve: could not find `xcrate` in crate root + //~^ ERROR failed to resolve: could not find `xcrate` in `{{root}}` } diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.stderr index 8b2a6933f37bf..7395d01d8ac44 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.stderr +++ b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.stderr @@ -1,8 +1,8 @@ -error[E0433]: failed to resolve: could not find `xcrate` in crate root +error[E0433]: failed to resolve: could not find `xcrate` in `{{root}}` --> $DIR/non-existent-2.rs:4:15 | LL | let s = ::xcrate::S; - | ^^^^^^ could not find `xcrate` in crate root + | ^^^^^^ could not find `xcrate` in `{{root}}` error: aborting due to previous error diff --git a/src/test/ui/traits/mutual-recursion-issue-75860.rs b/src/test/ui/traits/mutual-recursion-issue-75860.rs deleted file mode 100644 index d7d7307b42431..0000000000000 --- a/src/test/ui/traits/mutual-recursion-issue-75860.rs +++ /dev/null @@ -1,15 +0,0 @@ -pub fn iso(a: F1, b: F2) -> (Box B>, Box A>) - where - F1: (Fn(A) -> B) + 'static, - F2: (Fn(B) -> A) + 'static, -{ - (Box::new(a), Box::new(b)) -} -pub fn iso_un_option() -> (Box B>, Box A>) { - let left = |o_a: Option<_>| o_a.unwrap(); - let right = |o_b: Option<_>| o_b.unwrap(); - iso(left, right) - //~^ ERROR overflow -} - -fn main() {} diff --git a/src/test/ui/traits/mutual-recursion-issue-75860.stderr b/src/test/ui/traits/mutual-recursion-issue-75860.stderr deleted file mode 100644 index cf867ef78c3b1..0000000000000 --- a/src/test/ui/traits/mutual-recursion-issue-75860.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0275]: overflow evaluating the requirement `Option<_>: Sized` - --> $DIR/mutual-recursion-issue-75860.rs:11:5 - | -LL | iso(left, right) - | ^^^ - | - ::: $SRC_DIR/core/src/option.rs:LL:COL - | -LL | pub enum Option { - | - required by this bound in `Option` - | - = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`mutual_recursion_issue_75860`) - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0275`. diff --git a/src/test/ui/unsafe/ranged_ints2_const.rs b/src/test/ui/unsafe/ranged_ints2_const.rs index b7178c2b52bfb..65e0d79308ca3 100644 --- a/src/test/ui/unsafe/ranged_ints2_const.rs +++ b/src/test/ui/unsafe/ranged_ints2_const.rs @@ -18,9 +18,3 @@ const fn bar() -> NonZero { let y = unsafe { &mut x.0 }; //~ ERROR mutable references unsafe { NonZero(1) } } - -const fn boo() -> NonZero { - let mut x = unsafe { NonZero(1) }; - unsafe { let y = &mut x.0; } //~ ERROR mutable references - unsafe { NonZero(1) } -} diff --git a/src/test/ui/unsafe/ranged_ints2_const.stderr b/src/test/ui/unsafe/ranged_ints2_const.stderr index a0dc950e76dd1..5ce4296458e6d 100644 --- a/src/test/ui/unsafe/ranged_ints2_const.stderr +++ b/src/test/ui/unsafe/ranged_ints2_const.stderr @@ -16,15 +16,6 @@ LL | let y = unsafe { &mut x.0 }; = note: see issue #57349 for more information = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable -error[E0658]: mutable references are not allowed in constant functions - --> $DIR/ranged_ints2_const.rs:24:22 - | -LL | unsafe { let y = &mut x.0; } - | ^^^^^^^^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block --> $DIR/ranged_ints2_const.rs:11:13 | @@ -33,7 +24,7 @@ LL | let y = &mut x.0; | = note: mutating layout constrained fields cannot statically be checked for valid values -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors Some errors have detailed explanations: E0133, E0658. For more information about an error, try `rustc --explain E0133`. diff --git a/src/tools/cargo b/src/tools/cargo index 783bc43c660bf..a73e5b7d567c3 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit 783bc43c660bf39c1e562c8c429b32078ad3099b +Subproject commit a73e5b7d567c3036b296fc6b33ed52c5edcd882e diff --git a/src/tools/clippy/clippy_lints/src/doc.rs b/src/tools/clippy/clippy_lints/src/doc.rs index 3a754f4991782..f518da55cd76f 100644 --- a/src/tools/clippy/clippy_lints/src/doc.rs +++ b/src/tools/clippy/clippy_lints/src/doc.rs @@ -12,7 +12,6 @@ use rustc_lint::{LateContext, LateLintPass}; use rustc_middle::lint::in_external_macro; use rustc_middle::ty; use rustc_parse::maybe_new_parser_from_source_str; -use rustc_parse::parser::ForceCollect; use rustc_session::parse::ParseSess; use rustc_session::{declare_tool_lint, impl_lint_pass}; use rustc_span::edition::Edition; @@ -484,7 +483,7 @@ fn check_code(cx: &LateContext<'_>, text: &str, edition: Edition, span: Span) { let mut relevant_main_found = false; loop { - match parser.parse_item(ForceCollect::No) { + match parser.parse_item() { Ok(Some(item)) => match &item.kind { // Tests with one of these items are ignored ItemKind::Static(..) diff --git a/src/tools/clippy/clippy_lints/src/loops.rs b/src/tools/clippy/clippy_lints/src/loops.rs index bbcea387de2cb..1c5ab2874b048 100644 --- a/src/tools/clippy/clippy_lints/src/loops.rs +++ b/src/tools/clippy/clippy_lints/src/loops.rs @@ -533,7 +533,7 @@ impl<'tcx> LateLintPass<'tcx> for Loops { } // check for never_loop - if let ExprKind::Loop(ref block, _, _, _) = expr.kind { + if let ExprKind::Loop(ref block, _, _) = expr.kind { match never_loop_block(block, expr.hir_id) { NeverLoopResult::AlwaysBreak => span_lint(cx, NEVER_LOOP, expr.span, "this loop never actually loops"), NeverLoopResult::MayContinueMainLoop | NeverLoopResult::Otherwise => (), @@ -543,7 +543,7 @@ impl<'tcx> LateLintPass<'tcx> for Loops { // check for `loop { if let {} else break }` that could be `while let` // (also matches an explicit "match" instead of "if let") // (even if the "match" or "if let" is used for declaration) - if let ExprKind::Loop(ref block, _, LoopSource::Loop, _) = expr.kind { + if let ExprKind::Loop(ref block, _, LoopSource::Loop) = expr.kind { // also check for empty `loop {}` statements, skipping those in #[panic_handler] if block.stmts.is_empty() && block.expr.is_none() && !is_in_panic_handler(cx, expr) { let msg = "empty `loop {}` wastes CPU cycles"; @@ -738,7 +738,7 @@ fn never_loop_expr(expr: &Expr<'_>, main_loop_id: HirId) -> NeverLoopResult { | ExprKind::Assign(ref e1, ref e2, _) | ExprKind::AssignOp(_, ref e1, ref e2) | ExprKind::Index(ref e1, ref e2) => never_loop_expr_all(&mut [&**e1, &**e2].iter().cloned(), main_loop_id), - ExprKind::Loop(ref b, _, _, _) => { + ExprKind::Loop(ref b, _, _) => { // Break can come from the inner loop so remove them. absorb_break(&never_loop_block(b, main_loop_id)) }, @@ -1314,7 +1314,7 @@ impl<'a, 'tcx> Visitor<'tcx> for SameItemPushVisitor<'a, 'tcx> { fn visit_expr(&mut self, expr: &'tcx Expr<'_>) { match &expr.kind { // Non-determinism may occur ... don't give a lint - ExprKind::Loop(..) | ExprKind::Match(..) => self.should_lint = false, + ExprKind::Loop(_, _, _) | ExprKind::Match(_, _, _) => self.should_lint = false, ExprKind::Block(block, _) => self.visit_block(block), _ => {}, } diff --git a/src/tools/clippy/clippy_lints/src/needless_continue.rs b/src/tools/clippy/clippy_lints/src/needless_continue.rs index 603071a5f4ac4..a971d041ca661 100644 --- a/src/tools/clippy/clippy_lints/src/needless_continue.rs +++ b/src/tools/clippy/clippy_lints/src/needless_continue.rs @@ -221,7 +221,7 @@ where { if let ast::ExprKind::While(_, loop_block, label) | ast::ExprKind::ForLoop(_, _, loop_block, label) - | ast::ExprKind::Loop(loop_block, label, ..) = &expr.kind + | ast::ExprKind::Loop(loop_block, label) = &expr.kind { func(loop_block, label.as_ref()); } diff --git a/src/tools/clippy/clippy_lints/src/shadow.rs b/src/tools/clippy/clippy_lints/src/shadow.rs index d5b1767e945b9..24da056770c9d 100644 --- a/src/tools/clippy/clippy_lints/src/shadow.rs +++ b/src/tools/clippy/clippy_lints/src/shadow.rs @@ -325,7 +325,7 @@ fn check_expr<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, bindings: &mut | ExprKind::Field(ref e, _) | ExprKind::AddrOf(_, _, ref e) | ExprKind::Box(ref e) => check_expr(cx, e, bindings), - ExprKind::Block(ref block, _) | ExprKind::Loop(ref block, ..) => check_block(cx, block, bindings), + ExprKind::Block(ref block, _) | ExprKind::Loop(ref block, _, _) => check_block(cx, block, bindings), // ExprKind::Call // ExprKind::MethodCall ExprKind::Array(v) | ExprKind::Tup(v) => { diff --git a/src/tools/clippy/clippy_lints/src/utils/author.rs b/src/tools/clippy/clippy_lints/src/utils/author.rs index ca60d335262b3..43afa65de3e55 100644 --- a/src/tools/clippy/clippy_lints/src/utils/author.rs +++ b/src/tools/clippy/clippy_lints/src/utils/author.rs @@ -317,7 +317,7 @@ impl<'tcx> Visitor<'tcx> for PrintVisitor { self.current = cast_pat; self.visit_expr(expr); }, - ExprKind::Loop(ref body, _, desugaring, _) => { + ExprKind::Loop(ref body, _, desugaring) => { let body_pat = self.next("body"); let des = loop_desugaring_name(desugaring); let label_pat = self.next("label"); diff --git a/src/tools/clippy/clippy_lints/src/utils/higher.rs b/src/tools/clippy/clippy_lints/src/utils/higher.rs index 42ab9a1e7d247..9b3585865da32 100644 --- a/src/tools/clippy/clippy_lints/src/utils/higher.rs +++ b/src/tools/clippy/clippy_lints/src/utils/higher.rs @@ -142,7 +142,7 @@ pub fn for_loop<'tcx>( if let hir::ExprKind::Match(ref iterexpr, ref arms, hir::MatchSource::ForLoopDesugar) = expr.kind; if let hir::ExprKind::Call(_, ref iterargs) = iterexpr.kind; if iterargs.len() == 1 && arms.len() == 1 && arms[0].guard.is_none(); - if let hir::ExprKind::Loop(ref block, ..) = arms[0].body.kind; + if let hir::ExprKind::Loop(ref block, _, _) = arms[0].body.kind; if block.expr.is_none(); if let [ _, _, ref let_stmt, ref body ] = *block.stmts; if let hir::StmtKind::Local(ref local) = let_stmt.kind; @@ -158,7 +158,7 @@ pub fn for_loop<'tcx>( /// `while cond { body }` becomes `(cond, body)`. pub fn while_loop<'tcx>(expr: &'tcx hir::Expr<'tcx>) -> Option<(&'tcx hir::Expr<'tcx>, &'tcx hir::Expr<'tcx>)> { if_chain! { - if let hir::ExprKind::Loop(block, _, hir::LoopSource::While, _) = &expr.kind; + if let hir::ExprKind::Loop(block, _, hir::LoopSource::While) = &expr.kind; if let hir::Block { expr: Some(expr), .. } = &**block; if let hir::ExprKind::Match(cond, arms, hir::MatchSource::WhileDesugar) = &expr.kind; if let hir::ExprKind::DropTemps(cond) = &cond.kind; diff --git a/src/tools/clippy/clippy_lints/src/utils/hir_utils.rs b/src/tools/clippy/clippy_lints/src/utils/hir_utils.rs index 6066383f2ef42..10120a8805db2 100644 --- a/src/tools/clippy/clippy_lints/src/utils/hir_utils.rs +++ b/src/tools/clippy/clippy_lints/src/utils/hir_utils.rs @@ -123,7 +123,7 @@ impl<'a, 'tcx> SpanlessEq<'a, 'tcx> { self.eq_expr(lc, rc) && self.eq_expr(&**lt, &**rt) && both(le, re, |l, r| self.eq_expr(l, r)) }, (&ExprKind::Lit(ref l), &ExprKind::Lit(ref r)) => l.node == r.node, - (&ExprKind::Loop(ref lb, ref ll, ref lls, _), &ExprKind::Loop(ref rb, ref rl, ref rls, _)) => { + (&ExprKind::Loop(ref lb, ref ll, ref lls), &ExprKind::Loop(ref rb, ref rl, ref rls)) => { lls == rls && self.eq_block(lb, rb) && both(ll, rl, |l, r| l.ident.name == r.ident.name) }, (&ExprKind::Match(ref le, ref la, ref ls), &ExprKind::Match(ref re, ref ra, ref rs)) => { @@ -560,7 +560,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> { ExprKind::Lit(ref l) => { l.node.hash(&mut self.s); }, - ExprKind::Loop(ref b, ref i, ..) => { + ExprKind::Loop(ref b, ref i, _) => { self.hash_block(b); if let Some(i) = *i { self.hash_name(i.ident.name); diff --git a/src/tools/clippy/tests/ui/deprecated.stderr b/src/tools/clippy/tests/ui/deprecated.stderr index f361db6b147da..3429317498ed6 100644 --- a/src/tools/clippy/tests/ui/deprecated.stderr +++ b/src/tools/clippy/tests/ui/deprecated.stderr @@ -1,4 +1,4 @@ -error: lint `clippy::unstable_as_slice` has been removed: `Vec::as_slice` has been stabilized in 1.7 +error: lint `clippy::unstable_as_slice` has been removed: ``Vec::as_slice` has been stabilized in 1.7` --> $DIR/deprecated.rs:1:8 | LL | #[warn(clippy::unstable_as_slice)] @@ -6,73 +6,73 @@ LL | #[warn(clippy::unstable_as_slice)] | = note: `-D renamed-and-removed-lints` implied by `-D warnings` -error: lint `clippy::unstable_as_mut_slice` has been removed: `Vec::as_mut_slice` has been stabilized in 1.7 +error: lint `clippy::unstable_as_mut_slice` has been removed: ``Vec::as_mut_slice` has been stabilized in 1.7` --> $DIR/deprecated.rs:2:8 | LL | #[warn(clippy::unstable_as_mut_slice)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: lint `clippy::misaligned_transmute` has been removed: this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr +error: lint `clippy::misaligned_transmute` has been removed: `this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr` --> $DIR/deprecated.rs:3:8 | LL | #[warn(clippy::misaligned_transmute)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: lint `clippy::unused_collect` has been removed: `collect` has been marked as #[must_use] in rustc and that covers all cases of this lint +error: lint `clippy::unused_collect` has been removed: ``collect` has been marked as #[must_use] in rustc and that covers all cases of this lint` --> $DIR/deprecated.rs:4:8 | LL | #[warn(clippy::unused_collect)] | ^^^^^^^^^^^^^^^^^^^^^^ -error: lint `clippy::invalid_ref` has been removed: superseded by rustc lint `invalid_value` +error: lint `clippy::invalid_ref` has been removed: `superseded by rustc lint `invalid_value`` --> $DIR/deprecated.rs:5:8 | LL | #[warn(clippy::invalid_ref)] | ^^^^^^^^^^^^^^^^^^^ -error: lint `clippy::into_iter_on_array` has been removed: this lint has been uplifted to rustc and is now called `array_into_iter` +error: lint `clippy::into_iter_on_array` has been removed: `this lint has been uplifted to rustc and is now called `array_into_iter`` --> $DIR/deprecated.rs:6:8 | LL | #[warn(clippy::into_iter_on_array)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: lint `clippy::unused_label` has been removed: this lint has been uplifted to rustc and is now called `unused_labels` +error: lint `clippy::unused_label` has been removed: `this lint has been uplifted to rustc and is now called `unused_labels`` --> $DIR/deprecated.rs:7:8 | LL | #[warn(clippy::unused_label)] | ^^^^^^^^^^^^^^^^^^^^ -error: lint `clippy::regex_macro` has been removed: the regex! macro has been removed from the regex crate in 2018 +error: lint `clippy::regex_macro` has been removed: `the regex! macro has been removed from the regex crate in 2018` --> $DIR/deprecated.rs:8:8 | LL | #[warn(clippy::regex_macro)] | ^^^^^^^^^^^^^^^^^^^ -error: lint `clippy::drop_bounds` has been removed: this lint has been uplifted to rustc and is now called `drop_bounds` +error: lint `clippy::drop_bounds` has been removed: `this lint has been uplifted to rustc and is now called `drop_bounds`` --> $DIR/deprecated.rs:9:8 | LL | #[warn(clippy::drop_bounds)] | ^^^^^^^^^^^^^^^^^^^ -error: lint `clippy::temporary_cstring_as_ptr` has been removed: this lint has been uplifted to rustc and is now called `temporary_cstring_as_ptr` +error: lint `clippy::temporary_cstring_as_ptr` has been removed: `this lint has been uplifted to rustc and is now called `temporary_cstring_as_ptr`` --> $DIR/deprecated.rs:10:8 | LL | #[warn(clippy::temporary_cstring_as_ptr)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: lint `clippy::panic_params` has been removed: this lint has been uplifted to rustc and is now called `panic_fmt` +error: lint `clippy::panic_params` has been removed: `this lint has been uplifted to rustc and is now called `panic_fmt`` --> $DIR/deprecated.rs:11:8 | LL | #[warn(clippy::panic_params)] | ^^^^^^^^^^^^^^^^^^^^ -error: lint `clippy::unknown_clippy_lints` has been removed: this lint has been integrated into the `unknown_lints` rustc lint +error: lint `clippy::unknown_clippy_lints` has been removed: `this lint has been integrated into the `unknown_lints` rustc lint` --> $DIR/deprecated.rs:12:8 | LL | #[warn(clippy::unknown_clippy_lints)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: lint `clippy::unstable_as_slice` has been removed: `Vec::as_slice` has been stabilized in 1.7 +error: lint `clippy::unstable_as_slice` has been removed: ``Vec::as_slice` has been stabilized in 1.7` --> $DIR/deprecated.rs:1:8 | LL | #[warn(clippy::unstable_as_slice)] diff --git a/src/tools/clippy/tests/ui/deprecated_old.stderr b/src/tools/clippy/tests/ui/deprecated_old.stderr index b8550078c4600..2fe1facf0c72d 100644 --- a/src/tools/clippy/tests/ui/deprecated_old.stderr +++ b/src/tools/clippy/tests/ui/deprecated_old.stderr @@ -1,4 +1,4 @@ -error: lint `unstable_as_slice` has been removed: `Vec::as_slice` has been stabilized in 1.7 +error: lint `unstable_as_slice` has been removed: ``Vec::as_slice` has been stabilized in 1.7` --> $DIR/deprecated_old.rs:1:8 | LL | #[warn(unstable_as_slice)] @@ -6,19 +6,19 @@ LL | #[warn(unstable_as_slice)] | = note: `-D renamed-and-removed-lints` implied by `-D warnings` -error: lint `unstable_as_mut_slice` has been removed: `Vec::as_mut_slice` has been stabilized in 1.7 +error: lint `unstable_as_mut_slice` has been removed: ``Vec::as_mut_slice` has been stabilized in 1.7` --> $DIR/deprecated_old.rs:2:8 | LL | #[warn(unstable_as_mut_slice)] | ^^^^^^^^^^^^^^^^^^^^^ -error: lint `misaligned_transmute` has been removed: this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr +error: lint `misaligned_transmute` has been removed: `this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr` --> $DIR/deprecated_old.rs:3:8 | LL | #[warn(misaligned_transmute)] | ^^^^^^^^^^^^^^^^^^^^ -error: lint `unstable_as_slice` has been removed: `Vec::as_slice` has been stabilized in 1.7 +error: lint `unstable_as_slice` has been removed: ``Vec::as_slice` has been stabilized in 1.7` --> $DIR/deprecated_old.rs:1:8 | LL | #[warn(unstable_as_slice)] diff --git a/src/tools/jsondocck/src/main.rs b/src/tools/jsondocck/src/main.rs index 6ec292aba6495..29131f686a9dc 100644 --- a/src/tools/jsondocck/src/main.rs +++ b/src/tools/jsondocck/src/main.rs @@ -149,22 +149,7 @@ fn get_commands(template: &str) -> Result, ()> { } } - let args = cap.name("args").map_or(Some(vec![]), |m| shlex::split(m.as_str())); - - let args = match args { - Some(args) => args, - None => { - print_err( - &format!( - "Invalid arguments to shlex::split: `{}`", - cap.name("args").unwrap().as_str() - ), - lineno, - ); - errors = true; - continue; - } - }; + let args = cap.name("args").map_or(vec![], |m| shlex::split(m.as_str()).unwrap()); if !cmd.validate(&args, commands.len(), lineno) { errors = true; diff --git a/src/tools/miri b/src/tools/miri index de0800e83b4e1..1cf1a2e40a686 160000 --- a/src/tools/miri +++ b/src/tools/miri @@ -1 +1 @@ -Subproject commit de0800e83b4e15cf3c6aa8f15f8328e86a95d955 +Subproject commit 1cf1a2e40a6867948db84f806085a875fbefce3c From 0e949ea36eb7d713515d804e26ed2ea6ac72c739 Mon Sep 17 00:00:00 2001 From: Rust timing bot Date: Tue, 26 Jan 2021 22:50:48 +0100 Subject: [PATCH 2/2] rust-timer simulated merge of cd0c54abb9801e26c9e6e83ad8c99a39a9656922 Original message: Rollup merge of #81178 - tmiasko:no-landing-pads, r=oli-obk Visit only terminators when removing landing pads No functional changes intended --- compiler/rustc_mir/src/shim.rs | 2 +- compiler/rustc_mir/src/transform/mod.rs | 4 +-- .../src/transform/no_landing_pads.rs | 27 ++++-------------- compiler/rustc_resolve/src/late.rs | 7 +++++ compiler/rustc_resolve/src/lib.rs | 14 +++++++--- library/alloc/src/fmt.rs | 9 +++--- library/alloc/src/vec/mod.rs | 22 +++++++++++++++ library/std/src/io/prelude.rs | 2 +- library/std/src/prelude/mod.rs | 28 +++++++++---------- .../edition-imports-virtual-2015-gated.stderr | 2 +- .../ui/resolve/crate-called-as-function.rs | 3 ++ .../resolve/crate-called-as-function.stderr | 9 ++++++ src/test/ui/resolve/missing-in-namespace.rs | 4 +++ .../ui/resolve/missing-in-namespace.stderr | 14 ++++++++++ .../non-existent-2.rs | 2 +- .../non-existent-2.stderr | 4 +-- .../ui/traits/mutual-recursion-issue-75860.rs | 15 ++++++++++ .../mutual-recursion-issue-75860.stderr | 16 +++++++++++ 18 files changed, 133 insertions(+), 51 deletions(-) create mode 100644 src/test/ui/resolve/crate-called-as-function.rs create mode 100644 src/test/ui/resolve/crate-called-as-function.stderr create mode 100644 src/test/ui/resolve/missing-in-namespace.rs create mode 100644 src/test/ui/resolve/missing-in-namespace.stderr create mode 100644 src/test/ui/traits/mutual-recursion-issue-75860.rs create mode 100644 src/test/ui/traits/mutual-recursion-issue-75860.stderr diff --git a/compiler/rustc_mir/src/shim.rs b/compiler/rustc_mir/src/shim.rs index b740dfaca328d..6aaf27bdcb5f1 100644 --- a/compiler/rustc_mir/src/shim.rs +++ b/compiler/rustc_mir/src/shim.rs @@ -81,7 +81,7 @@ fn make_shim<'tcx>(tcx: TyCtxt<'tcx>, instance: ty::InstanceDef<'tcx>) -> Body<' MirPhase::Const, &[&[ &add_moves_for_packed_drops::AddMovesForPackedDrops, - &no_landing_pads::NoLandingPads::new(tcx), + &no_landing_pads::NoLandingPads, &remove_noop_landing_pads::RemoveNoopLandingPads, &simplify::SimplifyCfg::new("make_shim"), &add_call_guards::CriticalCallEdges, diff --git a/compiler/rustc_mir/src/transform/mod.rs b/compiler/rustc_mir/src/transform/mod.rs index 11f7e6922ccbc..e509c35de40b8 100644 --- a/compiler/rustc_mir/src/transform/mod.rs +++ b/compiler/rustc_mir/src/transform/mod.rs @@ -433,7 +433,7 @@ fn run_post_borrowck_cleanup_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tc let post_borrowck_cleanup: &[&dyn MirPass<'tcx>] = &[ // Remove all things only needed by analysis - &no_landing_pads::NoLandingPads::new(tcx), + &no_landing_pads::NoLandingPads, &simplify_branches::SimplifyBranches::new("initial"), &remove_noop_landing_pads::RemoveNoopLandingPads, &cleanup_post_borrowck::CleanupNonCodegenStatements, @@ -441,7 +441,7 @@ fn run_post_borrowck_cleanup_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tc // These next passes must be executed together &add_call_guards::CriticalCallEdges, &elaborate_drops::ElaborateDrops, - &no_landing_pads::NoLandingPads::new(tcx), + &no_landing_pads::NoLandingPads, // AddMovesForPackedDrops needs to run after drop // elaboration. &add_moves_for_packed_drops::AddMovesForPackedDrops, diff --git a/compiler/rustc_mir/src/transform/no_landing_pads.rs b/compiler/rustc_mir/src/transform/no_landing_pads.rs index 83954c93c04a1..5479f0cc5861d 100644 --- a/compiler/rustc_mir/src/transform/no_landing_pads.rs +++ b/compiler/rustc_mir/src/transform/no_landing_pads.rs @@ -2,42 +2,27 @@ //! specified. use crate::transform::MirPass; -use rustc_middle::mir::visit::MutVisitor; use rustc_middle::mir::*; use rustc_middle::ty::TyCtxt; use rustc_target::spec::PanicStrategy; -pub struct NoLandingPads<'tcx> { - tcx: TyCtxt<'tcx>, -} - -impl<'tcx> NoLandingPads<'tcx> { - pub fn new(tcx: TyCtxt<'tcx>) -> Self { - NoLandingPads { tcx } - } -} +pub struct NoLandingPads; -impl<'tcx> MirPass<'tcx> for NoLandingPads<'tcx> { +impl<'tcx> MirPass<'tcx> for NoLandingPads { fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { no_landing_pads(tcx, body) } } pub fn no_landing_pads<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { - if tcx.sess.panic_strategy() == PanicStrategy::Abort { - NoLandingPads::new(tcx).visit_body(body); - } -} - -impl<'tcx> MutVisitor<'tcx> for NoLandingPads<'tcx> { - fn tcx(&self) -> TyCtxt<'tcx> { - self.tcx + if tcx.sess.panic_strategy() != PanicStrategy::Abort { + return; } - fn visit_terminator(&mut self, terminator: &mut Terminator<'tcx>, location: Location) { + for block in body.basic_blocks_mut() { + let terminator = block.terminator_mut(); if let Some(unwind) = terminator.kind.unwind_mut() { unwind.take(); } - self.super_terminator(terminator, location); } } diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 97e556f5a338d..fff14747e5729 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -243,6 +243,13 @@ impl<'a> PathSource<'a> { // "function" here means "anything callable" rather than `DefKind::Fn`, // this is not precise but usually more helpful than just "value". Some(ExprKind::Call(call_expr, _)) => match &call_expr.kind { + // the case of `::some_crate()` + ExprKind::Path(_, path) + if path.segments.len() == 2 + && path.segments[0].ident.name == kw::PathRoot => + { + "external crate" + } ExprKind::Path(_, path) => { let mut msg = "function"; if let Some(segment) = path.segments.iter().last() { diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index af5341623758a..d293899dc0c6f 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -2485,8 +2485,14 @@ impl<'a> Resolver<'a> { (format!("use of undeclared crate or module `{}`", ident), None) } } else { - let mut msg = - format!("could not find `{}` in `{}`", ident, path[i - 1].ident); + let parent = path[i - 1].ident.name; + let parent = if parent == kw::PathRoot { + "crate root".to_owned() + } else { + format!("`{}`", parent) + }; + + let mut msg = format!("could not find `{}` in {}", ident, parent); if ns == TypeNS || ns == ValueNS { let ns_to_try = if ns == TypeNS { ValueNS } else { TypeNS }; if let FindBindingResult::Binding(Ok(binding)) = @@ -2494,11 +2500,11 @@ impl<'a> Resolver<'a> { { let mut found = |what| { msg = format!( - "expected {}, found {} `{}` in `{}`", + "expected {}, found {} `{}` in {}", ns.descr(), what, ident, - path[i - 1].ident + parent ) }; if binding.module().is_some() { diff --git a/library/alloc/src/fmt.rs b/library/alloc/src/fmt.rs index 5ebc4d6c4c14a..f9424b1d74744 100644 --- a/library/alloc/src/fmt.rs +++ b/library/alloc/src/fmt.rs @@ -282,21 +282,22 @@ //! `%`. The actual grammar for the formatting syntax is: //! //! ```text -//! format_string := [ maybe-format ] * -//! maybe-format := '{' '{' | '}' '}' | +//! format_string := text [ maybe_format text ] * +//! maybe_format := '{' '{' | '}' '}' | format //! format := '{' [ argument ] [ ':' format_spec ] '}' //! argument := integer | identifier //! -//! format_spec := [[fill]align][sign]['#']['0'][width]['.' precision][type] +//! format_spec := [[fill]align][sign]['#']['0'][width]['.' precision]type //! fill := character //! align := '<' | '^' | '>' //! sign := '+' | '-' //! width := count //! precision := count | '*' -//! type := identifier | '?' | '' +//! type := '' | '?' | 'x?' | 'X?' | identifier //! count := parameter | integer //! parameter := argument '$' //! ``` +//! In the above grammar, `text` may not contain any `'{'` or `'}'` characters. //! //! # Formatting traits //! diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index ccc4f03a1e505..0f5feb4ab8dc4 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -285,6 +285,27 @@ mod spec_extend; /// you would see if you coerced it to a slice), followed by [`capacity`]` - /// `[`len`] logically uninitialized, contiguous elements. /// +/// A vector containing the elements `'a'` and `'b'` with capacity 4 can be +/// visualized as below. The top part is the `Vec` struct, it contains a +/// pointer to the head of the allocation in the heap, length and capacity. +/// The bottom part is the allocation on the heap, a contiguous memory block. +/// +/// ```text +/// ptr len capacity +/// +--------+--------+--------+ +/// | 0x0123 | 2 | 4 | +/// +--------+--------+--------+ +/// | +/// v +/// Heap +--------+--------+--------+--------+ +/// | 'a' | 'b' | uninit | uninit | +/// +--------+--------+--------+--------+ +/// ``` +/// +/// - **uninit** represents memory that is not initialized, see [`MaybeUninit`]. +/// - Note: the ABI is not stable and `Vec` makes no guarantees about its memory +/// layout (including the order of fields). +/// /// `Vec` will never perform a "small optimization" where elements are actually /// stored on the stack for two reasons: /// @@ -345,6 +366,7 @@ mod spec_extend; /// [`push`]: Vec::push /// [`insert`]: Vec::insert /// [`reserve`]: Vec::reserve +/// [`MaybeUninit`]: core::mem::MaybeUninit /// [owned slice]: Box /// [slice]: ../../std/primitive.slice.html /// [`&`]: ../../std/primitive.reference.html diff --git a/library/std/src/io/prelude.rs b/library/std/src/io/prelude.rs index 3baab2be37795..d80643101f2ed 100644 --- a/library/std/src/io/prelude.rs +++ b/library/std/src/io/prelude.rs @@ -1,4 +1,4 @@ -//! The I/O Prelude +//! The I/O Prelude. //! //! The purpose of this module is to alleviate imports of many common I/O traits //! by adding a glob import to the top of I/O heavy modules: diff --git a/library/std/src/prelude/mod.rs b/library/std/src/prelude/mod.rs index a3776681d0349..eb2095b819657 100644 --- a/library/std/src/prelude/mod.rs +++ b/library/std/src/prelude/mod.rs @@ -1,4 +1,4 @@ -//! The Rust Prelude. +//! # The Rust Prelude //! //! Rust comes with a variety of things in its standard library. However, if //! you had to manually import every single thing that you used, it would be @@ -28,35 +28,35 @@ //! The current version of the prelude (version 1) lives in //! [`std::prelude::v1`], and re-exports the following: //! -//! * [`std::marker`]::{[`Copy`], [`Send`], [`Sized`], [`Sync`], [`Unpin`]}, +//! * [`std::marker`]::{[`Copy`], [`Send`], [`Sized`], [`Sync`], [`Unpin`]}: //! marker traits that indicate fundamental properties of types. -//! * [`std::ops`]::{[`Drop`], [`Fn`], [`FnMut`], [`FnOnce`]}, various +//! * [`std::ops`]::{[`Drop`], [`Fn`], [`FnMut`], [`FnOnce`]}: various //! operations for both destructors and overloading `()`. -//! * [`std::mem`]::[`drop`][`mem::drop`], a convenience function for explicitly +//! * [`std::mem`]::[`drop`][`mem::drop`]: a convenience function for explicitly //! dropping a value. -//! * [`std::boxed`]::[`Box`], a way to allocate values on the heap. -//! * [`std::borrow`]::[`ToOwned`], the conversion trait that defines +//! * [`std::boxed`]::[`Box`]: a way to allocate values on the heap. +//! * [`std::borrow`]::[`ToOwned`]: the conversion trait that defines //! [`to_owned`], the generic method for creating an owned type from a //! borrowed type. -//! * [`std::clone`]::[`Clone`], the ubiquitous trait that defines +//! * [`std::clone`]::[`Clone`]: the ubiquitous trait that defines //! [`clone`][`Clone::clone`], the method for producing a copy of a value. -//! * [`std::cmp`]::{[`PartialEq`], [`PartialOrd`], [`Eq`], [`Ord`] }, the +//! * [`std::cmp`]::{[`PartialEq`], [`PartialOrd`], [`Eq`], [`Ord`]}: the //! comparison traits, which implement the comparison operators and are often //! seen in trait bounds. -//! * [`std::convert`]::{[`AsRef`], [`AsMut`], [`Into`], [`From`]}, generic +//! * [`std::convert`]::{[`AsRef`], [`AsMut`], [`Into`], [`From`]}: generic //! conversions, used by savvy API authors to create overloaded methods. //! * [`std::default`]::[`Default`], types that have default values. -//! * [`std::iter`]::{[`Iterator`], [`Extend`], [`IntoIterator`] -//! [`DoubleEndedIterator`], [`ExactSizeIterator`]}, iterators of various +//! * [`std::iter`]::{[`Iterator`], [`Extend`], [`IntoIterator`], +//! [`DoubleEndedIterator`], [`ExactSizeIterator`]}: iterators of various //! kinds. //! * [`std::option`]::[`Option`]::{[`self`][`Option`], [`Some`], [`None`]}, a //! type which expresses the presence or absence of a value. This type is so //! commonly used, its variants are also exported. -//! * [`std::result`]::[`Result`]::{[`self`][`Result`], [`Ok`], [`Err`]}, a type +//! * [`std::result`]::[`Result`]::{[`self`][`Result`], [`Ok`], [`Err`]}: a type //! for functions that may succeed or fail. Like [`Option`], its variants are //! exported as well. -//! * [`std::string`]::{[`String`], [`ToString`]}, heap allocated strings. -//! * [`std::vec`]::[`Vec`], a growable, heap-allocated vector. +//! * [`std::string`]::{[`String`], [`ToString`]}: heap-allocated strings. +//! * [`std::vec`]::[`Vec`]: a growable, heap-allocated vector. //! //! [`mem::drop`]: crate::mem::drop //! [`std::borrow`]: crate::borrow diff --git a/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr b/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr index 56cbd882cca60..06605c6f2082e 100644 --- a/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr +++ b/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `E` --> $DIR/edition-imports-virtual-2015-gated.rs:8:5 | LL | gen_gated!(); - | ^^^^^^^^^^^^^ could not find `E` in `{{root}}` + | ^^^^^^^^^^^^^ could not find `E` in crate root | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/resolve/crate-called-as-function.rs b/src/test/ui/resolve/crate-called-as-function.rs new file mode 100644 index 0000000000000..e8f52c0c029aa --- /dev/null +++ b/src/test/ui/resolve/crate-called-as-function.rs @@ -0,0 +1,3 @@ +fn main() { + ::foo() //~ cannot find external crate `foo` in the crate root +} diff --git a/src/test/ui/resolve/crate-called-as-function.stderr b/src/test/ui/resolve/crate-called-as-function.stderr new file mode 100644 index 0000000000000..eb42349aff1b6 --- /dev/null +++ b/src/test/ui/resolve/crate-called-as-function.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find external crate `foo` in the crate root + --> $DIR/crate-called-as-function.rs:2:7 + | +LL | ::foo() + | ^^^ not found in the crate root + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/resolve/missing-in-namespace.rs b/src/test/ui/resolve/missing-in-namespace.rs new file mode 100644 index 0000000000000..e1dedb072b77b --- /dev/null +++ b/src/test/ui/resolve/missing-in-namespace.rs @@ -0,0 +1,4 @@ +fn main() { + let _map = std::hahmap::HashMap::new(); + //~^ ERROR failed to resolve: could not find `hahmap` in `std +} diff --git a/src/test/ui/resolve/missing-in-namespace.stderr b/src/test/ui/resolve/missing-in-namespace.stderr new file mode 100644 index 0000000000000..8b292aeda5074 --- /dev/null +++ b/src/test/ui/resolve/missing-in-namespace.stderr @@ -0,0 +1,14 @@ +error[E0433]: failed to resolve: could not find `hahmap` in `std` + --> $DIR/missing-in-namespace.rs:2:29 + | +LL | let _map = std::hahmap::HashMap::new(); + | ^^^^^^^ not found in `std::hahmap` + | +help: consider importing this struct + | +LL | use std::collections::HashMap; + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0433`. diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.rs b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.rs index 4f53108b3a938..61212f299bec7 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.rs +++ b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.rs @@ -2,5 +2,5 @@ fn main() { let s = ::xcrate::S; - //~^ ERROR failed to resolve: could not find `xcrate` in `{{root}}` + //~^ ERROR failed to resolve: could not find `xcrate` in crate root } diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.stderr index 7395d01d8ac44..8b2a6933f37bf 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.stderr +++ b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.stderr @@ -1,8 +1,8 @@ -error[E0433]: failed to resolve: could not find `xcrate` in `{{root}}` +error[E0433]: failed to resolve: could not find `xcrate` in crate root --> $DIR/non-existent-2.rs:4:15 | LL | let s = ::xcrate::S; - | ^^^^^^ could not find `xcrate` in `{{root}}` + | ^^^^^^ could not find `xcrate` in crate root error: aborting due to previous error diff --git a/src/test/ui/traits/mutual-recursion-issue-75860.rs b/src/test/ui/traits/mutual-recursion-issue-75860.rs new file mode 100644 index 0000000000000..d7d7307b42431 --- /dev/null +++ b/src/test/ui/traits/mutual-recursion-issue-75860.rs @@ -0,0 +1,15 @@ +pub fn iso(a: F1, b: F2) -> (Box B>, Box A>) + where + F1: (Fn(A) -> B) + 'static, + F2: (Fn(B) -> A) + 'static, +{ + (Box::new(a), Box::new(b)) +} +pub fn iso_un_option() -> (Box B>, Box A>) { + let left = |o_a: Option<_>| o_a.unwrap(); + let right = |o_b: Option<_>| o_b.unwrap(); + iso(left, right) + //~^ ERROR overflow +} + +fn main() {} diff --git a/src/test/ui/traits/mutual-recursion-issue-75860.stderr b/src/test/ui/traits/mutual-recursion-issue-75860.stderr new file mode 100644 index 0000000000000..cf867ef78c3b1 --- /dev/null +++ b/src/test/ui/traits/mutual-recursion-issue-75860.stderr @@ -0,0 +1,16 @@ +error[E0275]: overflow evaluating the requirement `Option<_>: Sized` + --> $DIR/mutual-recursion-issue-75860.rs:11:5 + | +LL | iso(left, right) + | ^^^ + | + ::: $SRC_DIR/core/src/option.rs:LL:COL + | +LL | pub enum Option { + | - required by this bound in `Option` + | + = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`mutual_recursion_issue_75860`) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0275`.