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

Bad compilation error when Send bound is required but not met #18988

Closed
carllerche opened this issue Nov 15, 2014 · 0 comments · Fixed by #26481
Closed

Bad compilation error when Send bound is required but not met #18988

carllerche opened this issue Nov 15, 2014 · 0 comments · Fixed by #26481
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lints Area: Lints (warnings about flaws in source code) such as unused_mut.

Comments

@carllerche
Copy link
Member

Here is an example. The error message only tells me that Send is required but not present. The Send bound is implicit though, and is missing due to something in my code. It would be nice if the compiler could tell me what is preventing the Send bound.

Error

bounds.rs:8:1: 9:2 error: the trait `core::kinds::Send` is not implemented for the type `MyFoo`
bounds.rs:8 impl Foo for MyFoo {
bounds.rs:9 }
bounds.rs:8:1: 9:2 note: the trait `core::kinds::Send` must be implemented because it is required by `Foo`
bounds.rs:8 impl Foo for MyFoo {
bounds.rs:9 }
error: aborting due to previous error
➜  rust-exp  rustc bounds.rs
bounds.rs:5:5: 5:33 warning: struct field is never used: `children`, #[warn(dead_code)] on by default
bounds.rs:5     children: Vec<Box<Foo+Send>>,
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Code

pub trait Foo : Send {
}

pub struct MyFoo {
    children: Vec<Box<Foo>>,
}

impl Foo for MyFoo {
}

pub fn main() {
}

@nikomatsakis

@steveklabnik steveklabnik added A-diagnostics Area: Messages for errors, warnings, and lints A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. labels Jan 29, 2015
nham pushed a commit to nham/rust that referenced this issue Jun 21, 2015
bors added a commit that referenced this issue Jun 22, 2015
These issues are fixed but still open.

Closes #18655.
Closes #18988.
lnicola pushed a commit to lnicola/rust that referenced this issue Jan 27, 2025
fix: Sort completion items that skip `await` and  `iter()` behind those that don't
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 A-lints Area: Lints (warnings about flaws in source code) such as unused_mut.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants