Commit Graph

57624 Commits

Author SHA1 Message Date
Jorge Aparicio
cbc56f16b4 add +d16 and +fp-only-sp to thumbv7em-none-eabihf and documentation 2016-10-03 22:28:40 -05:00
bors
5ea241b9fb Auto merge of #36876 - nikomatsakis:issue-36381, r=pnkfelix
loosen assertion against proj in collector

The collector was asserting a total absence of projections, but some projections are expected, even in trans: in particular, projections containing higher-ranked regions, which we don't currently normalize.

r? @pnkfelix

Fixes #36381
2016-10-03 19:36:27 -07:00
Brian Anderson
2e7f796e58 Fix mod declarations on untested platforms 2016-10-03 22:29:03 +00:00
Ariel Ben-Yehuda
c2a0859b3e stop having identity casts be lexprs
that made no sense (see test), and was incompatible with borrowck.

Fixes #36936.
2016-10-04 01:13:36 +03:00
bors
9c31d76e97 Auto merge of #36821 - pweaver:master, r=michaelwoerister
#36821

I am just starting to learn rust. Feedback would be appreciated.
2016-10-03 15:04:41 -07:00
Andrea Pretto
801a580aa8 Fixed lines longer than 100. 2016-10-03 23:51:22 +02:00
Martin Thoresen
d8ddef0de3
Add test for Issue #21837 2016-10-03 23:40:40 +02:00
Andrea Pretto
cf26cae4ee Test Case for Incr. Comp. Hash for traits #36681. 2016-10-03 22:59:16 +02:00
Tomasz Miąsko
4935343f6e Check for overflow in Cursor<Vec<u8>>::write.
Ensure that cursor position fits into usize, before proceeding with
write. Fixes issue #36884.
2016-10-03 22:16:13 +02:00
Pweaver (Paul Weaver)
7cf90d0a1d fixes multi-line string whitespace in librustc_incremental/persist/fs.rs 2016-10-03 15:18:27 -04:00
bors
7a26aeca77 Auto merge of #36815 - alexcrichton:stabilize-1.13, r=aturon
std: Stabilize and deprecate APIs for 1.13

This commit is intended to be backported to the 1.13 branch, and works with the
following APIs:

Stabilized

* `i32::checked_abs`
* `i32::wrapping_abs`
* `i32::overflowing_abs`
* `RefCell::try_borrow`
* `RefCell::try_borrow_mut`

Deprecated

* `BinaryHeap::push_pop`
* `BinaryHeap::replace`
* `SipHash13`
* `SipHash24`
* `SipHasher` - use `DefaultHasher` instead in the `std::collections::hash_map`
  module

Closes #28147
Closes #34767
Closes #35057
Closes #35070
2016-10-03 11:00:03 -07:00
Alex Crichton
10c3134da0 std: Stabilize and deprecate APIs for 1.13
This commit is intended to be backported to the 1.13 branch, and works with the
following APIs:

Stabilized

* `i32::checked_abs`
* `i32::wrapping_abs`
* `i32::overflowing_abs`
* `RefCell::try_borrow`
* `RefCell::try_borrow_mut`
* `DefaultHasher`
* `DefaultHasher::new`
* `DefaultHasher::default`

Deprecated

* `BinaryHeap::push_pop`
* `BinaryHeap::replace`
* `SipHash13`
* `SipHash24`
* `SipHasher` - use `DefaultHasher` instead in the `std::collections::hash_map`
  module

Closes #28147
Closes #34767
Closes #35057
Closes #35070
2016-10-03 10:34:34 -07:00
Michael Woerister
f320004a1b incr.comp.: Add test case for dependency graph of type aliases. 2016-10-03 12:30:29 -04:00
Niko Matsakis
58b75f7aa3 loosen assertion against proj in collector
The collector was asserting a total absence of projections, but some
projections are expected, even in trans: in particular, projections
containing higher-ranked regions, which we don't currently normalize.
2016-10-03 11:52:36 -04:00
Guillaume Gomez
baa854f167 Add missing urls for error module 2016-10-03 17:20:39 +02:00
bors
ff713464e6 Auto merge of #36847 - alexcrichton:rustc-macro-doc, r=nrc
rustdoc: Fix documenting rustc-macro crates

