]> git.lizzy.rs Git - rust.git/log
rust.git
4 years ago[mir-opt] Turn on the `ConstProp` pass by default
Wesley Wiser [Mon, 28 Oct 2019 09:59:59 +0000 (05:59 -0400)]
[mir-opt] Turn on the `ConstProp` pass by default

perf.rlo shows that running the `ConstProp` pass results in
across-the-board wins regardless of debug or opt complilation mode. As a
result, we're turning it on to get the compile time benefits.

`ConstProp` doesn't currently intern the memory used by its `Machine` so
we can't yet propagate allocations which is why
`ConstProp::should_const_prop()` checks if the value being propagated is
a scalar or not.

4 years agoAuto merge of #65933 - crgl:vec-deque-truncate, r=alexcrichton
bors [Mon, 11 Nov 2019 19:20:54 +0000 (19:20 +0000)]
Auto merge of #65933 - crgl:vec-deque-truncate, r=alexcrichton

Use ptr::drop_in_place for VecDeque::truncate and VecDeque::clear

This commit allows `VecDeque::truncate` to take advantage of its (largely) contiguous memory layout and is consistent with the change in #64432 for `Vec`. As with the change to `Vec::truncate`, this changes both:

- the drop order, from back-to-front to front-to-back
- the behavior when dropping an element panics

For consistency, it also changes the behavior when dropping an element panics for `VecDeque::clear`.

These changes in behavior can be observed. This example ([playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=d0b1f2edc123437a2f704cbe8d93d828))
```rust
use std::collections::VecDeque;

fn main() {
    struct Bomb(usize);
    impl Drop for Bomb {
        fn drop(&mut self) {
            panic!(format!("{}", self.0));
        }
    }
    let mut v = VecDeque::from(vec![Bomb(0), Bomb(1)]);
    std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
        v.truncate(0);
    }));
    std::mem::forget(v);
}
```
panics printing `1` today and succeeds. `v.clear()` panics printing `0` today and succeeds. With the change, `v.clear()`, `v.truncate(0)`, and dropping the `VecDeque` all panic printing `0` first and then abort with a double-panic printing `1`.

The motivation for this was making `VecDeque::truncate` more efficient since it was used in the implementation of `VecDeque::clone_from` (#65069), but it also makes behavior more consistent within the `VecDeque` and with `Vec` if that change is accepted (this probably doesn't make sense to merge if not).

This might need a crater run and an FCP as well.

4 years agoAuto merge of #66252 - cjgillot:trees, r=oli-obk
bors [Mon, 11 Nov 2019 14:05:43 +0000 (14:05 +0000)]
Auto merge of #66252 - cjgillot:trees, r=oli-obk

Merge repeated definitions

Step forward on #66149

I may need further context to understand the need for a separate crate.

Also, please tell me if you think of other definitions to merge.

4 years agoAuto merge of #66213 - tmiasko:mandatory-error-warn, r=petrochenkov
bors [Mon, 11 Nov 2019 09:40:33 +0000 (09:40 +0000)]
Auto merge of #66213 - tmiasko:mandatory-error-warn, r=petrochenkov

Make error and warning annotations mandatory in UI tests

This change makes error and warning annotations mandatory in UI tests.
The only exception are tests that use error patterns to match compiler
output and don't have any annotations.

Fixes #55596.

4 years agoAuto merge of #66207 - Manishearth:clippyup, r=Centril
bors [Mon, 11 Nov 2019 06:29:15 +0000 (06:29 +0000)]
Auto merge of #66207 - Manishearth:clippyup, r=Centril

Update clippy

Fixes #66150

r? @ghost

4 years agoUpdate clippy
Manish Goregaokar [Fri, 8 Nov 2019 03:15:13 +0000 (19:15 -0800)]
Update clippy

4 years agoAuto merge of #66250 - oli-obk:no_fields_in_empty_unions, r=eddyb
bors [Mon, 11 Nov 2019 02:52:49 +0000 (02:52 +0000)]
Auto merge of #66250 - oli-obk:no_fields_in_empty_unions, r=eddyb

Undo an assert causing an ICE until we fix the underlying problem

r? @eddyb

fixes #65462

4 years agoAuto merge of #66161 - mark-i-m:fix-rustc-guide, r=ehuss
bors [Sun, 10 Nov 2019 21:55:00 +0000 (21:55 +0000)]
Auto merge of #66161 - mark-i-m:fix-rustc-guide, r=ehuss

Update rustc-guide

r? @ehuss

fix #66144

4 years agoMake error and warning annotations mandatory in UI tests
Tomasz Miąsko [Wed, 6 Nov 2019 00:00:00 +0000 (00:00 +0000)]
Make error and warning annotations mandatory in UI tests

This change makes error and warning annotations mandatory in UI tests.
The only exception are tests that use error patterns to match compiler
output and don't have any annotations.

4 years agoAdd warning annotations to rustdoc-ui tests
Tomasz Miąsko [Fri, 8 Nov 2019 00:00:00 +0000 (00:00 +0000)]
Add warning annotations to rustdoc-ui tests

4 years agoAdd warning annotations to ignore-stage1 ui-fulldeps tests
Tomasz Miąsko [Fri, 8 Nov 2019 00:00:00 +0000 (00:00 +0000)]
Add warning annotations to ignore-stage1 ui-fulldeps tests

4 years agoAuto merge of #66070 - petrochenkov:regattr, r=matthewjasper
bors [Sun, 10 Nov 2019 15:53:35 +0000 (15:53 +0000)]
Auto merge of #66070 - petrochenkov:regattr, r=matthewjasper

Support registering inert attributes and attribute tools using crate-level attributes

And remove `#[feature(custom_attribute)]`.
(`rustc_plugin::Registry::register_attribute` is not removed yet, I'll do it in a follow up PR.)

```rust
#![register_attr(my_attr)]
#![register_tool(my_tool)]

#[my_attr] // OK
#[my_tool::anything] // OK
fn main() {}
```

---
Some tools (`rustfmt` and `clippy`) used in tool attributes are hardcoded in the compiler.
We need some way to introduce them without hardcoding as well.

This PR introduces a way to do it with a crate level attribute.
The previous attempt to introduce them through command line (https://github.com/rust-lang/rust/pull/57921) met some resistance.

This probably needs to go through an RFC before stabilization.
However, I'd prefer to land *this* PR without an RFC to able to remove `#[feature(custom_attribute)]` and `Registry::register_attribute` while also providing a replacement.

---
`register_attr` is a direct replacement for `#![feature(custom_attribute)]` (https://github.com/rust-lang/rust/issues/29642), except it doesn't rely on implicit fallback from unresolved attributes to custom attributes (which was always hacky and is the primary reason for the removal of `custom_attribute`) and requires registering the attribute explicitly.
It's not clear whether it should go through stabilization or not.
It's quite possible that all the uses should migrate to `#![register_tool]` (https://github.com/rust-lang/rust/issues/66079) instead.

---

Details:
- The naming is `register_attr`/`register_tool` rather than some `register_attributes` (plural, no abbreviation) for consistency with already existing attributes like `cfg_attr`, or `feature`, etc.
---
Previous attempt: https://github.com/rust-lang/rust/pull/57921
cc https://github.com/rust-lang/rust/issues/44690
Tracking issues: #66079 (`register_tool`), #66080 (`register_attr`)
Closes https://github.com/rust-lang/rust/issues/29642

4 years agoAuto merge of #65324 - Centril:organize-syntax, r=petrochenkov
bors [Sun, 10 Nov 2019 12:18:53 +0000 (12:18 +0000)]
Auto merge of #65324 - Centril:organize-syntax, r=petrochenkov

Split libsyntax apart

In this PR the general idea is to separate the AST, parser, and friends by a more data / logic structure (tho not fully realized!) by separating out the parser and macro expansion code from libsyntax. Specifically have now three crates instead of one (libsyntax):

- libsyntax:

   - concrete syntax tree (`syntax::ast`)

   - definition of tokens and token-streams (`syntax::{token, tokenstream}`) -- used by `syntax::ast`

   - visitors (`syntax::visit`, `syntax::mut_visit`)

   - shared definitions between `libsyntax_expand`

   - feature gating (`syntax::feature_gate`) -- we could possibly move this out to its own crater later.

   - attribute and meta item utilities, including used-marking (`syntax::attr`)

   - pretty printer (`syntax::print`) -- this should possibly be moved out later. For now I've reduced down the dependencies to a single essential one which could be broken via `ParseSess`. This entails that e.g. `Debug` impls for `Path` cannot reference the pretty printer.

   - definition of `ParseSess` (`syntax::sess`) -- this is used by `syntax::{attr, print, feature_gate}` and is a common definition used by the parser and other things like librustc.

   - the `syntax::source_map` -- this includes definitions used by `syntax::ast` and other things but could ostensibly be moved `syntax_pos` since that is more related to this module.

   - a smattering of misc utilities not sufficiently important to itemize -- some of these could be moved to where they are used (often a single place) but I wanted to limit the scope of this PR.

- librustc_parse:

   - parser (`rustc_parse::parser`) -- reading a file and such are defined in the crate root tho.

   - lexer (`rustc_parse::lexer`)

   - validation of meta grammar (post-expansion) in (`rustc_parse::validate_attr`)

- libsyntax_expand -- this defines the infra for macro expansion and conditional compilation but this is not libsyntax_ext; we might want to merge them later but currently libsyntax_expand is depended on by librustc_metadata which libsyntax_ext is not.

   - conditional compilation (`syntax_expand::config`) -- moved from `syntax::config` to here

   - the bulk of this crate is made up of the old `syntax::ext`

r? @estebank

4 years agoFix tidy.
Camille GILLOT [Sat, 9 Nov 2019 18:22:30 +0000 (19:22 +0100)]
Fix tidy.

4 years agoMerge hir::ImplPolarity into ast::ImplPolarity.
Camille GILLOT [Sat, 9 Nov 2019 17:38:35 +0000 (18:38 +0100)]
Merge hir::ImplPolarity into ast::ImplPolarity.

4 years agoMerge hir::IsAuto into ast::IsAuto.
Camille GILLOT [Sat, 9 Nov 2019 17:28:03 +0000 (18:28 +0100)]
Merge hir::IsAuto into ast::IsAuto.

4 years agoMerge hir::CaptureClause into ast::CaptureBy.
Camille GILLOT [Sat, 9 Nov 2019 17:23:11 +0000 (18:23 +0100)]
Merge hir::CaptureClause into ast::CaptureBy.

4 years agoMerge hir::GeneratorMovability into ast::Movability.
Camille GILLOT [Sat, 9 Nov 2019 17:06:57 +0000 (18:06 +0100)]
Merge hir::GeneratorMovability into ast::Movability.

4 years agoMerge hir::Unsafety into ast::Unsafety.
Camille GILLOT [Sat, 9 Nov 2019 17:01:12 +0000 (18:01 +0100)]
Merge hir::Unsafety into ast::Unsafety.

4 years agoMerge hir::Constness into ast::Constness.
Camille GILLOT [Sat, 9 Nov 2019 16:54:28 +0000 (17:54 +0100)]
Merge hir::Constness into ast::Constness.

4 years agoMerge hir::Mutability into ast::Mutability.
Camille GILLOT [Sat, 9 Nov 2019 16:44:11 +0000 (17:44 +0100)]
Merge hir::Mutability into ast::Mutability.

4 years agoUndo an assert causing an ICE until we fix the problem properly
Oliver Scherer [Sun, 10 Nov 2019 10:15:34 +0000 (11:15 +0100)]
Undo an assert causing an ICE until we fix the problem properly

4 years agoAuto merge of #66072 - Mark-Simulacrum:next-node-id, r=nikomatsakis
bors [Sun, 10 Nov 2019 07:46:58 +0000 (07:46 +0000)]
Auto merge of #66072 - Mark-Simulacrum:next-node-id, r=nikomatsakis

Move next node ID to Resolver

This moves the `next_node_id` method(s) and related tracking information to the resolver. By doing so, we also remove the OneThread and Cell on next_node_id in Session in this move, which means that the new code is simpler and less "interesting" as it doesn't tie itself to a single thread.

This required moving some of the pretty-printing logic around, but this was just copying the code without any semantic changes, so it's just a second commit instead of a separate PR; I can polish it up a bit more if desired.

4 years agomove syntax::parse -> librustc_parse
Mazdak Farrokhzad [Tue, 15 Oct 2019 20:48:13 +0000 (22:48 +0200)]
move syntax::parse -> librustc_parse

also move MACRO_ARGUMENTS -> librustc_parse

4 years agoAuto merge of #66259 - JohnTitor:rollup-x9nk1e2, r=JohnTitor
bors [Sun, 10 Nov 2019 02:15:28 +0000 (02:15 +0000)]
Auto merge of #66259 - JohnTitor:rollup-x9nk1e2, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #65719 (Refactor sync::Once)
 - #65831 (Don't cast directly from &[T; N] to *const T)
 - #66048 (Correct error in documentation for Ipv4Addr method)
 - #66058 (Correct deprecated `is_global` IPv6 documentation)
 - #66216 ([mir-opt] Handle return place in ConstProp and improve SimplifyLocals pass)
 - #66217 (invalid_value lint: use diagnostic items)
 - #66235 (rustc_metadata: don't let LLVM confuse rmeta blobs for COFF object files.)

Failed merges:

r? @ghost

4 years agomove config.rs to libsyntax_expand
Mazdak Farrokhzad [Thu, 10 Oct 2019 08:26:10 +0000 (10:26 +0200)]
move config.rs to libsyntax_expand

4 years agoRollup merge of #66235 - eddyb:coff-syrup, r=nagisa
Yuki Okushi [Sun, 10 Nov 2019 00:27:20 +0000 (09:27 +0900)]
Rollup merge of #66235 - eddyb:coff-syrup, r=nagisa

rustc_metadata: don't let LLVM confuse rmeta blobs for COFF object files.

This has likely been a silent issue since 1.10 but only caused trouble recently (see https://github.com/rust-lang/rust/issues/65536#issuecomment-552018224), when recent changes to the `rmeta` schema introduced more opportunities for COFF parse errors.

To prevent any undesired interactions with old compilers, I've renamed the file inside `rlib`s from `rust.metadata.bin` to `lib.rmeta` (not strongly attached to it, suggestions welcome).

Fixes #65536.

<hr/>

Before:
```
$ llvm-objdump -all-headers build/*/stage1-std/*/release/deps/libcore-*.rmeta

build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcore-6b9e8b5a59b79a1d.rmeta: file format COFF-<unknown arch>

architecture: unknown
start address: 0x00000000

Sections:
Idx Name          Size     VMA          Type

SYMBOL TABLE:
```

After:
```
$ llvm-objdump -all-headers build/*/stage1-std/*/release/deps/libcore-*.rmeta

llvm-objdump: error: 'build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcore-6b9e8b5a59b79a1d.rmeta':
    The file was not recognized as a valid object file
```

4 years agoRollup merge of #66217 - RalfJung:diagnostic-items, r=Centril
Yuki Okushi [Sun, 10 Nov 2019 00:27:19 +0000 (09:27 +0900)]
Rollup merge of #66217 - RalfJung:diagnostic-items, r=Centril

invalid_value lint: use diagnostic items

This adjusts the invalid_value lint to use diagnostic items.

@Centril @oli-obk For some reason, this fails to recognize `transmute` -- somehow the diagnostic item is not found. Any idea why?

r? @Centril

Cc https://github.com/rust-lang/rust/issues/66075

4 years agoRollup merge of #66216 - wesleywiser:const_prop_codegen_improvements, r=oli-obk
Yuki Okushi [Sun, 10 Nov 2019 00:27:17 +0000 (09:27 +0900)]
Rollup merge of #66216 - wesleywiser:const_prop_codegen_improvements, r=oli-obk

[mir-opt] Handle return place in ConstProp and improve SimplifyLocals pass

Temporarily rebased on top of #66074. The top 2 commits are new.

r? @oli-obk

4 years agoRollup merge of #66058 - mjptree:patch-2, r=kennytm
Yuki Okushi [Sun, 10 Nov 2019 00:27:15 +0000 (09:27 +0900)]
Rollup merge of #66058 - mjptree:patch-2, r=kennytm

Correct deprecated `is_global` IPv6 documentation

This method does currently not return false for the `site_local` unicast address space. The documentation of the `is_unicast_global` method on lines 1352 - 1382 suggests that this is intentional as the site-local prefix must no longer be supported in new implementations, thus the documentation can safely be updated to reflect that information.
If not so,  either the `is_unicast_global` method should be updated to exclude the unicast site-local address space, or the `is_global` method itself.

4 years agoRollup merge of #66048 - mjptree:patch-1, r=Dylan-DPC
Yuki Okushi [Sun, 10 Nov 2019 00:27:13 +0000 (09:27 +0900)]
Rollup merge of #66048 - mjptree:patch-1, r=Dylan-DPC

Correct error in documentation for Ipv4Addr method

Correct statement in doctests on line 539 of `is_global` method of the `Ipv4Addr` object, which falsely attributed the tests to the broadcast address.

4 years agoRollup merge of #65831 - matthewjasper:array-ptr-cast, r=oli-obk
Yuki Okushi [Sun, 10 Nov 2019 00:27:12 +0000 (09:27 +0900)]
Rollup merge of #65831 - matthewjasper:array-ptr-cast, r=oli-obk

Don't cast directly from &[T; N] to *const T

Split out from #64588

r? @oli-obk

4 years agoRollup merge of #65719 - pitdicker:refactor_sync_once, r=Amanieu
Yuki Okushi [Sun, 10 Nov 2019 00:27:10 +0000 (09:27 +0900)]
Rollup merge of #65719 - pitdicker:refactor_sync_once, r=Amanieu

Refactor sync::Once

`std::sync::Once` contains some tricky code to park and unpark waiting threads. [once_cell](https://github.com/matklad/once_cell) has very similar code copied from here. I tried to add more comments and refactor the code to make it more readable (at least in my opinion). My PR to `once_cell` was rejected, because it is an advantage to remain close to the implementation in std, and because I made a mess of the atomic orderings. So now a PR here, with similar changes to `std::sync::Once`!

The initial goal was to see if there is some way to detect reentrant initialization instead of deadlocking. No luck there yet, but you first have to understand and document the complexities of the existing code :smile:.

*Maybe not this entire PR will be acceptable, but I hope at least some of the commits can be useful.*

Individual commits:

#### Rename state to state_and_queue
Just a more accurate description, although a bit wordy. It helped me on a first read through the code, where before `state` was use to encode a pointer in to nodes of a linked list.

#### Simplify loop conditions in RUNNING and add comments
In the relevant loop there are two things to be careful about:
- make sure not to enqueue the current thread only while still RUNNING, otherwise we will never be woken up (the status may have changed while trying to enqueue this thread).
- pick up if another thread just replaced the head of the linked list.

Because the first check was part of the condition of the while loop, the rest of the parking code also had to live in that loop. It took me a while to get the subtlety here, and it should now be clearer.

Also call out that we really have to wait until signaled, otherwise we leave a dangling reference.

#### Don't mutate waiter nodes
Previously while waking up other threads the managing thread would `take()` out the `Thread` struct and use that to unpark the other thread. It is just as easy to clone it, just 24 bytes. This way `Waiter.thread` does not need an `Option`, `Waiter.next` does not need to be a mutable pointer, and there is less data that needs to be synchronised by later atomic operations.

#### Turn Finish into WaiterQueue
In my opinion these changes make it just a bit more clear what is going on with the thread parking stuff.

#### Move thread parking to a seperate function
Maybe controversial, but with this last commit all the thread parking stuff has a reasonably clean seperation from the state changes in `Once`. This is arguably the trickier part of `Once`, compared to the loop in `call_inner`. It may make it easier to reuse parts of this code (see https://github.com/rust-lang/rfcs/pull/2788#discussion_r336729695). Not sure if that ever becomes a reality though.

#### Reduce the amount of comments in call_inner
With the changes from the previous commits, the code pretty much speaks for itself, and the amount of comments is hurting readability a bit.

#### Use more precise atomic orderings
Now the hard one. This is the one change that is not anything but a pure refactor or change of comments.

I have a dislike for using `SeqCst` everywhere, because it hides what the atomics are supposed to do. the rationale was:
> This cold path uses SeqCst consistently because the performance difference really does not matter there, and SeqCst minimizes the chances of something going wrong.

But in my opinion, having the proper orderings and some explanation helps to understand what is going on. My rationale for the used orderings (also included as comment):

When running `Once` we deal with multiple atomics: `Once.state_and_queue` and an unknown number of `Waiter.signaled`.
* `state_and_queue` is used (1) as a state flag, (2) for synchronizing the data that is the result of the `Once`, and (3) for synchronizing `Waiter` nodes.
    - At the end of the `call_inner` function we have to make sure the result of the `Once` is acquired. So every load which can be the only one to load COMPLETED must have at least Acquire ordering, which means all three of them.
    - `WaiterQueue::Drop` is the only place that may store COMPLETED, and must do so with Release ordering to make result available.
    - `wait` inserts `Waiter` nodes as a pointer in `state_and_queue`, and needs to make the nodes available with Release ordering. The load in its `compare_and_swap` can be Relaxed because it only has to compare the atomic, not to read other data.
    - `WaiterQueue::Drop` must see the `Waiter` nodes, so it must load `state_and_queue` with Acquire ordering.
    - There is just one store where `state_and_queue` is used only as a state flag, without having to synchronize data: switching the state from INCOMPLETE to RUNNING in `call_inner`. This store can be Relaxed, but the read has to be Acquire because of the requirements mentioned above.
* `Waiter.signaled` is both used as a flag, and to protect a field with interior mutability in `Waiter`. `Waiter.thread` is changed in `WaiterQueue::Drop` which then sets `signaled` with Release ordering. After `wait` loads `signaled` with Acquire and sees it is true, it needs to see the changes to drop the `Waiter` struct correctly.
* There is one place where the two atomics `Once.state_and_queue` and `Waiter.signaled` come together, and might be reordered by the compiler or processor. Because both use Aquire ordering such a reordering is not allowed, so no need for SeqCst.

cc @matklad

4 years agoAuto merge of #65694 - wesleywiser:uninhabited_enum_variants_pass, r=oli-obk
bors [Sat, 9 Nov 2019 23:01:06 +0000 (23:01 +0000)]
Auto merge of #65694 - wesleywiser:uninhabited_enum_variants_pass, r=oli-obk

[mir-opt] Implement pass to remove branches on uninhabited variants

Based on discussion [here](https://github.com/rust-lang/rust/pull/64890#discussion_r333612125), this is a pass to eliminate dead code that is caused by branching on an enum with uninhabited variants.

r? @oli-obk

4 years agoAuto merge of #63871 - BatmanAoD:FloatFnMustUse, r=withoutboats
bors [Sat, 9 Nov 2019 17:02:49 +0000 (17:02 +0000)]
Auto merge of #63871 - BatmanAoD:FloatFnMustUse, r=withoutboats

Add #[must_use] to all functions 'fn(float) -> float'

These are pure functions.

```rust
impl f32/f64 {
    fn floor(self) -> Self;
    fn ceil(self) -> Self;
    fn round(self) -> Self;
    fn trunc(self) -> Self;
    fn fract(self) -> Self;
    fn abs(self) -> Self;
    fn signum(self) -> Self;
    fn mul_add(self, a: Self, b: Self) -> Self;
    fn div_euclid(self, rhs: Self) -> Self;
    fn rem_euclid(self, rhs: Self) -> Self;
    fn powi(self, n: i32) -> Self;
    fn powf(self, n: Self) -> Self;
    fn sqrt(self) -> Self;
    fn exp(self) -> Self;
    fn exp2(self) -> Self;
    fn ln(self) -> Self;
    fn log(self, base: Self) -> Self;
    fn log2(self) -> Self;
    fn log10(self) -> Self;
    fn abs_sub(self, other: Self) -> Self;
    fn cbrt(self) -> Self;
    fn hypot(self, other: Self) -> Self;
    fn sin(self) -> Self;
    fn cos(self) -> Self;
    fn tan(self) -> Self;
    fn asin(self) -> Self;
    fn acos(self) -> Self;
    fn atan(self) -> Self;
    fn atan2(self, other: Self) -> Self;
    fn exp_m1(self) -> Self;
    fn ln_1p(self) -> Self;
    fn sinh(self) -> Self;
    fn cosh(self) -> Self;
    fn tanh(self) -> Self;
    fn asinh(self) -> Self;
    fn acosh(self) -> Self;
    fn atanh(self) -> Self;
    fn clamp(self, min: Self, max: Self) -> Self;
}
```

Part of #48926

4 years agoInline reserve_node_ids
Mark Rousskov [Mon, 4 Nov 2019 13:22:52 +0000 (08:22 -0500)]
Inline reserve_node_ids

This function was only ever called with 1 so there's little point in it;
this isn't an expensive operation (essentially a checked add) so we're
not really "reserving" anything either.

4 years agoMove pretty parsing into Session options
Mark Rousskov [Mon, 4 Nov 2019 02:42:03 +0000 (21:42 -0500)]
Move pretty parsing into Session options

This allows us to query whether PpmEveryBodyLoops is set during
expansion and run the everybody loops pass.

4 years agoMove next_node_id to Resolver
Mark Rousskov [Sun, 3 Nov 2019 22:38:02 +0000 (17:38 -0500)]
Move next_node_id to Resolver

This doesn't migrate the pretty-printing everybody loops, which will be
done in the next few commits.

4 years agoAddress review comments
Vadim Petrochenkov [Mon, 4 Nov 2019 13:47:03 +0000 (16:47 +0300)]
Address review comments

4 years agoresolve: Factor out some common binding creation functionality
Vadim Petrochenkov [Mon, 4 Nov 2019 13:24:21 +0000 (16:24 +0300)]
resolve: Factor out some common binding creation functionality

4 years agoresolve: Remove some bits relevant only to legacy plugins
Vadim Petrochenkov [Mon, 4 Nov 2019 13:21:59 +0000 (16:21 +0300)]
resolve: Remove some bits relevant only to legacy plugins

They are unstable and going to be removed anyway and the removed code would complicate the next commit

4 years agoRemove `#[feature(custom_attribute)]`
Vadim Petrochenkov [Sun, 3 Nov 2019 21:36:45 +0000 (00:36 +0300)]
Remove `#[feature(custom_attribute)]`

4 years agoSupport registering attributes and attribute tools using crate-level attributes
Vadim Petrochenkov [Sun, 3 Nov 2019 17:28:20 +0000 (20:28 +0300)]
Support registering attributes and attribute tools using crate-level attributes

4 years agoAuto merge of #66243 - RalfJung:miri, r=RalfJung
bors [Sat, 9 Nov 2019 13:48:56 +0000 (13:48 +0000)]
Auto merge of #66243 - RalfJung:miri, r=RalfJung

update miri

Fixes https://github.com/rust-lang/rust/issues/66179

r? @ghost

4 years agoUpdate src/libstd/net/ip.rs
mjptree [Sat, 9 Nov 2019 12:27:09 +0000 (12:27 +0000)]
Update src/libstd/net/ip.rs

I assumed some sort of Oxford-comma case here, bit have to admit English is not my first language.

Co-Authored-By: kennytm <kennytm@gmail.com>
4 years agoRun rustfmt on libstd/sync/once.rs
Paul Dicker [Sat, 9 Nov 2019 11:46:17 +0000 (12:46 +0100)]
Run rustfmt on libstd/sync/once.rs

4 years agopartially port invalid_value lint to diagnostic items
Ralf Jung [Sat, 9 Nov 2019 09:34:16 +0000 (10:34 +0100)]
partially port invalid_value lint to diagnostic items

4 years agoAuto merge of #66242 - Centril:rollup-h73ztr1, r=Centril
bors [Sat, 9 Nov 2019 09:33:13 +0000 (09:33 +0000)]
Auto merge of #66242 - Centril:rollup-h73ztr1, r=Centril

Rollup of 6 pull requests

Successful merges:

 - #65949 (Move promotion into its own pass)
 - #65994 (Point at where clauses where the associated item was restricted)
 - #66050 (Fix C aggregate-passing ABI on powerpc)
 - #66134 (Point at formatting descriptor string when it is invalid)
 - #66172 (Stabilize @file command line arguments)
 - #66226 (add link to unstable book for asm! macro)

Failed merges:

r? @ghost

4 years agoupdate miri
Ralf Jung [Sat, 9 Nov 2019 08:20:13 +0000 (09:20 +0100)]
update miri

4 years agoRollup merge of #66226 - lzutao:asm-usage-link, r=Centril
Mazdak Farrokhzad [Sat, 9 Nov 2019 06:18:35 +0000 (07:18 +0100)]
Rollup merge of #66226 - lzutao:asm-usage-link, r=Centril

add link to unstable book for asm! macro

r? @Centril

4 years agoRollup merge of #66172 - jsgf:stabilize-atfile, r=nikomatsakis
Mazdak Farrokhzad [Sat, 9 Nov 2019 06:18:34 +0000 (07:18 +0100)]
Rollup merge of #66172 - jsgf:stabilize-atfile, r=nikomatsakis

Stabilize @file command line arguments

Issue https://github.com/rust-lang/rust/issues/63576

4 years agoRollup merge of #66134 - estebank:unknown-formatting-trait, r=nikomatsakis
Mazdak Farrokhzad [Sat, 9 Nov 2019 06:18:32 +0000 (07:18 +0100)]
Rollup merge of #66134 - estebank:unknown-formatting-trait, r=nikomatsakis

Point at formatting descriptor string when it is invalid

When a formatting string contains an invalid descriptor, point at it
instead of the argument:

```
error: unknown format trait `foo`
  --> $DIR/ifmt-bad-arg.rs:86:17
   |
LL |     println!("{:foo}", 1);
   |                 ^^^
   |
   = note: the only appropriate formatting traits are:
           - ``, which uses the `Display` trait
           - `?`, which uses the `Debug` trait
           - `e`, which uses the `LowerExp` trait
           - `E`, which uses the `UpperExp` trait
           - `o`, which uses the `Octal` trait
           - `p`, which uses the `Pointer` trait
           - `b`, which uses the `Binary` trait
           - `x`, which uses the `LowerHex` trait
           - `X`, which uses the `UpperHex` trait
```

4 years agoRollup merge of #66050 - smaeul:patch/powerpc-abi-2, r=eddyb
Mazdak Farrokhzad [Sat, 9 Nov 2019 06:18:31 +0000 (07:18 +0100)]
Rollup merge of #66050 - smaeul:patch/powerpc-abi-2, r=eddyb

Fix C aggregate-passing ABI on powerpc

The existing code (which looks like it was copied from MIPS) passes
aggregates by value in registers. This is wrong. According to the SVR4
powerpc psABI, all aggregates are passed indirectly.

See #64259 for more discussion, which addresses the ABI for the special
case of ZSTs (empty structs).

4 years agoRollup merge of #65994 - estebank:where-bound, r=nikomatsakis
Mazdak Farrokhzad [Sat, 9 Nov 2019 06:18:29 +0000 (07:18 +0100)]
Rollup merge of #65994 - estebank:where-bound, r=nikomatsakis

Point at where clauses where the associated item was restricted

CC #57663.
r? @nikomatsakis

4 years agoRollup merge of #65949 - ecstatic-morse:promote-only-pass, r=eddyb
Mazdak Farrokhzad [Sat, 9 Nov 2019 06:18:27 +0000 (07:18 +0100)]
Rollup merge of #65949 - ecstatic-morse:promote-only-pass, r=eddyb

Move promotion into its own pass

**edited**

This adds a `PromoteTemps` pass, which runs after the old `QualifyAndPromoteConsts` pass, that *only* does promotion (no const-checking). Everything related to promotion has been removed from `QualifyAndPromoteConstants`: it no longer even visits the body of a non-const `fn`.

As a result we no longer need to keep the `BitSet` of promotable locals that was returned by `mir_const_qualif`. Rvalue-static promotion in a `const` is now done in `promote_consts`, and it operates on a set of `Candidate`s instead. This will allow me–in a later PR–to create promoted MIR fragments for `const`s when necessary, which could resolve some shortcomings of the current approach (removing `StorageDead`).

r? @eddyb

4 years agoAuto merge of #65879 - ohadravid:stabilize-re-rebalance-coherence, r=nikomatsakis
bors [Sat, 9 Nov 2019 05:57:14 +0000 (05:57 +0000)]
Auto merge of #65879 - ohadravid:stabilize-re-rebalance-coherence, r=nikomatsakis

Stabilize the `re_rebalance_coherence` feature

This PR stabilizes [RFC 2451](https://rust-lang.github.io/rfcs/2451-re-rebalancing-coherence.html), re-rebalance coherence.

Changes include removing the attribute from tests which tested both the old and new behavior, moving the feature to `accepted` and removing the old logic.

I'll also open a [PR](https://github.com/rust-lang-nursery/reference/pull/703) against the reference, updating it with the content of the RFC.

Closes #63599

r? @nikomatsakis

4 years ago[mir-opt] Handle aggregates in SimplifyLocals pass
Wesley Wiser [Fri, 8 Nov 2019 00:21:40 +0000 (19:21 -0500)]
[mir-opt] Handle aggregates in SimplifyLocals pass

4 years ago[mir-opt] Handle const-prop for the return place
Wesley Wiser [Fri, 8 Nov 2019 00:13:03 +0000 (19:13 -0500)]
[mir-opt] Handle const-prop for the return place

4 years agomove attr meta grammar to parse::validate_atr + ast_validation
Mazdak Farrokhzad [Fri, 11 Oct 2019 19:00:09 +0000 (21:00 +0200)]
move attr meta grammar to parse::validate_atr + ast_validation

4 years agorustc_metadata: don't let LLVM confuse rmeta blobs for COFF object files.
Eduard-Mihai Burtescu [Sat, 9 Nov 2019 00:06:22 +0000 (02:06 +0200)]
rustc_metadata: don't let LLVM confuse rmeta blobs for COFF object files.

4 years agoAuto merge of #66194 - alexcrichton:update-clang, r=Mark-Simulacrum
bors [Fri, 8 Nov 2019 23:28:06 +0000 (23:28 +0000)]
Auto merge of #66194 - alexcrichton:update-clang, r=Mark-Simulacrum

Update Clang & build MSVC LLVM with it

This is a general update of our builders to Clang 9, and then it also attempts to tackle a bit of #66192 by building LLVM for rustc with Clang, not with the system `cl.exe` on MSVC.

4 years agoClean up dead code in `qualify_consts`
Dylan MacKenzie [Wed, 6 Nov 2019 23:00:29 +0000 (15:00 -0800)]
Clean up dead code in `qualify_consts`

We don't do promotion here anymore, so `Checker` will never even visit
the body of a non-const `fn`.

4 years agoBless tests now that we do promotion if `min_const_fn` fails
Dylan MacKenzie [Mon, 28 Oct 2019 22:21:53 +0000 (15:21 -0700)]
Bless tests now that we do promotion if `min_const_fn` fails

We bailed out of `QualifyAndPromoteConsts` immediately if the
`min_const_fn` checks failed, which sometimes resulted in additional,
spurious errors since promotion was skipped.

We now do promotion in a completely separate pass, so this is no longer
an issue.

4 years agoUse new `PromoteTemps` for promotion
Dylan MacKenzie [Wed, 6 Nov 2019 22:23:35 +0000 (14:23 -0800)]
Use new `PromoteTemps` for promotion

4 years agoAdd a `PromoteTemps` pass
Dylan MacKenzie [Mon, 28 Oct 2019 22:32:56 +0000 (15:32 -0700)]
Add a `PromoteTemps` pass

`remove_storage_dead_and_drop` has been copied to `promote_temps` and
now operates on an array of `Candidate`s instead of a bitset.

4 years agoStop returning promotables from `mir_const_qualif`
Dylan MacKenzie [Mon, 28 Oct 2019 19:17:36 +0000 (12:17 -0700)]
Stop returning promotables from `mir_const_qualif`

4 years agoupdate rustc-guide
Mark Mansi [Fri, 8 Nov 2019 17:48:12 +0000 (11:48 -0600)]
update rustc-guide

4 years agoadd link to unstable book for asm! macro
Lzu Tao [Fri, 8 Nov 2019 15:58:25 +0000 (15:58 +0000)]
add link to unstable book for asm! macro

4 years agoAuto merge of #66225 - Centril:rollup-it0t5tk, r=Centril
bors [Fri, 8 Nov 2019 15:52:14 +0000 (15:52 +0000)]
Auto merge of #66225 - Centril:rollup-it0t5tk, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #65785 (Transition future compat lints to {ERROR, DENY} - Take 2)
 - #66007 (Remove "here" from "expected one of X here")
 - #66043 (rename Memory::get methods to get_raw to indicate their unchecked nature)
 - #66154 (miri: Rename to_{u,i}size to to_machine_{u,i}size)
 - #66188 (`MethodSig` -> `FnSig` & Use it in `ItemKind::Fn`)

Failed merges:

r? @ghost

4 years agoRollup merge of #66188 - Centril:fnsig, r=davidtwco
Mazdak Farrokhzad [Fri, 8 Nov 2019 15:50:41 +0000 (16:50 +0100)]
Rollup merge of #66188 - Centril:fnsig, r=davidtwco

`MethodSig` -> `FnSig` & Use it in `ItemKind::Fn`

In both AST & HIR, rename `MethodSig` to `FnSig` and then proceed to use it in `ItemKind::Fn` so that the overall structure is more regular.

r? @davidtwco

4 years agoRollup merge of #66154 - RalfJung:to_usize, r=oli-obk
Mazdak Farrokhzad [Fri, 8 Nov 2019 15:50:40 +0000 (16:50 +0100)]
Rollup merge of #66154 - RalfJung:to_usize, r=oli-obk

miri: Rename to_{u,i}size to to_machine_{u,i}size

Having a function `to_usize` that does not return a (host) usize is somewhat confusing, so let's rename it.

r? @oli-obk

4 years agoRollup merge of #66043 - RalfJung:memory-get-raw, r=cramertj
Mazdak Farrokhzad [Fri, 8 Nov 2019 15:50:38 +0000 (16:50 +0100)]
Rollup merge of #66043 - RalfJung:memory-get-raw, r=cramertj

rename Memory::get methods to get_raw to indicate their unchecked nature

Some recent Miri PRs started using these methods when they should not; this should discourage their use.

In fact we could make these methods private to the `interp` module as far as Miri is concerned -- with the exception of the `uninit` intrinsic which will hopefully go away soon. @bjorn3 @oli-obk does priroda need these methods? It would be great to be able to seal them away.

4 years agoRollup merge of #66007 - estebank:remove-here, r=Centril
Mazdak Farrokhzad [Fri, 8 Nov 2019 15:50:35 +0000 (16:50 +0100)]
Rollup merge of #66007 - estebank:remove-here, r=Centril

Remove "here" from "expected one of X here"

4 years agoRollup merge of #65785 - Centril:compat-to-error-2, r=oli-obk
Mazdak Farrokhzad [Fri, 8 Nov 2019 15:50:33 +0000 (16:50 +0100)]
Rollup merge of #65785 - Centril:compat-to-error-2, r=oli-obk

Transition future compat lints to {ERROR, DENY} - Take 2

Follow up to https://github.com/rust-lang/rust/pull/63247 implementing https://github.com/rust-lang/rust/pull/63247#issuecomment-536295992.

- `legacy_ctor_visibility` (ERROR) -- closes #39207
- `legacy_directory_ownership` (ERROR) -- closes #37872
- `safe_extern_static` (ERROR) -- closes #36247
- `parenthesized_params_in_types_and_modules` (ERROR) -- closes #42238
- `duplicate_macro_exports` (ERROR)
- `nested_impl_trait` (ERROR) -- closes #59014
- `ill_formed_attribute_input` (DENY) -- transitions #57571
- `patterns_in_fns_without_body` (DENY) -- transitions #35203

r? @varkor
cc @petrochenkov

4 years agoast::ItemKind::Fn: use ast::FnSig
Mazdak Farrokhzad [Thu, 7 Nov 2019 12:33:37 +0000 (13:33 +0100)]
ast::ItemKind::Fn: use ast::FnSig

4 years agoast::MethodSig -> ast::FnSig
Mazdak Farrokhzad [Thu, 7 Nov 2019 12:11:59 +0000 (13:11 +0100)]
ast::MethodSig -> ast::FnSig

4 years agohir::MethodSig -> hir::FnSig
Mazdak Farrokhzad [Thu, 7 Nov 2019 12:06:52 +0000 (13:06 +0100)]
hir::MethodSig -> hir::FnSig

4 years agohir::ItemKind::Fn: use hir::MethodSig
Mazdak Farrokhzad [Thu, 7 Nov 2019 11:57:52 +0000 (12:57 +0100)]
hir::ItemKind::Fn: use hir::MethodSig

4 years agomiri: Rename to_{u,i}size to to_machine_{u,i}size
Ralf Jung [Wed, 6 Nov 2019 12:00:14 +0000 (13:00 +0100)]
miri: Rename to_{u,i}size to to_machine_{u,i}size

Having a function `to_usize` that does not return a usize is somewhat confusing

4 years agorename Memory::get methods to get_raw to indicate their unchecked nature
Ralf Jung [Sat, 2 Nov 2019 16:46:11 +0000 (17:46 +0100)]
rename Memory::get methods to get_raw to indicate their unchecked nature

4 years agoAuto merge of #66066 - ecstatic-morse:remove-promotion-from-qualify-consts, r=eddyb
bors [Fri, 8 Nov 2019 07:55:53 +0000 (07:55 +0000)]
Auto merge of #66066 - ecstatic-morse:remove-promotion-from-qualify-consts, r=eddyb

Remove promotion candidate gathering and checking from `qualify_consts.rs`

This makes promotion candidate gathering and checking the exclusive domain of `promote_consts`, but the `QualifyAndPromoteConsts` pass is still responsible for both const-checking and creating promoted MIR fragments.

This should not be merged until the beta branches on Nov. 5.

r? @eddyb

4 years agoAuto merge of #66208 - JohnTitor:rollup-2umgjer, r=JohnTitor
bors [Fri, 8 Nov 2019 04:44:23 +0000 (04:44 +0000)]
Auto merge of #66208 - JohnTitor:rollup-2umgjer, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #65554 (Enhance the documentation of BufReader for potential data loss)
 - #65580 (Add `MaybeUninit` methods `uninit_array`, `slice_get_ref`, `slice_get_mut`)
 - #66049 (consistent handling of missing sysroot spans)
 - #66056 (rustc_metadata: Some reorganization of the module structure)
 - #66123 (No more hidden elements)
 - #66157 (Improve math log documentation examples)
 - #66165 (Ignore these tests ,since the called commands doesn't exist in VxWorks)
 - #66190 (rustc_target: inline abi::FloatTy into abi::Primitive.)

Failed merges:

 - #66188 (`MethodSig` -> `FnSig` & Use it in `ItemKind::Fn`)

r? @ghost

4 years agoRollup merge of #66190 - eddyb:primflt, r=Centril
Yuki Okushi [Fri, 8 Nov 2019 04:42:24 +0000 (13:42 +0900)]
Rollup merge of #66190 - eddyb:primflt, r=Centril

rustc_target: inline abi::FloatTy into abi::Primitive.

This effectively undoes a small part of @oli-obk's #50967, now that the rest of the compiler doesn't use the `FloatTy` definition from `rustc_target`, post-#65884.

4 years agoRollup merge of #66165 - Wind-River:master_xyz, r=alexcrichton
Yuki Okushi [Fri, 8 Nov 2019 04:42:22 +0000 (13:42 +0900)]
Rollup merge of #66165 - Wind-River:master_xyz, r=alexcrichton

Ignore these tests ,since the called commands doesn't exist in VxWorks

4 years agoRollup merge of #66157 - srinivasreddy:improv, r=alexcrichton
Yuki Okushi [Fri, 8 Nov 2019 04:42:21 +0000 (13:42 +0900)]
Rollup merge of #66157 - srinivasreddy:improv, r=alexcrichton

Improve math log documentation examples

using 2.0.log(2.0) in examples does not make it clear which is the base and number. This example makes it clear for programmers who take a glance at the example by following the calculation. It is more intuitive, and eliminates the need for executing the example in the playground.

4 years agoRollup merge of #66123 - GuillaumeGomez:no-more-hidden-elements, r=Dylan-DPC
Yuki Okushi [Fri, 8 Nov 2019 04:42:19 +0000 (13:42 +0900)]
Rollup merge of #66123 - GuillaumeGomez:no-more-hidden-elements, r=Dylan-DPC

No more hidden elements

Fixes #66046.

Follow-up of #66082.

r? @kinnison

4 years agoRollup merge of #66056 - petrochenkov:metapriv, r=eddyb
Yuki Okushi [Fri, 8 Nov 2019 04:42:17 +0000 (13:42 +0900)]
Rollup merge of #66056 - petrochenkov:metapriv, r=eddyb

rustc_metadata: Some reorganization of the module structure

The new structure of `rustc_metadata` (or rather its parts affected by the refactoring) is
```
├── lib.rs
└── rmeta
    ├── decoder
    │   └── cstore_impl.rs
    ├── decoder.rs
    ├── encoder.rs
    ├── mod.rs
    └── table.rs
```

(`schema` is renamed to `rmeta`.)

The code inside `rmeta` is pretty self-contained, so we can now privatize almost everything in this module instead of using `pub(crate)`  which was necessary when all these modules accessed their neighbors in the old flat structure.

`encoder` and `decoder` work with structures defined by `rmeta`.
`table` is a part of `rmeta`.
`cstore_impl` actively uses decoder methods and exposes their results through very few public methods (`provide` and `_untracked` methods).

r? @eddyb @spastorino

4 years agoRollup merge of #66049 - RalfJung:missing-spans, r=alexcrichton
Yuki Okushi [Fri, 8 Nov 2019 04:42:16 +0000 (13:42 +0900)]
Rollup merge of #66049 - RalfJung:missing-spans, r=alexcrichton

consistent handling of missing sysroot spans

Due to https://github.com/rust-lang/rust/issues/53081, sysroot spans (pointing to code in libcore/libstd/...) fails to print on some x86 runners. This consolidates the ignore directives for that and references the relevant issue.

I also did that for the generated derive-error-span tests -- but there the script and the tests were not entirely in sync any more since https://github.com/rust-lang/rust/pull/64151. Cc @estebank @varkor

4 years agoRollup merge of #65580 - SimonSapin:maybeuninit-array, r=Amanieu
Yuki Okushi [Fri, 8 Nov 2019 04:42:14 +0000 (13:42 +0900)]
Rollup merge of #65580 - SimonSapin:maybeuninit-array, r=Amanieu

Add `MaybeUninit` methods `uninit_array`, `slice_get_ref`, `slice_get_mut`

Eventually these will hopefully become the idiomatic way to work with partially-initialized stack buffers.

All methods are unstable. Note that `uninit_array` takes a type-level `const usize` parameter, so it is blocked (at least in its current form) on const generics.

Example:

```rust
use std::mem::MaybeUninit;

let input = b"Foo";
let f = u8::to_ascii_uppercase;

let mut buffer: [MaybeUninit<u8>; 32] = MaybeUninit::uninit_array();
let vec;
let output = if let Some(buffer) = buffer.get_mut(..input.len()) {
    buffer.iter_mut().zip(input).for_each(|(a, b)| { a.write(f(b)); });
    unsafe { MaybeUninit::slice_get_ref(buffer) }
} else {
    vec = input.iter().map(f).collect::<Vec<u8>>();
    &vec
};

assert_eq!(output, b"FOO");
```

4 years agoRollup merge of #65554 - gliderkite:bufreader-doc-enhance, r=KodrAus
Yuki Okushi [Fri, 8 Nov 2019 04:42:12 +0000 (13:42 +0900)]
Rollup merge of #65554 - gliderkite:bufreader-doc-enhance, r=KodrAus

Enhance the documentation of BufReader for potential data loss

This is (IMO) and enhancement of the `std::io::BufReader` documentation, that aims to highlight how relatively easy is to end up with data loss when improperly using an instance of this class.

This is following the issue I had figuring out why my application was loosing data, because I focused my attention on the word *multiple instances* of `BufReader` in its `struct` documentation, even if I ever only had one instance.

Link to the issue: https://github.com/tokio-rs/tokio/issues/1662

4 years agoAuto merge of #64882 - ehuss:stabilize-bare-extern, r=eddyb
bors [Fri, 8 Nov 2019 01:15:50 +0000 (01:15 +0000)]
Auto merge of #64882 - ehuss:stabilize-bare-extern, r=eddyb

Stabilize --extern flag without a path.

This stabilizes the `--extern` flag without a path, implemented in #54116.

This flag is used to add a crate that may be found in the search path to the extern prelude. The intent of stabilizing this now is to change Cargo to emit this flag for `proc_macro` when building a proc-macro crate. This will allow the ability to elide `extern crate proc_macro;` for proc-macros, one of the few places where it is still necessary.

It is intended that Cargo may also use this flag for other cases in the future as part of the [std-aware work](https://github.com/rust-lang/wg-cargo-std-aware/). There will likely be some kind of syntax where users may declare dependencies on other crates (such as `alloc`), and Cargo will use this flag so that they may be used like any other crate. At this time there are no short-term plans to use it for anything other than proc-macro.

This will not help for non-proc-macro crates that use `proc_macro`, which I believe is not too common?

An alternate approach for proc-macro is to use the `meta` crate, but from my inquiries there doesn't appear to be anyone interested in pushing that forward. The `meta` crate also doesn't help with things like `alloc` or `test`.

cc #57288

4 years agoAuto merge of #66189 - Centril:rollup-3bsf45s, r=Centril
bors [Thu, 7 Nov 2019 22:02:41 +0000 (22:02 +0000)]
Auto merge of #66189 - Centril:rollup-3bsf45s, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #63793 (Have tidy ensure that we document all `unsafe` blocks in libcore)
 - #64696 ([rustdoc] add sub settings)
 - #65916 (syntax: move stuff around)
 - #66087 (Update some build-pass ui tests to use check-pass where applicable)
 - #66182 (invalid_value lint: fix help text)

Failed merges:

r? @ghost

4 years agoAttempt to fix *.yml confguration on Azure
Alex Crichton [Thu, 7 Nov 2019 17:25:06 +0000 (09:25 -0800)]
Attempt to fix *.yml confguration on Azure

Currently the `RUST_CONFIGURE_ARGS` variable apparently has a trailing
newline at the end of it due to the way it's configured in yaml. This
causes issues with MSVC's `install-clang.sh` step where the way the bash
syntax works out means that we drop the arg we're trying to add and it
doesn't actually get added!

The hopeful fix here is to tweak how we specify the yaml syntax to not
have a trailing newline, we'll see what CI says about this...

4 years agoUpdate clang to build LLVM to 9.0.0
Alex Crichton [Thu, 7 Nov 2019 17:00:25 +0000 (09:00 -0800)]
Update clang to build LLVM to 9.0.0

This also ensure that we're using the same clang version for all our
major platforms instead of 8.0 on Linux and 7.0 on OSX/Windows.

4 years agorustc_metadata: Rename `schema` to `rmeta`
Vadim Petrochenkov [Mon, 4 Nov 2019 08:57:17 +0000 (11:57 +0300)]
rustc_metadata: Rename `schema` to `rmeta`

And change `rmeta.rs` to `rmeta/mod.rs`

4 years agorustc_metadata: Privatize more entities
Vadim Petrochenkov [Sun, 3 Nov 2019 15:27:24 +0000 (18:27 +0300)]
rustc_metadata: Privatize more entities

4 years agorustc_metadata: Privatize everything in decoder
Vadim Petrochenkov [Sun, 3 Nov 2019 14:13:07 +0000 (17:13 +0300)]
rustc_metadata: Privatize everything in decoder

4 years agorustc_metadata: Move cstore_impl into mod decoder
Vadim Petrochenkov [Sun, 3 Nov 2019 14:36:16 +0000 (17:36 +0300)]
rustc_metadata: Move cstore_impl into mod decoder

4 years agorustc_metadata: Privatize everything in schema and schema/table
Vadim Petrochenkov [Sun, 3 Nov 2019 14:33:27 +0000 (17:33 +0300)]
rustc_metadata: Privatize everything in schema and schema/table

4 years agorustc_metadata: Move decoder/encoder/table into mod schema
Vadim Petrochenkov [Sun, 3 Nov 2019 12:56:11 +0000 (15:56 +0300)]
rustc_metadata: Move decoder/encoder/table into mod schema