Commit Graph

102742 Commits

Author SHA1 Message Date
Aaron Hill
fe3e1c1cc3
Add doc comment 2019-11-11 15:14:33 -05:00
Aaron Hill
64a43f45d2
A few minor tweaks 2019-11-11 15:14:33 -05:00
Ralf Jung
01c11f9fb5
avoid the loop in unwinding stack popping 2019-11-11 15:14:32 -05:00
Aaron Hill
499eb5d831
More fixes for rustc changes 2019-11-11 15:14:32 -05:00
Aaron Hill
d87e2daccf
Remove old intrinsic check 2019-11-11 15:14:32 -05:00
Aaron Hill
fa4f1b79ec
Fix incorrect unwrap of dest 2019-11-11 15:14:32 -05:00
Aaron Hill
199101822a
Formatting improvements
Co-Authored-By: Oliver Scherer <github35764891676564198441@oli-obk.de>
2019-11-11 15:14:31 -05:00
Aaron Hill
187d05f215
Add hooks for Miri panic unwinding
This commits adds in some additional hooks to allow Miri to properly
handle panic unwinding. None of this should have any impact on CTFE mode
2019-11-11 15:14:31 -05:00
Mark Rousskov
2c6d609484 Move allocator_kind to CrateStore
Similarly to the previous commit, there's no need for this to be in
Session and have a Once around it.
2019-11-11 14:59:07 -05:00
Mark Rousskov
e1cf38ac18 Move injected_panic_runtime to CrateStore
This was essentially a "query" previously (with no key, just always run
once when resolving the crate dependencies), and remains so, just now in
a way that isn't on Session. This removes the need for the `Once` as
well.
2019-11-11 14:50:26 -05:00
Manish Goregaokar
7a5f27a62e Update clippy 2019-11-11 11:41:10 -08:00
Vadim Petrochenkov
e7c42f0cf0 Tiny cleanup to size assertions 2019-11-11 22:23:25 +03:00
bors
bc0e288ad0 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.
2019-11-11 19:20:54 +00:00
Vytautas Astrauskas
f9f5a88bc4 Add a callback that allows compiler consumers to override queries. 2019-11-11 19:29:34 +01:00
Ross MacArthur
3ba8257253 support issue = "none" in unstable attributes
- Use `Option<NonZeroU32>` to represent issue numbers.
2019-11-11 19:33:30 +02:00
Guanqun Lu
0019371e3d bootstrap: don't call support_xz in hot-path 2019-11-12 00:16:05 +08:00
Guanqun Lu
292ba98cb7 fix an ICE in macro's diagnostic message 2019-11-11 22:21:16 +08:00
bors
56237d75b4 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.
2019-11-11 14:05:43 +00:00
csmoe
dcc14c40ee suggest to add a constraint except asyn-fn without explicit output 2019-11-11 21:37:13 +08:00
csmoe
b380d35849 add ui test for issue-62097 2019-11-11 21:37:13 +08:00
bors
9248b019b2 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.
2019-11-11 09:40:33 +00:00
Lukas Kalbertodt
696ac95304
Fix error message about exported symbols from proc-macro crates
Someone forgot to update the error message after `#[proc_macro]` and
`#[proc_macro_attribute]` were stabilized.
2019-11-11 08:04:39 +01:00
bors
2a9be46cc4 Auto merge of #66207 - Manishearth:clippyup, r=Centril
Update clippy

Fixes #66150

r? @ghost
2019-11-11 06:29:15 +00:00
Manish Goregaokar
955f861075 Update clippy 2019-11-11 07:27:46 +01:00
Mazdak Farrokhzad
9a88364525 syntactically allow visibility on trait item & enum variant 2019-11-11 06:33:09 +01:00
bors
1062b698c1 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
2019-11-11 02:52:49 +00:00
Stepan Koltsov
04a237b9e2 Fix HashSet::union performance
Consider this example: small_set = 0..2, large_set = 0..1000.

To efficiently compute the union of these sets, we should
* take all elements of the larger set
* for each element of the smaller set check it is not in the larger set

This is exactly what this commit does.

This particular optimization was implemented a year ago, but the
author mistaken `<` and `>`.
2019-11-10 23:53:44 +00:00
Guillaume Gomez
528b0590b1 Add rustdoc doc page for lints 2019-11-10 23:06:24 +01:00
Guillaume Gomez
af5f84fa4f Add rustdoc doc page on how to write documentation 2019-11-10 23:06:24 +01:00
bors
e2fa9527d4 Auto merge of #66161 - mark-i-m:fix-rustc-guide, r=ehuss
Update rustc-guide

r? @ehuss

fix #66144
2019-11-10 21:55:00 +00:00
Tomasz Miąsko
427952e808 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.
2019-11-10 21:01:02 +01:00
Tomasz Miąsko
70b146c2cb Add warning annotations to rustdoc-ui tests 2019-11-10 21:01:02 +01:00
Tomasz Miąsko
267fc6dcf6 Add warning annotations to ignore-stage1 ui-fulldeps tests 2019-11-10 21:00:59 +01:00
Mark Rousskov
2c34f384d4 Move lock into CodeStats
Prevent accidental too-long borrows by ensuring only encapsulated
locking.
2019-11-10 11:48:47 -05:00
bors
3fc30d884a 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
2019-11-10 15:53:35 +00:00
Ohad Ravid
2db744ca9d Improve coherence errors for wrong type order 2019-11-10 16:26:38 +01:00
Guillaume Gomez
db1dd8f800 Clean up librustc_typeck error_codes file 2019-11-10 14:57:19 +01:00
bors
a3b6e5705c 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
2019-11-10 12:18:53 +00:00
Camille GILLOT
76128f89a1 Fix tidy. 2019-11-10 12:45:31 +01:00
Camille GILLOT
daff3e346c Merge hir::ImplPolarity into ast::ImplPolarity. 2019-11-10 12:40:44 +01:00
Camille GILLOT
738faadc31 Merge hir::IsAuto into ast::IsAuto. 2019-11-10 12:37:12 +01:00
Camille GILLOT
cb233f5420 Merge hir::CaptureClause into ast::CaptureBy. 2019-11-10 12:33:41 +01:00
Camille GILLOT
5b30da10b6 Merge hir::GeneratorMovability into ast::Movability. 2019-11-10 12:31:41 +01:00
Camille GILLOT
f03cbc313d Merge hir::Unsafety into ast::Unsafety. 2019-11-10 12:24:22 +01:00
Camille GILLOT
1f21c080eb Merge hir::Constness into ast::Constness. 2019-11-10 12:21:11 +01:00
Camille GILLOT
ed640c6a27 Merge hir::Mutability into ast::Mutability. 2019-11-10 12:21:05 +01:00
Nadrieril
fd9921b41c tidy 2019-11-10 10:56:06 +00:00
Oliver Scherer
39fb820820 Undo an assert causing an ICE until we fix the problem properly 2019-11-10 11:19:55 +01:00
Nadrieril
369a351010 Inline constructor_sub_pattern_tys
It was only used at a single location
2019-11-10 10:05:16 +00:00
Guanqun Lu
8d56bcc59c download .tar.xz if python3 is used 2019-11-10 16:34:31 +08:00