This commit adds a "hack" to the session to track whether we're a rustdoc
session or not. If we're rustdoc then we skip the expansion to add the
rustc-macro infrastructure.

Closes #36820
2016-10-03 07:40:22 -07:00
bors
75df685d28 Auto merge of #36766 - nnethercote:hash-span-capacity, r=bluss
Clarify HashMap's capacity handling.

HashMap has two notions of "capacity":

- "Usable capacity": the number of elements a hash map can hold without
  resizing. This is the meaning of "capacity" used in HashMap's API,
  e.g. the `with_capacity()` function.

- "Internal capacity": the number of allocated slots. Except for the
  zero case, it is always larger than the usable capacity (because some
  slots must be left empty) and is always a power of two.

HashMap's code is confusing because it does a poor job of
distinguishing these two meanings. I propose using two different terms
for these two concepts. Because "capacity" is already used in HashMap's
API to mean "usable capacity", I will use a different word for "internal
capacity". I propose "span", though I'm happy to consider other names.
2016-10-03 04:25:58 -07:00
bors
f3745653e1 Auto merge of #36767 - jseyfried:enforce_rfc_1560_shadowing, r=nrc
Enforce the shadowing restrictions from RFC 1560 for today's macros

This PR enforces a weakened version of the shadowing restrictions from RFC 1560. More specifically,
 - If a macro expansion contains a `macro_rules!` macro definition that is used outside of the expansion, the defined macro may not shadow an existing macro.
 - If a macro expansion contains a `#[macro_use] extern crate` macro import that is used outside of the expansion, the imported macro may not shadow an existing macro.

This is a [breaking-change]. For example,
```rust
macro_rules! m { () => {} }
macro_rules! n { () => {
    macro_rules! m { () => {} } //< This shadows an existing macro.
    m!(); //< This is inside the expansion that generated `m`'s definition, so it is OK.
} }
n!();
m!(); //< This use of `m` is outside the expansion, so it causes the shadowing to be an error.
```

r? @nrc
2016-10-03 01:30:32 -07:00
Nicholas Nethercote
9e3dcb4549 Simplify start_bpos calculation in scan_comment().
The two branches of this `if` compute the same value. This commit gets
rid of the first branch, which makes this calculation identical to the
one in scan_block_comment().
2016-10-03 19:02:33 +11:00
Nicholas Nethercote
49960ad250 Streamline StringReader::bump.
First, assert! is redundant w.r.t. the unwrap() immediately afterwards.

Second, `byte_offset_diff` is effectively computed as
`current_byte_offset + ch.len_utf8() - current_byte_offset` (with `next`
as an intermediate) which is silly and can be simplified.
2016-10-03 18:57:18 +11:00
Nicholas Nethercote
607d2973da Avoid overflow check in HashMap::reserve's fast path. 2016-10-03 14:31:30 +11:00
Nicholas Nethercote
3779971dbb Optimize plug_leaks some more.
This commit avoids the `resolve_type_vars_if_possible` call in
`plug_leaks` when `skol_map` is empty, which is the common case. It also
changes the signature of `plug_leaks` slightly to avoid the need for a
`clone` of `value`. These changes give speed-ups of up a few percent on
some of the rustc-benchmarks.
2016-10-03 13:34:48 +11:00
Nicholas Nethercote
1fece3d84b Optimize plug_leaks.
This commit avoids the `fold_regions` call in `plug_leaks` when
`skol_map` is empty, which is the common case. This gives speed-ups of
up to 1.14x on some of the rustc-benchmarks.
2016-10-03 13:32:24 +11:00
Corey Farwell
35d214afe6 Remove redundant 'Variant' in variant names, stop reexporting. 2016-10-02 21:58:23 -04:00
Corey Farwell
88d41441f6 Migrate VariantKind constructor to Clean impl.
https://github.com/rust-lang/rust/pull/36903#discussion_r81477884
2016-10-02 21:58:22 -04:00
Corey Farwell
b55468c8fe Simplify equality checks. 2016-10-02 21:58:22 -04:00
Corey Farwell
5b9ba4c550 Remove redundant 'Import' in variant names, stop reexporting. 2016-10-02 21:58:21 -04:00
Corey Farwell
a400cccd54 Cleanup return statements. 2016-10-02 21:58:20 -04:00
Corey Farwell
6d0894940f Migrate VariantKind construction function to associated function. 2016-10-02 21:58:20 -04:00
Corey Farwell
0d0f1b4690 Rename method 'to_string' to match conventions. 2016-10-02 21:58:19 -04:00
Corey Farwell
c3bc905e5f Remove redundant 'Type' in variant names, stop reexporting. 2016-10-02 21:58:18 -04:00
Corey Farwell
159b8c4e5a Update unstable attr to reference tracking issue. 2016-10-02 20:39:17 -04:00
bors
144af3e97a Auto merge of #36807 - brson:pal, r=brson
Restrict where in the tree platform-specific cfgs may be mentioned

With the ports of Rust never ending, it's important that we keep things tidy. The main thing this PR does is introduce  a new "pal" (platform abstraction layer) tidy check that limits where platform-specific CFGs may appear.

This is intended to maintain existing standards of code organization
in hopes that the standard library will continue to be refactored to
isolate platform-specific bits, making porting easier; where "standard
library" roughly means "all the dependencies of the std and test
crates".

This generally means placing restrictions on where `cfg(unix)`,
`cfg(windows)`, `cfg(target_os)` and `cfg(target_env)` may appear,
the basic objective being to isolate platform-specific code to the
platform-specific `std::sys` modules, and to the allocation,
unwinding, and libc crates.

Following are the basic rules, though there are currently
exceptions:

- core may not have platform-specific code
- liballoc_system may have platform-specific code
- liballoc_jemalloc may have platform-specific code
- libpanic_abort may have platform-specific code
- libpanic_unwind may have platform-specific code
- other crates in the std facade may not
- std may have platform-specific code in the following places
  - sys/unix/
  - sys/windows/
  - os/

There are plenty of exceptions today though, noted in the whitelist.

The end-state, IMO, is for the standard library to be portable by porting only `std::sys` (possibly extracted to its own crate), an allocator crate, an unwinder crate, and possibly a libc crate (if std depends on it); but that outcome is far off and independent of the utility of enforcing where such code lives today.

cc @rust-lang/libs
2016-10-02 17:33:34 -07:00
Philip Davis
bcac486117 Avoid introducing run twice
As it stands, getting-started and guessing-game both introduce `run` as
a new command. The second should probably make it clear that the reader
has seen it before :)
2016-10-02 15:33:41 -07:00
Brian Anderson
4d76ac8492 Move platform-specific arg handling to sys::args 2016-10-02 14:52:30 -07:00
Brian Anderson
29e0235415 Add a platform-abstraction tidy script
This is intended to maintain existing standards of code organization
in hopes that the standard library will continue to be refactored to
isolate platform-specific bits, making porting easier; where "standard
library" roughly means "all the dependencies of the std and test
crates".

This generally means placing restrictions on where `cfg(unix)`,
`cfg(windows)`, `cfg(target_os)` and `cfg(target_env)` may appear,
the basic objective being to isolate platform-specific code to the
platform-specific `std::sys` modules, and to the allocation,
unwinding, and libc crates.

Following are the basic rules, though there are currently
exceptions:

- core may not have platform-specific code
- liballoc_system may have platform-specific code
- liballoc_jemalloc may have platform-specific code
- libpanic_abort may have platform-specific code
- libpanic_unwind may have platform-specific code
- other crates in the std facade may not
- std may have platform-specific code in the following places
  - sys/unix/
  - sys/windows/
  - os/

There are plenty of exceptions today though, noted in the whitelist.
2016-10-02 14:52:15 -07:00
bors
1cdc0fb11a Auto merge of #36904 - camlorn:field_offsets_refactor, r=eddyb
Refactor layout to store offsets of fields, not offsets after fields

This is the next PR moving us towards being able to reorder struct fields.

The old code implicitly stored the offset of the first field.  This is inadequate because the first field may no longer be offset 0 in future.  This PR refactors `layout` to use a `offsets` vector instead of a `offset_after_field` vector.
2016-10-02 14:13:27 -07:00
Jorge Aparicio
6d0b8aeb97 set panic-strategy to abort 2016-10-02 15:55:49 -05:00
Jorge Aparicio
396b757fc3 set relocation-model to static 2016-10-02 15:53:28 -05:00
Jorge Aparicio
e4c3263e5f rustc -> $(RUSTC) in rmake test 2016-10-02 15:52:26 -05:00
Jorge Aparicio
901c5f2aa4 add Thumbs to the compiler
this commit adds 4 new target definitions to the compiler for easier
cross compilation to ARM Cortex-M devices.

- `thumbv6m-none-eabi`
  - For the Cortex-M0, Cortex-M0+ and Cortex-M1
  - This architecture doesn't have hardware support (instructions) for
    atomics. Hence, the `Atomic*` structs are not available for this
    target.
- `thumbv7m-none-eabi`
  - For the Cortex-M3
- `thumbv7em-none-eabi`
  - For the FPU-less variants of the Cortex-M4 and Cortex-M7
  - On this target, all the floating point operations will be lowered
    software routines (intrinsics)
- `thumbv7em-none-eabihf`
  - For the variants of the Cortex-M4 and Cortex-M7 that do have a FPU.
  - On this target, all the floating point operations will be lowered
    to hardware instructions

No binary releases of standard crates, like `core`, are planned for
these targets because Cargo, in the future, will compile e.g. the `core`
crate on the fly as part of the `cargo build` process. In the meantime,
you'll have to compile the `core` crate yourself. [Xargo] is the easiest
way to do that as in handles the compilation of `core` automatically and
can be used just like Cargo: `xargo build --target thumbv6m-none-eabi`
is all that's needed.

[Xargo]: https://crates.io/crates/xargo
2016-10-02 15:52:26 -05:00
Austin Hicks
9482bce56e Replace offset_after_field with offsets 2016-10-02 13:13:40 -04:00
bors
8991ffc303 Auto merge of #36404 - christopherdumas:master, r=GuillaumeGomez
Documentation change to macros.rs for `includes!`

I'm not sure if this documentation is clear or extensive enough, but this is just to get started on the problem, fixes issue #36387.
2016-10-02 08:32:07 -07:00
Guillaume Gomez
cb22364f32 Merge E0002 into E0004 2016-10-02 15:45:06 +02:00
Guillaume Gomez
a638580c08 fix typos 2016-10-02 14:45:49 +02:00
bors
791fb778cc Auto merge of #36862 - chamoysvoice:E0220, r=GuillaumeGomez
Update E0220 error format

@jonathandturner
Part of #35233 .
Fixes #35385.
2016-10-02 05:01:57 -07:00
Jeffrey Seyfried
057302bcd9 Fix fallout in tests. 2016-10-02 08:25:28 +00:00
Jeffrey Seyfried
9de6bdc3cf Add test. 2016-10-02 08:25:28 +00:00
Jeffrey Seyfried
ed1e00268b Enforce the weakened shadowing restriction. 2016-10-02 08:25:27 +00:00
bors
fe36876ce1 Auto merge of #36853 - TimNN:rustbuild-out-of-tree, r=alexcrichton
fix out-of-tree rustbuild

See https://github.com/rust-lang/rust/pull/36456#issuecomment-250589906

r? @alexcrichton
2016-10-01 23:53:35 -07:00