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

Weird error when implementing Send with a nonexisting type param #75627

Closed
lcnr opened this issue Aug 17, 2020 · 0 comments · Fixed by #75928
Closed

Weird error when implementing Send with a nonexisting type param #75627

lcnr opened this issue Aug 17, 2020 · 0 comments · Fixed by #75928
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. D-confusing Diagnostics: Confusing error or lint that should be reworked. D-incorrect Diagnostics: A diagnostic that is giving misleading or incorrect information. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@lcnr
Copy link
Contributor

lcnr commented Aug 17, 2020

struct Foo<T>(T, *const ());

unsafe impl Send for Foo<T> {}

results in

error[E0412]: cannot find type `T` in this scope
 --> src/lib.rs:3:26
  |
3 | unsafe impl Send for Foo<T> {}
  |                          ^ not found in this scope

error[E0277]: `*const ()` cannot be sent between threads safely
  --> src/lib.rs:3:13
   |
3  |   unsafe impl Send for Foo<T> {}
   |               ^^^^ `*const ()` cannot be sent between threads safely
   |
   = help: within `Foo<[type error]>`, the trait `std::marker::Send` is not implemented for `*const ()`
   = note: required because it appears within the type `Foo<[type error]>`

The second error is incorrect and quite confusing.

@lcnr lcnr added A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. D-confusing Diagnostics: Confusing error or lint that should be reworked. D-incorrect Diagnostics: A diagnostic that is giving misleading or incorrect information. labels Aug 17, 2020
@JohnTitor JohnTitor added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Aug 18, 2020
@bors bors closed this as completed in 5fa978f Oct 5, 2020
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-bug Category: This is a bug. D-confusing Diagnostics: Confusing error or lint that should be reworked. D-incorrect Diagnostics: A diagnostic that is giving misleading or incorrect information. 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.

2 participants