Commit Graph

49323 Commits

Author SHA1 Message Date
Felix S. Klock II
decc286757 add doc for new fn alloc_ty_init.
(Note that it might be a good idea to replace *all* calls of
`alloc_ty` with calls to `alloc_ty_init`, to encourage programmers to
consider the appropriate value for the `init` flag when creating
temporary values.)
2016-01-13 14:29:50 +01:00
Felix S. Klock II
7706e2333e revise lifetime handling for alloca's that are initialized as "dropped."
(This can/should be revisited when drop flags are stored out of band.)
2016-01-13 14:29:50 +01:00
Felix S. Klock II
8168765d43 Factored out private routine for emitting LLVM lifetime intrinsic calls.
(The reason this is not factored as far as possible because a
subsequent commit is going to need to do construction without having
access to a `cx`.)
2016-01-13 14:29:50 +01:00
Felix S. Klock II
df1283cd1a Unit/regression tests for issues #29092, #30018, #30530, #30822.
Note that the test for #30822 is folded into the test for #30530 (but
the file name mentions only 30530).
2016-01-13 14:29:25 +01:00
Felix S. Klock II
f251ff4081 bug fixes for issues 30018 and 30822.
includes bugfixes pointed out during review:

 * Only `call_lifetime_start` for an alloca if the function entry does
   not itself initialize it to "dropped."

 * Remove `schedule_lifetime_end` after writing an *element* into a
   borrowed slice. (As explained by [dotdash][irc], "the lifetime end
   that is being removed was for an element in the slice, which is not
   an alloca of its own and has no lifetime start of its own")

[irc]: https://botbot.me/mozilla/rust-internals/2016-01-13/?msg=57844504&page=3
2016-01-13 14:02:06 +01:00
Felix S. Klock II
cec7280bf3 debug instrumentation (can remove) 2016-01-12 15:24:52 +01:00
Felix S. Klock II
965b0bfefe Issue 30530: initialize allocas for Datum::to_lvalue_datum_in_scope.
In particular, bring back the `zero` flag for `lvalue_scratch_datum`,
which controls whether the alloca's created immediately at function
start are uninitialized at that point or have their embedded
drop-flags initialized to "dropped".

Then made `to_lvalue_datum_in_scope` pass "dropped" as `zero` flag.
2016-01-12 15:24:52 +01:00
bors
3246eaec90 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
2016-01-12 08:30:56 +00:00
bors
d6cb2791ce 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
2016-01-12 05:20:23 +00:00
bors
dedaebd5a1 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?
2016-01-12 03:00:00 +00:00
bors
4405944b94 Auto merge of #30826 - nagisa:rollup, r=nagisa
- Successful merges: #30538, #30687, #30694, #30737, #30761, #30768, #30774, #30798, #30808, #30812, #30814
- Failed merges:
2016-01-11 20:59:15 +00:00
Simonas Kazlauskas
8dd7eabad7 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
2016-01-11 21:17:54 +02:00
Simonas Kazlauskas
0b8370c397 Rollup merge of #30812 - D101101:patch-2, r=steveklabnik
r? @steveklabnik
2016-01-11 21:17:53 +02:00
Simonas Kazlauskas
b3749b7ceb Rollup merge of #30808 - GuillaumeGomez:remove_lang_iter, r=alexcrichton
Fixes #30803

r? @nagisa
2016-01-11 21:17:53 +02:00
Simonas Kazlauskas
584e145e43 Rollup merge of #30798 - erickt:fix-doc, r=apasel422 2016-01-11 21:17:53 +02:00
Simonas Kazlauskas
6aaa6068c5 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.
2016-01-11 21:17:53 +02:00
Simonas Kazlauskas
19820c4488 Rollup merge of #30768 - steveklabnik:gh28953, r=alexcrichton
Fixes #28953
2016-01-11 21:17:53 +02:00
Simonas Kazlauskas
04906061d8 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
2016-01-11 21:17:52 +02:00
Simonas Kazlauskas
caf6095fcf Rollup merge of #30737 - Ms2ger:MutateMode, r=sanxiyn 2016-01-11 21:17:52 +02:00
Simonas Kazlauskas
6d6e831c33 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
2016-01-11 21:17:52 +02:00
Simonas Kazlauskas
6cc2e37135 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.
2016-01-11 21:17:52 +02:00
Simonas Kazlauskas
dd6aa056fc Rollup merge of #30538 - oli-obk:kill_unsigned_unary_negation, r=pnkfelix
fixes  #29645
2016-01-11 21:17:52 +02:00
bors
1586005a1d 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
2016-01-11 19:03:18 +00:00
bors
0672ed4e82 Auto merge of #30800 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #30766, #30771, #30789
- Failed merges:
2016-01-11 17:15:27 +00:00
bors
d01ed8ad8e 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.
2016-01-11 15:26:57 +00:00
bors
5cf69aa951 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
2016-01-11 13:39:06 +00:00
Oliver Schneider
bac3eec67c [breaking-change] remove negate_unsigned feature gate 2016-01-11 12:31:46 +01:00
Amanieu d'Antras
e304fb43a3 Replace no_elf_tls with target_thread_local 2016-01-11 10:38:36 +00:00
bors
d228cd3964 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
```
2016-01-11 10:19:44 +00:00
bors
dfaddb732c 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.
2016-01-11 08:32:46 +00:00
bors
69e1f57dfb 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.
2016-01-11 06:40:58 +00:00
Brian Anderson
bcf20a7cb1 doc: Add descriptions to links in the index
These are the same descriptions as on the website.
2016-01-10 22:30:09 +00:00
Sergey Veselkov
8cc149dbc1 Fix link in getting-started.md 2016-01-11 00:13:54 +03:00
Guillaume Gomez
216e72f8d9 Remove unneeded #[lang = "iterator"] 2016-01-10 16:54:04 +01:00
Steve Klabnik
b2e670a7f3 Rollup merge of #30789 - D101101:patch-1, r=steveklabnik 2016-01-09 14:04:20 -05:00
Steve Klabnik
c0983cd67e 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
2016-01-09 14:04:20 -05:00
Steve Klabnik
1345d188b7 Rollup merge of #30766 - steveklabnik:gh28810, r=steveklabnik
Doing so is considered weaker writing. Thanks @Charlotteis!

Fixes #28810
2016-01-09 14:04:20 -05:00
Steve Klabnik
6ba952020f Remove many instances of 'just'
Doing so is considered weaker writing. Thanks @Charlotteis!

Fixes #28810
2016-01-09 14:03:58 -05:00
Erick Tryzelaar
cd1f0b75f3 Fix a typo in rustc_mir::build::scope's documentation 2016-01-09 10:31:50 -08:00
Sergey Veselkov
31e39cd05c Remove unused link from enums.md 2016-01-09 12:17:44 +03:00
Niko Matsakis
b0f6a47a0f Minor rebase corrections 2016-01-08 21:00:24 -05:00
Niko Matsakis
83710b4471 permit coercions if [error] is found in either type 2016-01-08 20:20:02 -05:00
Ariel Ben-Yehuda
a3cbfa58be 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).
2016-01-08 20:20:02 -05:00
Niko Matsakis
77756cb12a Change error scheme so that if projection fails we generate A::B instead of TyError 2016-01-08 20:20:02 -05:00
Niko Matsakis
64b720229c Remove ErrorCandidate in favor of just generating an ambiguous result 2016-01-08 20:20:02 -05:00
Niko Matsakis
b4f5ddba67 Make coherence more tolerant of error types.
Fixes #29857.
Fixes #30589.
2016-01-08 20:20:01 -05:00
bors
d70ab2bdf1 Auto merge of #30782 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #30584, #30747, #30755, #30758, #30760, #30769
- Failed merges: #30766
2016-01-08 22:42:10 +00:00
Steve Klabnik
926eb83e78 Rollup merge of #30769 - steveklabnik:gh30069, r=apasel422
Fixes #30069
2016-01-08 13:02:31 -05:00
Steve Klabnik
2908385fc7 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.
2016-01-08 13:02:31 -05:00
Steve Klabnik
3836578be2 Rollup merge of #30758 - birkenfeld:fix-30743, r=steveklabnik
(fixes #30743)

Not sure if the "Note" should be kept.
2016-01-08 13:02:31 -05:00