Skip to content

Commit af607ec

Browse files
committed
---
yaml --- r: 125943 b: refs/heads/try c: c05cfab h: refs/heads/master i: 125941: 46118d8 125939: 176dbd1 125935: 5769884 v: v3
1 parent 82e6a9e commit af607ec

File tree

253 files changed

+560
-760
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

253 files changed

+560
-760
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: f2fa55903e378368ed9173560f03a0ef16e371c2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 9fc8394d3bce22ab483f98842434c84c396212ae
5-
refs/heads/try: ad4fa46f5b17ea4eb64192b3aab71953bd91240d
5+
refs/heads/try: c05cfab7f979f72a25821060576a2aaea4c61ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/etc/licenseck.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
"libsync/mpsc_intrusive.rs", # BSD
4545
"test/bench/shootout-binarytrees.rs", # BSD
4646
"test/bench/shootout-fannkuch-redux.rs", # BSD
47-
"test/bench/shootout-k-nucleotide.rs", # BSD
4847
"test/bench/shootout-mandelbrot.rs", # BSD
4948
"test/bench/shootout-meteor.rs", # BSD
5049
"test/bench/shootout-pidigits.rs", # BSD
Lines changed: 6 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
Rust's lexical grammar is not context-free. Raw string literals are the source
22
of the problem. Informally, a raw string literal is an `r`, followed by `N`
33
hashes (where N can be zero), a quote, any characters, then a quote followed
4-
by `N` hashes. Critically, once inside the first pair of quotes,
5-
another quote cannot be followed by `N` consecutive hashes. e.g.
6-
`r###""###"###` is invalid.
7-
8-
This grammar describes this as best possible:
4+
by `N` hashes. This grammar describes this as best possible:
95

106
R -> 'r' S
117
S -> '"' B '"'
@@ -26,39 +22,8 @@ accepted as one by the above grammar, using the derivation:
2622
(Where `T : U` means the rule `T` is applied, and `U` is the remainder of the
2723
string.) The difficulty arises from the fact that it is fundamentally
2824
context-sensitive. In particular, the context needed is the number of hashes.
29-
30-
To prove that Rust's string literals are not context-free, we will use
31-
the fact that context-free languages are closed under intersection with
32-
regular languages, and the
33-
[pumping lemma for context-free languages](https://en.wikipedia.org/wiki/Pumping_lemma_for_context-free_languages).
34-
35-
Consider the regular language `R = r#+""#*"#+`. If Rust's raw string literals are
36-
context-free, then their intersection with `R`, `R'`, should also be context-free.
37-
Therefore, to prove that raw string literals are not context-free,
38-
it is sufficient to prove that `R'` is not context-free.
39-
40-
The language `R'` is `{r#^n""#^m"#^n | m < n}`.
41-
42-
Assume `R'` *is* context-free. Then `R'` has some pumping length `p > 0` for which
43-
the pumping lemma applies. Consider the following string `s` in `R'`:
44-
45-
`r#^p""#^{p-1}"#^p`
46-
47-
e.g. for `p = 2`: `s = r##""#"##`
48-
49-
Then `s = uvwxy` for some choice of `uvwxy` such that `vx` is non-empty,
50-
`|vwx| < p+1`, and `uv^iwx^iy` is in `R'` for all `i >= 0`.
51-
52-
Neither `v` nor `x` can contain a `"` or `r`, as the number of these characters
53-
in any string in `R'` is fixed. So `v` and `x` contain only hashes.
54-
Consequently, of the three sequences of hashes, `v` and `x` combined
55-
can only pump two of them.
56-
If we ever choose the central sequence of hashes, then one of the outer sequences
57-
will not grow when we pump, leading to an imbalance between the outer sequences.
58-
Therefore, we must pump both outer sequences of hashes. However,
59-
there are `p+2` characters between these two sequences of hashes, and `|vwx|` must
60-
be less than `p+1`. Therefore we have a contradiction, and `R'` must not be
61-
context-free.
62-
63-
Since `R'` is not context-free, it follows that the Rust's raw string literals
64-
must not be context-free.
25+
I know of no way to resolve this, but also have not come up with a proof that
26+
it is not context sensitive. Such a proof would probably use the pumping lemma
27+
for context-free languages, but I (cmr) could not come up with a proof after
28+
spending a few hours on it, and decided my time best spent elsewhere. Pull
29+
request welcome!

branches/try/src/liballoc/arc.rs

Lines changed: 6 additions & 14 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-
#![stable]
12-
13-
//! Concurrency-enabled mechanisms for sharing mutable and/or immutable state
14-
//! between tasks.
11+
/*!
12+
* Concurrency-enabled mechanisms for sharing mutable and/or immutable state
13+
* between tasks.
14+
*/
1515

1616
use core::atomics;
1717
use core::clone::Clone;
@@ -51,7 +51,6 @@ use heap::deallocate;
5151
/// }
5252
/// ```
5353
#[unsafe_no_drop_flag]
54-
#[stable]
5554
pub struct Arc<T> {
5655
// FIXME #12808: strange name to try to avoid interfering with
5756
// field accesses of the contained type via Deref
@@ -63,7 +62,6 @@ pub struct Arc<T> {
6362
/// Weak pointers will not keep the data inside of the `Arc` alive, and can be
6463
/// used to break cycles between `Arc` pointers.
6564
#[unsafe_no_drop_flag]
66-
#[experimental = "Weak pointers may not belong in this module."]
6765
pub struct Weak<T> {
6866
// FIXME #12808: strange name to try to avoid interfering with
6967
// field accesses of the contained type via Deref
@@ -79,7 +77,6 @@ struct ArcInner<T> {
7977
impl<T: Share + Send> Arc<T> {
8078
/// Create an atomically reference counted wrapper.
8179
#[inline]
82-
#[stable]
8380
pub fn new(data: T) -> Arc<T> {
8481
// Start the weak pointer count as 1 which is the weak pointer that's
8582
// held by all the strong pointers (kinda), see std/rc.rs for more info
@@ -106,15 +103,14 @@ impl<T: Share + Send> Arc<T> {
106103
/// Weak pointers will not keep the data alive. Once all strong references
107104
/// to the underlying data have been dropped, the data itself will be
108105
/// destroyed.
109-
#[experimental = "Weak pointers may not belong in this module."]
110106
pub fn downgrade(&self) -> Weak<T> {
111107
// See the clone() impl for why this is relaxed
112108
self.inner().weak.fetch_add(1, atomics::Relaxed);
113109
Weak { _ptr: self._ptr }
114110
}
115111
}
116112

117-
#[unstable = "waiting on stability of Clone"]
113+
#[unstable]
118114
impl<T: Share + Send> Clone for Arc<T> {
119115
/// Duplicate an atomically reference counted wrapper.
120116
///
@@ -139,7 +135,6 @@ impl<T: Share + Send> Clone for Arc<T> {
139135
}
140136
}
141137

142-
#[experimental = "Deref is experimental."]
143138
impl<T: Send + Share> Deref<T> for Arc<T> {
144139
#[inline]
145140
fn deref<'a>(&'a self) -> &'a T {
@@ -174,7 +169,6 @@ impl<T: Send + Share + Clone> Arc<T> {
174169
}
175170

176171
#[unsafe_destructor]
177-
#[experimental = "waiting on stability of Drop"]
178172
impl<T: Share + Send> Drop for Arc<T> {
179173
fn drop(&mut self) {
180174
// This structure has #[unsafe_no_drop_flag], so this drop glue may run
@@ -218,7 +212,6 @@ impl<T: Share + Send> Drop for Arc<T> {
218212
}
219213
}
220214

221-
#[experimental = "Weak pointers may not belong in this module."]
222215
impl<T: Share + Send> Weak<T> {
223216
/// Attempts to upgrade this weak reference to a strong reference.
224217
///
@@ -244,7 +237,7 @@ impl<T: Share + Send> Weak<T> {
244237
}
245238
}
246239

247-
#[experimental = "Weak pointers may not belong in this module."]
240+
#[unstable]
248241
impl<T: Share + Send> Clone for Weak<T> {
249242
#[inline]
250243
fn clone(&self) -> Weak<T> {
@@ -255,7 +248,6 @@ impl<T: Share + Send> Clone for Weak<T> {
255248
}
256249

257250
#[unsafe_destructor]
258-
#[experimental = "Weak pointers may not belong in this module."]
259251
impl<T: Share + Send> Drop for Weak<T> {
260252
fn drop(&mut self) {
261253
// see comments above for why this check is here

branches/try/src/liballoc/boxed.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,10 @@ impl<T: Ord> Ord for Box<T> {
8787
impl<T: Eq> Eq for Box<T> {}
8888

8989
/// Extension methods for an owning `Any` trait object
90-
#[unstable = "post-DST and coherence changes, this will not be a trait but \
91-
rather a direct `impl` on `Box<Any>`"]
90+
#[unstable = "post-DST, the signature of `downcast` will change to take `Box<Self>`"]
9291
pub trait BoxAny {
9392
/// Returns the boxed value if it is of type `T`, or
9493
/// `Err(Self)` if it isn't.
95-
#[unstable = "naming conventions around accessing innards may change"]
9694
fn downcast<T: 'static>(self) -> Result<Box<T>, Self>;
9795

9896
/// Deprecated; this method has been renamed to `downcast`.
@@ -102,7 +100,6 @@ pub trait BoxAny {
102100
}
103101
}
104102

105-
#[stable]
106103
impl BoxAny for Box<Any> {
107104
#[inline]
108105
fn downcast<T: 'static>(self) -> Result<Box<T>, Box<Any>> {

branches/try/src/liballoc/rc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ impl<T> Drop for Weak<T> {
379379
}
380380
}
381381

382+
#[unstable]
382383
#[experimental = "Weak pointers may not belong in this module."]
383384
impl<T> Clone for Weak<T> {
384385
#[inline]

branches/try/src/libcollections/ringbuf.rs

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,6 @@ impl<T> RingBuf<T> {
133133
/// Retrieve an element in the RingBuf by index
134134
///
135135
/// Fails if there is no element with the given index
136-
///
137-
/// # Example
138-
///
139-
/// ```rust
140-
/// use std::collections::RingBuf;
141-
///
142-
/// let mut buf = RingBuf::new();
143-
/// buf.push(3i);
144-
/// buf.push(4);
145-
/// buf.push(5);
146-
/// assert_eq!(buf.get(1), &4);
147-
/// ```
148136
pub fn get<'a>(&'a self, i: uint) -> &'a T {
149137
let idx = self.raw_index(i);
150138
match *self.elts.get(idx) {
@@ -156,19 +144,6 @@ impl<T> RingBuf<T> {
156144
/// Retrieve an element in the RingBuf by index
157145
///
158146
/// Fails if there is no element with the given index
159-
///
160-
/// # Example
161-
///
162-
/// ```rust
163-
/// use std::collections::RingBuf;
164-
///
165-
/// let mut buf = RingBuf::new();
166-
/// buf.push(3i);
167-
/// buf.push(4);
168-
/// buf.push(5);
169-
/// *buf.get_mut(1) = 7;
170-
/// assert_eq!(buf.get(1), &7);
171-
/// ```
172147
pub fn get_mut<'a>(&'a mut self, i: uint) -> &'a mut T {
173148
let idx = self.raw_index(i);
174149
match *self.elts.get_mut(idx) {
@@ -182,20 +157,6 @@ impl<T> RingBuf<T> {
182157
/// `i` and `j` may be equal.
183158
///
184159
/// Fails if there is no element with the given index
185-
///
186-
/// # Example
187-
///
188-
/// ```rust
189-
/// use std::collections::RingBuf;
190-
///
191-
/// let mut buf = RingBuf::new();
192-
/// buf.push(3i);
193-
/// buf.push(4);
194-
/// buf.push(5);
195-
/// buf.swap(0, 2);
196-
/// assert_eq!(buf.get(0), &5);
197-
/// assert_eq!(buf.get(2), &3);
198-
/// ```
199160
pub fn swap(&mut self, i: uint, j: uint) {
200161
assert!(i < self.len());
201162
assert!(j < self.len());
@@ -235,38 +196,11 @@ impl<T> RingBuf<T> {
235196
}
236197

237198
/// Front-to-back iterator.
238-
///
239-
/// # Example
240-
///
241-
/// ```rust
242-
/// use std::collections::RingBuf;
243-
///
244-
/// let mut buf = RingBuf::new();
245-
/// buf.push(5i);
246-
/// buf.push(3);
247-
/// buf.push(4);
248-
/// assert_eq!(buf.iter().collect::<Vec<&int>>().as_slice(), &[&5, &3, &4]);
249-
/// ```
250199
pub fn iter<'a>(&'a self) -> Items<'a, T> {
251200
Items{index: 0, rindex: self.nelts, lo: self.lo, elts: self.elts.as_slice()}
252201
}
253202

254203
/// Front-to-back iterator which returns mutable values.
255-
///
256-
/// # Example
257-
///
258-
/// ```rust
259-
/// use std::collections::RingBuf;
260-
///
261-
/// let mut buf = RingBuf::new();
262-
/// buf.push(5i);
263-
/// buf.push(3);
264-
/// buf.push(4);
265-
/// for num in buf.mut_iter() {
266-
/// *num = *num - 2;
267-
/// }
268-
/// assert_eq!(buf.mut_iter().collect::<Vec<&mut int>>().as_slice(), &[&mut 3, &mut 1, &mut 2]);
269-
/// ```
270204
pub fn mut_iter<'a>(&'a mut self) -> MutItems<'a, T> {
271205
let start_index = raw_index(self.lo, self.elts.len(), 0);
272206
let end_index = raw_index(self.lo, self.elts.len(), self.nelts);

0 commit comments

Comments
 (0)