Skip to content

Commit 86923c5

Browse files
committed
---
yaml --- r: 81660 b: refs/heads/master c: 040f1c0 h: refs/heads/master v: v3
1 parent d888a6c commit 86923c5

Some content is hidden

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

63 files changed

+1945
-686
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: d2b0b11aebfe3167bf41f7c6c31cf7b1e396efe7
2+
refs/heads/master: 040f1c06bc7c1c5fa37477513227114d343b3ec3
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6c08cc2db4f98e9f07ae7d50338396c4123c2f0a
55
refs/heads/try: 70152ff55722878cde684ee6462c14c65f2c4729

trunk/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

trunk/mk/llvm.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ LLVM_STAMP_$(1) = $$(CFG_LLVM_BUILD_DIR_$(1))/llvm-auto-clean-stamp
2828

2929
$$(LLVM_CONFIG_$(1)): $$(LLVM_DEPS) $$(LLVM_STAMP_$(1))
3030
@$$(call E, make: llvm)
31-
$$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1)) $$(CFG_LLVM_BUILD_ENV_$(1))
31+
$$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1)) $$(CFG_LLVM_BUILD_ENV)
3232
$$(Q)touch $$(LLVM_CONFIG_$(1))
3333
endif
3434

trunk/mk/platform.mk

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,6 @@ CFG_PATH_MUNGE_mips-unknown-linux-gnu := true
343343
CFG_LDPATH_mips-unknown-linux-gnu :=
344344
CFG_RUN_mips-unknown-linux-gnu=
345345
CFG_RUN_TARG_mips-unknown-linux-gnu=
346-
RUSTC_FLAGS_mips-unknown-linux-gnu := --linker=$(CXX_mips-unknown-linux-gnu) --target-cpu mips32r2 --target-feature +mips32r2,+o32
347346

348347
# i686-pc-mingw32 configuration
349348
CC_i686-pc-mingw32=$(CC)
@@ -353,7 +352,7 @@ AR_i686-pc-mingw32=$(AR)
353352
CFG_LIB_NAME_i686-pc-mingw32=$(1).dll
354353
CFG_LIB_GLOB_i686-pc-mingw32=$(1)-*.dll
355354
CFG_LIB_DSYM_GLOB_i686-pc-mingw32=$(1)-*.dylib.dSYM
356-
CFG_GCCISH_CFLAGS_i686-pc-mingw32 := -Wall -Werror -g -m32 -march=i686 -D_WIN32_WINNT=0x0600 -I$(CFG_SRC_DIR)src/etc/mingw-fix-include
355+
CFG_GCCISH_CFLAGS_i686-pc-mingw32 := -Wall -Werror -g -m32 -march=i686 -D_WIN32_WINNT=0x0600
357356
CFG_GCCISH_CXXFLAGS_i686-pc-mingw32 := -fno-rtti
358357
CFG_GCCISH_LINK_FLAGS_i686-pc-mingw32 := -shared -fPIC -g -m32
359358
CFG_GCCISH_DEF_FLAG_i686-pc-mingw32 :=
@@ -362,7 +361,6 @@ CFG_GCCISH_POST_LIB_FLAGS_i686-pc-mingw32 :=
362361
CFG_DEF_SUFFIX_i686-pc-mingw32 := .mingw32.def
363362
CFG_INSTALL_NAME_i686-pc-mingw32 =
364363
CFG_LIBUV_LINK_FLAGS_i686-pc-mingw32 := -lWs2_32 -lpsapi -liphlpapi
365-
CFG_LLVM_BUILD_ENV_i686-pc-mingw32 := CPATH=$(CFG_SRC_DIR)src/etc/mingw-fix-include
366364
CFG_EXE_SUFFIX_i686-pc-mingw32 := .exe
367365
CFG_WINDOWSY_i686-pc-mingw32 := 1
368366
CFG_UNIXY_i686-pc-mingw32 :=
@@ -481,7 +479,7 @@ define CFG_MAKE_TOOLCHAIN
481479
$$(CFG_GCCISH_DEF_FLAG_$(1))$$(3) $$(2) \
482480
$$(call CFG_INSTALL_NAME_$(1),$$(4))
483481

484-
ifeq ($$(findstring $(HOST_$(1)),arm mips),)
482+
ifneq ($(HOST_$(1)),arm)
485483

486484
# We're using llvm-mc as our assembler because it supports
487485
# .cfi pseudo-ops on mac
@@ -493,7 +491,7 @@ define CFG_MAKE_TOOLCHAIN
493491
-o=$$(1)
494492
else
495493

496-
# For the ARM and MIPS crosses, use the toolchain assembler
494+
# For the ARM crosses, use the toolchain assembler
497495
# XXX: We should be able to use the LLVM assembler
498496
CFG_ASSEMBLE_$(1)=$$(CC_$(1)) $$(CFG_DEPEND_FLAGS) $$(2) -c -o $$(1)
499497

trunk/mk/rt.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
# working under these assumptions).
2525

2626
# Hack for passing flags into LIBUV, see below.
27-
LIBUV_FLAGS_i386 = -m32 -fPIC -I$(S)src/etc/mingw-fix-include
27+
LIBUV_FLAGS_i386 = -m32 -fPIC
2828
LIBUV_FLAGS_x86_64 = -m64 -fPIC
2929
ifeq ($(OSTYPE_$(1)), linux-androideabi)
3030
LIBUV_FLAGS_arm = -fPIC -DANDROID -std=gnu99

trunk/src/compiletest/compiletest.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ extern mod extra;
1717

1818
use std::os;
1919
use std::rt;
20+
use std::f64;
2021

2122
use extra::getopts;
2223
use extra::getopts::groups::{optopt, optflag, reqopt};
@@ -130,7 +131,7 @@ pub fn parse_config(args: ~[~str]) -> config {
130131
ratchet_noise_percent:
131132
getopts::opt_maybe_str(matches,
132133
"ratchet-noise-percent").map_move(|s|
133-
from_str::<f64>(s).unwrap()),
134+
f64::from_str(s).unwrap()),
134135
runtool: getopts::opt_maybe_str(matches, "runtool"),
135136
rustcflags: getopts::opt_maybe_str(matches, "rustcflags"),
136137
jit: getopts::opt_present(matches, "jit"),

trunk/src/etc/mingw-fix-include/README.txt

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

trunk/src/etc/mingw-fix-include/bits/c++config.h

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

trunk/src/etc/mingw-fix-include/winbase.h

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

trunk/src/etc/mingw-fix-include/winsock2.h

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

trunk/src/libextra/glob.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,16 @@ fn list_dir_sorted(path: &Path) -> ~[Path] {
137137
/**
138138
* A compiled Unix shell style pattern.
139139
*/
140+
#[cfg(stage0)]
141+
#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, IterBytes)]
142+
pub struct Pattern {
143+
priv tokens: ~[PatternToken]
144+
}
145+
146+
/**
147+
* A compiled Unix shell style pattern.
148+
*/
149+
#[cfg(not(stage0))]
140150
#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, IterBytes, Default)]
141151
pub struct Pattern {
142152
priv tokens: ~[PatternToken]
@@ -455,10 +465,39 @@ fn is_sep(c: char) -> bool {
455465
}
456466
}
457467
468+
/**
469+
* Configuration options to modify the behaviour of `Pattern::matches_with(..)`
470+
*/
471+
#[cfg(stage0)]
472+
#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, IterBytes)]
473+
pub struct MatchOptions {
474+
475+
/**
476+
* Whether or not patterns should be matched in a case-sensitive manner. This
477+
* currently only considers upper/lower case relationships between ASCII characters,
478+
* but in future this might be extended to work with Unicode.
479+
*/
480+
case_sensitive: bool,
481+
482+
/**
483+
* If this is true then path-component separator characters (e.g. `/` on Posix)
484+
* must be matched by a literal `/`, rather than by `*` or `?` or `[...]`
485+
*/
486+
require_literal_separator: bool,
487+
488+
/**
489+
* If this is true then paths that contain components that start with a `.` will
490+
* not match unless the `.` appears literally in the pattern: `*`, `?` or `[...]`
491+
* will not match. This is useful because such files are conventionally considered
492+
* hidden on Unix systems and it might be desirable to skip them when listing files.
493+
*/
494+
require_literal_leading_dot: bool
495+
}
458496
459497
/**
460498
* Configuration options to modify the behaviour of `Pattern::matches_with(..)`
461499
*/
500+
#[cfg(not(stage0))]
462501
#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, IterBytes, Default)]
463502
pub struct MatchOptions {
464503

0 commit comments

Comments
 (0)