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

Try fix incorrect "explicit lifetime name needed" #65307

Merged
merged 1 commit into from
Oct 16, 2019

Conversation

Phosphorus15
Copy link
Contributor

@Phosphorus15 Phosphorus15 commented Oct 11, 2019

This pr is trying to fixes #65285 .

@rust-highfive
Copy link
Collaborator

r? @cramertj

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 11, 2019
@Phosphorus15
Copy link
Contributor Author

r? @varkor maybe?

@rust-highfive rust-highfive assigned varkor and unassigned cramertj Oct 11, 2019
@varkor
Copy link
Member

varkor commented Oct 11, 2019

Can you add a test with the new diagnostic?

@Phosphorus15
Copy link
Contributor Author

Sure yes, there ought to be a test correspond to this issue.

@Phosphorus15
Copy link
Contributor Author

Phosphorus15 commented Oct 12, 2019

It seems enough to solve this issue, please review 😃

/// Refer to issue #65285
/// return a "error lifetime".
fn new_missing_lifetime(&mut self, id: Option<NodeId>, span: Span) -> hir::Lifetime {
match id {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be if id.is_some() { … }.

@@ -3284,7 +3295,7 @@ impl<'a> LoweringContext<'a> {
// This is the normal case.
AnonymousLifetimeMode::PassThrough => self.new_implicit_lifetime(span),

AnonymousLifetimeMode::ReportError => self.new_error_lifetime(None, span),
AnonymousLifetimeMode::ReportError => self.new_missing_lifetime(None, span),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is always called with None, so you might as well just use new_implicit_lifetime here, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, shame of me. Thanks for pointing out XD

@@ -3283,8 +3283,10 @@ impl<'a> LoweringContext<'a> {
}
// This is the normal case.
AnonymousLifetimeMode::PassThrough => self.new_implicit_lifetime(span),

AnonymousLifetimeMode::ReportError => self.new_error_lifetime(None, span),
// elide the lifetime parameter (if possible) for the lifetime resolver to check
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear to me from this comment why this change works. Could you try to elaborate what this does in your comment?

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-10-14T13:55:00.0675543Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-10-14T13:55:00.1169025Z ##[command]git config gc.auto 0
2019-10-14T13:55:00.1203668Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-10-14T13:55:00.1255141Z ##[command]git config --get-all http.proxy
2019-10-14T13:55:00.1389624Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/65307/merge:refs/remotes/pull/65307/merge
---
2019-10-14T14:01:29.7202354Z    Compiling serde_json v1.0.40
2019-10-14T14:01:31.4379471Z    Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
2019-10-14T14:01:42.6096955Z     Finished release [optimized] target(s) in 1m 27s
2019-10-14T14:01:42.6171282Z tidy check
2019-10-14T14:01:43.3193873Z tidy error: /checkout/src/librustc/hir/lowering.rs:3297: line longer than 100 chars
2019-10-14T14:01:43.3194075Z tidy error: /checkout/src/librustc/hir/lowering.rs:3298: line longer than 100 chars
2019-10-14T14:01:43.3194121Z tidy error: /checkout/src/librustc/hir/lowering.rs:3299: line longer than 100 chars
2019-10-14T14:01:43.3194181Z tidy error: /checkout/src/librustc/hir/lowering.rs:3300: line longer than 100 chars
2019-10-14T14:01:44.6577604Z Found 482 error codes
2019-10-14T14:01:44.6577900Z Found 0 error codes with no tests
2019-10-14T14:01:44.6581925Z Done!
2019-10-14T14:01:44.6582206Z some tidy checks failed
2019-10-14T14:01:44.6582206Z some tidy checks failed
2019-10-14T14:01:44.6582252Z 
2019-10-14T14:01:44.6582274Z 
2019-10-14T14:01:44.6583465Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor"
2019-10-14T14:01:44.6583695Z 
2019-10-14T14:01:44.6583716Z 
2019-10-14T14:01:44.6583805Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2019-10-14T14:01:44.6583846Z Build completed unsuccessfully in 0:01:31
2019-10-14T14:01:44.6583846Z Build completed unsuccessfully in 0:01:31
2019-10-14T14:01:44.6627303Z == clock drift check ==
2019-10-14T14:01:44.6644847Z   local time: Mon Oct 14 14:01:44 UTC 2019
2019-10-14T14:01:44.7608054Z   network time: Mon, 14 Oct 2019 14:01:44 GMT
2019-10-14T14:01:44.7615251Z == end clock drift check ==
2019-10-14T14:01:45.6525208Z ##[error]Bash exited with code '1'.
2019-10-14T14:01:45.6677724Z ##[section]Starting: Checkout
2019-10-14T14:01:45.6679480Z ==============================================================================
2019-10-14T14:01:45.6679540Z Task         : Get sources
2019-10-14T14:01:45.6679580Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@varkor
Copy link
Member

varkor commented Oct 14, 2019

r=me with comment suggestion and squashing the commits.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-10-14T14:51:56.1422827Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-10-14T14:51:56.1531249Z ##[command]git config gc.auto 0
2019-10-14T14:51:56.1615446Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-10-14T14:51:56.1674274Z ##[command]git config --get-all http.proxy
2019-10-14T14:51:56.1849625Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/65307/merge:refs/remotes/pull/65307/merge
---
2019-10-14T14:58:09.7838720Z    Compiling serde_json v1.0.40
2019-10-14T14:58:11.7817399Z    Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
2019-10-14T14:58:24.3443050Z     Finished release [optimized] target(s) in 1m 36s
2019-10-14T14:58:24.3524722Z tidy check
2019-10-14T14:58:25.1209972Z tidy error: /checkout/src/librustc/hir/lowering.rs:3300: trailing whitespace
2019-10-14T14:58:26.7715847Z some tidy checks failed
2019-10-14T14:58:26.7716009Z Found 482 error codes
2019-10-14T14:58:26.7716058Z Found 0 error codes with no tests
2019-10-14T14:58:26.7716102Z Done!
2019-10-14T14:58:26.7716102Z Done!
2019-10-14T14:58:26.7716131Z 
2019-10-14T14:58:26.7716176Z 
2019-10-14T14:58:26.7718096Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor"
2019-10-14T14:58:26.7718253Z 
2019-10-14T14:58:26.7718279Z 
2019-10-14T14:58:26.7718327Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2019-10-14T14:58:26.7718407Z Build completed unsuccessfully in 0:01:40
2019-10-14T14:58:26.7718407Z Build completed unsuccessfully in 0:01:40
2019-10-14T14:58:26.7763841Z == clock drift check ==
2019-10-14T14:58:26.7777766Z   local time: Mon Oct 14 14:58:26 UTC 2019
2019-10-14T14:58:26.9274879Z   network time: Mon, 14 Oct 2019 14:58:26 GMT
2019-10-14T14:58:26.9279791Z == end clock drift check ==
2019-10-14T14:58:27.7247259Z ##[error]Bash exited with code '1'.
2019-10-14T14:58:27.7294733Z ##[section]Starting: Checkout
2019-10-14T14:58:27.7296516Z ==============================================================================
2019-10-14T14:58:27.7296572Z Task         : Get sources
2019-10-14T14:58:27.7296620Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@rust-highfive
Copy link
Collaborator

Your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-10-14T15:20:01.4693733Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-10-14T15:20:01.4805184Z ##[command]git config gc.auto 0
2019-10-14T15:20:01.4877095Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-10-14T15:20:01.4939132Z ##[command]git config --get-all http.proxy
2019-10-14T15:20:01.5086379Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/65307/merge:refs/remotes/pull/65307/merge

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

Copy link
Member

@varkor varkor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the full stop here?

@Phosphorus15
Copy link
Contributor Author

Why remove the full stop here?

There were something wrong with CI, and I just tried to trigger the re-run by a commit, I'll revert this change

@varkor
Copy link
Member

varkor commented Oct 15, 2019

In the future, you can trigger the CI to restart by amending the last commit and force-pushing.

If you could squash your commits into a single commit, I'll approve the PR :)

add test to for the fix

add descriptive text for the fix

simplified code logics

update descriptive comments

update to cope with the tidyness requirement

merged commit suggestions

Co-Authored-By: varkor <github@varkor.com>

truncated redundant comments

update to cope with tidy-check
@Phosphorus15
Copy link
Contributor Author

Thanks a lot 🎁 , I'm somewhat new to the rust community and you've helped me greatly.

@varkor
Copy link
Member

varkor commented Oct 15, 2019

Thanks for your work on this issue!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Oct 15, 2019

📌 Commit 53187c5 has been approved by varkor

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 15, 2019
Centril added a commit to Centril/rust that referenced this pull request Oct 15, 2019
Try fix incorrect "explicit lifetime name needed"

This pr is trying to fixes rust-lang#65285 .
Centril added a commit to Centril/rust that referenced this pull request Oct 15, 2019
Try fix incorrect "explicit lifetime name needed"

This pr is trying to fixes rust-lang#65285 .
tmandry added a commit to tmandry/rust that referenced this pull request Oct 15, 2019
Try fix incorrect "explicit lifetime name needed"

This pr is trying to fixes rust-lang#65285 .
bors added a commit that referenced this pull request Oct 15, 2019
Rollup of 14 pull requests

Successful merges:

 - #64603 (Reducing spurious unused lifetime warnings.)
 - #64623 (Remove last uses of gensyms)
 - #65235 (don't assume we can *always* find a return type hint in async fn)
 - #65242 (Fix suggestion to constrain trait for method to be found)
 - #65265 (Cleanup librustc mir err codes)
 - #65293 (Optimize `try_expand_impl_trait_type`)
 - #65307 (Try fix incorrect "explicit lifetime name needed")
 - #65308 (Add long error explanation for E0574)
 - #65353 (save-analysis: Don't ICE when resolving qualified type paths in struct members)
 - #65389 (Return `false` from `needs_drop` for all zero-sized arrays.)
 - #65402 (Add troubleshooting section to PGO chapter in rustc book.)
 - #65425 (Optimize `BitIter`)
 - #65438 (Organize `never_type`  tests)
 - #65444 (Implement AsRef<[T]> for List<T>)

Failed merges:

 - #65390 (Add long error explanation for E0576)

r? @ghost
@bors bors merged commit 53187c5 into rust-lang:master Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect "explicit lifetime name needed" error
5 participants