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

gccrs: add test case to show method resolution is working #3234

Merged
merged 1 commit into from
Nov 1, 2024

Conversation

philberty
Copy link
Member

The issue here was that the impl block for Cell defines that T must have the bound of Copy implemented. But simultaneously if you do an deref you get direct access to the unsafe cell which also defines a get method so these are two valid ways of accessing the method in question but when Copy is implementet the simplest case is prefered so it does resolve to Cell::get.

Fixes #3033

gcc/testsuite/ChangeLog:

* rust/compile/nr2/exclude:
* rust/compile/issue-3033.rs: New test.

The issue here was that the impl block for Cell<T> defines that T must have
the bound of Copy implemented. But simultaneously if you do an deref
you get direct access to the unsafe cell which also defines a get method
so these are two valid ways of accessing the method in question but
when Copy is implementet the simplest case is prefered so it does resolve
to Cell<T>::get.

Fixes #3033

gcc/testsuite/ChangeLog:

	* rust/compile/nr2/exclude: nr can't handle this
	* rust/compile/issue-3033.rs: New test.

Signed-off-by: Philip Herron <[email protected]>
@philberty philberty force-pushed the phil/method-resolution branch from 4ba8f23 to ee06ea3 Compare November 1, 2024 14:11
@philberty philberty added this pull request to the merge queue Nov 1, 2024
Merged via the queue into master with commit c5ae11b Nov 1, 2024
12 checks passed
@philberty philberty deleted the phil/method-resolution branch November 1, 2024 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Invalid "duplicate definitions" error in Cell<T> implementation
2 participants