about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2021-07-14 16:55:31 -0300
committerSantiago Pastorino <spastorino@gmail.com>2021-07-18 09:30:09 -0300
commit962ac8183d174d409db549cd6b502d847aa04f12 (patch)
treeaa4a8b82e98ec89c7ab743c09cc6e0383b3df6a1
parent4d2d90307d7a7ac70a2cd4545dbe917f79eb9dff (diff)
downloadrust-962ac8183d174d409db549cd6b502d847aa04f12.tar.gz
rust-962ac8183d174d409db549cd6b502d847aa04f12.zip
Remove impl_trait_in_bindings handling on inference error reporting
-rw-r--r--compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs7
-rw-r--r--src/test/ui/impl-trait/bindings.stderr77
-rw-r--r--src/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings.rs17
-rw-r--r--src/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings.stderr21
4 files changed, 2 insertions, 120 deletions
diff --git a/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs b/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs
index d9a1193aac4..9a718102cf1 100644
--- a/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs
+++ b/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs
@@ -491,11 +491,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
             span
         };
 
-        let is_named_and_not_impl_trait = |ty: Ty<'_>| {
-            &ty.to_string() != "_" &&
-                // FIXME: Remove this check after `impl_trait_in_bindings` is stabilized. #63527
-                (!ty.is_impl_trait() || self.tcx.features().impl_trait_in_bindings)
-        };
+        let is_named_and_not_impl_trait =
+            |ty: Ty<'_>| &ty.to_string() != "_" && !ty.is_impl_trait();
 
         let ty_msg = match (local_visitor.found_node_ty, local_visitor.found_exact_method_call) {
             (_, Some(_)) => String::new(),
diff --git a/src/test/ui/impl-trait/bindings.stderr b/src/test/ui/impl-trait/bindings.stderr
deleted file mode 100644
index 05f3f2e0d3e..00000000000
--- a/src/test/ui/impl-trait/bindings.stderr
+++ /dev/null
@@ -1,77 +0,0 @@
-error[E0435]: attempt to use a non-constant value in a constant
-  --> $DIR/bindings.rs:5:29
-   |
-LL |     const foo: impl Clone = x;
-   |     ---------               ^ non-constant value
-   |     |
-   |     help: consider using `let` instead of `const`: `let foo`
-
-error[E0435]: attempt to use a non-constant value in a constant
-  --> $DIR/bindings.rs:11:33
-   |
-LL |         const foo: impl Clone = x;
-   |         ---------               ^ non-constant value
-   |         |
-   |         help: consider using `let` instead of `const`: `let foo`
-
-error[E0435]: attempt to use a non-constant value in a constant
-  --> $DIR/bindings.rs:18:33
-   |
-LL |         const foo: impl Clone = x;
-   |         ---------               ^ non-constant value
-   |         |
-   |         help: consider using `let` instead of `const`: `let foo`
-
-error[E0435]: attempt to use a non-constant value in a constant
-  --> $DIR/bindings.rs:25:33
-   |
-LL |         const foo: impl Clone = x;
-   |         ---------               ^ non-constant value
-   |         |
-   |         help: consider using `let` instead of `const`: `let foo`
-
-error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
-  --> $DIR/bindings.rs:5:16
-   |
-LL |     const foo: impl Clone = x;
-   |                ^^^^^^^^^^
-   |
-   = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
-
-error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
-  --> $DIR/bindings.rs:11:20
-   |
-LL |         const foo: impl Clone = x;
-   |                    ^^^^^^^^^^
-   |
-   = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
-
-error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
-  --> $DIR/bindings.rs:18:20
-   |
-LL |         const foo: impl Clone = x;
-   |                    ^^^^^^^^^^
-   |
-   = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
-
-error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
-  --> $DIR/bindings.rs:25:20
-   |
-LL |         const foo: impl Clone = x;
-   |                    ^^^^^^^^^^
-   |
-   = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
-
-warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
-  --> $DIR/bindings.rs:1:12
-   |
-LL | #![feature(impl_trait_in_bindings)]
-   |            ^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: `#[warn(incomplete_features)]` on by default
-   = note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
-
-error: aborting due to 8 previous errors; 1 warning emitted
-
-Some errors have detailed explanations: E0435, E0562.
-For more information about an error, try `rustc --explain E0435`.
diff --git a/src/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings.rs b/src/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings.rs
deleted file mode 100644
index 7beb2db3969..00000000000
--- a/src/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-// edition:2018
-#![feature(impl_trait_in_bindings)]
-//~^ WARN the feature `impl_trait_in_bindings` is incomplete
-
-use std::io::Error;
-
-fn make_unit() -> Result<(), Error> {
-    Ok(())
-}
-
-fn main() {
-    let fut = async {
-        make_unit()?;
-
-        Ok(()) //~ ERROR type annotations needed
-    };
-}
diff --git a/src/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings.stderr b/src/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings.stderr
deleted file mode 100644
index 8e632fbc1de..00000000000
--- a/src/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
-  --> $DIR/cannot-infer-async-enabled-impl-trait-bindings.rs:2:12
-   |
-LL | #![feature(impl_trait_in_bindings)]
-   |            ^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: `#[warn(incomplete_features)]` on by default
-   = note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
-
-error[E0282]: type annotations needed for `impl Future`
-  --> $DIR/cannot-infer-async-enabled-impl-trait-bindings.rs:15:9
-   |
-LL |     let fut = async {
-   |         --- consider giving `fut` the explicit type `impl Future`, where the type parameter `E` is specified
-...
-LL |         Ok(())
-   |         ^^ cannot infer type for type parameter `E` declared on the enum `Result`
-
-error: aborting due to previous error; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0282`.