@@ -44,8 +44,7 @@ use crate::hir::def::{Namespace, Res, DefKind, PartialRes, PerNS};
44
44
use crate :: hir:: { GenericArg , ConstArg } ;
45
45
use crate :: hir:: ptr:: P ;
46
46
use crate :: lint;
47
- use crate :: lint:: builtin:: { self , PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES ,
48
- ELIDED_LIFETIMES_IN_PATHS } ;
47
+ use crate :: lint:: builtin:: { self , ELIDED_LIFETIMES_IN_PATHS } ;
49
48
use crate :: middle:: cstore:: CrateStore ;
50
49
use crate :: session:: Session ;
51
50
use crate :: session:: config:: nightly_options;
@@ -298,7 +297,6 @@ enum ParamMode {
298
297
299
298
enum ParenthesizedGenericArgs {
300
299
Ok ,
301
- Warn ,
302
300
Err ,
303
301
}
304
302
@@ -1695,29 +1693,19 @@ impl<'a> LoweringContext<'a> {
1695
1693
} ;
1696
1694
let parenthesized_generic_args = match partial_res. base_res ( ) {
1697
1695
// `a::b::Trait(Args)`
1698
- Res :: Def ( DefKind :: Trait , _)
1699
- if i + 1 == proj_start => ParenthesizedGenericArgs :: Ok ,
1696
+ Res :: Def ( DefKind :: Trait , _) if i + 1 == proj_start => {
1697
+ ParenthesizedGenericArgs :: Ok
1698
+ }
1700
1699
// `a::b::Trait(Args)::TraitItem`
1701
- Res :: Def ( DefKind :: Method , _)
1702
- | Res :: Def ( DefKind :: AssocConst , _)
1703
- | Res :: Def ( DefKind :: AssocTy , _)
1704
- if i + 2 == proj_start =>
1705
- {
1700
+ Res :: Def ( DefKind :: Method , _) |
1701
+ Res :: Def ( DefKind :: AssocConst , _) |
1702
+ Res :: Def ( DefKind :: AssocTy , _) if i + 2 == proj_start => {
1706
1703
ParenthesizedGenericArgs :: Ok
1707
1704
}
1708
1705
// Avoid duplicated errors.
1709
1706
Res :: Err => ParenthesizedGenericArgs :: Ok ,
1710
1707
// An error
1711
- Res :: Def ( DefKind :: Struct , _)
1712
- | Res :: Def ( DefKind :: Enum , _)
1713
- | Res :: Def ( DefKind :: Union , _)
1714
- | Res :: Def ( DefKind :: TyAlias , _)
1715
- | Res :: Def ( DefKind :: Variant , _) if i + 1 == proj_start =>
1716
- {
1717
- ParenthesizedGenericArgs :: Err
1718
- }
1719
- // A warning for now, for compatibility reasons.
1720
- _ => ParenthesizedGenericArgs :: Warn ,
1708
+ _ => ParenthesizedGenericArgs :: Err ,
1721
1709
} ;
1722
1710
1723
1711
let num_lifetimes = type_def_id. map_or ( 0 , |def_id| {
@@ -1780,7 +1768,7 @@ impl<'a> LoweringContext<'a> {
1780
1768
segment,
1781
1769
param_mode,
1782
1770
0 ,
1783
- ParenthesizedGenericArgs :: Warn ,
1771
+ ParenthesizedGenericArgs :: Err ,
1784
1772
itctx. reborrow ( ) ,
1785
1773
None ,
1786
1774
) ) ;
@@ -1856,15 +1844,6 @@ impl<'a> LoweringContext<'a> {
1856
1844
}
1857
1845
GenericArgs :: Parenthesized ( ref data) => match parenthesized_generic_args {
1858
1846
ParenthesizedGenericArgs :: Ok => self . lower_parenthesized_parameter_data ( data) ,
1859
- ParenthesizedGenericArgs :: Warn => {
1860
- self . resolver . lint_buffer ( ) . buffer_lint (
1861
- PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES ,
1862
- CRATE_NODE_ID ,
1863
- data. span ,
1864
- msg. into ( ) ,
1865
- ) ;
1866
- ( hir:: GenericArgs :: none ( ) , true )
1867
- }
1868
1847
ParenthesizedGenericArgs :: Err => {
1869
1848
let mut err = struct_span_err ! ( self . sess, data. span, E0214 , "{}" , msg) ;
1870
1849
err. span_label ( data. span , "only `Fn` traits may use parentheses" ) ;
0 commit comments