This required some contortions because importing both raw::Slice
and slice::Slice makes rustc crash.
Since `Slice` is in the prelude, this renaming is unlikely to
casue breakage.
[breaking-change]
ImmutableVector -> ImmutableSlice
ImmutableEqVector -> ImmutableEqSlice
ImmutableOrdVector -> ImmutableOrdSlice
MutableVector -> MutableSlice
MutableVectorAllocating -> MutableSliceAllocating
MutableCloneableVector -> MutableCloneableSlice
MutableOrdVector -> MutableOrdSlice
These are all in the prelude so most code will not break.
[breaking-change]
I chose to make two of them because I wanted something close to an
"end-to-end" test (*), but at the same time I wanted a test that
would run on Windows (**).
(*) The run-make test serves as the end-to-end: It constructs an input
that is trying to subvert the hack and we are going to check that it
fails in the attempt).
(**) The compile-fail-fulldeps test serves as a more narrow test that
will be tested on all platforms. It also attempts to subvert the
hack, testing that when you use `new_parser_from_tts`, the resulting
parser does not support reading embedded Idents.
This adds support to `quote_expr!` and friends for round-trip hygienic
preservation of Ident.
Here are the pieces of the puzzle:
* adding a method for encoding Ident for re-reading into token tree.
* Support for reading such encoded Idents in the lexer. Note that one
must peek ahead for MOD_SEP after scan_embedded_hygienic_ident.
* To ensure that encoded Idents are only read when we are in the midst
of expanding a `quote_expr` or similar, added a
`read_embedded_ident` flag on `StringReader`.
* pprust support for encoding Ident's as (uint,uint) pairs (for hygiene).
rust.md: Explicitly point out how special `'static` is.
Drive-by: fix description of `&content` to point out that `&'f type` is (as of today) only for type expressions.
This fixes borrow checking for closures. Code like this will break:
struct Foo {
x: int,
}
pub fn main() {
let mut this = &mut Foo {
x: 1,
};
let r = || {
let p = &this.x;
&mut this.x;
};
r()
}
Change this code to not take multiple mutable references to the same value. For
example:
struct Foo {
x: int,
}
pub fn main() {
let mut this = &mut Foo {
x: 1,
};
let r = || {
&mut this.x;
};
r()
}
Closes#16361.
[breaking-change]
r? @nikomatsakis
`for` loop heads.
This breaks code like:
let x = Some(box 1i);
for &a in x.iter() {
}
Change this code to obey the borrow checking rules. For example:
let x = Some(box 1i);
for &ref a in x.iter() {
}
Closes#16205.
[breaking-change]
r? @nikomatsakis
* The caller should be responsible for cleaning up file descriptors
* If a caller safely creates a file descriptor (via
native::io::file::open) the returned structure (FileDesc) will try to
clean up the file, failing in the process and writing error messages
to the screen.
* This should not happen as the caller has no public interface for
telling the FileDesc structure to NOT free the underlying fd.
* Alternatively, if another file is opened under the same fd held by
the FileDesc structure returned by native::io::file::open, it will
close the wrong file upon destruction.
This code produces an ICE:
```rust
#![crate_type = "rlib"]
fn main() {
if true { return }
// remaining code is unreachable
match () {
() => { static MAGIC: uint = 0; }
}
}
```
([playpen](http://is.gd/iwOISB))
The error is "encode_symbol: id not found 18", where 18 is the `NodeId` of the declaration of `MAGIC`. The problem is that `rustc` tries to emit metadata for `MAGIC`, but some of the information is missing because `MAGIC` never gets translated by `trans_item` - the entire body of the `match` gets skipped because the `match` itself is unreachable.
This branch simplifies the handling of inner items by always processing them using the `trans_item` visitor, instead of sometimes using the visitor and sometimes waiting until `trans_stmt` encounters the item. This fixes the ICE by making the translation of the item no longer depend on the declaration being reachable code. This branch also reverts #16059 and #16359, since the new change to item translation fixes the same problems as those but is simpler.
`for` loop heads.
This breaks code like:
let x = Some(box 1i);
for &a in x.iter() {
}
Change this code to obey the borrow checking rules. For example:
let x = Some(box 1i);
for &ref a in x.iter() {
}
Closes#16205.
[breaking-change]
Previously the stability lint considered cross-crate items only. That's appropriate for unstable and experimental levels, but not for deprecation.
In addition to changing the lint, this PR takes care of the fallout: a number of deprecated items that were being used throughout libstd.
Closes#16409
Due to deny(deprecated), this is a:
[breaking-change]
This fixes borrow checking for closures. Code like this will break:
struct Foo {
x: int,
}
pub fn main() {
let mut this = &mut Foo {
x: 1,
};
let r = || {
let p = &this.x;
&mut this.x;
};
r()
}
Change this code to not take multiple mutable references to the same value. For
example:
struct Foo {
x: int,
}
pub fn main() {
let mut this = &mut Foo {
x: 1,
};
let r = || {
&mut this.x;
};
r()
}
Closes#16361.
[breaking-change]
Previously the lint considered cross-crate items only. That's
appropriate for unstable and experimental levels, but not for
deprecation.
Closes#16409
Due to deny(deprecation), this is a:
[breaking-change]
For historical reasons, "Win32" has been used in Rust codebase to mean "Windows OS in general".
This is confusing, especially now, that Rust supports Win64 builds.
[breaking-change]
Implement `Index` for `RingBuf`, `HashMap`, `TreeMap`, `SmallIntMap`, and `TrieMap`.
If there’s anything that I missed or should be removed, let me know.
There was a bug in both libnative and libuv which prevented child processes from
being spawned correctly on windows when one of the arguments was an empty
string. The libuv bug has since been fixed upstream, and the libnative bug was
fixed as part of this commit.
When updating libuv, this also includes a fix for #15149.
Closes#15149Closes#16272