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

Don't ICE on unconstrained anonymous lifetimes inside associated types. #74665

Merged
merged 2 commits into from
Jul 24, 2020
Merged

Don't ICE on unconstrained anonymous lifetimes inside associated types. #74665

merged 2 commits into from
Jul 24, 2020

Conversation

smmalis37
Copy link
Contributor

Fixes #62200. The change here is inspired (copied) by how this case is handled on bare fns at

for br in late_bound_in_ret.difference(&late_bound_in_args) {
let lifetime_name = match *br {
ty::BrNamed(_, name) => format!("lifetime `{}`,", name),
ty::BrAnon(_) | ty::BrEnv => "an anonymous lifetime".to_string(),
};
let mut err = struct_span_err!(
tcx.sess,
decl.output.span(),
E0581,
"return type references {} which is not constrained by the fn input types",
lifetime_name
);
if let ty::BrAnon(_) = *br {
// The only way for an anonymous lifetime to wind up
// in the return type but **also** be unconstrained is
// if it only appears in "associated types" in the
// input. See #47511 for an example. In this case,
// though we can easily give a hint that ought to be
// relevant.
err.note(
"lifetimes appearing in an associated type are not considered constrained",
);
}
err.emit();
.

@rust-highfive
Copy link
Collaborator

r? @davidtwco

(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 Jul 23, 2020
@smmalis37 smmalis37 changed the title Don't ICE on unconstrained lifetimes inside associated types. Don't ICE on unconstrained anonymous lifetimes inside associated types. Jul 23, 2020
@davidtwco
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jul 23, 2020

📌 Commit bbaab63 has been approved by davidtwco

@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 Jul 23, 2020
@bors
Copy link
Contributor

bors commented Jul 23, 2020

⌛ Testing commit bbaab63 with merge e9d67a3cd88b7a8350112e69507668a7c71ac50d...

@rust-log-analyzer
Copy link
Collaborator

The job dist-i686-msvc 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.

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 @rust-lang/infra. (Feature Requests)

@bors
Copy link
Contributor

bors commented Jul 23, 2020

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 23, 2020
@davidtwco
Copy link
Member

davidtwco commented Jul 23, 2020

@rust-lang/infra @rust-log-analyzer's snippet is empty in the above comment - the error seems spurious too.

@ehuss
Copy link
Contributor

ehuss commented Jul 23, 2020

@bors retry
rust-lang/cargo#8517

@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 Jul 23, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 24, 2020
Rollup of 12 pull requests

Successful merges:

 - rust-lang#74361 (Improve doc theme logo display)
 - rust-lang#74504 (Add right border bar to Dark and Light theme)
 - rust-lang#74572 (Internally unify rustc_deprecated and deprecated)
 - rust-lang#74601 (Clean up E0724 explanation)
 - rust-lang#74623 (polymorphize GlobalAlloc::Function)
 - rust-lang#74665 (Don't ICE on unconstrained anonymous lifetimes inside associated types.)
 - rust-lang#74666 (More BTreeMap test cases, some exposing undefined behaviour)
 - rust-lang#74669 (Fix typo)
 - rust-lang#74677 (Remove needless unsafety from BTreeMap::drain_filter)
 - rust-lang#74680 (Add missing backticks in diagnostics note)
 - rust-lang#74694 (Clean up E0727 explanation)
 - rust-lang#74703 (Fix ICE while building MIR with type errors)

Failed merges:

r? @ghost
@bors bors merged commit 1f6d5ce into rust-lang:master Jul 24, 2020
@smmalis37 smmalis37 deleted the issue-62200 branch July 25, 2020 00:11
@cuviper cuviper added this to the 1.47.0 milestone May 2, 2024
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.

Internal compiler error anonymous bound region BrAnon(0) in binding but not trait ref
7 participants