Skip to content
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

Add a lint to warn about &(dyn … + Send) #110937

Open
m-ou-se opened this issue Apr 28, 2023 · 4 comments · May be fixed by #110961
Open

Add a lint to warn about &(dyn … + Send) #110937

m-ou-se opened this issue Apr 28, 2023 · 4 comments · May be fixed by #110961
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-feature-request Category: A feature request, i.e: not implemented / a PR. E-help-wanted Call for participation: Help is requested to fix this issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@m-ou-se
Copy link
Member

m-ou-se commented Apr 28, 2023

Adding + Send to a &dyn is a useless restriction. E.g. &(dyn Any + Send) implicitly converts to &dyn Any, but not the other way around, even though it'd be sound to just transmute it in both directions, since the Send isn't of any use for (shared) references.

It'd be nice if we suggest removing the + Send for &(dyn … + Send).

See #110799

@m-ou-se m-ou-se added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. E-help-wanted Call for participation: Help is requested to fix this issue. C-feature-request Category: A feature request, i.e: not implemented / a PR. labels Apr 28, 2023
@john-h-k
Copy link
Contributor

Would this make the most sense as a rustc lint or a clippy lint?

@m-ou-se
Copy link
Member Author

m-ou-se commented Apr 28, 2023

I think as a rustc lint.

cc @rust-lang/types who probably have an opinion on this.

@john-h-k
Copy link
Contributor

@rustbot claim

@steffahn
Copy link
Member

Using the dyn-clone crate, &dyn Trait + Send can be useful, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-feature-request Category: A feature request, i.e: not implemented / a PR. E-help-wanted Call for participation: Help is requested to fix this issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants