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

Missing lifetime specifier in src/reader.rs #247

Closed
LucianaMarques opened this issue Jan 28, 2019 · 5 comments
Closed

Missing lifetime specifier in src/reader.rs #247

LucianaMarques opened this issue Jan 28, 2019 · 5 comments

Comments

@LucianaMarques
Copy link
Contributor

LucianaMarques commented Jan 28, 2019

Hi there,

I'm working on another issue and I'm trying to merge the updates from the upstream repo with my origin repo.

I builded the project with "cargo build" but this message keeps appearing on the terminal (I use Ubuntu 18):

error[E0106]: missing lifetime specifier
--> src/reader.rs:83:11
|
83 | impl From<&str> for GcovReaderBuf {
| ^ expected lifetime parameter

error: aborting due to previous error

For more information about this error, try rustc --explain E0106.
error: Could not compile grcov.

To learn more, run the command again with --verbose.

Is this suppose to happen or am I doing it wrong?

I checked and the file on my computer is the same as on the original github repo.

Thanks!

@calixteman
Copy link
Collaborator

What's your rust version ?
It works for me with stable (1.32.0) and nightly (1.34.0).

@calixteman
Copy link
Collaborator

Tell me if it's better with this patch:

diff --git a/src/reader.rs b/src/reader.rs
index f673853..c7de3ea 100644
--- a/src/reader.rs
+++ b/src/reader.rs
@@ -80,8 +80,8 @@ pub struct GcovReaderBuf {
     pos: usize,
 }
 
-impl From<&str> for GcovReaderBuf {
-    fn from(path: &str) -> GcovReaderBuf {
+impl<'a> From<&'a str> for GcovReaderBuf {
+    fn from(path: &'a str) -> GcovReaderBuf {
         let path = PathBuf::from(path);
         let mut f = File::open(&path).unwrap();
         let mut buf = Vec::new();

@marco-c
Copy link
Collaborator

marco-c commented Jan 28, 2019

This would likely be fixed if you update Rust to the latest version.

@LucianaMarques
Copy link
Contributor Author

Hi there,

It worked. I just have a few comments:

For some reason I didn't have rustup but had a previous Rust installation. I only use Rust for this tool, so this may be because I didn't do the installation properly (I don't remember what I did on installation matters, this was some months ago, but I remember having the build working fine in October 2018). I then got stuck on this bug, so I uninstalled Rust and did the whole process accordingly to this tutorial. I think it would be nice to have some kind of remark on README.md for potential contributors, if approved I can submit a Pull Request.

The build worked with the new installed version of Rust, but I had this warning:

warning: method is never used: collect_lines
--> src/reader.rs:614:5
|
614 | fn collect_lines(&self) -> HashMap<&str, HashMap<u32, u64>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(dead_code)] on by default

warning: method is never used: dump
--> src/reader.rs:636:5
|
636 | / fn dump(
637 | | &mut self,
638 | | path: &PathBuf,
639 | | file_name: &str,
... |
691 | | Ok(())
692 | | }
| |_____^

Thought it would be good to notify.

Thanks!

@marco-c
Copy link
Collaborator

marco-c commented Jan 28, 2019

It's clear that the project is using Rust, so I think it's unneeded to explain in our README how to install it (contributors can search for themselves).

Glad the error is gone after the update!

@marco-c marco-c closed this as completed Jan 28, 2019
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