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

Fix extern prelude failure in rustdoc #50617

Merged
merged 1 commit into from
Jun 12, 2018

Conversation

GuillaumeGomez
Copy link
Member

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 10, 2018
@QuietMisdreavus
Copy link
Member

This sounds like it could be a bug in the way this error is handled, not necessarily something that we would need to hack around. (And if we do need to patch it specifically for rustdoc, i would prefer using the actually_rustdoc flag instead of adding a new parameter.)

@Manishearth What do you know about the extern_prelude feature? The intra-links seem to have an awkward interaction with it.

@Manishearth
Copy link
Member

Well, actually_rustdoc doesn't handle the difference between resolution that rustdoc has to do for compilation vs resolution for intra doc links.

@QuietMisdreavus
Copy link
Member

Hmm, that's a good point, since this PR currently only enables the setting after the rest of the crate has passed resolution.

Still, i'm wondering whether there's a "proper" fix that's not "disable this check during intra-link resolution". What's actually going on here?

@Manishearth
Copy link
Member

Actually the proper fix is make it such that we hit that call with record_used=true, since record_used is also "is this a speculative resolution" which is true in this case. Perhaps rename the parameter while you're at it.

Elsewhere I've proposed a more coherent abstraction for paths that also includes speculation but it's currently stalled on a decision from compiler folks think.

@bors
Copy link
Contributor

bors commented May 13, 2018

☔ The latest upstream changes (presumably #50235) made this pull request unmergeable. Please resolve the merge conflicts.

@pietroalbini
Copy link
Member

Ping from triage @QuietMisdreavus! This PR needs your review.

@QuietMisdreavus
Copy link
Member

I think we still needed to discuss what it would take to get to the solution @Manishearth mentioned. I'm not a fan of adding a new flag just to toss it into an existing if-clause somewhere.

@GuillaumeGomez
Copy link
Member Author

Me neither so an alternative solution would come in handy.

@TimNN
Copy link
Contributor

TimNN commented May 29, 2018

@QuietMisdreavus / @GuillaumeGomez: How do you plan to move forward with this PR?

@GuillaumeGomez
Copy link
Member Author

We haven't talked about it since then (rustfest). We will come back to it.

@pietroalbini pietroalbini added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 4, 2018
@Mark-Simulacrum
Copy link
Member

Mark-Simulacrum commented Jun 9, 2018

For when this is ready to go, @bors p=1

We should also make sure to backport this if necessary -- I've put the related issue on the tracking milestone (edit: to be clear, for now it's not necessary, but this may slip into beta).

@GuillaumeGomez
Copy link
Member Author

Should we merge this meanwhile writing a better version?

@QuietMisdreavus
Copy link
Member

Reading over this again, i'm willing to have the temp flag (even though i'm concerned it may not stay temporary). However, the location of the check should probably be moved. Right now, what this is doing is universally enabling the extern_prelude feature for every user of type-links, whether or not they actually intended for it, by bypassing the location where the error would have been emitted. Do we want this? It seems to me like the existing feature check is kinda late in the flow.

In fact, reading this over again, it looks like we can bypass the need for the new flag by moving the feature-flag check. Would it be possible to reconfigure this so that the block with self.extern_prelude.contains(&ident.name) doesn't get executed at all if the feature flag is absent? Or use that inner check to set some indicator and emit the error afterward? We can use the ignore_extern_prelude_feature check to silence the error then.

I've changed my mind a few times while writing this, but basically i want to make sure we don't eagerly use the extern_prelude feature if the crate doesn't have the feature flag set. Right now it will use it regardless.

@petrochenkov
Copy link
Contributor

Temporary flag to avoid a feature gate error is okay, but I'd like to avoid this:

don't eagerly use the extern_prelude feature if the crate doesn't have the feature flag set.

We did the breaking change once in #49789 making sure it caused no regressions and now people can't write code that would conflict with extern prelude when it's stabilized.
If extern prelude is completely ignored if feature(extern_prelude) is not specified, then we are opening one more time window for people to write such code that will be broken later.

@QuietMisdreavus
Copy link
Member

@petrochenkov I'm not sure what you're suggesting. Are you wanting to keep this PR as-is, or make it do something different?

@petrochenkov
Copy link
Contributor

"As is" LGTM.

@QuietMisdreavus
Copy link
Member

Works for me! I was worried about exposing the feature more widely than it otherwise would have been, but if you're worried about breaking more code when it's fully stabilized, i won't hold it up. Thanks for commenting!

@bors r+

@bors
Copy link
Contributor

bors commented Jun 11, 2018

📌 Commit 27db90a has been approved by QuietMisdreavus

@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 Jun 11, 2018
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Jun 11, 2018
…r=QuietMisdreavus

Fix extern prelude failure in rustdoc

Fixes rust-lang#50561.

r? @QuietMisdreavus
bors added a commit that referenced this pull request Jun 11, 2018
Rollup of 4 pull requests

Successful merges:

 - #50617 (Fix extern prelude failure in rustdoc)
 - #51442 ([futures] add a few blanket impls to std)
 - #51498 (Make parse_ident public)
 - #51502 (Make parse_seq_to_end and parse_path public)

Failed merges:
@bors
Copy link
Contributor

bors commented Jun 11, 2018

🔒 Merge conflict

@bors bors removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jun 11, 2018
@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 11, 2018
@GuillaumeGomez
Copy link
Member Author

Rebased (and no conflicts of course...).

@bors: r=QuietMisdreavus

@bors
Copy link
Contributor

bors commented Jun 11, 2018

📌 Commit dadfa13 has been approved by QuietMisdreavus

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 11, 2018
@bors
Copy link
Contributor

bors commented Jun 11, 2018

⌛ Testing commit dadfa13 with merge f9944fd...

bors added a commit that referenced this pull request Jun 11, 2018
…reavus

Fix extern prelude failure in rustdoc

Fixes #50561.

r? @QuietMisdreavus
@bors
Copy link
Contributor

bors commented Jun 12, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: QuietMisdreavus
Pushing f9944fd to master...

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.

9 participants