Commit Graph

50191 Commits

Author SHA1 Message Date
bors
f01b85b103 Auto merge of #31382 - DanielJCampbell:SaveSpans, r=nrc
r? @nrc
2016-02-04 15:44:35 +00:00
Paul Dicker
fb172b676e Allow dead code for symlink_junction() 2016-02-04 16:29:55 +01:00
Robin Kruppe
33713bca49 drive-by doc fixes 2016-02-04 16:28:08 +01:00
Robin Kruppe
cc68f2c6bf Enable unit tests for literals that overflow. I have no idea why this condition was ever added. 2016-02-04 16:28:07 +01:00
Robin Kruppe
af5d574d1f Prevent the immediate panic uncovered by #31109 and add a test.
The code there still triggers an ICE, but for different reasons (const eval unwraps the parse result).
2016-02-04 16:28:06 +01:00
Robin Kruppe
a8dc1f974b Add the kind of input from #31109 to the expensive tests (not run by default) 2016-02-04 16:27:22 +01:00
Robin Kruppe
25c9ac3280 Use the right target ratio in Algorithm M quickstart.
Using f64's bit size probably wasn't actually *wrong*, but it would overshoot for no reason. This might have slowed down f32 parsing significantly.
2016-02-04 16:24:23 +01:00
Simonas Kazlauskas
5638847ae3 Address nits on build/scope.rs 2016-02-04 15:56:05 +02:00
Simonas Kazlauskas
ebf6341d1d Translation part of drop panic recovery
With this commit we now finally execute all the leftover drops once some drop panics for some
reason!
2016-02-04 15:56:05 +02:00
Simonas Kazlauskas
98265d3385 Convert Drop statement into terminator
The structure of the old translator as well as MIR assumed that drop glue cannot possibly panic and
translated the drops accordingly. However, in presence of `Drop::drop` this assumption can be
trivially shown to be untrue. As such, the Rust code like the following would never print number 2:

```rust
struct Droppable(u32);
impl Drop for Droppable {
    fn drop(&mut self) {
        if self.0 == 1 { panic!("Droppable(1)") } else { println!("{}", self.0) }
    }
}
fn main() {
    let x = Droppable(2);
    let y = Droppable(1);
}
```

While the behaviour is allowed according to the language rules (we allow drops to not run), that’s
a very counter-intuitive behaviour. We fix this in MIR by allowing `Drop` to have a target to take
on divergence and connect the drops in such a way so the leftover drops are executed when some drop
unwinds.

Note, that this commit still does not implement the translator part of changes necessary for the
grand scheme of things to fully work, so the actual observed behaviour does not change yet. Coming
soon™.

See #14875.
2016-02-04 15:56:05 +02:00
Simonas Kazlauskas
65dd5e6a84 Remove the CallKind
We used to have CallKind only because there was a requirement to have all successors in a
contiguous memory block. Now that the requirement is gone, remove the CallKind and instead just
have the necessary information inline.

Awesome!
2016-02-04 15:56:04 +02:00
Simonas Kazlauskas
02365fe753 Change successor{,_mut} to return a Vec
This helps to avoid the unpleasant restriction of being unable to have multiple successors in
non-contiguous block of memory.
2016-02-04 15:56:04 +02:00
Simonas Kazlauskas
432460a6fc Synthesize calls to box_free language item
This gets rid of Drop(Free, _) MIR construct by synthesizing a call to language item which
takes care of dropping instead.
2016-02-04 15:56:01 +02:00
bors
e64ca8cd59 Auto merge of #31161 - sfackler:slice-to-socket-addrs, r=alexcrichton
This is useful when you have an API that takes a `T: ToSocketAddrs` and needs to turn that into an owned value which will be passed to another API taking `T: ToSocketAddrs` at a later time, for example: https://github.com/sfackler/rust-hyper-socks/blob/master/src/lib.rs#L15
2016-02-04 13:41:42 +00:00
bors
7b9d6d3bc8 Auto merge of #31069 - sfackler:file-try-clone, r=alexcrichton
I have it set as stable right now under the rationale that it's extending an existing, stable API to another type in the "obvious" way.

r? @alexcrichton

cc @reem
2016-02-04 11:39:27 +00:00
Steven Fackler
7ea0abfb35 Implement ToSocketAddrs for &[SocketAddr] 2016-02-04 09:44:30 +00:00
Steven Fackler
a414b61f92 Add File::try_clone 2016-02-04 09:43:21 +00:00
bors
9c30f12790 Auto merge of #31378 - nagisa:target-man, r=alexcrichton 2016-02-04 09:38:15 +00:00
Richard Bradfield
3cafce6596 Fix unclear make_mut docs
Changed the description of the `make_mut` copy-on-write behaviour in arc.rs

The sentence "doesn't have one strong reference and no weak references." is a
hard to understand double negative, which can be much more easily explained.
2016-02-04 09:25:03 +00:00
bors
f511b21dba Auto merge of #31326 - sdleffler:master, r=nikomatsakis
After the truly incredible and embarrassing mess I managed to make in my last pull request, this should be a bit less messy.

Fixes #31267 - with this change, the code mentioned in the issue compiles.

Found and fixed another issue as well - constants of zero-size types, when used in ExprRepeats inside associated constants, were causing the compiler to crash at the same place as #31267. An example of this:
```

struct Bar;

const BAZ: Bar = Bar;

struct Foo([Bar; 1]);

struct Biz;

impl Biz {
    const BAZ: Foo = Foo([BAZ; 1]);
}

fn main() {
    let foo = Biz::BAZ;
    println!("{:?}", foo);
}
```
However, I'm fairly certain that my fix for this is not as elegant as it could be. The problem seems to occur only with an associated constant of a tuple struct containing a fixed size array which is initialized using a repeat expression, and when the element to be repeated provided to the repeat expression is another constant which is of a zero-sized type. The fix works by looking for constants and associated constants which are zero-width and consequently contain no data, but for which rustc is still attempting to emit an LLVM value; it simply stops rustc from attempting to emit anything. By my logic, this should work fine since the only values that are emitted in this case (according to the comments) are for closures with side effects, and constants will never have side effects, so it's fine to simply get rid of them. It fixes the error and things compile fine with it, but I have a sneaking suspicion that it could be done in a far better manner.

r? @nikomatsakis
2016-02-04 06:07:26 +00:00
Alex Burka
45e716e51c test #[derive(FromPrimitive)] triggers custom-derive error 2016-02-04 01:03:08 -05:00
bors
1096e7ab7a Auto merge of #30962 - Amanieu:non_volatile_atomic, r=alexcrichton
Rust currently emits atomic loads and stores with the LLVM `volatile` qualifier. This is unnecessary and prevents LLVM from performing optimization on these atomic operations.
2016-02-04 02:46:44 +00:00
Alex Burka
f6e22e53f3 remove dead #[derive(FromPrimitive)] code 2016-02-03 21:26:02 -05:00
bors
3c9442fc50 Auto merge of #30796 - GuillaumeGomez:impl_box_error, r=alexcrichton
Fixes #30349
2016-02-04 00:39:55 +00:00
Jeffrey Seyfried
9c166cb671 Remove unneeded borrows and slices 2016-02-03 23:40:46 +00:00
Jeffrey Seyfried
9fc71b4506 Remove unneeded use of Cell 2016-02-03 23:40:44 +00:00
Jeffrey Seyfried
79a3f22246 Refactor away resolve_item_by_name_in_lexical_scope 2016-02-03 23:40:38 +00:00
Jeffrey Seyfried
964b72b3e0 Refactor resolve_import_for_module 2016-02-03 23:39:16 +00:00
Jeffrey Seyfried
0c40621759 Refactor away resolve_module_in_lexical_scope 2016-02-03 23:39:14 +00:00
Jeffrey Seyfried
23bdbb13f4 Refactor block_needs_anonymous_module 2016-02-03 23:39:13 +00:00
Jeffrey Seyfried
2ed210d5fe Refactor more functionality into record_import_use 2016-02-03 23:39:12 +00:00
Jeffrey Seyfried
8e61ca4acc Refactor resolve_item_in_lexical_scope 2016-02-03 23:39:10 +00:00
Jeffrey Seyfried
298346dd5b Improve detection of unused imports 2016-02-03 23:39:08 +00:00
Björn Steinbrink
8c0f4f5d3a Avoid quadratic growth of functions due to cleanups
If a new cleanup is added to a cleanup scope, the cached exits for that
scope are cleared, so all previous cleanups have to be translated
again. In the worst case this means that we get N distinct landing pads
where the last one has N cleanups, then N-1 and so on.

As new cleanups are to be executed before older ones, we can instead
cache the number of already translated cleanups in addition to the
block that contains them, and then only translate new ones, if any and
then jump to the cached ones, getting away with linear growth instead.

