]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agorustc: remove hir::fold.
Eduard Burtescu [Thu, 1 Sep 2016 07:21:12 +0000 (10:21 +0300)]
rustc: remove hir::fold.

7 years agorustc_metadata: go back to not using the opaque format.
Eduard Burtescu [Thu, 1 Sep 2016 03:19:58 +0000 (06:19 +0300)]
rustc_metadata: go back to not using the opaque format.

7 years agorustc: replace uses of NodeId in Def, other than closures and labels.
Eduard Burtescu [Wed, 31 Aug 2016 11:08:22 +0000 (14:08 +0300)]
rustc: replace uses of NodeId in Def, other than closures and labels.

7 years agorustc_metadata: go only through rustc_serialize in astencode.
Eduard Burtescu [Wed, 31 Aug 2016 11:00:29 +0000 (14:00 +0300)]
rustc_metadata: go only through rustc_serialize in astencode.

7 years agorustc_metadata: combine DecodeContext and rbml::reader::Decoder.
Eduard Burtescu [Tue, 30 Aug 2016 11:24:14 +0000 (14:24 +0300)]
rustc_metadata: combine DecodeContext and rbml::reader::Decoder.

7 years agoDon't ICE when a float can't be parsed
mcarton [Tue, 20 Sep 2016 16:05:00 +0000 (18:05 +0200)]
Don't ICE when a float can't be parsed

7 years agorustc_metadata: encode miscellaneous information opaquely.
Eduard Burtescu [Tue, 30 Aug 2016 06:00:04 +0000 (09:00 +0300)]
rustc_metadata: encode miscellaneous information opaquely.

7 years agorustc_metadata: sign-extend when decoding signed integers.
Eduard Burtescu [Tue, 30 Aug 2016 05:14:12 +0000 (08:14 +0300)]
rustc_metadata: sign-extend when decoding signed integers.

7 years agorustc_metadata: use specialization for {en,de}coding Ty and Substs.
Eduard Burtescu [Mon, 19 Sep 2016 20:46:31 +0000 (23:46 +0300)]
rustc_metadata: use specialization for {en,de}coding Ty and Substs.

7 years agorustc_metadata: combine EncodeContext and rbml::writer::Encoder.
Eduard Burtescu [Mon, 29 Aug 2016 05:55:40 +0000 (08:55 +0300)]
rustc_metadata: combine EncodeContext and rbml::writer::Encoder.

7 years agorustc_metadata: remove astencode tests.
Eduard Burtescu [Mon, 29 Aug 2016 02:12:03 +0000 (05:12 +0300)]
rustc_metadata: remove astencode tests.

7 years agorustc_metadata: remove extension traits from astencode.
Eduard Burtescu [Mon, 29 Aug 2016 02:03:55 +0000 (05:03 +0300)]
rustc_metadata: remove extension traits from astencode.

7 years agorustc_metadata: remove redundant lifetimes from astencode::DecodeContext.
Eduard Burtescu [Mon, 29 Aug 2016 00:33:38 +0000 (03:33 +0300)]
rustc_metadata: remove redundant lifetimes from astencode::DecodeContext.

7 years agorbml: move the tagged encoder/decoder to librustc_metadata.
Eduard Burtescu [Sun, 28 Aug 2016 04:10:22 +0000 (07:10 +0300)]
rbml: move the tagged encoder/decoder to librustc_metadata.

7 years agoserialize: extend with specialization-based encoding/decoding multi-dispatch.
Eduard Burtescu [Sat, 27 Aug 2016 17:18:02 +0000 (20:18 +0300)]
serialize: extend with specialization-based encoding/decoding multi-dispatch.

7 years agoMinor correction in `sort_by_key` doc comment
Nick Platt [Tue, 20 Sep 2016 15:20:19 +0000 (11:20 -0400)]
Minor correction in `sort_by_key` doc comment

7 years agoAuto merge of #36388 - pcwalton:copy-propagation, r=nikomatsakis
bors [Tue, 20 Sep 2016 15:01:01 +0000 (08:01 -0700)]
Auto merge of #36388 - pcwalton:copy-propagation, r=nikomatsakis

librustc_mir: Implement def-use chains and trivial copy propagation on MIR.

This only supports trivial cases in which there is exactly one def and
one use.

Currently, some random unrelated MIR tests are failing, probably just because they haven't been updated.

r? @eddyb

7 years agoWorkaround #34427 by using memset of 0 on ARM to set the discriminant.
Felix S. Klock II [Thu, 15 Sep 2016 17:02:10 +0000 (19:02 +0200)]
Workaround #34427 by using memset of 0 on ARM to set the discriminant.

7 years agoLazily allocate TypedArena's first chunk.
Nicholas Nethercote [Mon, 19 Sep 2016 23:52:38 +0000 (09:52 +1000)]
Lazily allocate TypedArena's first chunk.

Currently `TypedArena` allocates its first chunk, which is usually 4096
bytes, as soon as it is created. If no allocations are ever made from
the arena then this allocation (and the corresponding deallocation) is
wasted effort.

This commit changes `TypedArena` so it doesn't allocate the first chunk
until the first allocation is made.

This change speeds up rustc by a non-trivial amount because rustc uses
`TypedArena` heavily: compilation speed (producing debug builds) on
several of the rustc-benchmarks increases by 1.02--1.06x. The change
should never cause a slow-down because the hot `alloc` function is
unchanged. It does increase the size of `TypedArena` by one `usize`
field, however.

The commit also fixes some out-of-date comments.

7 years agoAuto merge of #36445 - infinity0:master, r=brson
bors [Tue, 20 Sep 2016 08:24:54 +0000 (01:24 -0700)]
Auto merge of #36445 - infinity0:master, r=brson

mk: add a all-no-docs target to build everything except docs

This makes things slightly more efficient for Debian's auto-builders where the
docs can be built on just one architecture, and distributed to users of all
other architectures as well.

7 years agolibrustc: Implement def-use chains and trivial copy propagation on MIR.
Patrick Walton [Fri, 16 Sep 2016 01:18:40 +0000 (18:18 -0700)]
librustc: Implement def-use chains and trivial copy propagation on MIR.

This only supports trivial cases in which there is exactly one def and
one use.

7 years agoAuto merge of #34942 - porglezomp:master, r=sfackler
bors [Tue, 20 Sep 2016 02:03:52 +0000 (19:03 -0700)]
Auto merge of #34942 - porglezomp:master, r=sfackler

Fix overflow checking in unsigned pow()

The pow() method for unsigned integers produced 0 instead of trapping overflow for certain inputs. Calls such as 2u32.pow(1024) produced 0 when they should trap an overflow. This also adds tests for the correctly handling overflow in unsigned pow().

This was previously fixed for signed integers in #28248, but it seems unsigned integers got missed that time.

For issue number #34913

7 years agofixed the safety header/wording in option.rs
jacobpadkins [Mon, 19 Sep 2016 22:55:44 +0000 (17:55 -0500)]
fixed the safety header/wording in option.rs

7 years agoAuto merge of #36102 - GuillaumeGomez:rustc_metadata_diagnostics, r=jonathandturner
bors [Mon, 19 Sep 2016 20:23:12 +0000 (13:23 -0700)]
Auto merge of #36102 - GuillaumeGomez:rustc_metadata_diagnostics, r=jonathandturner

Rustc metadata diagnostics

r? @jonathandturner

7 years agoAdd the ability to merge spans to codemap
Jonathan Turner [Mon, 19 Sep 2016 19:31:56 +0000 (12:31 -0700)]
Add the ability to merge spans to codemap

7 years agolibrustc: Add a new nop statement to the MIR.
Patrick Walton [Fri, 16 Sep 2016 01:17:58 +0000 (18:17 -0700)]
librustc: Add a new nop statement to the MIR.

This is useful when passes want to remove statements without affecting
`Location`s.

7 years agoAuto merge of #36471 - nnethercote:rm-to_binop, r=sanxiyn
bors [Mon, 19 Sep 2016 15:32:05 +0000 (08:32 -0700)]
Auto merge of #36471 - nnethercote:rm-to_binop, r=sanxiyn

Remove unused Token::to_binop function

Just some dead code removal.

7 years agoReplace 'e.g.' by 'i.e.'
Guillaume Gomez [Mon, 19 Sep 2016 12:08:57 +0000 (14:08 +0200)]
Replace 'e.g.' by 'i.e.'

