Skip to content

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

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jul 11, 2023

Conversation

fmease
Copy link
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

@rustbot
Copy link
Collaborator

rustbot commented Jul 10, 2023

r? @cjgillot

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. labels Jul 10, 2023
@compiler-errors
Copy link
Member

This makes sense, and given that it only affects nightly feature-gated code and just extends this lint to a position where it was forgotten, I'm gonna approve it.

r? @compiler-errors @bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jul 11, 2023

📌 Commit b809207 has been approved by compiler-errors

It is now in the queue for this repository.

@rustbot rustbot assigned compiler-errors and unassigned cjgillot Jul 11, 2023
@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 11, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 11, 2023
…iaskrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang#112717 (Implement a few more rvalue translation to smir)
 - rust-lang#113310 (Don't suggest `impl Trait` in path position)
 - rust-lang#113497 (Support explicit 32-bit MIPS ABI for the synthetic object)
 - rust-lang#113560 (Lint against misplaced where-clauses on associated types in traits)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 4f5ef52 into rust-lang:master Jul 11, 2023
@rustbot rustbot added this to the 1.73.0 milestone Jul 11, 2023
@fmease fmease deleted the assoc-tys-in-traits-depr-wc-loc branch July 11, 2023 19:59
# for free to join this conversation on GitHub. Already have an account? # 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