Skip to content

Commit 8a60256

Browse files
committed
---
yaml --- r: 277652 b: refs/heads/try c: 5158f3b h: refs/heads/master
1 parent ad1eabf commit 8a60256

File tree

30 files changed

+462
-125
lines changed

30 files changed

+462
-125
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 6dbb0e86aec11050480beb76eade6fb805010ba7
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
4-
refs/heads/try: 238e4ee104179c5a6beb5bb25ffe28a3fd77bff5
4+
refs/heads/try: 5158f3b282287624232ac6935569e440bb182664
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/mk/debuggers.mk

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,13 @@ DEBUGGER_BIN_SCRIPTS_LLDB_ABS=\
4141

4242

4343
## ALL ##
44-
DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL=$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB) \
45-
$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB)
46-
DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS=$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) \
47-
$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS)
44+
DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL=gdb_load_rust_pretty_printers.py \
45+
gdb_rust_pretty_printing.py \
46+
lldb_rust_formatters.py \
47+
debugger_pretty_printers_common.py
48+
DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS=\
49+
$(foreach script,$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL), \
50+
$(CFG_SRC_DIR)src/etc/$(script))
4851
DEBUGGER_BIN_SCRIPTS_ALL=$(DEBUGGER_BIN_SCRIPTS_GDB) \
4952
$(DEBUGGER_BIN_SCRIPTS_LLDB)
5053
DEBUGGER_BIN_SCRIPTS_ALL_ABS=$(DEBUGGER_BIN_SCRIPTS_GDB_ABS) \

branches/try/mk/main.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ endif
390390
# This 'function' will determine which debugger scripts to copy based on a
391391
# target triple. See debuggers.mk for more information.
392392
TRIPLE_TO_DEBUGGER_SCRIPT_SETTING=\
393-
$(if $(findstring windows,$(1)),none,$(if $(findstring darwin,$(1)),lldb,gdb))
393+
$(if $(findstring windows-msvc,$(1)),none,all)
394394

395395
STAGES = 0 1 2 3
396396

branches/try/mk/tests.mk

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -636,11 +636,11 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
636636
--host-rustcflags "$(RUSTC_FLAGS_$(3)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(3))" \
637637
--lldb-python-dir=$(CFG_LLDB_PYTHON_DIR) \
638638
--target-rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2))" \
639-
--cc '$$(CC_$(3))' \
640-
--cxx '$$(CXX_$(3))' \
641-
--cflags "$$(CFG_GCCISH_CFLAGS_$(3))" \
642-
--llvm-components "$$(LLVM_ALL_COMPONENTS_$(3))" \
643-
--llvm-cxxflags "$$(LLVM_CXXFLAGS_$(3))" \
639+
--cc '$$(CC_$(2))' \
640+
--cxx '$$(CXX_$(2))' \
641+
--cflags "$$(CFG_GCCISH_CFLAGS_$(2))" \
642+
--llvm-components "$$(LLVM_ALL_COMPONENTS_$(2))" \
643+
--llvm-cxxflags "$$(LLVM_CXXFLAGS_$(2))" \
644644
$$(CTEST_TESTARGS)
645645

646646
ifdef CFG_VALGRIND_RPASS

branches/try/src/bootstrap/build/dist.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -217,23 +217,23 @@ pub fn debugger_scripts(build: &Build,
217217
t!(fs::create_dir_all(&dst));
218218
install(&build.src.join("src/etc/").join(file), &dst, 0o644);
219219
};
220-
if host.contains("windows") {
220+
if host.contains("windows-msvc") {
221221
// no debugger scripts
222-
} else if host.contains("darwin") {
223-
// lldb debugger scripts
224-
install(&build.src.join("src/etc/rust-lldb"), &sysroot.join("bin"),
225-
0o755);
226-
227-
cp_debugger_script("lldb_rust_formatters.py");
228-
cp_debugger_script("debugger_pretty_printers_common.py");
229222
} else {
223+
cp_debugger_script("debugger_pretty_printers_common.py");
224+
230225
// gdb debugger scripts
231226
install(&build.src.join("src/etc/rust-gdb"), &sysroot.join("bin"),
232227
0o755);
233228

234229
cp_debugger_script("gdb_load_rust_pretty_printers.py");
235230
cp_debugger_script("gdb_rust_pretty_printing.py");
236-
cp_debugger_script("debugger_pretty_printers_common.py");
231+
232+
// lldb debugger scripts
233+
install(&build.src.join("src/etc/rust-lldb"), &sysroot.join("bin"),
234+
0o755);
235+
236+
cp_debugger_script("lldb_rust_formatters.py");
237237
}
238238
}
239239

branches/try/src/doc/book/getting-started.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ we’ll talk about Cargo, Rust’s build system and package manager.
88

99
The first step to using Rust is to install it. Generally speaking, you’ll need
1010
an Internet connection to run the commands in this section, as we’ll be
11-
downloading Rust from the internet.
11+
downloading Rust from the Internet.
1212

1313
We’ll be showing off a number of commands using a terminal, and those lines all
1414
start with `$`. We don't need to type in the `$`s, they are there to indicate
@@ -399,13 +399,13 @@ Let’s convert the Hello World program to Cargo. To Cargo-fy a project, you nee
399399
to do three things:
400400

401401
1. Put your source file in the right directory.
402-
2. Get rid of the old executable (`main.exe` on Windows, `main` everywhere else)
403-
and make a new one.
402+
2. Get rid of the old executable (`main.exe` on Windows, `main` everywhere
403+
else).
404404
3. Make a Cargo configuration file.
405405

406406
Let's get started!
407407

408-
### Creating a new Executable and Source Directory
408+
### Creating a Source Directory and Removing the Old Executable
409409

410410
First, go back to your terminal, move to your *hello_world* directory, and
411411
enter the following commands:

branches/try/src/libcollections/fmt.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@
333333
//! precision := count | '*'
334334
//! type := identifier | ''
335335
//! count := parameter | integer
336-
//! parameter := integer '$'
336+
//! parameter := argument '$'
337337
//! ```
338338
//!
339339
//! # Formatting Parameters
@@ -403,11 +403,12 @@
403403
//! println!("Hello {:5}!", "x");
404404
//! println!("Hello {:1$}!", "x", 5);
405405
//! println!("Hello {1:0$}!", 5, "x");
406+
//! println!("Hello {:width$}!", "x", width = 5);
406407
//! ```
407408
//!
408409
//! Referring to an argument with the dollar syntax does not affect the "next
409-
//! argument" counter, so it's usually a good idea to refer to all arguments by
410-
//! their position explicitly.
410+
//! argument" counter, so it's usually a good idea to refer to arguments by
411+
//! position, or use named arguments.
411412
//!
412413
//! ## Precision
413414
//!
@@ -426,7 +427,7 @@
426427
//!
427428
//! the integer `N` itself is the precision.
428429
//!
429-
//! 2. An integer followed by dollar sign `.N$`:
430+
//! 2. An integer or name followed by dollar sign `.N$`:
430431
//!
431432
//! use format *argument* `N` (which must be a `usize`) as the precision.
432433
//!
@@ -456,6 +457,10 @@
456457
//! // Hello {next arg (x)} is {arg 2 (0.01) with precision
457458
//! // specified in its predecessor (5)}
458459
//! println!("Hello {} is {2:.*}", "x", 5, 0.01);
460+
//!
461+
//! // Hello {next arg (x)} is {arg "number" (0.01) with precision specified
462+
//! // in arg "prec" (5)}
463+
//! println!("Hello {} is {number:.prec$}", "x", prec = 5, number = 0.01);
459464
//! ```
460465
//!
461466
//! All print the same thing:

branches/try/src/libcore/cell.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,18 @@ impl<T:Copy> Cell<T> {
232232
pub fn as_unsafe_cell(&self) -> &UnsafeCell<T> {
233233
&self.value
234234
}
235+
236+
/// Returns a mutable reference to the underlying data.
237+
///
238+
/// This call borrows `Cell` mutably (at compile-time) which guarantees
239+
/// that we possess the only reference.
240+
#[inline]
241+
#[unstable(feature = "cell_get_mut", issue = "33444")]
242+
pub fn get_mut(&mut self) -> &mut T {
243+
unsafe {
244+
&mut *self.value.get()
245+
}
246+
}
235247
}
236248

237249
#[stable(feature = "rust1", since = "1.0.0")]
@@ -455,6 +467,18 @@ impl<T: ?Sized> RefCell<T> {
455467
pub unsafe fn as_unsafe_cell(&self) -> &UnsafeCell<T> {
456468
&self.value
457469
}
470+
471+
/// Returns a mutable reference to the underlying data.
472+
///
473+
/// This call borrows `RefCell` mutably (at compile-time) so there is no
474+
/// need for dynamic checks.
475+
#[inline]
476+
#[unstable(feature = "cell_get_mut", issue="33444")]
477+
pub fn get_mut(&mut self) -> &mut T {
478+
unsafe {
479+
&mut *self.value.get()
480+
}
481+
}
458482
}
459483

460484
#[stable(feature = "rust1", since = "1.0.0")]

branches/try/src/libcore/mem.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ pub use intrinsics::transmute;
110110
/// }
111111
/// }
112112
/// ```
113+
#[inline]
113114
#[stable(feature = "rust1", since = "1.0.0")]
114115
pub fn forget<T>(t: T) {
115116
unsafe { intrinsics::forget(t) }

branches/try/src/libcore/num/wrapping.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,15 @@ macro_rules! wrapping_impl {
275275
*self = *self & other;
276276
}
277277
}
278+
279+
#[stable(feature = "wrapping_neg", since = "1.10.0")]
280+
impl Neg for Wrapping<$t> {
281+
type Output = Self;
282+
#[inline(always)]
283+
fn neg(self) -> Self {
284+
Wrapping(0) - self
285+
}
286+
}
278287
)*)
279288
}
280289

branches/try/src/librustc_borrowck/diagnostics.rs

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,82 @@ let c = &i; // still ok!
314314
```
315315
"##,
316316

317+
E0501: r##"
318+
This error indicates that a mutable variable is being used while it is still
319+
captured by a closure. Because the closure has borrowed the variable, it is not
320+
available for use until the closure goes out of scope.
321+
322+
Note that a capture will either move or borrow a variable, but in this
323+
situation, the closure is borrowing the variable. Take a look at
324+
http://rustbyexample.com/fn/closures/capture.html for more information about
325+
capturing.
326+
327+
Example of erroneous code:
328+
329+
```compile_fail
330+
fn inside_closure(x: &mut i32) {
331+
// Actions which require unique access
332+
}
333+
334+
fn outside_closure(x: &mut i32) {
335+
// Actions which require unique access
336+
}
337+
338+
fn foo(a: &mut i32) {
339+
let bar = || {
340+
inside_closure(a)
341+
};
342+
outside_closure(a); // error: cannot borrow `*a` as mutable because previous
343+
// closure requires unique access.
344+
}
345+
```
346+
347+
To fix this error, you can place the closure in its own scope:
348+
349+
```
350+
fn inside_closure(x: &mut i32) {}
351+
fn outside_closure(x: &mut i32) {}
352+
353+
fn foo(a: &mut i32) {
354+
{
355+
let bar = || {
356+
inside_closure(a)
357+
};
358+
} // borrow on `a` ends.
359+
outside_closure(a); // ok!
360+
}
361+
```
362+
363+
Or you can pass the variable as a parameter to the closure:
364+
365+
```
366+
fn inside_closure(x: &mut i32) {}
367+
fn outside_closure(x: &mut i32) {}
368+
369+
fn foo(a: &mut i32) {
370+
let bar = |s: &mut i32| {
371+
inside_closure(s)
372+
};
373+
outside_closure(a);
374+
bar(a);
375+
}
376+
```
377+
378+
It may be possible to define the closure later:
379+
380+
```
381+
fn inside_closure(x: &mut i32) {}
382+
fn outside_closure(x: &mut i32) {}
383+
384+
fn foo(a: &mut i32) {
385+
outside_closure(a);
386+
let bar = || {
387+
inside_closure(a)
388+
};
389+
}
390+
```
391+
"##,
392+
317393
E0507: r##"
318394
You tried to move out of a value which was borrowed. Erroneous code example:
319395
@@ -436,7 +512,6 @@ register_diagnostics! {
436512
E0388, // {} in a static location
437513
E0389, // {} in a `&` reference
438514
E0500, // closure requires unique access to `..` but .. is already borrowed
439-
E0501, // cannot borrow `..`.. as .. because previous closure requires unique access
440515
E0502, // cannot borrow `..`.. as .. because .. is also borrowed as ...
441516
E0503, // cannot use `..` because it was mutably borrowed
442517
E0504, // cannot move `..` into closure because it is borrowed

0 commit comments

Comments
 (0)