Skip to content

Commit d8a82d6

Browse files
committed
fix: allow removed_trait_bound in more places
1 parent a2d0367 commit d8a82d6

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

grammar.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,6 @@ module.exports = grammar({
526526
$._type,
527527
$.lifetime,
528528
$.higher_ranked_trait_bound,
529-
$.removed_trait_bound,
530529
)),
531530
),
532531

@@ -711,6 +710,7 @@ module.exports = grammar({
711710
$.never_type,
712711
$.dynamic_type,
713712
$.bounded_type,
713+
$.removed_trait_bound,
714714
alias(choice(...primitiveTypes), $.primitive_type),
715715
),
716716

@@ -851,6 +851,7 @@ module.exports = grammar({
851851
field('trait', choice(
852852
$._type_identifier,
853853
$.scoped_type_identifier,
854+
$.removed_trait_bound,
854855
$.generic_type,
855856
$.function_type,
856857
)),

test/corpus/declarations.txt

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,7 @@ fn triples(a: impl B) -> impl Iterator<Item=(usize)> {
269269
Diverging functions
270270
================================================================================
271271

272-
fn aborts() -> ! {
273-
}
272+
fn aborts() -> ! {}
274273

275274
--------------------------------------------------------------------------------
276275

@@ -1634,6 +1633,8 @@ Unsized types in trait bounds
16341633
trait Foo<T: ?Sized> {
16351634
}
16361635

1636+
fn univariant(this: &impl ?Sized, that: &(impl LayoutCalculator + ?Sized)) {}
1637+
16371638
--------------------------------------------------------------------------------
16381639

16391640
(source_file
@@ -1645,7 +1646,26 @@ trait Foo<T: ?Sized> {
16451646
(trait_bounds
16461647
(removed_trait_bound
16471648
(type_identifier)))))
1648-
(declaration_list)))
1649+
(declaration_list))
1650+
(function_item
1651+
(identifier)
1652+
(parameters
1653+
(parameter
1654+
(identifier)
1655+
(reference_type
1656+
(abstract_type
1657+
(removed_trait_bound
1658+
(type_identifier)))))
1659+
(parameter
1660+
(identifier)
1661+
(reference_type
1662+
(tuple_type
1663+
(bounded_type
1664+
(abstract_type
1665+
(type_identifier))
1666+
(removed_trait_bound
1667+
(type_identifier)))))))
1668+
(block)))
16491669

16501670
================================================================================
16511671
Macro invocations inside trait declarations

0 commit comments

Comments
 (0)