For the crate in #31381 this reduces the compile time for an optimized
build from >20 minutes (I cancelled the build at that point) to about 11
seconds. Testing a few crates that come with rustc show compile time
improvements somewhere between 1 and 8%. The "big" winner being
rustc_platform_intrinsics which features code similar to that in #31381.

Fixes #31381
2016-02-04 00:34:53 +01:00
bors
e3bcddb44b Auto merge of #31078 - nbaksalyar:illumos, r=alexcrichton
This pull request adds support for [Illumos](http://illumos.org/)-based operating systems: SmartOS, OpenIndiana, and others. For now it's x86-64 only, as I'm not sure if 32-bit installations are widespread. This PR is based on #28589 by @potatosalad, and also closes #21000, #25845, and #25846.

Required changes in libc are already merged: https://github.com/rust-lang-nursery/libc/pull/138

Here's a snapshot required to build a stage0 compiler:
https://s3-eu-west-1.amazonaws.com/nbaksalyar/rustc-sunos-snapshot.tar.gz
It passes all checks from `make check`.

There are some changes I'm not quite sure about, e.g. macro usage in `src/libstd/num/f64.rs` and `DirEntry` structure in `src/libstd/sys/unix/fs.rs`, so any comments on how to rewrite it better would be greatly appreciated.

Also, LLVM configure script might need to be patched to build it successfully, or a pre-built libLLVM should be used. Some details can be found here: https://llvm.org/bugs/show_bug.cgi?id=25409

Thanks!

r? @brson
2016-02-03 22:40:32 +00:00
Matt Brubeck
7b3ea40500 Remove redundant semicolon from "block_expr" in grammar reference
"stmt" already includes the terminating semicolon.
2016-02-03 13:43:52 -08:00
Tobias Bucher
b27b8f63bc Add tests for Cow::from for strings, vectors and slices 2016-02-03 20:45:30 +01:00
Tobias Bucher
f30f569f3b Add Cow::from for Vec and slices
Fixes #31354.
2016-02-03 20:45:18 +01:00
bors
18c1781a4c Auto merge of #30834 - reem:rwlock-read-guard-map, r=alexcrichton
This is very useful when the RwLock is synchronizing access to a data
structure and you would like to return or store guards which contain
references to data inside the data structure instead of the data structure
itself.
2016-02-03 19:26:05 +00:00
Paul Dicker
0bd55e5484 Reformat comments 2016-02-03 18:50:57 +01:00
Paul Dicker
7f6f458194 Adress comments 2016-02-03 18:23:33 +01:00
bors
8fc73c703a Auto merge of #31056 - kamalmarhubi:std-process-nul-chars, r=alexcrichton
This reports an error at the point of calling `Command::spawn()` or one of
its equivalents.

Fixes #30858
Fixes #30862
2016-02-03 17:19:10 +00:00
mitaa
1fcdedb8fb Fix rendering of single-char-span
A span spanning only a single character would render like `^~`
instead of just `^`.
2016-02-03 16:54:37 +01:00
Kamal Marhubi
7c64bf1b9b std: Properly handle interior NULs in std::process
This reports an error at the point of calling `Command::spawn()` or one of
its equivalents.

Fixes https://github.com/rust-lang/rust/issues/30858
Fixes https://github.com/rust-lang/rust/issues/30862
2016-02-03 10:54:29 -05:00
Guillaume Bonnet
e9dfc94d26 compiler-rt: Handle -Werror=* arguments in CFLAGS 2016-02-03 16:17:32 +01:00
bors
b14af1e4ef Auto merge of #31371 - apasel422:docs, r=alexcrichton
r? @steveklabnik
2016-02-03 15:13:39 +00:00
Nikita Baksalyar
fae883c113
Fix broken auto-mac-ios-opt build 2016-02-03 16:45:34 +03:00
bors
2d4e94a501 Auto merge of #31385 - oli-obk:doc/mir, r=nagisa
I didn't change any content, just added another slash so we can see those comments in the docs

r? @steveklabnik
2016-02-03 13:05:18 +00:00
Oliver Schneider
4e44ef1e29 upgrade comments on MIR structures and functions to doc comments 2016-02-03 13:25:07 +01:00
bors
db6f888e78 Auto merge of #31375 - nagisa:path-docs, r=alexcrichton 2016-02-03 10:59:47 +00:00