]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoDeprecate RustcEncodable and RustcDecodable.
Mara Bos [Mon, 15 Mar 2021 18:44:40 +0000 (19:44 +0100)]
Deprecate RustcEncodable and RustcDecodable.

3 years agoSpecify *.woff2 files as binary
Julian Frimmel [Mon, 15 Mar 2021 19:14:56 +0000 (20:14 +0100)]
Specify *.woff2 files as binary

This prevents older git versions to change the "line endings".

3 years agoMore precise spans for HIR paths
Vadim Petrochenkov [Sat, 13 Mar 2021 16:14:18 +0000 (19:14 +0300)]
More precise spans for HIR paths

3 years agoDeclare `word` outside the loop, as recommended by eslint
Michael Howell [Mon, 15 Mar 2021 18:58:34 +0000 (11:58 -0700)]
Declare `word` outside the loop, as recommended by eslint

3 years agoRun tests in nll mode
Oli Scherer [Mon, 15 Mar 2021 18:35:47 +0000 (18:35 +0000)]
Run tests in nll mode

3 years agoAuto merge of #83121 - the8472:env-rwlock-2, r=joshtriplett
bors [Mon, 15 Mar 2021 18:32:10 +0000 (18:32 +0000)]
Auto merge of #83121 - the8472:env-rwlock-2, r=joshtriplett

use RWlock when accessing os::env (take 2)

This reverts commit acdca316c3d42299d31c1b47eb792006ffdfc29c (#82877) i.e. redoes #81850 since the invalid unlock attempts in the child process have been fixed in #82949

r? `@joshtriplett`

3 years agoExplain each variant of TAIT usage with examples
Oli Scherer [Mon, 15 Mar 2021 11:02:35 +0000 (11:02 +0000)]
Explain each variant of TAIT usage with examples

3 years ago🍼 for tidy
Oli Scherer [Fri, 12 Mar 2021 12:51:53 +0000 (12:51 +0000)]
🍼 for tidy

3 years agoOnly allow tait defining uses in function and method return position
Oli Scherer [Fri, 12 Mar 2021 12:02:29 +0000 (12:02 +0000)]
Only allow tait defining uses in function and method return position

3 years agoNo background for code in portability snippets
Simonas Kazlauskas [Mon, 15 Mar 2021 17:34:21 +0000 (19:34 +0200)]
No background for code in portability snippets

This better matches the appearance of this kind of snippet in the full
item view and is less jarring to read due to repeated
foreground-background changes.

3 years agoSpecial case type aliases from impl trait in const/static types
Oli Scherer [Fri, 12 Mar 2021 11:27:08 +0000 (11:27 +0000)]
Special case type aliases from impl trait in const/static types

3 years agoAdd a test showing how `impl_trait_in_bindings` is a breaking change
Oli Scherer [Fri, 12 Mar 2021 10:54:12 +0000 (10:54 +0000)]
Add a test showing how `impl_trait_in_bindings` is a breaking change

3 years agoReplace `type_alias_impl_trait` by `min_type_alias_impl_trait` with no actual changes...
Oli Scherer [Fri, 12 Mar 2021 10:53:51 +0000 (10:53 +0000)]
Replace `type_alias_impl_trait` by `min_type_alias_impl_trait` with no actual changes in behaviour

This makes `type_alias_impl_trait` not actually do anything anymore

3 years agoFall-back to sans-serif if Arial is not available
Simonas Kazlauskas [Mon, 15 Mar 2021 17:20:15 +0000 (19:20 +0200)]
Fall-back to sans-serif if Arial is not available

Otherwise on systems where Arial is not available the system will
fallback to a serif font, rather than a sans-serif one.

This is especially relevant on acessibility-conscious setups (such as is
mine) that have web-fonts disabled and a limited set of fonts available
on the system.

3 years agoFix error after rebase
Roxane [Mon, 15 Mar 2021 03:53:43 +0000 (23:53 -0400)]
Fix error after rebase

3 years agoAdd comments with examples and tests
Roxane [Thu, 25 Feb 2021 23:03:41 +0000 (18:03 -0500)]
Add comments with examples and tests

3 years agoDelete non-revision ui test output file if revisions are used
Oli Scherer [Fri, 5 Mar 2021 11:26:06 +0000 (11:26 +0000)]
Delete non-revision ui test output file if revisions are used

3 years agoMake regression test succeed as long as it ICEs
Oli Scherer [Fri, 5 Mar 2021 11:16:37 +0000 (11:16 +0000)]
Make regression test succeed as long as it ICEs

3 years agoUse tracing instrumentation for better bug diagnosing
Oli Scherer [Fri, 5 Mar 2021 10:21:38 +0000 (10:21 +0000)]
Use tracing instrumentation for better bug diagnosing

3 years agoAdd reproduction test
Oli Scherer [Thu, 4 Mar 2021 16:22:00 +0000 (16:22 +0000)]
Add reproduction test

3 years agoMark `extern_mod_stmt_cnum` as `eval_always`
Aaron Hill [Mon, 15 Mar 2021 16:26:49 +0000 (12:26 -0400)]
Mark `extern_mod_stmt_cnum` as `eval_always`

This query reads from global untracked state, so it always needs to be
evaluated.

3 years agoAuto merge of #83149 - Dylan-DPC:rollup-ov70c5v, r=Dylan-DPC
bors [Mon, 15 Mar 2021 15:24:54 +0000 (15:24 +0000)]
Auto merge of #83149 - Dylan-DPC:rollup-ov70c5v, r=Dylan-DPC

Rollup of 10 pull requests

Successful merges:

 - #82989 (Custom error on literal names from other languages)
 - #83054 (Validate rustc_layout_scalar_valid_range_{start,end} attributes)
 - #83098 (Find more invalid doc attributes)
 - #83108 (Remove unused `opt_local_def_id_to_hir_id` function)
 - #83110 (Fix typos in `library/core/src/ptr/mod.rs` and `library/std/src/sys_common/thread_local_dtor.rs`)
 - #83113 (Minor refactoring in try_index_step)
 - #83127 (Introduce `proc_macro_back_compat` lint, and emit for `time-macros-impl`)
 - #83132 (Don't encode file information for span with a dummy location)
 - #83141 (:arrow_up: rust-analyzer)
 - #83144 (Introduce `rustc_interface::interface::Config::parse_sess_created` callback)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #83144 - hyd-dev:parse-sess-created, r=oli-obk
Dylan DPC [Mon, 15 Mar 2021 15:23:00 +0000 (16:23 +0100)]
Rollup merge of #83144 - hyd-dev:parse-sess-created, r=oli-obk

Introduce `rustc_interface::interface::Config::parse_sess_created` callback

Resolves #82900.

cc `@oli-obk`

3 years agoRollup merge of #83141 - lnicola:rust-analyzer-2021-03-15, r=jonas-schievink
Dylan DPC [Mon, 15 Mar 2021 15:22:59 +0000 (16:22 +0100)]
Rollup merge of #83141 - lnicola:rust-analyzer-2021-03-15, r=jonas-schievink

:arrow_up: rust-analyzer

3 years agoRollup merge of #83132 - Aaron1011:fix/incr-cache-dummy, r=estebank
Dylan DPC [Mon, 15 Mar 2021 15:22:58 +0000 (16:22 +0100)]
Rollup merge of #83132 - Aaron1011:fix/incr-cache-dummy, r=estebank

Don't encode file information for span with a dummy location

Fixes #83112

The location information for a dummy span isn't real, so don't encode
it. This brings the incr comp cache code into line with the Span
`StableHash` impl, which doesn't hash the location information for dummy
spans.

Previously, we would attempt to load the 'original' file from a dummy
span - if the file id changed (e.g. due to being moved on disk), we would get an
ICE, since the Span was still valid due to its hash being unchanged.

3 years agoRollup merge of #83127 - Aaron1011:time-macros-impl-warn, r=petrochenkov
Dylan DPC [Mon, 15 Mar 2021 15:22:57 +0000 (16:22 +0100)]
Rollup merge of #83127 - Aaron1011:time-macros-impl-warn, r=petrochenkov

Introduce `proc_macro_back_compat` lint, and emit for `time-macros-impl`

Now that future-incompat-report support has landed in nightly Cargo, we
can start to make progress towards removing the various proc-macro
back-compat hacks that have accumulated in the compiler.

This PR introduces a new lint `proc_macro_back_compat`, which results in
a future-incompat-report entry being generated. All proc-macro
back-compat warnings will be grouped under this lint. Note that this
lint will never actually become a hard error - instead, we will remove
the special cases for various macros, which will cause older versions of
those crates to emit some other error.

I've added code to fire this lint for the `time-macros-impl` case. This
is the easiest case out of all of our current back-compat hacks - the
crate was renamed to `time-macros`, so seeing a filename with
`time-macros-impl` guarantees that an older version of the parent `time`
crate is in use.

When Cargo's future-incompat-report feature gets stabilized, affected
users will start to see future-incompat warnings when they build their
crates.

3 years agoRollup merge of #83113 - osa1:refactor_try_index_step, r=jonas-schievink
Dylan DPC [Mon, 15 Mar 2021 15:22:56 +0000 (16:22 +0100)]
Rollup merge of #83113 - osa1:refactor_try_index_step, r=jonas-schievink

Minor refactoring in try_index_step

Merges `if-let` and `if x.is_some() { ... }` blocks

3 years agoRollup merge of #83110 - hyksm:fix-typo, r=jonas-schievink
Dylan DPC [Mon, 15 Mar 2021 15:22:55 +0000 (16:22 +0100)]
Rollup merge of #83110 - hyksm:fix-typo, r=jonas-schievink

Fix typos in `library/core/src/ptr/mod.rs` and `library/std/src/sys_common/thread_local_dtor.rs`

adress -> address

3 years agoRollup merge of #83108 - jyn514:remove-unused, r=estebank
Dylan DPC [Mon, 15 Mar 2021 15:22:53 +0000 (16:22 +0100)]
Rollup merge of #83108 - jyn514:remove-unused, r=estebank

Remove unused `opt_local_def_id_to_hir_id` function

Found while investigating #82933 - all LocalDefIds are expected to have
HirIds, there's no point in pretending otherwise.

3 years agoRollup merge of #83098 - camelid:more-doc-attr-check, r=davidtwco
Dylan DPC [Mon, 15 Mar 2021 15:22:52 +0000 (16:22 +0100)]
Rollup merge of #83098 - camelid:more-doc-attr-check, r=davidtwco

Find more invalid doc attributes

- Lint on `#[doc(123)]`, `#[doc("hello")]`, etc.
- Lint every attribute; e.g., will now report two warnings for `#[doc(foo, bar)]`
- Add hyphen to "crate level"
- Display paths like `#[doc(foo::bar)]` correctly instead of as an empty string

3 years agoRollup merge of #83054 - tmiasko:rustc_layout_scalar_valid_range, r=davidtwco
Dylan DPC [Mon, 15 Mar 2021 15:22:51 +0000 (16:22 +0100)]
Rollup merge of #83054 - tmiasko:rustc_layout_scalar_valid_range, r=davidtwco

Validate rustc_layout_scalar_valid_range_{start,end} attributes

Fixes #82251, fixes #82981.

3 years agoRollup merge of #82989 - Smittyvb:other-lang-literal-errors, r=varkor
Dylan DPC [Mon, 15 Mar 2021 15:22:50 +0000 (16:22 +0100)]
Rollup merge of #82989 - Smittyvb:other-lang-literal-errors, r=varkor

Custom error on literal names from other languages

This detects all Java literal types and all single word C data types, and suggests the corresponding Rust literal type.

3 years agoFix const stability `since` versions.
Oli Scherer [Fri, 12 Mar 2021 13:45:13 +0000 (13:45 +0000)]
Fix const stability `since` versions.

3 years agoFix `src/test/run-make-fulldeps/issue-19371`
hyd-dev [Mon, 15 Mar 2021 13:16:39 +0000 (21:16 +0800)]
Fix `src/test/run-make-fulldeps/issue-19371`

3 years agoChange the `.unwrap` to `.expect` with a helpful message
hyd-dev [Mon, 15 Mar 2021 12:44:48 +0000 (20:44 +0800)]
Change the `.unwrap` to `.expect` with a helpful message

3 years agoPacify tidy
Oli Scherer [Mon, 15 Mar 2021 12:19:29 +0000 (12:19 +0000)]
Pacify tidy

3 years agoCustom error on literal names from other languages
Smitty [Mon, 15 Mar 2021 12:11:02 +0000 (08:11 -0400)]
Custom error on literal names from other languages

This detects all Java literal types and all single word C data types,
and suggests the corresponding Rust literal type.

3 years agoDo not expose fallible `to_int` operation on `Scalar`.
Oli Scherer [Mon, 15 Mar 2021 12:06:07 +0000 (12:06 +0000)]
Do not expose fallible `to_int` operation on `Scalar`.

Any use of it has been shown to be a bug in the past.

3 years agoExplain pointer and dyn Trait handling in const_to_valtree
Oli Scherer [Mon, 15 Mar 2021 11:53:37 +0000 (11:53 +0000)]
Explain pointer and dyn Trait handling in const_to_valtree

3 years agoExplain how we encode enums at the encoding site
Oli Scherer [Mon, 15 Mar 2021 11:52:26 +0000 (11:52 +0000)]
Explain how we encode enums at the encoding site

3 years agoExplain why we do not allow const_to_valtree to read from statics
Oli Scherer [Mon, 15 Mar 2021 11:52:00 +0000 (11:52 +0000)]
Explain why we do not allow const_to_valtree to read from statics

3 years agoDocument valtree
Oli Scherer [Mon, 15 Mar 2021 11:31:01 +0000 (11:31 +0000)]
Document valtree

3 years agos/ConstantSource/ConstantKind/
Oli Scherer [Mon, 15 Mar 2021 11:23:44 +0000 (11:23 +0000)]
s/ConstantSource/ConstantKind/

3 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Mon, 15 Mar 2021 11:55:56 +0000 (13:55 +0200)]
:arrow_up: rust-analyzer

