Skip to content

Commit 297d752

Browse files
committed
---
yaml --- r: 275110 b: refs/heads/stable c: 80122b2 h: refs/heads/master
1 parent 660858f commit 297d752

File tree

9 files changed

+71
-17
lines changed

9 files changed

+71
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 6e985934bdd29579b7df5ad092f44d41ed2cf799
32+
refs/heads/stable: 80122b2248a6168f38fdb8b532e0cdf5f6c01ba8
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
url = https://github.com/rust-lang/rust-installer.git
1717
[submodule "src/liblibc"]
1818
path = src/liblibc
19-
url = https://github.com/rust-lang-nursery/libc.git
19+
url = https://github.com/rust-lang/libc.git

branches/stable/src/libcore/ptr.rs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,54 @@ pub unsafe fn write<T>(dst: *mut T, src: T) {
161161
intrinsics::move_val_init(&mut *dst, src)
162162
}
163163

164+
/// Performs a volatile read of the value from `src` without moving it. This
165+
/// leaves the memory in `src` unchanged.
166+
///
167+
/// Volatile operations are intended to act on I/O memory, and are guaranteed
168+
/// to not be elided or reordered by the compiler across other volatile
169+
/// operations. See the LLVM documentation on [[volatile]].
170+
///
171+
/// [volatile]: http://llvm.org/docs/LangRef.html#volatile-memory-accesses
172+
///
173+
/// # Safety
174+
///
175+
/// Beyond accepting a raw pointer, this is unsafe because it semantically
176+
/// moves the value out of `src` without preventing further usage of `src`.
177+
/// If `T` is not `Copy`, then care must be taken to ensure that the value at
178+
/// `src` is not used before the data is overwritten again (e.g. with `write`,
179+
/// `zero_memory`, or `copy_memory`). Note that `*src = foo` counts as a use
180+
/// because it will attempt to drop the value previously at `*src`.
181+
#[inline]
182+
#[unstable(feature = "volatile", reason = "recently added", issue = "31756")]
183+
pub unsafe fn read_volatile<T>(src: *const T) -> T {
184+
intrinsics::volatile_load(src)
185+
}
186+
187+
/// Performs a volatile write of a memory location with the given value without
188+
/// reading or dropping the old value.
189+
///
190+
/// Volatile operations are intended to act on I/O memory, and are guaranteed
191+
/// to not be elided or reordered by the compiler across other volatile
192+
/// operations. See the LLVM documentation on [[volatile]].
193+
///
194+
/// [volatile]: http://llvm.org/docs/LangRef.html#volatile-memory-accesses
195+
///
196+
/// # Safety
197+
///
198+
/// This operation is marked unsafe because it accepts a raw pointer.
199+
///
200+
/// It does not drop the contents of `dst`. This is safe, but it could leak
201+
/// allocations or resources, so care must be taken not to overwrite an object
202+
/// that should be dropped.
203+
///
204+
/// This is appropriate for initializing uninitialized memory, or overwriting
205+
/// memory that has previously been `read` from.
206+
#[inline]
207+
#[unstable(feature = "volatile", reason = "recently added", issue = "31756")]
208+
pub unsafe fn write_volatile<T>(dst: *mut T, src: T) {
209+
intrinsics::volatile_store(dst, src);
210+
}
211+
164212
#[lang = "const_ptr"]
165213
impl<T: ?Sized> *const T {
166214
/// Returns true if the pointer is null.

branches/stable/src/librustc/lint/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ declare_lint! {
132132

133133
declare_lint! {
134134
pub MATCH_OF_UNIT_VARIANT_VIA_PAREN_DOTDOT,
135-
Warn,
135+
Deny,
136136
"unit struct or enum variant erroneously allowed to match via path::ident(..)"
137137
}
138138

branches/stable/src/llvm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 39e8e59056bcd84bf9c44d0bcd46ae441567e0a0
1+
Subproject commit 69ef168544e4f15b793dd35d272008fde9a6e835
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# If this file is modified, then llvm will be forcibly cleaned and then rebuilt.
22
# The actual contents of this file do not matter, but to trigger a change on the
33
# build bots then the contents should be changed so git updates the mtime.
4-
2016-02-16
4+
2016-02-20

branches/stable/src/test/compile-fail/empty-struct-unit-pat.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
// aux-build:empty-struct.rs
1414

15-
#![feature(rustc_attrs)]
1615
// remove prior feature after warning cycle and promoting warnings to errors
1716
#![feature(braced_empty_structs)]
1817

@@ -26,8 +25,7 @@ enum E {
2625
}
2726

2827
// remove attribute after warning cycle and promoting warnings to errors
29-
#[rustc_error]
30-
fn main() { //~ ERROR: compilation successful
28+
fn main() {
3129
let e2 = Empty2;
3230
let e4 = E::Empty4;
3331
let xe2 = XEmpty2;
@@ -41,12 +39,12 @@ fn main() { //~ ERROR: compilation successful
4139
// XEmpty2() => () // ERROR `XEmpty2` does not name a tuple variant or a tuple struct
4240
// }
4341
match e2 {
44-
Empty2(..) => () //~ WARN `Empty2` does not name a tuple variant or a tuple struct
45-
//~^ WARN hard error
42+
Empty2(..) => () //~ ERROR `Empty2` does not name a tuple variant or a tuple struct
43+
//~^ ERROR hard error
4644
}
4745
match xe2 {
48-
XEmpty2(..) => () //~ WARN `XEmpty2` does not name a tuple variant or a tuple struct
49-
//~^ WARN hard error
46+
XEmpty2(..) => () //~ ERROR `XEmpty2` does not name a tuple variant or a tuple struct
47+
//~^ ERROR hard error
5048
}
5149
// Rejected by parser as yet
5250
// match e4 {
@@ -57,12 +55,12 @@ fn main() { //~ ERROR: compilation successful
5755
// _ => {},
5856
// }
5957
match e4 {
60-
E::Empty4(..) => () //~ WARN `E::Empty4` does not name a tuple variant or a tuple struct
61-
//~^ WARN hard error
58+
E::Empty4(..) => () //~ ERROR `E::Empty4` does not name a tuple variant or a tuple struct
59+
//~^ ERROR hard error
6260
}
6361
match xe4 {
64-
XE::XEmpty4(..) => (), //~ WARN `XE::XEmpty4` does not name a tuple variant or a tuple
65-
//~^ WARN hard error
62+
XE::XEmpty4(..) => (), //~ ERROR `XE::XEmpty4` does not name a tuple variant or a tuple
63+
//~^ ERROR hard error
6664
_ => {},
6765
}
6866
}

branches/stable/src/test/run-make/volatile-intrinsics/main.rs

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

11-
#![feature(core_intrinsics)]
11+
#![feature(core_intrinsics, volatile)]
1212

1313
use std::intrinsics::{volatile_load, volatile_store};
14+
use std::ptr::{read_volatile, write_volatile};
1415

1516
pub fn main() {
1617
unsafe {
1718
let mut i : isize = 1;
1819
volatile_store(&mut i, 2);
1920
assert_eq!(volatile_load(&i), 2);
2021
}
22+
unsafe {
23+
let mut i : isize = 1;
24+
write_volatile(&mut i, 2);
25+
assert_eq!(read_volatile(&i), 2);
26+
}
2127
}

branches/stable/src/test/run-pass/issue-pr29383.rs

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

11+
#![allow(match_of_unit_variant_via_paren_dotdot)]
12+
1113
enum E {
1214
A,
1315
B,

0 commit comments

Comments
 (0)