rust/src
Without Boats 06ede350c2 Add Wake trait for safe construction of Wakers.
Currently, constructing a waker requires calling the unsafe
`Waker::from_raw` API. This API requires the user to manually construct
a vtable for the waker themself - which is both cumbersome and very
error prone. This API would provide an ergonomic, straightforward and
guaranteed memory-safe way of constructing a waker.

It has been our longstanding intention that the `Waker` type essentially
function as an `Arc<dyn Wake>`, with a `Wake` trait as defined here. Two
considerations prevented the original API from being shipped as simply
an `Arc<dyn Wake>`:

- We want to support futures on embedded systems, which may not have an
  allocator, and in optimized executors for which this API may not be
  best-suited. Therefore, we have always explicitly supported the
  maximally-flexible (but also memory-unsafe) `RawWaker` API, and
  `Waker` has always lived in libcore.
- Because `Waker` lives in libcore and `Arc` lives in liballoc, it has
  not been feasible to provide a constructor for `Waker` from `Arc<dyn
  Wake>`.

Therefore, the Wake trait was left out of the initial version of the
task waker API.

However, as Rust 1.41, it is possible under the more flexible orphan
rules to implement `From<Arc<W>> for Waker where W: Wake` in liballoc.
Therefore, we can now define this constructor even though `Waker` lives
in libcore.

This PR adds these APIs:

- A `Wake` trait, which contains two methods
    - A required method `wake`, which is called by `Waker::wake`
    - A provided method `wake_by_ref`, which is called by
      `Waker::wake_by_ref` and which implementors can override if they
      can optimize this use case.
- An implementation of `From<Arc<W>> for Waker where W: Wake + Send +
  Sync + 'static`
