From 35726e909d44f41e090ac22e626bb4fa0e68afdb Mon Sep 17 00:00:00 2001 From: Kai Luo Date: Thu, 23 Mar 2023 17:56:26 +0800 Subject: LIBPATH is used as dylib's path environment variable on AIX --- src/bootstrap/dylib_util.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/bootstrap/dylib_util.rs b/src/bootstrap/dylib_util.rs index 6d75272c501..b14c0bed66c 100644 --- a/src/bootstrap/dylib_util.rs +++ b/src/bootstrap/dylib_util.rs @@ -12,6 +12,8 @@ pub fn dylib_path_var() -> &'static str { "DYLD_LIBRARY_PATH" } else if cfg!(target_os = "haiku") { "LIBRARY_PATH" + } else if cfg!(target_os = "aix") { + "LIBPATH" } else { "LD_LIBRARY_PATH" } -- cgit 1.4.1-3-g733a5 From 88b3ae96904312c7c0fe9b40357613f9fc29dbc8 Mon Sep 17 00:00:00 2001 From: Lenko Donchev Date: Sun, 26 Mar 2023 15:43:23 -0500 Subject: check for missing codegen backeng config --- src/bootstrap/compile.rs | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 54971af644c..783061d8ee8 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -20,7 +20,7 @@ use serde_derive::Deserialize; use crate::builder::crate_description; use crate::builder::Cargo; -use crate::builder::{Builder, Kind, RunConfig, ShouldRun, Step}; +use crate::builder::{Builder, Kind, PathSet, RunConfig, ShouldRun, Step, TaskPath}; use crate::cache::{Interned, INTERNER}; use crate::config::{LlvmLibunwind, RustcLto, TargetSelection}; use crate::dist; @@ -995,6 +995,44 @@ pub struct CodegenBackend { pub backend: Interned, } +fn needs_codegen_config(run: &RunConfig<'_>) -> bool { + let mut needs_codegen_cfg = false; + for path_set in &run.paths { + needs_codegen_cfg = match path_set { + PathSet::Set(set) => set.iter().any(|p| is_codegen_cfg_needed(p, run)), + PathSet::Suite(suite) => is_codegen_cfg_needed(&suite, run), + } + } + needs_codegen_cfg +} + +const CODEGEN_BACKEND_PREFIX: &str = "rustc_codegen_"; + +fn is_codegen_cfg_needed(path: &TaskPath, run: &RunConfig<'_>) -> bool { + if path.path.to_str().unwrap().contains(&CODEGEN_BACKEND_PREFIX) { + let mut needs_codegen_backend_config = true; + for &backend in &run.builder.config.rust_codegen_backends { + if path + .path + .to_str() + .unwrap() + .ends_with(&(CODEGEN_BACKEND_PREFIX.to_owned() + &backend)) + { + needs_codegen_backend_config = false; + } + } + if needs_codegen_backend_config { + run.builder.info( + "Warning: no codegen-backends config matched the requested path to build a codegen backend. \ + Help: add backend to codegen-backends in config.toml.", + ); + return true; + } + } + + return false; +} + impl Step for CodegenBackend { type Output = (); const ONLY_HOSTS: bool = true; @@ -1006,6 +1044,10 @@ impl Step for CodegenBackend { } fn make_run(run: RunConfig<'_>) { + if needs_codegen_config(&run) { + return; + } + for &backend in &run.builder.config.rust_codegen_backends { if backend == "llvm" { continue; // Already built as part of rustc -- cgit 1.4.1-3-g733a5 From b56fcb173bbf5ae0a52f26362639b7f2b922e7e9 Mon Sep 17 00:00:00 2001 From: Kai Luo Date: Tue, 28 Mar 2023 10:59:45 +0800 Subject: Set LIBPATH --- src/bootstrap/bootstrap.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 013d1ab525b..d12781cc33a 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -741,6 +741,9 @@ class RustBuild(object): env["LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \ (os.pathsep + env["LIBRARY_PATH"]) \ if "LIBRARY_PATH" in env else "" + env["LIBPATH"] = os.path.join(self.bin_root(), "lib") + \ + (os.pathsep + env["LIBPATH"]) \ + if "LIBPATH" in env else "" # Export Stage0 snapshot compiler related env variables build_section = "target.{}".format(self.build) -- cgit 1.4.1-3-g733a5 From d3cc2f76465b854129daa4dca2a10b137a8699bf Mon Sep 17 00:00:00 2001 From: Kai Luo Date: Wed, 29 Mar 2023 14:55:30 +0800 Subject: Use LIBPATH in compiletest --- src/tools/compiletest/src/util.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs index 5f6a27e5366..748240cc94b 100644 --- a/src/tools/compiletest/src/util.rs +++ b/src/tools/compiletest/src/util.rs @@ -156,6 +156,8 @@ pub fn dylib_env_var() -> &'static str { "DYLD_LIBRARY_PATH" } else if cfg!(target_os = "haiku") { "LIBRARY_PATH" + } else if cfg!(target_os = "aix") { + "LIBPATH" } else { "LD_LIBRARY_PATH" } -- cgit 1.4.1-3-g733a5 From 423e76f1ddf2ffeec4235b09946f563d3ddb6004 Mon Sep 17 00:00:00 2001 From: jyn Date: Sun, 2 Apr 2023 17:48:12 -0400 Subject: Improve job names in Github Actions preview Before: `CI / PR (mingw-check, false, ubuntu-20.04-16core-64gb) (pull_request)` After: `CI / PR - mingw-check (pull_request)` --- .github/workflows/ci.yml | 6 +++--- src/ci/github-actions/ci.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b45246eb4ea..a917d9a7d55 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: pr: permissions: actions: write - name: PR + name: "PR - ${{ matrix.name }}" env: CI_JOB_NAME: "${{ matrix.name }}" CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse @@ -159,7 +159,7 @@ jobs: auto: permissions: actions: write - name: auto + name: "auto - ${{ matrix.name }}" env: CI_JOB_NAME: "${{ matrix.name }}" CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse @@ -578,7 +578,7 @@ jobs: try: permissions: actions: write - name: try + name: "try - ${{ matrix.name }}" env: CI_JOB_NAME: "${{ matrix.name }}" CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index c594288dcf8..403953b5047 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -284,7 +284,7 @@ jobs: permissions: actions: write # for rust-lang/simpleinfra/github-actions/cancel-outdated-builds <<: *base-ci-job - name: PR + name: PR - ${{ matrix.name }} env: <<: [*shared-ci-variables, *public-variables] if: github.event_name == 'pull_request' @@ -312,7 +312,7 @@ jobs: permissions: actions: write # for rust-lang/simpleinfra/github-actions/cancel-outdated-builds <<: *base-ci-job - name: auto + name: auto - ${{ matrix.name }} env: <<: [*shared-ci-variables, *prod-variables] if: github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust' @@ -741,7 +741,7 @@ jobs: permissions: actions: write # for rust-lang/simpleinfra/github-actions/cancel-outdated-builds <<: *base-ci-job - name: try + name: try - ${{ matrix.name }} env: <<: [*shared-ci-variables, *prod-variables] if: github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust' -- cgit 1.4.1-3-g733a5 From dd85271ef5ea61fc4be3cd7607c838b99f8740f5 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sun, 2 Apr 2023 19:02:55 -0400 Subject: Include invocation start times For multi-invocation builders (e.g., dist-x86_64-linux) this timestamp is necessary to correlate the data in the metrics JSON with other data sources (e.g., logs, cpu-usage CSV, etc.). Such correlation may not be perfect but is sometimes helpful and awkward to do otherwise. --- src/bootstrap/metrics.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/bootstrap/metrics.rs b/src/bootstrap/metrics.rs index 5f254761aa1..82b123ec8a5 100644 --- a/src/bootstrap/metrics.rs +++ b/src/bootstrap/metrics.rs @@ -11,7 +11,7 @@ use serde_derive::{Deserialize, Serialize}; use std::cell::RefCell; use std::fs::File; use std::io::BufWriter; -use std::time::{Duration, Instant}; +use std::time::{Duration, Instant, SystemTime}; use sysinfo::{CpuExt, System, SystemExt}; pub(crate) struct BuildMetrics { @@ -27,6 +27,7 @@ impl BuildMetrics { system_info: System::new(), timer_start: None, invocation_timer_start: Instant::now(), + invocation_start: SystemTime::now(), }); BuildMetrics { state } @@ -124,6 +125,11 @@ impl BuildMetrics { } }; invocations.push(JsonInvocation { + start_time: state + .invocation_start + .duration_since(SystemTime::UNIX_EPOCH) + .unwrap() + .as_secs(), duration_including_children_sec: state.invocation_timer_start.elapsed().as_secs_f64(), children: steps.into_iter().map(|step| self.prepare_json_step(step)).collect(), }); @@ -166,6 +172,7 @@ struct MetricsState { system_info: System, timer_start: Option, invocation_timer_start: Instant, + invocation_start: SystemTime, } struct StepMetrics { @@ -194,6 +201,10 @@ struct JsonRoot { #[derive(Serialize, Deserialize)] #[serde(rename_all = "snake_case")] struct JsonInvocation { + // Unix timestamp in seconds + // + // This is necessary to easily correlate this invocation with logs or other data. + start_time: u64, duration_including_children_sec: f64, children: Vec, } -- cgit 1.4.1-3-g733a5 From 01b75e20f2f92e3086bc004cd2f4430bf41ccdc0 Mon Sep 17 00:00:00 2001 From: jyn Date: Sun, 2 Apr 2023 19:30:32 -0400 Subject: Move some UI tests into subdirectories to avoid going over the existing limit now that the ui-fulldeps tests have been moved to ui. --- src/tools/tidy/src/ui_tests.rs | 2 +- tests/ui/auxiliary/xc-private-method-lib.rs | 33 ----- tests/ui/disambiguate-identical-names.rs | 15 -- tests/ui/disambiguate-identical-names.stderr | 19 --- tests/ui/expr-block-generic-unique1.rs | 18 --- tests/ui/expr-block-generic-unique2.rs | 14 -- tests/ui/expr-if-unique.rs | 9 -- tests/ui/foreign-unsafe-fn-called.mir.stderr | 11 -- tests/ui/foreign-unsafe-fn-called.rs | 14 -- tests/ui/foreign-unsafe-fn-called.thir.stderr | 11 -- .../slightly-nice-generic-literal-messages.rs | 14 ++ .../slightly-nice-generic-literal-messages.stderr | 14 ++ tests/ui/lexer/unterminated-comment.rs | 1 + tests/ui/lexer/unterminated-comment.stderr | 9 ++ tests/ui/lexer/unterminated-nested-comment.rs | 4 + tests/ui/lexer/unterminated-nested-comment.stderr | 21 +++ tests/ui/mir-unpretty.rs | 5 - tests/ui/mir-unpretty.stderr | 11 -- tests/ui/new-unsafe-pointers.rs | 7 - tests/ui/output-type-mismatch.rs | 5 - tests/ui/output-type-mismatch.stderr | 11 -- .../ui/privacy/auxiliary/xc-private-method-lib.rs | 33 +++++ tests/ui/privacy/xc-private-method.rs | 11 ++ tests/ui/privacy/xc-private-method.stderr | 25 ++++ tests/ui/privacy/xc-private-method2.rs | 11 ++ tests/ui/privacy/xc-private-method2.stderr | 25 ++++ tests/ui/reachable-unnameable-type-alias.rs | 16 --- .../reachable/reachable-unnameable-type-alias.rs | 16 +++ tests/ui/resolve/disambiguate-identical-names.rs | 15 ++ .../ui/resolve/disambiguate-identical-names.stderr | 19 +++ tests/ui/slightly-nice-generic-literal-messages.rs | 14 -- .../slightly-nice-generic-literal-messages.stderr | 14 -- tests/ui/suppressed-error.rs | 8 -- tests/ui/suppressed-error.stderr | 14 -- tests/ui/tag-that-dare-not-speak-its-name.rs | 16 --- tests/ui/tag-that-dare-not-speak-its-name.stderr | 14 -- tests/ui/terr-in-field.rs | 17 --- tests/ui/terr-in-field.stderr | 17 --- tests/ui/terr-sorts.rs | 15 -- tests/ui/terr-sorts.stderr | 23 --- tests/ui/thread-local-mutation.rs | 18 --- tests/ui/thread-local-mutation.stderr | 9 -- tests/ui/thread-local-static.rs | 16 --- tests/ui/thread-local-static.stderr | 44 ------ tests/ui/thread-local/thread-local-mutation.rs | 18 +++ tests/ui/thread-local/thread-local-mutation.stderr | 9 ++ tests/ui/thread-local/thread-local-static.rs | 16 +++ tests/ui/thread-local/thread-local-static.stderr | 44 ++++++ tests/ui/traits/wrong-mul-method-signature.rs | 68 +++++++++ tests/ui/traits/wrong-mul-method-signature.stderr | 56 ++++++++ tests/ui/tuple-index.rs | 32 ----- tests/ui/tuple/tuple-index.rs | 32 +++++ tests/ui/typeck/output-type-mismatch.rs | 5 + tests/ui/typeck/output-type-mismatch.stderr | 11 ++ tests/ui/typeck/suppressed-error.rs | 8 ++ tests/ui/typeck/suppressed-error.stderr | 14 ++ .../ui/typeck/tag-that-dare-not-speak-its-name.rs | 16 +++ .../typeck/tag-that-dare-not-speak-its-name.stderr | 14 ++ tests/ui/typeck/terr-in-field.rs | 17 +++ tests/ui/typeck/terr-in-field.stderr | 17 +++ tests/ui/typeck/terr-sorts.rs | 15 ++ tests/ui/typeck/terr-sorts.stderr | 23 +++ tests/ui/typeck/while-type-error.rs | 3 + tests/ui/typeck/while-type-error.stderr | 12 ++ tests/ui/typeck/wrong-ret-type.rs | 3 + tests/ui/typeck/wrong-ret-type.stderr | 16 +++ tests/ui/ufcs-polymorphic-paths.rs | 154 --------------------- tests/ui/ufcs/ufcs-polymorphic-paths.rs | 154 +++++++++++++++++++++ tests/ui/unique-object-noncopyable.rs | 25 ---- tests/ui/unique-object-noncopyable.stderr | 25 ---- tests/ui/unique-pinned-nocopy.rs | 14 -- tests/ui/unique-pinned-nocopy.stderr | 27 ---- tests/ui/unique/expr-block-generic-unique1.rs | 18 +++ tests/ui/unique/expr-block-generic-unique2.rs | 14 ++ tests/ui/unique/expr-if-unique.rs | 9 ++ tests/ui/unique/unique-object-noncopyable.rs | 25 ++++ tests/ui/unique/unique-object-noncopyable.stderr | 25 ++++ tests/ui/unique/unique-pinned-nocopy.rs | 14 ++ tests/ui/unique/unique-pinned-nocopy.stderr | 27 ++++ tests/ui/unique/unwind-unique.rs | 15 ++ tests/ui/unpretty-expr-fn-arg.rs | 13 -- tests/ui/unpretty-expr-fn-arg.stdout | 17 --- tests/ui/unpretty/mir-unpretty.rs | 5 + tests/ui/unpretty/mir-unpretty.stderr | 11 ++ tests/ui/unpretty/unpretty-expr-fn-arg.rs | 13 ++ tests/ui/unpretty/unpretty-expr-fn-arg.stdout | 17 +++ tests/ui/unsafe-fn-called-from-unsafe-blk.rs | 18 --- tests/ui/unsafe-fn-called-from-unsafe-fn.rs | 17 --- tests/ui/unsafe-pointer-assignability.rs | 11 -- .../ui/unsafe/foreign-unsafe-fn-called.mir.stderr | 11 ++ tests/ui/unsafe/foreign-unsafe-fn-called.rs | 14 ++ .../ui/unsafe/foreign-unsafe-fn-called.thir.stderr | 11 ++ tests/ui/unsafe/new-unsafe-pointers.rs | 7 + .../ui/unsafe/unsafe-fn-called-from-unsafe-blk.rs | 18 +++ tests/ui/unsafe/unsafe-fn-called-from-unsafe-fn.rs | 17 +++ tests/ui/unsafe/unsafe-pointer-assignability.rs | 11 ++ tests/ui/unterminated-comment.rs | 1 - tests/ui/unterminated-comment.stderr | 9 -- tests/ui/unterminated-nested-comment.rs | 4 - tests/ui/unterminated-nested-comment.stderr | 21 --- tests/ui/unwind-unique.rs | 15 -- .../ui/variance-intersection-of-ref-and-opt-ref.rs | 25 ---- tests/ui/variance-iterators-in-libcore.rs | 10 -- .../variance-intersection-of-ref-and-opt-ref.rs | 25 ++++ tests/ui/variance/variance-iterators-in-libcore.rs | 10 ++ tests/ui/wasm-custom-section-relocations.rs | 15 -- tests/ui/wasm-custom-section-relocations.stderr | 14 -- tests/ui/wasm/wasm-custom-section-relocations.rs | 15 ++ .../ui/wasm/wasm-custom-section-relocations.stderr | 14 ++ tests/ui/while-type-error.rs | 3 - tests/ui/while-type-error.stderr | 12 -- tests/ui/wrong-mul-method-signature.rs | 68 --------- tests/ui/wrong-mul-method-signature.stderr | 56 -------- tests/ui/wrong-ret-type.rs | 3 - tests/ui/wrong-ret-type.stderr | 16 --- tests/ui/xc-private-method.rs | 11 -- tests/ui/xc-private-method.stderr | 25 ---- tests/ui/xc-private-method2.rs | 11 -- tests/ui/xc-private-method2.stderr | 25 ---- 119 files changed, 1136 insertions(+), 1136 deletions(-) delete mode 100644 tests/ui/auxiliary/xc-private-method-lib.rs delete mode 100644 tests/ui/disambiguate-identical-names.rs delete mode 100644 tests/ui/disambiguate-identical-names.stderr delete mode 100644 tests/ui/expr-block-generic-unique1.rs delete mode 100644 tests/ui/expr-block-generic-unique2.rs delete mode 100644 tests/ui/expr-if-unique.rs delete mode 100644 tests/ui/foreign-unsafe-fn-called.mir.stderr delete mode 100644 tests/ui/foreign-unsafe-fn-called.rs delete mode 100644 tests/ui/foreign-unsafe-fn-called.thir.stderr create mode 100644 tests/ui/generics/slightly-nice-generic-literal-messages.rs create mode 100644 tests/ui/generics/slightly-nice-generic-literal-messages.stderr create mode 100644 tests/ui/lexer/unterminated-comment.rs create mode 100644 tests/ui/lexer/unterminated-comment.stderr create mode 100644 tests/ui/lexer/unterminated-nested-comment.rs create mode 100644 tests/ui/lexer/unterminated-nested-comment.stderr delete mode 100644 tests/ui/mir-unpretty.rs delete mode 100644 tests/ui/mir-unpretty.stderr delete mode 100644 tests/ui/new-unsafe-pointers.rs delete mode 100644 tests/ui/output-type-mismatch.rs delete mode 100644 tests/ui/output-type-mismatch.stderr create mode 100644 tests/ui/privacy/auxiliary/xc-private-method-lib.rs create mode 100644 tests/ui/privacy/xc-private-method.rs create mode 100644 tests/ui/privacy/xc-private-method.stderr create mode 100644 tests/ui/privacy/xc-private-method2.rs create mode 100644 tests/ui/privacy/xc-private-method2.stderr delete mode 100644 tests/ui/reachable-unnameable-type-alias.rs create mode 100644 tests/ui/reachable/reachable-unnameable-type-alias.rs create mode 100644 tests/ui/resolve/disambiguate-identical-names.rs create mode 100644 tests/ui/resolve/disambiguate-identical-names.stderr delete mode 100644 tests/ui/slightly-nice-generic-literal-messages.rs delete mode 100644 tests/ui/slightly-nice-generic-literal-messages.stderr delete mode 100644 tests/ui/suppressed-error.rs delete mode 100644 tests/ui/suppressed-error.stderr delete mode 100644 tests/ui/tag-that-dare-not-speak-its-name.rs delete mode 100644 tests/ui/tag-that-dare-not-speak-its-name.stderr delete mode 100644 tests/ui/terr-in-field.rs delete mode 100644 tests/ui/terr-in-field.stderr delete mode 100644 tests/ui/terr-sorts.rs delete mode 100644 tests/ui/terr-sorts.stderr delete mode 100644 tests/ui/thread-local-mutation.rs delete mode 100644 tests/ui/thread-local-mutation.stderr delete mode 100644 tests/ui/thread-local-static.rs delete mode 100644 tests/ui/thread-local-static.stderr create mode 100644 tests/ui/thread-local/thread-local-mutation.rs create mode 100644 tests/ui/thread-local/thread-local-mutation.stderr create mode 100644 tests/ui/thread-local/thread-local-static.rs create mode 100644 tests/ui/thread-local/thread-local-static.stderr create mode 100644 tests/ui/traits/wrong-mul-method-signature.rs create mode 100644 tests/ui/traits/wrong-mul-method-signature.stderr delete mode 100644 tests/ui/tuple-index.rs create mode 100644 tests/ui/tuple/tuple-index.rs create mode 100644 tests/ui/typeck/output-type-mismatch.rs create mode 100644 tests/ui/typeck/output-type-mismatch.stderr create mode 100644 tests/ui/typeck/suppressed-error.rs create mode 100644 tests/ui/typeck/suppressed-error.stderr create mode 100644 tests/ui/typeck/tag-that-dare-not-speak-its-name.rs create mode 100644 tests/ui/typeck/tag-that-dare-not-speak-its-name.stderr create mode 100644 tests/ui/typeck/terr-in-field.rs create mode 100644 tests/ui/typeck/terr-in-field.stderr create mode 100644 tests/ui/typeck/terr-sorts.rs create mode 100644 tests/ui/typeck/terr-sorts.stderr create mode 100644 tests/ui/typeck/while-type-error.rs create mode 100644 tests/ui/typeck/while-type-error.stderr create mode 100644 tests/ui/typeck/wrong-ret-type.rs create mode 100644 tests/ui/typeck/wrong-ret-type.stderr delete mode 100644 tests/ui/ufcs-polymorphic-paths.rs create mode 100644 tests/ui/ufcs/ufcs-polymorphic-paths.rs delete mode 100644 tests/ui/unique-object-noncopyable.rs delete mode 100644 tests/ui/unique-object-noncopyable.stderr delete mode 100644 tests/ui/unique-pinned-nocopy.rs delete mode 100644 tests/ui/unique-pinned-nocopy.stderr create mode 100644 tests/ui/unique/expr-block-generic-unique1.rs create mode 100644 tests/ui/unique/expr-block-generic-unique2.rs create mode 100644 tests/ui/unique/expr-if-unique.rs create mode 100644 tests/ui/unique/unique-object-noncopyable.rs create mode 100644 tests/ui/unique/unique-object-noncopyable.stderr create mode 100644 tests/ui/unique/unique-pinned-nocopy.rs create mode 100644 tests/ui/unique/unique-pinned-nocopy.stderr create mode 100644 tests/ui/unique/unwind-unique.rs delete mode 100644 tests/ui/unpretty-expr-fn-arg.rs delete mode 100644 tests/ui/unpretty-expr-fn-arg.stdout create mode 100644 tests/ui/unpretty/mir-unpretty.rs create mode 100644 tests/ui/unpretty/mir-unpretty.stderr create mode 100644 tests/ui/unpretty/unpretty-expr-fn-arg.rs create mode 100644 tests/ui/unpretty/unpretty-expr-fn-arg.stdout delete mode 100644 tests/ui/unsafe-fn-called-from-unsafe-blk.rs delete mode 100644 tests/ui/unsafe-fn-called-from-unsafe-fn.rs delete mode 100644 tests/ui/unsafe-pointer-assignability.rs create mode 100644 tests/ui/unsafe/foreign-unsafe-fn-called.mir.stderr create mode 100644 tests/ui/unsafe/foreign-unsafe-fn-called.rs create mode 100644 tests/ui/unsafe/foreign-unsafe-fn-called.thir.stderr create mode 100644 tests/ui/unsafe/new-unsafe-pointers.rs create mode 100644 tests/ui/unsafe/unsafe-fn-called-from-unsafe-blk.rs create mode 100644 tests/ui/unsafe/unsafe-fn-called-from-unsafe-fn.rs create mode 100644 tests/ui/unsafe/unsafe-pointer-assignability.rs delete mode 100644 tests/ui/unterminated-comment.rs delete mode 100644 tests/ui/unterminated-comment.stderr delete mode 100644 tests/ui/unterminated-nested-comment.rs delete mode 100644 tests/ui/unterminated-nested-comment.stderr delete mode 100644 tests/ui/unwind-unique.rs delete mode 100644 tests/ui/variance-intersection-of-ref-and-opt-ref.rs delete mode 100644 tests/ui/variance-iterators-in-libcore.rs create mode 100644 tests/ui/variance/variance-intersection-of-ref-and-opt-ref.rs create mode 100644 tests/ui/variance/variance-iterators-in-libcore.rs delete mode 100644 tests/ui/wasm-custom-section-relocations.rs delete mode 100644 tests/ui/wasm-custom-section-relocations.stderr create mode 100644 tests/ui/wasm/wasm-custom-section-relocations.rs create mode 100644 tests/ui/wasm/wasm-custom-section-relocations.stderr delete mode 100644 tests/ui/while-type-error.rs delete mode 100644 tests/ui/while-type-error.stderr delete mode 100644 tests/ui/wrong-mul-method-signature.rs delete mode 100644 tests/ui/wrong-mul-method-signature.stderr delete mode 100644 tests/ui/wrong-ret-type.rs delete mode 100644 tests/ui/wrong-ret-type.stderr delete mode 100644 tests/ui/xc-private-method.rs delete mode 100644 tests/ui/xc-private-method.stderr delete mode 100644 tests/ui/xc-private-method2.rs delete mode 100644 tests/ui/xc-private-method2.stderr (limited to 'src') diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index 20b8a2c3b24..f582666ab28 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -9,7 +9,7 @@ use std::path::{Path, PathBuf}; const ENTRY_LIMIT: usize = 1000; // FIXME: The following limits should be reduced eventually. -const ROOT_ENTRY_LIMIT: usize = 940; +const ROOT_ENTRY_LIMIT: usize = 881; const ISSUES_ENTRY_LIMIT: usize = 1978; fn check_entries(tests_path: &Path, bad: &mut bool) { diff --git a/tests/ui/auxiliary/xc-private-method-lib.rs b/tests/ui/auxiliary/xc-private-method-lib.rs deleted file mode 100644 index 4d5ec6de392..00000000000 --- a/tests/ui/auxiliary/xc-private-method-lib.rs +++ /dev/null @@ -1,33 +0,0 @@ -#![crate_type="lib"] - -pub struct Struct { - pub x: isize -} - -impl Struct { - fn static_meth_struct() -> Struct { - Struct { x: 1 } - } - - fn meth_struct(&self) -> isize { - self.x - } -} - -pub enum Enum { - Variant1(isize), - Variant2(isize) -} - -impl Enum { - fn static_meth_enum() -> Enum { - Enum::Variant2(10) - } - - fn meth_enum(&self) -> isize { - match *self { - Enum::Variant1(x) | - Enum::Variant2(x) => x - } - } -} diff --git a/tests/ui/disambiguate-identical-names.rs b/tests/ui/disambiguate-identical-names.rs deleted file mode 100644 index 708d2cd76a1..00000000000 --- a/tests/ui/disambiguate-identical-names.rs +++ /dev/null @@ -1,15 +0,0 @@ -pub mod submod { - // Create ambiguity with the std::vec::Vec item: - pub struct Vec; -} - -fn test(_v: &Vec>) { -} - -fn main() { - let v = std::collections::HashMap::new(); - v.insert(3u8, 1u8); - - test(&v); - //~^ ERROR mismatched types -} diff --git a/tests/ui/disambiguate-identical-names.stderr b/tests/ui/disambiguate-identical-names.stderr deleted file mode 100644 index 7d8293018d2..00000000000 --- a/tests/ui/disambiguate-identical-names.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/disambiguate-identical-names.rs:13:10 - | -LL | test(&v); - | ---- ^^ expected `&Vec>`, found `&HashMap` - | | - | arguments to this function are incorrect - | - = note: expected reference `&std::vec::Vec>` - found reference `&HashMap` -note: function defined here - --> $DIR/disambiguate-identical-names.rs:6:4 - | -LL | fn test(_v: &Vec>) { - | ^^^^ ------------------ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/expr-block-generic-unique1.rs b/tests/ui/expr-block-generic-unique1.rs deleted file mode 100644 index 14603a2c71f..00000000000 --- a/tests/ui/expr-block-generic-unique1.rs +++ /dev/null @@ -1,18 +0,0 @@ -// run-pass -#![allow(unused_braces)] - -fn test_generic(expected: Box, eq: F) where T: Clone, F: FnOnce(Box, Box) -> bool { - let actual: Box = { expected.clone() }; - assert!(eq(expected, actual)); -} - -fn test_box() { - fn compare_box(b1: Box, b2: Box) -> bool { - println!("{}", *b1); - println!("{}", *b2); - return *b1 == *b2; - } - test_generic::(Box::new(true), compare_box); -} - -pub fn main() { test_box(); } diff --git a/tests/ui/expr-block-generic-unique2.rs b/tests/ui/expr-block-generic-unique2.rs deleted file mode 100644 index 7879c144b10..00000000000 --- a/tests/ui/expr-block-generic-unique2.rs +++ /dev/null @@ -1,14 +0,0 @@ -// run-pass -#![allow(unused_braces)] - -fn test_generic(expected: T, eq: F) where T: Clone, F: FnOnce(T, T) -> bool { - let actual: T = { expected.clone() }; - assert!(eq(expected, actual)); -} - -fn test_vec() { - fn compare_vec(v1: Box, v2: Box) -> bool { return v1 == v2; } - test_generic::, _>(Box::new(1), compare_vec); -} - -pub fn main() { test_vec(); } diff --git a/tests/ui/expr-if-unique.rs b/tests/ui/expr-if-unique.rs deleted file mode 100644 index 86232683549..00000000000 --- a/tests/ui/expr-if-unique.rs +++ /dev/null @@ -1,9 +0,0 @@ -// run-pass - -// Tests for if as expressions returning boxed types -fn test_box() { - let rs: Box<_> = if true { Box::new(100) } else { Box::new(101) }; - assert_eq!(*rs, 100); -} - -pub fn main() { test_box(); } diff --git a/tests/ui/foreign-unsafe-fn-called.mir.stderr b/tests/ui/foreign-unsafe-fn-called.mir.stderr deleted file mode 100644 index d3cf5d84fdd..00000000000 --- a/tests/ui/foreign-unsafe-fn-called.mir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/foreign-unsafe-fn-called.rs:11:5 - | -LL | test::free(); - | ^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/foreign-unsafe-fn-called.rs b/tests/ui/foreign-unsafe-fn-called.rs deleted file mode 100644 index 67302ea1bcd..00000000000 --- a/tests/ui/foreign-unsafe-fn-called.rs +++ /dev/null @@ -1,14 +0,0 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - -mod test { - extern "C" { - pub fn free(); - } -} - -fn main() { - test::free(); - //[mir]~^ ERROR call to unsafe function is unsafe - //[thir]~^^ ERROR call to unsafe function `test::free` is unsafe -} diff --git a/tests/ui/foreign-unsafe-fn-called.thir.stderr b/tests/ui/foreign-unsafe-fn-called.thir.stderr deleted file mode 100644 index 00ba0f7a6a3..00000000000 --- a/tests/ui/foreign-unsafe-fn-called.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function `test::free` is unsafe and requires unsafe function or block - --> $DIR/foreign-unsafe-fn-called.rs:11:5 - | -LL | test::free(); - | ^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/generics/slightly-nice-generic-literal-messages.rs b/tests/ui/generics/slightly-nice-generic-literal-messages.rs new file mode 100644 index 00000000000..268009f65a5 --- /dev/null +++ b/tests/ui/generics/slightly-nice-generic-literal-messages.rs @@ -0,0 +1,14 @@ +use std::marker; + +struct Foo(T, marker::PhantomData); + +fn main() { + match Foo(1.1, marker::PhantomData) { + 1 => {} + //~^ ERROR mismatched types + //~| expected struct `Foo<{float}, _>` + //~| found type `{integer}` + //~| expected `Foo<{float}, _>`, found integer + } + +} diff --git a/tests/ui/generics/slightly-nice-generic-literal-messages.stderr b/tests/ui/generics/slightly-nice-generic-literal-messages.stderr new file mode 100644 index 00000000000..83ef522ab46 --- /dev/null +++ b/tests/ui/generics/slightly-nice-generic-literal-messages.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/slightly-nice-generic-literal-messages.rs:7:9 + | +LL | match Foo(1.1, marker::PhantomData) { + | ----------------------------- this expression has type `Foo<{float}, _>` +LL | 1 => {} + | ^ expected `Foo<{float}, _>`, found integer + | + = note: expected struct `Foo<{float}, _>` + found type `{integer}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/lexer/unterminated-comment.rs b/tests/ui/lexer/unterminated-comment.rs new file mode 100644 index 00000000000..1cfdfb1fb45 --- /dev/null +++ b/tests/ui/lexer/unterminated-comment.rs @@ -0,0 +1 @@ +/* //~ ERROR E0758 diff --git a/tests/ui/lexer/unterminated-comment.stderr b/tests/ui/lexer/unterminated-comment.stderr new file mode 100644 index 00000000000..c513fafeeb3 --- /dev/null +++ b/tests/ui/lexer/unterminated-comment.stderr @@ -0,0 +1,9 @@ +error[E0758]: unterminated block comment + --> $DIR/unterminated-comment.rs:1:1 + | +LL | /* + | ^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0758`. diff --git a/tests/ui/lexer/unterminated-nested-comment.rs b/tests/ui/lexer/unterminated-nested-comment.rs new file mode 100644 index 00000000000..db5f2f3ba13 --- /dev/null +++ b/tests/ui/lexer/unterminated-nested-comment.rs @@ -0,0 +1,4 @@ +/* //~ ERROR E0758 +/* */ +/* +*/ diff --git a/tests/ui/lexer/unterminated-nested-comment.stderr b/tests/ui/lexer/unterminated-nested-comment.stderr new file mode 100644 index 00000000000..3653e76c9cb --- /dev/null +++ b/tests/ui/lexer/unterminated-nested-comment.stderr @@ -0,0 +1,21 @@ +error[E0758]: unterminated block comment + --> $DIR/unterminated-nested-comment.rs:1:1 + | +LL | /* + | ^- + | | + | _unterminated block comment + | | +LL | | /* */ +LL | | /* + | | -- + | | | + | | ...as last nested comment starts here, maybe you want to close this instead? +LL | | */ + | |_--^ + | | + | ...and last nested comment terminates here. + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0758`. diff --git a/tests/ui/mir-unpretty.rs b/tests/ui/mir-unpretty.rs deleted file mode 100644 index 30620c69fea..00000000000 --- a/tests/ui/mir-unpretty.rs +++ /dev/null @@ -1,5 +0,0 @@ -// compile-flags: -Z unpretty=mir - -fn main() { - let x: () = 0; //~ ERROR: mismatched types -} diff --git a/tests/ui/mir-unpretty.stderr b/tests/ui/mir-unpretty.stderr deleted file mode 100644 index 3808f8583b8..00000000000 --- a/tests/ui/mir-unpretty.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/mir-unpretty.rs:4:17 - | -LL | let x: () = 0; - | -- ^ expected `()`, found integer - | | - | expected due to this - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/new-unsafe-pointers.rs b/tests/ui/new-unsafe-pointers.rs deleted file mode 100644 index d99eb4cbd1c..00000000000 --- a/tests/ui/new-unsafe-pointers.rs +++ /dev/null @@ -1,7 +0,0 @@ -// run-pass -// pretty-expanded FIXME #23616 - -fn main() { - let _a: *const isize = 3 as *const isize; - let _a: *mut isize = 3 as *mut isize; -} diff --git a/tests/ui/output-type-mismatch.rs b/tests/ui/output-type-mismatch.rs deleted file mode 100644 index 35097aa9ec6..00000000000 --- a/tests/ui/output-type-mismatch.rs +++ /dev/null @@ -1,5 +0,0 @@ -// error-pattern: mismatched types - -fn f() { } - -fn main() { let i: isize; i = f(); } diff --git a/tests/ui/output-type-mismatch.stderr b/tests/ui/output-type-mismatch.stderr deleted file mode 100644 index 4507a4df621..00000000000 --- a/tests/ui/output-type-mismatch.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/output-type-mismatch.rs:5:31 - | -LL | fn main() { let i: isize; i = f(); } - | ----- ^^^ expected `isize`, found `()` - | | - | expected due to this type - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/privacy/auxiliary/xc-private-method-lib.rs b/tests/ui/privacy/auxiliary/xc-private-method-lib.rs new file mode 100644 index 00000000000..4d5ec6de392 --- /dev/null +++ b/tests/ui/privacy/auxiliary/xc-private-method-lib.rs @@ -0,0 +1,33 @@ +#![crate_type="lib"] + +pub struct Struct { + pub x: isize +} + +impl Struct { + fn static_meth_struct() -> Struct { + Struct { x: 1 } + } + + fn meth_struct(&self) -> isize { + self.x + } +} + +pub enum Enum { + Variant1(isize), + Variant2(isize) +} + +impl Enum { + fn static_meth_enum() -> Enum { + Enum::Variant2(10) + } + + fn meth_enum(&self) -> isize { + match *self { + Enum::Variant1(x) | + Enum::Variant2(x) => x + } + } +} diff --git a/tests/ui/privacy/xc-private-method.rs b/tests/ui/privacy/xc-private-method.rs new file mode 100644 index 00000000000..f05994646b3 --- /dev/null +++ b/tests/ui/privacy/xc-private-method.rs @@ -0,0 +1,11 @@ +// aux-build:xc-private-method-lib.rs + +extern crate xc_private_method_lib; + +fn main() { + let _ = xc_private_method_lib::Struct::static_meth_struct(); + //~^ ERROR: associated function `static_meth_struct` is private + + let _ = xc_private_method_lib::Enum::static_meth_enum(); + //~^ ERROR: associated function `static_meth_enum` is private +} diff --git a/tests/ui/privacy/xc-private-method.stderr b/tests/ui/privacy/xc-private-method.stderr new file mode 100644 index 00000000000..0eabc592aa4 --- /dev/null +++ b/tests/ui/privacy/xc-private-method.stderr @@ -0,0 +1,25 @@ +error[E0624]: associated function `static_meth_struct` is private + --> $DIR/xc-private-method.rs:6:44 + | +LL | let _ = xc_private_method_lib::Struct::static_meth_struct(); + | ^^^^^^^^^^^^^^^^^^ private associated function + | + ::: $DIR/auxiliary/xc-private-method-lib.rs:8:5 + | +LL | fn static_meth_struct() -> Struct { + | --------------------------------- private associated function defined here + +error[E0624]: associated function `static_meth_enum` is private + --> $DIR/xc-private-method.rs:9:42 + | +LL | let _ = xc_private_method_lib::Enum::static_meth_enum(); + | ^^^^^^^^^^^^^^^^ private associated function + | + ::: $DIR/auxiliary/xc-private-method-lib.rs:23:5 + | +LL | fn static_meth_enum() -> Enum { + | ----------------------------- private associated function defined here + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0624`. diff --git a/tests/ui/privacy/xc-private-method2.rs b/tests/ui/privacy/xc-private-method2.rs new file mode 100644 index 00000000000..f11b251082b --- /dev/null +++ b/tests/ui/privacy/xc-private-method2.rs @@ -0,0 +1,11 @@ +// aux-build:xc-private-method-lib.rs + +extern crate xc_private_method_lib; + +fn main() { + let _ = xc_private_method_lib::Struct{ x: 10 }.meth_struct(); + //~^ ERROR method `meth_struct` is private + + let _ = xc_private_method_lib::Enum::Variant1(20).meth_enum(); + //~^ ERROR method `meth_enum` is private +} diff --git a/tests/ui/privacy/xc-private-method2.stderr b/tests/ui/privacy/xc-private-method2.stderr new file mode 100644 index 00000000000..af0c3cfcb2c --- /dev/null +++ b/tests/ui/privacy/xc-private-method2.stderr @@ -0,0 +1,25 @@ +error[E0624]: method `meth_struct` is private + --> $DIR/xc-private-method2.rs:6:52 + | +LL | let _ = xc_private_method_lib::Struct{ x: 10 }.meth_struct(); + | ^^^^^^^^^^^ private method + | + ::: $DIR/auxiliary/xc-private-method-lib.rs:12:5 + | +LL | fn meth_struct(&self) -> isize { + | ------------------------------ private method defined here + +error[E0624]: method `meth_enum` is private + --> $DIR/xc-private-method2.rs:9:55 + | +LL | let _ = xc_private_method_lib::Enum::Variant1(20).meth_enum(); + | ^^^^^^^^^ private method + | + ::: $DIR/auxiliary/xc-private-method-lib.rs:27:5 + | +LL | fn meth_enum(&self) -> isize { + | ---------------------------- private method defined here + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0624`. diff --git a/tests/ui/reachable-unnameable-type-alias.rs b/tests/ui/reachable-unnameable-type-alias.rs deleted file mode 100644 index 461355f87cf..00000000000 --- a/tests/ui/reachable-unnameable-type-alias.rs +++ /dev/null @@ -1,16 +0,0 @@ -// run-pass - -#![feature(staged_api)] -#![stable(feature = "a", since = "b")] - -mod inner_private_module { - // UnnameableTypeAlias isn't marked as reachable, so no stability annotation is required here - pub type UnnameableTypeAlias = u8; -} - -#[stable(feature = "a", since = "b")] -pub fn f() -> inner_private_module::UnnameableTypeAlias { - 0 -} - -fn main() {} diff --git a/tests/ui/reachable/reachable-unnameable-type-alias.rs b/tests/ui/reachable/reachable-unnameable-type-alias.rs new file mode 100644 index 00000000000..461355f87cf --- /dev/null +++ b/tests/ui/reachable/reachable-unnameable-type-alias.rs @@ -0,0 +1,16 @@ +// run-pass + +#![feature(staged_api)] +#![stable(feature = "a", since = "b")] + +mod inner_private_module { + // UnnameableTypeAlias isn't marked as reachable, so no stability annotation is required here + pub type UnnameableTypeAlias = u8; +} + +#[stable(feature = "a", since = "b")] +pub fn f() -> inner_private_module::UnnameableTypeAlias { + 0 +} + +fn main() {} diff --git a/tests/ui/resolve/disambiguate-identical-names.rs b/tests/ui/resolve/disambiguate-identical-names.rs new file mode 100644 index 00000000000..708d2cd76a1 --- /dev/null +++ b/tests/ui/resolve/disambiguate-identical-names.rs @@ -0,0 +1,15 @@ +pub mod submod { + // Create ambiguity with the std::vec::Vec item: + pub struct Vec; +} + +fn test(_v: &Vec>) { +} + +fn main() { + let v = std::collections::HashMap::new(); + v.insert(3u8, 1u8); + + test(&v); + //~^ ERROR mismatched types +} diff --git a/tests/ui/resolve/disambiguate-identical-names.stderr b/tests/ui/resolve/disambiguate-identical-names.stderr new file mode 100644 index 00000000000..7d8293018d2 --- /dev/null +++ b/tests/ui/resolve/disambiguate-identical-names.stderr @@ -0,0 +1,19 @@ +error[E0308]: mismatched types + --> $DIR/disambiguate-identical-names.rs:13:10 + | +LL | test(&v); + | ---- ^^ expected `&Vec>`, found `&HashMap` + | | + | arguments to this function are incorrect + | + = note: expected reference `&std::vec::Vec>` + found reference `&HashMap` +note: function defined here + --> $DIR/disambiguate-identical-names.rs:6:4 + | +LL | fn test(_v: &Vec>) { + | ^^^^ ------------------ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/slightly-nice-generic-literal-messages.rs b/tests/ui/slightly-nice-generic-literal-messages.rs deleted file mode 100644 index 268009f65a5..00000000000 --- a/tests/ui/slightly-nice-generic-literal-messages.rs +++ /dev/null @@ -1,14 +0,0 @@ -use std::marker; - -struct Foo(T, marker::PhantomData); - -fn main() { - match Foo(1.1, marker::PhantomData) { - 1 => {} - //~^ ERROR mismatched types - //~| expected struct `Foo<{float}, _>` - //~| found type `{integer}` - //~| expected `Foo<{float}, _>`, found integer - } - -} diff --git a/tests/ui/slightly-nice-generic-literal-messages.stderr b/tests/ui/slightly-nice-generic-literal-messages.stderr deleted file mode 100644 index 83ef522ab46..00000000000 --- a/tests/ui/slightly-nice-generic-literal-messages.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/slightly-nice-generic-literal-messages.rs:7:9 - | -LL | match Foo(1.1, marker::PhantomData) { - | ----------------------------- this expression has type `Foo<{float}, _>` -LL | 1 => {} - | ^ expected `Foo<{float}, _>`, found integer - | - = note: expected struct `Foo<{float}, _>` - found type `{integer}` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/suppressed-error.rs b/tests/ui/suppressed-error.rs deleted file mode 100644 index 1e39be46080..00000000000 --- a/tests/ui/suppressed-error.rs +++ /dev/null @@ -1,8 +0,0 @@ -fn main() { - let (x, y) = (); -//~^ ERROR mismatched types -//~| expected unit type `()` -//~| found tuple `(_, _)` -//~| expected `()`, found - return x; -} diff --git a/tests/ui/suppressed-error.stderr b/tests/ui/suppressed-error.stderr deleted file mode 100644 index 11d70f8a433..00000000000 --- a/tests/ui/suppressed-error.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/suppressed-error.rs:2:9 - | -LL | let (x, y) = (); - | ^^^^^^ -- this expression has type `()` - | | - | expected `()`, found `(_, _)` - | - = note: expected unit type `()` - found tuple `(_, _)` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/tag-that-dare-not-speak-its-name.rs b/tests/ui/tag-that-dare-not-speak-its-name.rs deleted file mode 100644 index 0e76ec246d7..00000000000 --- a/tests/ui/tag-that-dare-not-speak-its-name.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Issue #876 - -use std::vec::Vec; - -fn last(v: Vec<&T> ) -> std::option::Option { - ::std::panic!(); -} - -fn main() { - let y; - let x : char = last(y); - //~^ ERROR mismatched types - //~| expected type `char` - //~| found enum `Option<_>` - //~| expected `char`, found `Option<_>` -} diff --git a/tests/ui/tag-that-dare-not-speak-its-name.stderr b/tests/ui/tag-that-dare-not-speak-its-name.stderr deleted file mode 100644 index f53abe53bf1..00000000000 --- a/tests/ui/tag-that-dare-not-speak-its-name.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/tag-that-dare-not-speak-its-name.rs:11:20 - | -LL | let x : char = last(y); - | ---- ^^^^^^^ expected `char`, found `Option<_>` - | | - | expected due to this - | - = note: expected type `char` - found enum `Option<_>` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/terr-in-field.rs b/tests/ui/terr-in-field.rs deleted file mode 100644 index cfe350ef86d..00000000000 --- a/tests/ui/terr-in-field.rs +++ /dev/null @@ -1,17 +0,0 @@ -struct Foo { - a: isize, - b: isize, -} - -struct Bar { - a: isize, - b: usize, -} - -fn want_foo(f: Foo) {} -fn have_bar(b: Bar) { - want_foo(b); //~ ERROR mismatched types - //~| expected `Foo`, found `Bar` -} - -fn main() {} diff --git a/tests/ui/terr-in-field.stderr b/tests/ui/terr-in-field.stderr deleted file mode 100644 index 09df4b34bb5..00000000000 --- a/tests/ui/terr-in-field.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/terr-in-field.rs:13:14 - | -LL | want_foo(b); - | -------- ^ expected `Foo`, found `Bar` - | | - | arguments to this function are incorrect - | -note: function defined here - --> $DIR/terr-in-field.rs:11:4 - | -LL | fn want_foo(f: Foo) {} - | ^^^^^^^^ ------ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/terr-sorts.rs b/tests/ui/terr-sorts.rs deleted file mode 100644 index c1e2f7daee5..00000000000 --- a/tests/ui/terr-sorts.rs +++ /dev/null @@ -1,15 +0,0 @@ -struct Foo { - a: isize, - b: isize, -} - -type Bar = Box; - -fn want_foo(f: Foo) {} -fn have_bar(b: Bar) { - want_foo(b); //~ ERROR mismatched types - //~| expected struct `Foo` - //~| found struct `Box` -} - -fn main() {} diff --git a/tests/ui/terr-sorts.stderr b/tests/ui/terr-sorts.stderr deleted file mode 100644 index 8f1975374a5..00000000000 --- a/tests/ui/terr-sorts.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/terr-sorts.rs:10:14 - | -LL | want_foo(b); - | -------- ^ expected `Foo`, found `Box` - | | - | arguments to this function are incorrect - | - = note: expected struct `Foo` - found struct `Box` -note: function defined here - --> $DIR/terr-sorts.rs:8:4 - | -LL | fn want_foo(f: Foo) {} - | ^^^^^^^^ ------ -help: consider unboxing the value - | -LL | want_foo(*b); - | + - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/thread-local-mutation.rs b/tests/ui/thread-local-mutation.rs deleted file mode 100644 index e738225ce2a..00000000000 --- a/tests/ui/thread-local-mutation.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Regression test for #54901: immutable thread locals could be mutated. See: -// https://github.com/rust-lang/rust/issues/29594#issuecomment-328177697 -// https://github.com/rust-lang/rust/issues/54901 - -#![feature(thread_local)] - -#[thread_local] -static S: &str = "before"; - -fn set_s() { - S = "after"; //~ ERROR cannot assign to immutable -} - -fn main() { - println!("{}", S); - set_s(); - println!("{}", S); -} diff --git a/tests/ui/thread-local-mutation.stderr b/tests/ui/thread-local-mutation.stderr deleted file mode 100644 index e5dc0e72edf..00000000000 --- a/tests/ui/thread-local-mutation.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0594]: cannot assign to immutable static item `S` - --> $DIR/thread-local-mutation.rs:11:5 - | -LL | S = "after"; - | ^^^^^^^^^^^ cannot assign - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0594`. diff --git a/tests/ui/thread-local-static.rs b/tests/ui/thread-local-static.rs deleted file mode 100644 index c7fee9e6b4c..00000000000 --- a/tests/ui/thread-local-static.rs +++ /dev/null @@ -1,16 +0,0 @@ -// edition:2018 - -#![feature(thread_local)] -#![feature(const_swap)] -#[thread_local] -static mut STATIC_VAR_2: [u32; 8] = [4; 8]; -const fn g(x: &mut [u32; 8]) { - //~^ ERROR mutable references are not allowed - std::mem::swap(x, &mut STATIC_VAR_2) - //~^ ERROR thread-local statics cannot be accessed - //~| ERROR mutable references are not allowed - //~| ERROR use of mutable static is unsafe - //~| constant functions cannot refer to statics -} - -fn main() {} diff --git a/tests/ui/thread-local-static.stderr b/tests/ui/thread-local-static.stderr deleted file mode 100644 index 712050a25fc..00000000000 --- a/tests/ui/thread-local-static.stderr +++ /dev/null @@ -1,44 +0,0 @@ -error[E0658]: mutable references are not allowed in constant functions - --> $DIR/thread-local-static.rs:7:12 - | -LL | const fn g(x: &mut [u32; 8]) { - | ^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - -error[E0625]: thread-local statics cannot be accessed at compile-time - --> $DIR/thread-local-static.rs:9:28 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^ - -error[E0013]: constant functions cannot refer to statics - --> $DIR/thread-local-static.rs:9:28 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^ - | - = help: consider extracting the value of the `static` to a `const`, and referring to that - -error[E0658]: mutable references are not allowed in constant functions - --> $DIR/thread-local-static.rs:9:23 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/thread-local-static.rs:9:23 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^^^^^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error: aborting due to 5 previous errors - -Some errors have detailed explanations: E0013, E0133, E0625, E0658. -For more information about an error, try `rustc --explain E0013`. diff --git a/tests/ui/thread-local/thread-local-mutation.rs b/tests/ui/thread-local/thread-local-mutation.rs new file mode 100644 index 00000000000..e738225ce2a --- /dev/null +++ b/tests/ui/thread-local/thread-local-mutation.rs @@ -0,0 +1,18 @@ +// Regression test for #54901: immutable thread locals could be mutated. See: +// https://github.com/rust-lang/rust/issues/29594#issuecomment-328177697 +// https://github.com/rust-lang/rust/issues/54901 + +#![feature(thread_local)] + +#[thread_local] +static S: &str = "before"; + +fn set_s() { + S = "after"; //~ ERROR cannot assign to immutable +} + +fn main() { + println!("{}", S); + set_s(); + println!("{}", S); +} diff --git a/tests/ui/thread-local/thread-local-mutation.stderr b/tests/ui/thread-local/thread-local-mutation.stderr new file mode 100644 index 00000000000..e5dc0e72edf --- /dev/null +++ b/tests/ui/thread-local/thread-local-mutation.stderr @@ -0,0 +1,9 @@ +error[E0594]: cannot assign to immutable static item `S` + --> $DIR/thread-local-mutation.rs:11:5 + | +LL | S = "after"; + | ^^^^^^^^^^^ cannot assign + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0594`. diff --git a/tests/ui/thread-local/thread-local-static.rs b/tests/ui/thread-local/thread-local-static.rs new file mode 100644 index 00000000000..c7fee9e6b4c --- /dev/null +++ b/tests/ui/thread-local/thread-local-static.rs @@ -0,0 +1,16 @@ +// edition:2018 + +#![feature(thread_local)] +#![feature(const_swap)] +#[thread_local] +static mut STATIC_VAR_2: [u32; 8] = [4; 8]; +const fn g(x: &mut [u32; 8]) { + //~^ ERROR mutable references are not allowed + std::mem::swap(x, &mut STATIC_VAR_2) + //~^ ERROR thread-local statics cannot be accessed + //~| ERROR mutable references are not allowed + //~| ERROR use of mutable static is unsafe + //~| constant functions cannot refer to statics +} + +fn main() {} diff --git a/tests/ui/thread-local/thread-local-static.stderr b/tests/ui/thread-local/thread-local-static.stderr new file mode 100644 index 00000000000..712050a25fc --- /dev/null +++ b/tests/ui/thread-local/thread-local-static.stderr @@ -0,0 +1,44 @@ +error[E0658]: mutable references are not allowed in constant functions + --> $DIR/thread-local-static.rs:7:12 + | +LL | const fn g(x: &mut [u32; 8]) { + | ^ + | + = note: see issue #57349 for more information + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + +error[E0625]: thread-local statics cannot be accessed at compile-time + --> $DIR/thread-local-static.rs:9:28 + | +LL | std::mem::swap(x, &mut STATIC_VAR_2) + | ^^^^^^^^^^^^ + +error[E0013]: constant functions cannot refer to statics + --> $DIR/thread-local-static.rs:9:28 + | +LL | std::mem::swap(x, &mut STATIC_VAR_2) + | ^^^^^^^^^^^^ + | + = help: consider extracting the value of the `static` to a `const`, and referring to that + +error[E0658]: mutable references are not allowed in constant functions + --> $DIR/thread-local-static.rs:9:23 + | +LL | std::mem::swap(x, &mut STATIC_VAR_2) + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #57349 for more information + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + +error[E0133]: use of mutable static is unsafe and requires unsafe function or block + --> $DIR/thread-local-static.rs:9:23 + | +LL | std::mem::swap(x, &mut STATIC_VAR_2) + | ^^^^^^^^^^^^^^^^^ use of mutable static + | + = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior + +error: aborting due to 5 previous errors + +Some errors have detailed explanations: E0013, E0133, E0625, E0658. +For more information about an error, try `rustc --explain E0013`. diff --git a/tests/ui/traits/wrong-mul-method-signature.rs b/tests/ui/traits/wrong-mul-method-signature.rs new file mode 100644 index 00000000000..1c2f865599e --- /dev/null +++ b/tests/ui/traits/wrong-mul-method-signature.rs @@ -0,0 +1,68 @@ +// This test is to make sure we don't just ICE if the trait +// method for an operator is not implemented properly. +// (In this case the mul method should take &f64 and not f64) +// See: #11450 + +use std::ops::Mul; + +struct Vec1 { + x: f64 +} + +// Expecting value in input signature +impl Mul for Vec1 { + type Output = Vec1; + + fn mul(self, s: &f64) -> Vec1 { + //~^ ERROR method `mul` has an incompatible type for trait + Vec1 { + x: self.x * *s + } + } +} + +struct Vec2 { + x: f64, + y: f64 +} + +// Wrong type parameter ordering +impl Mul for Vec2 { + type Output = f64; + + fn mul(self, s: f64) -> Vec2 { + //~^ ERROR method `mul` has an incompatible type for trait + Vec2 { + x: self.x * s, + y: self.y * s + } + } +} + +struct Vec3 { + x: f64, + y: f64, + z: f64 +} + +// Unexpected return type +impl Mul for Vec3 { + type Output = i32; + + fn mul(self, s: f64) -> f64 { + //~^ ERROR method `mul` has an incompatible type for trait + s + } +} + +pub fn main() { + // Check that the usage goes from the trait declaration: + + let x: Vec1 = Vec1 { x: 1.0 } * 2.0; // this is OK + + let x: Vec2 = Vec2 { x: 1.0, y: 2.0 } * 2.0; // trait had reversed order + //~^ ERROR mismatched types + //~| ERROR mismatched types + + let x: i32 = Vec3 { x: 1.0, y: 2.0, z: 3.0 } * 2.0; +} diff --git a/tests/ui/traits/wrong-mul-method-signature.stderr b/tests/ui/traits/wrong-mul-method-signature.stderr new file mode 100644 index 00000000000..25a92f5ec12 --- /dev/null +++ b/tests/ui/traits/wrong-mul-method-signature.stderr @@ -0,0 +1,56 @@ +error[E0053]: method `mul` has an incompatible type for trait + --> $DIR/wrong-mul-method-signature.rs:16:21 + | +LL | fn mul(self, s: &f64) -> Vec1 { + | ^^^^ + | | + | expected `f64`, found `&f64` + | help: change the parameter type to match the trait: `f64` + | + = note: expected signature `fn(Vec1, f64) -> Vec1` + found signature `fn(Vec1, &f64) -> Vec1` + +error[E0053]: method `mul` has an incompatible type for trait + --> $DIR/wrong-mul-method-signature.rs:33:21 + | +LL | fn mul(self, s: f64) -> Vec2 { + | ^^^ + | | + | expected `Vec2`, found `f64` + | help: change the parameter type to match the trait: `Vec2` + | + = note: expected signature `fn(Vec2, Vec2) -> f64` + found signature `fn(Vec2, f64) -> Vec2` + +error[E0053]: method `mul` has an incompatible type for trait + --> $DIR/wrong-mul-method-signature.rs:52:29 + | +LL | fn mul(self, s: f64) -> f64 { + | ^^^ + | | + | expected `i32`, found `f64` + | help: change the output type to match the trait: `i32` + | + = note: expected signature `fn(Vec3, _) -> i32` + found signature `fn(Vec3, _) -> f64` + +error[E0308]: mismatched types + --> $DIR/wrong-mul-method-signature.rs:63:45 + | +LL | let x: Vec2 = Vec2 { x: 1.0, y: 2.0 } * 2.0; // trait had reversed order + | ----------------------- ^^^ expected `Vec2`, found floating-point number + | | + | expected because this is `Vec2` + +error[E0308]: mismatched types + --> $DIR/wrong-mul-method-signature.rs:63:19 + | +LL | let x: Vec2 = Vec2 { x: 1.0, y: 2.0 } * 2.0; // trait had reversed order + | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Vec2`, found `f64` + | | + | expected due to this + +error: aborting due to 5 previous errors + +Some errors have detailed explanations: E0053, E0308. +For more information about an error, try `rustc --explain E0053`. diff --git a/tests/ui/tuple-index.rs b/tests/ui/tuple-index.rs deleted file mode 100644 index 3e1d92b42aa..00000000000 --- a/tests/ui/tuple-index.rs +++ /dev/null @@ -1,32 +0,0 @@ -// run-pass - -struct Point(isize, isize); - -fn main() { - let mut x = Point(3, 2); - assert_eq!(x.0, 3); - assert_eq!(x.1, 2); - x.0 += 5; - assert_eq!(x.0, 8); - { - let ry = &mut x.1; - *ry -= 2; - x.0 += 3; - assert_eq!(x.0, 11); - } - assert_eq!(x.1, 0); - - let mut x = (3, 2); - assert_eq!(x.0, 3); - assert_eq!(x.1, 2); - x.0 += 5; - assert_eq!(x.0, 8); - { - let ry = &mut x.1; - *ry -= 2; - x.0 += 3; - assert_eq!(x.0, 11); - } - assert_eq!(x.1, 0); - -} diff --git a/tests/ui/tuple/tuple-index.rs b/tests/ui/tuple/tuple-index.rs new file mode 100644 index 00000000000..3e1d92b42aa --- /dev/null +++ b/tests/ui/tuple/tuple-index.rs @@ -0,0 +1,32 @@ +// run-pass + +struct Point(isize, isize); + +fn main() { + let mut x = Point(3, 2); + assert_eq!(x.0, 3); + assert_eq!(x.1, 2); + x.0 += 5; + assert_eq!(x.0, 8); + { + let ry = &mut x.1; + *ry -= 2; + x.0 += 3; + assert_eq!(x.0, 11); + } + assert_eq!(x.1, 0); + + let mut x = (3, 2); + assert_eq!(x.0, 3); + assert_eq!(x.1, 2); + x.0 += 5; + assert_eq!(x.0, 8); + { + let ry = &mut x.1; + *ry -= 2; + x.0 += 3; + assert_eq!(x.0, 11); + } + assert_eq!(x.1, 0); + +} diff --git a/tests/ui/typeck/output-type-mismatch.rs b/tests/ui/typeck/output-type-mismatch.rs new file mode 100644 index 00000000000..35097aa9ec6 --- /dev/null +++ b/tests/ui/typeck/output-type-mismatch.rs @@ -0,0 +1,5 @@ +// error-pattern: mismatched types + +fn f() { } + +fn main() { let i: isize; i = f(); } diff --git a/tests/ui/typeck/output-type-mismatch.stderr b/tests/ui/typeck/output-type-mismatch.stderr new file mode 100644 index 00000000000..4507a4df621 --- /dev/null +++ b/tests/ui/typeck/output-type-mismatch.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/output-type-mismatch.rs:5:31 + | +LL | fn main() { let i: isize; i = f(); } + | ----- ^^^ expected `isize`, found `()` + | | + | expected due to this type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/suppressed-error.rs b/tests/ui/typeck/suppressed-error.rs new file mode 100644 index 00000000000..1e39be46080 --- /dev/null +++ b/tests/ui/typeck/suppressed-error.rs @@ -0,0 +1,8 @@ +fn main() { + let (x, y) = (); +//~^ ERROR mismatched types +//~| expected unit type `()` +//~| found tuple `(_, _)` +//~| expected `()`, found + return x; +} diff --git a/tests/ui/typeck/suppressed-error.stderr b/tests/ui/typeck/suppressed-error.stderr new file mode 100644 index 00000000000..11d70f8a433 --- /dev/null +++ b/tests/ui/typeck/suppressed-error.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/suppressed-error.rs:2:9 + | +LL | let (x, y) = (); + | ^^^^^^ -- this expression has type `()` + | | + | expected `()`, found `(_, _)` + | + = note: expected unit type `()` + found tuple `(_, _)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/tag-that-dare-not-speak-its-name.rs b/tests/ui/typeck/tag-that-dare-not-speak-its-name.rs new file mode 100644 index 00000000000..0e76ec246d7 --- /dev/null +++ b/tests/ui/typeck/tag-that-dare-not-speak-its-name.rs @@ -0,0 +1,16 @@ +// Issue #876 + +use std::vec::Vec; + +fn last(v: Vec<&T> ) -> std::option::Option { + ::std::panic!(); +} + +fn main() { + let y; + let x : char = last(y); + //~^ ERROR mismatched types + //~| expected type `char` + //~| found enum `Option<_>` + //~| expected `char`, found `Option<_>` +} diff --git a/tests/ui/typeck/tag-that-dare-not-speak-its-name.stderr b/tests/ui/typeck/tag-that-dare-not-speak-its-name.stderr new file mode 100644 index 00000000000..f53abe53bf1 --- /dev/null +++ b/tests/ui/typeck/tag-that-dare-not-speak-its-name.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/tag-that-dare-not-speak-its-name.rs:11:20 + | +LL | let x : char = last(y); + | ---- ^^^^^^^ expected `char`, found `Option<_>` + | | + | expected due to this + | + = note: expected type `char` + found enum `Option<_>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/terr-in-field.rs b/tests/ui/typeck/terr-in-field.rs new file mode 100644 index 00000000000..cfe350ef86d --- /dev/null +++ b/tests/ui/typeck/terr-in-field.rs @@ -0,0 +1,17 @@ +struct Foo { + a: isize, + b: isize, +} + +struct Bar { + a: isize, + b: usize, +} + +fn want_foo(f: Foo) {} +fn have_bar(b: Bar) { + want_foo(b); //~ ERROR mismatched types + //~| expected `Foo`, found `Bar` +} + +fn main() {} diff --git a/tests/ui/typeck/terr-in-field.stderr b/tests/ui/typeck/terr-in-field.stderr new file mode 100644 index 00000000000..09df4b34bb5 --- /dev/null +++ b/tests/ui/typeck/terr-in-field.stderr @@ -0,0 +1,17 @@ +error[E0308]: mismatched types + --> $DIR/terr-in-field.rs:13:14 + | +LL | want_foo(b); + | -------- ^ expected `Foo`, found `Bar` + | | + | arguments to this function are incorrect + | +note: function defined here + --> $DIR/terr-in-field.rs:11:4 + | +LL | fn want_foo(f: Foo) {} + | ^^^^^^^^ ------ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/terr-sorts.rs b/tests/ui/typeck/terr-sorts.rs new file mode 100644 index 00000000000..c1e2f7daee5 --- /dev/null +++ b/tests/ui/typeck/terr-sorts.rs @@ -0,0 +1,15 @@ +struct Foo { + a: isize, + b: isize, +} + +type Bar = Box; + +fn want_foo(f: Foo) {} +fn have_bar(b: Bar) { + want_foo(b); //~ ERROR mismatched types + //~| expected struct `Foo` + //~| found struct `Box` +} + +fn main() {} diff --git a/tests/ui/typeck/terr-sorts.stderr b/tests/ui/typeck/terr-sorts.stderr new file mode 100644 index 00000000000..8f1975374a5 --- /dev/null +++ b/tests/ui/typeck/terr-sorts.stderr @@ -0,0 +1,23 @@ +error[E0308]: mismatched types + --> $DIR/terr-sorts.rs:10:14 + | +LL | want_foo(b); + | -------- ^ expected `Foo`, found `Box` + | | + | arguments to this function are incorrect + | + = note: expected struct `Foo` + found struct `Box` +note: function defined here + --> $DIR/terr-sorts.rs:8:4 + | +LL | fn want_foo(f: Foo) {} + | ^^^^^^^^ ------ +help: consider unboxing the value + | +LL | want_foo(*b); + | + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/while-type-error.rs b/tests/ui/typeck/while-type-error.rs new file mode 100644 index 00000000000..8098bfcd8d9 --- /dev/null +++ b/tests/ui/typeck/while-type-error.rs @@ -0,0 +1,3 @@ +// error-pattern: mismatched types + +fn main() { while main { } } diff --git a/tests/ui/typeck/while-type-error.stderr b/tests/ui/typeck/while-type-error.stderr new file mode 100644 index 00000000000..529cbff0563 --- /dev/null +++ b/tests/ui/typeck/while-type-error.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/while-type-error.rs:3:19 + | +LL | fn main() { while main { } } + | ^^^^ expected `bool`, found fn item + | + = note: expected type `bool` + found fn item `fn() {main}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/wrong-ret-type.rs b/tests/ui/typeck/wrong-ret-type.rs new file mode 100644 index 00000000000..cbff8dbae21 --- /dev/null +++ b/tests/ui/typeck/wrong-ret-type.rs @@ -0,0 +1,3 @@ +// error-pattern: mismatched types +fn mk_int() -> usize { let i: isize = 3; return i; } +fn main() { } diff --git a/tests/ui/typeck/wrong-ret-type.stderr b/tests/ui/typeck/wrong-ret-type.stderr new file mode 100644 index 00000000000..c686a0b2f5a --- /dev/null +++ b/tests/ui/typeck/wrong-ret-type.stderr @@ -0,0 +1,16 @@ +error[E0308]: mismatched types + --> $DIR/wrong-ret-type.rs:2:49 + | +LL | fn mk_int() -> usize { let i: isize = 3; return i; } + | ----- ^ expected `usize`, found `isize` + | | + | expected `usize` because of return type + | +help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit + | +LL | fn mk_int() -> usize { let i: isize = 3; return i.try_into().unwrap(); } + | ++++++++++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/ufcs-polymorphic-paths.rs b/tests/ui/ufcs-polymorphic-paths.rs deleted file mode 100644 index a14ebd6a41f..00000000000 --- a/tests/ui/ufcs-polymorphic-paths.rs +++ /dev/null @@ -1,154 +0,0 @@ -// run-pass - -use std::borrow::{Cow, ToOwned}; -use std::default::Default; -use std::iter::FromIterator; -use std::ops::Add; -use std::option::IntoIter as OptionIter; - -pub struct XorShiftRng; -use XorShiftRng as DummyRng; -impl Rng for XorShiftRng {} -pub trait Rng {} -pub trait Rand: Default + Sized { - fn rand(_rng: &mut R) -> Self { Default::default() } -} -impl Rand for i32 { } - -pub trait IntoCow<'a, B: ?Sized> where B: ToOwned { - fn into_cow(self) -> Cow<'a, B>; -} - -impl<'a> IntoCow<'a, str> for String { - fn into_cow(self) -> Cow<'a, str> { - Cow::Owned(self) - } -} - -#[derive(PartialEq, Eq)] -struct Newt(T); - -fn id(x: T) -> T { x } -fn eq(a: T, b: T) -> bool { a == b } -fn u8_as_i8(x: u8) -> i8 { x as i8 } -fn odd(x: usize) -> bool { x % 2 == 1 } -fn dummy_rng() -> DummyRng { XorShiftRng } - -trait Size: Sized { - fn size() -> usize { std::mem::size_of::() } -} -impl Size for T {} - -#[derive(PartialEq, Eq)] -struct BitVec; - -impl BitVec { - fn from_fn(_: usize, _: F) -> BitVec where F: FnMut(usize) -> bool { - BitVec - } -} - -#[derive(PartialEq, Eq)] -struct Foo(T); - -impl Foo { - fn map_in_place(self, mut f: F) -> Foo where F: FnMut(T) -> U { - Foo(f(self.0)) - } - -} - -macro_rules! tests { - ($($expr:expr, $ty:ty, ($($test:expr),*);)+) => (pub fn main() {$({ - const C: $ty = $expr; - static S: $ty = $expr; - assert!(eq(C($($test),*), $expr($($test),*))); - assert!(eq(S($($test),*), $expr($($test),*))); - assert!(eq(C($($test),*), S($($test),*))); - })+}) -} - -tests! { - // Free function. - id, fn(i32) -> i32, (5); - id::, fn(i32) -> i32, (5); - - // Enum variant constructor. - Some, fn(i32) -> Option, (5); - Some::, fn(i32) -> Option, (5); - - // Tuple struct constructor. - Newt, fn(i32) -> Newt, (5); - Newt::, fn(i32) -> Newt, (5); - - // Inherent static methods. - Vec::new, fn() -> Vec<()>, (); - Vec::<()>::new, fn() -> Vec<()>, (); - >::new, fn() -> Vec<()>, (); - Vec::with_capacity, fn(usize) -> Vec<()>, (5); - Vec::<()>::with_capacity, fn(usize) -> Vec<()>, (5); - >::with_capacity, fn(usize) -> Vec<()>, (5); - BitVec::from_fn, fn(usize, fn(usize) -> bool) -> BitVec, (5, odd); - BitVec::from_fn:: bool>, fn(usize, fn(usize) -> bool) -> BitVec, (5, odd); - - // Inherent non-static method. - Foo::map_in_place, fn(Foo, fn(u8) -> i8) -> Foo, (Foo(b'f'), u8_as_i8); - Foo::map_in_place:: i8>, fn(Foo, fn(u8) -> i8) -> Foo, - (Foo(b'f'), u8_as_i8); - Foo::::map_in_place, fn(Foo, fn(u8) -> i8) -> Foo - , (Foo(b'f'), u8_as_i8); - Foo::::map_in_place:: i8>, fn(Foo, fn(u8) -> i8) -> Foo - , (Foo(b'f'), u8_as_i8); - - // Trait static methods. - bool::size, fn() -> usize, (); - ::size, fn() -> usize, (); - ::size, fn() -> usize, (); - - Default::default, fn() -> i32, (); - i32::default, fn() -> i32, (); - ::default, fn() -> i32, (); - ::default, fn() -> i32, (); - - Rand::rand, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); - i32::rand, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); - ::rand, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); - ::rand, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); - Rand::rand::, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); - i32::rand::, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); - ::rand::, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); - ::rand::, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); - - // Trait non-static methods. - Clone::clone, fn(&i32) -> i32, (&5); - i32::clone, fn(&i32) -> i32, (&5); - ::clone, fn(&i32) -> i32, (&5); - ::clone, fn(&i32) -> i32, (&5); - - FromIterator::from_iter, fn(OptionIter) -> Vec, (Some(5).into_iter()); - Vec::from_iter, fn(OptionIter) -> Vec, (Some(5).into_iter()); - >::from_iter, fn(OptionIter) -> Vec, (Some(5).into_iter()); - as FromIterator<_>>::from_iter, fn(OptionIter) -> Vec, - (Some(5).into_iter()); - as FromIterator<_>>::from_iter, fn(OptionIter) -> Vec, - (Some(5).into_iter()); - FromIterator::from_iter::>, fn(OptionIter) -> Vec, - (Some(5).into_iter()); - as FromIterator<_>>::from_iter::>, fn(OptionIter) -> Vec, - (Some(5).into_iter()); - - Add::add, fn(i32, i32) -> i32, (5, 6); - i32::add, fn(i32, i32) -> i32, (5, 6); - ::add, fn(i32, i32) -> i32, (5, 6); - >::add, fn(i32, i32) -> i32, (5, 6); - >::add, fn(i32, i32) -> i32, (5, 6); - - String::into_cow, fn(String) -> Cow<'static, str>, - ("foo".to_string()); - ::into_cow, fn(String) -> Cow<'static, str>, - ("foo".to_string()); - >::into_cow, fn(String) -> Cow<'static, str>, - ("foo".to_string()); - >::into_cow, fn(String) -> Cow<'static, str>, - ("foo".to_string()); -} diff --git a/tests/ui/ufcs/ufcs-polymorphic-paths.rs b/tests/ui/ufcs/ufcs-polymorphic-paths.rs new file mode 100644 index 00000000000..a14ebd6a41f --- /dev/null +++ b/tests/ui/ufcs/ufcs-polymorphic-paths.rs @@ -0,0 +1,154 @@ +// run-pass + +use std::borrow::{Cow, ToOwned}; +use std::default::Default; +use std::iter::FromIterator; +use std::ops::Add; +use std::option::IntoIter as OptionIter; + +pub struct XorShiftRng; +use XorShiftRng as DummyRng; +impl Rng for XorShiftRng {} +pub trait Rng {} +pub trait Rand: Default + Sized { + fn rand(_rng: &mut R) -> Self { Default::default() } +} +impl Rand for i32 { } + +pub trait IntoCow<'a, B: ?Sized> where B: ToOwned { + fn into_cow(self) -> Cow<'a, B>; +} + +impl<'a> IntoCow<'a, str> for String { + fn into_cow(self) -> Cow<'a, str> { + Cow::Owned(self) + } +} + +#[derive(PartialEq, Eq)] +struct Newt(T); + +fn id(x: T) -> T { x } +fn eq(a: T, b: T) -> bool { a == b } +fn u8_as_i8(x: u8) -> i8 { x as i8 } +fn odd(x: usize) -> bool { x % 2 == 1 } +fn dummy_rng() -> DummyRng { XorShiftRng } + +trait Size: Sized { + fn size() -> usize { std::mem::size_of::() } +} +impl Size for T {} + +#[derive(PartialEq, Eq)] +struct BitVec; + +impl BitVec { + fn from_fn(_: usize, _: F) -> BitVec where F: FnMut(usize) -> bool { + BitVec + } +} + +#[derive(PartialEq, Eq)] +struct Foo(T); + +impl Foo { + fn map_in_place(self, mut f: F) -> Foo where F: FnMut(T) -> U { + Foo(f(self.0)) + } + +} + +macro_rules! tests { + ($($expr:expr, $ty:ty, ($($test:expr),*);)+) => (pub fn main() {$({ + const C: $ty = $expr; + static S: $ty = $expr; + assert!(eq(C($($test),*), $expr($($test),*))); + assert!(eq(S($($test),*), $expr($($test),*))); + assert!(eq(C($($test),*), S($($test),*))); + })+}) +} + +tests! { + // Free function. + id, fn(i32) -> i32, (5); + id::, fn(i32) -> i32, (5); + + // Enum variant constructor. + Some, fn(i32) -> Option, (5); + Some::, fn(i32) -> Option, (5); + + // Tuple struct constructor. + Newt, fn(i32) -> Newt, (5); + Newt::, fn(i32) -> Newt, (5); + + // Inherent static methods. + Vec::new, fn() -> Vec<()>, (); + Vec::<()>::new, fn() -> Vec<()>, (); + >::new, fn() -> Vec<()>, (); + Vec::with_capacity, fn(usize) -> Vec<()>, (5); + Vec::<()>::with_capacity, fn(usize) -> Vec<()>, (5); + >::with_capacity, fn(usize) -> Vec<()>, (5); + BitVec::from_fn, fn(usize, fn(usize) -> bool) -> BitVec, (5, odd); + BitVec::from_fn:: bool>, fn(usize, fn(usize) -> bool) -> BitVec, (5, odd); + + // Inherent non-static method. + Foo::map_in_place, fn(Foo, fn(u8) -> i8) -> Foo, (Foo(b'f'), u8_as_i8); + Foo::map_in_place:: i8>, fn(Foo, fn(u8) -> i8) -> Foo, + (Foo(b'f'), u8_as_i8); + Foo::::map_in_place, fn(Foo, fn(u8) -> i8) -> Foo + , (Foo(b'f'), u8_as_i8); + Foo::::map_in_place:: i8>, fn(Foo, fn(u8) -> i8) -> Foo + , (Foo(b'f'), u8_as_i8); + + // Trait static methods. + bool::size, fn() -> usize, (); + ::size, fn() -> usize, (); + ::size, fn() -> usize, (); + + Default::default, fn() -> i32, (); + i32::default, fn() -> i32, (); + ::default, fn() -> i32, (); + ::default, fn() -> i32, (); + + Rand::rand, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); + i32::rand, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); + ::rand, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); + ::rand, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); + Rand::rand::, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); + i32::rand::, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); + ::rand::, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); + ::rand::, fn(&mut DummyRng) -> i32, (&mut dummy_rng()); + + // Trait non-static methods. + Clone::clone, fn(&i32) -> i32, (&5); + i32::clone, fn(&i32) -> i32, (&5); + ::clone, fn(&i32) -> i32, (&5); + ::clone, fn(&i32) -> i32, (&5); + + FromIterator::from_iter, fn(OptionIter) -> Vec, (Some(5).into_iter()); + Vec::from_iter, fn(OptionIter) -> Vec, (Some(5).into_iter()); + >::from_iter, fn(OptionIter) -> Vec, (Some(5).into_iter()); + as FromIterator<_>>::from_iter, fn(OptionIter) -> Vec, + (Some(5).into_iter()); + as FromIterator<_>>::from_iter, fn(OptionIter) -> Vec, + (Some(5).into_iter()); + FromIterator::from_iter::>, fn(OptionIter) -> Vec, + (Some(5).into_iter()); + as FromIterator<_>>::from_iter::>, fn(OptionIter) -> Vec, + (Some(5).into_iter()); + + Add::add, fn(i32, i32) -> i32, (5, 6); + i32::add, fn(i32, i32) -> i32, (5, 6); + ::add, fn(i32, i32) -> i32, (5, 6); + >::add, fn(i32, i32) -> i32, (5, 6); + >::add, fn(i32, i32) -> i32, (5, 6); + + String::into_cow, fn(String) -> Cow<'static, str>, + ("foo".to_string()); + ::into_cow, fn(String) -> Cow<'static, str>, + ("foo".to_string()); + >::into_cow, fn(String) -> Cow<'static, str>, + ("foo".to_string()); + >::into_cow, fn(String) -> Cow<'static, str>, + ("foo".to_string()); +} diff --git a/tests/ui/unique-object-noncopyable.rs b/tests/ui/unique-object-noncopyable.rs deleted file mode 100644 index 2c40dfc7a4b..00000000000 --- a/tests/ui/unique-object-noncopyable.rs +++ /dev/null @@ -1,25 +0,0 @@ -trait Foo { - fn f(&self); -} - -struct Bar { - x: isize, -} - -impl Drop for Bar { - fn drop(&mut self) {} -} - -impl Foo for Bar { - fn f(&self) { - println!("hi"); - } -} - - - -fn main() { - let x = Box::new(Bar { x: 10 }); - let y: Box = x as Box; - let _z = y.clone(); //~ ERROR the method -} diff --git a/tests/ui/unique-object-noncopyable.stderr b/tests/ui/unique-object-noncopyable.stderr deleted file mode 100644 index db42ed9baf1..00000000000 --- a/tests/ui/unique-object-noncopyable.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0599]: the method `clone` exists for struct `Box`, but its trait bounds were not satisfied - --> $DIR/unique-object-noncopyable.rs:24:16 - | -LL | trait Foo { - | --------- - | | - | doesn't satisfy `dyn Foo: Clone` - | doesn't satisfy `dyn Foo: Sized` -... -LL | let _z = y.clone(); - | ^^^^^ method cannot be called on `Box` due to unsatisfied trait bounds - --> $SRC_DIR/alloc/src/boxed.rs:LL:COL - ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL - | - = note: doesn't satisfy `Box: Clone` - | - = note: the following trait bounds were not satisfied: - `dyn Foo: Sized` - which is required by `Box: Clone` - `dyn Foo: Clone` - which is required by `Box: Clone` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/unique-pinned-nocopy.rs b/tests/ui/unique-pinned-nocopy.rs deleted file mode 100644 index 8edaeef51e0..00000000000 --- a/tests/ui/unique-pinned-nocopy.rs +++ /dev/null @@ -1,14 +0,0 @@ -#[derive(Debug)] -struct R { - b: bool, -} - -impl Drop for R { - fn drop(&mut self) {} -} - -fn main() { - let i = Box::new(R { b: true }); - let _j = i.clone(); //~ ERROR the method - println!("{:?}", i); -} diff --git a/tests/ui/unique-pinned-nocopy.stderr b/tests/ui/unique-pinned-nocopy.stderr deleted file mode 100644 index de6611324ca..00000000000 --- a/tests/ui/unique-pinned-nocopy.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0599]: the method `clone` exists for struct `Box`, but its trait bounds were not satisfied - --> $DIR/unique-pinned-nocopy.rs:12:16 - | -LL | struct R { - | -------- doesn't satisfy `R: Clone` -... -LL | let _j = i.clone(); - | ^^^^^ method cannot be called on `Box` due to unsatisfied trait bounds - --> $SRC_DIR/alloc/src/boxed.rs:LL:COL - ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL - | - = note: doesn't satisfy `Box: Clone` - | - = note: the following trait bounds were not satisfied: - `R: Clone` - which is required by `Box: Clone` - = help: items from traits can only be used if the trait is implemented and in scope - = note: the following trait defines an item `clone`, perhaps you need to implement it: - candidate #1: `Clone` -help: consider annotating `R` with `#[derive(Clone)]` - | -LL | #[derive(Clone)] - | - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/unique/expr-block-generic-unique1.rs b/tests/ui/unique/expr-block-generic-unique1.rs new file mode 100644 index 00000000000..14603a2c71f --- /dev/null +++ b/tests/ui/unique/expr-block-generic-unique1.rs @@ -0,0 +1,18 @@ +// run-pass +#![allow(unused_braces)] + +fn test_generic(expected: Box, eq: F) where T: Clone, F: FnOnce(Box, Box) -> bool { + let actual: Box = { expected.clone() }; + assert!(eq(expected, actual)); +} + +fn test_box() { + fn compare_box(b1: Box, b2: Box) -> bool { + println!("{}", *b1); + println!("{}", *b2); + return *b1 == *b2; + } + test_generic::(Box::new(true), compare_box); +} + +pub fn main() { test_box(); } diff --git a/tests/ui/unique/expr-block-generic-unique2.rs b/tests/ui/unique/expr-block-generic-unique2.rs new file mode 100644 index 00000000000..7879c144b10 --- /dev/null +++ b/tests/ui/unique/expr-block-generic-unique2.rs @@ -0,0 +1,14 @@ +// run-pass +#![allow(unused_braces)] + +fn test_generic(expected: T, eq: F) where T: Clone, F: FnOnce(T, T) -> bool { + let actual: T = { expected.clone() }; + assert!(eq(expected, actual)); +} + +fn test_vec() { + fn compare_vec(v1: Box, v2: Box) -> bool { return v1 == v2; } + test_generic::, _>(Box::new(1), compare_vec); +} + +pub fn main() { test_vec(); } diff --git a/tests/ui/unique/expr-if-unique.rs b/tests/ui/unique/expr-if-unique.rs new file mode 100644 index 00000000000..86232683549 --- /dev/null +++ b/tests/ui/unique/expr-if-unique.rs @@ -0,0 +1,9 @@ +// run-pass + +// Tests for if as expressions returning boxed types +fn test_box() { + let rs: Box<_> = if true { Box::new(100) } else { Box::new(101) }; + assert_eq!(*rs, 100); +} + +pub fn main() { test_box(); } diff --git a/tests/ui/unique/unique-object-noncopyable.rs b/tests/ui/unique/unique-object-noncopyable.rs new file mode 100644 index 00000000000..2c40dfc7a4b --- /dev/null +++ b/tests/ui/unique/unique-object-noncopyable.rs @@ -0,0 +1,25 @@ +trait Foo { + fn f(&self); +} + +struct Bar { + x: isize, +} + +impl Drop for Bar { + fn drop(&mut self) {} +} + +impl Foo for Bar { + fn f(&self) { + println!("hi"); + } +} + + + +fn main() { + let x = Box::new(Bar { x: 10 }); + let y: Box = x as Box; + let _z = y.clone(); //~ ERROR the method +} diff --git a/tests/ui/unique/unique-object-noncopyable.stderr b/tests/ui/unique/unique-object-noncopyable.stderr new file mode 100644 index 00000000000..db42ed9baf1 --- /dev/null +++ b/tests/ui/unique/unique-object-noncopyable.stderr @@ -0,0 +1,25 @@ +error[E0599]: the method `clone` exists for struct `Box`, but its trait bounds were not satisfied + --> $DIR/unique-object-noncopyable.rs:24:16 + | +LL | trait Foo { + | --------- + | | + | doesn't satisfy `dyn Foo: Clone` + | doesn't satisfy `dyn Foo: Sized` +... +LL | let _z = y.clone(); + | ^^^^^ method cannot be called on `Box` due to unsatisfied trait bounds + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL + ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL + | + = note: doesn't satisfy `Box: Clone` + | + = note: the following trait bounds were not satisfied: + `dyn Foo: Sized` + which is required by `Box: Clone` + `dyn Foo: Clone` + which is required by `Box: Clone` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/unique/unique-pinned-nocopy.rs b/tests/ui/unique/unique-pinned-nocopy.rs new file mode 100644 index 00000000000..8edaeef51e0 --- /dev/null +++ b/tests/ui/unique/unique-pinned-nocopy.rs @@ -0,0 +1,14 @@ +#[derive(Debug)] +struct R { + b: bool, +} + +impl Drop for R { + fn drop(&mut self) {} +} + +fn main() { + let i = Box::new(R { b: true }); + let _j = i.clone(); //~ ERROR the method + println!("{:?}", i); +} diff --git a/tests/ui/unique/unique-pinned-nocopy.stderr b/tests/ui/unique/unique-pinned-nocopy.stderr new file mode 100644 index 00000000000..de6611324ca --- /dev/null +++ b/tests/ui/unique/unique-pinned-nocopy.stderr @@ -0,0 +1,27 @@ +error[E0599]: the method `clone` exists for struct `Box`, but its trait bounds were not satisfied + --> $DIR/unique-pinned-nocopy.rs:12:16 + | +LL | struct R { + | -------- doesn't satisfy `R: Clone` +... +LL | let _j = i.clone(); + | ^^^^^ method cannot be called on `Box` due to unsatisfied trait bounds + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL + ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL + | + = note: doesn't satisfy `Box: Clone` + | + = note: the following trait bounds were not satisfied: + `R: Clone` + which is required by `Box: Clone` + = help: items from traits can only be used if the trait is implemented and in scope + = note: the following trait defines an item `clone`, perhaps you need to implement it: + candidate #1: `Clone` +help: consider annotating `R` with `#[derive(Clone)]` + | +LL | #[derive(Clone)] + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/unique/unwind-unique.rs b/tests/ui/unique/unwind-unique.rs new file mode 100644 index 00000000000..50ecf751a86 --- /dev/null +++ b/tests/ui/unique/unwind-unique.rs @@ -0,0 +1,15 @@ +// run-pass +// needs-unwind +// ignore-emscripten no threads support + +use std::thread; + +fn f() { + let _a: Box<_> = Box::new(0); + panic!(); +} + +pub fn main() { + let t = thread::spawn(f); + drop(t.join()); +} diff --git a/tests/ui/unpretty-expr-fn-arg.rs b/tests/ui/unpretty-expr-fn-arg.rs deleted file mode 100644 index 6e1132a3372..00000000000 --- a/tests/ui/unpretty-expr-fn-arg.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Regression test for the ICE described in #82328. The pretty-printer for -// `-Zunpretty=hir,typed` would previously retrieve type-checking results -// when entering a body, which means that type information was not available -// for expressions occurring in function signatures, as in the `foo` example -// below, leading to an ICE. - -// check-pass -// compile-flags: -Zunpretty=hir,typed -#![allow(dead_code)] - -fn main() {} - -fn foo(-128..=127: i8) {} diff --git a/tests/ui/unpretty-expr-fn-arg.stdout b/tests/ui/unpretty-expr-fn-arg.stdout deleted file mode 100644 index b745b988631..00000000000 --- a/tests/ui/unpretty-expr-fn-arg.stdout +++ /dev/null @@ -1,17 +0,0 @@ -// Regression test for the ICE described in #82328. The pretty-printer for -// `-Zunpretty=hir,typed` would previously retrieve type-checking results -// when entering a body, which means that type information was not available -// for expressions occurring in function signatures, as in the `foo` example -// below, leading to an ICE. - -// check-pass -// compile-flags: -Zunpretty=hir,typed -#![allow(dead_code)] -#[prelude_import] -use ::std::prelude::rust_2015::*; -#[macro_use] -extern crate std; - -fn main() ({ } as ()) - -fn foo((-(128 as i8) as i8)...(127 as i8): i8) ({ } as ()) diff --git a/tests/ui/unpretty/mir-unpretty.rs b/tests/ui/unpretty/mir-unpretty.rs new file mode 100644 index 00000000000..30620c69fea --- /dev/null +++ b/tests/ui/unpretty/mir-unpretty.rs @@ -0,0 +1,5 @@ +// compile-flags: -Z unpretty=mir + +fn main() { + let x: () = 0; //~ ERROR: mismatched types +} diff --git a/tests/ui/unpretty/mir-unpretty.stderr b/tests/ui/unpretty/mir-unpretty.stderr new file mode 100644 index 00000000000..3808f8583b8 --- /dev/null +++ b/tests/ui/unpretty/mir-unpretty.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/mir-unpretty.rs:4:17 + | +LL | let x: () = 0; + | -- ^ expected `()`, found integer + | | + | expected due to this + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/unpretty/unpretty-expr-fn-arg.rs b/tests/ui/unpretty/unpretty-expr-fn-arg.rs new file mode 100644 index 00000000000..6e1132a3372 --- /dev/null +++ b/tests/ui/unpretty/unpretty-expr-fn-arg.rs @@ -0,0 +1,13 @@ +// Regression test for the ICE described in #82328. The pretty-printer for +// `-Zunpretty=hir,typed` would previously retrieve type-checking results +// when entering a body, which means that type information was not available +// for expressions occurring in function signatures, as in the `foo` example +// below, leading to an ICE. + +// check-pass +// compile-flags: -Zunpretty=hir,typed +#![allow(dead_code)] + +fn main() {} + +fn foo(-128..=127: i8) {} diff --git a/tests/ui/unpretty/unpretty-expr-fn-arg.stdout b/tests/ui/unpretty/unpretty-expr-fn-arg.stdout new file mode 100644 index 00000000000..b745b988631 --- /dev/null +++ b/tests/ui/unpretty/unpretty-expr-fn-arg.stdout @@ -0,0 +1,17 @@ +// Regression test for the ICE described in #82328. The pretty-printer for +// `-Zunpretty=hir,typed` would previously retrieve type-checking results +// when entering a body, which means that type information was not available +// for expressions occurring in function signatures, as in the `foo` example +// below, leading to an ICE. + +// check-pass +// compile-flags: -Zunpretty=hir,typed +#![allow(dead_code)] +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; + +fn main() ({ } as ()) + +fn foo((-(128 as i8) as i8)...(127 as i8): i8) ({ } as ()) diff --git a/tests/ui/unsafe-fn-called-from-unsafe-blk.rs b/tests/ui/unsafe-fn-called-from-unsafe-blk.rs deleted file mode 100644 index 3713a7065f5..00000000000 --- a/tests/ui/unsafe-fn-called-from-unsafe-blk.rs +++ /dev/null @@ -1,18 +0,0 @@ -// run-pass - -#![allow(dead_code)] -// -// See also: ui/unsafe/unsafe-fn-called-from-safe.rs - -// pretty-expanded FIXME #23616 - -unsafe fn f() { return; } - -fn g() { - unsafe { - f(); - } -} - -pub fn main() { -} diff --git a/tests/ui/unsafe-fn-called-from-unsafe-fn.rs b/tests/ui/unsafe-fn-called-from-unsafe-fn.rs deleted file mode 100644 index 5e953107686..00000000000 --- a/tests/ui/unsafe-fn-called-from-unsafe-fn.rs +++ /dev/null @@ -1,17 +0,0 @@ -// run-pass - -#![allow(dead_code)] -// -// See also: ui/unsafe/unsafe-fn-called-from-safe.rs - -// pretty-expanded FIXME #23616 - -unsafe fn f() { return; } - -unsafe fn g() { - f(); -} - -pub fn main() { - return; -} diff --git a/tests/ui/unsafe-pointer-assignability.rs b/tests/ui/unsafe-pointer-assignability.rs deleted file mode 100644 index db822bb6a02..00000000000 --- a/tests/ui/unsafe-pointer-assignability.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass - -fn f(x: *const isize) { - unsafe { - assert_eq!(*x, 3); - } -} - -pub fn main() { - f(&3); -} diff --git a/tests/ui/unsafe/foreign-unsafe-fn-called.mir.stderr b/tests/ui/unsafe/foreign-unsafe-fn-called.mir.stderr new file mode 100644 index 00000000000..d3cf5d84fdd --- /dev/null +++ b/tests/ui/unsafe/foreign-unsafe-fn-called.mir.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/foreign-unsafe-fn-called.rs:11:5 + | +LL | test::free(); + | ^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/foreign-unsafe-fn-called.rs b/tests/ui/unsafe/foreign-unsafe-fn-called.rs new file mode 100644 index 00000000000..67302ea1bcd --- /dev/null +++ b/tests/ui/unsafe/foreign-unsafe-fn-called.rs @@ -0,0 +1,14 @@ +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + +mod test { + extern "C" { + pub fn free(); + } +} + +fn main() { + test::free(); + //[mir]~^ ERROR call to unsafe function is unsafe + //[thir]~^^ ERROR call to unsafe function `test::free` is unsafe +} diff --git a/tests/ui/unsafe/foreign-unsafe-fn-called.thir.stderr b/tests/ui/unsafe/foreign-unsafe-fn-called.thir.stderr new file mode 100644 index 00000000000..00ba0f7a6a3 --- /dev/null +++ b/tests/ui/unsafe/foreign-unsafe-fn-called.thir.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function `test::free` is unsafe and requires unsafe function or block + --> $DIR/foreign-unsafe-fn-called.rs:11:5 + | +LL | test::free(); + | ^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/new-unsafe-pointers.rs b/tests/ui/unsafe/new-unsafe-pointers.rs new file mode 100644 index 00000000000..d99eb4cbd1c --- /dev/null +++ b/tests/ui/unsafe/new-unsafe-pointers.rs @@ -0,0 +1,7 @@ +// run-pass +// pretty-expanded FIXME #23616 + +fn main() { + let _a: *const isize = 3 as *const isize; + let _a: *mut isize = 3 as *mut isize; +} diff --git a/tests/ui/unsafe/unsafe-fn-called-from-unsafe-blk.rs b/tests/ui/unsafe/unsafe-fn-called-from-unsafe-blk.rs new file mode 100644 index 00000000000..3713a7065f5 --- /dev/null +++ b/tests/ui/unsafe/unsafe-fn-called-from-unsafe-blk.rs @@ -0,0 +1,18 @@ +// run-pass + +#![allow(dead_code)] +// +// See also: ui/unsafe/unsafe-fn-called-from-safe.rs + +// pretty-expanded FIXME #23616 + +unsafe fn f() { return; } + +fn g() { + unsafe { + f(); + } +} + +pub fn main() { +} diff --git a/tests/ui/unsafe/unsafe-fn-called-from-unsafe-fn.rs b/tests/ui/unsafe/unsafe-fn-called-from-unsafe-fn.rs new file mode 100644 index 00000000000..5e953107686 --- /dev/null +++ b/tests/ui/unsafe/unsafe-fn-called-from-unsafe-fn.rs @@ -0,0 +1,17 @@ +// run-pass + +#![allow(dead_code)] +// +// See also: ui/unsafe/unsafe-fn-called-from-safe.rs + +// pretty-expanded FIXME #23616 + +unsafe fn f() { return; } + +unsafe fn g() { + f(); +} + +pub fn main() { + return; +} diff --git a/tests/ui/unsafe/unsafe-pointer-assignability.rs b/tests/ui/unsafe/unsafe-pointer-assignability.rs new file mode 100644 index 00000000000..db822bb6a02 --- /dev/null +++ b/tests/ui/unsafe/unsafe-pointer-assignability.rs @@ -0,0 +1,11 @@ +// run-pass + +fn f(x: *const isize) { + unsafe { + assert_eq!(*x, 3); + } +} + +pub fn main() { + f(&3); +} diff --git a/tests/ui/unterminated-comment.rs b/tests/ui/unterminated-comment.rs deleted file mode 100644 index 1cfdfb1fb45..00000000000 --- a/tests/ui/unterminated-comment.rs +++ /dev/null @@ -1 +0,0 @@ -/* //~ ERROR E0758 diff --git a/tests/ui/unterminated-comment.stderr b/tests/ui/unterminated-comment.stderr deleted file mode 100644 index c513fafeeb3..00000000000 --- a/tests/ui/unterminated-comment.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0758]: unterminated block comment - --> $DIR/unterminated-comment.rs:1:1 - | -LL | /* - | ^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0758`. diff --git a/tests/ui/unterminated-nested-comment.rs b/tests/ui/unterminated-nested-comment.rs deleted file mode 100644 index db5f2f3ba13..00000000000 --- a/tests/ui/unterminated-nested-comment.rs +++ /dev/null @@ -1,4 +0,0 @@ -/* //~ ERROR E0758 -/* */ -/* -*/ diff --git a/tests/ui/unterminated-nested-comment.stderr b/tests/ui/unterminated-nested-comment.stderr deleted file mode 100644 index 3653e76c9cb..00000000000 --- a/tests/ui/unterminated-nested-comment.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0758]: unterminated block comment - --> $DIR/unterminated-nested-comment.rs:1:1 - | -LL | /* - | ^- - | | - | _unterminated block comment - | | -LL | | /* */ -LL | | /* - | | -- - | | | - | | ...as last nested comment starts here, maybe you want to close this instead? -LL | | */ - | |_--^ - | | - | ...and last nested comment terminates here. - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0758`. diff --git a/tests/ui/unwind-unique.rs b/tests/ui/unwind-unique.rs deleted file mode 100644 index 50ecf751a86..00000000000 --- a/tests/ui/unwind-unique.rs +++ /dev/null @@ -1,15 +0,0 @@ -// run-pass -// needs-unwind -// ignore-emscripten no threads support - -use std::thread; - -fn f() { - let _a: Box<_> = Box::new(0); - panic!(); -} - -pub fn main() { - let t = thread::spawn(f); - drop(t.join()); -} diff --git a/tests/ui/variance-intersection-of-ref-and-opt-ref.rs b/tests/ui/variance-intersection-of-ref-and-opt-ref.rs deleted file mode 100644 index 74707a98d32..00000000000 --- a/tests/ui/variance-intersection-of-ref-and-opt-ref.rs +++ /dev/null @@ -1,25 +0,0 @@ -// run-pass -// Elaborated version of the opening example from RFC 738. This failed -// to compile before variance because invariance of `Option` prevented -// us from approximating the lifetimes of `field1` and `field2` to a -// common intersection. - -#![allow(dead_code)] - -struct List<'l> { - field1: &'l i32, - field2: Option<&'l i32>, -} - -fn foo(field1: &i32, field2: Option<&i32>) -> i32 { - let list = List { field1: field1, field2: field2 }; - *list.field1 + list.field2.cloned().unwrap_or(0) -} - -fn main() { - let x = 22; - let y = Some(3); - let z = None; - assert_eq!(foo(&x, y.as_ref()), 25); - assert_eq!(foo(&x, z.as_ref()), 22); -} diff --git a/tests/ui/variance-iterators-in-libcore.rs b/tests/ui/variance-iterators-in-libcore.rs deleted file mode 100644 index a542e44d517..00000000000 --- a/tests/ui/variance-iterators-in-libcore.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass - -#![allow(dead_code)] - -use std::iter::{Fuse, Zip}; - -fn fuse_covariant<'a, I>(iter: Fuse<&'static I>) -> Fuse<&'a I> { iter } -fn zip_covariant<'a, A, B>(iter: Zip<&'static A, &'static B>) -> Zip<&'a A, &'a B> { iter } - -fn main() { } diff --git a/tests/ui/variance/variance-intersection-of-ref-and-opt-ref.rs b/tests/ui/variance/variance-intersection-of-ref-and-opt-ref.rs new file mode 100644 index 00000000000..74707a98d32 --- /dev/null +++ b/tests/ui/variance/variance-intersection-of-ref-and-opt-ref.rs @@ -0,0 +1,25 @@ +// run-pass +// Elaborated version of the opening example from RFC 738. This failed +// to compile before variance because invariance of `Option` prevented +// us from approximating the lifetimes of `field1` and `field2` to a +// common intersection. + +#![allow(dead_code)] + +struct List<'l> { + field1: &'l i32, + field2: Option<&'l i32>, +} + +fn foo(field1: &i32, field2: Option<&i32>) -> i32 { + let list = List { field1: field1, field2: field2 }; + *list.field1 + list.field2.cloned().unwrap_or(0) +} + +fn main() { + let x = 22; + let y = Some(3); + let z = None; + assert_eq!(foo(&x, y.as_ref()), 25); + assert_eq!(foo(&x, z.as_ref()), 22); +} diff --git a/tests/ui/variance/variance-iterators-in-libcore.rs b/tests/ui/variance/variance-iterators-in-libcore.rs new file mode 100644 index 00000000000..a542e44d517 --- /dev/null +++ b/tests/ui/variance/variance-iterators-in-libcore.rs @@ -0,0 +1,10 @@ +// run-pass + +#![allow(dead_code)] + +use std::iter::{Fuse, Zip}; + +fn fuse_covariant<'a, I>(iter: Fuse<&'static I>) -> Fuse<&'a I> { iter } +fn zip_covariant<'a, A, B>(iter: Zip<&'static A, &'static B>) -> Zip<&'a A, &'a B> { iter } + +fn main() { } diff --git a/tests/ui/wasm-custom-section-relocations.rs b/tests/ui/wasm-custom-section-relocations.rs deleted file mode 100644 index c3cca3a35ac..00000000000 --- a/tests/ui/wasm-custom-section-relocations.rs +++ /dev/null @@ -1,15 +0,0 @@ -// only-wasm32 - -#[link_section = "test"] -pub static A: &[u8] = &[1]; //~ ERROR: no extra levels of indirection - -#[link_section = "test"] -pub static B: [u8; 3] = [1, 2, 3]; - -#[link_section = "test"] -pub static C: usize = 3; - -#[link_section = "test"] -pub static D: &usize = &C; //~ ERROR: no extra levels of indirection - -fn main() {} diff --git a/tests/ui/wasm-custom-section-relocations.stderr b/tests/ui/wasm-custom-section-relocations.stderr deleted file mode 100644 index a37edc51d19..00000000000 --- a/tests/ui/wasm-custom-section-relocations.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: statics with a custom `#[link_section]` must be a simple list of bytes on the wasm target with no extra levels of indirection such as references - --> $DIR/wasm-custom-section-relocations.rs:4:1 - | -LL | pub static A: &[u8] = &[1]; - | ^^^^^^^^^^^^^^^^^^^ - -error: statics with a custom `#[link_section]` must be a simple list of bytes on the wasm target with no extra levels of indirection such as references - --> $DIR/wasm-custom-section-relocations.rs:13:1 - | -LL | pub static D: &usize = &C; - | ^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - diff --git a/tests/ui/wasm/wasm-custom-section-relocations.rs b/tests/ui/wasm/wasm-custom-section-relocations.rs new file mode 100644 index 00000000000..c3cca3a35ac --- /dev/null +++ b/tests/ui/wasm/wasm-custom-section-relocations.rs @@ -0,0 +1,15 @@ +// only-wasm32 + +#[link_section = "test"] +pub static A: &[u8] = &[1]; //~ ERROR: no extra levels of indirection + +#[link_section = "test"] +pub static B: [u8; 3] = [1, 2, 3]; + +#[link_section = "test"] +pub static C: usize = 3; + +#[link_section = "test"] +pub static D: &usize = &C; //~ ERROR: no extra levels of indirection + +fn main() {} diff --git a/tests/ui/wasm/wasm-custom-section-relocations.stderr b/tests/ui/wasm/wasm-custom-section-relocations.stderr new file mode 100644 index 00000000000..a37edc51d19 --- /dev/null +++ b/tests/ui/wasm/wasm-custom-section-relocations.stderr @@ -0,0 +1,14 @@ +error: statics with a custom `#[link_section]` must be a simple list of bytes on the wasm target with no extra levels of indirection such as references + --> $DIR/wasm-custom-section-relocations.rs:4:1 + | +LL | pub static A: &[u8] = &[1]; + | ^^^^^^^^^^^^^^^^^^^ + +error: statics with a custom `#[link_section]` must be a simple list of bytes on the wasm target with no extra levels of indirection such as references + --> $DIR/wasm-custom-section-relocations.rs:13:1 + | +LL | pub static D: &usize = &C; + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/while-type-error.rs b/tests/ui/while-type-error.rs deleted file mode 100644 index 8098bfcd8d9..00000000000 --- a/tests/ui/while-type-error.rs +++ /dev/null @@ -1,3 +0,0 @@ -// error-pattern: mismatched types - -fn main() { while main { } } diff --git a/tests/ui/while-type-error.stderr b/tests/ui/while-type-error.stderr deleted file mode 100644 index 529cbff0563..00000000000 --- a/tests/ui/while-type-error.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/while-type-error.rs:3:19 - | -LL | fn main() { while main { } } - | ^^^^ expected `bool`, found fn item - | - = note: expected type `bool` - found fn item `fn() {main}` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/wrong-mul-method-signature.rs b/tests/ui/wrong-mul-method-signature.rs deleted file mode 100644 index 1c2f865599e..00000000000 --- a/tests/ui/wrong-mul-method-signature.rs +++ /dev/null @@ -1,68 +0,0 @@ -// This test is to make sure we don't just ICE if the trait -// method for an operator is not implemented properly. -// (In this case the mul method should take &f64 and not f64) -// See: #11450 - -use std::ops::Mul; - -struct Vec1 { - x: f64 -} - -// Expecting value in input signature -impl Mul for Vec1 { - type Output = Vec1; - - fn mul(self, s: &f64) -> Vec1 { - //~^ ERROR method `mul` has an incompatible type for trait - Vec1 { - x: self.x * *s - } - } -} - -struct Vec2 { - x: f64, - y: f64 -} - -// Wrong type parameter ordering -impl Mul for Vec2 { - type Output = f64; - - fn mul(self, s: f64) -> Vec2 { - //~^ ERROR method `mul` has an incompatible type for trait - Vec2 { - x: self.x * s, - y: self.y * s - } - } -} - -struct Vec3 { - x: f64, - y: f64, - z: f64 -} - -// Unexpected return type -impl Mul for Vec3 { - type Output = i32; - - fn mul(self, s: f64) -> f64 { - //~^ ERROR method `mul` has an incompatible type for trait - s - } -} - -pub fn main() { - // Check that the usage goes from the trait declaration: - - let x: Vec1 = Vec1 { x: 1.0 } * 2.0; // this is OK - - let x: Vec2 = Vec2 { x: 1.0, y: 2.0 } * 2.0; // trait had reversed order - //~^ ERROR mismatched types - //~| ERROR mismatched types - - let x: i32 = Vec3 { x: 1.0, y: 2.0, z: 3.0 } * 2.0; -} diff --git a/tests/ui/wrong-mul-method-signature.stderr b/tests/ui/wrong-mul-method-signature.stderr deleted file mode 100644 index 25a92f5ec12..00000000000 --- a/tests/ui/wrong-mul-method-signature.stderr +++ /dev/null @@ -1,56 +0,0 @@ -error[E0053]: method `mul` has an incompatible type for trait - --> $DIR/wrong-mul-method-signature.rs:16:21 - | -LL | fn mul(self, s: &f64) -> Vec1 { - | ^^^^ - | | - | expected `f64`, found `&f64` - | help: change the parameter type to match the trait: `f64` - | - = note: expected signature `fn(Vec1, f64) -> Vec1` - found signature `fn(Vec1, &f64) -> Vec1` - -error[E0053]: method `mul` has an incompatible type for trait - --> $DIR/wrong-mul-method-signature.rs:33:21 - | -LL | fn mul(self, s: f64) -> Vec2 { - | ^^^ - | | - | expected `Vec2`, found `f64` - | help: change the parameter type to match the trait: `Vec2` - | - = note: expected signature `fn(Vec2, Vec2) -> f64` - found signature `fn(Vec2, f64) -> Vec2` - -error[E0053]: method `mul` has an incompatible type for trait - --> $DIR/wrong-mul-method-signature.rs:52:29 - | -LL | fn mul(self, s: f64) -> f64 { - | ^^^ - | | - | expected `i32`, found `f64` - | help: change the output type to match the trait: `i32` - | - = note: expected signature `fn(Vec3, _) -> i32` - found signature `fn(Vec3, _) -> f64` - -error[E0308]: mismatched types - --> $DIR/wrong-mul-method-signature.rs:63:45 - | -LL | let x: Vec2 = Vec2 { x: 1.0, y: 2.0 } * 2.0; // trait had reversed order - | ----------------------- ^^^ expected `Vec2`, found floating-point number - | | - | expected because this is `Vec2` - -error[E0308]: mismatched types - --> $DIR/wrong-mul-method-signature.rs:63:19 - | -LL | let x: Vec2 = Vec2 { x: 1.0, y: 2.0 } * 2.0; // trait had reversed order - | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Vec2`, found `f64` - | | - | expected due to this - -error: aborting due to 5 previous errors - -Some errors have detailed explanations: E0053, E0308. -For more information about an error, try `rustc --explain E0053`. diff --git a/tests/ui/wrong-ret-type.rs b/tests/ui/wrong-ret-type.rs deleted file mode 100644 index cbff8dbae21..00000000000 --- a/tests/ui/wrong-ret-type.rs +++ /dev/null @@ -1,3 +0,0 @@ -// error-pattern: mismatched types -fn mk_int() -> usize { let i: isize = 3; return i; } -fn main() { } diff --git a/tests/ui/wrong-ret-type.stderr b/tests/ui/wrong-ret-type.stderr deleted file mode 100644 index c686a0b2f5a..00000000000 --- a/tests/ui/wrong-ret-type.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/wrong-ret-type.rs:2:49 - | -LL | fn mk_int() -> usize { let i: isize = 3; return i; } - | ----- ^ expected `usize`, found `isize` - | | - | expected `usize` because of return type - | -help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit - | -LL | fn mk_int() -> usize { let i: isize = 3; return i.try_into().unwrap(); } - | ++++++++++++++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/xc-private-method.rs b/tests/ui/xc-private-method.rs deleted file mode 100644 index f05994646b3..00000000000 --- a/tests/ui/xc-private-method.rs +++ /dev/null @@ -1,11 +0,0 @@ -// aux-build:xc-private-method-lib.rs - -extern crate xc_private_method_lib; - -fn main() { - let _ = xc_private_method_lib::Struct::static_meth_struct(); - //~^ ERROR: associated function `static_meth_struct` is private - - let _ = xc_private_method_lib::Enum::static_meth_enum(); - //~^ ERROR: associated function `static_meth_enum` is private -} diff --git a/tests/ui/xc-private-method.stderr b/tests/ui/xc-private-method.stderr deleted file mode 100644 index 0eabc592aa4..00000000000 --- a/tests/ui/xc-private-method.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0624]: associated function `static_meth_struct` is private - --> $DIR/xc-private-method.rs:6:44 - | -LL | let _ = xc_private_method_lib::Struct::static_meth_struct(); - | ^^^^^^^^^^^^^^^^^^ private associated function - | - ::: $DIR/auxiliary/xc-private-method-lib.rs:8:5 - | -LL | fn static_meth_struct() -> Struct { - | --------------------------------- private associated function defined here - -error[E0624]: associated function `static_meth_enum` is private - --> $DIR/xc-private-method.rs:9:42 - | -LL | let _ = xc_private_method_lib::Enum::static_meth_enum(); - | ^^^^^^^^^^^^^^^^ private associated function - | - ::: $DIR/auxiliary/xc-private-method-lib.rs:23:5 - | -LL | fn static_meth_enum() -> Enum { - | ----------------------------- private associated function defined here - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0624`. diff --git a/tests/ui/xc-private-method2.rs b/tests/ui/xc-private-method2.rs deleted file mode 100644 index f11b251082b..00000000000 --- a/tests/ui/xc-private-method2.rs +++ /dev/null @@ -1,11 +0,0 @@ -// aux-build:xc-private-method-lib.rs - -extern crate xc_private_method_lib; - -fn main() { - let _ = xc_private_method_lib::Struct{ x: 10 }.meth_struct(); - //~^ ERROR method `meth_struct` is private - - let _ = xc_private_method_lib::Enum::Variant1(20).meth_enum(); - //~^ ERROR method `meth_enum` is private -} diff --git a/tests/ui/xc-private-method2.stderr b/tests/ui/xc-private-method2.stderr deleted file mode 100644 index af0c3cfcb2c..00000000000 --- a/tests/ui/xc-private-method2.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0624]: method `meth_struct` is private - --> $DIR/xc-private-method2.rs:6:52 - | -LL | let _ = xc_private_method_lib::Struct{ x: 10 }.meth_struct(); - | ^^^^^^^^^^^ private method - | - ::: $DIR/auxiliary/xc-private-method-lib.rs:12:5 - | -LL | fn meth_struct(&self) -> isize { - | ------------------------------ private method defined here - -error[E0624]: method `meth_enum` is private - --> $DIR/xc-private-method2.rs:9:55 - | -LL | let _ = xc_private_method_lib::Enum::Variant1(20).meth_enum(); - | ^^^^^^^^^ private method - | - ::: $DIR/auxiliary/xc-private-method-lib.rs:27:5 - | -LL | fn meth_enum(&self) -> isize { - | ---------------------------- private method defined here - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0624`. -- cgit 1.4.1-3-g733a5