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

Add a method to the arena to promote objects to it if they implement LocalDrop #56448

Closed
wants to merge 2 commits into from

Conversation

Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Dec 3, 2018

A cleaned up part from #56382.

Uses PROC MACROS! cc @eddyb

r? @michaelwoerister

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 3, 2018
@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@eddyb eddyb added S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 3, 2018
@eddyb
Copy link
Member

eddyb commented Dec 3, 2018

Blocked on #56447.


/// A type which does not look at references in its destructor
/// but only owned data
pub unsafe trait LocalDrop {
Copy link
Member

Choose a reason for hiding this comment

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

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:1d5bce8b:start=1543831341297730946,finish=1543831396049658308,duration=54751927362
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-5.0
---
[00:04:55]    Compiling crossbeam-deque v0.2.0
[00:04:55]    Compiling syn v0.15.21
[00:04:58]    Compiling rustc-rayon v0.1.1
[00:05:11]    Compiling synstructure v0.10.1
[00:05:18]    Compiling rustc_local_drop_derive v0.1.0 (/checkout/src/librustc_local_drop_derive)
[00:05:24]    Compiling arena v0.0.0 (/checkout/src/libarena)
[00:05:25]    Compiling syntax_pos v0.0.0 (/checkout/src/libsyntax_pos)
[00:05:29]    Compiling rustc_errors v0.0.0 (/checkout/src/librustc_errors)
[00:06:47]    Compiling syntax_ext v0.0.0 (/checkout/src/libsyntax_ext)
---
[00:21:13]    Compiling flate2 v1.0.3
[00:21:13]    Compiling crossbeam-deque v0.2.0
[00:21:17]    Compiling rustc-rayon v0.1.1
[00:21:29]    Compiling synstructure v0.10.1
[00:21:36]    Compiling rustc_local_drop_derive v0.1.0 (/checkout/src/librustc_local_drop_derive)
[00:21:41]    Compiling arena v0.0.0 (/checkout/src/libarena)
[00:21:42]    Compiling syntax_pos v0.0.0 (/checkout/src/libsyntax_pos)
[00:21:46]    Compiling rustc_errors v0.0.0 (/checkout/src/librustc_errors)
[00:23:12]    Compiling syntax_ext v0.0.0 (/checkout/src/libsyntax_ext)
---
travis_time:start:test_codegen
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:53:19] 
[00:53:19] running 119 tests
[00:53:21] i..ii...iii..iiii.....i...i.........i..iii.............i.....i.....ii...i..i.ii..............i...ii. 100/119
[00:53:22] .ii.i.....iiii.....
[00:53:22] 
[00:53:22]  finished in 3.194
[00:53:22] travis_fold:end:test_codegen

---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:53:35] 
[00:53:35] running 118 tests
[00:53:58] .iiiii...i.....i..i...i..i.i..i.i..i.....i..i....i..........iiii.........i.i....i...i.......ii.i.i.i 100/118
[00:54:01] ......iii.i.....ii
[00:54:01] 
[00:54:01]  finished in 26.240
[00:54:01] travis_fold:end:test_debuginfo

---
[01:14:33] travis_fold:end:test_stage1-rustc_lint

[01:14:33] travis_time:end:test_stage1-rustc_lint:start=1543835877680908835,finish=1543835877937200137,duration=256291302

[01:14:33] travis_fold:start:test_stage1-rustc_local_drop_derive
travis_time:start:test_stage1-rustc_local_drop_derive
Testing rustc_local_drop_derive stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:14:33]    Compiling rustc_local_drop_derive v0.1.0 (/checkout/src/librustc_local_drop_derive)
[01:14:33]      Running build/x86_64-unknown-linux-gnu/stage1-rustc/release/deps/rustc_local_drop_derive-2c2003ab05d45dcc
[01:14:33] 
[01:14:33] running 0 tests
[01:14:33] 
---
[01:14:34] 
[01:14:34]  finished in 0.509
[01:14:34] travis_fold:end:test_stage1-rustc_local_drop_derive

[01:14:34] travis_time:end:test_stage1-rustc_local_drop_derive:start=1543835877939104787,finish=1543835878448616685,duration=509511898
[01:14:34] travis_fold:start:test_stage1-rustc_metadata
travis_time:start:test_stage1-rustc_metadata
Testing rustc_metadata stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:14:34]    Compiling rustc_metadata v0.0.0 (/checkout/src/librustc_metadata)
---
[01:17:56] running 192 tests
[01:18:19] .................................................................................................... 100/192
[01:19:17] ..........................................................................................Ftest [run-make] run-make-fulldeps/long-linker-command-lines has been running for over 60 seconds
d_core is an unstable crate
[01:20:03] verifying if memoffset is an unstable crate
[01:20:03] verifying if ena is an unstable crate
[01:20:03] verifying if proc_macro2 is an unstable crate
[01:20:03] verifying if num_cpus is an unstable crate
[01:20:03] verifying if crossbeam_utils is an unstable crate
[01:20:03] verifying if rustc_demangle is an unstable crate
[01:20:03] verifying if scoped_tls is an unstable crate
[01:20:03] verifying if crossbeam_deque is an unstable crate
[01:20:03] verifying if datafrog is an unstable crate
[01:20:03] verifying if rustc_serialize is an unstable crate
[01:20:03] verifying if rustc_msan is an unstable crate
[01:20:03] verifying if libc is an unstable crate
[01:20:03] verifying if panic_abort is an unstable crate
[01:20:03] verifying if log_settings is an unstable crate
[01:20:03] verifying if rls_data is an unstable crate
[01:20:03] verifying if memmap is an unstable crate
[01:20:03] verifying if build_helper is an unstable crate
[01:20:03] verifying if build_helper is an unstable crate
[01:20:03] crate build_helper "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbuild_helper-fc70adc6582f8056.rlib" is not unstable
[01:20:03] error[E0514]: found crate `build_helper` compiled by an incompatible version of rustc
[01:20:03]  --> <anon>:1:1
[01:20:03] 1 | extern crate build_helper;
[01:20:03]   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
[01:20:03]   |
[01:20:03]   |
[01:20:03]   = help: please recompile that crate using this compiler (rustc 1.32.0-dev)
[01:20:03]   = note: the following crate versions were found:
[01:20:03]       verifying if panic_unwind is an unstable crate
[01:20:03] verifying if jobserver is an unstable crate
[01:20:03] verifying if atty is an unstable crate
[01:20:03] verifying if atty is an unstable crate
[01:20:03] verifying if lock_api is an unstable crate
[01:20:03] verifying if cmake is an unstable crate
[01:20:03] crate cmake "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcmake-afb19a8695d09bc4.rlib" is not unstable
[01:20:03] error[E0514]: found crate `cmake` compiled by an incompatible version of rustc
[01:20:03]  --> <anon>:1:1
[01:20:03] 1 | extern crate cmake;
[01:20:03]   | ^^^^^^^^^^^^^^^^^^^
[01:20:03]   |
[01:20:03]   |
[01:20:03]   = help: please recompile that crate using this compiler (rustc 1.32.0-dev)
[01:20:03]   = note: the following crate versions were found:
[01:20:03]           crate `cmake` compiled by rustc 1.31.0-beta.1 (2824a67b0 2018-10-29): /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcmake-afb19a8695d09bc4.rlib
[01:20:03] error: aborting due to previous error
[01:20:03] 
[01:20:03] For more information about this error, try `rustc --explain E0514`.
[01:20:03] 
[01:20:03] 
[01:20:03] 
[01:20:03] verifying if bitflags is an unstable crate
[01:20:03] verifying if chalk_macros is an unstable crate
[01:20:03] verifying if unwind is an unstable crate
[01:20:03] verifying if syn is an unstable crate
[01:20:03] verifying if cfg_if is an unstable crate
[01:20:03] verifying if env_logger is an unstable crate
[01:20:03] verifying if alloc is an unstable crate
[01:20:nknown-linux-gnu/stage2/bin/rustc" "--rustdoc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" "--src-base" "/checkout/src/test/run-make-fulldeps" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "run-make" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-5.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "5.0.0\n" "--system-llvm" "--cc" "cc" "--cxx" "c++" "--cflags" "-ffunction-sections -fdata-sections -fPIC -m64" "--llvm-components" "aarch64 aarch64asmparser aarch64asmprinter aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils all all-targets amdgpu amdgpuasmparser amdgpuasmprinter amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armasmprinter armcodegen armdesc armdisassembler arminfo asmparser asmprinter binaryformat bitreader bitwriter bpf bpfasmprinter bpfcodegen bpfdesc bpfdisassembler bpfinfo codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfomsf debuginfopdb demangle dlltooldriver engine executionengine globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader lanai lanaiasmparser lanaiasmprinter lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mcdisassembler mcjit mcparser mips mipsasmparser mipsasmprinter mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmprinter msp430codegen msp430desc msp430info native nativecodegen nvptx nvptxasmprinter nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit passes powerpc powerpcasmparser powerpcasmprinter powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata runtimedyld scalaropts selectiondag sparc sparcasmparser sparcasmprinter sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzasmprinter systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target transformutils vectorize x86 x86asmparser x86asmprinter x86codegen x86desc x86disassembler x86info x86utils xcore xcoreasmprinter xcorecodegen xcoredesc xcoredisassembler xcoreinfo" "--llvm-cxxflags" "-I/usr/lib/llvm-5.0/include -std=c++0x -fuse-ld=gold -Wl,--no-keep-files-mapped -Wl,--no-map-whole-files -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O2 -DNDEBUG -g1  -fno-exceptions -DLLVM_BUILD_GLOBAL_ISEL -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS" "--ar" "ar" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:20:03] 
[01:20:03] 
[01:20:03] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:20:03] Build completed unsuccessfully in 0:36:50
[01:20:03] Build completed unsuccessfully in 0:36:50
[01:20:03] make: *** [check] Error 1
[01:20:03] Makefile:58: recipe for target 'check' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:1e3c2b08
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Mon Dec  3 11:23:28 UTC 2018

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@michaelwoerister
Copy link
Member

@Zoxc, can you give some explanation and reasoning of the concepts any changes here? What is LocalDrop and why do we need it? What is "promotion" in this context?

@Zoxc
Copy link
Contributor Author

Zoxc commented Dec 7, 2018

Promotion would be allocating types with destructors on the dropless arena by deferring execution of their destructors to when the arena is dropped. We can only allow that for types which do not access other promoted objects during destruction, since those promoted object may have been destroyed earlier. Such allowed types implement LocalDrop. Types without a Drop impl trivially have that property and this allows you to #[derive] that fact.

@eddyb
Copy link
Member

eddyb commented Dec 7, 2018

The point of the dropless arena is that, well, it has no destructors, simplifying a few things. You can add separate regular typed arenas for things you can't make dropless.

@bors
Copy link
Contributor

bors commented Dec 7, 2018

☔ The latest upstream changes (presumably #56502) made this pull request unmergeable. Please resolve the merge conflicts.

@michaelwoerister
Copy link
Member

To be honest, that sounds a bit too magical for my taste. cc @rust-lang/compiler

@pnkfelix
Copy link
Member

@eddyb wrote:

The point of the dropless arena is that, well, it has no destructors, simplifying a few things. You can add separate regular typed arenas for things you can't make dropless.

I want to clarify the point eddyb is making here.

@eddyb, are you asking for @Zoxc to revise this PR to get rid of LocalDrop, and instead just distinguish between a dropless arena which would presumably only accept ... things that are Copy?

Or is your point just to explain what the purpose of LocalDrop is, and when you said "no destructors", you meant something more nuanced, like (perhaps) "no destructors with non-trivial side-effects -- i.e. no destructors that touch anything except for data they own that is also LocalDrop" ?

@Zoxc Zoxc closed this Jan 7, 2019
@eddyb
Copy link
Member

eddyb commented Jan 30, 2019

@pnkfelix The former, except it's not a Copy bound but an assert!(!needs_drop::<T>()).

bors added a commit that referenced this pull request Mar 31, 2019
Introduce an arena type which may be used to allocate a list of types with destructors

You can also specify that you want deserializers for `&'tcx [T]` and `&'tcx T` for a type in the list, which will allocate those using the arena.

Based on #59517 and #59533. Look at the last commit for the interesting changes.

An alternative to #56448. cc @michaelwoerister @eddyb

r? @oli-obk
bors added a commit that referenced this pull request Apr 12, 2019
Introduce an arena type which may be used to allocate a list of types with destructors

You can also specify that you want deserializers for `&'tcx [T]` and `&'tcx T` for a type in the list, which will allocate those using the arena.

Based on #59517 and #59533. Look at the last commit for the interesting changes.

An alternative to #56448. cc @michaelwoerister @eddyb

r? @oli-obk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants