1
Fork 0

Implement a explicit_generic_args_with_impl_trait feature gate

When this gate is enabled, explicit generic arguments can be specified even
if `impl Trait` is used in argument position. Generic arguments can only be
specified for explicit generic parameters but not for the synthetic type
parameters from  `impl Trait`
This commit is contained in:
Gary Guo 2021-06-09 20:56:41 +01:00
parent 337181e07d
commit 9b90e7e980
10 changed files with 139 additions and 4 deletions

View file

@ -769,7 +769,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
// (#83606): Do not emit a suggestion if the parent has an `impl Trait`
// as an argument otherwise it will cause the E0282 error.
if !has_impl_trait {
if !has_impl_trait || self.tcx.features().explicit_generic_args_with_impl_trait {
err.span_suggestion_verbose(
span,
"consider specifying the const argument",