Skip to content

Commit d334aa4

Browse files
committed
---
yaml --- r: 206336 b: refs/heads/beta c: 0d7d3ec h: refs/heads/master v: v3
1 parent 43d6830 commit d334aa4

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,7 +29,7 @@ refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2929
refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3030
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3131
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
32-
refs/heads/beta: df18642b1ad80369cefc0cbe626e5b0096654938
32+
refs/heads/beta: 0d7d3ec9d2b314af0188a820c58fbd95ee905793
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3535
refs/heads/tmp: 579e31929feff51dcaf8d444648eff8de735f91a

branches/beta/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/beta/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/beta/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/beta/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/beta/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/beta/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)