Skip to content

rustc --lib par.rs -L . -->> error: internal compiler error: can't make T_opaque_trait with bare trait store #6940

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

Closed
JeffMurray opened this issue Jun 4, 2013 · 12 comments

Comments

@JeffMurray
Copy link

Here is a link to the code at this point in time.

https://github.com/JeffMurray/must/tree/29fd8652674a1b1009d7a168fc544c830fdce87c/src

I am getting the error when compiling par.rs, but I am guessing the opaque trait the compiler is referring to is ParFitable in fit.rs.

Thanks for making Rust, and sorry if I am making a noob mistake :)

@JeffMurray
Copy link
Author

rustic -v

rustc 0.6 (5f13e9c 2013-04-02 13:36:51 -0700)
host: x86_64-unknown-linux-gnu

@Blei
Copy link
Contributor

Blei commented Jun 5, 2013

Hi, thanks for the bug report, but I couldn't build your code... par.rs depends on bootstrap, which contains numerous errors and I gave up after fixing some of them.

@JeffMurray
Copy link
Author

My apologies, I hope you did not spend to much time on it. I was in the middle of re-factoring when I ran into the compiler issue.

I will tidy up and re-submit, if necessary.

Thanks.

@JeffMurray
Copy link
Author

Take 2 after a promised tidy up on my part, I am still getting the reported compiler error.

You now only need fit.rs and par.rs to reproduce it.

fit.rs contains the trait in question par.rs tries to use it.

Here is a link to this commit:

https://github.com/JeffMurray/must/tree/32050866d1316bd9fafef925c8a1e671bc4194b4/src

It is likely I am doing something wrong but I am not sure what a bare trait store is. My goal is to simply pass a connection to ParFitable.connect( ... )

Thanks in advance for any feedback.

@JeffMurray
Copy link
Author

line 121 in par.rs is an example of passing a DuplexStream to a fn defined through the ParFitable trait which has me stumped. -> https://github.com/JeffMurray/must/blob/32050866d1316bd9fafef925c8a1e671bc4194b4/src/par.rs#L121

@Blei
Copy link
Contributor

Blei commented Jun 6, 2013

Thanks for fixing the errors. I compiled your code with the newest version of rust (the "incoming" branch). After fixing up some small library changes, this resulted in the following error:

par.rs:84:11: 84:21 error: reference to trait `ParFitable` where a type is expected; try `@ParFitable`, `~ParFitable`, or `&ParFitable`
par.rs:84       priv fit: ParFitable
                          ^~~~~~~~~~
par.rs:107:20: 107:30 error: reference to trait `ParFitable` where a type is expected; try `@ParFitable`, `~ParFitable`, or `&ParFitable`
par.rs:107      fn new(&self, fit: ParFitable, timeout_ms: uint, spawn_cap: uint ) -> Par {
                                   ^~~~~~~~~~

Bare traits, i.e. without any pointer indirection, have a dynamic size, as it's impossible to know which object that implements the trait will be used. As a consequence, bare traits can not be instantiated, you have to use a pointer indirection. After fixing your code up to use @ParFitable (as the other two variants are still buggy IIRC?), it compiled correctly.

@JeffMurray
Copy link
Author

Thank you :)

@JeffMurray
Copy link
Author

Still: rustic -v

rustc 0.6 (5f13e9c 2013-04-02 13:36:51 -0700)
host: x86_64-unknown-linux-gnu

Rather than creating a new thread, I am re-opening this one to note that I am am receiving an odd warning when compiling must/src/par.rs

https://github.com/JeffMurray/must/tree/05a14237c5e6b119c39cb418f271b3a2239964ff/src

rustc --lib par.rs -L .
par.rs:166:6: 166:19 warning: unused variable: RecvInChan
par.rs:166 RecvInChan => {
^~~~~~~~~~~~~

RecvInChan is an enum that I am matching.

Sorry if I am making an obvious mistake.

Thanks,

Jeff

@JeffMurray JeffMurray reopened this Jun 25, 2013
@jdm
Copy link
Contributor

jdm commented Jun 25, 2013

You haven't imported the RecvInChan name, so you have a catch-all binding named RecvInChan instead.

@jdm jdm closed this as completed Jun 25, 2013
@JeffMurray
Copy link
Author

RecvInChan is part of an enum declared in this rs. I am not sure I understand. Thanks anyway.

@Blei
Copy link
Contributor

Blei commented Jun 25, 2013

No it's not. You seem to have renamed it to RecvInPort.

@JeffMurray
Copy link
Author

On my, you are right.

flip1995 pushed a commit to flip1995/rust that referenced this issue May 6, 2021
`implicit_return` improvements

fixes: rust-lang#6940

changelog: Fix `implicit_return` suggestion for async functions
changelog: Improve `implicit_return` suggestions when returning the result of a macro
changelog: Check for `break` expressions inside a loop which are then implicitly returned
changelog: Allow all diverging functions in `implicit_return`, not just panic functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants