Commit Graph

103218 Commits

Author SHA1 Message Date
Ralf Jung
7f20198632 pass Queries to compiler callbacks 2019-11-30 10:16:19 +01:00
David Tolnay
f34990e9b5
Remove unneeded prelude imports in libcore tests
These three lines are from c82da7a54b in
2015.

They cause problems when applying rustfmt to the codebase, because
reordering wildcard imports can trigger new unused import warnings.

As a minimized example, the following program compiles successfully:

    #![deny(unused_imports)]

    use std::fmt::Debug;
    use std::marker::Send;

    pub mod repro {
        use std::prelude::v1::*;
        use super::*;

        pub type D = dyn Debug;
        pub type S = dyn Send;
    }

    pub type S = dyn Send;

but putting it through rustfmt produces a program that fails to compile:

    #![deny(unused_imports)]

    use std::fmt::Debug;
    use std::marker::Send;

    pub mod repro {
        use super::*;
        use std::prelude::v1::*;

        pub type D = dyn Debug;
        pub type S = dyn Send;
    }

    pub type S = dyn Send;

The error is:

    error: unused import: `std::prelude::v1::*`
     --> src/main.rs:8:9
      |
    8 |     use std::prelude::v1::*;
      |         ^^^^^^^^^^^^^^^^^^^
2019-11-29 23:16:46 -08:00
Mazdak Farrokhzad
ded177a06a derive(Default) for Features 2019-11-30 07:44:50 +01:00
Mazdak Farrokhzad
79077f13ff move GateIssue to rustc_feature & simplify emit_feature_err 2019-11-30 07:40:28 +01:00
Mazdak Farrokhzad
91fcd40ca2 update rustc_feature crate docs 2019-11-30 06:43:32 +01:00
Mazdak Farrokhzad
b756b7d074 tidy: adjust feature gating path 2019-11-30 06:32:49 +01:00
David Tolnay
1c4d453969
Format liballoc with rustfmt 2019-11-29 20:25:07 -08:00
David Tolnay
28eb31f8dc
Make libcore/unicode/tables.rs compatible with rustfmt 2019-11-29 20:17:11 -08:00
David Tolnay
f4cff27792
Make libcore/unicode/printable.rs compatible with rustfmt 2019-11-29 20:17:10 -08:00
David Tolnay
d353a4c267
Make dec2flt_table compatible with rustfmt 2019-11-29 20:17:09 -08:00
cad97
52426ab42d
Use recursion_limit for const eval stack limit 2019-11-29 22:49:39 -05:00
David Tolnay
b14d9c2120
Rollup merge of #66847 - dtolnay:_fmt, r=joshtriplett
Allow any identifier as format arg name

Previously:

```console
error: invalid format string: invalid argument name `_x`
 --> src/main.rs:2:16
  |
2 |     println!("{_x}", _x=0);
  |                ^^ invalid argument name in format string
  |
  = note: argument names cannot start with an underscore
```

Not supporting identifiers starting with underscore appears to have been an arbitrary limitation from 2013 in code that was most likely never reviewed: https://github.com/rust-lang/rust/pull/8245/files#diff-0347868ef389c805e97636623e4a4ea6R277

The error message was dutifully improved in #50610 but is there any reason that leading underscore would be a special case?

This commit updates the format_args parser to accept identifiers with leading underscores.
2019-11-29 18:46:09 -08:00
David Tolnay
27710d28b7
Rollup merge of #66820 - dtolnay:fmt3, r=Dylan-DPC
Format libstd with rustfmt

