Commit Graph

66283 Commits

Author SHA1 Message Date
Alex Crichton
b121689c6a Flag docker invocations as --privileged on CI
When upgrading to LLVM 5.0 it was found that the leak sanitizer tests were
failing with fatal errors, but they were passing locally when run. Turns out it
looks like they may be using new ptrace-like syscalls so the docker container
now needs `--privileged` when executing to complete the test.
2017-07-29 13:44:28 -07:00
Alex Crichton
ad1f19479c rustbuild: Enable building LLVM
I use this from time to time debugging LLVM builds, useful to have!
2017-07-29 13:39:43 -07:00
bors
cfe1668ca3 Auto merge of #43541 - gaurikholkar:lifetime_errors, r=nikomatsakis
Changing E0623 error message - both anonymous lifetime regions

Changing the error message to
```
error[E0623]: lifetime mismatch
  --> $DIR/ex3-both-anon-regions.rs:12:12
   |
11 | fn foo(x: &mut Vec<&u8>, y: &u8) {
   |                    ---      --- these references are not declared with the same lifetime...
12 |     x.push(y);
   |            ^ ...but data from `y` flows into `x` here

error: aborting due to previous error
```
cc @nikomatsakis @aturon @jonathandturner

r? @nikomatsakis
2017-07-29 19:41:53 +00:00
Alex Crichton
54b6b23fc0 std: Mark Layout::repeat as #[inline]
This fixes an optimization regression by allowing LLVM to see through more
functions.

Closes #43272
2017-07-29 09:03:06 -07:00
Jeremy Soller
a30092fbf6 Split FL and FD fcntls 2017-07-29 09:31:18 -06:00
Ian Douglas Scott
c83f97533a Redox: Add JoinHandleExt (matching Unix version) 2017-07-29 09:31:18 -06:00
Vadim Petrochenkov
80cf3f99f4 Cleanup some remains of hr_lifetime_in_assoc_type compatibility lint 2017-07-29 17:50:42 +03:00
QuietMisdreavus
612081a78d print associated types in traits "implementors" section 2017-07-29 09:21:48 -05:00
Guillaume Gomez
5636d325ed Update cargo version 2017-07-29 15:11:31 +02:00
bors
ad36f8feba Auto merge of #43534 - alexcrichton:cargo-target-runner, r=Mark-Simulacrum
rustbuild: Use Cargo's "target runner"

This commit leverages a relatively new feature in Cargo to execute
cross-compiled tests, the `target.$target.runner` configuration. We configure it
through environment variables in rustbuild and this avoids the need for us to
locate and run tests after-the-fact, instead relying on Cargo to do all that
execution for us.
2017-07-29 12:30:12 +00:00
gaurikholkar
cb93cc6299 changing E0623 error message 2017-07-29 17:40:16 +05:30
bors
91aff5775d Auto merge of #43530 - alexcrichton:update-freebsd-compilers, r=Mark-Simulacrum,cuviper
rustbuild: Update cross-compilers for FreeBSD

When working through bugs for the LLVM 5.0 upgrade it looks like the FreeBSD
cross compilers we're currently using are unable to build LLVM, failing with
references to the function `std::to_string` claiming it doesn't exist. I don't
actually know what this function is, but assuming that it was added in a more
recent version of a C++ standard I've updated the gcc versions for the
toolchains we're using. This made the error go away!
2017-07-29 08:48:57 +00:00
bors
8d0ad26b95 Auto merge of #43527 - alexcrichton:different-llvm-cross, r=Mark-Simulacrum
rustbuild: Tweak how we cross-compile LLVM

In preparation for upgrading to LLVM 5.0 it looks like we need to tweak how we
cross compile LLVM slightly. It's using `CMAKE_SYSTEM_NAME` to infer whether to
build libFuzzer which only works on some platforms, and then once we configure
that it needs to apparently reach into the host build area to try to compile
`llvm-config` as well. Once these are both configured, though, it looks like we
can successfully cross-compile LLVM.
2017-07-29 06:13:55 +00:00
bors
6dd8744a11 Auto merge of #43492 - lu-zero:master, r=alexcrichton
More Altivec Intrinsics
2017-07-29 03:58:18 +00:00
bors
42a09c01f0 Auto merge of #43518 - cuviper:aapcs_vfp, r=eddyb
Support homogeneous aggregates for hard-float ARM

Hard-float ARM targets use the AAPCS-VFP ABI, which passes and returns
homogeneous float/vector aggregates in the VFP registers.

Fixes #43329.

r? @eddyb
2017-07-29 01:43:03 +00:00
Alex Crichton
8e7849e766 rustbuild: Use Cargo's "target runner"
This commit leverages a relatively new feature in Cargo to execute
cross-compiled tests, the `target.$target.runner` configuration. We configure it
through environment variables in rustbuild and this avoids the need for us to
locate and run tests after-the-fact, instead relying on Cargo to do all that
execution for us.
2017-07-28 18:00:31 -07:00
Alex Crichton
122fd188ae rustbuild: Update cross-compilers for FreeBSD
When working through bugs for the LLVM 5.0 upgrade it looks like the FreeBSD
cross compilers we're currently using are unable to build LLVM, failing with
references to the function `std::to_string` claiming it doesn't exist. I don't
actually know what this function is, but assuming that it was added in a more
recent version of a C++ standard I've updated the gcc versions for the
toolchains we're using. This made the error go away!
2017-07-28 14:26:27 -07:00
Alex Crichton
069a1b3c8f rustbuild: Tweak how we cross-compile LLVM
In preparation for upgrading to LLVM 5.0 it looks like we need to tweak how we
cross compile LLVM slightly. It's using `CMAKE_SYSTEM_NAME` to infer whether to
build libFuzzer which only works on some platforms, and then once we configure
that it needs to apparently reach into the host build area to try to compile
`llvm-config` as well. Once these are both configured, though, it looks like we
can successfully cross-compile LLVM.
2017-07-28 12:20:47 -07:00
bors
126321e2e5 Auto merge of #43230 - alexcrichton:more-tokenstream, r=nrc,jseyfried
Implement tokenization for some items in proc_macro

This PR is a partial implementation of https://github.com/rust-lang/rust/issues/43081 targeted towards preserving span information in attribute-like procedural macros. Currently all attribute-like macros will lose span information with the input token stream if it's iterated over due to the inability of the compiler to losslessly tokenize an AST node. This PR takes a strategy of saving off a list of tokens in particular AST nodes to return a lossless tokenized version. There's a few limitations with this PR, however, so the old fallback remains in place.
2017-07-28 18:31:52 +00:00
Alex Crichton
4886ec8665 syntax: Capture a TokenStream when parsing items
This is then later used by `proc_macro` to generate a new
`proc_macro::TokenTree` which preserves span information. Unfortunately this
isn't a bullet-proof approach as it doesn't handle the case when there's still
other attributes on the item, especially inner attributes.

Despite this the intention here is to solve the primary use case for procedural
attributes, attached to functions as outer attributes, likely bare. In this
situation we should be able to now yield a lossless stream of tokens to preserve
span information.
2017-07-28 10:47:01 -07:00
bors
eba9d7f08c Auto merge of #43298 - gaurikholkar:lifetime_errors, r=estebank
improve case with both anonymous lifetime parameters #43269

This is a fix to #43269.

Sample output message-

```

error[E0623]: lifetime mismatch
  --> $DIR/ex3-both-anon-regions.rs:12:12
   |
11 | fn foo(x: &mut Vec<&u8>, y: &u8) {
   |                    ---      --- these references must have the same lifetime
12 |     x.push(y);
   |            ^ data from `y` flows into `x` here

error: aborting due to 2 previous errors

```
r? @nikomatsakis
2017-07-28 16:03:32 +00:00
topecongiro
6375b77ebb Add Span to ast::WhereClause 2017-07-29 00:43:35 +09:00
Alex Crichton
036300aadd Add a failing test for errors in proc macros
This test currently fails because the tokenization of an AST item during the
expansion of a procedural macro attribute rounds-trips through strings, losing
span information.
2017-07-28 07:58:20 -07:00
Alex Crichton
36f2816a1e proc_macro: Use an item's tokens if available
This partly resolves the `FIXME` located in `src/libproc_macro/lib.rs` when
interpreting interpolated tokens. All instances of `ast::Item` which have a list
of tokens attached to them now use that list of tokens to losslessly get
converted into a `TokenTree` instead of going through stringification and losing
span information.

cc #43081
2017-07-28 07:58:20 -07:00
Alex Crichton
9b2f7624ec syntax: Add tokens: Option<TokenStream> to Item
This commit adds a new field to the `Item` AST node in libsyntax to optionally
contain the original token stream that the item itself was parsed from. This is
currently `None` everywhere but is intended for use later with procedural
macros.
2017-07-28 07:58:20 -07:00
Luca Barbato
c4710203c0 Make LLVMRustHasFeature more robust
The function should accept feature strings that old LLVM might not
support.

Simplify the code using the same approach used by
LLVMRustPrintTargetFeatures.

Dummify the function for non 4.0 LLVM and update the tests accordingly.
2017-07-28 14:30:06 +00:00
bors
e2b5d7e6b3 Auto merge of #43324 - Nashenas88:visit_locations, r=arielb1
Provide positional information when visiting ty, substs and closure_substs in MIR

This will enable the region renumbering portion of #43234 (non-lexical lifetimes). @nikomatsakis's current plan [here](https://gist.github.com/nikomatsakis/dfc27b28cd024eb25054b52bb11082f2) shows that we need spans of the original code to create new region variables, e.g. `self.infcx.next_region_var(infer::MiscVariable(span))`. The current visitor impls did not pass positional information (`Location` in some, `Span` and `SourceInfo` for others) for all types. I did not expand this to all visits, just the ones necessary for the above-mentioned plan.
2017-07-28 12:55:12 +00:00
bors
6f815ca771 Auto merge of #43221 - MaulingMonkey:natvis-improvements, r=michaelwoerister
Embed MSVC .natvis files into .pdbs and mangle debuginfo for &str, *T, and [T].

No idea if these changes are reasonable - please feel free to suggest changes/rewrites.  And these are some of my first real commits to any rust codebase - *don't* be gentle, and nitpick away, I need to learn! ;)

### Overview
Embedding `.natvis` files into `.pdb`s allows MSVC (and potentially other debuggers) to automatically pick up the visualizers without having to do any additional configuration (other than to perhaps add the relevant .pdb paths to symbol search paths.)

The native debug engine for MSVC parses the type names, making various C++ish assumptions about what they mean and adding various limitations to valid type names.  `&str` cannot be matched against a visualizer, but if we emit `str&` instead, it'll be recognized as a reference to a `str`, solving the problem.  `[T]` is similarly problematic, but emitting `slice<T>` instead works fine as it looks like a template.  I've been unable to get e.g. `slice<u32>&` to match visualizers in VS2015u3, so I've gone with `str*` and `slice<u32>*` instead.

### Possible Issues
* I'm not sure if `slice<T>` is a great mangling for `[T]` or if I should worry about name collisions.
* I'm not sure if `linker.rs` is the right place to be enumerating natvis files.
* I'm not sure if these type name mangling changes should actually be MSVC specific.  I recall seeing gdb visualizer tests that might be broken if made more general?  I'm hesitant to mess with them without a gdb install.  But perhaps I'm just wracking up technical debt.
  Should I try `pacman -S mingw-w64-x86_64-gdb` and to make things consistent?
* I haven't touched `const` / `mut` yet, and I'm worried MSVC might trip up on `mut` or their placement.
* I may like terse oneliners too much.
* I don't know if there's broader implications for messing with debug type names here.
* I may have been mistaken about bellow test failures being ignorable / unrelated to this changelist.

### Test Failures on `x86_64-pc-windows-gnu`

```
---- [debuginfo-gdb] debuginfo-gdb\associated-types.rs stdout ----
        thread '[debuginfo-gdb] debuginfo-gdb\associated-types.rs' panicked at 'gdb not available but debuginfo gdb debuginfo test requested', src\tools\compiletest\src\runtest.rs:48:16
note: Run with `RUST_BACKTRACE=1` for a backtrace.

[...identical panic causes omitted...]

---- [debuginfo-gdb] debuginfo-gdb\vec.rs stdout ----
        thread '[debuginfo-gdb] debuginfo-gdb\vec.rs' panicked at 'gdb not available but debuginfo gdb debuginfo test requested', src\tools\compiletest\src\runtest.rs:48:16
```

### Relevant Issues
* https://github.com/rust-lang/rust/issues/40460 Metaissue for Visual Studio debugging Rust
* https://github.com/rust-lang/rust/issues/36503 Investigate natvis for improved msvc debugging
* https://github.com/PistonDevelopers/VisualRust/issues/160 Debug visualization of Rust data structures

