Commit Graph

74242 Commits

Author SHA1 Message Date
Ryan Cumming
b9441f2428 Improve char escaping in lexer messages
Currently ', " and \ are escaped as \', \" and \\ respectively. This
leads to confusing messages such as `error: unknown start of token: \\`
when encountering a single backslash.

Fix by emitting printable ASCII characters directly. This will still
escape \r, \n, \t and Unicode characters.

Fixes #47902
2018-02-01 08:19:22 +11:00
bors
8ccab7eed5 Auto merge of #47900 - kennytm:rollup, r=kennytm
Rollup of 16 pull requests

- Successful merges: #47838, #47840, #47844, #47874, #47875, #47876, #47884, #47886, #47889, #47890, #47891, #47795, #47677, #47893, #47895, #47552
- Failed merges:
2018-01-31 20:51:02 +00:00
Josh Stone
55b54a999b Use a range to identify SIGSEGV in stack guards
Previously, the `guard::init()` and `guard::current()` functions were
returning a `usize` address representing the top of the stack guard,
respectively for the main thread and for spawned threads.  The `SIGSEGV`
handler on `unix` targets checked if a fault was within one page below
that address, if so reporting it as a stack overflow.

Now `unix` targets report a `Range<usize>` representing the guard
memory, so it can cover arbitrary guard sizes.  Non-`unix` targets which
always return `None` for guards now do so with `Option<!>`, so they
don't pay any overhead.

For `linux-gnu` in particular, the previous guard upper-bound was
`stackaddr + guardsize`, as the protected memory was *inside* the stack.
This was a glibc bug, and starting from 2.27 they are moving the guard
*past* the end of the stack.  However, there's no simple way for us to
know where the guard page actually lies, so now we declare it as the
whole range of `stackaddr ± guardsize`, and any fault therein will be
called a stack overflow.  This fixes #47863.
2018-01-31 11:41:29 -08:00
Josh Stone
e2de8deb09 Enable stack-probe tests with system LLVM >= 5.0 2018-01-31 11:41:26 -08:00
kennytm
af95302d3c
Rollup merge of #47552 - oberien:stepby-nth, r=dtolnay
Specialize StepBy::nth

This allows optimizations of implementations of the inner iterator's `.nth` method.
2018-02-01 02:34:15 +08:00
kennytm
86eb725953
Rollup merge of #47895 - varkor:non-utf-stdin, r=estebank
Fix ICE when reading non-UTF-8 input from stdin

Fixes #22387.
2018-02-01 02:32:10 +08:00
kennytm
61972e733d
Rollup merge of #47893 - alexcrichton:move-codegen-backends, r=alexcrichton
rustc: Move location of `codegen-backends` dir

Right now this directory is located under:

```
$sysroot/lib/rustlib/$target/lib/codegen-backends
```

but after seeing what we do in a few other places it seems that a more
appropriate location would be:

```
$sysroot/lib/rustlib/$target/codegen-backends
```

so this commit moves it!
2018-02-01 02:29:38 +08:00
kennytm
68135d1936
Rollup merge of #47677 - etaoins:avoid-underflow-in-rennder-source-line, r=estebank
Avoid underflow in render_source_line

While testing rust-lang/rust#47655 I was able to make the compiler panic when it's compiled with debug assertions:

```shell
> rustc /dev/null --crate-type proc-macro

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.25.0-dev running on x86_64-apple-darwin

note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'attempt to subtract with overflow', librustc_errors/emitter.rs:287:49
```

Without debug assertions the following warning is emitted:

```shell
> rustc /dev/null --crate-type proc-macro

warning: unused variable: `registrar`
 --> /dev/null:0:1
  |
  |
  = note: #[warn(unused_variables)] on by default
  = note: to avoid this warning, consider using `_registrar` instead
```

The panic is due to the unused variable warning being spanned to `/dev/null:0:1`. When `render_source_line` subtracts 1 from the line number to look up the source line it panics due to underflow. Without debug assertions this would wrap and cause us to return a blank string instead.

Fix by explicitly testing for 0 and exiting early. I'm unsure how to automatically test this now that rust-lang/rust#46655 has been approved.
2018-02-01 02:26:48 +08:00
Alex Crichton
8ebe542480 rustc: Move location of codegen-backends dir
Right now this directory is located under:

  $sysroot/lib/rustlib/$target/lib/codegen-backends

but after seeing what we do in a few other places it seems that a more
appropriate location would be:

  $sysroot/lib/rustlib/$target/codegen-backends

so this commit moves it!
2018-01-31 10:16:26 -08:00
kennytm
64fc9d2b9e
Rollup merge of #47795 - avborhanian:master, r=rkruppe
Adding ICH to the glossary.

Fixes #47782.
2018-01-31 22:11:12 +08:00
varkor
a43d7eb3dd Use file containing non-UTF-8 character instead of echo -e 2018-01-31 11:56:15 +00:00
varkor
00a33d685b Add echo escape flag 2018-01-31 10:23:15 +00:00
kennytm
bacb5b7224 Rollup merge of #47891 - eddyb:issue-47638, r=nikomatsakis
rustc_trans: keep LLVM types for trait objects anonymous.

Fixes #47638 by reverting the addition of readable LLVM trait object type names.
r? @nikomatsakis
2018-01-31 16:36:18 +08:00
kennytm
3d8279dec7 Rollup merge of #47890 - pftbest:no_trap, r=alexcrichton
[MSP430] Don't enable trap_unreachable option by default on msp.

Since MSP430 doesn't meaningfully support faulting on illegal
instructions, LLVM generates a call to abort() function instead
of a trap instruction. Such calls are 4 bytes long, and that is
too much overhead for such small target.

r? @alexcrichton
2018-01-31 16:36:17 +08:00
kennytm
fde67b6ae3 Rollup merge of #47889 - alexcrichton:wasm-hidden-by-default, r=cramertj
rustc: Add an option to default hidden visibility

This commit adds a new option to target specifictions to specify that symbols
should be "hidden" visibility by default in LLVM. While there are no existing
targets that take advantage of this the `wasm32-unknown-unknown` target will
soon start to use this visibility. The LLD linker currently interprets `hidden`
as "don't export this from the wasm module" which is what we want for 90% of our
functions. While the LLD linker does have a "export this symbol" argument which
is what we use for other linkers, it was also somewhat easier to do this change
instead which'll involve less arguments flying around. Additionally there's no
need for non-`hidden` visibility for most of our symbols!

This change should not immediately impact the wasm targets as-is, but rather
this is laying the foundations for soon integrating LLD as a linker for wasm
code.
2018-01-31 16:36:15 +08:00
kennytm
2c3e6ac887 Rollup merge of #47886 - alexcrichton:llvm-7-start, r=eddyb
rustc: Add some defines for LLVM 7 compat

I was testing out the tip support to see what's going on with wasm, and this was
I believe the only issue encountered with LLVM 7 support so far.
2018-01-31 16:36:14 +08:00
kennytm
ffb6b466b8 Rollup merge of #47884 - cuviper:run-pass-sse2, r=alexcrichton
Ignore run-pass/sse2 when using system LLVM

This is a test of `target_feature`, which needs a rust-specific patch to
LLVM to add `MCSubtargetInfo::getFeatureTable()`.
2018-01-31 16:36:13 +08:00
kennytm
38587a7bd9 Rollup merge of #47876 - GuillaumeGomez:associated-const-error, r=nikomatsakis
Update associated constants error message

Fixes #47570.
2018-01-31 16:36:11 +08:00
kennytm
6c0d5f5826 Rollup merge of #47875 - jcowgill:mips-clobber-at, r=rkruppe
rustc_trans: clobber $1 (aka $at) on mips

This copies what clang does. There is a long explanation as to why this is needed in the clang source (tools/clang/lib/Basic/Targets/Mips.h).
2018-01-31 16:36:10 +08:00
kennytm
33d175f74d Rollup merge of #47874 - jcowgill:mips-from_raw_os_error, r=dtolnay
std: use more portable error number in from_raw_os_error docs

On MIPS, error number 98 is not `EADDRINUSE` (it is `EPROTOTYPE`). To fix the resulting test failure this causes, use a more portable error number in the example documentation. `EINVAL` shold be more reliable because it was defined in the original Unix as 22 so hopefully most derivatives have defined it the same way.
2018-01-31 16:36:09 +08:00
kennytm
c66c6b7ee7 Rollup merge of #47844 - CAD97:patch-1, r=estebank
Fix regression: account for trait methods in arg count mismatch error

Fixed #47706 (https://github.com/rust-lang/rust/issues/47706#issuecomment-361161495)

Original PR #47747 missed methods on trait definitions.

This edit was done in GitHub. I think I got the signature of the variant right, going by the ICE debug output and the other cases above.
2018-01-31 16:36:08 +08:00
kennytm
0370717296 Rollup merge of #47840 - penpalperson:master, r=bluss
Marked Debug implementations for primitive types as #[inline]

Change for issue #47792.
2018-01-31 16:36:06 +08:00
kennytm
89ea6d2a3e Rollup merge of #47838 - euclio:snakecase-suggestion, r=petrochenkov
use correct casing for rename suggestions

If the original name is uppercase, use camel case. Otherwise, use snake
case.
2018-01-31 16:36:05 +08:00
bors
560a2f4faf Auto merge of #45752 - estebank:highlight-primary, r=nikomatsakis
Highlight code on diagnostics when underlined

Highlight the label's span with the respective color:

<img width="692" alt="" src="https://user-images.githubusercontent.com/1606434/32411026-a1842482-c18d-11e7-9933-6510eefbad19.png">

Fix #42112.
2018-01-31 07:53:57 +00:00
bors
b8f2674ea4 Auto merge of #46666 - clarcharr:duration_core, r=alexcrichton
Move Duration to libcore

Fixes #46520; should be merged after #46508.
2018-01-31 04:16:12 +00:00
QuietMisdreavus
5a350c1371 add doc(include) to the save-analysis test 2018-01-30 20:54:34 -06:00
Aaron Hill
bc8e11b975
Fix ICE when assigning references to a static mut with NLL
is_unsafe_place only filters out statics in the rhs, not the lhs. Since
it's possible to reach that 'Place::Static', we handle statics the same
way as we do locals.

Fixes #47789
2018-01-30 21:44:35 -05:00
Yury Delendik
cfe53c0666 Export wasm source map when debug information is enabled
We use binaryen's linker to produce a wasm file (via s2wasm). The wasm writer has capabilities to export source maps.

The produced source map contains references to the original file, that might require additional source map file processing to include / package original files with it.
2018-01-30 20:10:58 -06:00
Zack M. Davis
5985b0b035 wherein the parens lint keeps its own counsel re args in nested macros
In #46980 ("in which the unused-parens lint..." (14982db2d6)), the
unused-parens lint was made to check function and method arguments,
which it previously did not (seemingly due to oversight rather than
willful design). However, in #47775 and discussion thereon,
user–developers of Geal/nom and graphql-rust/juniper reported that the
lint was seemingly erroneously triggering on certain complex macros in
those projects. While this doesn't seem like a bug in the lint in the
particular strict sense that the expanded code would, in fact, contain
unncecessary parentheses, it also doesn't seem like the sort of thing
macro authors should have to think about: the spirit of the
unused-parens lint is to prevent needless clutter in code, not to give
macro authors extra heartache in the handling of token trees.

We propose the expediency of declining to lint unused parentheses in
function or method args inside of nested expansions: we believe that
this should eliminate the petty, troublesome lint warnings reported
in the issue, without forgoing the benefits of the lint in simpler
macros.

It seemed like too much duplicated code for the `Call` and `MethodCall`
match arms to duplicate the nested-macro check in addition to each
having their own `for` loop, so this occasioned a slight refactor so
that the function and method cases could share code—hopefully the
overall intent is at least no less clear to the gentle reader.

This is concerning #47775.
2018-01-30 17:47:19 -08:00
varkor
c73925452c Fix ICE when reading non-UTF-8 input from stdin
Fixes #22387.
2018-01-31 00:59:20 +00:00
Daan Sprenkels
f641ac6ecb Add regression test for #44415 2018-01-31 00:23:54 +01:00
Diggory Blake
0e6601f630 Add wasm_syscall feature to build system 2018-01-30 23:22:23 +00:00
Diggory Blake
36695a37c5 Implement extensible syscall interface for wasm 2018-01-30 23:22:19 +00:00
Eduard-Mihai Burtescu
973756d715 rustc_trans: keep LLVM types for trait objects anonymous. 2018-01-31 00:23:25 +02:00
Jonathan Goodman
a99b5db56a stabilize match_beginning_vert 2018-01-30 16:00:55 -06:00
Vadzim Dambrouski
1e380cbfdd [MSP430] Don't enable trap_unreachable option by default on msp.
Since MSP430 doesn't meaningfully support faulting on illegal
instructions, LLVM generates a call to abort() function instead
of a trap instruction. Such calls are 4 bytes long, and that is
too much overhead for such small target.
2018-01-31 00:57:30 +03:00
Alex Crichton
a2cc5d68a7 rustc: Add an option to default hidden visibility
This commit adds a new option to target specifictions to specify that symbols
should be "hidden" visibility by default in LLVM. While there are no existing
targets that take advantage of this the `wasm32-unknown-unknown` target will
soon start to use this visibility. The LLD linker currently interprets `hidden`
as "don't export this from the wasm module" which is what we want for 90% of our
functions. While the LLD linker does have a "export this symbol" argument which
is what we use for other linkers, it was also somewhat easier to do this change
instead which'll involve less arguments flying around. Additionally there's no
need for non-`hidden` visibility for most of our symbols!

This change should not immediately impact the wasm targets as-is, but rather
this is laying the foundations for soon integrating LLD as a linker for wasm
code.
2018-01-30 13:41:20 -08:00
Alex Crichton
d492fe0a00 rustc: Add some defines for LLVM 7 compat
I was testing out the tip support to see what's going on with wasm, and this was
I believe the only issue encountered with LLVM 7 support so far.
2018-01-30 12:11:31 -08:00
Niko Matsakis
2fc573945a track intercrate ambiguity only when there is a coherence error 2018-01-30 14:00:25 -05:00
Niko Matsakis
514ae7d917 change overlapping_impls to take a tcx and create the infcx 2018-01-30 14:00:24 -05:00
Niko Matsakis
4c210afb19 make overlapping_impls call closures instead of returning 2018-01-30 13:43:41 -05:00
Josh Stone
eaebfd4420 Ignore run-pass/sse2 when using system LLVM
This is a test of `target_feature`, which needs a rust-specific patch to
LLVM to add `MCSubtargetInfo::getFeatureTable()`.
2018-01-30 10:18:54 -08:00
Guillaume Gomez
f6a6d84031 Update associated constants error message 2018-01-30 18:42:18 +01:00
Santiago Pastorino
b9f756416a Do not ignore lifetime bounds in Copy impls
Closes #29149
2018-01-30 14:00:27 -03:00
Manish Goregaokar
ef4f4864f1 Use dest,src ordering for make_clone_call 2018-01-30 21:09:19 +05:30
Manish Goregaokar
48a7a1f5e9 Document the index used in AggregateKind::Adt 2018-01-30 21:09:18 +05:30
Manish Goregaokar
c6140970f5 Remove AggregateKind argument from tuple_like_shim 2018-01-30 21:09:18 +05:30
Manish Goregaokar
7fd3c27345 Write directly to the RETURN_PLACE in tuple_like_shim 2018-01-30 21:09:18 +05:30
Manish Goregaokar
e07aecde48 Make make_clone_call take a Place argument 2018-01-30 21:09:18 +05:30
penpalperson
deba3890c5 Changed back inline markings. 2018-01-30 05:31:38 -07:00