]> git.lizzy.rs Git - rust.git/log
rust.git
8 years agothe reference was inferring values that didn't fit into their target type
Oliver 'ker' Schneider [Mon, 28 Dec 2015 18:55:56 +0000 (19:55 +0100)]
the reference was inferring values that didn't fit into their target type

8 years agoAuto merge of #29498 - wthrowe:replace-pattern, r=alexcrichton
bors [Wed, 13 Jan 2016 08:15:45 +0000 (08:15 +0000)]
Auto merge of #29498 - wthrowe:replace-pattern, r=alexcrichton

It appears this was left out of RFC rust-lang/rfcs#528 because it might be useful to
also generalize the second argument in some way.  That doesn't seem to
prevent generalizing the first argument now, however.

This is a [breaking-change] because it could cause type-inference to
fail where it previously succeeded.

Also update docs for a few other methods that still referred to `&str` instead of patterns.

8 years agoAuto merge of #30639 - rkruppe:dec2flt-fastpath-tables, r=alexcrichton
bors [Wed, 13 Jan 2016 02:05:02 +0000 (02:05 +0000)]
Auto merge of #30639 - rkruppe:dec2flt-fastpath-tables, r=alexcrichton

Add tables of small powers of ten used in the fast path. The tables are redundant: We could also use the big, more accurate table and round the value to the correct type (in fact we did just that before this commit). However, the rounding is extra work and slows down the fast path.

Because only very small exponents enter the fast path, the table and thus the space overhead is negligible. Speed-wise, this is a clear win on a [benchmark] comparing the fast path to a naive, hand-optimized, inaccurate algorithm. Specifically, this change narrows the gap from a roughly 5x difference to a roughly 3.4x difference.

[benchmark]: https://gist.github.com/Veedrac/dbb0c07994bc7882098e

8 years agoAuto merge of #30601 - tamird:delegate-libc, r=alexcrichton
bors [Tue, 12 Jan 2016 22:49:02 +0000 (22:49 +0000)]
Auto merge of #30601 - tamird:delegate-libc, r=alexcrichton

See: http://developer.android.com/ndk/downloads/revision_history.html

Also, use `libc`'s `posix_memalign`.

8 years agoSpeed up dec2flt fast path with additional tables.
Robin Kruppe [Wed, 30 Dec 2015 13:01:42 +0000 (14:01 +0100)]
Speed up dec2flt fast path with additional tables.

Add tables of small powers of ten used in the fast path. The tables are redundant: We could also use the big, more accurate table and round the value to the correct type (in fact we did just that before this commit). However, the rounding is extra work and slows down the fast path.

Because only very small exponents enter the fast path, the table and thus the space overhead is negligible. Speed-wise, this is a clear win on a [benchmark] comparing the fast path to a naive, hand-optimized, inaccurate algorithm. Specifically, this change narrows the gap from a roughly 5x difference to a roughly 3.4x difference.

[benchmark]: https://gist.github.com/Veedrac/dbb0c07994bc7882098e

8 years agoandroid has `posix_memalign` for API 16+ since NDK r10d
Tamir Duberstein [Tue, 29 Dec 2015 01:04:20 +0000 (20:04 -0500)]
android has `posix_memalign` for API 16+ since NDK r10d

See: http://developer.android.com/ndk/downloads/revision_history.html

Also, use `libc`'s `posix_memalign`.

8 years agoAuto merge of #30719 - pyfisch:fix30657, r=alexcrichton
bors [Tue, 12 Jan 2016 16:30:20 +0000 (16:30 +0000)]
Auto merge of #30719 - pyfisch:fix30657, r=alexcrichton

8 years agoAuto merge of #30695 - ranma42:cleanup-unicode, r=alexcrichton
bors [Tue, 12 Jan 2016 10:18:53 +0000 (10:18 +0000)]
Auto merge of #30695 - ranma42:cleanup-unicode, r=alexcrichton

and the associated update of tables.rs

The last commit is related to my comment to #29734.

8 years agoAuto merge of #30678 - Amanieu:no_elf_tls, r=alexcrichton
bors [Tue, 12 Jan 2016 08:30:56 +0000 (08:30 +0000)]
Auto merge of #30678 - Amanieu:no_elf_tls, r=alexcrichton

I also re-enabled the use of `#[thread_local]` on AArch64. It was originally disabled in the PR that introduced AArch64 (#19790), but the reasons for this were not explained. `#[thread_local]` seems to work fine in my tests on AArch64, so I don't think this should be an issue.

cc @alexcrichton @akiss77

8 years agoAuto merge of #30635 - nagisa:mir-rid-unit-temp, r=nikomatsakis
bors [Tue, 12 Jan 2016 05:20:23 +0000 (05:20 +0000)]
Auto merge of #30635 - nagisa:mir-rid-unit-temp, r=nikomatsakis

Get rid of that nasty unit_ty temporary variable created just because it might be handy to have one around, when in reality it isn’t really that useful at all.

r? @nikomatsakis

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

8 years agoAuto merge of #30599 - brson:extra, r=alexcrichton
bors [Tue, 12 Jan 2016 03:00:00 +0000 (03:00 +0000)]
Auto merge of #30599 - brson:extra, r=alexcrichton

This mixes in additional information into the hash that is
passed to -C extra-filename. It can be used to further distinguish
the standard libraries if they must be installed next to each
other.

Closes #29559

Frankly, I'm not sure if this solves a real problem. It's meant to help with side-by-side and overlapping installations where there are two sets of libs in /usr, but there are other potential issues there as well, including that some of our artifacts don't use this extra-filename munging, and it's not something our installers can support at all.

cc @jauhien Do you still think this helps the Gentoo case?

8 years agoAuto merge of #30826 - nagisa:rollup, r=nagisa
bors [Mon, 11 Jan 2016 20:59:15 +0000 (20:59 +0000)]
Auto merge of #30826 - nagisa:rollup, r=nagisa

- Successful merges: #30538, #30687, #30694, #30737, #30761, #30768, #30774, #30798, #30808, #30812, #30814
- Failed merges:

8 years agoRollup merge of #30814 - brson:docidx, r=steveklabnik
Simonas Kazlauskas [Mon, 11 Jan 2016 19:17:54 +0000 (21:17 +0200)]
Rollup merge of #30814 - brson:docidx, r=steveklabnik

These are the same descriptions as on the website.

re https://www.reddit.com/r/rust/comments/409nlo/i_just_noticed_the_docs_nightly_all_docs_got_more/cytc4ab

r? @steveklabnik

8 years agoRollup merge of #30812 - D101101:patch-2, r=steveklabnik
Simonas Kazlauskas [Mon, 11 Jan 2016 19:17:53 +0000 (21:17 +0200)]
Rollup merge of #30812 - D101101:patch-2, r=steveklabnik

r? @steveklabnik

8 years agoRollup merge of #30808 - GuillaumeGomez:remove_lang_iter, r=alexcrichton
Simonas Kazlauskas [Mon, 11 Jan 2016 19:17:53 +0000 (21:17 +0200)]
Rollup merge of #30808 - GuillaumeGomez:remove_lang_iter, r=alexcrichton

Fixes #30803

r? @nagisa

8 years agoRollup merge of #30798 - erickt:fix-doc, r=apasel422
Simonas Kazlauskas [Mon, 11 Jan 2016 19:17:53 +0000 (21:17 +0200)]
Rollup merge of #30798 - erickt:fix-doc, r=apasel422

8 years agoRollup merge of #30774 - nagisa:mir-fix-constval-adts, r=arielb1
Simonas Kazlauskas [Mon, 11 Jan 2016 19:17:53 +0000 (21:17 +0200)]
Rollup merge of #30774 - nagisa:mir-fix-constval-adts, r=arielb1

Fixes #30772

We used to have a untested special case which didn’t really work anyway, because of lacking casts. This PR removes the case in question.

8 years agoRollup merge of #30768 - steveklabnik:gh28953, r=alexcrichton
Simonas Kazlauskas [Mon, 11 Jan 2016 19:17:53 +0000 (21:17 +0200)]
Rollup merge of #30768 - steveklabnik:gh28953, r=alexcrichton

Fixes #28953

8 years agoRollup merge of #30761 - nagisa:mir-fix-destination, r=michaelwoerister
Simonas Kazlauskas [Mon, 11 Jan 2016 19:17:52 +0000 (21:17 +0200)]
Rollup merge of #30761 - nagisa:mir-fix-destination, r=michaelwoerister

Previously it was returning a clone, mostly for the two reasons:

* Cloning Lvalue is very cheap most of the time (i.e. when Lvalue is not a Projection);
* There’s users who want &mut lvalue and there’s users who want &lvalue. Returning a value allows
  to make either one easier when pattern matching (i.e. Some(ref dest) or Some(ref mut dest)).

However, I’m now convinced this is an invalid approach. Namely the users which want a mutable
reference may modify the Lvalue in-place, but the changes won’t be reflected in the final MIR,
since the Lvalue modified is merely a clone.

Instead, we have two accessors `destination` and `destination_mut` which return a reference to the
destination in desired mode.

r? @nikomatsakis

8 years agoRollup merge of #30737 - Ms2ger:MutateMode, r=sanxiyn
Simonas Kazlauskas [Mon, 11 Jan 2016 19:17:52 +0000 (21:17 +0200)]
Rollup merge of #30737 - Ms2ger:MutateMode, r=sanxiyn

8 years agoRollup merge of #30694 - pnkfelix:issue-25658-real-first-follow, r=nrc
Simonas Kazlauskas [Mon, 11 Jan 2016 19:17:52 +0000 (21:17 +0200)]
Rollup merge of #30694 - pnkfelix:issue-25658-real-first-follow, r=nrc

Proper first and follow sets for macro_rules future proofing

implements first stage of RFC amendment 1384; see #30450

8 years agoRollup merge of #30687 - mmcco:lbt, r=eddyb
Simonas Kazlauskas [Mon, 11 Jan 2016 19:17:52 +0000 (21:17 +0200)]
Rollup merge of #30687 - mmcco:lbt, r=eddyb

These should probably be submitted upstream. They're inevitably going to
complicate merges, and because they're non-functional changes this just
isn't worth our time.

8 years agoRollup merge of #30538 - oli-obk:kill_unsigned_unary_negation, r=pnkfelix
Simonas Kazlauskas [Mon, 11 Jan 2016 19:17:52 +0000 (21:17 +0200)]
Rollup merge of #30538 - oli-obk:kill_unsigned_unary_negation, r=pnkfelix

fixes  #29645

8 years agoAuto merge of #30534 - bluss:binary-heap-fast-pop, r=Gankro
bors [Mon, 11 Jan 2016 19:03:18 +0000 (19:03 +0000)]
Auto merge of #30534 - bluss:binary-heap-fast-pop, r=Gankro

BinaryHeap: Use full sift down in .pop()

.sift_down can either choose to compare the element on the way down (and
place it during descent), or to sift down an element fully, then sift
back up to place it.

A previous PR changed .sift_down() to the former behavior, which is much
faster for relatively small heaps and for elements that are cheap to
compare.

A benchmarking run suggested that BinaryHeap::pop() suffers
improportionally from this, and that it should use the second strategy
instead. It's logical since .pop() brings last element from the
heapified vector into index 0, it's very likely that this element will
end up at the bottom again.

Closes #29969
Previous PR #29811

8 years agoAuto merge of #30800 - steveklabnik:rollup, r=steveklabnik
bors [Mon, 11 Jan 2016 17:15:27 +0000 (17:15 +0000)]
Auto merge of #30800 - steveklabnik:rollup, r=steveklabnik

- Successful merges: #30766, #30771, #30789
- Failed merges:

8 years agoAuto merge of #30676 - nikomatsakis:issue-29857, r=arielb1
bors [Mon, 11 Jan 2016 15:26:57 +0000 (15:26 +0000)]
Auto merge of #30676 - nikomatsakis:issue-29857, r=arielb1

This is an alternative to https://github.com/rust-lang/rust/pull/29954 for fixing #29857 that seems to me to be more inline with the general strategy around `TyError`. It also includes the fix for #30589 -- in fact, just the minimal change of making `ty_is_local` tolerate `TyError` avoids the ICE, but you get a lot of duplicate error reports, so in the case where the impl's trait reference already includes `TyError`, we just ignore the impl altogether.

cc @arielb1 @sanxiyn

Fixes #29857.
Fixes #30589.

8 years agoAuto merge of #30753 - pnkfelix:downgrade-29383-struct-warnings-to-errors, r=nikomatsakis
bors [Mon, 11 Jan 2016 13:39:06 +0000 (13:39 +0000)]
Auto merge of #30753 - pnkfelix:downgrade-29383-struct-warnings-to-errors, r=nikomatsakis

Downgrade unit struct match via S(..) warnings to errors

The error signalling was introduced in #29383

It was noted as a warning-cycle-less regression in #30379

Fix #30379

8 years ago[breaking-change] remove negate_unsigned feature gate
Oliver Schneider [Mon, 11 Jan 2016 11:31:46 +0000 (12:31 +0100)]
[breaking-change] remove negate_unsigned feature gate

8 years agoReplace no_elf_tls with target_thread_local
Amanieu d'Antras [Sat, 2 Jan 2016 22:50:50 +0000 (22:50 +0000)]
Replace no_elf_tls with target_thread_local

8 years agoAuto merge of #30490 - ipetkov:unix-spawn, r=alexcrichton
bors [Mon, 11 Jan 2016 10:19:44 +0000 (10:19 +0000)]
Auto merge of #30490 - ipetkov:unix-spawn, r=alexcrichton

* If the requested descriptors to inherit are stdio descriptors there
  are situations where they will not be set correctly
* Example: parent's stdout --> child's stderr
           parent's stderr --> child's stdout
* Solution: if the requested descriptors for the child are stdio
  descriptors, `dup` them before overwriting the child's stdio

Example of a program which exhibits the bug:
```rust
// stdio.rs
use std::io::Write;
use std::io::{stdout, stderr};
use std::process::{Command, Stdio};
use std::os::unix::io::FromRawFd;

fn main() {
    stdout().write_all("parent stdout\n".as_bytes()).unwrap();
    stderr().write_all("parent stderr\n".as_bytes()).unwrap();

    Command::new("sh")
        .arg("-c")
        .arg("echo 'child stdout'; echo 'child stderr' 1>&2")
        .stdin(Stdio::inherit())
        .stdout(unsafe { FromRawFd::from_raw_fd(2) })
        .stderr(unsafe { FromRawFd::from_raw_fd(1) })
        .status()
        .unwrap_or_else(|e| { panic!("failed to execute process: {}", e) });
}
```

Before:
```
$ rustc --version
rustc 1.7.0-nightly (8ad12c3e2 2015-12-19)
$ rustc stdio.rs && ./stdio >out 2>err
$ cat out
parent stdout
$ cat err
parent stderr
child stdout
child stderr
```

After (expected):
```
$ rustc --version
rustc 1.7.0-dev (712eccee2 2015-12-19)
$ rustc stdio.rs && ./stdio >out 2>err
$ cat out
parent stdout
child stderr
$ cat err
parent stderr
child stdout
```

8 years agoAuto merge of #27807 - pczarn:arena-internals, r=bluss
bors [Mon, 11 Jan 2016 08:32:46 +0000 (08:32 +0000)]
Auto merge of #27807 - pczarn:arena-internals, r=bluss

Fixes #18037 "TypedArena cannot handle zero-sized types".
Closes #17931 "improve chunk allocation scheme used by Arena / TypedArena".
Closes #22847 "TypedArena should implement Send". - N.B. Arena cannot implement Send, since it may contain non-Send values.
Closes #18471 "`Arena::alloc_copy_inner` (at least) should be renamed and made public." - Added `Arena::alloc_bytes`.
Closes #18261 "support clearing TypedArena with the chunks preserved". - Only the largest chunk is preserved.

8 years agoAuto merge of #30295 - jseyfried:fix_extern_crate_duplicate, r=nrc
bors [Mon, 11 Jan 2016 06:40:58 +0000 (06:40 +0000)]
Auto merge of #30295 - jseyfried:fix_extern_crate_duplicate, r=nrc

Fix a bug allowing an item and an external crate to collide so long as the external crate is declared after the item. For example,
```rust
mod core { pub fn f() {} } // This would be an error if it followed the `extern crate`
extern crate core; // This declaration is shadowed by the preceding module

fn main() { core::f(); }
```
This is a [breaking-change], but it looks unlikely to cause breakage in practice, and any breakage can be fixed by removing colliding `extern crate` declarations, which are shadowed and hence unused.

8 years agodoc: Add descriptions to links in the index
Brian Anderson [Sun, 10 Jan 2016 22:30:09 +0000 (22:30 +0000)]
doc: Add descriptions to links in the index

These are the same descriptions as on the website.

8 years agoFix link in getting-started.md
Sergey Veselkov [Sun, 10 Jan 2016 21:13:54 +0000 (00:13 +0300)]
Fix link in getting-started.md

8 years agoRemove unneeded #[lang = "iterator"]
Guillaume Gomez [Sun, 10 Jan 2016 15:54:04 +0000 (16:54 +0100)]
Remove unneeded #[lang = "iterator"]

8 years agoRollup merge of #30789 - D101101:patch-1, r=steveklabnik
Steve Klabnik [Sat, 9 Jan 2016 19:04:20 +0000 (14:04 -0500)]
Rollup merge of #30789 - D101101:patch-1, r=steveklabnik

8 years agoRollup merge of #30771 - tsion:mir-text-terminator-fix, r=eddyb
Steve Klabnik [Sat, 9 Jan 2016 19:04:20 +0000 (14:04 -0500)]
Rollup merge of #30771 - tsion:mir-text-terminator-fix, r=eddyb

This just removes the `Some()` that appeared around terminators in MIR text output after https://github.com/rust-lang/rust/pull/30481 (cc @nagisa). The graphviz is already fixed.

r? @eddyb

8 years agoRollup merge of #30766 - steveklabnik:gh28810, r=steveklabnik
Steve Klabnik [Sat, 9 Jan 2016 19:04:20 +0000 (14:04 -0500)]
Rollup merge of #30766 - steveklabnik:gh28810, r=steveklabnik

Doing so is considered weaker writing. Thanks @Charlotteis!

Fixes #28810

8 years agoRemove many instances of 'just'
Steve Klabnik [Thu, 7 Jan 2016 19:05:00 +0000 (14:05 -0500)]
Remove many instances of 'just'

Doing so is considered weaker writing. Thanks @Charlotteis!

Fixes #28810

8 years agoFix a typo in rustc_mir::build::scope's documentation
Erick Tryzelaar [Sat, 9 Jan 2016 18:31:50 +0000 (10:31 -0800)]
Fix a typo in rustc_mir::build::scope's documentation

8 years agoRemove unused link from enums.md
Sergey Veselkov [Sat, 9 Jan 2016 09:17:44 +0000 (12:17 +0300)]
Remove unused link from enums.md

8 years agoMinor rebase corrections
Niko Matsakis [Sat, 9 Jan 2016 02:00:24 +0000 (21:00 -0500)]
Minor rebase corrections

8 years agopermit coercions if `[error]` is found in either type
Niko Matsakis [Sat, 9 Jan 2016 01:16:30 +0000 (20:16 -0500)]
permit coercions if `[error]` is found in either type

8 years agoimprove cast handling - this fixes test failures
Ariel Ben-Yehuda [Wed, 25 Nov 2015 16:17:16 +0000 (18:17 +0200)]
improve cast handling - this fixes test failures

the problem is that now "type_is_known_to_be_sized" now returns
false when called on a type with ty_err inside - this prevents
spurious errors (we may want to move the check to check::cast
anyway - see #12894).

8 years agoChange error scheme so that if projection fails we generate `A::B` instead of `TyError`
Niko Matsakis [Thu, 7 Jan 2016 18:51:16 +0000 (13:51 -0500)]
Change error scheme so that if projection fails we generate `A::B` instead of `TyError`

8 years agoRemove ErrorCandidate in favor of just generating an ambiguous result
Niko Matsakis [Thu, 7 Jan 2016 21:48:48 +0000 (16:48 -0500)]
Remove ErrorCandidate in favor of just generating an ambiguous result

8 years agoMake coherence more tolerant of error types.
Niko Matsakis [Sat, 2 Jan 2016 09:57:55 +0000 (04:57 -0500)]
Make coherence more tolerant of error types.

Fixes #29857.
Fixes #30589.

8 years agoAuto merge of #30782 - steveklabnik:rollup, r=steveklabnik
bors [Fri, 8 Jan 2016 22:42:10 +0000 (22:42 +0000)]
Auto merge of #30782 - steveklabnik:rollup, r=steveklabnik

- Successful merges: #30584, #30747, #30755, #30758, #30760, #30769
- Failed merges: #30766

8 years agoRollup merge of #30769 - steveklabnik:gh30069, r=apasel422
Steve Klabnik [Fri, 8 Jan 2016 18:02:31 +0000 (13:02 -0500)]
Rollup merge of #30769 - steveklabnik:gh30069, r=apasel422

Fixes #30069

8 years agoRollup merge of #30760 - jonastepe:nomicon_vec_insert_remove_len, r=apasel422
Steve Klabnik [Fri, 8 Jan 2016 18:02:31 +0000 (13:02 -0500)]
Rollup merge of #30760 - jonastepe:nomicon_vec_insert_remove_len, r=apasel422

len needs to be prefixed by self for this to work. That is something which trips me up all the time. It's reassuring to see that happening to seasoned Rust programmers.

8 years agoRollup merge of #30758 - birkenfeld:fix-30743, r=steveklabnik
Steve Klabnik [Fri, 8 Jan 2016 18:02:31 +0000 (13:02 -0500)]
Rollup merge of #30758 - birkenfeld:fix-30743, r=steveklabnik

 (fixes #30743)

Not sure if the "Note" should be kept.

8 years agoRollup merge of #30755 - datagrok:master, r=steveklabnik
Steve Klabnik [Fri, 8 Jan 2016 18:02:31 +0000 (13:02 -0500)]
Rollup merge of #30755 - datagrok:master, r=steveklabnik

I'm working my way through TRPL beginning at "Syntax and Semantics" as was recommended in a previous version.

I'm expecting the chapter to incrementally build up my knowledge of the language section by section, assuming no prior Rust experience. So it was a bit of a speed-bump to encounter references and the vector type in a code example long before they had been defined and explained.

Another commit in this PR tries to make consistent what is a "chapter" of TRPL versus a "section." Just a nit-pick, but not thinking about that stuff keeps my focus on the important material.

My background: Python programmer since ~2000, with moderate exposure to C, C++, assembly, operating systems, and system architecture in university several years ago.

For your kind consideration, feel welcome to use or drop or rework any part of this.

8 years agoRollup merge of #30747 - nagisa:mir-reenable-test, r=nikomatsakis
Steve Klabnik [Fri, 8 Jan 2016 18:02:30 +0000 (13:02 -0500)]
Rollup merge of #30747 - nagisa:mir-reenable-test, r=nikomatsakis

Fixes #30674

The test seems to work fine and assertion passes. The test seems to also be generated from MIR (LLVM IR has footprint of MIR translator), thus I’m reenabling it.

8 years agoRollup merge of #30584 - GuillaumeGomez:new_handles, r=pnkfelix
Steve Klabnik [Fri, 8 Jan 2016 18:02:30 +0000 (13:02 -0500)]
Rollup merge of #30584 - GuillaumeGomez:new_handles, r=pnkfelix

Last part of #30413.

r? @pnkfelix

8 years agoThe lint warnings are not reported since we report the errors first and then exit.
Felix S. Klock II [Fri, 8 Jan 2016 15:19:13 +0000 (16:19 +0100)]
The lint warnings are not reported since we report the errors first and then exit.

I think that behavior is fine, so I am removing the expected warnings from these tests.

8 years agoChange destination accessor to return references
Simonas Kazlauskas [Thu, 7 Jan 2016 13:08:02 +0000 (15:08 +0200)]
Change destination accessor to return references

Previously it was returning a value, mostly for the two reasons:

* Cloning Lvalue is very cheap most of the time (i.e. when Lvalue is not a Projection);
* There’s users who want &mut lvalue and there’s users who want &lvalue. Returning a value allows
  to make either one easier when pattern matching (i.e. Some(ref dest) or Some(ref mut dest)).

However, I’m now convinced this is an invalid approach. Namely the users which want a mutable
reference may modify the Lvalue in-place, but the changes won’t be reflected in the final MIR,
since the Lvalue modified is merely a clone.

Instead, we have two accessors `destination` and `destination_mut` which return a reference to the
destination in desired mode.

8 years agoAdd new help messages for E0425
Guillaume Gomez [Thu, 24 Dec 2015 19:44:14 +0000 (20:44 +0100)]
Add new help messages for E0425

8 years agoAdded proper lint for the unit variant/struct warning.
Felix S. Klock II [Fri, 8 Jan 2016 01:07:28 +0000 (02:07 +0100)]
Added proper lint for the unit variant/struct warning.

8 years agoupdate test to reflect other sources of brokenness in it under new
Felix S. Klock II [Thu, 7 Jan 2016 23:36:09 +0000 (00:36 +0100)]
update test to reflect other sources of brokenness in it under new
macro future proofing rules.

(We may want to think about what this test was actually testing and
figure out a way to test it without running afoul of macro future
proofing.  I spent some time trying to do this, e.g. by inserting
parenthesis in the macro input pattern, but I could not quickly get it
working, so I took this tack instead.)

8 years ago[MIR] Fix translation of ConstVal::{Struct, Tuple}
Simonas Kazlauskas [Thu, 7 Jan 2016 23:15:59 +0000 (01:15 +0200)]
[MIR] Fix translation of ConstVal::{Struct, Tuple}

Fixes #30772

8 years agoAuto merge of #30757 - michaelwoerister:mir-visitor-cleanup, r=jroesch
bors [Thu, 7 Jan 2016 22:54:22 +0000 (22:54 +0000)]
Auto merge of #30757 - michaelwoerister:mir-visitor-cleanup, r=jroesch

After a call to `visit_def_id()` missing in `mir::visit::Visitor` but not `mir::visit::MutVisitor` has caused me a couple hours of error hunting, I decided I'd take the time to get rid of the code duplication between the two implementations.

cc @rust-lang/compiler

8 years agoFix MIR text output for terminators since they were made optional.
Scott Olson [Thu, 7 Jan 2016 21:16:07 +0000 (15:16 -0600)]
Fix MIR text output for terminators since they were made optional.

8 years agoAuto merge of #30748 - tsion:mir-tuple-fix, r=eddyb
bors [Thu, 7 Jan 2016 21:04:36 +0000 (21:04 +0000)]
Auto merge of #30748 - tsion:mir-tuple-fix, r=eddyb

r? @nikomatsakis

(Related issue about `debug_tuple` at https://github.com/rust-lang/rfcs/issues/1448.)

```rust

fn main() {
    let _x = ();
}
```

```diff
--- empty_tuple-old.mir 2016-01-06 16:04:24.206409186 -0600
+++ empty_tuple-new.mir 2016-01-06 14:26:17.324888585 -0600
@@ -1,13 +1,13 @@
 fn() -> () {
     let var0: (); // _x
     let mut tmp0: ();

     bb0: {
-        var0 = ;
+        var0 = ();
         Some(goto -> bb1);
     }

     bb1: {
         Some(return);
     }
 }
```

8 years agoupdated test to reflect loosening of check (for issue #30379).
Felix S. Klock II [Thu, 7 Jan 2016 00:03:36 +0000 (01:03 +0100)]
updated test to reflect loosening of check (for issue #30379).

8 years agoextend warning cycle to cover matching unit-structs via `S(..)`
Felix S. Klock II [Wed, 6 Jan 2016 23:45:13 +0000 (00:45 +0100)]
extend warning cycle to cover matching unit-structs via `S(..)`

(this makes them handled like enum unit-variants.)

8 years agofix broken float methods
Pyfisch [Thu, 7 Jan 2016 20:07:24 +0000 (21:07 +0100)]
fix broken float methods

closes #30657

8 years agoAfter RFC amendment 1384, FOLLOW(pat) includes `|`, so update tests accordingly.
Felix S. Klock II [Wed, 6 Jan 2016 23:22:47 +0000 (00:22 +0100)]
After RFC amendment 1384, FOLLOW(pat) includes `|`, so update tests accordingly.

8 years agoUpdated future-proofing test, removed outdated test, and added
Felix S. Klock II [Tue, 24 Nov 2015 18:46:21 +0000 (19:46 +0100)]
Updated future-proofing test, removed outdated test, and added
run-pass test for some new functionality.

8 years agoextending FOLLOW(NT) as specified in amendment.
Felix S. Klock II [Tue, 17 Nov 2015 23:17:48 +0000 (00:17 +0100)]
extending FOLLOW(NT) as specified in amendment.

See RFC amendment 1384:

  https://github.com/rust-lang/rfcs/pull/1384

8 years agomacro_rules: proper FIRST/FOLLOW computations for checking macro_rules validity.
Felix S. Klock II [Thu, 12 Nov 2015 19:55:28 +0000 (20:55 +0100)]
macro_rules: proper FIRST/FOLLOW computations for checking macro_rules validity.

See RFC amendment 1384 and tracking issue 30450:
  https://github.com/rust-lang/rfcs/pull/1384
  https://github.com/rust-lang/rust/issues/30450

Moved old check_matcher code into check_matcher_old

combined the two checks to enable a warning cycle (where we will
continue to error if the two checks agree to reject, accept if the new
check says accept, and warn if the old check accepts but the new check
rejects).

8 years agoRemove extraneous [], replace accidental removed link to heap section
Michael F. Lamb [Thu, 7 Jan 2016 19:44:03 +0000 (11:44 -0800)]
Remove extraneous [], replace accidental removed link to heap section

8 years agoLink Nomicon in PhantomData's docs
Steve Klabnik [Thu, 7 Jan 2016 19:18:15 +0000 (14:18 -0500)]
Link Nomicon in PhantomData's docs

Fixes #30069

8 years agofix trailing whitespace
Pyfisch [Tue, 5 Jan 2016 20:30:14 +0000 (21:30 +0100)]
fix trailing whitespace

8 years agof32: inline methods with special variant for msvc
Pyfisch [Tue, 5 Jan 2016 20:14:38 +0000 (21:14 +0100)]
f32: inline methods with special variant for msvc

8 years agoExpand EO308 to mention try!
Steve Klabnik [Thu, 7 Jan 2016 19:09:20 +0000 (14:09 -0500)]
Expand EO308 to mention try!

Fixes #28953

8 years agoAuto merge of #30739 - pnkfelix:finish-enable-rpath-by-default, r=dotdash
bors [Thu, 7 Jan 2016 17:46:04 +0000 (17:46 +0000)]
Auto merge of #30739 - pnkfelix:finish-enable-rpath-by-default, r=dotdash

finish enabling `-C rpath` by default in rustc. See #30353.

8 years agoMove os_str docs to OsString in order to be visible in HTML (fixes #30743)
Georg Brandl [Thu, 7 Jan 2016 10:58:08 +0000 (11:58 +0100)]
Move os_str docs to OsString in order to be visible in HTML (fixes #30743)

8 years agoAuto merge of #30734 - tsion:mir-pretty, r=nikomatsakis
bors [Thu, 7 Jan 2016 14:22:49 +0000 (14:22 +0000)]
Auto merge of #30734 - tsion:mir-pretty, r=nikomatsakis

* Put `const` in front of every `ConstVal`.
* Pretty-print bytestrings as they appear in Rust source.
* Pretty-print `ConstVal::{Struct, Tuple, Array, Repeat}` by pretty-printing the `ast::NodeId`. This is a temporary measure, and probably not perfect, but I'm avoiding anything more complex since I hear the const evaluator might not be AST-based in the near future.

```rust

struct Point {
    x: i32,
    y: i32,
}

fn consts() {
    let _float = 3.14159;
    let _non_const_int = -42;
    const INT: i32 = -42;
    let _int = INT;
    let _uint = 42u32;
    let _str = "a string";
    let _bytestr = b"a bytes\xFF\n\ttri\'\"\\ng";
    let _bool = true;
    const STRUCT: Point = Point { x: 42, y: 42 };
    let _struct = STRUCT;
    const EXTERNAL_STRUCT: std::sync::atomic::AtomicUsize = std::sync::atomic::ATOMIC_USIZE_INIT;
    let _external_struct = EXTERNAL_STRUCT;
    const TUPLE: (i32, &'static str, &'static [u8; 5]) = (1, "two", b"three");
    let _tuple = TUPLE;
    const FUNC: fn() = consts;
    let _function = FUNC;
    let _non_const_function = consts;
    const ARRAY: [&'static str; 3] = ["a", "b", "c"];
    let _array = ARRAY;
    const REPEAT: [&'static [u8; 3]; 10] = [b"foo"; 10];
    let _repeat = REPEAT;
}
```

```diff
--- consts-old.mir 2016-01-05 23:23:14.163807017 -0600
+++ consts-new.mir 2016-01-05 23:04:51.121386151 -0600
@@ -1,45 +1,45 @@
 fn() -> () {
     let var0: f64; // _float
     let var1: i32; // _non_const_int
     let var2: i32; // _int
     let var3: u32; // _uint
     let var4: &str; // _str
     let var5: &[u8; 18]; // _bytestr
     let var6: bool; // _bool
     let var7: Point; // _struct
     let var8: core::sync::atomic::AtomicUsize; // _external_struct
     let var9: (i32, &str, &[u8; 5]); // _tuple
     let var10: fn(); // _function
     let var11: fn() {consts}; // _non_const_function
     let var12: [&str; 3]; // _array
     let var13: [&[u8; 3]; 10]; // _repeat
     let mut tmp0: ();

     bb0: {
-        var0 = 3.14159;
-        var1 = Neg(42);
-        var2 = -42;
-        var3 = 42;
-        var4 = Str("a string");
-        var5 = ByteStr[97, 32, 98, 121, 116, 101, 115, 255, 10, 9, 116, 114, 105, 39, 34, 92, 110, 103];
-        var6 = true;
-        var7 = Struct(51);
+        var0 = const 3.14159;
+        var1 = Neg(const 42);
+        var2 = const -42;
+        var3 = const 42;
+        var4 = const "a string";
+        var5 = const b"a bytes\xff\n\ttri\'\"\\ng";
+        var6 = const true;
+        var7 = const expr Point{x: 42, y: 42,};
         var8 = consts::EXTERNAL_STRUCT;
-        var9 = Tuple(78);
-        var10 = Function(DefId { krate: 0, node: DefIndex(7) => consts });
+        var9 = const expr (1, "two", b"three");
+        var10 = const consts;
         var11 = consts;
-        var12 = Array(105, 3);
-        var13 = Repeat(122, 10);
+        var12 = const expr ["a", "b", "c"];
+        var13 = const expr [b"foo"; 10];
         drop var8;
         drop var7;
         goto -> bb1;
     }

     bb1: {
         return;
     }

     bb2: {
         diverge;
     }
 }
```

8 years agoAuto merge of #30317 - jseyfried:refactor_type_folder, r=nikomatsakis
bors [Thu, 7 Jan 2016 11:48:35 +0000 (11:48 +0000)]
Auto merge of #30317 - jseyfried:refactor_type_folder, r=nikomatsakis

`TypeFoldable`s can currently be visited inefficiently with an identity folder that is run only for its side effects. This creates a more efficient visitor for `TypeFoldable`s and uses it to implement `RegionEscape` and `HasProjectionTypes`, fixing cleanup issue #20298.
This is a pure refactoring.

8 years agolen needs to be prefixed by self for this to work. The final code in this section...
jonastepe [Thu, 7 Jan 2016 11:13:22 +0000 (12:13 +0100)]
len needs to be prefixed by self for this to work. The final code in this section of the book is correct.

8 years agoFactor mir::[Mut]Visitor implementations into a common macro.
Michael Woerister [Thu, 7 Jan 2016 10:49:46 +0000 (05:49 -0500)]
Factor mir::[Mut]Visitor implementations into a common macro.

8 years agoAuto merge of #30728 - athaeryn:mention-warning-lint-group, r=Manishearth
bors [Thu, 7 Jan 2016 08:24:36 +0000 (08:24 +0000)]
Auto merge of #30728 - athaeryn:mention-warning-lint-group, r=Manishearth

Fixes #30203.

This is my first time writing Rust, and I think this code could be a bit better. Any suggestions?

8 years agoAuto merge of #30724 - nikomatsakis:feature-gate-defaulted-type-parameters, r=pnkfelix
bors [Thu, 7 Jan 2016 06:32:56 +0000 (06:32 +0000)]
Auto merge of #30724 - nikomatsakis:feature-gate-defaulted-type-parameters, r=pnkfelix

It was recently realized that we accept defaulted type parameters everywhere, without feature gate, even though the only place that we really *intended* to accept them were on types. This PR adds a lint warning unless the "type-parameter-defaults" feature is enabled. This should eventually become a hard error.

This is a [breaking-change] in that new feature gates are required (or simply removing the defaults, which is probably a better choice as they have little effect at this time). Results of a [crater run][crater] suggest that approximately 5-15 crates are affected. I didn't do the measurement quite right so that run cannot distinguish "true" regressions from "non-root" regressions, but even the upper bound of 15 affected crates seems relatively minimal.

[crater]: https://gist.github.com/nikomatsakis/760c6a67698bd24253bf

cc @rust-lang/lang
r? @pnkfelix

8 years agoAuto merge of #30723 - nrc:macro-err-bug, r=Manishearth
bors [Thu, 7 Jan 2016 04:44:14 +0000 (04:44 +0000)]
Auto merge of #30723 - nrc:macro-err-bug, r=Manishearth

Fixes #30715

8 years agoAuto merge of #30557 - sfackler:panic-propagate, r=aturon
bors [Thu, 7 Jan 2016 01:26:45 +0000 (01:26 +0000)]
Auto merge of #30557 - sfackler:panic-propagate, r=aturon

See rust-lang/rfcs#1413.

r? @alexcrichton

8 years agoRename fold_subitems_with to super_fold_with
Jeffrey Seyfried [Wed, 6 Jan 2016 02:01:28 +0000 (02:01 +0000)]
Rename fold_subitems_with to super_fold_with

8 years agoRefactor away extension traits RegionEscape and HasTypeFlags
Jeffrey Seyfried [Fri, 18 Dec 2015 10:07:06 +0000 (10:07 +0000)]
Refactor away extension traits RegionEscape and HasTypeFlags

8 years agoCreate a visitor for `TypeFoldable`s and use it to implement RegionEscape and HasType...
Jeffrey Seyfried [Wed, 18 Nov 2015 09:38:57 +0000 (09:38 +0000)]
Create a visitor for `TypeFoldable`s and use it to implement RegionEscape and HasTypeFlags (fixes #20298)

8 years ago[MIR] Set dest ∀ expr with optional value
Simonas Kazlauskas [Wed, 30 Dec 2015 18:00:26 +0000 (20:00 +0200)]
[MIR] Set dest ∀ expr with optional value

Assign a default unit value to the destinations of block expressions without trailing expression,
return expressions without return value (i.e. `return;`) and conditionals without else clause.

8 years agoBe consistent about what is a "chapter" versus a "section"
Michael F. Lamb [Thu, 7 Jan 2016 00:04:47 +0000 (16:04 -0800)]
Be consistent about what is a "chapter" versus a "section"

8 years agoLink to section on references when we use the term prior to defining it
Michael F. Lamb [Thu, 7 Jan 2016 00:04:01 +0000 (16:04 -0800)]
Link to section on references when we use the term prior to defining it

8 years agoLink to references section when they first appear
Michael F. Lamb [Thu, 7 Jan 2016 00:02:03 +0000 (16:02 -0800)]
Link to references section when they first appear

In a straight-through read of "Syntax and Semantics," the concept of a
"reference" is used here before it is explained. Mention that and link to
the section explaining references.

8 years agoExplain surprising new syntax appearing in example code
Michael F. Lamb [Wed, 6 Jan 2016 23:46:58 +0000 (15:46 -0800)]
Explain surprising new syntax appearing in example code

In a straight-through read of "Syntax and Semantics," the first time we
meet a generic, and the first time we meet a vector, is when a Vec<T> shows
up in this example. I'm not sure that I could argue that the whole section
should appear later in the book than the ones on vectors and generics, so
instead just give the reader a brief introduction to both and a promise to
follow up later.

8 years agoAdd std::panic::propagate
Steven Fackler [Fri, 25 Dec 2015 19:00:40 +0000 (12:00 -0700)]
Add std::panic::propagate

8 years agoAuto merge of #30750 - steveklabnik:rollup, r=steveklabnik
bors [Wed, 6 Jan 2016 23:35:13 +0000 (23:35 +0000)]
Auto merge of #30750 - steveklabnik:rollup, r=steveklabnik

- Successful merges: #30683, #30698, #30699, #30700, #30716, #30720, #30727, #30729, #30735, #30749
- Failed merges:

8 years agoRollup merge of #30749 - andgra2:patch-1, r=steveklabnik
Steve Klabnik [Wed, 6 Jan 2016 23:31:58 +0000 (18:31 -0500)]
Rollup merge of #30749 - andgra2:patch-1, r=steveklabnik

8 years agoRollup merge of #30735 - jonastepe:nomicon_vec_dealloc_pointer_type, r=steveklabnik
Steve Klabnik [Wed, 6 Jan 2016 23:31:58 +0000 (18:31 -0500)]
Rollup merge of #30735 - jonastepe:nomicon_vec_dealloc_pointer_type, r=steveklabnik

heap::deallocate expects a *mut u8, but here a *mut T is given as the type of the argument. This would not compile. The final code is correct, however.

8 years agoRollup merge of #30729 - huonw:delete-bad-comment, r=sanxiyn
Steve Klabnik [Wed, 6 Jan 2016 23:31:58 +0000 (18:31 -0500)]
Rollup merge of #30729 - huonw:delete-bad-comment, r=sanxiyn

The fundamental problem of duplication was fixed in https://github.com/rust-lang/rust/pull/10891, but the comment was preserved. Closes https://github.com/rust-lang/rust/issues/9762.

8 years agoRollup merge of #30727 - tbu-:pr_doc_escaped_newline, r=steveklabnik
Steve Klabnik [Wed, 6 Jan 2016 23:31:58 +0000 (18:31 -0500)]
Rollup merge of #30727 - tbu-:pr_doc_escaped_newline, r=steveklabnik

Rust differs in that behavior from C: In C, the newline escapes are resolved
before anything else, and in Rust this depends on whether the backslash is
escaped itself.

A difference can be observed in the following two programs:

```c
int main()
{
printf("\\
n\n");
return 0;
}
```

```rust
fn main() {
println!("\\
n");
}
```

The first program prints two newlines, the second one prints a backslash, a
newline, the latin character n and a final newline.

8 years agoRollup merge of #30720 - BChip:patch-1, r=steveklabnik
Steve Klabnik [Wed, 6 Jan 2016 23:31:57 +0000 (18:31 -0500)]
Rollup merge of #30720 - BChip:patch-1, r=steveklabnik

Declare what LIFO stands for