Skip to content

Can't build linearscan.rs #7639

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
indutny opened this issue Jul 7, 2013 · 8 comments
Closed

Can't build linearscan.rs #7639

indutny opened this issue Jul 7, 2013 · 8 comments

Comments

@indutny
Copy link
Contributor

indutny commented Jul 7, 2013

https://github.com/indutny/linearscan.rs

It was working with pre 0.7 rust, but name lookup doesn't seem to be working now :(

@emberian
Copy link
Member

@indutny Is this still relevant? Do you need help?

@indutny
Copy link
Contributor Author

indutny commented Aug 29, 2013

I'll be able to tell you once I'll port all code to new rust :) Iterators has changed dramatically.

@indutny
Copy link
Contributor Author

indutny commented Sep 9, 2013

@cmr it seems to be still broken... I've ported my code to use new iterators but I still get:

test/emulator.rs:210:15: 210:25 error: unresolved name `Graph::new`.
test/emulator.rs:210   let mut g = ~Graph::new();

@indutny
Copy link
Contributor Author

indutny commented Sep 9, 2013

Any help would be welcome!

@emberian
Copy link
Member

emberian commented Sep 9, 2013

@indutny I'll take a poke at it later today, thanks for following up.

@indutny
Copy link
Contributor Author

indutny commented Sep 9, 2013

@cmr thank you!

@alexcrichton
Copy link
Member

Turns out this is the problem:

use linearscan::Graph;

mod linearscan {

  mod graph {
    pub struct Graph { block_id: uint, }
    impl Graph {
      pub fn new() -> Graph { fail!() }
    }
  }

  impl Graph {}
}

pub fn main() {
  Graph::new();
}

Has this error message:

$ make
rustc  --test test/runner.rs -o run-tests
test/runner.rs:16:2: 16:12 error: unresolved name `Graph::new`.
test/runner.rs:16   Graph::new();
                    ^~~~~~~~~~
error: aborting due to previous error
make: *** [run-tests] Error 101

Which is kind of right, but also kind of weird. I think that the problem is that in linearscan::api you have impl<...> Graph<...> while in linearscan::graph you have a separate impl<...> Graph<...>. I think that this falls under the category of "resolve surprises", but I'm not entirely sure what's going on here.

In the meantime, if you merge the two impl blocks for Graph, your code should get past resolve at least.

@indutny
Copy link
Contributor Author

indutny commented Sep 10, 2013

Apparently @alexcrichton's comment fixes the issue, thanks!

@indutny indutny closed this as completed Sep 10, 2013
flip1995 pushed a commit to flip1995/rust that referenced this issue Nov 23, 2021
…msteffen

Improve heuristic for eagerness suggestion

Still to be done:

* a more complete list of cheap functions
* a way to limit the complexity of cheap expressions

changelog: Improve heuristics for `or_fun_call` and `unnecessary_lazy_evaluations`
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