Skip to content

Commit 14d066d

Browse files
committed
---
yaml --- r: 216527 b: refs/heads/stable c: 0d7d3ec h: refs/heads/master i: 216525: 5675eaf 216523: ec4b2b7 216519: 3abcb9f 216511: c39a3af v: v3
1 parent 962f39e commit 14d066d

File tree

7 files changed

+29
-16
lines changed

7 files changed

+29
-16
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ refs/heads/tmp: 378a370ff2057afeb1eae86eb6e78c476866a4a6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: a5286998df566e736b32f6795bfc3803bdaf453d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: df18642b1ad80369cefc0cbe626e5b0096654938
32+
refs/heads/stable: 0d7d3ec9d2b314af0188a820c58fbd95ee905793
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375

branches/stable/src/doc/trpl/concurrency.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ use std::thread;
116116
fn main() {
117117
let mut data = vec![1u32, 2, 3];
118118
119-
for i in 0..2 {
119+
for i in 0..3 {
120120
thread::spawn(move || {
121121
data[i] += 1;
122122
});
@@ -154,7 +154,7 @@ use std::sync::Mutex;
154154
fn main() {
155155
let mut data = Mutex::new(vec![1u32, 2, 3]);
156156
157-
for i in 0..2 {
157+
for i in 0..3 {
158158
let data = data.lock().unwrap();
159159
thread::spawn(move || {
160160
data[i] += 1;
@@ -196,7 +196,7 @@ use std::thread;
196196
fn main() {
197197
let data = Arc::new(Mutex::new(vec![1u32, 2, 3]));
198198
199-
for i in 0..2 {
199+
for i in 0..3 {
200200
let data = data.clone();
201201
thread::spawn(move || {
202202
let mut data = data.lock().unwrap();
@@ -217,7 +217,7 @@ thread more closely:
217217
# use std::thread;
218218
# fn main() {
219219
# let data = Arc::new(Mutex::new(vec![1u32, 2, 3]));
220-
# for i in 0..2 {
220+
# for i in 0..3 {
221221
# let data = data.clone();
222222
thread::spawn(move || {
223223
let mut data = data.lock().unwrap();

branches/stable/src/liblog/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ macro_rules! info {
136136
}
137137

138138
/// A convenience macro for logging at the debug log level. This macro can also
139-
/// be omitted at compile time by passing `--cfg ndebug` to the compiler. If
139+
/// be omitted at compile time by passing `-C debug-assertions` to the compiler. If
140140
/// this option is not passed, then debug statements will be compiled.
141141
///
142142
/// # Examples

branches/stable/src/librustc_typeck/check/cast.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,10 @@ pub fn check_cast<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, cast: &CastCheck<'tcx>) {
170170
demand::coerce(fcx, e.span, t_1, &e);
171171
}
172172
}
173-
} else if fcx.type_is_fat_ptr(t_e, span) && !fcx.type_is_fat_ptr(t_1, span) {
173+
} else if fcx.type_is_fat_ptr(t_e, span) != fcx.type_is_fat_ptr(t_1, span) {
174174
fcx.type_error_message(span, |actual| {
175-
format!("illegal cast; cast from fat pointer: `{}` as `{}`",
175+
format!("illegal cast; cast to or from fat pointer: `{}` as `{}` \
176+
involving incompatible type.",
176177
actual, fcx.infcx().ty_to_string(t_1))
177178
}, t_e, None);
178179
} else if !(t_e_is_scalar && t_1_is_trivial) {

branches/stable/src/test/compile-fail/fat-ptr-cast.rs

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

11+
// Make sure casts between thin pointer <-> fat pointer are illegal.
12+
13+
pub trait Trait {}
14+
1115
fn main() {
1216
let a: &[i32] = &[1, 2, 3];
1317
let b: Box<[i32]> = Box::new([1, 2, 3]);
1418
let p = a as *const [i32];
19+
let q = a.as_ptr();
20+
21+
a as usize; //~ ERROR illegal cast
22+
b as usize; //~ ERROR illegal cast
23+
p as usize; //~ ERROR illegal cast
24+
25+
// #22955
26+
q as *const [i32]; //~ ERROR illegal cast
1527

16-
a as usize; //~ ERROR cast from fat pointer
17-
b as usize; //~ ERROR cast from fat pointer
18-
p as usize; //~ ERROR cast from fat pointer
28+
// #21397
29+
let t: *mut (Trait + 'static) = 0 as *mut _; //~ ERROR illegal cast
30+
let mut fail: *const str = 0 as *const str; //~ ERROR illegal cast
1931
}

branches/stable/src/test/compile-fail/issue-22034.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
extern crate libc;
1212

1313
fn main() {
14-
let foo: *mut libc::c_void;
15-
let cb: &mut Fn() = unsafe {
16-
&mut *(foo as *mut Fn())
17-
//~^ ERROR use of possibly uninitialized variable: `foo`
14+
let ptr: *mut () = 0 as *mut _;
15+
let _: &mut Fn() = unsafe {
16+
&mut *(ptr as *mut Fn())
17+
//~^ ERROR illegal cast
1818
};
1919
}

branches/stable/src/test/compile-fail/issue-22289.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
// except according to those terms.
1010

1111
fn main() {
12-
0 as &std::any::Any; //~ ERROR non-scalar cast: `i32` as `&core::any::Any`
12+
0 as &std::any::Any; //~ ERROR illegal cast
1313
}

0 commit comments

Comments
 (0)