]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #83160 - m-ou-se:deprecate-rustc-serialize-derives, r=petrochenkov
Yuki Okushi [Tue, 16 Mar 2021 14:54:00 +0000 (23:54 +0900)]
Rollup merge of #83160 - m-ou-se:deprecate-rustc-serialize-derives, r=petrochenkov

Deprecate RustcEncodable and RustcDecodable.

We can't remove the `RustcEncodable` and `RustcDecodable` derive macros from the prelude, but we can deprecate them.

3 years agoRollup merge of #83157 - nagisa:nagisa/portability-background, r=GuillaumeGomez
Yuki Okushi [Tue, 16 Mar 2021 14:53:59 +0000 (23:53 +0900)]
Rollup merge of #83157 - nagisa:nagisa/portability-background, r=GuillaumeGomez

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.

![Listing of items in a module with some portability snippets attached to some of the items (light theme). The portability snippet has a light blue background and all of the text in it, monospace or not, is the same colour – black](https://user-images.githubusercontent.com/679122/111196363-1900f500-85b5-11eb-8f97-e283c59002a4.png)
![Listing of items in a module with some portability snippets attached to some of the items (dark theme). The portability snippet has a light blue background and all of the text in it, monospace or not, is the same colour – black](https://user-images.githubusercontent.com/679122/111196366-19998b80-85b5-11eb-9914-4d14d9d13ed3.png)

There should be no observable changes to the ayu theme.

3 years agoRollup merge of #83156 - nagisa:nagisa/sans-serif-please, r=GuillaumeGomez
Yuki Okushi [Tue, 16 Mar 2021 14:53:58 +0000 (23:53 +0900)]
Rollup merge of #83156 - nagisa:nagisa/sans-serif-please, r=GuillaumeGomez

Fall-back to sans-serif if Arial is not available

Otherwise on systems where Arial is not available the UA 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.

r? ```@GuillaumeGomez``` cc ```@jsha```

3 years agoRollup merge of #83091 - usbalbin:const_copy, r=oli-obk
Yuki Okushi [Tue, 16 Mar 2021 14:53:56 +0000 (23:53 +0900)]
Rollup merge of #83091 - usbalbin:const_copy, r=oli-obk

Constify `copy` related functions

Constify

* `*const T::copy_to[_nonoverlapping]`
* `*mut T::copy_to[_nonoverlapping]`
* `*mut T::copy_from[_nonoverlapping]`
* `mem::transmute_copy`
* `mem::swap`
* `ptr::swap[_nonoverlapping]`
* `mem::replace`
* `ptr::replace`

3 years agoRollup merge of #83077 - notriddle:gc-cleanup-rustdoc-search, r=GuillaumeGomez
Yuki Okushi [Tue, 16 Mar 2021 14:53:55 +0000 (23:53 +0900)]
Rollup merge of #83077 - notriddle:gc-cleanup-rustdoc-search, r=GuillaumeGomez

rustdoc: reduce GC work during search

3 years agoRollup merge of #83072 - henryboisdequin:patch-1, r=Dylan-DPC
Yuki Okushi [Tue, 16 Mar 2021 14:53:54 +0000 (23:53 +0900)]
Rollup merge of #83072 - henryboisdequin:patch-1, r=Dylan-DPC

Update `Vec` docs

Fix typos/nits in `Vec` docs

3 years agoRollup merge of #81822 - Kixunil:path_try_exists, r=kennytm
Yuki Okushi [Tue, 16 Mar 2021 14:53:52 +0000 (23:53 +0900)]
Rollup merge of #81822 - Kixunil:path_try_exists, r=kennytm

Added `try_exists()` method to `std::path::Path`

This method is similar to the existing `exists()` method, except it
doesn't silently ignore the errors, leading to less error-prone code.

This change intentionally does NOT touch the documentation of `exists()`
nor recommend people to use this method while it's unstable.
Such changes are reserved for stabilization to prevent confusing people.

Apart from that it avoids conflicts with #80979.

`@joshtriplett` requested this PR in [internals discussion](https://internals.rust-lang.org/t/the-api-of-path-exists-encourages-broken-code/13817/25?u=kixunil)

3 years agoVec::dedup optimization - add benches
Soveu [Tue, 16 Mar 2021 13:41:26 +0000 (14:41 +0100)]
Vec::dedup optimization - add benches

3 years agoci/docker: Add SDK/NDK level 21 to android docker for 32bit platforms
Daniel Silverstone [Tue, 16 Mar 2021 10:50:45 +0000 (10:50 +0000)]
ci/docker: Add SDK/NDK level 21 to android docker for 32bit platforms

Certain features of Linux (getauxval() and epoll_create1()) are only
available in android SDK/NDK levels 18 and 21 respectively.  The 32bit
platform is currently on level 14 for compatibility with Android 4.0.

This patch adds SDK/NDK level 21 to the docker for 32 bit platforms,
while leaving the default setup at level 14.

With this done, projects such as `rustup` which rely on these dockers
can build with modern ecosystem crates such as tokio 1.0, by using
the level 21 toolchain, but those which do not need to switch will
be unaffected, since the level 14 toolchain remains available.

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
3 years agofeat: Update hashbrown to instantiate less llvm IR
Markus Westerlind [Mon, 5 Oct 2020 08:50:51 +0000 (10:50 +0200)]
feat: Update hashbrown to instantiate less llvm IR

Includes https://github.com/rust-lang/hashbrown/pull/204 and https://github.com/rust-lang/hashbrown/pull/205 (not yet merged) which both server to reduce the amount of IR generated for hashmaps.

Inspired by the llvm-lines data gathered in https://github.com/rust-lang/rust/pull/76680

3 years agoAuto merge of #82838 - Amanieu:rustdoc_asm, r=nagisa
bors [Tue, 16 Mar 2021 10:05:46 +0000 (10:05 +0000)]
Auto merge of #82838 - Amanieu:rustdoc_asm, r=nagisa

Allow rustdoc to handle asm! of foreign architectures

This allows rustdoc to process code containing `asm!` for architectures other than the current one. Since this never reaches codegen, we just replace target-specific registers and register classes with a dummy one.

Fixes #82869

3 years agoast: Reduce size of `ExprKind` by boxing fields of `ExprKind::Struct`
Vadim Petrochenkov [Tue, 16 Mar 2021 00:15:53 +0000 (03:15 +0300)]
ast: Reduce size of `ExprKind` by boxing fields of `ExprKind::Struct`

3 years agoast/hir: Rename field-related structures
Vadim Petrochenkov [Mon, 15 Mar 2021 21:36:07 +0000 (00:36 +0300)]
ast/hir: Rename field-related structures

StructField -> FieldDef ("field definition")
Field -> ExprField ("expression field", not "field expression")
FieldPat -> PatField ("pattern field", not "field pattern")

Also rename visiting and other methods working on them.

3 years agoFilled tracking issue for path_try_exists
Martin Habovstiak [Tue, 16 Mar 2021 07:41:14 +0000 (08:41 +0100)]
Filled tracking issue for path_try_exists

This adds the ID of the tracking issue to the feature.

3 years agoAuto merge of #82898 - oli-obk:tait_🧊, r=nikomatsakis
bors [Tue, 16 Mar 2021 04:24:48 +0000 (04:24 +0000)]
Auto merge of #82898 - oli-obk:tait_🧊, r=nikomatsakis

Add a `min_type_alias_impl_trait` feature gate

This new feature gate only permits type alias impl trait to be constrained by function and trait method return types. All other possible constraining sites like const/static types, closure return types and binding types are now forbidden and gated under the `type_alias_impl_trait` and `impl_trait_in_bindings` feature gates (which are both marked as incomplete, as they have various ways to ICE the compiler or cause query cycles where they shouldn't).

r? `@nikomatsakis`

This is best reviewed commit-by-commit

3 years agoMake bootstrap be more informative when one does `x.py test` on a beta checkout witho...
Felix S. Klock II [Mon, 15 Mar 2021 21:37:06 +0000 (17:37 -0400)]
Make bootstrap be more informative when one does `x.py test` on a beta checkout without other mods.

To be clear, by default running `x.py test` on a checkout of the beta branch
currently fails, and with this change will continue to fail, because `x.py
tests` runs `x.py test src/tools/tidy` which tries to run `rustfmt` and that
will fail because the `rustfmt` binary is pinned to the current nighlty and we
do not attempt to distribute one for the beta builds.

This change gives a better error message than the current message, which is just
"./x.py fmt is not supported on this channel" without providing any hint about
what one might do about that problem.

(update: placated tidy.)

3 years agoAuto merge of #83153 - Aaron1011:eval-always-extern_mod_stmt_cnum, r=michaelwoerister
bors [Tue, 16 Mar 2021 01:33:06 +0000 (01:33 +0000)]
Auto merge of #83153 - Aaron1011:eval-always-extern_mod_stmt_cnum, r=michaelwoerister

Mark `extern_mod_stmt_cnum` as `eval_always`

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

3 years agoAdd test case for -Zinline-mir & -Zinstrument-coverage
Tomasz Miąsko [Tue, 16 Mar 2021 00:00:00 +0000 (00:00 +0000)]
Add test case for -Zinline-mir & -Zinstrument-coverage

3 years agoUse delay_span_bug instead of panic in layout_scalar_valid_range
Tomasz Miąsko [Tue, 16 Mar 2021 00:00:00 +0000 (00:00 +0000)]
Use delay_span_bug instead of panic in layout_scalar_valid_range

83054 introduced validation of scalar range attributes, but panicking
code that uses the attribute remained reachable. Use `delay_span_bug`
instead to avoid the ICE.

3 years agoMake functions passed to BoundVarReplacer be optional
Jack Huey [Sat, 13 Mar 2021 18:44:00 +0000 (13:44 -0500)]
Make functions passed to BoundVarReplacer be optional

3 years agoAdd support for compile-flags in coverage tests
Tomasz Miąsko [Mon, 15 Mar 2021 00:00:00 +0000 (00:00 +0000)]
Add support for compile-flags in coverage tests

3 years agoRemove inline-instrument-coverage-fail.rs test case
Tomasz Miąsko [Sat, 13 Mar 2021 00:00:00 +0000 (00:00 +0000)]
Remove inline-instrument-coverage-fail.rs test case

3 years agoFunctions inlined into reachable functions are reachable
Tomasz Miąsko [Sat, 13 Mar 2021 00:00:00 +0000 (00:00 +0000)]
Functions inlined into reachable functions are reachable

Consider functions to be reachable for code coverage purposes, either
when they reach the code generation directly, or indirectly as inlined
part of another function.

3 years agoMake source-based code coverage compatible with MIR inlining
Tomasz Miąsko [Sat, 13 Mar 2021 00:00:00 +0000 (00:00 +0000)]
Make source-based code coverage compatible with MIR inlining

When codegenning code coverage use the instance that coverage data was
originally generated for, to ensure basic level of compatibility with
MIR inlining.

3 years agoUpdate clippy tests
Vadim Petrochenkov [Mon, 15 Mar 2021 20:52:57 +0000 (23:52 +0300)]
Update clippy tests

3 years agoMerge branch 'master' into dedup
Soveu [Mon, 15 Mar 2021 20:51:38 +0000 (21:51 +0100)]
Merge branch 'master' into dedup

3 years agoVec::dedup optimization - add test for panic
Soveu [Mon, 15 Mar 2021 20:26:22 +0000 (21:26 +0100)]
Vec::dedup optimization - add test for panic

3 years agoExtend `proc_macro_back_compat` lint to `procedural-masquerade`
Aaron Hill [Mon, 15 Mar 2021 19:54:25 +0000 (15:54 -0400)]
Extend `proc_macro_back_compat` lint to `procedural-masquerade`

We now lint on *any* use of `procedural-masquerade` crate. While this
crate still exists, its main reverse dependency (`cssparser`) no longer
depends on it. Any crates still depending off should stop doing so, as
it only exists to support very old Rust versions.

If a crate actually needs to support old versions of rustc via
`procedural-masquerade`, then they'll just need to accept the warning
until we remove it entirely (at the same time as the back-compat hack).
The latest version of `procedural-masquerade` does not work with the
latest rustc, but trying to check for the version seems like more
trouble than it's worth.

While working on this, I realized that the `proc-macro-hack` check was
never actually doing anything. The corresponding enum variant in
`proc-macro-hack` is named `Value` or `Nested` - it has never been
called `Input`. Due to a strange Crater issue, the Crater run that
tested adding this did *not* end up testing it - some of the crates that
would have failed did not actually have their tests checked, making it
seem as though the `proc-macro-hack` check was working.

The Crater issue is being discussed at
https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/Nearly.20identical.20Crater.20runs.20processed.20a.20crate.20differently/near/230406661

Despite the `proc-macro-hack` check not actually doing anything, we
haven't gotten any reports from users about their build being broken.
I went ahead and removed it entirely, since it's clear that no one is
being affected by the `proc-macro-hack` regression in practice.

3 years agoConstify mem::transmute_copy
Albin Hedman [Sat, 13 Mar 2021 19:43:47 +0000 (20:43 +0100)]
Constify mem::transmute_copy

3 years agoConstify mem::replace and ptr::replace
Albin Hedman [Sat, 13 Mar 2021 19:38:43 +0000 (20:38 +0100)]
Constify mem::replace and ptr::replace

3 years agoConstify mem::swap and ptr::swap[_nonoverlapping]
Albin Hedman [Sat, 13 Mar 2021 19:33:27 +0000 (20:33 +0100)]
Constify mem::swap and ptr::swap[_nonoverlapping]

3 years agoConstify copy_to and copy_from
Albin Hedman [Sat, 13 Mar 2021 18:45:48 +0000 (19:45 +0100)]
Constify copy_to and copy_from

3 years agoVec::dedup optimization - finishing polishes
Soveu [Mon, 15 Mar 2021 19:36:29 +0000 (20:36 +0100)]
Vec::dedup optimization - finishing polishes

3 years agoVec::dedup optimization - add tests
Soveu [Mon, 15 Mar 2021 19:24:35 +0000 (20:24 +0100)]
Vec::dedup optimization - add tests

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 `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.