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

{integer} isn't considered Send #11

Closed
compiler-errors opened this issue Mar 29, 2023 · 0 comments · Fixed by rust-lang/rust#109752
Closed

{integer} isn't considered Send #11

compiler-errors opened this issue Mar 29, 2023 · 0 comments · Fixed by rust-lang/rust#109752
Labels
has-fix A fix is up

Comments

@compiler-errors
Copy link
Owner

compiler-errors commented Mar 29, 2023

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

@compiler-errors compiler-errors added needs-further-investigation Needs to be root-caused needs-fix An easy fix needs to be put up and applied labels Mar 29, 2023
@compiler-errors compiler-errors removed the needs-further-investigation Needs to be root-caused label Mar 30, 2023
@compiler-errors compiler-errors added has-fix A fix is up and removed needs-fix An easy fix needs to be put up and applied labels Mar 30, 2023
JohnTitor added a commit to JohnTitor/rust that referenced this issue Apr 11, 2023
…uto-trait-for-num-var, r=lcnr

Stall auto trait assembly in new solver for int/float vars

Make sure that we don't match int/float vars against *all* manual auto trait impls due to this check:

https://github.com/rust-lang/rust/blob/2fb0e8d162a021f8a795fb603f5d8c0017855160/compiler/rustc_trait_selection/src/solve/trait_goals.rs#L151-L169

Since `find_map_relevant_impl` treats all impls as candidates for int/float vars, due to the way that `fast_reject::simplify_type` works.

This fixes compiler-errors/next-solver-hir-issues#11.

r? `@lcnr`
JohnTitor added a commit to JohnTitor/rust that referenced this issue Apr 11, 2023
…uto-trait-for-num-var, r=lcnr

Stall auto trait assembly in new solver for int/float vars

Make sure that we don't match int/float vars against *all* manual auto trait impls due to this check:

https://github.com/rust-lang/rust/blob/2fb0e8d162a021f8a795fb603f5d8c0017855160/compiler/rustc_trait_selection/src/solve/trait_goals.rs#L151-L169

Since `find_map_relevant_impl` treats all impls as candidates for int/float vars, due to the way that `fast_reject::simplify_type` works.

This fixes compiler-errors/next-solver-hir-issues#11.

r? ``@lcnr``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has-fix A fix is up
Projects
None yet
1 participant