Commit Graph

49247 Commits

Author SHA1 Message Date
bors
440ef8b154 Auto merge of #30184 - petrochenkov:ascr, r=nikomatsakis
This PR is a rebase of the original PR by @eddyb https://github.com/rust-lang/rust/pull/21836 with some unrebasable parts manually reapplied, feature gate added + type equality restriction added as described below.

This implementation is partial because the type equality restriction is applied to all type ascription expressions and not only those in lvalue contexts. Thus, all difficulties with detection of these contexts and translation of coercions having effect in runtime are avoided.
So, you can't write things with coercions like `let slice = &[1, 2, 3]: &[u8];`. It obviously makes type ascription less useful than it should be, but it's still much more useful than not having type ascription at all.
In particular, things like `let v = something.iter().collect(): Vec<_>;` and `let u = t.into(): U;` work as expected and I'm pretty happy with these improvements alone.

Part of https://github.com/rust-lang/rust/issues/23416
2015-12-19 02:45:15 +00:00
Vadim Petrochenkov
e3da2a9003 Improve OwnedSlice and use it in HIR 2015-12-19 04:20:11 +03:00
bors
8ad12c3e25 Auto merge of #30381 - fhahn:memchr-in-std, r=alexcrichton
This PR adds `memchr`and `memrchr` based on @BurntSushi 's rust-memchr crate to libstd (as discussed in #30151).

I've update some places in libstd to use memchr/memrchr, but I am not sure if there are other places where it could be used as well.

ref #30076
2015-12-19 00:57:25 +00:00
Sebastian Hahn
5b3bdafb96 Have to use Weak instead of Arc in Weak::new() example 2015-12-19 01:49:36 +01:00
Sebastian Hahn
7dd618fd23 Address review comments 2015-12-19 01:31:21 +01:00
Michael McConville
33113f86f4 Fix build by removing needless type prefix 2015-12-18 19:26:11 -05:00
Michael McConville
5b282981d3 Simplify logic checking getentropy's return value 2015-12-18 19:26:11 -05:00
Michael McConville
3ee3a784bf Use a const for getentropy(2)'s syscall number
Reported by Sebastien Marie.
2015-12-18 19:26:10 -05:00
Michael McConville
a51b70b816 Use the correct syscall name in panic message
I copied it from the getrandom code but forgot to change the name.
Reported by Sebastien Marie.
2015-12-18 19:26:10 -05:00
Michael McConville
f4d409d6ed Use the getentropy(2) syscall on OpenBSD
Rust already supports Linux's getrandom(2), which is very similar and
was based on getentropy(2). This is a pretty clean, simple addition that
uses the same approach as the iOS randomness API support.
2015-12-18 19:26:09 -05:00
Simonas Kazlauskas
03903cbc20 Prettify MIR graphviz output
One will look at graphviz often when working with MIR, so may as well make the tables a bit more
pretty :)
2015-12-19 01:25:10 +02:00
Sebastian Hahn
9697076b62 Implement arc::Weak::new() 2015-12-19 00:23:07 +01:00
Sebastian Hahn
4741ad38b5 Rename Weak::new_downgraded to Weak::new 2015-12-19 00:23:07 +01:00
Sebastian Hahn
0e043862bf use core::mem::unintialized instead of uninit intrinsic 2015-12-19 00:23:07 +01:00
Sebastian Hahn
8bed2acf92 Fix doctest failure 2015-12-19 00:23:07 +01:00
bors
9e278950c2 Auto merge of #30364 - luqmana:mir-calls, r=nikomatsakis 2015-12-18 23:06:24 +00:00
Luqman Aden
a6b861b197 [MIR] Initial implementation for translating calls. 2015-12-18 17:33:29 -05:00
Lee Jeffery
d724dae2d4 Fix broken link in E0070 description. 2015-12-18 21:47:16 +00:00
Florian Hahn
a206e556d0 Use memrchr bindings provided by libc 2015-12-18 21:49:20 +01:00
bors
5dd29cc310 Auto merge of #30389 - nikomatsakis:rfc1214-error, r=arielb1
Make RFC 1214 warnings into errors, and rip out the "warn or err"
associated machinery. Future such attempts should go through lints
anyhow.

There is a fair amount of fallout in the compile-fail tests, as WF
checking now occurs earlier in the process.

r? @arielb1
2015-12-18 20:44:33 +00:00
Sebastian Hahn
79d0235439 Implement Weak::new_downgraded() (#30425)
This adds a constructor for a Weak that can never be upgraded. These are
mostly useless, but for example are required when deserializing.
2015-12-18 20:40:17 +01:00
bors
ef91cdb140 Auto merge of #29973 - petrochenkov:privinpub, r=nikomatsakis
Some notes:
This patch enforces the rules from [RFC 136](https://github.com/rust-lang/rfcs/blob/master/text/0136-no-privates-in-public.md) and makes "private in public" a module-level concept and not crate-level. Only `pub` annotations are used by the new algorithm, crate-level exported node set produced by `EmbargoVisitor` is not used. The error messages are tweaked accordingly and don't use the word "exported" to avoid confusing people (https://github.com/rust-lang/rust/issues/29668).

The old algorithm tried to be extra smart with impls, but it mostly led to unpredictable behavior and bugs like https://github.com/rust-lang/rust/issues/28325.
The new algorithm tries to be as simple as possible - an impl is considered public iff its type is public and its trait is public (if presents).
A type or trait is considered public if all its components are public, [complications](https://internals.rust-lang.org/t/limits-of-type-inference-smartness/2919) with private types leaking to other crates/modules through trait impls and type inference are deliberately ignored so far.

The new algorithm is not recursive and uses the nice new facility `Crate::visit_all_items`!

Obsolete pre-1.0 feature `visible_private_types` is removed.

This is a [breaking-change].
The two main vectors of breakage are type aliases (https://github.com/rust-lang/rust/issues/28450) and impls (https://github.com/rust-lang/rust/issues/28325).
I need some statistics from a crater run (cc @alexcrichton) to decide on the breakage mitigation strategy.
UPDATE: All the new errors are reported as warnings controlled by a lint `private_in_public` and lint group `future_incompatible`, but the intent is to make them hard errors eventually.

Closes https://github.com/rust-lang/rust/issues/28325
Closes https://github.com/rust-lang/rust/issues/28450
Closes https://github.com/rust-lang/rust/issues/29524
Closes https://github.com/rust-lang/rust/issues/29627
Closes https://github.com/rust-lang/rust/issues/29668
Closes https://github.com/rust-lang/rust/issues/30055

r? @nikomatsakis
2015-12-18 18:54:52 +00:00
Vadim Petrochenkov
785cbe0200 Do not substitute type aliases during error reporting
Type aliases are still substituted when determining impl publicity
2015-12-18 20:57:36 +03:00
Niko Matsakis
dbf994bbaf Make RFC 1214 warnings into errors, and rip out the "warn or err"
associated machinery. Future such attempts should go through lints
anyhow.

There is a fair amount of fallout in the compile-fail tests, as WF
checking now occurs earlier in the process.
2015-12-18 12:41:02 -05:00
Alex Burka
3da609fe57 add tests for #26873 2015-12-18 12:14:15 -05:00
bors
29ea4eef9f Auto merge of #30374 - durka:issue-30371, r=alexcrichton
Fixes #30371.
2015-12-18 17:06:19 +00:00
Vadim Petrochenkov
95fdaf2375 Require exact type equality + add tests
+ Rebase fixes
2015-12-18 20:00:19 +03:00
Felix S. Klock II
04c05c7b01 Added doc comments for new UnresolvedNameContext enum. 2015-12-18 17:42:46 +01:00
ebadf
cb7017ce3a Made dynamic_lib migration path more explicit 2015-12-18 10:21:13 -06:00
lnmx
49dc357e3e doc: minor format fixes in book/error-handling 2015-12-18 10:27:39 -05:00
bors
3391630778 Auto merge of #30457 - Manishearth:rollup, r=Manishearth
- Successful merges: #30272, #30286, #30365, #30381, #30384, #30398, #30406, #30408, #30420, #30431, #30447, #30452
- Failed merges:
2015-12-18 15:17:29 +00:00
Manish Goregaokar
a8e424685c Rollup merge of #30452 - dotdash:24876_take_2, r=alexcrichton
LLVM doesn't really support reusing the same module to emit more than
one file. One bug this causes is that the IR is invalidated by the stack
coloring pass when emitting the first file, and then the IR verifier
complains by the time we try to emit the second file. Also, we get
different binaries with --emit=asm,link than with just --emit=link. In
some cases leading to segfaults.

Unfortunately, it seems that at this point in time, the most sensible
option to circumvent this problem is to just clone the whole llvm module
for the asm output if we need both, asm and obj file output.

Fixes #24876
Fixes #26235
2015-12-18 20:02:14 +05:30
Manish Goregaokar
4f8b32c96f Rollup merge of #30447 - Xmasreturns:Docu, r=steveklabnik
Added sentences for description of code and changed x in the example to an int
2015-12-18 20:02:14 +05:30
Manish Goregaokar
e9166766bd Rollup merge of #30431 - mmcco:cleanup, r=alexcrichton
Remove a needless variable and simply a cfg().
2015-12-18 20:02:13 +05:30
Manish Goregaokar
9e953df6f0 Rollup merge of #30420 - petrochenkov:owned2, r=nrc
Part of https://github.com/rust-lang/rust/pull/30095 not causing mysterious segfaults.

r? @nrc
2015-12-18 20:02:12 +05:30
Florian Hahn
aa1f8fd3fb Update liblibc to current master 2015-12-18 13:32:14 +01:00
Florian Hahn
de3e843d24 Use memchr in libstd where possible, closes #30076 2015-12-18 13:32:14 +01:00
Florian Hahn
ca52c56e34 Add memchr implemenation based on rust-memchr to libstd 2015-12-18 13:32:14 +01:00
bors
de62f9d885 Auto merge of #30286 - oli-obk:const_error_span, r=nikomatsakis
previously the error was erased and a `non-const path` error was emitted at the location of the field access instead of at the overflow location (as can be seen in the playground: http://is.gd/EuAF5F )
2015-12-18 12:23:54 +00:00
Tamir Duberstein
928e3e4e44 mk: actually run valgrind on x86_64-apple-darwin 2015-12-18 06:53:38 -05:00
Manish Goregaokar
158a1bdd7d Rollup merge of #30406 - durka:patch-13, r=sanxiyn
The previous example had no chance of compiling in either form, due to the restrictive follow set for `ty`. This one has the desired behavior: http://is.gd/kYdw4g (well, I don't exactly desire this behavior at all, but it's true at least :p )
2015-12-18 16:47:38 +05:30
Manish Goregaokar
7eb7bc2e04 Rollup merge of #30398 - jwworth:pull-request-1450205451, r=sanxiyn
This fixes a double word typo, 'the'.
2015-12-18 16:47:38 +05:30
Manish Goregaokar
c2902965cb Rollup merge of #30384 - nrc:diagnostics, r=@nikomatsakis
Should make it possible to add JSON or HTML errors. Also tidies up a lot.
2015-12-18 16:47:37 +05:30
Manish Goregaokar
cb319fc84f Rollup merge of #30286 - oli-obk:const_error_span, r=nikomatsakis
previously the error was erased and a `non-const path` error was emitted at the location of the field access instead of at the overflow location (as can be seen in the playground: http://is.gd/EuAF5F )
2015-12-18 15:56:39 +05:30
bors
f963eb2870 Auto merge of #30272 - tshepang:doc-drain, r=bluss
Second sentence actually repeats info from first sentence. "from start to end" also feels like it adds nothing.

I also extended Vec::drain example.
2015-12-18 05:05:09 +00:00
Michael McConville
b76cebdc8a Beautify ISAAC's mixing arithmetic
Call me verbose, but the existing logic was hideously formatted. The
result still fits in a small terminal. No functional change.
2015-12-17 22:43:48 -05:00
Björn Steinbrink
88ffb26cf5 Fix emitting asm and object file output at the same time
LLVM doesn't really support reusing the same module to emit more than
one file. One bug this causes is that the IR is invalidated by the stack
coloring pass when emitting the first file, and then the IR verifier
complains by the time we try to emit the second file. Also, we get
different binaries with --emit=asm,link than with just --emit=link. In
some cases leading to segfaults.

Unfortunately, it seems that at this point in time, the most sensible
option to circumvent this problem is to just clone the whole llvm module
for the asm output if we need both, asm and obj file output.

Fixes #24876
Fixes #26235
2015-12-18 04:14:52 +01:00
bors
27d551142f Auto merge of #30414 - alexcrichton:fix-cross-builds, r=brson
It looks like #27937 accidentally switched the llvmdeps file from the target to
the host by accident, so be sure to use the right llvmdeps file which is built
for the target when building rustc_llvm
2015-12-18 03:05:02 +00:00
Michael McConville
cf03ceed14 Add a type prefix to fix build
Apparently this file's use annotations have changed since I last pulled
on my test machine.
2015-12-17 21:24:14 -05:00
Michael McConville
5f59e1c8f9 Make runtime function return size_t
It returns sizeof(dirent_t), so I'm not sure why its return type is int.
It's only used once, and that usage immediately casts it to usize.
2015-12-17 21:04:54 -05:00