Skip to content

Move GAT where-clause to after type, extern type to both #1340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,6 @@ pub mod parsing {
// type Ty<T> where T: 'static = T;
BeforeEq,
// type Ty<T> = T where T: 'static;
#[allow(dead_code)]
AfterEq,
// TODO: goes away once the migration period on rust-lang/rust#89122 is over
Both,
Expand Down Expand Up @@ -1091,7 +1090,7 @@ pub mod parsing {
WhereClauseLocation::BeforeEq | WhereClauseLocation::Both => {
generics.where_clause = input.parse()?;
}
_ => {}
WhereClauseLocation::AfterEq => {}
}

let ty = if let Some(eq_token) = input.parse()? {
Expand Down Expand Up @@ -1788,7 +1787,7 @@ pub mod parsing {
bounds: _,
ty,
semi_token,
} = FlexibleItemType::parse(input, WhereClauseLocation::BeforeEq)?;
} = FlexibleItemType::parse(input, WhereClauseLocation::Both)?;

if defaultness.is_some()
|| generics.lt_token.is_some()
Expand Down Expand Up @@ -2277,7 +2276,7 @@ pub mod parsing {
bounds,
ty,
semi_token,
} = FlexibleItemType::parse(input, WhereClauseLocation::Both)?;
} = FlexibleItemType::parse(input, WhereClauseLocation::AfterEq)?;

if defaultness.is_some() || vis.is_some() {
Ok(TraitItem::Verbatim(verbatim::between(begin, input)))
Expand Down Expand Up @@ -2608,7 +2607,7 @@ pub mod parsing {
bounds: _,
ty,
semi_token,
} = FlexibleItemType::parse(input, WhereClauseLocation::Both)?;
} = FlexibleItemType::parse(input, WhereClauseLocation::AfterEq)?;

if colon_token.is_some() || ty.is_none() {
Ok(ImplItem::Verbatim(verbatim::between(begin, input)))
Expand Down
8 changes: 8 additions & 0 deletions tests/repo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ static EXCLUDE_FILES: &[&str] = &[
"tests/ui/issues/issue-34074.rs",
"tests/ui/proc-macro/trait-fn-args-2015.rs",

// Deprecated where-clause location
"src/tools/rustfmt/tests/source/issue_4257.rs",
"src/tools/rustfmt/tests/source/issue_4911.rs",
"src/tools/rustfmt/tests/target/issue_4257.rs",
"src/tools/rustfmt/tests/target/issue_4911.rs",
"tests/pretty/gat-bounds.rs",
"tests/rustdoc/generic-associated-types/gats.rs",

// Old type ascription expression syntax
"src/tools/rustfmt/tests/source/type-ascription.rs",
"src/tools/rustfmt/tests/target/type-ascription.rs",
Expand Down