Commit Graph

65567 Commits

Author SHA1 Message Date
Vadim Petrochenkov
bdffb9722d Move public reexports of private extern crates into a separate lint
This is going to be a hard error while all private-in-public errors from rustc_privacy will be reclassified into lints.
2017-07-08 01:56:27 +03:00
Vadim Petrochenkov
96bcdac9e4 Make sufficiently old or low-impact compatibility lints deny-by-default 2017-07-08 01:56:27 +03:00
Vadim Petrochenkov
affb8ee831 Remove more anonymous trait method parameters 2017-07-08 01:56:27 +03:00
bors
9b85e1cfa5 Auto merge of #42840 - arielb1:poison-smoke-and-mirrors, r=nikomatsakis
Replace the global fulfillment cache with the evaluation cache

This uses the new "Chalk" ParamEnv refactoring to check "global" predicates in an empty environment, which should be correct because global predicates aren't affected by a consistent environment.

Fixes #39970.
Fixes #42796.

r? @nikomatsakis
2017-07-07 21:15:30 +00:00
boreeas
c215d08c4c Fold E0613 into E0609
Resolves #42945
2017-07-07 21:47:39 +02:00
bors
13157c4ebc Auto merge of #42809 - seanmonstar:stable-associated-consts, r=nikomatsakis
remove associated_consts feature gate

Currently struggling to run tests locally (something about jemalloc target missing).

cc #29646
2017-07-07 18:42:14 +00:00
Ariel Ben-Yehuda
b7b965a3e7 return EvaluatedToRecur when evaluating a recursive obligation tree
This helps avoid cache pollution. Also add more comments explaining
that.
2017-07-07 14:05:21 -04:00
Ariel Ben-Yehuda
87a11812e1 use the evaluation cache instead of the global fulfillment cache
The evaluation cache already exists, and it can handle differing
parameter environments natively.

Fixes #39970.
Fixes #42796.
2017-07-07 14:05:02 -04:00
Ariel Ben-Yehuda
16d1700337 use dep-graph reads for the evaluation cache
This is just duplicating the logic from the old fulfillment cache, so
I'm not sure it is 100% correct, but it should not be more wrong than
the old logic.
2017-07-07 14:03:47 -04:00
Ariel Ben-Yehuda
14875fd3b7 prevent illegal coinductive matching in trait evaluation
Previously, coinductive matching was only blocked on the fulfillment
path, and ignored on the evaluation path.
2017-07-07 14:03:23 -04:00
Josh Stone
be509b3387 Skip the main thread's manual stack guard on Linux
Linux doesn't allocate the whole stack right away, and the kernel has
its own stack-guard mechanism to fault when growing too close to an
existing mapping.  If we map our own guard, then the kernel starts
enforcing a rather large gap above that, rendering much of the possible
stack space useless.

Instead, we'll just note where we expect rlimit to start faulting, so
our handler can report "stack overflow", and trust that the kernel's own
stack guard will work.

Fixes #43052.
2017-07-07 09:19:04 -07:00
Ian Douglas Scott
59981e4057
Redox: Fix Condvar.wait(); do not lock mutex twice
The atomic_xchg() loop locks the mutex, so the call to mutex_lock is
incorrect, and blocks.
2017-07-07 08:34:48 -07:00
bors
c0ec385cac Auto merge of #43099 - japaric:msp430, r=alexcrichton
add a built-in MSP430 target

the MSP430 backend has been enabled for a while but no target was added to rustc
to encourage out of tree experimentation.

We believe the out of tree (custom) target has been iterated long enough and is
stable enough for inclusion in the compiler. Kudos to @pftbest and @awygle for
fixing several LLVM / codegen bugs this target had!

The target name chosen is a slight variation of the triple gcc uses, which is
simply `msp430-elf`. We picked `msp430-none-elf` to leave room for custom
targets that target some embedded OS running on MSP430 devices. (cf. the
custom `thumbv7m-tockos-eabi` target TockOS uses vs the built-in
`thumbv7m-none-eabi`).

There's one expected change in the specification of the proposed target: the
`asm_args` and `no_integrated_as` fields will change to their default values.
Once the LLVM backend gains the ability to directly produce MSP430 object files
we can stop depending on `msp430-elf-gcc` for producing object files; when that
occurs the `asm` related fields will change. This change won't break existing
user code.

r? @alexcrichton
cc @brson
2017-07-07 15:27:49 +00:00
bors
703341051d Auto merge of #43093 - rthomas:39791-hashmap, r=alexcrichton
Add annotations to the resize fn #39791

This adds the `inline(never)` and `cold` annotations to the
HashMap::resize function.
2017-07-07 12:54:46 +00:00
bors
70412af285 Auto merge of #43060 - petrochenkov:asless, r=estebank
syntax: Apply `x as usize < y` recovery to type ascription as well

Also correct spans, add some comments.

r? @estebank
2017-07-07 10:37:38 +00:00
Vadim Petrochenkov
4323877e92 syntax: Apply recovery for casts to type ascription
Fix spans, add some comments
2017-07-07 11:53:12 +03:00
Vadim Petrochenkov
5fa1c1b5f3 Fix spans for binary operator expression with interpolated identifiers 2017-07-07 11:21:57 +03:00
bors
33e353ea51 Auto merge of #43091 - aidanhs:aphs-no-docker-priv, r=alexcrichton
Privileged in docker run isn't necessary

Added relatively recently in https://github.com/rust-lang/rust/pull/40199/files#diff-71609a365528e4649836825d8250c241R57, but I don't see anything in that PR that requires it. If it's not strictly necessary, we shouldn't use it.