- A similar implementation of `From<Arc<W>> for RawWaker`.
2020-03-23 15:44:58 +01:00
..
bootstrap Rollup merge of #70123 - cuviper:library-path, r=Mark-Simulacrum 2020-03-23 10:29:13 +01:00
build_helper
ci Rollup merge of #70159 - alexcrichton:update-wasi, r=pietroalbini 2020-03-23 10:29:14 +01:00
doc Update books 2020-03-16 19:09:54 -07:00
etc Test pretty printing more and fix overzealous type substitution 2020-03-21 14:03:09 +00:00
liballoc Add Wake trait for safe construction of Wakers. 2020-03-23 15:44:58 +01:00
libarena separate out an arena for HIR 2020-03-21 22:18:57 +01:00
libcore Auto merge of #69079 - CAD97:layout-of-ptr, r=RalfJung 2020-03-22 18:37:19 +00:00
libfmt_macros fix various typos 2020-03-06 15:19:31 +01:00
libgraphviz
libpanic_abort Simplify the try intrinsic by using a callback in the catch block 2020-03-05 17:36:50 +00:00
libpanic_unwind remove unused imports 2020-03-19 07:53:32 +01:00
libproc_macro Use min_specialization in libstd and libproc_macro 2020-03-15 13:23:03 +00:00
libprofiler_builtins Remove -ffreestanding from libprofiler_builtins because we do need the standard library 2020-03-18 15:55:26 -04:00
librustc Rollup merge of #70286 - RalfJung:no-experiments, r=petrochenkov 2020-03-23 10:29:18 +01:00
librustc_apfloat
librustc_ast Auto merge of #70296 - Centril:rollup-wvfmb3n, r=Centril 2020-03-23 06:02:34 +00:00
librustc_ast_lowering Auto merge of #70296 - Centril:rollup-wvfmb3n, r=Centril 2020-03-23 06:02:34 +00:00
librustc_ast_passes Rollup merge of #70032 - lcnr:issue69970, r=varkor 2020-03-21 13:06:40 +01:00
librustc_ast_pretty Don't prepend with space before paren 2020-03-17 18:29:20 +01:00
librustc_attr Other legacy -> macro_rules 2020-03-16 00:29:42 +03:00
librustc_builtin_macros Rollup merge of #70269 - matthiaskrgr:clippy_closures, r=Dylan-DPC 2020-03-23 04:26:15 +01:00
librustc_codegen_llvm Rollup merge of #69968 - eddyb:tupled-closure-captures, r=nikomatsakis 2020-03-23 10:29:11 +01:00
librustc_codegen_ssa Rollup merge of #70249 - lcnr:issue70125, r=eddyb 2020-03-23 04:26:13 +01:00
librustc_data_structures Rollup merge of #70269 - matthiaskrgr:clippy_closures, r=Dylan-DPC 2020-03-23 04:26:15 +01:00
librustc_driver Rollup merge of #69965 - mark-i-m:codegen-utils, r=eddyb 2020-03-21 08:51:14 +01:00
librustc_error_codes Rollup merge of #70270 - GuillaumeGomez:cleanup-e0449, r=Dylan-DPC 2020-03-23 04:26:16 +01:00
librustc_errors remove redundant closures (clippy::redundant_closure) 2020-03-22 12:43:19 +01:00
librustc_expand parse: nix new_sub_parser_from_file 2020-03-22 00:35:20 +01:00
librustc_feature remove redundant closures (clippy::redundant_closure) 2020-03-22 12:43:19 +01:00
librustc_fs_util
librustc_hir {rustc::hir::map -> rustc_hir}::definitions 2020-03-21 22:20:24 +01:00
librustc_incremental Rollup merge of #70092 - eddyb:hir-items-are-just-nodes, r=Zoxc 2020-03-21 08:51:19 +01:00
librustc_index Add requisite feature gates for const assert 2020-03-17 11:15:40 -07:00
librustc_infer Rollup merge of #69968 - eddyb:tupled-closure-captures, r=nikomatsakis 2020-03-23 10:29:11 +01:00
librustc_interface Auto merge of #70296 - Centril:rollup-wvfmb3n, r=Centril 2020-03-23 06:02:34 +00:00
librustc_lexer remove redundant returns (clippy::needless_return) 2020-03-20 20:23:03 +01:00
librustc_lint {rustc::hir::map -> rustc_hir}::definitions 2020-03-21 22:20:24 +01:00
librustc_llvm rustc_llvm: don't use -g when LLVM_NDEBUG is set. 2020-03-23 02:36:36 +02:00
librustc_macros Auto merge of #66364 - Centril:cleanup-macro-def, r=petrochenkov,eddyb 2020-03-10 17:12:48 +00:00
librustc_metadata Rollup merge of #69968 - eddyb:tupled-closure-captures, r=nikomatsakis 2020-03-23 10:29:11 +01:00
librustc_mir Rollup merge of #69968 - eddyb:tupled-closure-captures, r=nikomatsakis 2020-03-23 10:29:11 +01:00
librustc_mir_build Rollup merge of #69968 - eddyb:tupled-closure-captures, r=nikomatsakis 2020-03-23 10:29:11 +01:00
librustc_parse Rollup merge of #70248 - Centril:unroot, r=petrochenkov 2020-03-23 04:26:12 +01:00
librustc_passes Allow #[track_caller] in traits. 2020-03-22 17:21:18 -07:00
librustc_plugin_impl use direct imports for rustc::{lint, session}. 2020-03-16 02:52:06 +01:00
librustc_privacy Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
librustc_resolve Rollup merge of #70233 - petrochenkov:superproc, r=ecstatic-morse 2020-03-23 10:29:16 +01:00
librustc_save_analysis remove redundant closures (clippy::redundant_closure) 2020-03-22 12:43:19 +01:00
librustc_session Auto merge of #70296 - Centril:rollup-wvfmb3n, r=Centril 2020-03-23 06:02:34 +00:00
librustc_span Rollup merge of #70229 - matthiaskrgr:cl3ppy, r=Mark-Simulacrum 2020-03-22 15:48:35 +01:00
librustc_symbol_mangling symbol_names: treat ReifyShim like VtableShim. 2020-03-21 14:51:58 +02:00
librustc_target remove unused unit values (clippy::unused_unit) 2020-03-21 20:45:19 +01:00
librustc_trait_selection Rollup merge of #69968 - eddyb:tupled-closure-captures, r=nikomatsakis 2020-03-23 10:29:11 +01:00
librustc_traits Rollup merge of #69968 - eddyb:tupled-closure-captures, r=nikomatsakis 2020-03-23 10:29:11 +01:00
librustc_ty rustc: keep upvars tupled in {Closure,Generator}Substs. 2020-03-21 14:23:50 +02:00
librustc_typeck Rollup merge of #69968 - eddyb:tupled-closure-captures, r=nikomatsakis 2020-03-23 10:29:11 +01:00
librustdoc Rollup merge of #70254 - matthiaskrgr:cl4ppy, r=Centril 2020-03-22 15:48:41 +01:00
libserialize Inline various simple emit_* and read_* methods in Decoder. 2020-02-18 16:46:50 +11:00
libstd Add Wake trait for safe construction of Wakers. 2020-03-23 15:44:58 +01:00
libterm
libtest Rollup merge of #69802 - matthiaskrgr:cl1ppy, r=Dylan-DPC 2020-03-14 04:03:24 +09:00
libunwind Link to libgcc dynamically on windows-gnu when using dylib crates 2020-03-05 17:36:50 +00:00
llvm-project@9f65ad0573 update llvm to silence gcc 9 warnings 2020-02-26 10:27:01 +08:00
rtstartup Fix MinGW termination callbacks not being invoked 2020-03-05 17:36:50 +00:00
rustc
rustllvm librustc_codegen_llvm: Use slices instead of 0-terminated strings 2020-03-11 08:10:21 +01:00
stdarch@abe96ca3b8 Update stdarch submodule 2020-03-19 14:38:09 +00:00
test Rollup merge of #70233 - petrochenkov:superproc, r=ecstatic-morse 2020-03-23 10:29:16 +01:00
tools Auto merge of #70153 - flip1995:clippyup, r=Dylan-DPC 2020-03-22 00:57:57 +00:00
README.md rust-lang.github.io/rustc-dev-guide -> rustc-dev-guide.rust-lang.org 2020-03-10 17:08:18 -03:00
stage0.txt Bump the bootstrap compiler 2020-03-15 19:43:25 +01:00

This directory contains the source code of the rust project, including:

  • rustc and its tests
  • libstd
  • Various submodules for tools, like rustdoc, rls, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.