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

ICE with #[derive(Copy)], missing trait bound, and blanket impl #38821

Closed
sgrif opened this issue Jan 4, 2017 · 4 comments
Closed

ICE with #[derive(Copy)], missing trait bound, and blanket impl #38821

sgrif opened this issue Jan 4, 2017 · 4 comments
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@sgrif
Copy link
Contributor

sgrif commented Jan 4, 2017

I have tested this on both 1.13 and on nightly-2016-12-28. This this is the script to reproduce: https://is.gd/PWV89w

The code is invalid due to missing constraint Col::SqlType: IntoNullable on line 26. The expected error is:

error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
  --> foo.rs:25:1
   |
25 |   pub enum ColumnInsertValue<Col, Expr> where
   |  _^ starting here...
26 | |     Col: Column,
27 | |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
28 | | {
29 | |     Expression(Col, Expr),
30 | |     Default(Col),
31 | | }
   | |_^ ...ending here: the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
   |
   = help: consider adding a `where <Col as Expression>::SqlType: NotNull` bound
   = note: required because of the requirements on the impl of `IntoNullable` for `<Col as Expression>::SqlType`

But the compiler instead ICEs. If #[derive(Copy)] is removed, the compiler gives the error message as expected. If the blanket impl<T: NotNull> IntoNullable for T (lines 10-12 in the script) is removed, the compiler gives the error message as expected.

@sgrif
Copy link
Contributor Author

sgrif commented Jan 4, 2017

Slightly simplified repro script: https://is.gd/HXaz0L

@brson brson added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 11, 2017
@Mark-Simulacrum
Copy link
Member

Errors today, which is I think correct. E-needstest.

error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
  --> <anon>:16:10
   |
16 | #[derive(Copy)]
   |          ^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
   |
   = help: consider adding a `where <Col as Expression>::SqlType: NotNull` bound
   = note: required because of the requirements on the impl of `IntoNullable` for `<Col as Expression>::SqlType`

error: aborting due to previous error

@Mark-Simulacrum Mark-Simulacrum added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label May 19, 2017
@venkatagiri
Copy link
Contributor

@Mark-Simulacrum I want to contribute the test for this issue.
By the example you have provided, my guess would be that we need an UI test in src/test/ui/span/ with issue-38821.rs and issue-38821.stderr files.

Is that correct?

@Mark-Simulacrum
Copy link
Member

@venkatagiri I think a compile-fail test would be enough here; we primarily want to just make sure it doesn't ICE. To do that, I'd say that the example code needs to be put into a file in src/test/compile-fail and annotated with the related messages. Let me know if you have any more questions; I'd be happy to help. Please r? me on the pull request when you create it.

venkatagiri added a commit to venkatagiri/rust that referenced this issue May 22, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue May 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants