Commit Graph

58416 Commits

Author SHA1 Message Date
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
John Firebaugh
9f7cc5faa0 Use a distinct error code for "if may be missing an else clause"
Introduce the possibility of assigning distinct error codes to the various origin types of E0308. Start by assigning E0317 for the "IfExpressionWithNoElse" case, and write a long diagnostic specific to this case.

Fixes #36596
2016-10-02 13:12:35 -07: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
Jeffrey Seyfried
72544afd71 Record macro import site spans. 2016-10-02 06:07:49 +00:00
Jeffrey Seyfried
1817ca4686 Refactor out resolve_macro_name. 2016-10-02 06:07:20 +00:00
Jeffrey Seyfried
2df4f2a126 Add field backtrace: SyntaxContext to ExpansionData. 2016-10-02 06:07:08 +00:00
Jeffrey Seyfried
c9f81190f2 Refactor ext::base::Resolver::add_ext to only define macros in the crate root. 2016-10-02 06:02:47 +00:00
Gavin Baker
99aae9b834 Improve error message and snippet for "did you mean x"
- Fixes #36164
- Part of #35233
- handles unknown fields
- uses UI-style tests
- update all related tests (cfail, ui, incremental)
2016-10-02 15:57:39 +11:00
Jeffrey Seyfried
797eb57aa8 Refactor field expansion_data of Resolver to use a Mark instead of a u32. 2016-10-02 04:25:31 +00:00
Jeffrey Seyfried
5c2d76d23e Add struct macros::NameBinding. 2016-10-02 04:25:27 +00:00
bors
7b33876fcc Auto merge of #36840 - eulerdisk:incr_test_for_hash_enum, r=michaelwoerister
Test Case for Incr. Comp. Hash for enums #36674.

Fixes #36674
Part of #36350

r? @michaelwoerister
2016-10-01 20:34:34 -07:00
Oliver Middleton
06a7dcd355 std: Correct stability attributes for some implementations
These are displayed by rustdoc so should be correct.
2016-10-01 23:58:14 +01:00
bors
de901573b3 Auto merge of #36828 - pnkfelix:update-compiler-rt, r=dotdash
Update src/compiler-rt to incoporate fix for UB in floatsidf.

Update src/compiler-rt to incoporate fix for UB in floatsidf.

Fix #36518
2016-10-01 14:53:04 -07:00
Brian Anderson
0fb8379ed8 std: Remove plattform-specific code from os_str 2016-10-01 19:33:02 +00:00
Brian Anderson
d311079a6f std: Move platform specific stdio code into sys 2016-10-01 19:33:02 +00:00
Brian Anderson
fea1bd4cdf std: Move platform specific memchr code into sys 2016-10-01 19:33:02 +00:00
Brian Anderson
5c21562302 std: Move platform specific env code into sys 2016-10-01 19:32:59 +00:00
Brian Anderson
e6457bb676 std: Move platform specific path code into sys 2016-10-01 19:28:17 +00:00
bors
ab38d52df7 Auto merge of #36885 - Manishearth:rollup, r=Manishearth
Rollup of 6 pull requests

- Successful merges: #36865, #36872, #36873, #36877, #36880, #36882
- Failed merges:
2016-10-01 10:17:20 -07:00
bors
df9fa1a51e Auto merge of #36857 - Manishearth:syntax-rollup, r=Manishearth
Syntax breaking batch

None
2016-10-01 06:59:09 -07:00
Manish Goregaokar
406fe7e3c2 Rollup merge of #34764 - pnkfelix:attrs-on-generic-formals, r=eddyb
First step for #34761
2016-10-01 19:22:39 +05:30
Manish Goregaokar
259d1fcd47 Rollup merge of #36599 - jonas-schievink:whats-a-pirates-favorite-data-structure, r=pnkfelix
Contains a syntax-[breaking-change] as a separate commit (cc #31645).nnAlso renames slice patterns from `PatKind::Vec` to `PatKind::Slice`.
2016-10-01 19:22:12 +05:30
Manish Goregaokar
a73ba8b98c Rollup merge of #35874 - CensoredUsername:stmt_let_typed_fix, r=Manishearth
This commit makes the return type of AstBuilder.stmt_let_typed match the return type of other AstBuilder.stmt* functions. This avoids unnecessary boxing/unboxing whenever Stmt's are stored in a Vec, which is the default use case.nnThis is a potentially plugin breaking change.
2016-10-01 19:22:08 +05:30
Manish Goregaokar
8457ab61f6 Rollup merge of #36882 - jseyfried:fix_36881, r=eddyb
resolve: fix incorrect code in `module_to_string`

Fixes #36881.
r? @nrc or @eddyb
2016-10-01 16:38:33 +05:30