@@ -1120,6 +1120,7 @@ impl<'a> Parser<'a> {
11201120 || self . check ( exp ! ( OpenParen ) )
11211121 || self . can_begin_maybe_const_bound ( )
11221122 || self . check_keyword ( exp ! ( Const ) )
1123+ || self . check_keyword ( exp ! ( Only ) )
11231124 || self . check_keyword ( exp ! ( Async ) )
11241125 || self . check_keyword ( exp ! ( Use ) )
11251126 }
@@ -1201,7 +1202,9 @@ impl<'a> Parser<'a> {
12011202
12021203 match polarity {
12031204 BoundPolarity :: Positive => { }
1204- BoundPolarity :: Negative ( span) | BoundPolarity :: Maybe ( span) => {
1205+ BoundPolarity :: Negative ( span)
1206+ | BoundPolarity :: Maybe ( span)
1207+ | BoundPolarity :: Only ( span) => {
12051208 return self
12061209 . dcx ( )
12071210 . emit_err ( errors:: ModifierLifetime { span, modifier : polarity. as_str ( ) } ) ;
@@ -1265,6 +1268,8 @@ impl<'a> Parser<'a> {
12651268 } else if self . eat ( exp ! ( Bang ) ) {
12661269 self . psess . gated_spans . gate ( sym:: negative_bounds, self . prev_token . span ) ;
12671270 BoundPolarity :: Negative ( self . prev_token . span )
1271+ } else if self . eat_keyword ( exp ! ( Only ) ) {
1272+ BoundPolarity :: Only ( self . prev_token . span )
12681273 } else {
12691274 BoundPolarity :: Positive
12701275 } ;
@@ -1274,7 +1279,9 @@ impl<'a> Parser<'a> {
12741279 BoundPolarity :: Positive => {
12751280 // All trait bound modifiers allowed to combine with positive polarity
12761281 }
1277- BoundPolarity :: Maybe ( polarity_span) | BoundPolarity :: Negative ( polarity_span) => {
1282+ BoundPolarity :: Maybe ( polarity_span)
1283+ | BoundPolarity :: Negative ( polarity_span)
1284+ | BoundPolarity :: Only ( polarity_span) => {
12781285 match ( asyncness, constness) {
12791286 ( BoundAsyncness :: Normal , BoundConstness :: Never ) => {
12801287 // Ok, no modifiers.
@@ -1346,7 +1353,9 @@ impl<'a> Parser<'a> {
13461353
13471354 if let Some ( binder_span) = binder_span {
13481355 match modifiers. polarity {
1349- BoundPolarity :: Negative ( polarity_span) | BoundPolarity :: Maybe ( polarity_span) => {
1356+ BoundPolarity :: Negative ( polarity_span)
1357+ | BoundPolarity :: Maybe ( polarity_span)
1358+ | BoundPolarity :: Only ( polarity_span) => {
13501359 self . dcx ( ) . emit_err ( errors:: BinderAndPolarity {
13511360 binder_span,
13521361 polarity_span,
0 commit comments