Skip to content

Commit 2744a36

Browse files
authored
Merge pull request #1340 from dtolnay/whereclauselocation
Move GAT where-clause to after type, extern type to both
2 parents 0911436 + 22621c8 commit 2744a36

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/item.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,6 @@ pub mod parsing {
10581058
// type Ty<T> where T: 'static = T;
10591059
BeforeEq,
10601060
// type Ty<T> = T where T: 'static;
1061-
#[allow(dead_code)]
10621061
AfterEq,
10631062
// TODO: goes away once the migration period on rust-lang/rust#89122 is over
10641063
Both,
@@ -1091,7 +1090,7 @@ pub mod parsing {
10911090
WhereClauseLocation::BeforeEq | WhereClauseLocation::Both => {
10921091
generics.where_clause = input.parse()?;
10931092
}
1094-
_ => {}
1093+
WhereClauseLocation::AfterEq => {}
10951094
}
10961095

10971096
let ty = if let Some(eq_token) = input.parse()? {
@@ -1788,7 +1787,7 @@ pub mod parsing {
17881787
bounds: _,
17891788
ty,
17901789
semi_token,
1791-
} = FlexibleItemType::parse(input, WhereClauseLocation::BeforeEq)?;
1790+
} = FlexibleItemType::parse(input, WhereClauseLocation::Both)?;
17921791

17931792
if defaultness.is_some()
17941793
|| generics.lt_token.is_some()
@@ -2277,7 +2276,7 @@ pub mod parsing {
22772276
bounds,
22782277
ty,
22792278
semi_token,
2280-
} = FlexibleItemType::parse(input, WhereClauseLocation::Both)?;
2279+
} = FlexibleItemType::parse(input, WhereClauseLocation::AfterEq)?;
22812280

22822281
if defaultness.is_some() || vis.is_some() {
22832282
Ok(TraitItem::Verbatim(verbatim::between(begin, input)))
@@ -2608,7 +2607,7 @@ pub mod parsing {
26082607
bounds: _,
26092608
ty,
26102609
semi_token,
2611-
} = FlexibleItemType::parse(input, WhereClauseLocation::Both)?;
2610+
} = FlexibleItemType::parse(input, WhereClauseLocation::AfterEq)?;
26122611

26132612
if colon_token.is_some() || ty.is_none() {
26142613
Ok(ImplItem::Verbatim(verbatim::between(begin, input)))

tests/repo/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ static EXCLUDE_FILES: &[&str] = &[
3939
"tests/ui/issues/issue-34074.rs",
4040
"tests/ui/proc-macro/trait-fn-args-2015.rs",
4141

42+
// Deprecated where-clause location
43+
"src/tools/rustfmt/tests/source/issue_4257.rs",
44+
"src/tools/rustfmt/tests/source/issue_4911.rs",
45+
"src/tools/rustfmt/tests/target/issue_4257.rs",
46+
"src/tools/rustfmt/tests/target/issue_4911.rs",
47+
"tests/pretty/gat-bounds.rs",
48+
"tests/rustdoc/generic-associated-types/gats.rs",
49+
4250
// Old type ascription expression syntax
4351
"src/tools/rustfmt/tests/source/type-ascription.rs",
4452
"src/tools/rustfmt/tests/target/type-ascription.rs",

0 commit comments

Comments
 (0)