Skip to content

Commit 7b5f1e2

Browse files
committed
---
yaml --- r: 107685 b: refs/heads/dist-snap c: 0b7f823 h: refs/heads/master i: 107683: 0fd3639 v: v3
1 parent 2c78197 commit 7b5f1e2

File tree

170 files changed

+1985
-1808
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+1985
-1808
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: f64fdf524a434f0e5cd0bc91d09c144723f3c90d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 4b2fdfaaec1f405ac613a50d448e2dd3f22e3f10
9+
refs/heads/dist-snap: 0b7f823156a9e11126792529ec45c7490fea2fc3
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/Makefile.in

Lines changed: 183 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -222,27 +222,72 @@ GENERATED :=
222222

223223

224224
######################################################################
225-
# Cleaning out old crates
225+
# Crates
226226
######################################################################
227227

228+
define DEF_LIBS
229+
230+
CFG_RUNTIME_$(1) :=$(call CFG_STATIC_LIB_NAME_$(1),rustrt)
231+
CFG_RUSTLLVM_$(1) :=$(call CFG_STATIC_LIB_NAME_$(1),rustllvm)
232+
CFG_STDLIB_$(1) :=$(call CFG_LIB_NAME_$(1),std)
233+
CFG_EXTRALIB_$(1) :=$(call CFG_LIB_NAME_$(1),extra)
234+
CFG_LIBRUSTC_$(1) :=$(call CFG_LIB_NAME_$(1),rustc)
235+
CFG_LIBSYNTAX_$(1) :=$(call CFG_LIB_NAME_$(1),syntax)
236+
CFG_LIBRUSTPKG_$(1) :=$(call CFG_LIB_NAME_$(1),rustpkg)
237+
CFG_LIBRUSTDOC_$(1) :=$(call CFG_LIB_NAME_$(1),rustdoc)
238+
CFG_LIBRUSTUV_$(1) :=$(call CFG_LIB_NAME_$(1),rustuv)
239+
CFG_LIBGREEN_$(1) :=$(call CFG_LIB_NAME_$(1),green)
240+
CFG_LIBNATIVE_$(1) :=$(call CFG_LIB_NAME_$(1),native)
241+
242+
EXTRALIB_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),extra)
243+
STDLIB_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),std)
244+
LIBRUSTC_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),rustc)
245+
LIBSYNTAX_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),syntax)
246+
LIBRUSTPKG_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),rustpkg)
247+
LIBRUSTDOC_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),rustdoc)
248+
LIBRUSTUV_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),rustuv)
249+
LIBGREEN_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),green)
250+
LIBNATIVE_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),native)
251+
EXTRALIB_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),extra)
252+
STDLIB_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),std)
253+
LIBRUSTC_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rustc)
254+
LIBSYNTAX_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),syntax)
255+
LIBRUSTPKG_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rustpkg)
256+
LIBRUSTDOC_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rustdoc)
257+
LIBRUSTUV_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rustuv)
258+
LIBGREEN_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),green)
259+
LIBNATIVE_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),native)
260+
261+
EXTRALIB_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,extra)
262+
STDLIB_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,std)
263+
LIBRUSTUV_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,rustuv)
264+
LIBSYNTAX_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,syntax)
265+
LIBRUSTC_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,rustc)
266+
LIBNATIVE_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,native)
267+
LIBGREEN_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,green)
268+
269+
endef
270+
228271
# $(1) is the path for directory to match against
229272
# $(2) is the glob to use in the match
273+
# $(3) is filename (usually the target being created) to filter out from match
274+
# (i.e. filename is not out-of-date artifact from prior Rust version/build)
230275
#
231276
# Note that a common bug is to accidentally construct the glob denoted
232277
# by $(2) with a space character prefix, which invalidates the
233278
# construction $(1)$(2).
234-
define CHECK_FOR_OLD_GLOB_MATCHES
235-
$(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then echo "warning: there are previous" \'$(notdir $(2))\' "libraries:" $$MATCHES; fi
279+
define CHECK_FOR_OLD_GLOB_MATCHES_EXCEPT
280+
$(Q)MATCHES="$(filter-out %$(3),$(wildcard $(1)/$(2)))"; if [ -n "$$MATCHES" ] ; then echo "warning: there are previous" \'$(2)\' "libraries:" $$MATCHES; fi
236281
endef
237282

238283
# Same interface as above, but deletes rather than just listing the files.
239284
ifdef VERBOSE
240-
define REMOVE_ALL_OLD_GLOB_MATCHES
241-
$(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then echo "warning: removing previous" \'$(notdir $(1))\' "libraries:" $$MATCHES; rm $$MATCHES ; fi
285+
define REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT
286+
$(Q)MATCHES="$(filter-out %$(3),$(wildcard $(1)/$(2)))"; if [ -n "$$MATCHES" ] ; then echo "warning: removing previous" \'$(2)\' "libraries:" $$MATCHES; rm $$MATCHES ; fi
242287
endef
243288
else
244-
define REMOVE_ALL_OLD_GLOB_MATCHES
245-
$(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then rm $$MATCHES ; fi
289+
define REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT
290+
$(Q)MATCHES="$(filter-out %$(3),$(wildcard $(1)/$(2)))"; if [ -n "$$MATCHES" ] ; then rm $$MATCHES ; fi
246291
endef
247292
endif
248293

@@ -253,15 +298,72 @@ endif
253298
# soon. (This is in contrast to the macros above, which are meant to
254299
# be run at the outset of a command list in a rule.)
255300
ifdef VERBOSE
256-
define LIST_ALL_OLD_GLOB_MATCHES
257-
@echo "info: now are following matches for" '$(notdir $(1))' "libraries:"
258-
@( ls $(1) 2>/dev/null || true )
301+
define LIST_ALL_OLD_GLOB_MATCHES_EXCEPT
302+
@echo "info: now are following matches for" '$(2)' "libraries:"
303+
@( cd $(1) && ( ls $(2) 2>/dev/null || true ) | grep -v $(3) || true )
259304
endef
260305
else
261-
define LIST_ALL_OLD_GLOB_MATCHES
306+
define LIST_ALL_OLD_GLOB_MATCHES_EXCEPT
262307
endef
263308
endif
264309

310+
$(foreach target,$(CFG_TARGET),\
311+
$(eval $(call DEF_LIBS,$(target))))
312+
313+
######################################################################
314+
# Standard library variables
315+
######################################################################
316+
317+
STDLIB_CRATE := $(S)src/libstd/lib.rs
318+
STDLIB_INPUTS := $(wildcard $(addprefix $(S)src/libstd/, \
319+
*.rs */*.rs */*/*rs */*/*/*rs))
320+
321+
######################################################################
322+
# Extra library variables
323+
######################################################################
324+
325+
EXTRALIB_CRATE := $(S)src/libextra/lib.rs
326+
EXTRALIB_INPUTS := $(wildcard $(addprefix $(S)src/libextra/, \
327+
*.rs */*.rs))
328+
329+
######################################################################
330+
# Rust UV library variables
331+
######################################################################
332+
333+
LIBRUSTUV_CRATE := $(S)src/librustuv/lib.rs
334+
LIBRUSTUV_INPUTS := $(wildcard $(addprefix $(S)src/librustuv/, \
335+
*.rs */*.rs))
336+
337+
######################################################################
338+
# Green threading library variables
339+
######################################################################
340+
341+
LIBGREEN_CRATE := $(S)src/libgreen/lib.rs
342+
LIBGREEN_INPUTS := $(wildcard $(addprefix $(S)src/libgreen/, \
343+
*.rs */*.rs))
344+
345+
######################################################################
346+
# Native threading library variables
347+
######################################################################
348+
349+
LIBNATIVE_CRATE := $(S)src/libnative/lib.rs
350+
LIBNATIVE_INPUTS := $(wildcard $(addprefix $(S)src/libnative/, \
351+
*.rs */*.rs))
352+
353+
######################################################################
354+
# rustc crate variables
355+
######################################################################
356+
357+
COMPILER_CRATE := $(S)src/librustc/lib.rs
358+
COMPILER_INPUTS := $(wildcard $(addprefix $(S)src/librustc/, \
359+
*.rs */*.rs */*/*.rs */*/*/*.rs))
360+
361+
LIBSYNTAX_CRATE := $(S)src/libsyntax/lib.rs
362+
LIBSYNTAX_INPUTS := $(wildcard $(addprefix $(S)src/libsyntax/, \
363+
*.rs */*.rs */*/*.rs */*/*/*.rs))
364+
365+
DRIVER_CRATE := $(S)src/driver/driver.rs
366+
265367
######################################################################
266368
# LLVM macros
267369
######################################################################
@@ -323,10 +425,12 @@ export CFG_LIBDIR_RELATIVE
323425
export CFG_DISABLE_INJECT_STD_VERSION
324426

325427
######################################################################
326-
# Per-stage targets and runner
428+
# Subprograms
327429
######################################################################
328430

329-
include $(CFG_SRC_DIR)mk/crates.mk
431+
######################################################################
432+
# Per-stage targets and runner
433+
######################################################################
330434

331435
define SREQ
332436
# $(1) is the stage number
@@ -343,37 +447,84 @@ TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/$$(CFG_RUSTLIBDIR)/$(2)
343447
TBIN$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/bin
344448
TLIB$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/lib
345449

450+
# The name of the standard and extra libraries used by rustc
451+
HSTDLIB_DEFAULT$(1)_H_$(3) = \
452+
$$(HLIB$(1)_H_$(3))/$(CFG_STDLIB_$(3))
453+
TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3) = \
454+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2))
455+
456+
HEXTRALIB_DEFAULT$(1)_H_$(3) = \
457+
$$(HLIB$(1)_H_$(3))/$(CFG_EXTRALIB_$(3))
458+
TEXTRALIB_DEFAULT$(1)_T_$(2)_H_$(3) = \
459+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2))
460+
461+
HLIBRUSTC_DEFAULT$(1)_H_$(3) = \
462+
$$(HLIB$(1)_H_$(3))/$(CFG_LIBRUSTC_$(3))
463+
TLIBRUSTC_DEFAULT$(1)_T_$(2)_H_$(3) = \
464+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(2))
465+
466+
HLIBRUSTUV_DEFAULT$(1)_H_$(3) = \
467+
$$(HLIB$(1)_H_$(3))/$(CFG_LIBRUSTUV_$(3))
468+
TLIBRUSTUV_DEFAULT$(1)_T_$(2)_H_$(3) = \
469+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTUV_$(2))
470+
471+
HLIBGREEN_DEFAULT$(1)_H_$(3) = \
472+
$$(HLIB$(1)_H_$(3))/$(CFG_LIBGREEN_$(3))
473+
TLIBGREEN_DEFAULT$(1)_T_$(2)_H_$(3) = \
474+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBGREEN_$(2))
475+
476+
HLIBNATIVE_DEFAULT$(1)_H_$(3) = \
477+
$$(HLIB$(1)_H_$(3))/$(CFG_LIBNATIVE_$(3))
478+
TLIBNATIVE_DEFAULT$(1)_T_$(2)_H_$(3) = \
479+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBNATIVE_$(2))
480+
346481
# Preqrequisites for using the stageN compiler
347482
ifeq ($(1),0)
348483
HSREQ$(1)_H_$(3) = $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3))
349484
else
350485
HSREQ$(1)_H_$(3) = \
351486
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
352-
$$(HLIB$(1)_H_$(3))/stamp.rustc \
353-
$$(foreach dep,$$(RUST_DEPS_rustc),$$(HLIB$(1)_H_$(3))/stamp.$$(dep)) \
487+
$$(HSTDLIB_DEFAULT$(1)_H_$(3)) \
488+
$$(HEXTRALIB_DEFAULT$(1)_H_$(3)) \
489+
$$(HLIBSYNTAX_DEFAULT$(1)_H_$(3)) \
490+
$$(HLIBRUSTC_DEFAULT$(1)_H_$(3)) \
491+
$$(HLIBRUSTUV_DEFAULT$(1)_H_$(3)) \
492+
$$(HLIBGREEN_DEFAULT$(1)_H_$(3)) \
493+
$$(HLIBNATIVE_DEFAULT$(1)_H_$(3)) \
354494
$$(MKFILE_DEPS)
355495
endif
356496

357497
# Prerequisites for using the stageN compiler to build target artifacts
358498
TSREQ$(1)_T_$(2)_H_$(3) = \
359499
$$(HSREQ$(1)_H_$(3)) \
500+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUNTIME_$(2)) \
360501
$$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a
361502

362-
# Prerequisites for a working stageN compiler and libraries, for a specific
363-
# target
503+
# Prerequisites for a working stageN compiler and libraries, for a specific target
364504
SREQ$(1)_T_$(2)_H_$(3) = \
365505
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
366-
$$(foreach dep,$$(TARGET_CRATES),\
367-
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep))
506+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)) \
507+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2)) \
508+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTUV_$(2)) \
509+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBGREEN_$(2)) \
510+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBNATIVE_$(2))
368511

369-
# Prerequisites for a working stageN compiler and complete set of target
370-
# libraries
512+
# Prerequisites for a working stageN compiler and libraries, for a specific target
371513
CSREQ$(1)_T_$(2)_H_$(3) = \
372514
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
373515
$$(HBIN$(1)_H_$(3))/rustpkg$$(X_$(3)) \
374516
$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
375-
$$(foreach dep,$$(CRATES),$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep)) \
376-
$$(foreach dep,$$(HOST_CRATES),$$(HLIB$(1)_H_$(3))/stamp.$$(dep))
517+
$$(HLIB$(1)_H_$(3))/$(CFG_LIBRUSTPKG_$(3)) \
518+
$$(HLIB$(1)_H_$(3))/$(CFG_LIBRUSTDOC_$(3)) \
519+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)) \
520+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2)) \
521+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(2)) \
522+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(2)) \
523+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTPKG_$(2)) \
524+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTDOC_$(2)) \
525+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTUV_$(2)) \
526+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBGREEN_$(2)) \
527+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBNATIVE_$(2))
377528

378529
ifeq ($(1),0)
379530
# Don't run the the stage0 compiler under valgrind - that ship has sailed
@@ -411,15 +562,15 @@ endif
411562
STAGE$(1)_T_$(2)_H_$(3) := \
412563
$$(Q)$$(RPATH_VAR$(1)_T_$(2)_H_$(3)) \
413564
$$(call CFG_RUN_TARG_$(3),$(1), \
414-
$$(CFG_VALGRIND_COMPILE$(1)) \
565+
$$(CFG_VALGRIND_COMPILE$(1)) \
415566
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
416567
--cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \
417568
$$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \
418569
$$(RUSTC_FLAGS_$(2))
419570

420-
PERF_STAGE$(1)_T_$(2)_H_$(3) := \
571+
PERF_STAGE$(1)_T_$(2)_H_$(3) := \
421572
$$(Q)$$(call CFG_RUN_TARG_$(3),$(1), \
422-
$$(CFG_PERF_TOOL) \
573+
$$(CFG_PERF_TOOL) \
423574
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
424575
--cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \
425576
$$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \
@@ -443,12 +594,13 @@ define DEF_RUSTC_STAGE_TARGET
443594
# $(2) == stage
444595

445596
rustc-stage$(2)-H-$(1): \
446-
$$(foreach target,$$(CFG_TARGET),$$(SREQ$(2)_T_$$(target)_H_$(1)))
597+
$$(foreach target,$$(CFG_TARGET), \
598+
$$(SREQ$(2)_T_$$(target)_H_$(1)))
447599

448600
endef
449601

450-
$(foreach host,$(CFG_HOST), \
451-
$(eval $(foreach stage,1 2 3, \
602+
$(foreach host,$(CFG_HOST), \
603+
$(eval $(foreach stage,1 2 3, \
452604
$(eval $(call DEF_RUSTC_STAGE_TARGET,$(host),$(stage))))))
453605

454606
rustc-stage1: rustc-stage1-H-$(CFG_BUILD)
@@ -484,7 +636,7 @@ CFG_INFO := $(info cfg: *** compiler is in snapshot transition ***)
484636
CFG_INFO := $(info cfg: *** stage2 and later will not be built ***)
485637
CFG_INFO := $(info cfg:)
486638

487-
#FIXME This is surely busted
639+
#XXX This is surely busted
488640
all: $(SREQ1$(CFG_BUILD)) $(GENERATED) docs
489641

490642
else
@@ -549,6 +701,7 @@ include $(CFG_SRC_DIR)mk/target.mk
549701
include $(CFG_SRC_DIR)mk/host.mk
550702
include $(CFG_SRC_DIR)mk/stage0.mk
551703
include $(CFG_SRC_DIR)mk/rustllvm.mk
704+
include $(CFG_SRC_DIR)mk/tools.mk
552705
include $(CFG_SRC_DIR)mk/docs.mk
553706
include $(CFG_SRC_DIR)mk/llvm.mk
554707

branches/dist-snap/doc/guide-container.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Reaching the end of the iterator is signalled by returning `None` instead of
9090
# fn main() {}
9191
/// A stream of N zeroes
9292
struct ZeroStream {
93-
remaining: uint
93+
priv remaining: uint
9494
}
9595

9696
impl ZeroStream {
@@ -305,7 +305,7 @@ The `ZeroStream` from earlier can provide an exact lower and upper bound:
305305
# fn main() {}
306306
/// A stream of N zeroes
307307
struct ZeroStream {
308-
remaining: uint
308+
priv remaining: uint
309309
}
310310
311311
impl ZeroStream {

branches/dist-snap/doc/guide-ffi.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -303,15 +303,15 @@ which would call back to `callback()` in Rust.
303303

304304
## Targetting callbacks to Rust objects
305305

306-
The former example showed how a global function can be called from C code.
306+
The former example showed how a global function can be called from C-Code.
307307
However it is often desired that the callback is targetted to a special
308308
Rust object. This could be the object that represents the wrapper for the
309309
respective C object.
310310

311311
This can be achieved by passing an unsafe pointer to the object down to the
312312
C library. The C library can then include the pointer to the Rust object in
313-
the notification. This will allow the callback to unsafely access the
314-
referenced Rust object.
313+
the notification. This will provide a unsafe possibility to access the
314+
referenced Rust object in callback.
315315

316316
Rust code:
317317
~~~~ {.xfail-test}
@@ -364,25 +364,25 @@ void trigger_callback() {
364364

365365
## Asynchronous callbacks
366366

367-
In the previously given examples the callbacks are invoked as a direct reaction
367+
In the already given examples the callbacks are invoked as a direct reaction
368368
to a function call to the external C library.
369-
The control over the current thread is switched from Rust to C to Rust for the
369+
The control over the current thread switched from Rust to C to Rust for the
370370
execution of the callback, but in the end the callback is executed on the
371371
same thread (and Rust task) that lead called the function which triggered
372372
the callback.
373373

374-
Things get more complicated when the external library spawns its own threads
374+
Things get more complicated when the external library spawns it's own threads
375375
and invokes callbacks from there.
376-
In these cases access to Rust data structures inside the callbacks is
376+
In these cases access to Rust data structures inside he callbacks is
377377
especially unsafe and proper synchronization mechanisms must be used.
378-
Besides classical synchronization mechanisms like mutexes, one possibility in
378+
Besides classical synchronization mechanisms like mutexes one possibility in
379379
Rust is to use channels (in `std::comm`) to forward data from the C thread
380380
that invoked the callback into a Rust task.
381381

382382
If an asychronous callback targets a special object in the Rust address space
383383
it is also absolutely necessary that no more callbacks are performed by the
384-
C library after the respective Rust object gets destroyed.
385-
This can be achieved by unregistering the callback in the object's
384+
C library after the respective Rust object get's destroyed.
385+
This can be achieved by unregistering the callback it the object's
386386
destructor and designing the library in a way that guarantees that no
387387
callback will be performed after unregistration.
388388

0 commit comments

Comments
 (0)