Skip to content

Error help suggests invalid syntax #56745

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
bjorn3 opened this issue Dec 12, 2018 · 2 comments
Closed

Error help suggests invalid syntax #56745

bjorn3 opened this issue Dec 12, 2018 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug.

Comments

@bjorn3
Copy link
Member

bjorn3 commented Dec 12, 2018

impl Backend: 'static

error[E0310]: the parameter type `impl Backend` may not live long enough
   --> src/lib.rs:373:9
    |
362 | fn codegen_allocator_shim(sess: &Session, module: &mut Module<impl Backend>) {
    |                                                               ------------- help: consider adding an explicit lifetime bound `impl Backend: 'static`...
...
373 |         allocator::codegen(module, kind);
    |         ^^^^^^^^^^^^^^^^^^
    |
note: ...so that the type `impl Backend` will meet its required lifetime bounds
   --> src/lib.rs:373:9
    |
373 |         allocator::codegen(module, kind);
    |         ^^^^^^^^^^^^^^^^^^
@estebank estebank added A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. labels Dec 12, 2018
@estebank
Copy link
Contributor

I don't think any of the suggestions account for impl Trait :-/

I think that in this case it can suggest impl Backend + 'static and that would be correct, right?

@bjorn3
Copy link
Member Author

bjorn3 commented Dec 12, 2018

I think that in this case it can suggest impl Backend + 'static and that would be correct, right?

Yes, that was exactly the fix.

pietroalbini added a commit to pietroalbini/rust that referenced this issue Dec 13, 2018
…ertj

Account for `impl Trait` when suggesting lifetime

Fix rust-lang#56745
kennytm added a commit to kennytm/rust that referenced this issue Dec 13, 2018
…ertj

Account for `impl Trait` when suggesting lifetime

Fix rust-lang#56745
kennytm added a commit to kennytm/rust that referenced this issue Dec 14, 2018
…ertj

Account for `impl Trait` when suggesting lifetime

Fix rust-lang#56745
kennytm added a commit to kennytm/rust that referenced this issue Dec 14, 2018
…ertj

Account for `impl Trait` when suggesting lifetime

Fix rust-lang#56745
pietroalbini added a commit to pietroalbini/rust that referenced this issue Dec 14, 2018
…ertj

Account for `impl Trait` when suggesting lifetime

Fix rust-lang#56745
pietroalbini added a commit to pietroalbini/rust that referenced this issue Dec 15, 2018
…ertj

Account for `impl Trait` when suggesting lifetime

Fix rust-lang#56745
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants