Skip to content

Commit f6ab438

Browse files
committed
---
yaml --- r: 231795 b: refs/heads/auto c: f7ffd50 h: refs/heads/master i: 231793: 233e01d 231791: cc04288 v: v3
1 parent 62fb02e commit f6ab438

File tree

12 files changed

+33
-105
lines changed

12 files changed

+33
-105
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: d7afefcbd18f78edad147aad250571d80effd4d0
11+
refs/heads/auto: f7ffd502e57c0e53c77f47a7c80d2fdc67559fd3
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/src/doc/trpl/method-syntax.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ can be awkward. Consider this code:
77
baz(bar(foo));
88
```
99

10-
We would read this left-to-right, and so we see ‘baz bar foo’. But this isn’t the
10+
We would read this left-to right, and so we see ‘baz bar foo’. But this isn’t the
1111
order that the functions would get called in, that’s inside-out: ‘foo bar baz’.
1212
Wouldn’t it be nice if we could do this instead?
1313

@@ -45,17 +45,17 @@ This will print `12.566371`.
4545

4646

4747

48-
We’ve made a `struct` that represents a circle. We then write an `impl` block,
48+
We’ve made a struct that represents a circle. We then write an `impl` block,
4949
and inside it, define a method, `area`.
5050

51-
Methods take a special first parameter, of which there are three variants:
51+
Methods take a special first parameter, of which there are three variants:
5252
`self`, `&self`, and `&mut self`. You can think of this first parameter as
5353
being the `foo` in `foo.bar()`. The three variants correspond to the three
5454
kinds of things `foo` could be: `self` if it’s just a value on the stack,
5555
`&self` if it’s a reference, and `&mut self` if it’s a mutable reference.
5656
Because we took the `&self` parameter to `area`, we can use it just like any
5757
other parameter. Because we know it’s a `Circle`, we can access the `radius`
58-
just like we would with any other `struct`.
58+
just like we would with any other struct.
5959

6060
We should default to using `&self`, as you should prefer borrowing over taking
6161
ownership, as well as taking immutable references over mutable ones. Here’s an
@@ -120,12 +120,12 @@ Check the return type:
120120
```rust
121121
# struct Circle;
122122
# impl Circle {
123-
fn grow(&self, increment: f64) -> Circle {
123+
fn grow(&self) -> Circle {
124124
# Circle } }
125125
```
126126

127127
We just say we’re returning a `Circle`. With this method, we can grow a new
128-
`Circle` to any arbitrary size.
128+
circle to any arbitrary size.
129129

130130
# Associated functions
131131

@@ -161,7 +161,7 @@ methods’.
161161

162162
# Builder Pattern
163163

164-
Let’s say that we want our users to be able to create `Circle`s, but we will
164+
Let’s say that we want our users to be able to create Circles, but we will
165165
allow them to only set the properties they care about. Otherwise, the `x`
166166
and `y` attributes will be `0.0`, and the `radius` will be `1.0`. Rust doesn’t
167167
have method overloading, named arguments, or variable arguments. We employ
@@ -224,7 +224,7 @@ fn main() {
224224
}
225225
```
226226

227-
What we’ve done here is make another `struct`, `CircleBuilder`. We’ve defined our
227+
What we’ve done here is make another struct, `CircleBuilder`. We’ve defined our
228228
builder methods on it. We’ve also defined our `area()` method on `Circle`. We
229229
also made one more method on `CircleBuilder`: `finalize()`. This method creates
230230
our final `Circle` from the builder. Now, we’ve used the type system to enforce

branches/auto/src/librustc/diagnostics.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ E0002: r##"
4444
This error indicates that an empty match expression is invalid because the type
4545
it is matching on is non-empty (there exist values of this type). In safe code
4646
it is impossible to create an instance of an empty type, so empty match
47-
expressions are almost never desired. This error is typically fixed by adding
47+
expressions are almost never desired. This error is typically fixed by adding
4848
one or more cases to the match expression.
4949
5050
An example of an empty type is `enum Empty { }`. So, the following will work:
@@ -218,14 +218,7 @@ match x {
218218
E0010: r##"
219219
The value of statics and constants must be known at compile time, and they live
220220
for the entire lifetime of a program. Creating a boxed value allocates memory on
221-
the heap at runtime, and therefore cannot be done at compile time. Erroneous
222-
code example:
223-
224-
```
225-
#![feature(box_syntax)]
226-
227-
const CON : Box<i32> = box 0;
228-
```
221+
the heap at runtime, and therefore cannot be done at compile time.
229222
"##,
230223

231224
E0011: r##"
@@ -342,6 +335,7 @@ is not allowed.
342335
343336
If you really want global mutable state, try using `static mut` or a global
344337
`UnsafeCell`.
338+
345339
"##,
346340

347341
E0018: r##"
@@ -405,13 +399,7 @@ fn main() {
405399

406400
E0020: r##"
407401
This error indicates that an attempt was made to divide by zero (or take the
408-
remainder of a zero divisor) in a static or constant expression. Erroneous
409-
code example:
410-
411-
```
412-
const X: i32 = 42 / 0;
413-
// error: attempted to divide by zero in a constant expression
414-
```
402+
remainder of a zero divisor) in a static or constant expression.
415403
"##,
416404

417405
E0022: r##"

branches/auto/src/librustc/middle/check_match.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,6 @@ fn check_expr(cx: &mut MatchCheckCtxt, ex: &hir::Expr) {
218218
span_err!(cx.tcx.sess, ex.span, E0002,
219219
"non-exhaustive patterns: type {} is non-empty",
220220
pat_ty);
221-
span_help!(cx.tcx.sess, ex.span,
222-
"Please ensure that all possible cases are being handled; \
223-
possibly adding wildcards or more match arms.");
224221
}
225222
// If the type *is* empty, it's vacuously exhaustive
226223
return;

branches/auto/src/librustc_typeck/diagnostics.rs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2475,24 +2475,6 @@ struct Bar<S, T> { x: Foo<S, T> }
24752475
```
24762476
"##,
24772477

2478-
//NB: not currently reachable
2479-
E0247: r##"
2480-
This error indicates an attempt to use a module name where a type is expected.
2481-
For example:
2482-
2483-
```
2484-
mod MyMod {
2485-
mod MySubMod { }
2486-
}
2487-
2488-
fn do_something(x: MyMod::MySubMod) { }
2489-
```
2490-
2491-
In this example, we're attempting to take a parameter of type `MyMod::MySubMod`
2492-
in the do_something function. This is not legal: `MyMod::MySubMod` is a module
2493-
name, not a type.
2494-
"##,
2495-
24962478
E0248: r##"
24972479
This error indicates an attempt to use a value where a type is expected. For
24982480
example:
@@ -3309,6 +3291,7 @@ register_diagnostics! {
33093291
E0242, // internal error looking up a definition
33103292
E0245, // not a trait
33113293
// E0246, // invalid recursive type
3294+
E0247, // found module name used as a type
33123295
// E0319, // trait impls for defaulted traits allowed just for structs/enums
33133296
E0320, // recursive overflow during dropck
33143297
E0321, // extended coherence rules for defaulted traits violated

branches/auto/src/libstd/prelude/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@
103103
//! `Some` and `None`.
104104
//! * `std::result::Result::`{
105105
//! [`self`](../result/enum.Result.html),
106-
//! [`Some`](../result/enum.Result.html),
107-
//! [`None`](../result/enum.Result.html)
106+
//! [`Ok`](../result/enum.Result.html),
107+
//! [`Err`](../result/enum.Result.html)
108108
//! }.
109109
//! The ubiquitous `Result` type and its two [variants][book-enums],
110110
//! `Ok` and `Err`.

branches/auto/src/libstd/sys/windows/backtrace.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ extern "system" {
6060
type SymFromAddrFn =
6161
extern "system" fn(libc::HANDLE, u64, *mut u64,
6262
*mut SYMBOL_INFO) -> libc::BOOL;
63-
type SymGetLineFromAddr64Fn =
64-
extern "system" fn(libc::HANDLE, u64, *mut u32,
65-
*mut IMAGEHLP_LINE64) -> libc::BOOL;
6663
type SymInitializeFn =
6764
extern "system" fn(libc::HANDLE, *mut libc::c_void,
6865
libc::BOOL) -> libc::BOOL;
@@ -102,14 +99,6 @@ struct SYMBOL_INFO {
10299
Name: [libc::c_char; MAX_SYM_NAME],
103100
}
104101

105-
#[repr(C)]
106-
struct IMAGEHLP_LINE64 {
107-
SizeOfStruct: u32,
108-
Key: *const libc::c_void,
109-
LineNumber: u32,
110-
Filename: *const libc::c_char,
111-
Address: u64,
112-
}
113102

114103
#[repr(C)]
115104
enum ADDRESS_MODE {

branches/auto/src/libstd/sys/windows/printing/msvc.rs

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use sys_common::backtrace::{output, output_fileline};
11+
use sys_common::backtrace::output;
1212
use ffi::CStr;
1313
use dynamic_lib::DynamicLibrary;
14-
use super::{SymFromAddrFn, SymGetLineFromAddr64Fn, SYMBOL_INFO, MAX_SYM_NAME, IMAGEHLP_LINE64};
14+
use super::{SymFromAddrFn, SYMBOL_INFO, MAX_SYM_NAME};
1515
use io;
1616
use io::prelude::*;
1717
use intrinsics;
@@ -20,7 +20,6 @@ use libc;
2020
pub fn print(w: &mut Write, i: isize, addr: u64, dbghelp: &DynamicLibrary, process: libc::HANDLE)
2121
-> io::Result<()> {
2222
let SymFromAddr = sym!(dbghelp, "SymFromAddr", SymFromAddrFn);
23-
let SymGetLineFromAddr64 = sym!(dbghelp, "SymGetLineFromAddr64", SymGetLineFromAddr64Fn);
2423

2524
let mut info: SYMBOL_INFO = unsafe { intrinsics::init() };
2625
info.MaxNameLen = MAX_SYM_NAME as libc::c_ulong;
@@ -30,7 +29,7 @@ pub fn print(w: &mut Write, i: isize, addr: u64, dbghelp: &DynamicLibrary, proce
3029
info.SizeOfStruct = 88;
3130

3231
let mut displacement = 0u64;
33-
let ret = SymFromAddr(process, addr, &mut displacement, &mut info);
32+
let ret = SymFromAddr(process, addr as u64, &mut displacement, &mut info);
3433

3534
let name = if ret == libc::TRUE {
3635
let ptr = info.Name.as_ptr() as *const libc::c_char;
@@ -39,20 +38,5 @@ pub fn print(w: &mut Write, i: isize, addr: u64, dbghelp: &DynamicLibrary, proce
3938
None
4039
};
4140

42-
try!(output(w, i, addr as usize as *mut libc::c_void, name));
43-
44-
// Now find out the filename and line number
45-
let mut line: IMAGEHLP_LINE64 = unsafe { intrinsics::init() };
46-
line.SizeOfStruct = ::mem::size_of::<IMAGEHLP_LINE64>() as u32;
47-
48-
let mut displacement = 0u32;
49-
let ret = SymGetLineFromAddr64(process, addr, &mut displacement, &mut line);
50-
if ret == libc::TRUE {
51-
output_fileline(w,
52-
unsafe { CStr::from_ptr(line.Filename).to_bytes() },
53-
line.LineNumber as libc::c_int,
54-
false)
55-
} else {
56-
Ok(())
57-
}
41+
output(w, i, addr as usize as *mut libc::c_void, name)
5842
}

branches/auto/src/rustbook/book.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ pub fn parse_summary(input: &mut Read, src: &Path) -> Result<Book, Vec<String>>
102102
top_items.push(BookItem {
103103
title: "Introduction".to_string(),
104104
path: PathBuf::from("README.md"),
105-
path_to_root: PathBuf::from(""),
105+
path_to_root: PathBuf::from("."),
106106
children: vec!(),
107107
});
108108

branches/auto/src/rustbook/build.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,16 @@ fn write_toc(book: &Book, current_page: &BookItem, out: &mut Write) -> io::Resul
5252
current_page: &BookItem,
5353
out: &mut Write) -> io::Result<()> {
5454
let class_string = if item.path == current_page.path {
55-
"class='active'"
55+
"class='active'"
5656
} else {
57-
""
57+
""
5858
};
5959

6060
try!(writeln!(out, "<li><a {} href='{}'><b>{}</b> {}</a>",
61-
class_string,
62-
current_page.path_to_root.join(&item.path).with_extension("html").display(),
63-
section,
64-
item.title));
61+
class_string,
62+
current_page.path_to_root.join(&item.path).with_extension("html").display(),
63+
section,
64+
item.title));
6565
if !item.children.is_empty() {
6666
try!(writeln!(out, "<ul class='section'>"));
6767
let _ = walk_items(&item.children[..], section, current_page, out);

branches/auto/src/test/run-pass/backtrace-debuginfo-aux.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ pub fn callback<F>(f: F) where F: FnOnce((&'static str, u32)) {
1515
f((file!(), line!()))
1616
}
1717

18-
// LLVM does not yet output the required debug info to support showing inlined
19-
// function calls in backtraces when targetting MSVC, so disable inlining in
20-
// this case.
21-
#[cfg_attr(not(target_env = "msvc"), inline(always))]
22-
#[cfg_attr(target_env = "msvc", inline(never))]
18+
#[inline(always)]
2319
pub fn callback_inlined<F>(f: F) where F: FnOnce((&'static str, u32)) {
2420
f((file!(), line!()))
2521
}

branches/auto/src/test/run-pass/backtrace-debuginfo.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ macro_rules! pos {
3232
not(target_os = "ios"),
3333
not(target_os = "android"),
3434
not(all(target_os = "linux", target_arch = "arm"))),
35-
all(windows, not(target_arch = "x86"))))]
35+
all(windows, target_env = "gnu", not(target_arch = "x86"))))]
3636
macro_rules! dump_and_die {
3737
($($pos:expr),*) => ({
3838
// FIXME(#18285): we cannot include the current position because
@@ -48,7 +48,7 @@ macro_rules! dump_and_die {
4848
not(target_os = "ios"),
4949
not(target_os = "android"),
5050
not(all(target_os = "linux", target_arch = "arm"))),
51-
all(windows, not(target_arch = "x86")))))]
51+
all(windows, target_env = "gnu", not(target_arch = "x86")))))]
5252
macro_rules! dump_and_die {
5353
($($pos:expr),*) => ({ let _ = [$($pos),*]; })
5454
}
@@ -69,10 +69,7 @@ type Pos = (&'static str, u32);
6969
// this goes to stdout and each line has to be occurred
7070
// in the following backtrace to stderr with a correct order.
7171
fn dump_filelines(filelines: &[Pos]) {
72-
// Skip top frame for MSVC, because it sees the macro rather than
73-
// the containing function.
74-
let skip = if cfg!(target_env = "msvc") {1} else {0};
75-
for &(file, line) in filelines.iter().rev().skip(skip) {
72+
for &(file, line) in filelines.iter().rev() {
7673
// extract a basename
7774
let basename = file.split(&['/', '\\'][..]).last().unwrap();
7875
println!("{}:{}", basename, line);
@@ -91,18 +88,12 @@ fn inner(counter: &mut i32, main_pos: Pos, outer_pos: Pos) {
9188
});
9289
}
9390

94-
// LLVM does not yet output the required debug info to support showing inlined
95-
// function calls in backtraces when targetting MSVC, so disable inlining in
96-
// this case.
97-
#[cfg_attr(not(target_env = "msvc"), inline(always))]
98-
#[cfg_attr(target_env = "msvc", inline(never))]
91+
#[inline(always)]
9992
fn inner_inlined(counter: &mut i32, main_pos: Pos, outer_pos: Pos) {
10093
check!(counter; main_pos, outer_pos);
10194
check!(counter; main_pos, outer_pos);
10295

103-
// Again, disable inlining for MSVC.
104-
#[cfg_attr(not(target_env = "msvc"), inline(always))]
105-
#[cfg_attr(target_env = "msvc", inline(never))]
96+
#[inline(always)]
10697
fn inner_further_inlined(counter: &mut i32, main_pos: Pos, outer_pos: Pos, inner_pos: Pos) {
10798
check!(counter; main_pos, outer_pos, inner_pos);
10899
}

0 commit comments

Comments
 (0)