Commit Graph

49483 Commits

Author SHA1 Message Date
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
Vadim Petrochenkov
cda7244a2a Add more systematic tests 2015-12-18 04:56:27 +03:00
Vadim Petrochenkov
8f359d5912 Prohibit public glob reexports of private variants 2015-12-18 04:14:46 +03:00
Vadim Petrochenkov
187c89a92a Address the comments 2015-12-18 04:14:46 +03:00
Vadim Petrochenkov
fcbd553f0f Substitute type aliases before checking for privacy 2015-12-18 04:14:46 +03:00
Vadim Petrochenkov
a745614f44 Use lint instead of warning 2015-12-18 04:14:46 +03:00
Vadim Petrochenkov
1a9239c964 Report errors not caught by the old visitor as warnings 2015-12-18 04:14:46 +03:00
Vadim Petrochenkov
73307475f9 Prohibit private variant reexports 2015-12-18 04:12:31 +03:00
Vadim Petrochenkov
a09246ad34 Approximate type aliases as public when determining impl publicity 2015-12-18 04:12:31 +03:00
Vadim Petrochenkov
f8ae31f601 Update error messages and error descriptions 2015-12-18 04:12:31 +03:00
Vadim Petrochenkov
26a2f852be Fix the fallout 2015-12-18 04:12:31 +03:00
Vadim Petrochenkov
f3f27a5c64 Rewrite VisiblePrivateTypesVisitor 2015-12-18 04:12:31 +03:00
bors
4eadabd9f8 Auto merge of #29907 - nagisa:mir-moar-constants, r=nikomatsakis
Still will not translate references to items like `X` or `Y::V` where

```
struct X;
enum Y { V }
```

but I must go work on university things so I’m PRing what I have.

r? @nikomatsakis
2015-12-18 00:24:05 +00:00
Xmasreturns
2a23e4a5b0 Clarified shadowing example
Added some additional descriptive sentences and changed x to an int in
the example
2015-12-17 14:31:31 -08:00
Vadim Petrochenkov
6c87b19158 Abstract away differences between Vec and ptr::P in HIR 2015-12-18 00:52:56 +03:00
Vadim Petrochenkov
0d298f9904 Deprecate name OwnedSlice and don't use it 2015-12-18 00:52:56 +03:00
Vadim Petrochenkov
09d4a436a7 libsyntax: Merge OwnedSlice into ptr::P 2015-12-18 00:51:10 +03:00