Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
/ druntime Public archive

Comments

Make TempStringNoAlloc a template#2705

Merged
thewilsonator merged 1 commit intodlang:stablefrom
skoppe:arraycast-fix
Aug 6, 2019
Merged

Make TempStringNoAlloc a template#2705
thewilsonator merged 1 commit intodlang:stablefrom
skoppe:arraycast-fix

Conversation

@skoppe
Copy link
Contributor

@skoppe skoppe commented Jul 29, 2019

Fixes https://issues.dlang.org/show_bug.cgi?id=20088

Since the new __ArrayCast template hook, casting arrays is broken in betterC. The reason is that __ArrayCast indirectly depends on TempStringNoAlloc.get, which is not a template function and doesn't get linked in betterC.

@dlang-bot
Copy link
Contributor

dlang-bot commented Jul 29, 2019

Thanks for your pull request and interest in making D better, @skoppe! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
20088 blocker void[] cast unusable in betterC due to new __ArrayCast template

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "stable + druntime#2705"

@dlang-bot dlang-bot added the Bug Fix Include reference to corresponding bugzilla issue label Jul 29, 2019
@skoppe skoppe changed the base branch from master to stable July 29, 2019 11:58
@thewilsonator
Copy link
Contributor

Please add the test case from the bug report.

@skoppe skoppe force-pushed the arraycast-fix branch 2 times, most recently from 6ee5951 to b74211f Compare July 29, 2019 13:57
@PetarKirov
Copy link
Member

PetarKirov commented Jul 29, 2019

In Phobos we have the option to run @betterC unit tests, and I think we should set up something like that for druntime as well - see:
dlang/phobos#5952.
In the mean time, you can add a test to Phobos as well.
Nevermind, the test you added looks good.

@skoppe
Copy link
Contributor Author

skoppe commented Jul 29, 2019

In Phobos we have the option to run @betterC tests, and I think we should set up something like that for druntime as well. In the mean time, you can add a test to Phobos as well

Sure, but what would be the benefit? Plus, where do you want me to put it? Ok.

@wilzbach
Copy link
Contributor

wilzbach commented Aug 2, 2019

Test fails with:

generated/linux/release/64/test20088.o: In function `_D6object__T16onArrayCastErrorZQtFNaNbNiNeAyamQemZv':
src/test20088.d:(.text._D6object__T16onArrayCastErrorZQtFNaNbNiNeAyamQemZv[_D6object__T16onArrayCastErrorZQtFNaNbNiNeAyamQemZv]+0x5e): undefined reference to `_D4core8internal6string17TempStringNoAlloc__T3getZQfMFNaNbNiNjNfZAa'
src/test20088.d:(.text._D6object__T16onArrayCastErrorZQtFNaNbNiNeAyamQemZv[_D6object__T16onArrayCastErrorZQtFNaNbNiNeAyamQemZv]+0x9e): undefined reference to `_D4core8internal6string17TempStringNoAlloc__T3getZQfMFNaNbNiNjNfZAa'
collect2: error: ld returned 1 exit status

In Phobos we have the option to run @BetterC unit tests, and I think we should set up something like that for druntime as well - see:

@betterC should be a thing soon here as well (e.g. #2715).

@skoppe
Copy link
Contributor Author

skoppe commented Aug 2, 2019

Test fails with:

generated/linux/release/64/test20088.o: In function `_D6object__T16onArrayCastErrorZQtFNaNbNiNeAyamQemZv':
src/test20088.d:(.text._D6object__T16onArrayCastErrorZQtFNaNbNiNeAyamQemZv[_D6object__T16onArrayCastErrorZQtFNaNbNiNeAyamQemZv]+0x5e): undefined reference to `_D4core8internal6string17TempStringNoAlloc__T3getZQfMFNaNbNiNjNfZAa'
src/test20088.d:(.text._D6object__T16onArrayCastErrorZQtFNaNbNiNeAyamQemZv[_D6object__T16onArrayCastErrorZQtFNaNbNiNeAyamQemZv]+0x9e): undefined reference to `_D4core8internal6string17TempStringNoAlloc__T3getZQfMFNaNbNiNjNfZAa'
collect2: error: ld returned 1 exit status

Hmm, I see. Will look into it this weekend.

@skoppe skoppe changed the title Make TempStringNoAlloc.get a template Make TempStringNoAlloc a template Aug 4, 2019
@skoppe
Copy link
Contributor Author

skoppe commented Aug 5, 2019

@wilzbach I found the mistake. Some CI's are still red though, but it doesn't seem to be caused by my changes. Would it help if I rebase on stable again?

@wilzbach
Copy link
Contributor

wilzbach commented Aug 5, 2019

Would it help if I rebase on stable again?

Probably. Just tried this for you.

@thewilsonator
Copy link
Contributor

Appveyor is expected to fail on stable.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Bug Fix Include reference to corresponding bugzilla issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants