]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoAuto merge of #36944 - brson:modos, r=alexcrichton
bors [Wed, 5 Oct 2016 16:14:02 +0000 (09:14 -0700)]
Auto merge of #36944 - brson:modos, r=alexcrichton

Fix mod declarations on untested platforms

r? @alexcrichton

7 years agoAuto merge of #36736 - srinivasreddy:method, r=nrc
bors [Wed, 5 Oct 2016 12:53:01 +0000 (05:53 -0700)]
Auto merge of #36736 - srinivasreddy:method, r=nrc

run rustfmt on librustc_typeck/check/method  folder

7 years agoAuto merge of #36971 - brson:docdir, r=alexcrichton
bors [Wed, 5 Oct 2016 09:34:06 +0000 (02:34 -0700)]
Auto merge of #36971 - brson:docdir, r=alexcrichton

Update rust-installer. Fixes #36451

Via https://github.com/rust-lang/rust-installer/pull/54. Untested...

r? @alexcrichton

7 years agoAuto merge of #36958 - nikomatsakis:issue-36856, r=eddyb
bors [Wed, 5 Oct 2016 06:13:08 +0000 (23:13 -0700)]
Auto merge of #36958 - nikomatsakis:issue-36856, r=eddyb

force `i1` booleans to `i8` when comparing

Work around LLVM bug.

cc #36856

r? @eddyb

7 years agorun rustfmt on librustc_typeck/check/method folder
Srinivas Reddy Thatiparthy [Tue, 4 Oct 2016 03:36:07 +0000 (09:06 +0530)]
run rustfmt on librustc_typeck/check/method folder

7 years agoAuto merge of #36942 - arielb1:cast-lifetimes, r=eddyb
bors [Wed, 5 Oct 2016 02:51:08 +0000 (19:51 -0700)]
Auto merge of #36942 - arielb1:cast-lifetimes, r=eddyb

stop having identity casts be lexprs

that made no sense (see test), and was incompatible with borrowck.

Fixes #36936.

beta-nominated since (bad) regression.

r? @eddyb

7 years agoUpdate rust-installer. Fixes #36451
Brian Anderson [Wed, 5 Oct 2016 00:17:30 +0000 (00:17 +0000)]
Update rust-installer. Fixes #36451

7 years agoAuto merge of #36814 - petrochenkov:def, r=eddyb
bors [Tue, 4 Oct 2016 23:30:30 +0000 (16:30 -0700)]
Auto merge of #36814 - petrochenkov:def, r=eddyb

Refactoring/bugfixing around definitions for struct/variant constructors

 https://github.com/rust-lang/rust/commit/d917c364ad0edfa441e5c219da1b00511b976789 separates definitions for struct/variant constructors living in value namespace from struct/variant type definitions.

https://github.com/rust-lang/rust/commit/adfb37827b3a52a83dd11d5781e5b492714a5d4c fixes cross-crate resolution of reexports reexporting half-items, like struct constructors without struct type or types without constructor. Such reexports can appear due to glob shadowing.
Resolution now is not affected by the order in which items and reexports are decoded from metadata (cc https://github.com/rust-lang/rust/issues/31337#issuecomment-183996263). `try_define` is not used during building reduced graph anymore.
500 lines of this PR are tests for this exotic situation, the remaining line diff count is actually negative! :)

https://github.com/rust-lang/rust/commit/c695d0c8756a87c0708b97b7e277b6a3f4712b97 (and partially https://github.com/rust-lang/rust/commit/aabf132de04643602ec17b6abab9e276366d9c6d) moves most of pattern resolution checks from typeck to resolve (except those checking for associated items), uses the same wording for pattern resolution error messages from both typeck and resolve and makes the messages more precise.

https://github.com/rust-lang/rust/commit/11e3524e5afa4ac1b04aece67fb683f078e63f37 fixes seemingly incorrectly set `NON_ZERO_SIZED` attributes for struct/variant ctors in const eval.

https://github.com/rust-lang/rust/commit/4586fea2531054d9b25f8663f1ba4b32b07c11c2 eliminates `ty::VariantKind` in favor of `def::CtorKind`. The logic is that variant kinds are irrelevant for types, they make sense only when we deal with constructor functions/constants. Despite that `VariantDefData` still keeps a copy of `CtorKind`, but it's used only for various kinds of pretty-printing (and for storing in metadata).

https://github.com/rust-lang/rust/commit/aabf132de04643602ec17b6abab9e276366d9c6d is mostly a cleanup of various impossible or improperly used definitions, and other small definition cleanups.

cc @jseyfried
r? @eddyb

7 years agoRemove some unused methods from metadata
Vadim Petrochenkov [Wed, 14 Sep 2016 21:51:46 +0000 (00:51 +0300)]
Remove some unused methods from metadata

Address comments + Fix rebase

7 years agoAuto merge of #36933 - alexcrichton:less-neon-again, r=eddyb
bors [Tue, 4 Oct 2016 20:23:09 +0000 (13:23 -0700)]
Auto merge of #36933 - alexcrichton:less-neon-again, r=eddyb

rustc: Try again to disable NEON on armv7 linux

This is a follow-up to #35814 which apparently didn't disable it hard enough. It
looks like LLVM's default armv7 target enables NEON so we'd otherwise have to
pass `-neon`, but we're already enabling armv7 with `+v7` supposedly, so let's
try just telling LLVM that the armv7 target is arm and then enable features
selectively.

Closes #36913

7 years agoTurn some impossible definitions into ICEs
Vadim Petrochenkov [Wed, 14 Sep 2016 21:51:46 +0000 (00:51 +0300)]
Turn some impossible definitions into ICEs

7 years agoEliminate ty::VariantKind in favor of def::CtorKind
Vadim Petrochenkov [Wed, 14 Sep 2016 21:51:46 +0000 (00:51 +0300)]
Eliminate ty::VariantKind in favor of def::CtorKind

7 years agoSet `NON_ZERO_SIZED` flag correctly for struct/union ctors
Vadim Petrochenkov [Wed, 14 Sep 2016 21:51:46 +0000 (00:51 +0300)]
Set `NON_ZERO_SIZED` flag correctly for struct/union ctors

And for methods/functions as well, they are zero-sized now

7 years agoMove pattern resolution checks from typeck to resolve
Vadim Petrochenkov [Wed, 14 Sep 2016 21:51:46 +0000 (00:51 +0300)]
Move pattern resolution checks from typeck to resolve

Make error messages more precise

7 years agoFurther cleanup in resolve
Vadim Petrochenkov [Wed, 14 Sep 2016 21:51:46 +0000 (00:51 +0300)]
Further cleanup in resolve

`try_define` is not used in build_reduced_graph anymore
Collection of field names for error reporting is optimized
Some comments added

7 years agoFix cross-crate resolution of half-items created by export shadowing
Vadim Petrochenkov [Wed, 14 Sep 2016 21:51:46 +0000 (00:51 +0300)]
Fix cross-crate resolution of half-items created by export shadowing

7 years agoSeparate Def::StructCtor/Def::VariantCtor from Def::Struct/Def::Variant
Vadim Petrochenkov [Wed, 14 Sep 2016 21:51:46 +0000 (00:51 +0300)]
Separate Def::StructCtor/Def::VariantCtor from Def::Struct/Def::Variant

7 years agorustc: Try again to disable NEON on armv7 linux
Alex Crichton [Mon, 3 Oct 2016 17:09:28 +0000 (10:09 -0700)]
rustc: Try again to disable NEON on armv7 linux

This is a follow-up to #35814 which apparently didn't disable it hard enough. It
looks like LLVM's default armv7 target enables NEON so we'd otherwise have to
pass `-neon`, but we're already enabling armv7 with `+v7` supposedly, so let's
try just telling LLVM that the armv7 target is arm and then enable features
selectively.

Closes #36913

7 years agoAuto merge of #36874 - japaric:thumbs, r=alexcrichton
bors [Tue, 4 Oct 2016 15:29:41 +0000 (08:29 -0700)]
Auto merge of #36874 - japaric:thumbs, r=alexcrichton

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

---

cc @brson @alexcrichton

7 years agoAuto merge of #36953 - Manishearth:rollup, r=Manishearth
bors [Tue, 4 Oct 2016 11:15:20 +0000 (04:15 -0700)]
Auto merge of #36953 - Manishearth:rollup, r=Manishearth

Rollup of 12 pull requests

- Successful merges: #36798, #36878, #36902, #36903, #36908, #36916, #36917, #36921, #36928, #36938, #36941, #36951
- Failed merges:

7 years agoforce `i1` booleans to `i8` when comparing
Niko Matsakis [Tue, 4 Oct 2016 09:55:45 +0000 (05:55 -0400)]
force `i1` booleans to `i8` when comparing

Work around LLVM bug.

cc #36856

7 years agoRollup merge of #36951 - nnethercote:fix-ICE, r=eddyb
Manish Goregaokar [Tue, 4 Oct 2016 09:54:04 +0000 (15:24 +0530)]
Rollup merge of #36951 - nnethercote:fix-ICE, r=eddyb

Fix an ICE in BuildReducedGraphVisitor::visit_trait_item.

This ICE occurs in the futures-rs-test-all benchmark in rustc-benchmarks (fixes #36950).

7 years agoRollup merge of #36941 - martinhath:issue-21837, r=alexcrichton
Manish Goregaokar [Tue, 4 Oct 2016 09:54:04 +0000 (15:24 +0530)]
Rollup merge of #36941 - martinhath:issue-21837, r=alexcrichton

Add regression test for Issue #21837

This PR adds a regression test for Issue #21837, as explained in the comments of the issue.

7 years agoRollup merge of #36938 - tmiasko:cursor-seek-overflow, r=alexcrichton
Manish Goregaokar [Tue, 4 Oct 2016 09:54:04 +0000 (15:24 +0530)]
Rollup merge of #36938 - tmiasko:cursor-seek-overflow, r=alexcrichton

Check for overflow in Cursor<Vec<u8>>::write.

Ensure that cursor position fits into usize, before proceeding with
write. Fixes issue #36884.

7 years agoRollup merge of #36928 - GuillaumeGomez:error_urls, r=steveklabnik
Manish Goregaokar [Tue, 4 Oct 2016 09:54:04 +0000 (15:24 +0530)]
Rollup merge of #36928 - GuillaumeGomez:error_urls, r=steveklabnik

Add missing urls for error module

r? @steveklabnik

7 years agoRollup merge of #36921 - nnethercote:two-lexer-tweaks, r=nrc
Manish Goregaokar [Tue, 4 Oct 2016 09:54:03 +0000 (15:24 +0530)]
Rollup merge of #36921 - nnethercote:two-lexer-tweaks, r=nrc

Two lexer tweaks

19 days later, I haven't received a review of my commits in #36470. In an attempt to make some progress, I'm going to split up the changes. Here are the ones that don't relate to renaming things.

7 years agoRollup merge of #36917 - nnethercote:speed-up-plug_leaks, r=eddyb
Manish Goregaokar [Tue, 4 Oct 2016 09:54:03 +0000 (15:24 +0530)]
Rollup merge of #36917 - nnethercote:speed-up-plug_leaks, r=eddyb

Speed up `plug_leaks`

Profiling shows that `plug_leaks` and the functions it calls are hot on some benchmarks. It's very common that `skol_map` is empty in this function, and we can specialize `plug_leaks` in that case for some big speed-ups.

The PR has two commits. I'm fairly confident that the first one is correct -- I traced through the code to confirm that the `fold_regions` and `pop_skolemized` calls are no-ops when `skol_map` is empty, and I also temporarily added an assertion to check that `result` ends up having the same value as `value` in that case. This commit is responsible for most of the improvement.

I'm less confident about the second commit. The call to `resolve_type_vars_is_possible` can change `value` when `skol_map` is empty... but testing suggests that it doesn't matter if the call is
omitted.

So, please check both patches carefully, especially the second one!

Here are the speed-ups for the first commit alone.

stage1 compiler (built with old rustc, using glibc malloc), doing debug builds:
```
futures-rs-test  4.710s vs  4.538s --> 1.038x faster (variance: 1.009x, 1.005x)
issue-32062-equ  0.415s vs  0.368s --> 1.129x faster (variance: 1.009x, 1.010x)
issue-32278-big  1.884s vs  1.808s --> 1.042x faster (variance: 1.020x, 1.017x)
jld-day15-parse  1.907s vs  1.668s --> 1.143x faster (variance: 1.011x, 1.007x)
piston-image-0. 13.024s vs 12.421s --> 1.049x faster (variance: 1.004x, 1.012x)
rust-encoding-0  3.335s vs  3.276s --> 1.018x faster (variance: 1.021x, 1.028x)
```
stage2 compiler (built with new rustc, using jemalloc), doing debug builds:
```
futures-rs-test  4.167s vs  4.065s --> 1.025x faster (variance: 1.006x, 1.018x)
issue-32062-equ  0.383s vs  0.343s --> 1.118x faster (variance: 1.012x, 1.016x)
issue-32278-big  1.680s vs  1.621s --> 1.036x faster (variance: 1.007x, 1.007x)
jld-day15-parse  1.671s vs  1.478s --> 1.131x faster (variance: 1.016x, 1.004x)
piston-image-0. 11.336s vs 10.852s --> 1.045x faster (variance: 1.003x, 1.006x)
rust-encoding-0  3.036s vs  2.971s --> 1.022x faster (variance: 1.030x, 1.032x)
```
I've omitted the benchmarks for which the change was negligible.

And here are the speed-ups for the first and second commit in combination.

stage1 compiler (built with old rustc, using glibc malloc), doing debug
builds:
```
futures-rs-test  4.684s vs  4.498s --> 1.041x faster (variance: 1.012x, 1.012x)
issue-32062-equ  0.413s vs  0.355s --> 1.162x faster (variance: 1.019x, 1.006x)
issue-32278-big  1.869s vs  1.763s --> 1.060x faster (variance: 1.013x, 1.018x)
jld-day15-parse  1.900s vs  1.602s --> 1.186x faster (variance: 1.010x, 1.003x)
piston-image-0. 12.907s vs 12.352s --> 1.045x faster (variance: 1.005x, 1.006x)
rust-encoding-0  3.254s vs  3.248s --> 1.002x faster (variance: 1.063x, 1.045x)
```
stage2 compiler (built with new rustc, using jemalloc), doing debug builds:
```
futures-rs-test  4.183s vs  4.046s --> 1.034x faster (variance: 1.007x, 1.004x)
issue-32062-equ  0.380s vs  0.340s --> 1.117x faster (variance: 1.020x, 1.003x)
issue-32278-big  1.671s vs  1.616s --> 1.034x faster (variance: 1.031x, 1.012x)
jld-day15-parse  1.661s vs  1.417s --> 1.172x faster (variance: 1.013x, 1.005x)
piston-image-0. 11.347s vs 10.841s --> 1.047x faster (variance: 1.007x, 1.010x)
rust-encoding-0  3.050s vs  3.000s --> 1.017x faster (variance: 1.016x, 1.012x)
```
@eddyb: `git blame` suggests that you should review this. Thanks!

7 years agoRollup merge of #36916 - frewsxcv:patch-1, r=alexcrichton
Manish Goregaokar [Tue, 4 Oct 2016 09:54:03 +0000 (15:24 +0530)]
Rollup merge of #36916 - frewsxcv:patch-1, r=alexcrichton

Update unstable attr to reference tracking issue.

7 years agoRollup merge of #36908 - GuillaumeGomez:default_doc, r=apasel422
Manish Goregaokar [Tue, 4 Oct 2016 09:54:03 +0000 (15:24 +0530)]
Rollup merge of #36908 - GuillaumeGomez:default_doc, r=apasel422

fix typos

r? @steveklabnik

7 years agoRollup merge of #36903 - frewsxcv:typekind, r=jseyfried
Manish Goregaokar [Tue, 4 Oct 2016 09:54:02 +0000 (15:24 +0530)]
Rollup merge of #36903 - frewsxcv:typekind, r=jseyfried

Minor librustdoc cleanup and refactoring.

7 years agoRollup merge of #36902 - ollie27:stab_impls, r=alexcrichton
Manish Goregaokar [Tue, 4 Oct 2016 09:54:02 +0000 (15:24 +0530)]
Rollup merge of #36902 - ollie27:stab_impls, r=alexcrichton

std: Correct stability attributes for some implementations

These are displayed by rustdoc so should be correct.

7 years agoRollup merge of #36878 - BlueSpaceCanary:book-dedup-cargo-run-intro, r=GuillaumeGomez
Manish Goregaokar [Tue, 4 Oct 2016 09:54:02 +0000 (15:24 +0530)]
Rollup merge of #36878 - BlueSpaceCanary:book-dedup-cargo-run-intro, r=GuillaumeGomez

Avoid introducing `run` twice in the Rust book

As it stands, getting-started.md and guessing-game.md both introduce `run` as a new command. I switched it so that the 2nd refers back to the first introduction, rather than re-introducing the command.

(First ever FOSS PR, sorry if I screwed up anything obvious :) )

r? @steveklabnik

7 years agoRollup merge of #36798 - gavinb:fix/36164, r=GuillaumeGomez
Manish Goregaokar [Tue, 4 Oct 2016 09:54:01 +0000 (15:24 +0530)]
Rollup merge of #36798 - gavinb:fix/36164, r=GuillaumeGomez

Improve error message and snippet for "did you mean `x`"

- Fixes #36164
- Part of #35233

Based on the standalone example https://is.gd/8STXMd posted by @nikomatsakis and using the third formatting option mentioned in #36164 and agreed by @jonathandturner.

Note however this does not address the question of [how to handle an empty or unknown suggestion](https://github.com/rust-lang/rust/issues/36164#issuecomment-244460024). @nikomatsakis any suggestions on how best to address that part?

7 years agoFix an ICE in BuildReducedGraphVisitor::visit_trait_item.
Nicholas Nethercote [Tue, 4 Oct 2016 05:36:14 +0000 (16:36 +1100)]
Fix an ICE in BuildReducedGraphVisitor::visit_trait_item.

This ICE occurs in the futures-rs-test-all benchmark in
rustc-benchmarks.

7 years agochange max_atomic_width type from u64 to Option<u64>
Jorge Aparicio [Tue, 4 Oct 2016 04:45:40 +0000 (23:45 -0500)]
change max_atomic_width type from u64 to Option<u64>

to better express the idea that omitting this field defaults this value
to target_pointer_width

7 years agofix: "abort" -> PanicStrategy
Jorge Aparicio [Tue, 4 Oct 2016 03:54:59 +0000 (22:54 -0500)]
fix: "abort" -> PanicStrategy

7 years agoadd a reference about the stated FP facts
Jorge Aparicio [Tue, 4 Oct 2016 03:34:33 +0000 (22:34 -0500)]
add a reference about the stated FP facts

7 years agoadd +d16 and +fp-only-sp to thumbv7em-none-eabihf and documentation
Jorge Aparicio [Tue, 4 Oct 2016 03:28:40 +0000 (22:28 -0500)]
add +d16 and +fp-only-sp to thumbv7em-none-eabihf and documentation

7 years agoAuto merge of #36876 - nikomatsakis:issue-36381, r=pnkfelix
bors [Tue, 4 Oct 2016 02:36:27 +0000 (19:36 -0700)]
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

7 years agoFix mod declarations on untested platforms
Brian Anderson [Mon, 3 Oct 2016 22:29:03 +0000 (22:29 +0000)]
Fix mod declarations on untested platforms

7 years agostop having identity casts be lexprs
Ariel Ben-Yehuda [Mon, 3 Oct 2016 22:13:36 +0000 (01:13 +0300)]
stop having identity casts be lexprs

that made no sense (see test), and was incompatible with borrowck.

Fixes #36936.

7 years agoAuto merge of #36821 - pweaver:master, r=michaelwoerister
bors [Mon, 3 Oct 2016 22:04:41 +0000 (15:04 -0700)]
Auto merge of #36821 - pweaver:master, r=michaelwoerister

 #36821

I am just starting to learn rust. Feedback would be appreciated.

7 years agoAdd test for Issue #21837
Martin Thoresen [Mon, 3 Oct 2016 12:46:21 +0000 (14:46 +0200)]
Add test for Issue #21837

7 years agoCheck for overflow in Cursor<Vec<u8>>::write.
Tomasz MiÄ…sko [Fri, 30 Sep 2016 22:00:00 +0000 (00:00 +0200)]
Check for overflow in Cursor<Vec<u8>>::write.

Ensure that cursor position fits into usize, before proceeding with
write. Fixes issue #36884.

7 years agofixes multi-line string whitespace in librustc_incremental/persist/fs.rs
Pweaver (Paul Weaver) [Mon, 3 Oct 2016 19:18:27 +0000 (15:18 -0400)]
fixes multi-line string whitespace in librustc_incremental/persist/fs.rs

7 years agoAuto merge of #36815 - alexcrichton:stabilize-1.13, r=aturon
bors [Mon, 3 Oct 2016 18:00:03 +0000 (11:00 -0700)]
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

7 years agostd: Stabilize and deprecate APIs for 1.13
Alex Crichton [Thu, 29 Sep 2016 00:23:36 +0000 (17:23 -0700)]
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

7 years agoloosen assertion against proj in collector
Niko Matsakis [Fri, 30 Sep 2016 22:15:11 +0000 (18:15 -0400)]
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.

7 years agoAdd missing urls for error module
Guillaume Gomez [Mon, 3 Oct 2016 15:20:39 +0000 (17:20 +0200)]
Add missing urls for error module

7 years agoAuto merge of #36847 - alexcrichton:rustc-macro-doc, r=nrc
bors [Mon, 3 Oct 2016 14:40:22 +0000 (07:40 -0700)]
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

7 years agoAuto merge of #36766 - nnethercote:hash-span-capacity, r=bluss
bors [Mon, 3 Oct 2016 11:25:58 +0000 (04:25 -0700)]
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.

7 years agoAuto merge of #36767 - jseyfried:enforce_rfc_1560_shadowing, r=nrc
bors [Mon, 3 Oct 2016 08:30:32 +0000 (01:30 -0700)]
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

7 years agoSimplify `start_bpos` calculation in scan_comment().
Nicholas Nethercote [Mon, 3 Oct 2016 07:58:35 +0000 (18:58 +1100)]
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().

7 years agoStreamline StringReader::bump.
Nicholas Nethercote [Mon, 3 Oct 2016 07:57:18 +0000 (18:57 +1100)]
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.

7 years agoAvoid overflow check in `HashMap::reserve`'s fast path.
Nicholas Nethercote [Mon, 3 Oct 2016 03:31:30 +0000 (14:31 +1100)]
Avoid overflow check in `HashMap::reserve`'s fast path.

7 years agoOptimize plug_leaks some more.
Nicholas Nethercote [Fri, 30 Sep 2016 07:44:48 +0000 (17:44 +1000)]
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.

7 years agoOptimize plug_leaks.
Nicholas Nethercote [Thu, 29 Sep 2016 10:34:28 +0000 (20:34 +1000)]
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.

7 years agoRemove redundant 'Variant' in variant names, stop reexporting.
Corey Farwell [Mon, 3 Oct 2016 00:07:18 +0000 (20:07 -0400)]
Remove redundant 'Variant' in variant names, stop reexporting.

7 years agoMigrate `VariantKind` constructor to `Clean` impl.
Corey Farwell [Sun, 2 Oct 2016 23:59:48 +0000 (19:59 -0400)]
Migrate `VariantKind` constructor to `Clean` impl.

https://github.com/rust-lang/rust/pull/36903#discussion_r81477884

7 years agoSimplify equality checks.
Corey Farwell [Sun, 2 Oct 2016 01:18:33 +0000 (21:18 -0400)]
Simplify equality checks.

7 years agoRemove redundant 'Import' in variant names, stop reexporting.
Corey Farwell [Sat, 1 Oct 2016 21:35:53 +0000 (17:35 -0400)]
Remove redundant 'Import' in variant names, stop reexporting.

7 years agoCleanup `return` statements.
Corey Farwell [Sat, 1 Oct 2016 20:47:43 +0000 (16:47 -0400)]
Cleanup `return` statements.

7 years agoMigrate `VariantKind` construction function to associated function.
Corey Farwell [Sat, 1 Oct 2016 19:09:27 +0000 (15:09 -0400)]
Migrate `VariantKind` construction function to associated function.

7 years agoRename method 'to_string' to match conventions.
Corey Farwell [Sat, 1 Oct 2016 15:15:42 +0000 (11:15 -0400)]
Rename method 'to_string' to match conventions.

7 years agoRemove redundant 'Type' in variant names, stop reexporting.
Corey Farwell [Sat, 1 Oct 2016 04:34:00 +0000 (00:34 -0400)]
Remove redundant 'Type' in variant names, stop reexporting.

7 years agoUpdate unstable attr to reference tracking issue.
Corey Farwell [Mon, 3 Oct 2016 00:39:17 +0000 (20:39 -0400)]
Update unstable attr to reference tracking issue.

7 years agoAuto merge of #36807 - brson:pal, r=brson
bors [Mon, 3 Oct 2016 00:33:34 +0000 (17:33 -0700)]
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

7 years agoAvoid introducing `run` twice
Philip Davis [Fri, 30 Sep 2016 22:13:20 +0000 (15:13 -0700)]
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 :)

7 years agoMove platform-specific arg handling to sys::args
Brian Anderson [Thu, 29 Sep 2016 22:00:44 +0000 (22:00 +0000)]
Move platform-specific arg handling to sys::args

7 years agoAdd a platform-abstraction tidy script
Brian Anderson [Thu, 22 Sep 2016 01:30:30 +0000 (01:30 +0000)]
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.

7 years agoAuto merge of #36904 - camlorn:field_offsets_refactor, r=eddyb
bors [Sun, 2 Oct 2016 21:13:27 +0000 (14:13 -0700)]
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.

7 years agoset panic-strategy to abort
Jorge Aparicio [Sun, 2 Oct 2016 20:55:49 +0000 (15:55 -0500)]
set panic-strategy to abort

7 years agoset relocation-model to static
Jorge Aparicio [Sun, 2 Oct 2016 20:53:28 +0000 (15:53 -0500)]
set relocation-model to static

7 years agorustc -> $(RUSTC) in rmake test
Jorge Aparicio [Sat, 1 Oct 2016 04:13:44 +0000 (23:13 -0500)]
rustc -> $(RUSTC) in rmake test

7 years agoadd Thumbs to the compiler
Jorge Aparicio [Fri, 16 Sep 2016 01:46:04 +0000 (20:46 -0500)]
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

7 years agoReplace offset_after_field with offsets
Austin Hicks [Sun, 2 Oct 2016 01:25:40 +0000 (21:25 -0400)]
Replace offset_after_field with offsets

7 years agoAuto merge of #36404 - christopherdumas:master, r=GuillaumeGomez
bors [Sun, 2 Oct 2016 15:32:07 +0000 (08:32 -0700)]
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.

7 years agofix typos
Guillaume Gomez [Sun, 2 Oct 2016 12:45:49 +0000 (14:45 +0200)]
fix typos

7 years agoAuto merge of #36862 - chamoysvoice:E0220, r=GuillaumeGomez
bors [Sun, 2 Oct 2016 12:01:57 +0000 (05:01 -0700)]
Auto merge of #36862 - chamoysvoice:E0220, r=GuillaumeGomez

Update E0220 error format

@jonathandturner
Part of #35233 .
Fixes #35385.

7 years agoFix fallout in tests.
Jeffrey Seyfried [Tue, 27 Sep 2016 06:38:17 +0000 (06:38 +0000)]
Fix fallout in tests.

7 years agoAdd test.
Jeffrey Seyfried [Sun, 2 Oct 2016 07:46:17 +0000 (07:46 +0000)]
Add test.

7 years agoEnforce the weakened shadowing restriction.
Jeffrey Seyfried [Sun, 2 Oct 2016 01:41:19 +0000 (01:41 +0000)]
Enforce the weakened shadowing restriction.

7 years agoAuto merge of #36853 - TimNN:rustbuild-out-of-tree, r=alexcrichton
bors [Sun, 2 Oct 2016 06:53:35 +0000 (23:53 -0700)]
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

7 years agoRecord macro import site spans.
Jeffrey Seyfried [Sun, 2 Oct 2016 04:21:34 +0000 (04:21 +0000)]
Record macro import site spans.

7 years agoRefactor out `resolve_macro_name`.
Jeffrey Seyfried [Mon, 26 Sep 2016 03:17:05 +0000 (03:17 +0000)]
Refactor out `resolve_macro_name`.

7 years agoAdd field `backtrace: SyntaxContext` to `ExpansionData`.
Jeffrey Seyfried [Sat, 1 Oct 2016 04:24:19 +0000 (04:24 +0000)]
Add field `backtrace: SyntaxContext` to `ExpansionData`.

7 years agoRefactor `ext::base::Resolver::add_ext` to only define macros in the crate root.
Jeffrey Seyfried [Sun, 2 Oct 2016 05:49:56 +0000 (05:49 +0000)]
Refactor `ext::base::Resolver::add_ext` to only define macros in the crate root.

7 years agoImprove error message and snippet for "did you mean `x`"
Gavin Baker [Wed, 28 Sep 2016 09:27:23 +0000 (19:27 +1000)]
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)

7 years agoRefactor field `expansion_data` of `Resolver` to use a `Mark` instead of a `u32`.
Jeffrey Seyfried [Sat, 1 Oct 2016 04:21:10 +0000 (04:21 +0000)]
Refactor field `expansion_data` of `Resolver` to use a `Mark` instead of a `u32`.

7 years agoAdd struct `macros::NameBinding`.
Jeffrey Seyfried [Sat, 1 Oct 2016 03:49:12 +0000 (03:49 +0000)]
Add struct `macros::NameBinding`.

7 years agoAuto merge of #36840 - eulerdisk:incr_test_for_hash_enum, r=michaelwoerister
bors [Sun, 2 Oct 2016 03:34:34 +0000 (20:34 -0700)]
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

7 years agostd: Correct stability attributes for some implementations
Oliver Middleton [Wed, 28 Sep 2016 10:28:42 +0000 (11:28 +0100)]
std: Correct stability attributes for some implementations

These are displayed by rustdoc so should be correct.

7 years agoAuto merge of #36828 - pnkfelix:update-compiler-rt, r=dotdash
bors [Sat, 1 Oct 2016 21:53:04 +0000 (14:53 -0700)]
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

7 years agostd: Remove plattform-specific code from os_str
Brian Anderson [Thu, 22 Sep 2016 00:57:18 +0000 (00:57 +0000)]
std: Remove plattform-specific code from os_str

7 years agostd: Move platform specific stdio code into sys
Brian Anderson [Thu, 22 Sep 2016 00:29:00 +0000 (00:29 +0000)]
std: Move platform specific stdio code into sys

7 years agostd: Move platform specific memchr code into sys
Brian Anderson [Thu, 22 Sep 2016 00:10:37 +0000 (00:10 +0000)]
std: Move platform specific memchr code into sys

7 years agostd: Move platform specific env code into sys
Brian Anderson [Wed, 21 Sep 2016 19:50:30 +0000 (19:50 +0000)]
std: Move platform specific env code into sys

7 years agostd: Move platform specific path code into sys
Brian Anderson [Wed, 21 Sep 2016 19:11:39 +0000 (19:11 +0000)]
std: Move platform specific path code into sys

7 years agoAuto merge of #36885 - Manishearth:rollup, r=Manishearth
bors [Sat, 1 Oct 2016 17:17:20 +0000 (10:17 -0700)]
Auto merge of #36885 - Manishearth:rollup, r=Manishearth

Rollup of 6 pull requests

- Successful merges: #36865, #36872, #36873, #36877, #36880, #36882
- Failed merges:

7 years agoAuto merge of #36857 - Manishearth:syntax-rollup, r=Manishearth
bors [Sat, 1 Oct 2016 13:59:09 +0000 (06:59 -0700)]
Auto merge of #36857 - Manishearth:syntax-rollup, r=Manishearth

Syntax breaking batch

None