@@ -5,7 +5,7 @@ use crate::maybe_whole;
55
66use rustc_error_codes:: * ;
77use rustc_errors:: { struct_span_err, Applicability , DiagnosticBuilder , PResult , StashKey } ;
8- use rustc_span:: source_map:: { self , respan, Span , Spanned } ;
8+ use rustc_span:: source_map:: { self , respan, Span } ;
99use rustc_span:: symbol:: { kw, sym, Symbol } ;
1010use rustc_span:: BytePos ;
1111use syntax:: ast:: { self , AttrKind , AttrStyle , AttrVec , Attribute , Ident , DUMMY_NODE_ID } ;
@@ -566,9 +566,9 @@ impl<'a> Parser<'a> {
566566 let constness = if self . eat_keyword ( kw:: Const ) {
567567 let span = self . prev_span ;
568568 self . sess . gated_spans . gate ( sym:: const_trait_impl, span) ;
569- Some ( respan ( span , Constness :: Const ) )
569+ Constness :: Const
570570 } else {
571- None
571+ Constness :: NotConst
572572 } ;
573573
574574 // Disambiguate `impl !Trait for Type { ... }` and `impl ! { ... }` for the never type.
@@ -631,8 +631,7 @@ impl<'a> Parser<'a> {
631631 err_path ( ty_first. span )
632632 }
633633 } ;
634- let constness = constness. map ( |c| c. node ) ;
635- let trait_ref = TraitRef { path, constness, ref_id : ty_first. id } ;
634+ let trait_ref = TraitRef { path, ref_id : ty_first. id } ;
636635
637636 ItemKind :: Impl {
638637 unsafety,
@@ -646,13 +645,6 @@ impl<'a> Parser<'a> {
646645 }
647646 }
648647 None => {
649- // Reject `impl const Type {}` here
650- if let Some ( Spanned { node : Constness :: Const , span } ) = constness {
651- self . struct_span_err ( span, "`const` cannot modify an inherent impl" )
652- . help ( "only a trait impl can be `const`" )
653- . emit ( ) ;
654- }
655-
656648 // impl Type
657649 ItemKind :: Impl {
658650 unsafety,
0 commit comments