Skip to content

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

Closed
@sgrif

Description

@sgrif

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions