about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorNick Cameron <nrc@ncameron.org>2022-05-09 15:14:43 +0100
committerNick Cameron <nrc@ncameron.org>2022-06-06 12:21:49 +0100
commit640a46138839dbb5d9bf8df0e8b9cbec1d8e5ded (patch)
tree282ba19f552fc560473f4e940e664826af212ce2 /compiler
parent12872b6807dbfca49e903ba13e375b960e0bdd4d (diff)
downloadrust-640a46138839dbb5d9bf8df0e8b9cbec1d8e5ded.tar.gz
rust-640a46138839dbb5d9bf8df0e8b9cbec1d8e5ded.zip
Deactivate feature gate explicit_generic_args_with_impl_trait
Signed-off-by: Nick Cameron <nrc@ncameron.org>
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0632.md4
-rw-r--r--compiler/rustc_error_messages/locales/en-US/typeck.ftl6
-rw-r--r--compiler/rustc_feature/src/accepted.rs2
-rw-r--r--compiler/rustc_feature/src/active.rs2
-rw-r--r--compiler/rustc_typeck/src/astconv/generics.rs70
-rw-r--r--compiler/rustc_typeck/src/errors.rs11
6 files changed, 23 insertions, 72 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0632.md b/compiler/rustc_error_codes/src/error_codes/E0632.md
index 40840e894d6..7e0a5c71f5f 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0632.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0632.md
@@ -1,9 +1,11 @@
+#### Note: this error code is no longer emitted by the compiler.
+
 An explicit generic argument was provided when calling a function that
 uses `impl Trait` in argument position.
 
 Erroneous code example:
 
-```compile_fail,E0632
+```ignore (no longer an error)
 fn foo<T: Copy>(a: T, b: impl Clone) {}
 
 foo::<i32>(0i32, "abc".to_string());
diff --git a/compiler/rustc_error_messages/locales/en-US/typeck.ftl b/compiler/rustc_error_messages/locales/en-US/typeck.ftl
index 95b348ec613..c61735a57e1 100644
--- a/compiler/rustc_error_messages/locales/en-US/typeck.ftl
+++ b/compiler/rustc_error_messages/locales/en-US/typeck.ftl
@@ -95,12 +95,6 @@ typeck-expected-return-type = expected `{$expected}` because of return type
 typeck-unconstrained-opaque-type = unconstrained opaque type
     .note = `{$name}` must be used in combination with a concrete type within the same module
 
-typeck-explicit-generic-args-with-impl-trait =
-    cannot provide explicit generic arguments when `impl Trait` is used in argument position
-    .label = explicit generic argument not allowed
-    .note = see issue #83701 <https://github.com/rust-lang/rust/issues/83701> for more information
-    .help = add `#![feature(explicit_generic_args_with_impl_trait)]` to the crate attributes to enable
-
 typeck-missing-type-params =
     the type {$parameterCount ->
         [one] parameter
diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs
index 048039343a7..6bff2a1365b 100644
--- a/compiler/rustc_feature/src/accepted.rs
+++ b/compiler/rustc_feature/src/accepted.rs
@@ -142,6 +142,8 @@ declare_features! (
     (accepted, dyn_trait, "1.27.0", Some(44662), None),
     /// Allows integer match exhaustiveness checking (RFC 2591).
     (accepted, exhaustive_integer_patterns, "1.33.0", Some(50907), None),
+    /// Allows explicit generic arguments specification with `impl Trait` present.
+    (accepted, explicit_generic_args_with_impl_trait, "1.63.0", Some(83701), None),
     /// Allows arbitrary expressions in key-value attributes at parse time.
     (accepted, extended_key_value_attributes, "1.54.0", Some(78835), None),
     /// Allows resolving absolute paths as paths from other crates.
diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs
index 1466e8dfc92..ad15d4bb842 100644
--- a/compiler/rustc_feature/src/active.rs
+++ b/compiler/rustc_feature/src/active.rs
@@ -383,8 +383,6 @@ declare_features! (
     (active, exclusive_range_pattern, "1.11.0", Some(37854), None),
     /// Allows exhaustive pattern matching on types that contain uninhabited types.
     (active, exhaustive_patterns, "1.13.0", Some(51085), None),
-    /// Allows explicit generic arguments specification with `impl Trait` present.
-    (active, explicit_generic_args_with_impl_trait, "1.56.0", Some(83701), None),
     /// Allows defining `extern type`s.
     (active, extern_types, "1.23.0", Some(43467), None),
     /// Allows the use of `#[ffi_const]` on foreign functions.
diff --git a/compiler/rustc_typeck/src/astconv/generics.rs b/compiler/rustc_typeck/src/astconv/generics.rs
index dc4bc8fb55a..3fe4b5b46e0 100644
--- a/compiler/rustc_typeck/src/astconv/generics.rs
+++ b/compiler/rustc_typeck/src/astconv/generics.rs
@@ -3,7 +3,7 @@ use crate::astconv::{
     AstConv, CreateSubstsForGenericArgsCtxt, ExplicitLateBound, GenericArgCountMismatch,
     GenericArgCountResult, GenericArgPosition,
 };
-use crate::errors::{AssocTypeBindingNotAllowed, ExplicitGenericArgsWithImplTrait};
+use crate::errors::AssocTypeBindingNotAllowed;
 use crate::structured_errors::{GenericArgsInfo, StructuredDiagnostic, WrongNumberOfGenericArgs};
 use rustc_ast::ast::ParamKindOrd;
 use rustc_errors::{struct_span_err, Applicability, Diagnostic, MultiSpan};
@@ -397,8 +397,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
         is_method_call: IsMethodCall,
     ) -> GenericArgCountResult {
         let empty_args = hir::GenericArgs::none();
-        let suppress_mismatch = Self::check_impl_trait(tcx, seg, generics);
-
         let gen_args = seg.args.unwrap_or(&empty_args);
         let gen_pos = if is_method_call == IsMethodCall::Yes {
             GenericArgPosition::MethodCall
@@ -406,10 +404,17 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
             GenericArgPosition::Value
         };
         let has_self = generics.parent.is_none() && generics.has_self;
-        let infer_args = seg.infer_args || suppress_mismatch;
 
         Self::check_generic_arg_count(
-            tcx, span, def_id, seg, generics, gen_args, gen_pos, has_self, infer_args,
+            tcx,
+            span,
+            def_id,
+            seg,
+            generics,
+            gen_args,
+            gen_pos,
+            has_self,
+            seg.infer_args,
         )
     }
 
@@ -431,19 +436,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
         let param_counts = gen_params.own_counts();
 
         // Subtracting from param count to ensure type params synthesized from `impl Trait`
-        // cannot be explicitly specified even with `explicit_generic_args_with_impl_trait`
-        // feature enabled.
-        let synth_type_param_count = if tcx.features().explicit_generic_args_with_impl_trait {
-            gen_params
-                .params
-                .iter()
-                .filter(|param| {
-                    matches!(param.kind, ty::GenericParamDefKind::Type { synthetic: true, .. })
-                })
-                .count()
-        } else {
-            0
-        };
+        // cannot be explicitly specified.
+        let synth_type_param_count = gen_params
+            .params
+            .iter()
+            .filter(|param| {
+                matches!(param.kind, ty::GenericParamDefKind::Type { synthetic: true, .. })
+            })
+            .count();
         let named_type_param_count =
             param_counts.types - has_self as usize - synth_type_param_count;
         let infer_lifetimes =
@@ -611,40 +611,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
         }
     }
 
-    /// Report error if there is an explicit type parameter when using `impl Trait`.
-    pub(crate) fn check_impl_trait(
-        tcx: TyCtxt<'_>,
-        seg: &hir::PathSegment<'_>,
-        generics: &ty::Generics,
-    ) -> bool {
-        if seg.infer_args || tcx.features().explicit_generic_args_with_impl_trait {
-            return false;
-        }
-
-        let impl_trait = generics.has_impl_trait();
-
-        if impl_trait {
-            let spans = seg
-                .args()
-                .args
-                .iter()
-                .filter_map(|arg| match arg {
-                    GenericArg::Infer(_) | GenericArg::Type(_) | GenericArg::Const(_) => {
-                        Some(arg.span())
-                    }
-                    _ => None,
-                })
-                .collect::<Vec<_>>();
-
-            tcx.sess.emit_err(ExplicitGenericArgsWithImplTrait {
-                spans,
-                is_nightly_build: tcx.sess.is_nightly_build().then_some(()),
-            });
-        }
-
-        impl_trait
-    }
-
     /// Emits an error regarding forbidden type binding associations
     pub fn prohibit_assoc_ty_binding(tcx: TyCtxt<'_>, span: Span) {
         tcx.sess.emit_err(AssocTypeBindingNotAllowed { span });
diff --git a/compiler/rustc_typeck/src/errors.rs b/compiler/rustc_typeck/src/errors.rs
index a7f736fed14..67a3d4a4d02 100644
--- a/compiler/rustc_typeck/src/errors.rs
+++ b/compiler/rustc_typeck/src/errors.rs
@@ -241,17 +241,6 @@ pub struct UnconstrainedOpaqueType {
     pub name: Symbol,
 }
 
-#[derive(SessionDiagnostic)]
-#[error(code = "E0632", slug = "typeck-explicit-generic-args-with-impl-trait")]
-#[note]
-pub struct ExplicitGenericArgsWithImplTrait {
-    #[primary_span]
-    #[label]
-    pub spans: Vec<Span>,
-    #[help]
-    pub is_nightly_build: Option<()>,
-}
-
 pub struct MissingTypeParams {
     pub span: Span,
     pub def_span: Span,