Skip to content

Lint against misplaced where-clauses on associated types in traits#113560

Merged
bors merged 1 commit intorust-lang:masterfrom
fmease:assoc-tys-in-traits-depr-wc-loc
Jul 11, 2023
Merged

Lint against misplaced where-clauses on associated types in traits#113560
bors merged 1 commit intorust-lang:masterfrom
fmease:assoc-tys-in-traits-depr-wc-loc

Conversation

@fmease
Copy link
Copy Markdown
Member

@fmease fmease commented Jul 10, 2023

Extends the scope of the lint deprecated_where_clause_location (#89122) from associated types in impls to associated types in any location (impl or trait). This is only relevant for #![feature(associated_type_defaults)]. Previously we didn't warn on the following code for example:

#![feature(associated_type_defaults)]
trait Trait { type Assoc where u32: Copy = (); }

Personally I would've preferred to emit a hard error here instead of a lint warning since the feature is unstable but unfortunately we are constrained by back compat as associated type defaults won't necessarily trigger the feature-gate error if they are inside of a macro call (since they use a post-expansion feature-gate due to historical reasons, see also #66004).

I've renamed and moved related preexisting tests: 1. They test AST validation passes not the parser & thus shouldn't live in parser/ (historical reasons?). 2. One test file was named after type aliases even though it tests assoc tys.

@rustbot label A-lint

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants