Commit Graph

84920 Commits

Author SHA1 Message Date
David Wood
2ecce7ccc5
Extend lang items to assert correct target.
This commit extends the existing lang items functionality to assert
that the `#[lang_item]` attribute is only found on the appropriate item
for any given lang item. That is, language items representing traits
must only ever have their corresponding attribute placed on a trait, for
example.
2018-10-11 19:36:51 +02:00
Alex Crichton
cbe9f33b8b std: Implement TLS for wasm32-unknown-unknown
This adds an implementation of thread local storage for the
`wasm32-unknown-unknown` target when the `atomics` feature is
implemented. This, however, comes with a notable caveat of that it
requires a new feature of the standard library, `wasm-bindgen-threads`,
to be enabled.

Thread local storage for wasm (when `atomics` are enabled and there's
actually more than one thread) is powered by the assumption that an
external entity can fill in some information for us. It's not currently
clear who will fill in this information nor whose responsibility it
should be long-term. In the meantime there's a strategy being gamed out
in the `wasm-bindgen` project specifically, and the hope is that we can
continue to test and iterate on the standard library without committing
to a particular strategy yet.

As to the details of `wasm-bindgen`'s strategy, LLVM doesn't currently
have the ability to emit custom `global` values (thread locals in a
`WebAssembly.Module`) so we leverage the `wasm-bindgen` CLI tool to do
it for us. To that end we have a few intrinsics, assuming two global values:

* `__wbindgen_current_id` - gets the current thread id as a 32-bit
  integer. It's `wasm-bindgen`'s responsibility to initialize this
  per-thread and then inform libstd of the id. Currently `wasm-bindgen`
  performs this initialization as part of the `start` function.
* `__wbindgen_tcb_{get,set}` - in addition to a thread id it's assumed
  that there's a global available for simply storing a pointer's worth
  of information (a thread control block, which currently only contains
  thread local storage). This would ideally be a native `global`
  injected by LLVM, but we don't have a great way to support that right
  now.

To reiterate, this is all intended to be unstable and purely intended
for testing out Rust on the web with threads. The story is very likely
to change in the future and we want to make sure that we're able to do
that!
2018-10-11 09:57:55 -07:00
Philip Munksgaard
1de8f51849 Include rustdoc tests that have been fixed by #33133
There was an issue (#33025) which caused these tests to not work. The issue has
since been fixed in #33133, and so we can now include them.
2018-10-11 18:25:55 +02:00
Philip Munksgaard
6c7eb1406d Fix spelling in the documentation to htmldocck.py 2018-10-11 14:37:56 +02:00
bors
b8b4150c04 Auto merge of #54911 - ljedrz:cleanup_codegen_llvm_top, r=michaelwoerister
Cleanup top-level codegen_llvm

- improve allocations
- improve common patterns
- remove explicit returns
- fix spelling & grammatical errors
- whitespace & formatting improvements
2018-10-11 11:57:06 +00:00
Ralf Jung
99db3e9bce impl Eq+Hash for TyLayout 2018-10-11 12:51:53 +02:00
bors
a534216fa6 Auto merge of #54850 - mcr431:fix-54707-trait-function-from-macro, r=nikomatsakis
Fix #54707 - parse_trait_item_ now handles interpolated blocks as function body decls

Fix #54707 - parse_trait_item_ now handles interpolated blocks as function body decls

Previously parsing trait items only handled opening brace token and semicolon, I added a branch to the match statement that will also handle interpolated blocks.
2018-10-11 09:19:23 +00:00
bors
cb6eeddd4d Auto merge of #54969 - Manishearth:rollup, r=Manishearth
Rollup of 9 pull requests

Successful merges:

 - #54747 (codegen_llvm: verify that inline assembly operands are scalars)
 - #54848 (Better Diagnostic for Trait Object Capture)
 - #54850 (Fix #54707 - parse_trait_item_ now handles interpolated blocks as function body decls)
 - #54858 (second round of refactorings for universes)
 - #54862 (Implement RFC 2539: cfg_attr with multiple attributes)
 - #54869 (Fix mobile docs)
 - #54870 (Stabilize tool lints)
 - #54893 (Fix internal compiler error on malformed match arm pattern.)
 - #54904 (Stabilize the `Option::replace` method)

Failed merges:

 - #54909 ( Add chalk rules related to associated type defs)

r? @ghost
2018-10-11 06:26:03 +00:00
Kazuyoshi Kato
f930087159 Fix slice's benchmarks
Fixes #54013.
2018-10-10 22:55:12 -07:00
bors
9746a2d40d Auto merge of #54848 - davidtwco:issue-52663-trait-object, r=nikomatsakis
Better Diagnostic for Trait Object Capture

Part of #52663.

This commit enhances `LaterUseKind` detection to identify when a borrow
is captured by a trait object which helps explain why there is a borrow
error.

r? @nikomatsakis
cc @pnkfelix
2018-10-11 03:32:12 +00:00
Esteban Küber
ed10a3faae Custom E0277 diagnostic for Path 2018-10-10 17:30:10 -07:00
Manish Goregaokar
be64bf3b9d Rollup merge of #54909 - scalexm:finish-rules, r=nikomatsakis
Fixes #47311.
r? @nrc
2018-10-10 15:59:25 -07:00
Manish Goregaokar
ff3e4d9f1c Rollup merge of #54904 - Kerollmops:stabilize-option-replace, r=Centril
Fixes #47311.
r? @nrc
2018-10-10 15:59:23 -07:00
Manish Goregaokar
e1e628ec87 Rollup merge of #54893 - dsciarra:issue-54379, r=pnkfelix
Fixes #47311.
r? @nrc
2018-10-10 15:59:21 -07:00
Manish Goregaokar
50e410c240 Rollup merge of #54870 - flip1995:stabilize_tool_lints, r=Manishearth
Fixes #47311.
r? @nrc
2018-10-10 15:59:20 -07:00
Manish Goregaokar
8ebc6d6dbb Rollup merge of #54862 - Havvy:cfg_attr_multi, r=petrochenkov
Fixes #47311.
r? @nrc
2018-10-10 15:58:40 -07:00
Manish Goregaokar
a267b3a9ff Rollup merge of #54848 - davidtwco:issue-52663-trait-object, r=nikomatsakis
Fixes #47311.
r? @nrc
2018-10-10 15:58:38 -07:00
bors
f42c510f2f Auto merge of #54747 - levex:inline-asm-bad-operands, r=nagisa
codegen_llvm: verify that inline assembly operands are scalars

Another set of inline assembly fixes. This time let's emit an error message when the operand value cannot be coerced into the operand constraint.

Two questions:

1) Should I reuse `E0668` which was introduced in #54568 or just use `E0669` as it stands because they do mean different things, but maybe that's not too user-friendly. Just a thought.
2) The `try_fold` returns the operand which failed to be converted into a scalar value, any suggestions on how to use that in the error message?

Thanks!
2018-10-10 22:24:48 +00:00
bors
5af0bb8304 Auto merge of #54732 - cramertj:waker, r=aturon
LocalWaker and Waker cleanups

r? @aturon
2018-10-10 18:28:30 +00:00
holmgr
05bb22d9e8 Remove incorrect span for second label inner macro invocation 2018-10-10 19:39:16 +02:00
Matthew Jasper
c312e04d45 Check user types are well-formed in MIR borrow check
Also update some tests so that they don't have user types on `_` in
unreachable code.
2018-10-10 16:23:59 +01:00
bors
e1041c6cd1 Auto merge of #54802 - davidtwco:issue-53040, r=pnkfelix
[nll] better error message when returning refs to upvars

Fixes #53040.

r? @nikomatsakis
2018-10-10 14:51:01 +00:00
Tom Tromey
ac66b04ccb Run both lldb and gdb tests
Currently lldb tests are run only on macOS, and gdb tests are only run
elsewhere.  This patch changes this to run tests depending on what is
available.

One test is changed, as it was previously marked as failing on macOS,
whereas really it is a generic failure with lldb.

Closes #54721
2018-10-10 08:27:01 -06:00
bors
2243fabd8f Auto merge of #54461 - RalfJung:pointer-provenance, r=oli-obk
miri engine: basic support for pointer provenance tracking

This enriches pointers with a new member, `tag`, that can be used to do provenance tracking. This is a new type parameter that propagates up through everything. It defaults to `()` (no tag), which is also the value used by CTFE -- but miri will use another type.

The only actually interesting piece here, I think, is what I had to do in the memory's `get`. The problem is that `tcx` (storing the allocations for statics) uses `()` for provenance information. But the machine might need another tag. The machine has a function to do the conversion, but if a conversion actually happened, we need to store the result of this *somewhere* -- we cannot return a pointer into `tcx` as we usually would.
So I introduced `MonoHashMap` which uses `RefCell` to be able to insert new entries even when we just have a shared ref. However, it is important that we can also return shared refs into the map without holding the `RefCell` opan. This is achieved by boxing the values stored in the map, so their addresses remain stable even when the map's table gets reallocated. This is all implemented in `mono_hash_map.rs`.

NOTE: This PR also contains the commits from https://github.com/rust-lang/rust/pull/54380#issuecomment-423130753. Only the [last two commits](8e74ee0998..HEAD) are new.
2018-10-10 12:13:03 +00:00
Matthew Jasper
55ec104313 Use the span of the user type for AscribeUserType
Also change the order of the fake read for let and the AscribeUserType,
so that we use the better span and message from the fake read in errors.
2018-10-10 11:56:16 +01:00
Ralf Jung
bc9435d239 tidy up 2018-10-10 11:31:31 +02:00
Ralf Jung
a332387b87 add a macro for static assertions 2018-10-10 11:03:58 +02:00
ljedrz
a01a994231 A handful of random string-related improvements 2018-10-10 10:39:18 +02:00
Ralf Jung
9a9dbfff6e vtables are not leaks 2018-10-10 10:11:35 +02:00
Ralf Jung
3fb617d0c5 more comments for these sublte games we are playing with allocations in the miri engine 2018-10-10 10:11:35 +02:00
Kazuyoshi Kato
da17e07c14 "(using ..." doesn't have the matching ")"
Fixes #54948.
2018-10-10 01:09:18 -07:00
Ralf Jung
83667d64a2 abstract mono_hash_map through a trait, only miri actually needs the fancy one 2018-10-10 10:08:17 +02:00
Ralf Jung
75ea7c7fc2 typos and spaces 2018-10-10 09:58:17 +02:00
Ralf Jung
03545109f4 clarify alloc_map description 2018-10-10 09:58:17 +02:00
Ralf Jung
e0b17ad26c fix typos 2018-10-10 09:58:17 +02:00
Ralf Jung
d4b21f1ed3 expand safety comment in memory.rs 2018-10-10 09:58:17 +02:00
Ralf Jung
397283dbc3 rename extra -> meta in place 2018-10-10 09:58:17 +02:00
Ralf Jung
50c00a9301 expand comment 2018-10-10 09:51:16 +02:00
Ralf Jung
f3a39e38f6 tidy, oh tidy 2018-10-10 09:51:16 +02:00
Ralf Jung
4e9f9329e3 miri engine: basic support for pointer provenance tracking 2018-10-10 09:50:06 +02:00
Ralf Jung
e4434be6b7 remove a now outdated comment 2018-10-10 09:16:05 +02:00
bors
71d3a71572 Auto merge of #54831 - davidtwco:issue-52663-struct-field-suggestion, r=nikomatsakis
NLL is missing struct field suggestion

Part of #52663.

This commit adds suggestions to change the definitions of fields in
struct definitions from immutable references to mutable references.

r? @nikomatsakis
cc @pnkfelix
2018-10-10 06:36:11 +00:00
Alex Crichton
c1f7e922e6 std: Synchronize global allocator on wasm32
We originally didn't have threads, and now we're starting to add them!
Make sure we properly synchronize access to dlmalloc when the `atomics`
feature is enabled for `wasm32-unknown-unknown`.
2018-10-09 23:35:45 -07:00
Kevin Leimkuhler
0e411c2597 Add clarifying pattern lint comment and revert test 2018-10-09 21:10:27 -07:00
Kevin Leimkuhler
47014df790 Fix Range warning and improve tests 2018-10-09 21:10:27 -07:00
Kevin Leimkuhler
46b07d670a Simply unused_parens check and add tests 2018-10-09 21:10:27 -07:00
Kevin Leimkuhler
5217527a5b Share outer paren trimming logic 2018-10-09 21:10:27 -07:00
Kevin Leimkuhler
8552c61c5a Add initial impl of check_pat() for UnusedParens
This uses a copied version of `check_unused_parens_expr` that is
specific to `ast::Pat`. `check_unused_parens_` could possibly be made
more generic to work with any `ast::*` that has `node` and `span`
fields.

This also only checks for the case of parens around the wildcard
pattern. It covers the case highlighted in the issue, but could check
for a lot more.
2018-10-09 21:10:27 -07:00
Esteban Küber
a0fd68b088 fix tidy 2018-10-09 20:19:57 -07:00
bors
4623d48893 Auto merge of #54764 - tromey:test-rust-lldb, r=alexcrichton
Run debuginfo tests against rust-enabled lldb, when possible

If the rust-enabled lldb was built, then use it when running the
debuginfo tests.  Updating the lldb submodule was necessary as this
needed a way to differentiate the rust-enabled lldb, so I added a line
to the --version output.

This adds compiletest commands to differentiate between the
rust-enabled and non-rust-enabled lldb, as is already done for gdb.  A
new "rust-lldb" header directive is also added, but not used in this
patch; I plan to use it in #54004.

This updates all the tests.
2018-10-10 02:08:23 +00:00