Skip to content

Conversation

@edi33416
Copy link
Contributor

Remove code duplication by using the druntime core.lifetime implementation.

This depends on this PR.

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @edi33416! 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 annotated coverage diff directly on GitHub with CodeCov's browser extension
  • 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

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

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 "master + phobos#6881"

std/conv.d Outdated
assert(iss.ii == [1, 2]);
}
/// ditto
T emplace(T, Args...)(T chunk, auto ref Args args);
Copy link
Member

Choose a reason for hiding this comment

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

Don't forget to include the template constraints for the docs - e.g. if (is(T == class)), IIRC, for this overload.

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 don't think I can add the template constraint in the function declaration. I tried to do that, but I couldn't get it to compile.

Copy link
Member

Choose a reason for hiding this comment

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

Since this will only exist when building the docs, you can use a full function definition with a trivial body - e.g. { return chunk; }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ZombineDev added the template constraints for the docs.

@PetarKirov
Copy link
Member

On the auto tester there were a couple of OOM failures which I restarted, but also one failure on Windows:

../dmd/generated/windows/release/32/dmd.exe -lib -ofphobos.lib -Xfphobos.json -conf= -O -release -w -de -dip25 -I../druntime\import std\stdio.d  std\string.d  std\format.d  std\file.d  std\array.d  std\functional.d  std\path.d  std\outbuffer.d  std\utf.d  std\csv.d  std\math.d  std\complex.d  std\numeric.d  std\bigint.d  std\bitmanip.d  std\typecons.d  std\uni.d  std\base64.d  std\ascii.d  std\demangle.d  std\uri.d  std\mmfile.d  std\getopt.d  std\signals.d  std\meta.d  std\typetuple.d  std\traits.d  std\encoding.d  std\xml.d  std\random.d  std\exception.d  std\compiler.d  std\system.d  std\concurrency.d  std\uuid.d  std\variant.d  std\zlib.d  std\socket.d  std\conv.d  std\zip.d  std\stdint.d  std\json.d  std\parallelism.d  std\mathspecial.d  std\process.d  std\algorithm\package.d  std\algorithm\comparison.d  std\algorithm\iteration.d  std\algorithm\mutation.d  std\algorithm\searching.d  std\algorithm\setops.d  std\algorithm\sorting.d  std\algorithm\internal.d  std\container\array.d  std\container\binaryheap.d  std\container\dlist.d  std\container\rbtree.d  std\container\slist.d  std\container\util.d  std\container\package.d  std\datetime\date.d  std\datetime\interval.d  std\datetime\package.d  std\datetime\stopwatch.d  std\datetime\systime.d  std\datetime\timezone.d  std\digest\crc.d  std\digest\sha.d  std\digest\md.d  std\digest\ripemd.d  std\digest\digest.d  std\digest\hmac.d  std\digest\murmurhash.d  std\digest\package.d  std\net\isemail.d  std\net\curl.d  std\range\package.d  std\range\primitives.d  std\range\interfaces.d  std\regex\internal\ir.d  std\regex\package.d  std\regex\internal\parser.d  std\regex\internal\tests.d  std\regex\internal\tests2.d  std\regex\internal\backtracking.d  std\regex\internal\thompson.d  std\regex\internal\kickstart.d  std\regex\internal\generator.d    std\windows\registry.d  std\windows\syserror.d  std\windows\charset.d    std\internal\cstring.d  std\internal\unicode_tables.d  std\internal\unicode_comp.d  std\internal\unicode_decomp.d  std\internal\unicode_grapheme.d  std\internal\unicode_norm.d  std\internal\scopebuffer.d  std\internal\test\dummyrange.d  std\internal\test\range.d  std\internal\digest\sha_SSSE3.d  std\internal\math\biguintcore.d  std\internal\math\biguintnoasm.d  std\internal\math\biguintx86.d  std\internal\math\gammafunction.d  std\internal\math\errorfunction.d  std\internal\windows\advapi32.d  std\experimental\all.d std\experimental\checkedint.d std\experimental\typecons.d  std\experimental\allocator\common.d  std\experimental\allocator\gc_allocator.d  std\experimental\allocator\mallocator.d  std\experimental\allocator\mmap_allocator.d  std\experimental\allocator\showcase.d  std\experimental\allocator\typed.d  std\experimental\allocator\package.d  std\experimental\allocator\building_blocks\affix_allocator.d  std\experimental\allocator\building_blocks\aligned_block_list.d  std\experimental\allocator\building_blocks\allocator_list.d  std\experimental\allocator\building_blocks\ascending_page_allocator.d  std\experimental\allocator\building_blocks\bitmapped_block.d  std\experimental\allocator\building_blocks\bucketizer.d  std\experimental\allocator\building_blocks\fallback_allocator.d  std\experimental\allocator\building_blocks\free_list.d  std\experimental\allocator\building_blocks\free_tree.d  std\experimental\allocator\building_blocks\kernighan_ritchie.d  std\experimental\allocator\building_blocks\null_allocator.d  std\experimental\allocator\building_blocks\quantizer.d  std\experimental\allocator\building_blocks\region.d  std\experimental\allocator\building_blocks\scoped_allocator.d  std\experimental\allocator\building_blocks\segregator.d  std\experimental\allocator\building_blocks\stats_collector.d  std\experimental\allocator\building_blocks\package.d  std\experimental\logger\core.d  std\experimental\logger\filelogger.d  std\experimental\logger\multilogger.d  std\experimental\logger\nulllogger.d  std\experimental\logger\package.d    etc\c\zlib.d  etc\c\curl.d  etc\c\sqlite3.d  etc\c\odbc\sql.d  etc\c\odbc\sqlext.d  etc\c\odbc\sqltypes.d  etc\c\odbc\sqlucode.d  etc\c\zlib\zlib.lib ../druntime/lib/druntime.lib
../druntime\import\core\internal\lifetime.d(75): Error: static assert:  "BinaryWriterImpl!true cannot be emplaced from (File)."
../druntime\import\core\lifetime.d(61):        instantiated from here: `emplaceRef!(BinaryWriterImpl!true, BinaryWriterImpl!true, File)`
std\typecons.d(6192):        instantiated from here: `emplace!(BinaryWriterImpl!true, File)`
std\typecons.d(6267):        instantiated from here: `initialize!(File)`
std\stdio.d(3174):        instantiated from here: `__ctor!(File)`

On BuildKite there the following two errors:

generated/linux/release/64/benchmark.o:benchmark/runbench.d:function _D3std4conv__T7emplaceTCQw5regex8internal12backtracking__T19BacktrackingMatcherTaTSQDdQCiQCf2ir__T5InputTaZQjZQCaTxSQEkQDpQDmQBh__T5RegexTaZQjTQCjTAvZQFgFNaQjKxQBtQDdQtZQFq: error: undefined reference to '_D3std4conv16testEmplaceChunkFNaNbNiNfAvmmZv'
generated/linux/release/64/benchmark.o:benchmark/runbench.d:function _D3std4conv__T7emplaceTCQw5regex8internal8thompson__T15ThompsonMatcherTaTSQCuQBzQBw2ir__T5InputTaZQjZQBwTxSQEbQDgQDdQBh__T5RegexTaZQjTQCjTAvZQExFQhKxQBrQDbQrZQFf: error: undefined reference to '_D3std4conv16testEmplaceChunkFNaNbNiNfAvmmZv'
generated/linux/release/64/benchmark.o:benchmark/runbench.d:function _D3std4conv__T7emplaceTCQw5regex8internal12backtracking__T19BacktrackingMatcherTaTSQDdQCiQCf2ir__T5InputTaZQjZQCaTxSQEkQDpQDmQBh__T5RegexTaZQjTPFNeQEuZbTQCtTAvZQFqFNaQjKxQCdQBeQDqQwZQGd: error: undefined reference to '_D3std4conv16testEmplaceChunkFNaNbNiNfAvmmZv'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
posix.mak:330: recipe for target 'generated/linux/release/64/benchmark' failed

(when building the druntime benchmark, which uses phobos)

and:

Running DScanner
generated/dscanner-b51ee472fe29c05cc33359ab8de52297899131fe/dsc --config .dscanner.ini --styleCheck etc std -I.
std/conv.d(4309:29)[warn]: Parameter chunk is never used.
std/conv.d(4316:34)[warn]: Parameter chunk is never used.
std/conv.d(4323:35)[warn]: Parameter chunk is never used.
posix.mak:556: recipe for target 'dscanner' failed
make: *** [dscanner] Error 1

(simply style check warnings)

@RazvanN7
Copy link
Collaborator

This has been done in: #7745 . Closing.

@RazvanN7 RazvanN7 closed this Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants