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 the error-causing suggestion of 'borrowed_box' #6200

Merged
merged 1 commit into from
Oct 30, 2020

Conversation

rail-rain
Copy link
Contributor

Fixes #3128

Fix the suggestion of 'borrowed_box', which causes a syntax error because it misses necessary parentheses.


changelog: Fix the error-causing suggestion of 'borrowed_box'

@rust-highfive
Copy link

r? @phansch

(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 21, 2020
@bors
Copy link
Collaborator

bors commented Oct 24, 2020

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

Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:

@rustbot modify labels: +S-waiting-on-review -S-waiting-on-author

fix the error-causing suggestion of 'borrowed_box',
which missed parentheses and was ambiguous.
Copy link
Member

@phansch phansch left a comment

Choose a reason for hiding this comment

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

r=me with typo fixed

@@ -721,6 +734,21 @@ fn is_any_trait(t: &hir::Ty<'_>) -> bool {
false
}

fn get_bounds_if_impl_trait<'tcx>(cx: &LateContext<'tcx>, qpath: &QPath<'_>, id: HirId) -> Option<GenericBounds<'tcx>> {
Copy link
Member

Choose a reason for hiding this comment

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

A typo, it seems?

Suggested change
fn get_bounds_if_impl_trait<'tcx>(cx: &LateContext<'tcx>, qpath: &QPath<'_>, id: HirId) -> Option<GenericBounds<'tcx>> {
fn get_bounds_of_impl_trait<'tcx>(cx: &LateContext<'tcx>, qpath: &QPath<'_>, id: HirId) -> Option<GenericBounds<'tcx>> {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm afraid not because it returns None if the qpath is not an impl trait, and actually checking whether the qpath is an impl trait is one of the main role of the function. I named it so hoping it looks similar to get_if_local. If it's confusing, something like get_bounds_provided_impl_trait might be more suitable?

@phansch phansch added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Oct 29, 2020
@phansch
Copy link
Member

phansch commented Oct 30, 2020

@bors r+ thanks!

@bors
Copy link
Collaborator

bors commented Oct 30, 2020

📌 Commit e568a32 has been approved by phansch

@bors
Copy link
Collaborator

bors commented Oct 30, 2020

⌛ Testing commit e568a32 with merge 74d8fbb...

@bors
Copy link
Collaborator

bors commented Oct 30, 2020

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: phansch
Pushing 74d8fbb to master...

@bors bors merged commit 74d8fbb into rust-lang:master Oct 30, 2020
@rail-rain rail-rain deleted the borrowed_box_invalid_sugg branch October 30, 2020 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

borrowed_box gives syntactically invalid suggestion
4 participants