Skip to content

Commit 240d42d

Browse files
committed
---
yaml --- r: 145231 b: refs/heads/try2 c: c3fd430 h: refs/heads/master i: 145229: b388cdd 145227: dece025 145223: e7a81cc 145215: 2850ff1 v: v3
1 parent 6ce157a commit 240d42d

File tree

175 files changed

+624
-2452
lines changed

Some content is hidden

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

175 files changed

+624
-2452
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 7dd9344b0359d1ee63bf6b3c01e6c0c209602e5d
8+
refs/heads/try2: c3fd43060306c17e47170c30e619d35bd4bdbdfb
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/.gitattributes

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
[attr]rust text eol=lf whitespace=tab-in-indent,trailing-space,tabwidth=4
22

3-
* text eol=lf
3+
* text=auto
44
*.cpp rust
55
*.h rust
66
*.rs rust
77
src/rt/msvc/* -whitespace
88
src/rt/vg/* -whitespace
99
src/rt/linenoise/* -whitespace
1010
src/rt/jemalloc/**/* -whitespace
11+
src/rt/jemalloc/include/jemalloc/jemalloc.h.in text eol=lf
12+
src/rt/jemalloc/include/jemalloc/jemalloc_defs.h.in text eol=lf
13+
src/rt/jemalloc/include/jemalloc/internal/jemalloc_internal.h.in text eol=lf

branches/try2/Makefile.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,6 @@ CSREQ$(1)_T_$(2)_H_$(3) = \
442442
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
443443
$$(HBIN$(1)_H_$(3))/rustpkg$$(X_$(3)) \
444444
$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
445-
$$(HBIN$(1)_H_$(3))/rustdoc_ng$$(X_$(3)) \
446445
$$(HBIN$(1)_H_$(3))/rusti$$(X_$(3)) \
447446
$$(HBIN$(1)_H_$(3))/rust$$(X_$(3)) \
448447
$$(HLIB$(1)_H_$(3))/$(CFG_LIBRUSTPKG_$(3)) \

branches/try2/doc/rust.md

Lines changed: 12 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ string_body : non_double_quote
248248
| '\x5c' [ '\x22' | common_escape ] ;
249249
250250
common_escape : '\x5c'
251-
| 'n' | 'r' | 't' | '0'
251+
| 'n' | 'r' | 't'
252252
| 'x' hex_digit 2
253253
| 'u' hex_digit 4
254254
| 'U' hex_digit 8 ;
@@ -962,76 +962,24 @@ parameters to allow methods with that trait to be called on values
962962
of that type.
963963

964964

965-
#### Unsafety
965+
#### Unsafe functions
966966

967-
Unsafe operations are those that potentially violate the memory-safety guarantees of Rust's static semantics.
967+
Unsafe functions are those containing unsafe operations that are not contained in an [`unsafe` block](#unsafe-blocks).
968+
Such a function must be prefixed with the keyword `unsafe`.
968969

969-
The following language level features cannot be used in the safe subset of Rust:
970+
Unsafe operations are those that potentially violate the memory-safety guarantees of Rust's static semantics.
971+
Specifically, the following operations are considered unsafe:
970972

971973
- Dereferencing a [raw pointer](#pointer-types).
972-
- Calling an unsafe function (including an intrinsic or foreign function).
973-
974-
##### Unsafe functions
975-
976-
Unsafe functions are functions that are not safe in all contexts and/or for all possible inputs.
977-
Such a function must be prefixed with the keyword `unsafe`.
974+
- Casting a [raw pointer](#pointer-types) to a safe pointer type.
975+
- Calling an unsafe function.
978976

979977
##### Unsafe blocks
980978

981-
A block of code can also be prefixed with the `unsafe` keyword, to permit calling `unsafe` functions
982-
or dereferencing raw pointers within a safe function.
983-
984-
When a programmer has sufficient conviction that a sequence of potentially unsafe operations is
985-
actually safe, they can encapsulate that sequence (taken as a whole) within an `unsafe` block. The
986-
compiler will consider uses of such code safe, in the surrounding context.
987-
988-
Unsafe blocks are used to wrap foreign libraries, make direct use of hardware or implement features
989-
not directly present in the language. For example, Rust provides the language features necessary to
990-
implement memory-safe concurrency in the language but the implementation of tasks and message
991-
passing is in the standard library.
992-
993-
Rust's type system is a conservative approximation of the dynamic safety requirements, so in some
994-
cases there is a performance cost to using safe code. For example, a doubly-linked list is not a
995-
tree structure and can only be represented with managed or reference-counted pointers in safe code.
996-
By using `unsafe` blocks to represent the reverse links as raw pointers, it can be implemented with
997-
only owned pointers.
998-
999-
##### Behavior considered unsafe
1000-
1001-
This is a list of behavior which is forbidden in all Rust code. Type checking provides the guarantee
1002-
that these issues are never caused by safe code. An `unsafe` block or function is responsible for
1003-
never invoking this behaviour or exposing an API making it possible for it to occur in safe code.
1004-
1005-
* Data races
1006-
* Dereferencing a null/dangling raw pointer
1007-
* Mutating an immutable value/reference, if it is not marked as non-`Freeze`
1008-
* Reads of [undef](http://llvm.org/docs/LangRef.html#undefined-values) (uninitialized) memory
1009-
* Breaking the [pointer aliasing rules](http://llvm.org/docs/LangRef.html#pointer-aliasing-rules)
1010-
with raw pointers (a subset of the rules used by C)
1011-
* Invoking undefined behavior via compiler intrinsics:
1012-
* Indexing outside of the bounds of an object with `std::ptr::offset` (`offset` intrinsic), with
1013-
the exception of one byte past the end which is permitted.
1014-
* Using `std::ptr::copy_nonoverlapping_memory` (`memcpy32`/`memcpy64` instrinsics) on
1015-
overlapping buffers
1016-
* Invalid values in primitive types, even in private fields/locals:
1017-
* Dangling/null pointers in non-raw pointers, or slices
1018-
* A value other than `false` (0) or `true` (1) in a `bool`
1019-
* A discriminant in an `enum` not included in the type definition
1020-
* A value in a `char` which is a surrogate or above `char::MAX`
1021-
* non-UTF-8 byte sequences in a `str`
1022-
1023-
##### Behaviour not considered unsafe
1024-
1025-
This is a list of behaviour not considered *unsafe* in Rust terms, but that may be undesired.
1026-
1027-
* Deadlocks
1028-
* Reading data from private fields (`std::repr`, `format!("{:?}", x)`)
1029-
* Leaks due to reference count cycles, even in the global heap
1030-
* Exiting without calling destructors
1031-
* Sending signals
1032-
* Accessing/modifying the file system
1033-
* Unsigned integer overflow (well-defined as wrapping)
1034-
* Signed integer overflow (well-defined as two's complement representation wrapping)
979+
A block of code can also be prefixed with the `unsafe` keyword, to permit a sequence of unsafe operations in an otherwise-safe function.
980+
This facility exists because the static semantics of Rust are a necessary approximation of the dynamic semantics.
981+
When a programmer has sufficient conviction that a sequence of unsafe operations is actually safe, they can encapsulate that sequence (taken as a whole) within an `unsafe` block. The compiler will consider uses of such code "safe", to the surrounding context.
982+
1035983

1036984
#### Diverging functions
1037985

branches/try2/doc/tutorial-ffi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ impl<T: Send> Unique<T> {
321321
322322
#[unsafe_destructor]
323323
impl<T: Send> Drop for Unique<T> {
324-
fn drop(&mut self) {
324+
fn drop(&self) {
325325
#[fixed_stack_segment];
326326
#[inline(never)];
327327

branches/try2/doc/tutorial-rustpkg.md

Lines changed: 0 additions & 223 deletions
This file was deleted.

branches/try2/doc/tutorial.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,7 +1898,7 @@ struct TimeBomb {
18981898
}
18991899
19001900
impl Drop for TimeBomb {
1901-
fn drop(&mut self) {
1901+
fn drop(&self) {
19021902
for _ in range(0, self.explosivity) {
19031903
println("blam!");
19041904
}
@@ -2979,15 +2979,13 @@ tutorials on individual topics.
29792979
* [The foreign function interface][ffi]
29802980
* [Containers and iterators](tutorial-container.html)
29812981
* [Error-handling and Conditions](tutorial-conditions.html)
2982-
* [Packaging up Rust code](rustpkg)
29832982

29842983
There is further documentation on the [wiki], however those tend to be even more out of date as this document.
29852984

29862985
[borrow]: tutorial-borrowed-ptr.html
29872986
[tasks]: tutorial-tasks.html
29882987
[macros]: tutorial-macros.html
29892988
[ffi]: tutorial-ffi.html
2990-
[rustpkg]: tutorial-rustpkg.html
29912989

29922990
[wiki]: https://github.com/mozilla/rust/wiki/Docs
29932991

0 commit comments

Comments
 (0)