(if this lands I'll make a PR against libc which also uses privileged)

r? @alexcrichton
2017-07-07 08:13:20 +00:00
kennytm
600800480a
Only match a fragment specifier the if it starts with certain tokens.
Fixes #24189.
Fixes #26444.
Fixes #27832.
Fixes #34030.
Fixes #35650.
Fixes #39964.
Fixes the 4th comment in #40569.
Fixes the issue blocking #40984.
2017-07-07 14:12:12 +08:00
bors
24fc541e7c Auto merge of #43068 - ollie27:rustdoc_markdown_tests, r=GuillaumeGomez
rustdoc: Don't run Markdown tests twice

This matches the behaviour for finding tests in Rust files.

This was a regression from 1.17 to 1.18 so it would be a good idea to backport this to beta so at least 1.19 won't also be affected.

Fixes #42726

r? @GuillaumeGomez
2017-07-07 06:01:30 +00:00
Nikita Baksalyar
e084bb2abc
Fix Rustbuild linking on Illumos
Illumos (an OpenSolaris fork) expects to get several
extra library references for some system functions used
by Rust standard library. This commit adds required linker
options to rustbuild, which is currently doesn't work on
Illumos-based operating systems.
2017-07-07 08:32:18 +03:00
bors
54e3fe7af0 Auto merge of #43062 - sfackler:connect-timeout, r=alexcrichton
Implement TcpStream::connect_timeout

This breaks the "single syscall rule", but it's really annoying to hand
write and is pretty foundational.

r? @alexcrichton

cc @rust-lang/libs
2017-07-07 03:43:14 +00:00
Steven Fackler
8c92da3c51 Implement TcpStream::connect_timeout
This breaks the "single syscall rule", but it's really annoying to hand
write and is pretty foundational.
2017-07-06 19:35:49 -07:00
Kevin Mehall
17bd76a516 Remove unused code from librustc_errors 2017-07-06 18:49:32 -07:00
bors
b80b659d67 Auto merge of #42125 - petrochenkov:privty, r=nikomatsakis
Check types for privacy

This PR implements late post factum checking of type privacy, as opposed to early preventive "private-in-public" checking.
This will allow to turn private-in-public checks into a lint and make them more heuristic-based, and more aligned with what people may expect (e.g. reachability-based behavior).

Types are privacy-checked if they are written explicitly, and also if they are inferred as expression or pattern types.
This PR checks "semantic" types and does it unhygienically, this significantly restricts what macros 2.0 (as implemented in https://github.com/rust-lang/rust/pull/40847) can do (sorry @jseyfried) - they still can use private *names*, but can't use private *types*.
This is the most conservative solution, but hopefully it's temporary and can be relaxed in the future, probably using macro contexts of expression/pattern spans.

Traits are also checked in preparation for [trait aliases](https://github.com/rust-lang/rust/issues/41517), which will be able to leak private traits, and macros 2.0 which will be able to leak pretty much anything.

This is a [breaking-change], but the code that is not contrived and can be broken by this patch should be guarded by `private_in_public` lint. [Previous crater run](https://github.com/rust-lang/rust/issues/34537#issuecomment-262865768) discovered a few abandoned crates that weren't updated since `private_in_public` has been introduced in 2015.

cc https://github.com/rust-lang/rust/issues/34537 https://internals.rust-lang.org/t/lang-team-minutes-private-in-public-rules/4504
Fixes https://github.com/rust-lang/rust/issues/30476
Fixes https://github.com/rust-lang/rust/issues/33479

cc @nikomatsakis
r? @eddyb
2017-07-07 01:32:13 +00:00
petrochenkov
a27f8cf8a3 Address review comments
Fix regressions after rebase
2017-07-07 01:22:48 +03:00
bors
d2ebb12a1d Auto merge of #42904 - estebank:number-suggestions, r=nikomatsakis
Make suggestion include the line number

When there're more than one suggestions in the same diagnostic, they are
displayed in their own block, instead of inline. In order to reduce
confusion, those blocks now display the line number.

New output:

```
error[E0308]: mismatched types
  --> ../../src/test/ui/block-result/unexpected-return-on-unit.rs:19:5
   |
19 |     foo()
   |     ^^^^^ expected (), found usize
   |
   = note: expected type `()`
              found type `usize`
help: did you mean to add a semicolon here?
   |
19 |     foo();
   |          ^
help: possibly return type missing here?
   |
18 | fn bar() -> usize {
   |          ^^^^^^^^

error: aborting due to previous error(s)
```

Fix #39152.
2017-07-06 22:22:21 +00:00
Aidan Hobson Sayers
4bd27fc21b Privileged in docker run isn't necessary 2017-07-06 23:16:12 +01:00
Jorge Aparicio
fc0275af24 add a built-in MSP430 target 2017-07-06 17:09:48 -05:00
Esteban Küber
697c85a4f1 Only underline suggestion if it is not the only code being shown 2017-07-06 14:36:49 -07:00
Esteban Küber
eb478e2381 Add extra whitespace for suggestions 2017-07-06 14:36:48 -07:00
Esteban Küber
7c84914635 Make suggestion include the line number
When there're more than one suggestions in the same diagnostic, they are
displayed in their own block, instead of inline. In order to reduce
confusion, those blocks now display the line number.
2017-07-06 14:36:48 -07:00
Vadim Petrochenkov
08a1d45818 Check adjustments and node substs
Cleanup checking of inherent static methods and fix checking of inherent associated constants
Add more tests
2017-07-06 23:50:02 +03:00
Vadim Petrochenkov
85fb9e0d91 Check types for privacy 2017-07-06 23:50:02 +03:00
Alex Burka
7386288e30 change error URLs to footnote style 2017-07-06 20:13:42 +00:00
Alex Burka
9c0fa15d2c fix description for E0617
It used to point to the Book, but no specific section, and in fact the
information is not in the Book (see rust-lang-nursery/reference#77).
2017-07-06 20:13:42 +00:00
Corey Farwell
55dccb99fd Fix a couple broken links to the reference from error messages. 2017-07-06 20:13:42 +00:00
bors
696412de7e Auto merge of #43092 - aidanhs:aphs-retry-llvm-tarball, r=alexcrichton
Retry downloading llvm commit tarball

As promised on https://github.com/rust-lang/rust/pull/42816#issuecomment-312890169

r? @alexcrichton
2017-07-06 19:56:55 +00:00
Ryan Thomas
c7fc6db68a Add annotations to the resize fn #39791
This adds the `inline(never)` and `cold` annotations to the
HashMap::resize function.
2017-07-06 20:32:47 +01:00
Sean McArthur
74b2d69358 remove associated_consts feature gate 2017-07-06 11:52:25 -07:00
Aidan Hobson Sayers
7c8523e87b Retry downloading llvm commit tarball 2017-07-06 18:55:07 +01:00
bors
cd72f2e269 Auto merge of #42816 - alexcrichton:probestack, r=nikomatsakis
rustc: Implement stack probes for x86

This commit implements stack probes on x86/x86_64 using the freshly landed
support upstream in LLVM. The purpose of stack probes here are to guarantee a
segfault on stack overflow rather than having a chance of running over the guard
page already present on all threads by accident.

At this time there's no support for any other architecture because LLVM itself
does not have support for other architectures.
2017-07-06 17:15:14 +00:00
Alex Crichton
5dbd97de3d rustc: Implement stack probes for x86
This commit implements stack probes on x86/x86_64 using the freshly landed
support upstream in LLVM. The purpose of stack probes here are to guarantee a
segfault on stack overflow rather than having a chance of running over the guard
page already present on all threads by accident.

At this time there's no support for any other architecture because LLVM itself
does not have support for other architectures.
2017-07-06 08:58:19 -07:00
Oliver Middleton
1966a6798d rustdoc: Don't run Markdown tests twice
This matches the behaviour for finding tests in Rust files.
2017-07-06 16:47:58 +01:00
bors
54fc9e4ea5 Auto merge of #43066 - pornel:patch-1, r=Mark-Simulacrum
Suggest rustup toolchain link

The contributing instructions only explain how to build the compiler, but not how to try it out.

I found `rustup toolchain link` to be super useful for this, so I think it's good to suggest it.
2017-07-06 14:46:13 +00:00
bors
ccf401f8f7 Auto merge of #43078 - kennytm:fix-42755-vis-can-be-empty, r=petrochenkov
Disallow `$($v:vis)*`. Fix #42755.

#42755
2017-07-06 11:28:32 +00:00
Kornel
1297b2d952 Suggest rustup toolchain link 2017-07-06 12:26:34 +01:00
kennytm
06e1fc06d7
Disallow $($v:vis)*. Fix #42755. 2017-07-06 18:24:36 +08:00
bors
afb853a3d7 Auto merge of #43008 - zackmdavis:field_init_shorthand_in_librustc, r=estebank
use field init shorthand in src/librustc/

Commentary on #37340 [suggested](https://github.com/rust-lang/rust/issues/37340#issuecomment-255513390) using the new field init syntax in the compiler. Do we care about this? If so, here's a pull request for the librustc/ directory. While [`rustfmt` might do this in the future](https://github.com/rust-lang/rust/issues/37340#issuecomment-255513712), in the meantime, some simple Python will do:

```python
#!/usr/bin/env python3

import os, re, sys

OPPORTUNITY = re.compile(r" (\w+): \1,?\n")

def field_init_shorthand_substitution(filename):
    with open(filename) as f:
        text = f.read()
        revised = OPPORTUNITY.sub(r" \1,\n", text)
    with open(filename, 'w') as f:
        f.write(revised)

def substitute_in_directory(path):
    for dirname, _subdirs, basenames in os.walk(path):
        for basename in basenames:
            field_init_shorthand_substitution(os.path.join(dirname, basename))

if __name__ == "__main__":
    substitute_in_directory(sys.argv[1])
```

**Update 3 July**: edited the search (respectively replace) regex to ` (\w+): \1,?\n` (` \1,\n`) from ` (\w+): \1,` (` \1,`)
2017-07-06 07:49:44 +00:00
Zack M. Davis
f668999153 use field init shorthand in src/librustc
The field init shorthand syntax was stabilized in 1.17.0 (aebd94f); we
are now free to use it in the compiler.
2017-07-05 22:37:10 -07:00