Commit Graph

150877 Commits

Author SHA1 Message Date
Camille GILLOT
aa1bc5874e Fix AST pretty. 2021-06-30 20:53:10 +02:00
Camille GILLOT
2f28737ebe Move AST crate. 2021-06-30 20:53:10 +02:00
Camille GILLOT
c520cf2253 Arena-allocate Crate during lowering. 2021-06-30 20:31:56 +02:00
Camille GILLOT
e05cd155fe Move lowering to create_global_ctxt. 2021-06-30 20:31:55 +02:00
Camille GILLOT
b80f720a2a Inline lower_to_hir. 2021-06-30 20:31:54 +02:00
Camille GILLOT
18c10fb1a6 Separate resolver creation from expansion. 2021-06-30 20:31:53 +02:00
Camille GILLOT
5f98e5ee56 Simplify DepGraph creation. 2021-06-30 20:31:52 +02:00
Cameron Steffen
2a60f090b9 Add suggestion for missing compile flag group 2021-06-30 13:28:15 -05:00
bors
cadb93b6de Auto merge of #7400 - popzxc:restrict-locales, r=Manishearth
New lint: `disallowed_script_idents`

This PR implements a new lint to restrict locales that can be used in the code,
as proposed in #7376.

Current concerns / unresolved questions:

- ~~Mixed usage of `script` (as a Unicode term) and `locale` (as something that is easier to understand for the broad audience). I'm not sure whether these terms are fully interchangeable and whether in the current form it is more confusing than helpful.~~ `script` is now used everywhere.
- ~~Having to mostly copy-paste `AllowedScript`. Probably it's not a big problem, as the list of scripts is standardized and is unlikely to change, and even if we'd stick to the `unicode_script::Script`, we'll still have to implement custom deserialization, and I don't think that it will be shorter in terms of the amount of LoC.~~ `unicode::Script` is used together with a filtering deserialize function.
- Should we stick to the list of "recommended scripts" from [UAX #31](http://www.unicode.org/reports/tr31/#Table_Recommended_Scripts) in the configuration?

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: ``[`disallowed_script_idents`]``

r? `@Manishearth`
2021-06-30 18:14:16 +00:00
Daniel Paoliello
aac8a88552 Improve debug symbol names to avoid ambiguity and work better with MSVC's debugger
There are several cases where names of types and functions in the debug info are either ambiguous, or not helpful, such as including ambiguous placeholders (e.g., `{{impl}}`, `{{closure}}` or `dyn _'`) or dropping qualifications (e.g., for dynamic types).

Instead, each debug symbol name should be unique and useful:
* Include disambiguators for anonymous `DefPathDataName` (closures and generators), and unify their formatting when used as a path-qualifier vs item being qualified.
* Qualify the principal trait for dynamic types.
* If there is no principal trait for a dynamic type, emit all other traits instead.
* Respect the `qualified` argument when emitting ref and pointer types.
* For implementations, emit the disambiguator.
* Print const generics when emitting generic parameters or arguments.

Additionally, when targeting MSVC, its debugger treats many command arguments as C++ expressions, even when the argument is defined to be a symbol name. As such names in the debug info need to be more C++-like to be parsed correctly:
* Avoid characters with special meaning (`#`, `[`, `"`, `+`).
* Never start a name with `<` or `{` as this is treated as an operator.
* `>>` is always treated as a right-shift, even when parsing generic arguments (so add a space to avoid this).
* Emit function declarations using C/C++ style syntax (e.g., leading return type).
* Emit arrays as a synthetic `array$<type, size>` type.
* Include a `$` in all synthetic types as this is a legal character for C++, but not Rust (thus we avoid collisions with user types).
2021-06-30 11:10:29 -07:00
Miguel Ojeda
7c9445d4a7 alloc: RawVec<T, A>::shrink can be in no_global_oom_handling.
Found in https://github.com/Rust-for-Linux/linux/pull/402.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2021-06-30 19:42:41 +02:00
Simonas Kazlauskas
9b67cba4f6 Add support for leaf fn frame pointer elimination
This PR adds ability for the target specifications to specify frame
pointer emission type that's not just “always” or “whatever cg decides”.

In particular there's a new mode that allows omission of the frame
pointer for leaf functions (those that don't call any other functions).

We then set this new mode for Aarch64-based Apple targets.

Fixes #86196
2021-06-30 19:45:17 +03:00
Smittyvb
12a8d106f6
Note that even ConstProp follows the rules
Co-authored-by: Ralf Jung <post@ralfj.de>
2021-06-30 12:42:04 -04:00
Smitty
4c934df45f Properly evaluate non-consts in const prop 2021-06-30 12:38:12 -04:00
Fabian Wolff
0c267830d5 Match on hir::TraitFn::Provided instead of using maybe_body_owned_by 2021-06-30 18:27:07 +02:00
Igor Aleksanov
018be41dee Implement 'disallowed_script_idents' lint 2021-06-30 19:06:33 +03:00
Deadbeef
c424510746
Add tests for cross-crate usage of impl const 2021-06-30 23:57:17 +08:00
Deadbeef
3b9453bfe2
use is_const_fn_raw when encoding constness
this properly encodes cross-crate constness data.
2021-06-30 23:56:43 +08:00
Smitty
9f227945f1 Simplify memory failure checking 2021-06-30 11:24:52 -04:00
bors
3525a6b61a Auto merge of #7390 - popzxc:issue-7331, r=flip1995
Improve lint message for match-same-arms lint

fixes #7331

Follow-up to #7377

This PR improves the lint message for `match-same-arms` lint and adds `todo!(..)`  example to the lint docs.

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: None
2021-06-30 15:12:55 +00:00
bors
868c702d0c Auto merge of #86695 - sexxi-goose:closure_size, r=nikomatsakis
Introduce -Zprofile-closures to evaluate the impact of 2229

This creates a CSV with name "closure_profile_XXXXX.csv", where the
variable part is the process id of the compiler.

To profile a cargo project you can run one of the following depending on
if you're compiling a library or a binary:

```
cargo +nightly rustc --lib -- -Zprofile-closures
cargo +nightly rustc --bin {binary_name} -- -Zprofile-closures
```

r? `@nikomatsakis`
2021-06-30 13:42:50 +00:00
Smitty
ba542eebc0 Rename is_spurious -> is_volatile 2021-06-30 09:27:30 -04:00
Smittyvb
55379bb7ea
simplify explanation comment
Co-authored-by: Ralf Jung <post@ralfj.de>
2021-06-30 09:07:47 -04:00
Guillaume Gomez
855923c895 Add test to ensure that the typed queries are not including other types 2021-06-30 14:20:17 +02:00
Guillaume Gomez
7b62d28cf2 Enforce search typed queries 2021-06-30 14:11:09 +02:00
Fabian Wolff
11fd8579e4 Emit explanatory note for functions in trait and impl items as well 2021-06-30 13:56:26 +02:00
bors
5d34076975 Auto merge of #86650 - GuillaumeGomez:fix-boldness, r=Nemo157
Fix boldness (put it back where needed)

I realized that I created a GUI test that wasn't run because it had ".rs" extension instead of ".goml" so I moved its content into `font-weight.goml` (since it was checking font weight).
2021-06-30 10:54:08 +00:00
bors
7ede6e2a23 Auto merge of #86739 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/86723
Cc `@rust-lang/miri` r? `@ghost`
2021-06-30 07:28:42 +00:00
Ralf Jung
80fa596145 update Miri 2021-06-30 09:21:20 +02:00
1000teslas
fe822fe64d copy rust-lld as ld in dist 2021-06-30 16:30:40 +10:00
bors
51fd129ac1 Auto merge of #86689 - rylev:future-compat-lint-group, r=nikomatsakis
Only include lint in future_incompatible lint group if not an edition lint

A follow up to #86330 - this only includes lints annotated with `FutureIncompatibleInfo` in the `future_incompatibile` lint group if the future compatibility is not tied to an edition.

We probably want to rename `FutureIncompatibleInfo` to something else since this type is now used to indicate future breakages of all kinds (even those that happen in editions). I'd prefer to do that in a separate PR though.

r? `@nikomatsakis`
2021-06-30 05:02:01 +00:00
Joshua Nelson
81f3ab6bca Use a macro for documenting rustdoc 2021-06-29 23:05:02 -04:00
bors
9af4bdeab0 Auto merge of #86724 - cuviper:indexmap-1.7, r=Mark-Simulacrum
Upgrade to indexmap 1.7, using hashbrown 0.11
2021-06-30 02:20:50 +00:00
Smitty
d04da1125d Properly handle const prop failures 2021-06-29 20:22:32 -04:00
Aaron Hill
1f7cb16fce
Return EvaluatedToOk when type in outlives predicate is global
A global type doesn't reference any local regions or types, so it's
guaranteed to outlive any region.
2021-06-29 19:21:13 -05:00
bors
0ce21126b2 Auto merge of #86522 - JohnTitor:move-ui-tests, r=petrochenkov
Move some UI tests to more suitable subdirs

cc #73494
The classified result is here: https://gist.github.com/JohnTitor/c9e00840990b5e4a8fc562ec3571e427

- issues/issue-27060.rs: misclassified, should be packed.
- issues/issue-45157.rs: moved to nll.
- issues/issue-69532.rs: ~~couldn't figured out the best place, placed a new `llvm` dir~~ moved to consts.
- fsu-moves-and-copies.rs: moved to borrowck.
- issues/issue-36638.rs: misclassified, moved to keyword.
- issues/issue-48636.rs: moved to parser.
- issues/issue-37655.rs: I'm not sure but associated-types shouldn't the best, moved to coercion but region may be better.
- issues/issue-20005.rs: moved to associated-types.
- issues/issue-82869.rs: moved to asm.
- issues/issue-24535-allow-mutable-borrow-in-match-guard.rs: moved to nll.
- issues/issue-52169.rs: moved to macros.
- test-passed.rs: moved to test-attrs along with `test-` prefixed tests.
  - test-cfg.rs: moved to conditional-compilation.
- non-integer-atomic.rs: moved to intrinsics.
- issues/issue-54521-2.rs: moved to parser.
- issues/issue-17756.rs: moved to consts.
- conversion-methods.rs: ~~moved to suggestions~~ moved to typeck.

r? `@petrochenkov`
2021-06-29 23:40:00 +00:00
Smitty
c94bafb69b fix sess error
This passed x.py check locally, not sure why it wasn't rebased right...
2021-06-29 19:17:14 -04:00
Smitty
ab66c3fbd4 Add comment with reasoning for non-determinism 2021-06-29 19:08:30 -04:00
Smitty
a59fafeb13 Test memory exhaustion in const evaluation 2021-06-29 19:08:30 -04:00
Smitty
3e735a52fe Unwrap allocated Location at creation 2021-06-29 19:08:29 -04:00
Smitty
43b55cf893 Simplify allocation creation 2021-06-29 19:08:29 -04:00
Smitty
dc1c6c3a25 Make memory exhaustion a hard error 2021-06-29 19:08:29 -04:00
Smitty
b40f3c1060 Simplify const_prop logic 2021-06-29 19:08:29 -04:00
Smitty
524e575bb4 Support allocation failures when interperting MIR
Note that this breaks Miri.

Closes #79601
2021-06-29 19:08:26 -04:00
Yuki Okushi
2c6268678d
Move some UI tests to more suitable subdirs 2021-06-30 06:41:10 +09:00
bors
6d820866a2 Auto merge of #86725 - JohnTitor:normalizecss-8, r=GuillaumeGomez
Upgrade normalize.css to v8.0.1

Fixes #86629, this addresses #82548 and #82542 with tweaks. I expect that this changes the style *slightly* but shouldn't have any major changes.
Here's some changes I observed, I'd say they all are an improvement.

<details>
<summary>Before</summary>

![before 1](https://user-images.githubusercontent.com/25030997/123854746-0fc84800-d95a-11eb-8484-ea86dfe0ae14.png)
![before 2](https://user-images.githubusercontent.com/25030997/123854754-135bcf00-d95a-11eb-8cca-f49994629e08.png)

</details>

<details>
<summary>After</summary>

![after 1](https://user-images.githubusercontent.com/25030997/123854809-21115480-d95a-11eb-9dd2-0d3b9ca45edd.png)
![after 2](https://user-images.githubusercontent.com/25030997/123854818-22428180-d95a-11eb-83aa-fb5a698124f9.png)

</details>

r? `@jsha`
2021-06-29 20:59:14 +00:00
Fabian Wolff
2586e962e0 Check node kind to avoid ICE in check_expr_return() 2021-06-29 22:20:06 +02:00
Yuki Okushi
510107815f
Fix some style regressions due to normalize.css 8 2021-06-30 04:13:46 +09:00
Yuki Okushi
66430652d1
Upgrade normalize.css to v8.0.1 2021-06-30 04:13:16 +09:00
Josh Stone
ae9713a399 Upgrade to indexmap 1.7, using hashbrown 0.11 2021-06-29 11:38:16 -07:00