3 years agoAuto merge of #83118 - erikdesjardins:removezst, r=oli-obk
bors [Mon, 15 Mar 2021 11:30:33 +0000 (11:30 +0000)]
Auto merge of #83118 - erikdesjardins:removezst, r=oli-obk

Rebase and fixup #80493: Remove MIR assignments to ZST types

closes #80493

cc `@simonvandel`

r? `@oli-obk`

3 years agoUse `rustc_interface::interface::Config::parse_sess_created` in Clippy
hyd-dev [Mon, 15 Mar 2021 10:24:28 +0000 (18:24 +0800)]
Use `rustc_interface::interface::Config::parse_sess_created` in Clippy

3 years agoAdd `rustc_interface::interface::Config::parse_sess_created`
hyd-dev [Mon, 15 Mar 2021 09:57:53 +0000 (17:57 +0800)]
Add `rustc_interface::interface::Config::parse_sess_created`

3 years agoAuto merge of #82999 - cuviper:rustc-rayon-0.3.1, r=Mark-Simulacrum
bors [Mon, 15 Mar 2021 08:49:25 +0000 (08:49 +0000)]
Auto merge of #82999 - cuviper:rustc-rayon-0.3.1, r=Mark-Simulacrum

Update to rustc-rayon 0.3.1

This pulls in rust-lang/rustc-rayon#8 to fix #81425. (h/t `@ammaraskar)`

That revealed weak constraints on `rustc_arena::DropArena`, because its
`DropType` was holding type-erased raw pointers to generic `T`. We can
implement `Send` for `DropType` (under `cfg(parallel_compiler)`) by
requiring all `T: Send` before they're type-erased.

3 years agoAuto merge of #83074 - Aaron1011:new-sort-fix, r=jackh726
bors [Mon, 15 Mar 2021 06:20:24 +0000 (06:20 +0000)]
Auto merge of #83074 - Aaron1011:new-sort-fix, r=jackh726

Avoid sorting predicates by `DefId`

Fixes issue #82920

Even if an item does not change between compilation sessions, it may end
up with a different `DefId`, since inserting/deleting an item affects
the `DefId`s of all subsequent items. Therefore, we use a `DefPathHash`
in the incremental compilation system, which is stable in the face of
changes to unrelated items.

In particular, the query system will consider the inputs to a query to
be unchanged if any `DefId`s in the inputs have their `DefPathHash`es
unchanged. Queries are pure functions, so the query result should be
unchanged if the query inputs are unchanged.

Unfortunately, it's possible to inadvertantly make a query result
incorrectly change across compilations, by relying on the specific value
of a `DefId`. Specifically, if the query result is a slice that gets
sorted by `DefId`, the precise order will depend on how the `DefId`s got
assigned in a particular compilation session. If some definitions end up
with different `DefId`s (but the same `DefPathHash`es) in a subsequent
compilation session, we will end up re-computing a *different* value for
the query, even though the query system expects the result to unchanged
due to the unchanged inputs.

It turns out that we have been sorting the predicates computed during
`astconv` by their `DefId`. These predicates make their way into the
`super_predicates_that_define_assoc_type`, which ends up getting used to
compute the vtables of trait objects. This, re-ordering these predicates
between compilation sessions can lead to undefined behavior at runtime -
the query system will re-use code built with a *differently ordered*
vtable, resulting in the wrong method being invoked at runtime.

This PR avoids sorting by `DefId` in `astconv`, fixing the
miscompilation. However, it's possible that other instances of this
issue exist - they could also be easily introduced in the future.

To fully fix this issue, we should
1. Turn on `-Z incremental-verify-ich` by default. This will cause the
   compiler to ICE whenver an 'unchanged' query result changes between
   compilation sessions, instead of causing a miscompilation.
2. Remove the `Ord` impls for `CrateNum` and `DefId`. This will make it
   difficult to introduce ICEs in the first place.

3 years agoClarify BTree range searching comments
dylni [Mon, 15 Mar 2021 04:26:41 +0000 (00:26 -0400)]
Clarify BTree range searching comments

3 years agoBump recursion_limit in a few places
Aaron Hill [Sun, 14 Mar 2021 18:12:04 +0000 (14:12 -0400)]
Bump recursion_limit in a few places

This is needed to get rustdoc to succeed on `dist-x86_64-linux-alt`

3 years agoIntroduce `proc_macro_back_compat` lint, and emit for `time-macros-impl`
Aaron Hill [Sun, 14 Mar 2021 20:55:59 +0000 (16:55 -0400)]
Introduce `proc_macro_back_compat` lint, and emit for `time-macros-impl`

Now that future-incompat-report support has landed in nightly Cargo, we
can start to make progress towards removing the various proc-macro
back-compat hacks that have accumulated in the compiler.

This PR introduces a new lint `proc_macro_back_compat`, which results in
a future-incompat-report entry being generated. All proc-macro
back-compat warnings will be grouped under this lint. Note that this
lint will never actually become a hard error - instead, we will remove
the special cases for various macros, which will cause older versions of
those crates to emit some other error.

I've added code to fire this lint for the `time-macros-impl` case. This
is the easiest case out of all of our current back-compat hacks - the
crate was renamed to `time-macros`, so seeing a filename with
`time-macros-impl` guarantees that an older version of the parent `time`
crate is in use.

