Skip to content

{integer} isn't considered Send #11

Closed
rust-lang/rust
#109752
@compiler-errors

Description

@compiler-errors
fn needs_foo(_: impl Send) {}

pub fn main() {
    needs_foo(1337);
}
error[E0277]: `{integer}` cannot be sent between threads safely
 --> <source>:4:15
  |
4 |     needs_foo(1337);
  |     --------- ^^^^ `{integer}` cannot be sent between threads safely
  |     |
  |     required by a bound introduced by this call
  |
  = help: the trait `Send` is not implemented for `{integer}`
note: required by a bound in `needs_foo`
 --> <source>:1:22
  |
1 | fn needs_foo(_: impl Send) {}
  |                      ^^^^ required by this bound in `needs_foo`

error: aborting due to previous error

Weird, because we definitely assemble auto trait bounds for {integer}. I wonder if it has to do with this:

https://github.com/rust-lang/rust/blob/f98598c6cd34947efa9e3977338e9bce62d1997c/compiler/rustc_trait_selection/src/solve/trait_goals.rs#L161

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions