Commit graph

138521 commits

Author SHA1 Message Date
Tomasz Miąsko
64b5b75e65 Use !Sync std::lazy::OnceCell in usefulness checking
The `rustc_data_structures::sync::OnceCell` is thread-safe when building
a parallel compiler. This is unnecessary for the purposes of pattern
usefulness checking. Use `!Sync` `std::lazy::OnceCell` instead.
2021-02-15 00:00:00 +00:00
Steven Fackler
4613b3764c Stabilize Arguments::as_str
Closes #74442
2021-02-14 17:48:51 -05:00
lukaslueg
3d7fcfff76
Update library/core/src/macros/mod.rs
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2021-02-14 23:33:43 +01:00
bors
9503ea19ed Auto merge of #82103 - Dylan-DPC:rollup-5wv8rid, r=Dylan-DPC
Rollup of 11 pull requests

Successful merges:

 - #80523 (#[doc(inline)] sym_generated)
 - #80920 (Visit more targets when validating attributes)
 - #81720 (Updated smallvec version due to RUSTSEC-2021-0003)
 - #81891 ([rustdoc-json] Make `header` a vec of modifiers, and FunctionPointer consistent)
 - #81912 (Implement the precise analysis pass for lint `disjoint_capture_drop_reorder`)
 - #81914 (Fixing bad suggestion for `_` in `const` type when a function #81885)
 - #81919 (BTreeMap: fix internal comments)
 - #81927 (Add a regression test for #32498)
 - #81965 (Fix MIR pretty printer for non-local DefIds)
 - #82029 (Use debug log level for developer oriented logs)
 - #82056 (fix ice (#82032))

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-02-14 22:26:21 +00:00
Mara Bos
1aa965101c Fix typo in link to CreateSymbolicLinkW documentation. 2021-02-14 23:16:45 +01:00
Lukas Lueg
dee54244a6 Add missing env!-decl variant
Resolves #82117
2021-02-14 22:39:47 +01:00
Giles Cope
845c14db05
Simpler way to convert to digit 2021-02-14 17:06:16 +00:00
Vadim Petrochenkov
6e11a8b66a expand: Remove redundant calls to configure
Starting from https://github.com/rust-lang/rust/pull/63468 cfg attributes on variants, fields, fn params etc. are processed together with other attributes (via `configure!`).
2021-02-14 19:47:00 +03:00
Vadim Petrochenkov
18c94b3edd expand: Remove obsolete ExpansionConfig::keep_macs
Maybe it was used before the introduction of placeholders, but now it has no effect.
2021-02-14 19:43:54 +03:00
Vadim Petrochenkov
0038eaee6b rustc_span: Remove obsolete allow_internal_unstable_backcompat_hack 2021-02-14 19:42:55 +03:00
Simonas Kazlauskas
fa3621b468 Don't fail to remove files if they are missing
In the backend we may want to remove certain temporary files, but in
certain other situations these files might not be produced in the first
place. We don't exactly care about that, and the intent is really that
these files are gone after a certain point in the backend.

Here we unify the backend file removing calls to use `ensure_removed`
which will attempt to delete a file, but will not fail if it does not
exist (anymore).