### Pretty Pictures
![Collapsed Watch Window](https://user-images.githubusercontent.com/75894/28180998-e44c7516-67bb-11e7-8b48-d4f9605973ae.png)
![Expanded Watch Window](https://user-images.githubusercontent.com/75894/28181000-e8da252e-67bb-11e7-96b8-d613310c04dc.png)
2017-07-28 10:25:58 +00:00
bors
7167843748 Auto merge of #43505 - eddyb:poly-const-eval-layout-of, r=nikomatsakis
rustc_const_eval: always require Substs and a ParamEnv.

Fixes #43357 by tracking the `Substs` and `ParamEnv` for const-evaluation in generic contexts.
2017-07-28 08:01:02 +00:00
bors
4d5150ce19 Auto merge of #43238 - estebank:try-on-unimplemented-2, r=alexcrichton
Use `rustc_on_unimplemented`'s trait name argument in `try`

Follow up to #43000 and #43001. Fix #42694.
2017-07-28 05:39:41 +00:00
Nick Cameron
bbc00c9e9c format!: use a dummy span rather than callee span for the span base for temporary variables 2017-07-28 16:42:39 +12:00
Nick Cameron
e1206c4b67 save-anlaysis: fix filter_generated 2017-07-28 16:42:17 +12:00
Josh Stone
efc67646fa Support homogeneous aggregates for hard-float ARM
Hard-float ARM targets use the AACPS-VFP ABI, which passes and returns
homogeneous float/vector aggregates in the VFP registers.

Fixes #43329.
2017-07-27 20:40:24 -07:00
gaurikholkar
4fb1808ab6 Adding E0623, to detect missing lifetimes when both regions are anonymous 2017-07-28 08:51:58 +05:30
bors
a9a07078ba Auto merge of #43432 - pczarn:macro-parser-description, r=jseyfried
Make the macro parser theory description more accurate

The macro parser is described as an NFA, not an Earley parser.
2017-07-28 03:16:14 +00:00
Esteban Küber
4f7834e32c Use rustc_on_unimplemented's trait name argument in try 2017-07-27 19:18:22 -07:00
bors
63b3a03dc8 Auto merge of #43217 - pnkfelix:alloc-requires-align-it-in-u32, r=alexcrichton
Add precondition to `Layout` that the `align` fit in a u32.

Add precondition to `Layout` that the `align` not exceed 2^31.

This precondition takes the form of a behavorial change in `Layout::from_size_align` (so it returns `None` if the input `align` is too large) and a new requirement for safe usage of `Layout::from_size_align_unchecked`.

Fix #30170.
2017-07-28 00:49:39 +00:00
Paul Faria
4b9acad7c6 Squash Span into SourceInfo and rename enum and its inner types 2017-07-27 19:43:05 -04:00
bors
8a78a12a55 Auto merge of #43438 - petrochenkov:path, r=jseyfried
syntax: Simplify parsing of paths

Discern between `Path` and `Path<>` in AST (but not in HIR).
Give span to angle bracketed generic arguments (`::<'a, T>` in `path::segment::<'a, T>`).

This is a refactoring in preparation for https://internals.rust-lang.org/t/macro-path-uses-novel-syntax/5561/3, but it doesn't add anything to the grammar yet.

r? @jseyfried
2017-07-27 22:22:01 +00:00
Luca Barbato
cbce0aa341 Add support for Vector Minimum on PowerPC 2017-07-27 21:30:31 +00:00
Ariel Ben-Yehuda
e268ddf52d erase types in the move-path abstract domain
Leaving types unerased would lead to 2 types with a different "name"
getting different move-paths, which would cause major brokenness (see
e.g. #42903).

This does not fix any *known* issue, but is required if we want to use
abs_domain with non-erased regions (because the same can easily
have different names). cc @RalfJung.
2017-07-27 23:14:41 +03:00
Vadim Petrochenkov
1e8a7f68e9 Avoid duplicated errors for generic arguments in macro paths 2017-07-27 23:01:17 +03:00
Vadim Petrochenkov
128f565dae Give span to angle bracketed generic arguments 2017-07-27 22:59:35 +03:00
Vadim Petrochenkov
ce3beb609f Discern between Path and Path<> in AST 2017-07-27 22:59:35 +03:00
Vadim Petrochenkov
da77a1a0ac Simplify parsing of paths 2017-07-27 22:59:34 +03:00
bors
52a3309695 Auto merge of #43443 - bitshifter:issue-43317, r=nikomatsakis
Improve checking of conflicting packed and align representation hints on structs and unions.

Fixes #43317 and improves #33626.
2017-07-27 19:48:13 +00:00
Guillaume Gomez
2f2623b79d Update tests 2017-07-27 20:40:20 +02:00
Guillaume Gomez
1cebf98e4c Make a lint instead 2017-07-27 20:38:33 +02:00
Guillaume Gomez
b68a03bded Change doc comment to code comment 2017-07-27 20:38:32 +02:00
Guillaume Gomez
7e70a63e61 Throw errors when doc comments are added where they're unused 2017-07-27 20:38:32 +02:00