Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into 0.11.0-release
Browse files Browse the repository at this point in the history
Conflicts:
	src/libstd/lib.rs
  • Loading branch information
alexcrichton committed Jul 2, 2014
2 parents aa1163b + ca2778e commit ff1dd44
Show file tree
Hide file tree
Showing 715 changed files with 10,840 additions and 8,689 deletions.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,26 @@ documentation.
When complete, `make install` will place several programs into
`/usr/local/bin`: `rustc`, the Rust compiler, and `rustdoc`, the
API-documentation tool.
system.
3. Read the [tutorial].
4. Enjoy!

### Building on Windows

To easily build on windows we can use [MSYS2](http://sourceforge.net/projects/msys2/):

1. Grab the latest MSYS2 installer and go through the installer.
2. Now from the MSYS2 terminal we want to install the mingw64 toolchain and the other
tools we need.

$ pacman -S mingw-w64-i686-toolchain
$ pacman -S base-devel

3. With that now start `mingw32_shell.bat` from where you installed MSYS2 (i.e. `C:\msys`).
4. From there just navigate to where you have Rust's source code, configure and build it:

$ ./configure --build=i686-pc-mingw32
$ make && make install

[repo]: https://github.com/rust-lang/rust
[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz
[tutorial]: http://doc.rust-lang.org/tutorial.html
Expand Down
9 changes: 9 additions & 0 deletions man/rustdoc.1
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ directory to load plugins from (default: /tmp/rustdoc_ng/plugins)
-L --library-path <val>
directory to add to crate search path
.TP
--html-in-header <val>
file to add to <head>
.TP
--html-before-content <val>
file to add in <body>, before content
.TP
--html-after-content <val>
file to add in <body>, after content
.TP
-h, --help
Print help

Expand Down
1 change: 1 addition & 0 deletions mk/dist.mk
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ PKG_FILES := \
driver \
etc \
$(foreach crate,$(CRATES),lib$(crate)) \
libcoretest \
libbacktrace \
rt \
rustllvm \
Expand Down
8 changes: 4 additions & 4 deletions mk/docs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ DOCS := index intro tutorial guide guide-ffi guide-macros guide-lifetimes \
PDF_DOCS := tutorial rust

RUSTDOC_DEPS_rust := doc/full-toc.inc
RUSTDOC_FLAGS_rust := --markdown-in-header=doc/full-toc.inc
RUSTDOC_FLAGS_rust := --html-in-header=doc/full-toc.inc

L10N_LANGS := ja

# Generally no need to edit below here.

# The options are passed to the documentation generators.
RUSTDOC_HTML_OPTS_NO_CSS = --markdown-before-content=doc/version_info.html \
--markdown-in-header=doc/favicon.inc \
--markdown-after-content=doc/footer.inc \
RUSTDOC_HTML_OPTS_NO_CSS = --html-before-content=doc/version_info.html \
--html-in-header=doc/favicon.inc \
--html-after-content=doc/footer.inc \
--markdown-playground-url='http://play.rust-lang.org/'

RUSTDOC_HTML_OPTS = $(RUSTDOC_HTML_OPTS_NO_CSS) --markdown-css rust.css
Expand Down
9 changes: 7 additions & 2 deletions mk/tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
######################################################################

# The names of crates that must be tested
TEST_TARGET_CRATES = $(TARGET_CRATES)

# libcore tests are in a separate crate
DEPS_coretest :=
$(eval $(call RUST_CRATE,coretest))

TEST_TARGET_CRATES = $(filter-out core,$(TARGET_CRATES)) coretest
TEST_DOC_CRATES = $(DOC_CRATES)
TEST_HOST_CRATES = $(HOST_CRATES)
TEST_CRATES = $(TEST_TARGET_CRATES) $(TEST_HOST_CRATES)
Expand Down Expand Up @@ -172,7 +177,7 @@ check-notidy: cleantmptestlogs cleantestlibs all check-stage2
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log

check-lite: cleantestlibs cleantmptestlogs \
$(foreach crate,$(TARGET_CRATES),check-stage2-$(crate)) \
$(foreach crate,$(TEST_TARGET_CRATES),check-stage2-$(crate)) \
check-stage2-rpass \
check-stage2-rfail check-stage2-cfail check-stage2-rmake
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
Expand Down
2 changes: 1 addition & 1 deletion src/compiletest/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub mod common;
pub mod errors;

#[start]
fn start(argc: int, argv: **u8) -> int {
fn start(argc: int, argv: *const *const u8) -> int {
green::start(argc, argv, rustuv::event_loop, main)
}

Expand Down
22 changes: 11 additions & 11 deletions src/doc/guide-ffi.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ use libc::{c_int, size_t};
#[link(name = "snappy")]
extern {
fn snappy_compress(input: *u8,
fn snappy_compress(input: *const u8,
input_length: size_t,
compressed: *mut u8,
compressed_length: *mut size_t) -> c_int;
fn snappy_uncompress(compressed: *u8,
fn snappy_uncompress(compressed: *const u8,
compressed_length: size_t,
uncompressed: *mut u8,
uncompressed_length: *mut size_t) -> c_int;
fn snappy_max_compressed_length(source_length: size_t) -> size_t;
fn snappy_uncompressed_length(compressed: *u8,
fn snappy_uncompressed_length(compressed: *const u8,
compressed_length: size_t,
result: *mut size_t) -> c_int;
fn snappy_validate_compressed_buffer(compressed: *u8,
fn snappy_validate_compressed_buffer(compressed: *const u8,
compressed_length: size_t) -> c_int;
}
# fn main() {}
Expand All @@ -82,7 +82,7 @@ the allocated memory. The length is less than or equal to the capacity.
~~~~
# extern crate libc;
# use libc::{c_int, size_t};
# unsafe fn snappy_validate_compressed_buffer(_: *u8, _: size_t) -> c_int { 0 }
# unsafe fn snappy_validate_compressed_buffer(_: *const u8, _: size_t) -> c_int { 0 }
# fn main() {}
pub fn validate_compressed_buffer(src: &[u8]) -> bool {
unsafe {
Expand All @@ -106,7 +106,7 @@ the true length after compression for setting the length.
~~~~
# extern crate libc;
# use libc::{size_t, c_int};
# unsafe fn snappy_compress(a: *u8, b: size_t, c: *mut u8,
# unsafe fn snappy_compress(a: *const u8, b: size_t, c: *mut u8,
# d: *mut size_t) -> c_int { 0 }
# unsafe fn snappy_max_compressed_length(a: size_t) -> size_t { a }
# fn main() {}
Expand All @@ -132,11 +132,11 @@ format and `snappy_uncompressed_length` will retrieve the exact buffer size requ
~~~~
# extern crate libc;
# use libc::{size_t, c_int};
# unsafe fn snappy_uncompress(compressed: *u8,
# unsafe fn snappy_uncompress(compressed: *const u8,
# compressed_length: size_t,
# uncompressed: *mut u8,
# uncompressed_length: *mut size_t) -> c_int { 0 }
# unsafe fn snappy_uncompressed_length(compressed: *u8,
# unsafe fn snappy_uncompressed_length(compressed: *const u8,
# compressed_length: size_t,
# result: *mut size_t) -> c_int { 0 }
# fn main() {}
Expand Down Expand Up @@ -418,7 +418,7 @@ Unsafe functions, on the other hand, advertise it to the world. An unsafe functi
this:
~~~~
unsafe fn kaboom(ptr: *int) -> int { *ptr }
unsafe fn kaboom(ptr: *const int) -> int { *ptr }
~~~~
This function can only be called from an `unsafe` block or another `unsafe` function.
Expand Down Expand Up @@ -453,7 +453,7 @@ use std::ptr;
#[link(name = "readline")]
extern {
static mut rl_prompt: *libc::c_char;
static mut rl_prompt: *const libc::c_char;
}
fn main() {
Expand All @@ -478,7 +478,7 @@ extern crate libc;
#[link(name = "kernel32")]
#[allow(non_snake_case_functions)]
extern "stdcall" {
fn SetEnvironmentVariableA(n: *u8, v: *u8) -> libc::c_int;
fn SetEnvironmentVariableA(n: *const u8, v: *const u8) -> libc::c_int;
}
# fn main() { }
~~~~
Expand Down
3 changes: 2 additions & 1 deletion src/doc/guide-macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ macro_rules! biased_match_rec (
_ => { $err }
}
);
// Produce the requested values
( binds $( $bind_res:ident ),* ) => ( ($( $bind_res ),*) )
)
Expand All @@ -364,7 +365,7 @@ macro_rules! biased_match (
( $( ($e:expr) ~ ($p:pat) else $err:stmt ; )*
binds $bind_res:ident
) => (
let ( $( $bind_res ),* ) = biased_match_rec!(
let $bind_res = biased_match_rec!(
$( ($e) ~ ($p) else $err ; )*
binds $bind_res
);
Expand Down
6 changes: 4 additions & 2 deletions src/doc/guide-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ extern crate green;
extern crate rustuv;
#[start]
fn start(argc: int, argv: **u8) -> int {
fn start(argc: int, argv: *const *const u8) -> int {
green::start(argc, argv, rustuv::event_loop, main)
}
Expand All @@ -261,7 +261,9 @@ inside of an OS thread.
extern crate native;
#[start]
fn start(argc: int, argv: **u8) -> int { native::start(argc, argv, main) }
fn start(argc: int, argv: *const *const u8) -> int {
native::start(argc, argv, main)
}
fn main() {}
~~~
Expand Down
4 changes: 4 additions & 0 deletions src/doc/guide-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,8 @@ the string in response. The child terminates when it receives `0`.
Here is the function that implements the child task:

~~~
#![allow(deprecated)]
use std::comm::DuplexStream;
# fn main() {
fn stringifier(channel: &DuplexStream<String, uint>) {
Expand All @@ -481,6 +483,8 @@ response itself is simply the stringified version of the received value,
Here is the code for the parent task:

~~~
#![allow(deprecated)]
use std::comm::duplex;
# use std::task::spawn;
# use std::comm::DuplexStream;
Expand Down
38 changes: 19 additions & 19 deletions src/doc/guide-unsafe.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ let ref_2: &mut u8 = unsafe { mem::transmute(&mut *ref_1) };
## Raw pointers

Rust offers two additional pointer types "raw pointers", written as
`*T` and `*mut T`. They're an approximation of C's `const T*` and `T*`
`*const T` and `*mut T`. They're an approximation of C's `const T*` and `T*`
respectively; indeed, one of their most common uses is for FFI,
interfacing with external C libraries.

Expand All @@ -100,7 +100,7 @@ offered by the Rust language and libraries. For example, they
- lack any form of lifetimes, unlike `&`, and so the compiler cannot
reason about dangling pointers; and
- have no guarantees about aliasing or mutability other than mutation
not being allowed directly through a `*T`.
not being allowed directly through a `*const T`.

Fortunately, they come with a redeeming feature: the weaker guarantees
mean weaker restrictions. The missing restrictions make raw pointers
Expand Down Expand Up @@ -131,13 +131,13 @@ unsafe, and neither is converting to an integer.

At runtime, a raw pointer `*` and a reference pointing to the same
piece of data have an identical representation. In fact, an `&T`
reference will implicitly coerce to an `*T` raw pointer in safe code
reference will implicitly coerce to an `*const T` raw pointer in safe code
and similarly for the `mut` variants (both coercions can be performed
explicitly with, respectively, `value as *T` and `value as *mut T`).
explicitly with, respectively, `value as *const T` and `value as *mut T`).

Going the opposite direction, from `*` to a reference `&`, is not
Going the opposite direction, from `*const` to a reference `&`, is not
safe. A `&T` is always valid, and so, at a minimum, the raw pointer
`*T` has to be a valid to a valid instance of type `T`. Furthermore,
`*const T` has to be a valid to a valid instance of type `T`. Furthermore,
the resulting pointer must satisfy the aliasing and mutability laws of
references. The compiler assumes these properties are true for any
references, no matter how they are created, and so any conversion from
Expand All @@ -149,7 +149,7 @@ The recommended method for the conversion is
```
let i: u32 = 1;
// explicit cast
let p_imm: *u32 = &i as *u32;
let p_imm: *const u32 = &i as *const u32;
let mut m: u32 = 2;
// implicit coercion
let p_mut: *mut u32 = &mut m;
Expand Down Expand Up @@ -256,7 +256,7 @@ impl<T: Send> Drop for Unique<T> {
// Copy the object out from the pointer onto the stack,
// where it is covered by normal Rust destructor semantics
// and cleans itself up, if necessary
ptr::read(self.ptr as *T);
ptr::read(self.ptr as *const T);
// clean-up our allocation
free(self.ptr as *mut c_void)
Expand All @@ -267,12 +267,12 @@ impl<T: Send> Drop for Unique<T> {
// A comparison between the built-in `Box` and this reimplementation
fn main() {
{
let mut x = box 5;
let mut x = box 5i;
*x = 10;
} // `x` is freed here
{
let mut y = Unique::new(5);
let mut y = Unique::new(5i);
*y.borrow_mut() = 10;
} // `y` is freed here
}
Expand Down Expand Up @@ -457,7 +457,7 @@ extern crate libc;
// Entry point for this program
#[start]
fn start(_argc: int, _argv: **u8) -> int {
fn start(_argc: int, _argv: *const *const u8) -> int {
0
}
Expand All @@ -482,7 +482,7 @@ compiler's name mangling too:
extern crate libc;
#[no_mangle] // ensure that this symbol is called `main` in the output
pub extern fn main(argc: int, argv: **u8) -> int {
pub extern fn main(argc: int, argv: *const *const u8) -> int {
0
}
Expand Down Expand Up @@ -540,8 +540,8 @@ use core::mem;
use core::raw::Slice;
#[no_mangle]
pub extern fn dot_product(a: *u32, a_len: u32,
b: *u32, b_len: u32) -> u32 {
pub extern fn dot_product(a: *const u32, a_len: u32,
b: *const u32, b_len: u32) -> u32 {
// Convert the provided arrays into Rust slices.
// The core::raw module guarantees that the Slice
// structure has the same memory layout as a &[T]
Expand Down Expand Up @@ -573,7 +573,7 @@ extern fn begin_unwind(args: &core::fmt::Arguments,
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
#[lang = "eh_personality"] extern fn eh_personality() {}
# #[start] fn start(argc: int, argv: **u8) -> int { 0 }
# #[start] fn start(argc: int, argv: *const *const u8) -> int { 0 }
# fn main() {}
```

Expand All @@ -595,7 +595,7 @@ standard library itself.
> parts of the language may never be full specified and so details may
> differ wildly between implementations (and even versions of `rustc`
> itself).
>
>
> Furthermore, this is just an overview; the best form of
> documentation for specific instances of these features are their
> definitions and uses in `std`.
Expand Down Expand Up @@ -627,7 +627,7 @@ via a declaration like
extern "rust-intrinsic" {
fn transmute<T, U>(x: T) -> U;
fn offset<T>(dst: *T, offset: int) -> *T;
fn offset<T>(dst: *const T, offset: int) -> *const T;
}
```

Expand Down Expand Up @@ -677,8 +677,8 @@ unsafe fn deallocate(ptr: *mut u8, _size: uint, _align: uint) {
}
#[start]
fn main(argc: int, argv: **u8) -> int {
let x = box 1;
fn main(argc: int, argv: *const *const u8) -> int {
let x = box 1i;
0
}
Expand Down
Loading

0 comments on commit ff1dd44

Please sign in to comment.