Commit Graph

67296 Commits

Author SHA1 Message Date
bors
0269acbb10 Auto merge of #43820 - sfackler:move-config-template, r=alexcrichton
Move config.toml.example to the root dir

It's way more discoverable here.

r? @alexcrichton
2017-08-12 16:48:31 +00:00
Guillaume Gomez
f0fb7ab0e7 Add missing link in fmt::format function 2017-08-12 16:54:12 +02:00
bors
045ca8b43b Auto merge of #43823 - tchajed:fix-pr-link, r=frewsxcv
Update GitHub pull request documentation link

It looks like the GitHub documentation has been re-organized so that the "fork and pull" model isn't explained alongside the PR process in one convenient link any more.
2017-08-12 14:24:40 +00:00
Bastien Orivel
3ab86fbab2 Fix some typos 2017-08-12 14:01:11 +02:00
bors
4564933538 Auto merge of #43746 - eddyb:sound-thread-local, r=alexcrichton
Check #[thread_local] statics correctly in the compiler.

Fixes #43733 by introducing `#[allow_internal_unsafe]` analogous to `#[allow_internal_unstable]`, for letting a macro expand to `unsafe` blocks and functions even in `#![forbid(unsafe_code)]` crates.

Fixes #17954 by not letting references to `#[thread_local]` statics escape the function they're taken in - we can't just use a magical lifetime because Rust has *lifetime parametrism*, so if we added the often-proposed `'thread` lifetime, we'd have no way to check it in generic code.
To avoid potential edge cases in the compiler, the lifetime is actually that of a temporary at the same position, i.e. `&TLS_STATIC` has the same lifetime `&non_const_fn()` would.

Referring to `#[thread_local]` `static`s at compile-time is banned now (as per PR discussion).

Additionally, to remove `unsafe impl Sync` from `std:🧵:local::fast::Key`, `#[thread_local]` statics are now not required to implement `Sync`, as they are not shared between threads.
2017-08-12 11:57:10 +00:00
kennytm
36ba8ee444
Fix -Z hir-stats always panics (fix #43232). 2017-08-12 19:53:15 +08:00
Tej Chajed
a746129bdb
Update GitHub pull request documentation link 2017-08-12 12:34:49 +01:00
Eduard-Mihai Burtescu
92892d3beb Check #[thread_local] statics correctly in the compiler. 2017-08-12 12:58:07 +03:00
bors
59f6b8338e Auto merge of #43812 - steveklabnik:rustdoc-doc-tests, r=QuietMisdreavus
rustdoc doc tests

This is mostly adapted from the book v1's chapter.

cc https://github.com/rust-lang/rust/issues/42322

r? @rust-lang/docs
2017-08-12 09:34:13 +00:00
topecongiro
64503b6ee7 Include 'let' keyword to the span for ast::Local 2017-08-12 18:00:57 +09:00
bjorn3
03584a2d8c Less cfg's 2017-08-12 10:54:36 +02:00
Alexey Tarasov
6a607faba4 Follow up commit for the issue 39827
- updates documentation on volatile memory intrinsics, now the case of
   zero-sized types is mentioned explicitly.

Volatile memory operations which doesn't affect memory at all are omitted
in LLVM backend, e.g. if number of elements is zero or type used in
generic specialisation is zero-sized, then LLVM intrinsic or related code
is not generated. This was not explicitly documented before in Rust
documentation and potentially could cause issues.
2017-08-12 18:51:10 +10:00
Alexey Tarasov
0cd358742d Fixes issue 39827: ICE in volatile_store intrinsic
- adds handling of zero-sized types for volatile_store.
- adds type size checks and warnigns for other volatile intrinsics.
- adds a test to check warnings emitting.

Cause of the issue

While preparing for trans_intrinsic_call() invoke arguments are
processed with trans_argument() method which excludes zero-sized types
from argument list (to be more correct - all arguments for which
ArgKind is Ignore are filtered out). As result volatile_store() intrinsic
gets one argument instead of expected address and value.

How it is fixed

Modification of the trans_argument() method may cause side effects,
therefore change was implemented in volatile_store() intrinsic building
code itself. Now it checks function signature and if it was specialised
with zero-sized type, then emits C_nil() instead of accessing
non-existing second argument.

Additionally warnings are added for all volatile operations which are
specialised with zero-sized arguments. In fact, those operations are omitted
in LLVM backend if no memory affected at all, e.g. number of elements
is zero or type is zero-sized. This was not explicitly documented before
and could lead to potential issues if developer expects volatile behaviour,
but type has degraded to zero-sized.
2017-08-12 18:42:44 +10:00
Eduard-Mihai Burtescu
8a4facc3c3 syntax: #[allow_internal_unsafe] bypasses the unsafe_code lint in macros. 2017-08-12 09:14:50 +03:00
bors
bffc973da8 Auto merge of #43794 - Eijebong:fix_typos, r=lukaramu,steveklanik,imperio
Fix some typos

I wrote a really naive script and found those typos in the documentation.
2017-08-12 05:52:19 +00:00
John Kåre Alsaker
1787d4ecf5 Fix errors 2017-08-12 07:37:17 +02:00
Steven Fackler
1126a85e87 Move config.toml.example to the root dir
It's way more discoverable here.
2017-08-11 22:24:25 -07:00
Thomas Levy
fb45233ed1 Handle DNS label compression in more places 2017-08-11 22:13:57 -07:00
John Kåre Alsaker
d020ff0c68 Merge branch 'master' of https://github.com/rust-lang/rust into gen
# Conflicts:
#	src/librustc_mir/build/scope.rs
2017-08-12 07:11:19 +02:00
Owen Sanchez
eeb748aa12 Don't trigger unused_result on functions returning empty enums 2017-08-11 22:07:28 -07:00
John Kåre Alsaker
fa18aa3520 Strip landing pads in the state transformation 2017-08-12 07:06:34 +02:00
Corey Farwell
8d0d2a5729 Add complete doc example for include_str!. 2017-08-12 00:31:56 -04:00
Corey Farwell
446ff0d529 Add complete doc example for include_bytes!. 2017-08-12 00:31:55 -04:00
Corey Farwell
ea6f0f060c Demonstrate include! with Rust code, not just a string slice literal. 2017-08-12 00:31:54 -04:00
kennytm
3093bb85f9
Fix error during cross-platform documentation. 2017-08-12 12:07:39 +08:00
bors
2fa5340318 Auto merge of #43792 - steveklabnik:rustdoc-directives, r=frewsxcv
Document the doc attribute

cc #42322
2017-08-12 03:22:09 +00:00
bors
b8266a90b9 Auto merge of #43772 - arielb1:nonfree-block, r=nagisa
For box expressions, use NZ drop instead of a free block

This falls naturally out of making drop elaboration work with `box`
expressions, which is probably required for sane MIR borrow-checking.
This is a pure refactoring with no intentional functional effects.

r? @nagisa
2017-08-12 00:54:38 +00:00
Alex Crichton
fae60b36cb std: Tag OOM functions as #[cold]
This was forgotten from #42727 by accident, but these functions are rarely
called and codegen can be improved in LLVM with the `#[cold]` tag.
2017-08-11 15:59:11 -07:00
Alex Crichton
a83d2afbba std: Tag AllocErr functions as #[inline]
None of these require a significant amount of code and using `#[inline]` will
allow constructors to get inlined, improving codegen at allocation callsites.
2017-08-11 15:58:26 -07:00
bors
8da3ff3fcc Auto merge of #43766 - michaelwoerister:trans-scheduler-touch-up, r=alexcrichton
Improve LLVM/trans scheduling a bit

Currently it's possible that the main thread is waiting on LLVM threads to finish work while its implicit token is going to waste. This PR let's the main thread take over, so one of the running LLVM threads can free its token earlier.

r? @alexcrichton
2017-08-11 22:23:10 +00:00
steveklabnik
035d4ea2ca rustdoc doc tests 2017-08-11 16:43:38 -04:00
Owen Sanchez
0b2c9f03ef Fix unused_result lint triggering when a function returns () or !
Add a test for this case
2017-08-11 13:43:33 -07:00
steveklabnik
1e4aaea431 address review feedback 2017-08-11 16:24:18 -04:00
Alex Crichton
84af3d8f3b Fix an error in diagnostic codes 2017-08-11 13:09:25 -07:00
bors
a7e0d3a81f Auto merge of #43750 - tbu-:pr_fn_unreachable, r=sfackler
Put `intrinsics::unreachable` on a possible path to stabilization

Mark it with the `unreachable` feature and put it into the `mem` module.
This is a pretty straight-forward API that can already be simulated in
stable Rust by using `transmute` to create an uninhabited enum that can
be matched.
2017-08-11 19:43:44 +00:00
Alex Crichton
3971a3d55c Merge remote-tracking branch 'origin/master' into gen 2017-08-11 09:55:13 -07:00
Alex Crichton
2b04afba63 Fix xcrate generator test 2017-08-11 09:54:28 -07:00
bors
edd82ee9f0 Auto merge of #42932 - bjorn3:no_llvm_try2, r=eddyb
Support compiling rustc without LLVM (try 2)

Now doesn't change rustc_driver.

Supersedes #42752
2017-08-11 15:45:10 +00:00
bors
38bdbb7cf9 Auto merge of #43748 - RalfJung:mir-validate2, r=arielb1
AddValidation: handle Call terminators into blocks that have multiple incoming edges

The old code was just wrong: It would add validation on paths that don't even come from the call, and it would add multiple validations if multiple calls end return to the same block.
2017-08-11 13:04:59 +00:00
bjorn3
e5399961c6
Remove some unused dependencies from rustc_trans_utils 2017-08-11 14:00:09 +02:00
bjorn3
b8d5c74c99
It now completely compiles without LLVM!!! 2017-08-11 14:00:07 +02:00
bjorn3
b7314c7caf
Actually make rustc_driver compile without llvm 2017-08-11 14:00:05 +02:00
Guillaume Gomez
e5938ef3c4 Add (a lot of) missing links in fmt module docs 2017-08-11 13:43:31 +02:00
Michael Woerister
a69eaf62c5 Improve validation of TypeckTables keys. 2017-08-11 12:17:07 +02:00
Michael Woerister
1f54df1101 Encapsulate sub-table access in TypeckTables and validate keys on each access. 2017-08-11 12:17:07 +02:00
Michael Woerister
bdfd78db8a Improve documentation for TypeckTables::validate_hir_id(). 2017-08-11 12:11:38 +02:00
Michael Woerister
4dcc3a4aae Use DefIndex instead of NodeId in UpvarId. 2017-08-11 12:11:38 +02:00
Michael Woerister
a8cf6cc6db Add some ID conversion methods to HIR map and Definitions. 2017-08-11 12:11:38 +02:00
Michael Woerister
fbc7398bad Use ItemLocalId as key for TypeckTables::cast_kinds. 2017-08-11 12:11:38 +02:00
Michael Woerister
801dd07a95 Use ItemLocalId as key for TypeckTables::fru_field_types. 2017-08-11 12:11:38 +02:00