Skip to content

Filter out intrinsics if we have other import candidates to suggest #97822

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

Merged

Conversation

compiler-errors
Copy link
Member

Fixes #97618

Also open to just sorting these candidates to be last. Pretty easy to modify the code to do that, too.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 7, 2022
@rust-highfive
Copy link
Contributor

r? @oli-obk

(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 Jun 7, 2022
@compiler-errors compiler-errors force-pushed the hesitate-to-suggest-intrinsics branch from 5c9f012 to ab0938d Compare June 7, 2022 08:08
Comment on lines +403 to +404
let path = path_names_to_string(&sugg.path);
path.starts_with("core::intrinsics::") || path.starts_with("std::intrinsics::")
Copy link
Contributor

Choose a reason for hiding this comment

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

You could add a #[diagnostic_item] attribute to the intrinsics extern block and check that the parent of the suggestion is not that specific diagnostic item.

Copy link
Member Author

Choose a reason for hiding this comment

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

do I have access to diagnostic items in rustc_resolve? i don't have a tcx here, i don't think.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh right :D

@oli-obk
Copy link
Contributor

oli-obk commented Jun 13, 2022

just plain filtering them out sgtm

@oli-obk
Copy link
Contributor

oli-obk commented Jun 14, 2022

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jun 14, 2022

📌 Commit ab0938d has been approved by oli-obk

@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 14, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jun 14, 2022
…-intrinsics, r=oli-obk

Filter out intrinsics if we have other import candidates to suggest

Fixes rust-lang#97618

Also open to just sorting these candidates to be last. Pretty easy to modify the code to do that, too.
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Jun 14, 2022
…-intrinsics, r=oli-obk

Filter out intrinsics if we have other import candidates to suggest

Fixes rust-lang#97618

Also open to just sorting these candidates to be last. Pretty easy to modify the code to do that, too.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 15, 2022
Rollup of 7 pull requests

Successful merges:

 - rust-lang#97822 (Filter out intrinsics if we have other import candidates to suggest)
 - rust-lang#98026 (Move some tests to more reasonable directories)
 - rust-lang#98067 (compiler: remove unused deps)
 - rust-lang#98078 (Use unchecked mul to compute slice sizes)
 - rust-lang#98083 (Rename rustc_serialize::opaque::Encoder as MemEncoder.)
 - rust-lang#98087 (Suggest adding a `#[macro_export]` to a private macro)
 - rust-lang#98113 (Fix misspelling of "constraint" as "contraint")

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 0ee1504 into rust-lang:master Jun 15, 2022
@rustbot rustbot added this to the 1.63.0 milestone Jun 15, 2022
@compiler-errors compiler-errors deleted the hesitate-to-suggest-intrinsics branch August 11, 2023 20:02
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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

E0425: Don't recommend the use of intrinsics first
5 participants