(Same strategy as #66691.)

This commit applies rustfmt with rust-lang/rust's default settings to files in src/libstd *that are not involved in any currently open PR* to minimize merge conflicts, and are not part of libstd/os (#66818) or libstd/sys (#66819). The list of files involved in open PRs was determined by querying GitHub's GraphQL API [with this script](https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8).

With the list of files from the script in outstanding_files, the relevant commands were:

    $ find src/libstd -name '*.rs' \
        | xargs rustfmt --edition=2018 --unstable-features --skip-children
    $ rg libstd outstanding_files | xargs git checkout --

Repeating this process several months apart should get us coverage of most of the rest of libstd.

To confirm no funny business:

    $ git checkout $THIS_COMMIT^
    $ git show --pretty= --name-only $THIS_COMMIT \
        | xargs rustfmt --edition=2018 --unstable-features --skip-children
    $ git diff $THIS_COMMIT  # there should be no difference
2019-11-29 18:46:08 -08:00
David Tolnay
77b5a05026
Rollup merge of #66819 - dtolnay:fmt2, r=kennytm
Format libstd/sys with rustfmt

(Same strategy as #66691.)

This commit applies rustfmt with rust-lang/rust's default settings to files in src/libstd/sys *that are not involved in any currently open PR* to minimize merge conflicts. The list of files involved in open PRs was determined by querying GitHub's GraphQL API [with this script](https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8).

With the list of files from the script in outstanding_files, the relevant commands were:

    $ find src/libstd/sys -name '*.rs' \
        | xargs rustfmt --edition=2018 --unstable-features --skip-children
    $ rg libstd/sys outstanding_files | xargs git checkout --

Repeating this process several months apart should get us coverage of most of the rest of the files.

To confirm no funny business:

    $ git checkout $THIS_COMMIT^
    $ git show --pretty= --name-only $THIS_COMMIT \
        | xargs rustfmt --edition=2018 --unstable-features --skip-children
    $ git diff $THIS_COMMIT  # there should be no difference
2019-11-29 18:46:06 -08:00
David Tolnay
34f2c2def4
Rollup merge of #66818 - dtolnay:fmt1, r=Dylan-DPC
Format libstd/os with rustfmt

(Same strategy as #66691.)

This commit applies rustfmt with rust-lang/rust's default settings to files in src/libstd/os *that are not involved in any currently open PR* to minimize merge conflicts. The list of files involved in open PRs was determined by querying GitHub's GraphQL API [with this script](https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8).

With the list of files from the script in outstanding_files, the relevant commands were:

    $ find src/libstd/os -name '*.rs' \
        | xargs rustfmt --edition=2018 --unstable-features --skip-children
    $ rg libstd/os outstanding_files | xargs git checkout --

Repeating this process several months apart should get us coverage of most of the rest of the files.

To confirm no funny business:

    $ git checkout $THIS_COMMIT^
    $ git show --pretty= --name-only $THIS_COMMIT \
        | xargs rustfmt --edition=2018 --unstable-features --skip-children
    $ git diff $THIS_COMMIT  # there should be no difference
2019-11-29 18:46:05 -08:00
David Tolnay
9ad0850707
Bless ui test for libstd reformat 2019-11-29 18:43:27 -08:00
David Tolnay
4436c9d354
Format libstd with rustfmt
This commit applies rustfmt with rust-lang/rust's default settings to
files in src/libstd *that are not involved in any currently open PR* to
minimize merge conflicts. THe list of files involved in open PRs was
determined by querying GitHub's GraphQL API with this script:
https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8

With the list of files from the script in outstanding_files, the
relevant commands were:

    $ find src/libstd -name '*.rs' \
        | xargs rustfmt --edition=2018 --unstable-features --skip-children
    $ rg libstd outstanding_files | xargs git checkout --

Repeating this process several months apart should get us coverage of
most of the rest of libstd.

To confirm no funny business:

    $ git checkout $THIS_COMMIT^
    $ git show --pretty= --name-only $THIS_COMMIT \
        | xargs rustfmt --edition=2018 --unstable-features --skip-children
    $ git diff $THIS_COMMIT  # there should be no difference
2019-11-29 18:43:27 -08:00
David Tolnay
c34fbfaad3
Format libstd/sys with rustfmt
This commit applies rustfmt with rust-lang/rust's default settings to
files in src/libstd/sys *that are not involved in any currently open PR*
to minimize merge conflicts. THe list of files involved in open PRs was
determined by querying GitHub's GraphQL API with this script:
https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8

With the list of files from the script in outstanding_files, the
relevant commands were:

    $ find src/libstd/sys -name '*.rs' \
        | xargs rustfmt --edition=2018 --unstable-features --skip-children
    $ rg libstd/sys outstanding_files | xargs git checkout --

Repeating this process several months apart should get us coverage of
most of the rest of the files.

To confirm no funny business:

    $ git checkout $THIS_COMMIT^
    $ git show --pretty= --name-only $THIS_COMMIT \
        | xargs rustfmt --edition=2018 --unstable-features --skip-children
    $ git diff $THIS_COMMIT  # there should be no difference
2019-11-29 18:37:58 -08:00
David Tolnay
60091ee826
Format libstd/os with rustfmt
This commit applies rustfmt with rust-lang/rust's default settings to
files in src/libstd/os *that are not involved in any currently open PR*
to minimize merge conflicts. THe list of files involved in open PRs was
determined by querying GitHub's GraphQL API with this script:
https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8

With the list of files from the script in outstanding_files, the
relevant commands were:

    $ find src/libstd/os -name '*.rs' \
        | xargs rustfmt --edition=2018 --unstable-features --skip-children
    $ rg libstd/os outstanding_files | xargs git checkout --

Repeating this process several months apart should get us coverage of
most of the rest of the files.

To confirm no funny business:

    $ git checkout $THIS_COMMIT^
    $ git show --pretty= --name-only $THIS_COMMIT \
        | xargs rustfmt --edition=2018 --unstable-features --skip-children
    $ git diff $THIS_COMMIT  # there should be no difference
2019-11-29 18:32:46 -08:00
Mazdak Farrokhzad
9626181494 check.rs: inline a constant 2019-11-30 03:30:49 +01:00
bors
8f1bbd69e1 Auto merge of #66873 - RalfJung:miri-args, r=dtolnay
really_init cmdline args on Miri

r? @joshtriplett

Closes #66862.
2019-11-30 02:12:19 +00:00
Mazdak Farrokhzad
b45f21d38e move UnstableFeatures -> rustc_feature 2019-11-30 02:50:47 +01:00
Mazdak Farrokhzad
db89679ebc inline two explanation constants 2019-11-30 02:40:45 +01:00
Mazdak Farrokhzad
70234f16df builtin_attrs.rs -> rustc_feature 2019-11-30 02:34:18 +01:00
Mazdak Farrokhzad
d04b838a44 move is_builtin_attr to syntax::attr 2019-11-30 02:20:07 +01:00
Mazdak Farrokhzad
4d9fde59ae builtin_attrs: inline some strings 2019-11-30 02:03:32 +01:00
Mazdak Farrokhzad
6cab02cf14 simplify gated cfgs logic 2019-11-30 01:57:53 +01:00
Mazdak Farrokhzad
8ad4d15f38 move AttributeTemplate to builtin_attrs 2019-11-30 00:56:46 +01:00
Mazdak Farrokhzad
048201fa7a move Stability to rustc_feature 2019-11-30 00:39:51 +01:00
Eduard-Mihai Burtescu
a9976d89ed rustc: move mir::SourceScopeLocalData to a field of SourceScopeData. 2019-11-30 01:37:42 +02:00
Eduard-Mihai Burtescu
78d85fcf52 rustc_mir: fix inliner to also copy over source_scope_local_data. 2019-11-30 01:36:51 +02:00
Eduard-Mihai Burtescu
30a9978c6c rustc: move MIR source_scope_local_data's ClearCrossCrate to be around elements. 2019-11-30 01:36:51 +02:00
Mazdak Farrokhzad
3d080a4a77 introduce crate rustc_feature and move active, accepted, and removed to it 2019-11-30 00:25:40 +01:00
Eduard-Mihai Burtescu
584ede5f30 rustc_typeck: gate AnonConst's generics on feature(const_generics). 2019-11-30 01:15:15 +02:00
Eduard-Mihai Burtescu
de30d31976 rustc: fix ty::Const::eval's handling of inference variables. 2019-11-30 01:13:47 +02:00
Nixon
f8fb24f18f Add explanation message for E0203 2019-11-29 22:42:38 +00:00
bors
9081929d45 Auto merge of #66879 - RalfJung:rollup-nprxpzi, r=RalfJung
Rollup of 11 pull requests

Successful merges:

 - #66379 (Rephrase docs in for ptr)
 - #66589 (Draw vertical lines correctly in compiler error messages)
 - #66613 (Allow customising ty::TraitRef's printing behavior)
 - #66766 (Panic machinery comments and tweaks)
 - #66791 (Handle GlobalCtxt directly from librustc_interface query system)
 - #66793 (Record temporary static references in generator witnesses)
 - #66808 (Cleanup error code)
 - #66826 (Clarifies how to tag users for assigning PRs)
 - #66837 (Clarify `{f32,f64}::EPSILON` docs)
 - #66844 (Miri: do not consider memory allocated by caller_location leaked)
 - #66872 (Minor documentation fix)

Failed merges:

r? @ghost
2019-11-29 22:00:28 +00:00
Ralf Jung
0b1b36ccb6
Rollup merge of #66872 - Mikotochan:patch-1, r=jonas-schievink
Minor documentation fix

Fixed the documentation for any as is a trait rather than a type.
2019-11-29 22:57:44 +01:00
Ralf Jung
0f6745d6e2
Rollup merge of #66844 - RalfJung:caller-location-leak, r=oli-obk
Miri: do not consider memory allocated by caller_location leaked

Fixes https://github.com/rust-lang/miri/issues/1071

r? @oli-obk

I am not sure if this is the best approach, but it certainly is the easiest.
2019-11-29 22:57:42 +01:00
Ralf Jung
395937823c
Rollup merge of #66837 - ohadravid:epsilon-doc, r=dtolnay
Clarify `{f32,f64}::EPSILON` docs

The doc for `EPSILON` says:
>  This is the difference between `1.0` and the next **largest** representable number.

Which is a bit unclear.

[Wikipedia](https://en.wikipedia.org/wiki/Machine_epsilon) says
> Machine epsilon is defined as the difference between 1 and the next **larger** floating point number

So this PR update the docs to match the Wikipedia version.

The original PR also has this in a [comment](https://github.com/rust-lang/rust/pull/50919#discussion_r192600209).
2019-11-29 22:57:41 +01:00
Ralf Jung
5c90811814
Rollup merge of #66826 - mlodato517:mlodato517-clarify-pr-message-assigner, r=Dylan-DPC
Clarifies how to tag users for assigning PRs

Clarifies language of where to put `r?` text to assign a particular user. Mostly a follow up of [this discussion](https://github.com/rust-lang/rust/pull/66797#issuecomment-559153444).
2019-11-29 22:57:39 +01:00
Ralf Jung
0f6e6363fc
Rollup merge of #66808 - GuillaumeGomez:cleanup-err-code-3, r=Dylan-DPC
Cleanup error code

r? @Dylan-DPC
2019-11-29 22:57:38 +01:00
Ralf Jung
37c1f52b43
Rollup merge of #66793 - matthewjasper:record-static-refs, r=cramertj
Record temporary static references in generator witnesses

Closes #66695

* Record the pointer to static's type in MIR.
* Normalize the static's type (so that constants can be compared correctly).
2019-11-29 22:57:36 +01:00
Ralf Jung
6ea1df2340
Rollup merge of #66791 - cjgillot:arena, r=Mark-Simulacrum
Handle GlobalCtxt directly from librustc_interface query system

This PR constructs the `GlobalCtxt` as a member of the `Queries` in librustc_interface.
This simplifies the code to construct it, at the expense of added complexity in the query control flow.
This allows to handle the arenas directly from librustc_interface.

Based on #66707

r? @Zoxc
2019-11-29 22:57:34 +01:00
Ralf Jung
56203be06f
Rollup merge of #66766 - RalfJung:panic-comments, r=SimonSapin
Panic machinery comments and tweaks

This is mostly more comments, but I also renamed some things:
* `BoxMeUp::box_me_up` is not terribly descriptive, and since this is a "take"-style method (the argument is `&mut self` but the return type is fully owned, even though you can't tell from the type) I chose a name involving "take".
* `continue_panic_fmt` was very confusing as it was entirely unclear what was being continued -- for some time I thought "continue" might be the same as "resume" for a panic, but that's something entirely different. So I renamed this to `begin_panic_handler`, matching the `begin_panic*` theme of the other entry points.

r? @Dylan-DPC @SimonSapin
2019-11-29 22:57:33 +01:00
Ralf Jung
64efc45bb9
Rollup merge of #66613 - Areredify:trait-ref-print, r=eddyb
Allow customising ty::TraitRef's printing behavior

This pr allows to explicitly choose which representation of `TraitRef` (`<T as Trait<U>>` or `Trait<U>`) you want to print. `Debug` and `Display` representations of `TraitRef` now match.

Closes #59188.
2019-11-29 22:57:31 +01:00
Ralf Jung
7b75a360f6
Rollup merge of #66589 - TheSamsa:master, r=Dylan-DPC
Draw vertical lines correctly in compiler error messages

... with multiline annotations correctly when non-1space unicode characters are to the left

For this we use the correct calculation of the 'left' identation

closes #66552
2019-11-29 22:57:30 +01:00
Ralf Jung
764ef8c81f
Rollup merge of #66379 - CreepySkeleton:patch-1, r=RalfJung
Rephrase docs in for ptr

These methods can be supplied with NULL just fine, this is the whole point of `Option<&T>` return type.
2019-11-29 22:57:28 +01:00
Tomasz Miąsko
45c4e11e43 SimplifyArmIdentity only for locals with the same type
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-29 20:13:54 +01:00
Ralf Jung
f621c252ec really_init cmdline args on Miri 2019-11-29 20:07:55 +01:00