The tradeoff to this approach is, of course, that we may miss instances
were we are attempting to remove files at wrong paths due to some bug –
compilation would silently succeed but the temporary files would remain
there somewhere.
2021-02-14 18:31:57 +02:00
Joshua Nelson
c583860126 Remove unnecessary Option in default_doc
Previously, there two different ways to encode the same info: `None` or
`Some(&[])`. Now there is only one way, `&[]`.
2021-02-14 11:31:35 -05:00
Dylan DPC
bcb14035e9
Rollup merge of #82056 - b-naber:mut_for_loop_bug, r=oli-obk
fix ice (#82032)

Fixes https://github.com/rust-lang/rust/issues/82032
2021-02-14 16:54:53 +01:00
Dylan DPC
c8dacf95ae
Rollup merge of #82029 - tmiasko:debug, r=matthewjasper
Use debug log level for developer oriented logs

The information logged here is of limited general interest, while at the
same times makes it impractical to simply enable logging and share the
resulting logs due to the amount of the output produced.

Reduce log level from info to debug for developer oriented information.

For example, when building cargo, this reduces the amount of logs
generated by `RUSTC_LOG=info cargo build` from 265 MB to 79 MB.

Continuation of changes from 81350.
2021-02-14 16:54:52 +01:00
Dylan DPC
2efde8c795
Rollup merge of #81965 - osa1:issue81200, r=oli-obk
Fix MIR pretty printer for non-local DefIds

Tries to fix #81200 -- the reproducer in the issue is not fixed yet.
Submitting PR to get feedback.

r? oli-obk
2021-02-14 16:54:51 +01:00
Dylan DPC
91889fc555
Rollup merge of #81927 - vandenheuvel:issue_32498, r=Mark-Simulacrum
Add a regression test for #32498

[This](https://github.com/rust-lang/rust/issues/32498#issuecomment-613626968) test mentioned at issue #32498 now passes. This PR adds this regression test.
2021-02-14 16:54:50 +01:00
Dylan DPC
4e888bf403
Rollup merge of #81919 - ssomers:btree_cleanup_comments, r=Mark-Simulacrum
BTreeMap: fix internal comments

Salvaged from #81372

r? `@Mark-Simulacrum`
2021-02-14 16:54:49 +01:00
Dylan DPC
a6809d00ae
Rollup merge of #81914 - kper:fixing-81885, r=estebank
Fixing bad suggestion for `_` in `const` type when a function #81885

Closes #81885

```
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
  --> $DIR/typeck_type_placeholder_item_help.rs:13:22
   |
LL | const TEST4: fn() -> _ = 42;
   |                      ^
   |                      |
   |                      not allowed in type signatures
   |                      help: use type parameters instead: `T`
```

Do not show the suggestion `help: use type parameters instead: T` when `fn`
2021-02-14 16:54:47 +01:00
Dylan DPC
25315635ef
Rollup merge of #81912 - sexxi-goose:Migrations2_review, r=nikomatsakis
Implement the precise analysis pass for lint `disjoint_capture_drop_reorder`

The precision pass for the lint prevents the lint from triggering for a variable (that was previously entirely captured by the closure) if all paths that need Drop starting at root variable have been captured by the closure.

r? `@nikomatsakis`
2021-02-14 16:54:46 +01:00
Dylan DPC
641c3785dc
Rollup merge of #81891 - CraftSpider:fn-header, r=jyn514
[rustdoc-json] Make `header` a vec of modifiers, and FunctionPointer consistent

Bumps version number and adds tests, this is a breaking change. I can split this into two (`is_unsafe` -> `header` and `header: Vec<Modifiers>`) if desired.

Rationale: Modifiers are individual notes on a function, it makes more sense for them to be a list of an independent enum over a String which is inconsistently exposing the HIR representation (prefix_str vs custom literals).
Function pointers currently only support `unsafe`, but there has been talk on and off about allowing them to also support `const`, and this makes handling their modifiers consistent with handling those of a function, allowing better shared code.

`@rustbot` modify labels: +A-rustdoc-json +T-rustdoc
CC: `@HeroicKatora`
r? `@jyn514`
2021-02-14 16:54:45 +01:00
Dylan DPC
e3b2655c3a
Rollup merge of #81720 - klensy:smallvec-update, r=Mark-Simulacrum
Updated smallvec version due to RUSTSEC-2021-0003

Hi.

Updated Cargo.toml's for smallvec due to RUSTSEC-2021-0003 and Cargo.toml in separate commit.

Affected function `SmallVec::insert_many` looks like don't was used directly in rust, but can be somewhere in deps.

There should be some mechanism to not to do this kind of things manually, like dependabot. Actually, dependabot supports rust and can check security articles (at least that noted in description).
2021-02-14 16:54:44 +01:00
Dylan DPC
ac1d26bcd3
Rollup merge of #80920 - rylev:check_attr-refactor, r=davidtwco
Visit more targets when validating attributes

This begins to address #80048, allowing for additional validation of attributes.

There are more refactorings that can be done, though I think they should be tackled in additional PRs:
* ICE when a builtin attribute is encountered that is not checked
* Move some of the attr checking done `ast_validation` into `rustc_passes`
  * note that this requires a bit of additional refactoring, especially of extern items which currently parse attributes (and thus are a part of the AST) but do not possess attributes in their HIR representation.
* Rename `Target` to `AttributeTarget`
* Refactor attribute validation completely to go through `Visitor::visit_attribute`.
  * This would require at a minimum passing `Target` into this method which might be too big of a refactoring to be worth it.
  * It's also likely not possible to do all the validation this way as some validation requires knowing what other attributes a target has.

r? `@davidtwco`
2021-02-14 16:54:42 +01:00
Dylan DPC
29ed864dc3
Rollup merge of #80523 - LeSeulArtichaut:inline-sym, r=jyn514
#[doc(inline)] sym_generated

Manually doc-inlines `rustc_span::sym_generated` into `sym`.
Previously the docs would not get inlined, causing the symbols to be undocumented as `sym_generated` is private.

r? `@jyn514`
2021-02-14 16:54:35 +01:00
klensy
93c8ebe022 bumped smallvec deps 2021-02-14 18:03:11 +03:00
bors
5fa22fe6f8 Auto merge of #81286 - Aaron1011:collect-tokens-attrs, r=petrochenkov
Require passing an `AttrWrapper` to `collect_tokens_trailing_token`

This is a pure refactoring split out from #80689.
It represents the most invasive part of that PR, requiring changes in
every caller of `parse_outer_attributes`

In order to eagerly expand `#[cfg]` attributes while preserving the
original `TokenStream`, we need to know the range of tokens that
corresponds to every attribute target. This is accomplished by making
`parse_outer_attributes` return an opaque `AttrWrapper` struct. An
`AttrWrapper` must be converted to a plain `AttrVec` by passing it to
`collect_tokens_trailing_token`. This makes it difficult to accidentally
construct an AST node with attributes without calling `collect_tokens_trailing_token`,
since AST nodes store an `AttrVec`, not an `AttrWrapper`.

As a result, we now call `collect_tokens_trailing_token` for attribute
targets which only support inert attributes, such as generic arguments
and struct fields. Currently, the constructed `LazyTokenStream` is
simply discarded. Future PRs will record the token range corresponding
to the attribute target, allowing those tokens to be removed from an
enclosing `collect_tokens_trailing_token` call if necessary.
2021-02-14 15:00:52 +00:00
Takayuki Maeda
ba72bc9b83 fix typo 2021-02-14 21:18:17 +09:00
Ellen
7bd71262f8 param_env debugs are instrumental to rustc's success 2021-02-14 11:18:40 +00:00
bjorn3
d1a541e342 Add tests for Atomic*::fetch_{min,max} 2021-02-14 11:31:33 +01:00
Camelid
a9b16c6d71 Improve error and help messages 2021-02-13 21:42:32 -08:00
bors
b86674e7cc Auto merge of #81956 - ssomers:btree_post_75200, r=Mark-Simulacrum
BTree: remove outdated traces of coercions

The introduction of `marker::ValMut` (#75200) meant iterators no longer see mutable keys but their code still pretends it does. And settle on the majority style `Some(unsafe {…})` over `unsafe { Some(…) }`.

r? `@Mark-Simulacrum`
2021-02-14 04:53:24 +00:00
Henry Boisdequin
64fe2c183d update message 2021-02-14 10:08:37 +05:30
pierwill
1c3841ebf2 Edit rustc_arena::DropArena docs
- Add a "Safety" section, edit formatting for clarity
- Add missing punctuation in code comments
2021-02-13 16:04:18 -08:00
kadmin
be1ed00712 Add additional type info to mismatch err 2021-02-13 20:37:38 +00:00
bors
8e54a21139 Auto merge of #81238 - RalfJung:copy-intrinsics, r=m-ou-se
directly expose copy and copy_nonoverlapping intrinsics

This effectively un-does https://github.com/rust-lang/rust/pull/57997. That should help with `ptr::read` codegen in debug builds (and any other of these low-level functions that bottoms out at `copy`/`copy_nonoverlapping`), where the wrapper function will not get inlined. See the discussion in https://github.com/rust-lang/rust/pull/80290 and https://github.com/rust-lang/rust/issues/81163.

Cc `@bjorn3` `@therealprof`
2021-02-13 20:30:07 +00:00
Camille GILLOT
3fc8ed68e9 Check query cache before calling into the query engine. 2021-02-13 21:14:58 +01:00
Camille GILLOT
280a2866d5 Drop the cache lock earlier. 2021-02-13 21:14:58 +01:00
Camille GILLOT
15b0bc6b83 Separate the query cache from the query state. 2021-02-13 21:14:58 +01:00
Camille GILLOT
9f46259a75 Return a Result for query cache. 2021-02-13 21:14:58 +01:00
Camille GILLOT
f8ab649dfd Introduce query_storage. 2021-02-13 21:14:58 +01:00
Camille GILLOT
4b42a6d90b Introduce query_stored module. 2021-02-13 21:14:57 +01:00
Camille GILLOT
8684e9e47d Merge {get,ensure}_query. 2021-02-13 21:14:57 +01:00
Matthew Jasper
eeb82e45fe Add more tests for generic associated type bounds 2021-02-13 19:44:34 +00:00
Matthew Jasper
d785c8c447 Remove unnecessary function parameters project.rs 2021-02-13 19:30:07 +00:00
Matthew Jasper
dfee89f755 Make ProjectionTy::trait_ref truncate substs again
Also make sure that type arguments of associated types are printed in
some error messages.
2021-02-13 19:30:07 +00:00
Matthew Jasper
79f6f11816 Remove some unnecessary trait_ref calls 2021-02-13 19:30:07 +00:00
Matthew Jasper
9526c0c6e8 Avoid trait_ref when lowering ExistentialProjections 2021-02-13 19:30:07 +00:00
Matthew Jasper
0bf1d73d22 Don't go through TraitRef to relate projections 2021-02-13 19:30:07 +00:00
Matthew Jasper
9bbd3e0f8e Remove ProjectionTy::from_ref_and_name 2021-02-13 19:29:55 +00:00
Matthew Jasper
dfa581ff87 Fix pretty printing of generic associated type constraints 2021-02-13 19:29:55 +00:00
Ellen
a419e112db a wild test has appeared uwu 2021-02-13 19:10:08 +00:00