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

Use Ancestory to check default fn in const impl instead of comparing idents #89471

Merged
merged 2 commits into from
Oct 12, 2021

Conversation

@rust-highfive
Copy link
Collaborator

r? @cjgillot

(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 2, 2021
@cjgillot
Copy link
Contributor

cjgillot commented Oct 2, 2021

Using Symbols completely ignores macro hygiene. In which extent can it be ignored? How does rustc_typeck check impls are complete?

@nbdd0121 nbdd0121 force-pushed the const3 branch 2 times, most recently from bdb99dd to 7d4d536 Compare October 2, 2021 21:49
@nbdd0121
Copy link
Contributor Author

nbdd0121 commented Oct 2, 2021

I was under the impression that method names are not hygenic, but then I realized it not be true for macro 2.0.

So a proper comparision would involve calling tcx.hygienic_eq. The typeck code uses Ancestory to find the defining node of a particular method (which internally uses tcx.hygienic_eq), so I updated the code to use Ancestory as well.

@nbdd0121 nbdd0121 changed the title Compare symbol instead ident when checking default fn in const impl Use Ancestory to check default fn in const impl instead of comparing idents Oct 4, 2021
Comment on lines 37 to 47
macro_rules! impl_tr {
($ty: ty) => {
impl const Tr for $ty {
fn req(&self) {}
fn prov(&self) {}
}
}
}

impl_tr!(u64);

Copy link
Member

Choose a reason for hiding this comment

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

Can you separate this into another ui test? Having passing code and failing code in the same file does not seem like a good idea to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is an impl const Tr for u8 above already, which is a passing test. Should I split that out as well?

Copy link
Member

Choose a reason for hiding this comment

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

Yes. I don't know why I included that in the failing test at the time...

@fee1-dead
Copy link
Member

r? @fee1-dead

@rust-highfive rust-highfive assigned fee1-dead and unassigned cjgillot Oct 11, 2021
@fee1-dead
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Oct 11, 2021

📌 Commit 0a03f8c has been approved by fee1-dead

@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 11, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 11, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 12, 2021
…askrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#89471 (Use Ancestory to check default fn in const impl instead of comparing idents)
 - rust-lang#89643 (Fix inherent impl overlap check.)
 - rust-lang#89651 (Add `Poll::ready` and revert stabilization of `task::ready!`)
 - rust-lang#89675 (Re-use TypeChecker instead of passing around some of its fields )
 - rust-lang#89710 (Add long explanation for error E0482)
 - rust-lang#89756 (Greatly reduce amount of debuginfo compiled for bootstrap itself)
 - rust-lang#89760 (Remove hack ignoring unused attributes for stage 0 std)
 - rust-lang#89772 (Fix function-names test for GDB 10.1)
 - rust-lang#89785 (Fix ICE when compiling nightly std/rustc on beta compiler)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 412301b into rust-lang:master Oct 12, 2021
@rustbot rustbot added this to the 1.57.0 milestone Oct 12, 2021
@nbdd0121 nbdd0121 deleted the const3 branch October 13, 2021 19:29
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.

6 participants