When Cargo's future-incompat-report feature gets stabilized, affected
users will start to see future-incompat warnings when they build their
crates.

3 years agoDon't encode file information for span with a dummy location
Aaron Hill [Sun, 14 Mar 2021 23:03:16 +0000 (19:03 -0400)]
Don't encode file information for span with a dummy location

Fixes #83112

The location information for a dummy span isn't real, so don't encode
it. This brings the incr comp cache code into line with the Span
`StableHash` impl, which doesn't hash the location information for dummy
spans.

Previously, we would attempt to load the 'original' file from a dummy
span - if the file id changed (e.g. due to being moved on disk), we would get an
ICE, since the Span was still valid due to its hash being unchanged.

3 years agoremove unnecessary condition
Erik Desjardins [Mon, 15 Mar 2021 00:21:20 +0000 (20:21 -0400)]
remove unnecessary condition

`_local` isn't visited in `_local = <rhs>` statements in the situation
we care about

3 years agoAdd fake_read() to clippy
Roxane [Thu, 25 Feb 2021 20:33:18 +0000 (15:33 -0500)]
Add fake_read() to clippy

3 years agoOnly borrow place for matching under specific conditions
Roxane [Wed, 24 Feb 2021 04:39:33 +0000 (23:39 -0500)]
Only borrow place for matching under specific conditions

3 years agoUse the correct FakeReadCause
Roxane [Tue, 23 Feb 2021 22:55:36 +0000 (17:55 -0500)]
Use the correct FakeReadCause

3 years agoAddress review comments
Amanieu d'Antras [Sun, 14 Mar 2021 23:19:16 +0000 (23:19 +0000)]
Address review comments

3 years agoMake nameWithoutUndescores lowercased
Michael Howell [Sun, 14 Mar 2021 21:43:10 +0000 (14:43 -0700)]
Make nameWithoutUndescores lowercased

This basically fixes a search bug introduced by earlier changes.

3 years agoUse pretty-printer instead of `span_to_snippet`
Camelid [Sun, 14 Mar 2021 21:39:13 +0000 (14:39 -0700)]
Use pretty-printer instead of `span_to_snippet`

3 years agoAuto merge of #83062 - JohnTitor:improve-reassign-err, r=davidtwco
bors [Sun, 14 Mar 2021 21:10:50 +0000 (21:10 +0000)]
Auto merge of #83062 - JohnTitor:improve-reassign-err, r=davidtwco

Improve the wording for the `can't reassign` error

Follow-up for https://github.com/rust-lang/rust/pull/71976#discussion_r448186151.
Fixes #66736

3 years agoAttempt to deal with nested closures properly
Roxane [Sun, 21 Feb 2021 15:20:40 +0000 (10:20 -0500)]
Attempt to deal with nested closures properly

3 years agoDelay use of Place in favor of PlaceBuilder
Roxane [Fri, 19 Feb 2021 00:02:07 +0000 (19:02 -0500)]
Delay use of Place in favor of PlaceBuilder

3 years agoTweak diagnostics
Camelid [Sun, 14 Mar 2021 21:00:02 +0000 (14:00 -0700)]
Tweak diagnostics

- Tweak lint message
- Display multi-segment paths correctly

3 years agoAssert there is no duplicate node.
Camille GILLOT [Sun, 14 Mar 2021 20:29:34 +0000 (21:29 +0100)]
Assert there is no duplicate node.

3 years agoIntroduce new fake reads
Roxane [Wed, 3 Feb 2021 02:07:52 +0000 (21:07 -0500)]
Introduce new fake reads

3 years agoRemove dead code.
Camille GILLOT [Sun, 14 Mar 2021 20:28:39 +0000 (21:28 +0100)]
Remove dead code.

3 years agoDo not insert impl_trait_in_bindings opaque definitions twice.
Camille GILLOT [Sun, 14 Mar 2021 19:02:35 +0000 (20:02 +0100)]
Do not insert impl_trait_in_bindings opaque definitions twice.

3 years agoRevert "Revert "use RWlock when accessing os::env #81850""
The8472 [Sun, 14 Mar 2021 18:10:34 +0000 (19:10 +0100)]
Revert "Revert "use RWlock when accessing os::env #81850""

This reverts commit acdca316c3d42299d31c1b47eb792006ffdfc29c.

3 years agobless tests (32-bit)
Erik Desjardins [Sun, 14 Mar 2021 17:53:16 +0000 (13:53 -0400)]
bless tests (32-bit)

3 years agoAuto merge of #82399 - petrochenkov:modin2, r=Aaron1011
bors [Sun, 14 Mar 2021 17:36:06 +0000 (17:36 +0000)]
Auto merge of #82399 - petrochenkov:modin2, r=Aaron1011

expand: Resolve and expand inner attributes on out-of-line modules

Fixes https://github.com/rust-lang/rust/issues/81661
r? `@Aaron1011`

3 years agoUse a number for row.id, instead of a string
Michael Howell [Sun, 14 Mar 2021 16:57:37 +0000 (09:57 -0700)]
Use a number for row.id, instead of a string

There's no reason for it to be a string, since it's only used for
de-duplicating the results arrays anyhow.

3 years agoAvoid generating new strings for names that have no undescores
Michael Howell [Sun, 14 Mar 2021 16:48:48 +0000 (09:48 -0700)]
Avoid generating new strings for names that have no undescores

This should have negligible effect on time, but it cuts about 1MiB
off of resident memory usage.

3 years agoexpand: Resolve and expand inner attributes on out-of-line modules
Vadim Petrochenkov [Sun, 21 Feb 2021 13:32:38 +0000 (16:32 +0300)]
expand: Resolve and expand inner attributes on out-of-line modules

3 years agoAuto merge of #83082 - cjgillot:defkey-ii, r=oli-obk
bors [Sun, 14 Mar 2021 14:16:21 +0000 (14:16 +0000)]
Auto merge of #83082 - cjgillot:defkey-ii, r=oli-obk

Iterate on crate_inherent_impls for metadata.

Split from #80347

r? `@oli-obk`

3 years agoRemove duplicate asserts, replace eq assert with assert_eq
Ömer Sinan Ağacan [Sun, 14 Mar 2021 14:06:18 +0000 (17:06 +0300)]
Remove duplicate asserts, replace eq assert with assert_eq

3 years agoMinor refactoring in try_index_step
Ömer Sinan Ağacan [Sun, 14 Mar 2021 13:00:02 +0000 (16:00 +0300)]
Minor refactoring in try_index_step

Merges `if-let` and `if x.is_some() { ... }` blocks

3 years agoAuto merge of #83044 - kubo39:set-llvm-code-model, r=nikic
bors [Sun, 14 Mar 2021 11:46:57 +0000 (11:46 +0000)]
Auto merge of #83044 - kubo39:set-llvm-code-model, r=nikic

Add support for storing code model to LLVM module IR

This patch avoids undefined behavior by linking different object files.
Also this would it could be propagated properly to LTO.

See https://reviews.llvm.org/D52322 and https://reviews.llvm.org/D52323.

This patch is based on https://github.com/rust-lang/rust/pull/74002

3 years agoAuto merge of #83094 - GuillaumeGomez:crates-js-location, r=Nemo157
bors [Sun, 14 Mar 2021 09:16:23 +0000 (09:16 +0000)]
Auto merge of #83094 - GuillaumeGomez:crates-js-location, r=Nemo157

crates.js should use root_path and not static_root_path

r? `@Nemo157`

3 years agoFix a typo in thread_local_dtor.rs
Motoki Ikeda [Sun, 14 Mar 2021 07:39:29 +0000 (16:39 +0900)]
Fix a typo in thread_local_dtor.rs

3 years agoFix a typo in `swap_nonoverlapping_bytes`
Motoki Ikeda [Fri, 12 Mar 2021 15:51:26 +0000 (00:51 +0900)]
Fix a typo in `swap_nonoverlapping_bytes`

3 years agoRemove unused `opt_local_def_id_to_hir_id` function
Joshua Nelson [Sun, 14 Mar 2021 06:37:13 +0000 (01:37 -0500)]
Remove unused `opt_local_def_id_to_hir_id` function

Found while investigating #82933 - all LocalDefIds are expected to have
HirIds, there's no point in pretending otherwise.

3 years agoAuto merge of #83028 - GuillaumeGomez:prevent-js-error-if-no-filter, r=Nemo157
bors [Sun, 14 Mar 2021 06:35:19 +0000 (06:35 +0000)]
Auto merge of #83028 - GuillaumeGomez:prevent-js-error-if-no-filter, r=Nemo157

Prevent JS error when there is no dependency or other crate documented (or --disable-per-crate-search has been used)

When there is only one crate, the dropdown is removed, creating an error (that you can see pretty easily on docs.rs for example).

r? `@jyn514`

3 years agoAuto merge of #83105 - JohnTitor:rollup-tqpm8pb, r=JohnTitor
bors [Sun, 14 Mar 2021 04:09:02 +0000 (04:09 +0000)]
Auto merge of #83105 - JohnTitor:rollup-tqpm8pb, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #81465 (Add documentation about formatting `Duration` values)
 - #82121 (Implement Extend and FromIterator for OsString)
 - #82617 (Document `everybody_loops`)
 - #82789 (Get with field index from pattern slice instead of directly indexing)
 - #82798 (Rename `rustdoc` to `rustdoc::all`)
 - #82804 (std: Fix a bug on the wasm32-wasi target opening files)
 - #82943 (Demonstrate best practice for feeding stdin of a child processes)
 - #83066 (Add `reverse` search alias for Iterator::rev())
 - #83070 (Update cargo)
 - #83081 (Fix panic message of `assert_failed_inner`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #83081 - hyd-dev:assert-message, r=m-ou-se
Yuki Okushi [Sun, 14 Mar 2021 04:07:37 +0000 (13:07 +0900)]
Rollup merge of #83081 - hyd-dev:assert-message, r=m-ou-se

Fix panic message of `assert_failed_inner`

cc https://github.com/rust-lang/rust/pull/79100#discussion_r593731020

r? ``@m-ou-se``

3 years agoRollup merge of #83070 - ehuss:update-cargo, r=ehuss
Yuki Okushi [Sun, 14 Mar 2021 04:07:36 +0000 (13:07 +0900)]
Rollup merge of #83070 - ehuss:update-cargo, r=ehuss

Update cargo

7 commits in 970bc67c3775781b9708c8a36893576b9459c64a..32da9eaa5de5be241cf8096ca6b749a157194f77
2021-03-07 18:09:40 +0000 to 2021-03-13 01:18:40 +0000
- Fix logic for determining prefer-dynamic for a dylib. (rust-lang/cargo#9252)
- Fix issue with filtering exclusive target dependencies. (rust-lang/cargo#9255)
- Update pkgid-spec docs. (rust-lang/cargo#9249)
- Wordsmith the edition documentation a bit more (rust-lang/cargo#9233)
- Package ID specification urls must contain a host (rust-lang/cargo#9188)
- Add documentation for JSON message_path. (rust-lang/cargo#9247)
- Fix filter_platform to run on targets other than x86. (rust-lang/cargo#9246)

3 years agoRollup merge of #83066 - Seppel3210:master, r=joshtriplett
Yuki Okushi [Sun, 14 Mar 2021 04:07:35 +0000 (13:07 +0900)]
Rollup merge of #83066 - Seppel3210:master, r=joshtriplett

Add `reverse` search alias for Iterator::rev()

When searching for "reverse" in rustdoc you can't find the rev method on Iterator so here is a search alias for that.

3 years agoRollup merge of #82943 - kornelski:threadstdio, r=joshtriplett
Yuki Okushi [Sun, 14 Mar 2021 04:07:34 +0000 (13:07 +0900)]
Rollup merge of #82943 - kornelski:threadstdio, r=joshtriplett

Demonstrate best practice for feeding stdin of a child processes

Documentation change.

It's possible to create a deadlock with stdin/stdout I/O on a single thread:

* the child process may fill its stdout buffer, and have to wait for the parent process to read it,
* but the parent process may be waiting until its stdin write finishes before reading the stdout.

Therefore, the parent process should use separate threads for writing and reading.

These examples are not deadlocking in practice, because they use short strings, but I think it's better to demonstrate code that works even for long writes. The problem is non-obvious and tricky to debug (it seems that even libstd has a similar issue: #45572).

This also demonstrates how to use stdio with threads: it's not obvious that `.take()` can be used to avoid fighting with the borrow checker.

I've checked that the modified examples run fine.

3 years agoRollup merge of #82804 - alexcrichton:fix-wasi, r=pnkfelix
Yuki Okushi [Sun, 14 Mar 2021 04:07:33 +0000 (13:07 +0900)]
Rollup merge of #82804 - alexcrichton:fix-wasi, r=pnkfelix

std: Fix a bug on the wasm32-wasi target opening files

This commit fixes an issue pointed out in #82758 where LTO changed the
behavior of a program. It turns out that LTO was not at fault here, it
simply uncovered an existing bug. The bindings to
`__wasilibc_find_relpath` assumed that the relative portion of the path
returned was always contained within thee input `buf` we passed in. This
isn't actually the case, however, and sometimes the relative portion of
the path may reference a sub-portion of the input string itself.

The fix here is to use the relative path pointer coming out of
`__wasilibc_find_relpath` as the source of truth. The `buf` used for
local storage is discarded in this function and the relative path is
copied out unconditionally. We might be able to get away with some
`Cow`-like business or such to avoid the extra allocation, but for now
this is probably the easiest patch to fix the original issue.

3 years agoRollup merge of #82798 - jyn514:rustdoc-group, r=Manishearth,GuillaumeGomez
Yuki Okushi [Sun, 14 Mar 2021 04:07:32 +0000 (13:07 +0900)]
Rollup merge of #82798 - jyn514:rustdoc-group, r=Manishearth,GuillaumeGomez

Rename `rustdoc` to `rustdoc::all`

When rustdoc lints were changed to be tool lints, the `rustdoc` group was removed, leading to spurious warnings like

```
warning: unknown lint: `rustdoc`
```

The lint group still worked when rustdoc ran, since rustdoc added the group itself.

This renames the group to `rustdoc::all` for consistency with `clippy::all` and the rest of the rustdoc lints.

Follow-up to #80527.
r? ``@Manishearth``

3 years agoRollup merge of #82789 - csmoe:issue-82772, r=estebank
Yuki Okushi [Sun, 14 Mar 2021 04:07:31 +0000 (13:07 +0900)]
Rollup merge of #82789 - csmoe:issue-82772, r=estebank

Get with field index from pattern slice instead of directly indexing

Closes #82772
r? ``@estebank``

https://github.com/rust-lang/rust/pull/82789#issuecomment-796921977
> ``@estebank`` So the real cause is we only generate single pattern for Box here
https://github.com/csmoe/rust/blob/615b03aeaa8ce9819de7828740ab3cd7def4fa76/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs#L1130-L1132
But in the replacing function, it tries to index on the 1-length pattern slice with field 1, thus out of bounds.
https://github.com/csmoe/rust/blob/615b03aeaa8ce9819de7828740ab3cd7def4fa76/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs#L1346

3 years agoRollup merge of #82617 - camelid:everybody_loops-docs, r=jyn514
Yuki Okushi [Sun, 14 Mar 2021 04:07:30 +0000 (13:07 +0900)]
Rollup merge of #82617 - camelid:everybody_loops-docs, r=jyn514

Document `everybody_loops`

cc `@jyn514`

3 years agoRollup merge of #82121 - lopopolo:pathbuf-osstring-extend, r=joshtriplett
Yuki Okushi [Sun, 14 Mar 2021 04:07:28 +0000 (13:07 +0900)]
Rollup merge of #82121 - lopopolo:pathbuf-osstring-extend, r=joshtriplett

Implement Extend and FromIterator for OsString

Add the following trait impls:

- `impl Extend<OsString> for OsString`
- `impl<'a> Extend<&'a OsStr> for OsString`
- `impl FromIterator<OsString> for OsString`
- `impl<'a> FromIterator<&'a OsStr> for OsString`

Because `OsString` is a platform string with no particular semantics, concatenating them together seems acceptable.

I came across a use case for these trait impls in https://github.com/artichoke/artichoke/pull/1089:

Artichoke is a Ruby interpreter. Its CLI accepts multiple `-e` switches for executing inline Ruby code, like:

```console
$ cargo -q run --bin artichoke -- -e '2.times {' -e 'puts "foo: #{__LINE__}"' -e '}'
foo: 2
foo: 2
```

I use `clap` for command line argument parsing, which collects these `-e` commands into a `Vec<OsString>`. To pass these commands to the interpreter for `Eval`, I need to join them together. Combining these impls with `Iterator::intersperse` https://github.com/rust-lang/rust/issues/79524 would enable me to build a single bit of Ruby code.

Currently, I'm doing something like:

```rust
let mut commands = commands.into_iter();
let mut buf = if let Some(command) = commands.next() {
    command
} else {
    return Ok(Ok(()));
};
for command in commands {
    buf.push("\n");
    buf.push(command);
}
```

If there's interest, I'd also like to add impls for `Cow<'a, OsStr>`, which would avoid allocating the `"\n"` `OsString` in the concatenate + intersperse use case.

3 years agoRollup merge of #81465 - joshtriplett:duration-formatting-documentation, r=m-ou-se
Yuki Okushi [Sun, 14 Mar 2021 04:07:27 +0000 (13:07 +0900)]
Rollup merge of #81465 - joshtriplett:duration-formatting-documentation, r=m-ou-se

Add documentation about formatting `Duration` values

Explain why Duration has a Debug impl but not a Display impl, and
mention the use of Unicode.

3 years agobless tests
Erik Desjardins [Sun, 14 Mar 2021 04:04:38 +0000 (23:04 -0500)]
bless tests

3 years agoUpdate `rustdoc-ui` versions of the `doc-attr` test
Camelid [Sun, 14 Mar 2021 00:36:38 +0000 (16:36 -0800)]
Update `rustdoc-ui` versions of the `doc-attr` test

It seems there are two copies of it: one in `src/test/ui/attributes/`
and one in `src/test/rustdoc-ui/`. I'm guessing this is to test that the
lint is emitted both when you run the compiler and when you run rustdoc.

3 years agoAdd hyphen to "crate level"
Camelid [Sat, 13 Mar 2021 22:32:06 +0000 (14:32 -0800)]
Add hyphen to "crate level"

"crate level attribute" -> "crate-level attribute"

3 years agoDo not emit alloca for ZST local even if it is uninitialized
Simon Vandel Sillesen [Sun, 3 Jan 2021 14:45:15 +0000 (15:45 +0100)]
Do not emit alloca for ZST local even if it is uninitialized

3 years agoMove ZST check inside UsedLocals
Simon Vandel Sillesen [Sun, 3 Jan 2021 13:51:24 +0000 (14:51 +0100)]
Move ZST check inside UsedLocals

3 years agoExtend SimplifyLocals to remove ZST writes
Simon Vandel Sillesen [Tue, 29 Dec 2020 22:32:31 +0000 (23:32 +0100)]
Extend SimplifyLocals to remove ZST writes