7 years agoAuto merge of #36545 - Cobrand:wild-print-fix, r=sfackler
bors [Mon, 19 Sep 2016 04:01:49 +0000 (21:01 -0700)]
Auto merge of #36545 - Cobrand:wild-print-fix, r=sfackler

Remove stray println! when invoking error E0316

Removed a wild println! statement that has been here for over a year and a half.

Closes #36543

7 years agoAuto merge of #36523 - Mark-Simulacrum:format-args-link, r=GuillaumeGomez
bors [Mon, 19 Sep 2016 00:25:01 +0000 (17:25 -0700)]
Auto merge of #36523 - Mark-Simulacrum:format-args-link, r=GuillaumeGomez

Add links between format_args! macro and std::fmt::Arguments struct

r? @GuillaumeGomez

7 years agoFix name of error test file
aclarry [Tue, 6 Sep 2016 17:40:33 +0000 (13:40 -0400)]
Fix name of error test file

7 years agoAuto merge of #36487 - nrc:save-doc-urls, r=@eddyb
bors [Sun, 18 Sep 2016 21:00:02 +0000 (14:00 -0700)]
Auto merge of #36487 - nrc:save-doc-urls, r=@eddyb

save-analysis: better 'parent' info

In particular, this fixes some bugs displaying doc URLs for method calls.

7 years agosave-analysis: better 'parent' info
Nick Cameron [Sun, 18 Sep 2016 19:17:49 +0000 (07:17 +1200)]
save-analysis: better 'parent' info

In particular, this fixes some bugs displaying doc URLs for method calls.

7 years agoAuto merge of #36390 - frewsxcv:panic-set-hook, r=GuillaumeGomez
bors [Sun, 18 Sep 2016 17:34:48 +0000 (10:34 -0700)]
Auto merge of #36390 - frewsxcv:panic-set-hook, r=GuillaumeGomez

Add basic doc examples for `std::panic::{set_hook, take_hook}`.

None

7 years agoAdd regression test for #9837.
Corey Farwell [Sun, 18 Sep 2016 17:01:40 +0000 (13:01 -0400)]
Add regression test for #9837.

Fixes https://github.com/rust-lang/rust/issues/9837

7 years agoper timnn
Eitan Adler [Sun, 18 Sep 2016 14:35:58 +0000 (07:35 -0700)]
per timnn

7 years agoAdd basic doc examples for `std::panic::{set_hook, take_hook}`.
Corey Farwell [Sat, 10 Sep 2016 21:09:02 +0000 (17:09 -0400)]
Add basic doc examples for `std::panic::{set_hook, take_hook}`.

7 years agoUpdated "Ownership". Trying to fix #34865
Vanja Cosic [Sun, 18 Sep 2016 12:43:14 +0000 (14:43 +0200)]
Updated "Ownership". Trying to fix #34865

- Reword
- Add link

7 years agoAdd missing Eq implementations
Guillaume Gomez [Mon, 12 Sep 2016 19:37:41 +0000 (21:37 +0200)]
Add missing Eq implementations

7 years agoAuto merge of #36555 - jseyfried:issue_36540, r=eddyb
bors [Sun, 18 Sep 2016 11:11:51 +0000 (04:11 -0700)]
Auto merge of #36555 - jseyfried:issue_36540, r=eddyb

Visit and fold macro invocations in the same order

Fixes #36540.
r? @nrc

7 years agoAuto merge of #36527 - nnethercote:last_token_kind, r=jseyfried
bors [Sun, 18 Sep 2016 07:48:51 +0000 (00:48 -0700)]
Auto merge of #36527 - nnethercote:last_token_kind, r=jseyfried

Optimize the parser's last token handling.

The parser currently makes a heap copy of the last token in four cases:
identifiers, paths, doc comments, and commas. The identifier and
interpolation cases are unused, and for doc comments and commas we only
need to record their presence, not their value.

This commit consolidates the last token handling and avoids the
unnecessary copies by replacing `last_token`, `last_token_eof`, and
`last_token_interpolated` with a new field `last_token_kind`. This
simplifies the parser slightly and speeds up parsing on some files by
3--4%.

7 years agoremove duplicate duplicate words
Eitan Adler [Sun, 18 Sep 2016 06:36:59 +0000 (23:36 -0700)]
remove duplicate duplicate words

7 years agoinherit from object
Eitan Adler [Sun, 18 Sep 2016 06:31:06 +0000 (23:31 -0700)]
inherit from object

7 years agoinvisible isn't a tag
Eitan Adler [Sun, 18 Sep 2016 06:30:42 +0000 (23:30 -0700)]
invisible isn't a tag

7 years agoborder-color > border
Eitan Adler [Sun, 18 Sep 2016 06:30:22 +0000 (23:30 -0700)]
border-color > border

7 years agoadd missing semi-colon
Eitan Adler [Sun, 18 Sep 2016 06:29:00 +0000 (23:29 -0700)]
add missing semi-colon

7 years agoduplicate the
Eitan Adler [Sun, 18 Sep 2016 06:19:03 +0000 (23:19 -0700)]
duplicate the

7 years agoremove useless semicolon from python
Eitan Adler [Sun, 18 Sep 2016 06:10:12 +0000 (23:10 -0700)]
remove useless semicolon from python

7 years agomodern style classes
Eitan Adler [Sun, 18 Sep 2016 06:09:21 +0000 (23:09 -0700)]
modern style classes

7 years agomake functions static where possible
Eitan Adler [Sun, 18 Sep 2016 06:08:31 +0000 (23:08 -0700)]
make functions static where possible

7 years agoRemove unused code
Eitan Adler [Sun, 18 Sep 2016 06:07:11 +0000 (23:07 -0700)]
Remove unused code

7 years agoprefer tuple to array
Eitan Adler [Sun, 18 Sep 2016 06:06:45 +0000 (23:06 -0700)]
prefer tuple to array

7 years agopep8 prefers triple quoted with double quotes
Eitan Adler [Sun, 18 Sep 2016 06:05:20 +0000 (23:05 -0700)]
pep8 prefers triple quoted with double quotes

7 years agoFix order of @import
Eitan Adler [Sun, 18 Sep 2016 05:56:22 +0000 (22:56 -0700)]
Fix order of @import
In CSS 2.1, any @import rules must precede all other rules (except the
@charset rule, if present).

7 years agosimplify python code
Eitan Adler [Sun, 18 Sep 2016 05:52:00 +0000 (22:52 -0700)]
simplify python code

7 years agoBrowsers do not consistently handle non-integer values for font-size.
Eitan Adler [Sun, 18 Sep 2016 05:51:13 +0000 (22:51 -0700)]
Browsers do not consistently handle non-integer values for font-size.

7 years agoAuto merge of #36502 - TimNN:correct-cancel, r=jseyfried
bors [Sun, 18 Sep 2016 03:57:05 +0000 (20:57 -0700)]
Auto merge of #36502 - TimNN:correct-cancel, r=jseyfried

correctly cancel some errors

Fixes #36499.

I also (proactively) changed all other calls in `parser.rs` to use `Handler::cancel`.

7 years agoAuto merge of #36504 - pcwalton:and-star, r=eddyb
bors [Sun, 18 Sep 2016 00:30:22 +0000 (17:30 -0700)]
Auto merge of #36504 - pcwalton:and-star, r=eddyb

librustc_mir: Remove `&*x` when `x` has a reference type.

This introduces a new `InstCombine` pass for us to place such peephole
optimizations.

r? @eddyb

7 years agoAdd regression test.
Jeffrey Seyfried [Sat, 17 Sep 2016 23:31:32 +0000 (23:31 +0000)]
Add regression test.

7 years agoEnsure that macro invocations are folded and visited the same order.
Jeffrey Seyfried [Sat, 17 Sep 2016 23:14:09 +0000 (23:14 +0000)]
Ensure that macro invocations are folded and visited the same order.

7 years agoAuto merge of #36508 - nagisa:llvm-backport, r=eddyb
bors [Sat, 17 Sep 2016 19:02:34 +0000 (12:02 -0700)]
Auto merge of #36508 - nagisa:llvm-backport, r=eddyb

Up the LLVM

Fixes #36474

The relevant patch to rust-llvm is at https://github.com/rust-lang/llvm/pull/51

r? @alexcrichton

7 years agoUp the LLVM
Simonas Kazlauskas [Thu, 15 Sep 2016 22:08:12 +0000 (01:08 +0300)]
Up the LLVM

Fixes #36474

7 years agoAuto merge of #36490 - bluss:zip-slightly-despecialized-edition, r=alexcrichton
bors [Sat, 17 Sep 2016 15:23:44 +0000 (08:23 -0700)]
Auto merge of #36490 - bluss:zip-slightly-despecialized-edition, r=alexcrichton

Remove data structure specialization for .zip() iterator

Go back on half the specialization, the part that changed the Zip
struct's fields themselves depending on the types of the iterators.

Previous PR: #33090

This means that the Zip iterator will always carry two usize fields,
which are sometimes unused. If a whole for loop using a .zip() iterator is
inlined, these are simply removed and have no effect.

The same improvement for Zip of for example slice iterators remain, and
they still optimize well. However, like when the specialization of zip
was merged, the compiler is still very sensistive to the exact context.

For example this code only autovectorizes if the function is used, not
if the code in zip_sum_i32 is inserted inline where it was called:

```rust
fn zip_sum_i32(xs: &[i32], ys: &[i32]) -> i32 {
    let mut s = 0;
    for (&x, &y) in xs.iter().zip(ys) {
        s += x * y;
    }
    s
}

fn zipdot_i32_default_zip(b: &mut test::Bencher)
{
    let xs = vec![1; 1024];
    let ys = vec![1; 1024];

    b.iter(|| {
        zip_sum_i32(&xs, &ys)
    })
}
```

Include a test that checks that `Zip<T, U>` is covariant w.r.t. T and U.

Fixes #35727

7 years agoAuto merge of #36485 - nnethercote:char_lit-2, r=nagisa
bors [Sat, 17 Sep 2016 09:51:13 +0000 (02:51 -0700)]
Auto merge of #36485 - nnethercote:char_lit-2, r=nagisa

Overhaul char_lit()

This commit does the following.

- Removes parsing support for '\X12', '\u123456' and '\U12345678' char
  literals. These are no longer valid Rust and rejected by the lexer.
  (This strange-sounding situation occurs because the parser rescans
  char literals to compute their value.)

- Rearranges the function so that all the escaped values are handled in
  a single `match`. The error-handling strategy is based on the one used
  by byte_lit().

7 years agoAuto merge of #36482 - jseyfried:dont_load_unconfigured_noninline_modules, r=nrc
bors [Sat, 17 Sep 2016 06:29:15 +0000 (23:29 -0700)]
Auto merge of #36482 - jseyfried:dont_load_unconfigured_noninline_modules, r=nrc

Avoid loading and parsing unconfigured non-inline modules.

For example, `#[cfg(any())] mod foo;` will always compile after this PR, even if `foo.rs` and `foo/mod.rs` do not exist or do not contain valid Rust.

Fixes #36478 and fixes #27873.

r? @nrc

7 years agoAuto merge of #36468 - michaelwoerister:collect-vtable-drop-glue, r=eddyb
bors [Sat, 17 Sep 2016 02:52:53 +0000 (19:52 -0700)]
Auto merge of #36468 - michaelwoerister:collect-vtable-drop-glue, r=eddyb

trans: Let the collector find drop-glue for all vtables, not just VTableImpl.

This fixes #36260. So far, the collector has only recorded drop-glue for insertion into a vtable if the vtable was for an impl. But there's actually no reason why it shouldn't do just the same for closure vtables, afaict.

r? @eddyb
cc @rust-lang/compiler

7 years agoRemove stray println! when invoking error E0316
Cobrand [Fri, 16 Sep 2016 21:52:03 +0000 (23:52 +0200)]
Remove stray println! when invoking error E0316

7 years agoAdd links between format_args! macro and std::fmt::Arguments struct
Mark-Simulacrum [Fri, 16 Sep 2016 01:59:29 +0000 (19:59 -0600)]
Add links between format_args! macro and std::fmt::Arguments struct

7 years agoAuto merge of #36444 - jseyfried:macro_rules_ext, r=nrc
bors [Fri, 16 Sep 2016 21:15:13 +0000 (14:15 -0700)]
Auto merge of #36444 - jseyfried:macro_rules_ext, r=nrc

Remove variant `MacroRulesTT` of `SyntaxExtension`

r? @nrc

7 years agofix top level attr spans
Mikhail Modin [Fri, 16 Sep 2016 18:44:15 +0000 (21:44 +0300)]
fix top level attr spans

7 years agoAuto merge of #36536 - jonathandturner:rollup, r=jonathandturner
bors [Fri, 16 Sep 2016 17:45:35 +0000 (10:45 -0700)]
Auto merge of #36536 - jonathandturner:rollup, r=jonathandturner

Rollup of 8 pull requests

- Successful merges: #36383, #36424, #36480, #36484, #36505, #36509, #36519, #36521
- Failed merges:

7 years agolibrustc_mir: Remove `&*x` when `x` has a reference type.
Patrick Walton [Sat, 10 Sep 2016 21:33:29 +0000 (14:33 -0700)]
librustc_mir: Remove `&*x` when `x` has a reference type.

This introduces a new `InstCombine` pass for us to place such peephole
optimizations.

7 years agoRollup merge of #36521 - Mark-Simulacrum:documentation-fix, r=apasel422
Jonathan Turner [Fri, 16 Sep 2016 16:29:49 +0000 (09:29 -0700)]
Rollup merge of #36521 - Mark-Simulacrum:documentation-fix, r=apasel422

Fix language in documentation comment.

7 years agoRollup merge of #36519 - Mark-Simulacrum:example-asmut, r=GuillaumeGomez
Jonathan Turner [Fri, 16 Sep 2016 16:29:49 +0000 (09:29 -0700)]
Rollup merge of #36519 - Mark-Simulacrum:example-asmut, r=GuillaumeGomez

Add example in AsMut trait documentation

Let me know of any changes I should make.

r? @GuillaumeGomez

7 years agoRollup merge of #36509 - nagisa:rustbuild-py3, r=alexcrichton
Jonathan Turner [Fri, 16 Sep 2016 16:29:49 +0000 (09:29 -0700)]
Rollup merge of #36509 - nagisa:rustbuild-py3, r=alexcrichton

Try to support py3 with rustbuild better

Annoying to have it fail when you run with `python` only to have to rerun later with `python2`.

r? @alexcrichton

7 years agoRollup merge of #36505 - nagisa:temp-stack-size, r=eddyb
Jonathan Turner [Fri, 16 Sep 2016 16:29:48 +0000 (09:29 -0700)]
Rollup merge of #36505 - nagisa:temp-stack-size, r=eddyb

Default RUST_MIN_STACK to 16MiB for now

Temporary(?) workaround to https://github.com/rust-lang/rust/issues/35408.

cc @nikomatsakis if you want to veto the idea.

r? @eddyb

7 years agoRollup merge of #36484 - frewsxcv:patch-33, r=eddyb
Jonathan Turner [Fri, 16 Sep 2016 16:29:48 +0000 (09:29 -0700)]
Rollup merge of #36484 - frewsxcv:patch-33, r=eddyb

Don't ignore a doc code-block we can compile.

7 years agoRollup merge of #36480 - tshepang:stronger-pause, r=steveklabnik
Jonathan Turner [Fri, 16 Sep 2016 16:29:48 +0000 (09:29 -0700)]
Rollup merge of #36480 - tshepang:stronger-pause, r=steveklabnik

doc: make that sound better

7 years agoRollup merge of #36424 - kmcallister:gh-29361-marker-docs, r=GuillaumeGomez
Jonathan Turner [Fri, 16 Sep 2016 16:29:48 +0000 (09:29 -0700)]
Rollup merge of #36424 - kmcallister:gh-29361-marker-docs, r=GuillaumeGomez

Tweak std::marker docs

Fixes #29361.

r? @GuillaumeGomez

7 years agoRollup merge of #36383 - GuillaumeGomez:e0049, r=jonathandturner
Jonathan Turner [Fri, 16 Sep 2016 16:29:48 +0000 (09:29 -0700)]
Rollup merge of #36383 - GuillaumeGomez:e0049, r=jonathandturner

Update E0049 to new error format

Fixes #35210.
Part of #35233.

r? @jonathandturner

7 years agoAuto merge of #36353 - arielb1:union-drops, r=pnkfelix
bors [Fri, 16 Sep 2016 14:23:18 +0000 (07:23 -0700)]
Auto merge of #36353 - arielb1:union-drops, r=pnkfelix

a few move-checker improvements

This fixes moves out of unions and prohibits moves out of slices (see the individual commits).

r? @pnkfelix

7 years agofix test fallout
Ariel Ben-Yehuda [Fri, 16 Sep 2016 13:02:43 +0000 (16:02 +0300)]
fix test fallout

7 years agofix dynamic drop for unions
Ariel Ben-Yehuda [Thu, 8 Sep 2016 17:12:53 +0000 (20:12 +0300)]
fix dynamic drop for unions

Moving out of a union is now treated like moving out of its parent type.

Fixes #36246

7 years agoforbid moves out of slices
Ariel Ben-Yehuda [Sun, 24 Jul 2016 10:56:27 +0000 (13:56 +0300)]
forbid moves out of slices

The wording of RFC #495 enables moves out of slices. Unfortuantely, non-zeroing
moves out of slices introduce a very annoying complication: as slices can
vary in their length, indexes from the start and end may or may not overlap
depending on the slice's exact length, which prevents assigning a particular
drop flag for each individual element.

For example, in the code

```Rust
fn foo<T>(a: Box<[Box<[T]>]>, c: bool) -> T {
    match (a, c) {
        (box [box [t, ..], ..], true) => t,
        (box [.., box [.., t]], false) => t,
        _ => panic!()
    }
}
```

If the condition is false, we have to drop the first element
of `a`, unless `a` has size 1 in which case we drop all the elements
of it but the last.

If someone comes with a nice way of handling it, we can always re-allow
moves out of slices.

This is a [breaking-change], but it is behind the `slice_patterns` feature
gate and was not allowed until recently.

7 years agogroundwork refactoring of `gather_moves`
Ariel Ben-Yehuda [Sat, 11 Jun 2016 20:47:28 +0000 (23:47 +0300)]
groundwork refactoring of `gather_moves`

7 years agoAuto merge of #36441 - alexcrichton:rustbuild-target, r=brson
bors [Fri, 16 Sep 2016 11:01:01 +0000 (04:01 -0700)]
Auto merge of #36441 - alexcrichton:rustbuild-target, r=brson

rustbuild: Fix cross-compiles to MinGW on Linux

Closes #36290
Closes #36291

7 years agoAuto merge of #36338 - estebank:primitive-shadow, r=jseyfried
bors [Fri, 16 Sep 2016 07:39:27 +0000 (00:39 -0700)]
Auto merge of #36338 - estebank:primitive-shadow, r=jseyfried

Be more specific when type parameter shadows primitive type

When a type parameter shadows a primitive type, the error message
was non obvious. For example, given the file `file.rs`:

```rust
trait Parser<T> {
    fn parse(text: &str) -> Option<T>;
}

impl<bool> Parser<bool> for bool {
    fn parse(text: &str) -> Option<bool> {
        Some(true)
    }
}

fn main() {
    println!("{}", bool::parse("ok").unwrap_or(false));
}
```

The output was:

```bash
% rustc file.rs
error[E0308]: mismatched types
 --> file.rs:7:14
  |
7 |         Some(true)
  |              ^^^^ expected type parameter, found bool a
  |
  = note: expected type `bool`
  = note:    found type `bool`

error: aborting due to previous error
```

We now show extra information about the type:

```bash
% rustc file.rs
error[E0308]: mismatched types
 --> file.rs:7:14
  |
7 |         Some(true)
  |              ^^^^ expected type parameter, found bool a
  |
  = note: expected type `bool` (type parameter)
  = note:    found type `bool` (bool)

error: aborting due to previous error
```

Fixes #35030

7 years agoOptimize the parser's last token handling.
Nicholas Nethercote [Fri, 16 Sep 2016 05:46:40 +0000 (15:46 +1000)]
Optimize the parser's last token handling.

The parser currently makes a heap copy of the last token in four cases:
identifiers, paths, doc comments, and commas. The identifier and
interpolation cases are unused, and for doc comments and commas we only
need to record their presence, not their value.

This commit consolidates the last token handling and avoids the
unnecessary copies by replacing `last_token`, `last_token_eof`, and
`last_token_interpolated` with a new field `last_token_kind`. This
simplifies the parser slightly and speeds up parsing on some files by
3--4%.

7 years agoAuto merge of #36213 - josephDunne:dist_version, r=brson
bors [Fri, 16 Sep 2016 03:48:58 +0000 (20:48 -0700)]
Auto merge of #36213 - josephDunne:dist_version, r=brson

Add rustc version info (git hash + date) to dist tarball

a fix for #32444

7 years agoSpecify when type parameter shadows primitive type
Esteban Küber [Thu, 8 Sep 2016 01:40:31 +0000 (18:40 -0700)]
Specify when type parameter shadows primitive type

When a type parameter shadows a primitive type, the error message
was non obvious. For example, given the file `file.rs`:

```rust
trait Parser<T> {
    fn parse(text: &str) -> Option<T>;
}

impl<bool> Parser<bool> for bool {
    fn parse(text: &str) -> Option<bool> {
        Some(true)
    }
}

fn main() {
    println!("{}", bool::parse("ok").unwrap_or(false));
}
```

The output was:

```bash
% rustc file.rs
error[E0308]: mismatched types
 --> file.rs:7:14
  |
7 |         Some(true)
  |              ^^^^ expected type parameter, found bool
  |
  = note: expected type `bool`
  = note:    found type `bool`

error: aborting due to previous error
```

We now show extra information about the type:

```bash
% rustc file.rs
error[E0308]: mismatched types
 --> file.rs:7:14
  |
7 |         Some(true)
  |              ^^^^ expected type parameter, found bool
  |
  = note: expected type `bool` (type parameter)
  = note:    found type `bool` (bool)

error: aborting due to previous error
```

Fixes #35030

7 years agoAdapt codegen-unit test cases to new behaviour
Michael Woerister [Fri, 16 Sep 2016 02:09:49 +0000 (22:09 -0400)]
Adapt codegen-unit test cases to new behaviour

7 years agoAdd example in AsMut trait documentation
Mark-Simulacrum [Fri, 16 Sep 2016 01:47:04 +0000 (19:47 -0600)]
Add example in AsMut trait documentation

7 years agotrans: Allow base::internalize_symbols() to internalize #[no_mangle] symbols
Michael Woerister [Fri, 16 Sep 2016 00:39:58 +0000 (20:39 -0400)]
trans: Allow base::internalize_symbols() to internalize #[no_mangle] symbols

7 years agoAuto merge of #36439 - alexcrichton:fix-rustbuild, r=japaric
bors [Fri, 16 Sep 2016 00:19:09 +0000 (17:19 -0700)]
Auto merge of #36439 - alexcrichton:fix-rustbuild, r=japaric

rustbuild: Fix dependency tracking with new Cargo

The recent Cargo update changed filenames, which broke a lot of incremental
rustbuild builds. What it thought were the output files were indeed no longer
the output files! (wreaking havoc).

This commit updates this to stop guessing filenames of Cargo and just manage
stamp files instead.

7 years agoOverhaul char_lit().
Nicholas Nethercote [Thu, 15 Sep 2016 00:59:11 +0000 (10:59 +1000)]
Overhaul char_lit().

This commit does the following.

- Removes parsing support for '\X12', '\u123456' and '\U12345678' char
  literals. These are no longer valid Rust and rejected by the lexer.
  (This strange-sounding situation occurs because the parser rescans
  char literals to compute their value.)

- Rearranges the function so that all the escaped values are handled in
  a single `match`, and changes the error-handling to use vanilla
  assert!() and unwrap().

7 years agoTry to support py3 with rustbuild better
Simonas Kazlauskas [Thu, 15 Sep 2016 22:48:27 +0000 (01:48 +0300)]
Try to support py3 with rustbuild better

7 years agoRemove irrelevant test.
Jeffrey Seyfried [Tue, 13 Sep 2016 08:39:11 +0000 (08:39 +0000)]
Remove irrelevant test.

7 years agoRemove `MacroRulesTT`.
Jeffrey Seyfried [Tue, 13 Sep 2016 06:25:02 +0000 (06:25 +0000)]
Remove `MacroRulesTT`.

7 years agoAllow `IdentMacroExpander::expand` to access the ident macro invocation's attributes.
Jeffrey Seyfried [Tue, 13 Sep 2016 05:21:54 +0000 (05:21 +0000)]
Allow `IdentMacroExpander::expand` to access the ident macro invocation's attributes.

7 years agoMove fields `single_step` and `keep_macs` from `MacroExpander` to `ExpansionConfig`.
Jeffrey Seyfried [Mon, 12 Sep 2016 09:47:54 +0000 (09:47 +0000)]
Move fields `single_step` and `keep_macs` from `MacroExpander` to `ExpansionConfig`.