]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #91150 - dtolnay:qpath, r=davidtwco
Matthias Krüger [Tue, 18 Jan 2022 21:00:43 +0000 (22:00 +0100)]
Rollup merge of #91150 - dtolnay:qpath, r=davidtwco

Let qpath contain NtTy: `<$:ty as $:ty>::…`

Example:

```rust
macro_rules! m {
    (<$type:ty as $trait:ty>::$name:ident) => {
        <$type as $trait>::$name
    };
}

fn main() {
    let _: m!(<str as ToOwned>::Owned);
}
```

Previous behavior:

```console
error: expected identifier, found `ToOwned`
 --> src/main.rs:3:19
  |
3 |         <$type as $trait>::$name
  |                   ^^^^^^ expected identifier
...
8 |     let _: m!(<str as ToOwned>::Owned);
  |            ---------------------------
  |            |
  |            this macro call doesn't expand to a type
  |            in this macro invocation
```

The <code>expected identifier, found \`ToOwned\`</code> error is particularly silly. I think it should be fine to accept this code as long as $trait is of the form `TyKind::Path(None, path)`; if it is any other kind of `NtTy`, we'll keep the same behavior as before.

2 years agoRollup merge of #90782 - ricobbe:binutils-dlltool, r=michaelwoerister
Matthias Krüger [Tue, 18 Jan 2022 21:00:42 +0000 (22:00 +0100)]
Rollup merge of #90782 - ricobbe:binutils-dlltool, r=michaelwoerister

Implement raw-dylib support for windows-gnu

Add support for `#[link(kind = "raw-dylib")]` on windows-gnu targets.  Work around binutils's linker's inability to read import libraries produced by LLVM by calling out to the binutils `dlltool` utility to create an import library from a temporary .DEF file; this approach is effectively a slightly refined version of `@mati865's` earlier attempt at this strategy in PR #88801.  (In particular, this attempt at this strategy adds support for `#[link_ordinal(...)]` as well.)

In support of #58713.

2 years agoAuto merge of #92731 - bjorn3:asm_support_changes, r=nagisa
bors [Tue, 18 Jan 2022 14:32:52 +0000 (14:32 +0000)]
Auto merge of #92731 - bjorn3:asm_support_changes, r=nagisa

Avoid unnecessary monomorphization of inline asm related functions

This should reduce build time for codegen backends by avoiding duplicated monomorphization of certain inline asm related functions for each passed in closure type.

2 years agoAuto merge of #87648 - JulianKnodt:const_eq_constrain, r=oli-obk
bors [Tue, 18 Jan 2022 09:58:39 +0000 (09:58 +0000)]
Auto merge of #87648 - JulianKnodt:const_eq_constrain, r=oli-obk

allow eq constraints on associated constants

Updates #70256

(cc `@varkor,` `@Centril)`

2 years agoAuto merge of #93021 - matthiaskrgr:rollup-o7z8zoe, r=matthiaskrgr
bors [Tue, 18 Jan 2022 06:07:58 +0000 (06:07 +0000)]
Auto merge of #93021 - matthiaskrgr:rollup-o7z8zoe, r=matthiaskrgr

Rollup of 14 pull requests

Successful merges:

 - #92629 (Pick themes on settings page, not every page)
 - #92640 (Fix ICEs related to `Deref<Target=[T; N]>` on newtypes)
 - #92701 (Add some more attribute validation)
 - #92803 (Hide mobile sidebar on some clicks)
 - #92830 (Rustdoc style cleanups)
 - #92866 ("Does exists" typos fix)
 - #92870 (add `rustc_diagnostic_item` attribute to `AtomicBool` type)
 - #92914 (htmldocck: Add support for `/text()` in ``@snapshot`)`
 - #92923 (Abstract the pretty printer's ringbuffer to be infinitely sized)
 - #92946 (Exclude llvm-libunwind from the self-contained set on s390x-musl targets)
 - #92947 (rustdoc: Use `intersperse` in a `visit_path` function)
 - #92997 (Add `~const` bound test for negative impls)
 - #93004 (update codegen test for LLVM 14)
 - #93016 (Stabilize vec_spare_capacity)

Failed merges:

 - #92924 (Delete pretty printer tracing)

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

2 years agoRollup merge of #93016 - Amanieu:vec_spare_capacity, r=Mark-Simulacrum
Matthias Krüger [Tue, 18 Jan 2022 03:42:11 +0000 (04:42 +0100)]
Rollup merge of #93016 - Amanieu:vec_spare_capacity, r=Mark-Simulacrum

Stabilize vec_spare_capacity

Closes #75017

2 years agoRollup merge of #93004 - krasimirgg:threadlocal-llvm-up, r=nikic
Matthias Krüger [Tue, 18 Jan 2022 03:42:10 +0000 (04:42 +0100)]
Rollup merge of #93004 - krasimirgg:threadlocal-llvm-up, r=nikic

update codegen test for LLVM 14

Fixes https://github.com/rust-lang/rust/issues/93003.

2 years agoRollup merge of #92997 - woppopo:test92114, r=Mark-Simulacrum
Matthias Krüger [Tue, 18 Jan 2022 03:42:09 +0000 (04:42 +0100)]
Rollup merge of #92997 - woppopo:test92114, r=Mark-Simulacrum

Add `~const` bound test for negative impls

Resolves #92114 which has been fixed in #92892.

2 years agoRollup merge of #92947 - vacuus:rustdoc-core-visit-path, r=camelid
Matthias Krüger [Tue, 18 Jan 2022 03:42:08 +0000 (04:42 +0100)]
Rollup merge of #92947 - vacuus:rustdoc-core-visit-path, r=camelid

rustdoc: Use `intersperse` in a `visit_path` function

(~~Is there a better way to word the title?~~ Eh, this works, I guess.)
I'm surprised that the compiler didn't complain when I left out the `.to_string()`, but hey, if it works then it works.

2 years agoRollup merge of #92946 - kaniini:chore/llvm-libunwind-s390x, r=Mark-Simulacrum
Matthias Krüger [Tue, 18 Jan 2022 03:42:07 +0000 (04:42 +0100)]
Rollup merge of #92946 - kaniini:chore/llvm-libunwind-s390x, r=Mark-Simulacrum

Exclude llvm-libunwind from the self-contained set on s390x-musl targets

llvm-libunwind does not support s390x targets at present, so we cannot build it
for s390x targets.  Accordingly, remove it from the self-contained set.

2 years agoRollup merge of #92923 - dtolnay:ringbuffer, r=petrochenkov
Matthias Krüger [Tue, 18 Jan 2022 03:42:06 +0000 (04:42 +0100)]
Rollup merge of #92923 - dtolnay:ringbuffer, r=petrochenkov

Abstract the pretty printer's ringbuffer to be infinitely sized

This PR backports https://github.com/dtolnay/prettyplease/commit/8e5e83c3ff7faaa272115a81b76f07a1d4a91969 from the `prettyplease` crate into `rustc_ast_pretty`.

Using a dedicated RingBuffer type with non-wrapping indices, instead of manually `%`-ing indices into a capped sized buffer, unlocks a number of simplifications to the pretty printing algorithm implementation in followup commits such as https://github.com/dtolnay/prettyplease/commit/fcb5968b1e1357497c7d7e205d22bb4e8c1dbd38 and https://github.com/dtolnay/prettyplease/commit/4427cedcb80294e89b823f923fdb16544c737bd9.

This change also greatly reduces memory overhead of the pretty printer. The old implementation always grows its buffer to 205920 bytes even for files without deeply nested code, because it only wraps its indices when they hit the maximum tolerable size of the ring buffer (the size after which the pretty printer will crash if there are that many tokens buffered). In contrast, the new implementation uses memory proportional to the peak number of simultaneously buffered tokens only, not the number of tokens that have ever been in the buffer.

Speaking of crashing the pretty printer and "maximum tolerable size", the constant used for that in the old implementation is a lie:

https://github.com/rust-lang/rust/blob/de9b573eedaaa6d6e7c00c986cccbee802f9287b/compiler/rustc_ast_pretty/src/pp.rs#L227-L228

It was raised from 3 to 55 in https://github.com/rust-lang/rust/pull/33934 because that was empirically the size that avoided crashing on one particular test crate, but according to https://github.com/rust-lang/rust/pull/33934#issuecomment-226700470 other syntax trees still crash at that size. There is no reason to believe that any particular size is good enough for arbitrary code, and using a large number like 55 adds overhead to inputs that never need close to that much of a buffer. The new implementation eliminates this tradeoff.

2 years agoRollup merge of #92914 - camelid:snapshot-text, r=GuillaumeGomez
Matthias Krüger [Tue, 18 Jan 2022 03:42:05 +0000 (04:42 +0100)]
Rollup merge of #92914 - camelid:snapshot-text, r=GuillaumeGomez

htmldocck: Add support for `/text()` in `@snapshot`

This allows just testing the text, in cases where the HTML tags don't
matter.

See https://github.com/rust-lang/rust/pull/92908#discussion_r785191758 for an example of when this would be useful.

r? `@GuillaumeGomez`

2 years agoRollup merge of #92870 - llogiq:atomic_bool_sym, r=Manishearth
Matthias Krüger [Tue, 18 Jan 2022 03:42:04 +0000 (04:42 +0100)]
Rollup merge of #92870 - llogiq:atomic_bool_sym, r=Manishearth

add `rustc_diagnostic_item` attribute to `AtomicBool` type

I wanted to use this in clippy and found that it didn't work. So hopefully this addition will fix it.

2 years agoRollup merge of #92866 - maxwase:does_exist_typo, r=Mark-Simulacrum
Matthias Krüger [Tue, 18 Jan 2022 03:42:03 +0000 (04:42 +0100)]
Rollup merge of #92866 - maxwase:does_exist_typo, r=Mark-Simulacrum

"Does exists" typos fix

Fixed some typos

2 years agoRollup merge of #92830 - jsha:style-cleanups, r=GuillaumeGomez
Matthias Krüger [Tue, 18 Jan 2022 03:42:02 +0000 (04:42 +0100)]
Rollup merge of #92830 - jsha:style-cleanups, r=GuillaumeGomez

Rustdoc style cleanups

 - Make "since" version numbers grey again (regressed in #92602).
 - Remove unneeded selectors for when crate filter dropdown is a
   sibling of search-input.
 - Crate filter dropdown doesn't need to be 100% width on mobile.
 - Only build crate filter dropdown when there is more than one crate.
 - Remove unused addCrateDropdown

 Demo: https://rustdoc.crud.net/jsha/style-cleanups/std/string/struct.String.html

 r? `@GuillaumeGomez`

2 years agoRollup merge of #92803 - jsha:hide-sidebar, r=GuillaumeGomez
Matthias Krüger [Tue, 18 Jan 2022 03:42:00 +0000 (04:42 +0100)]
Rollup merge of #92803 - jsha:hide-sidebar, r=GuillaumeGomez

Hide mobile sidebar on some clicks

When the user clicks outside the sidebar, the sidebar should close. Also, when the user clicks an internal link in the sidebar, it should close.

Fixes #92682

Demo: https://rustdoc.crud.net/jsha/hide-sidebar/std/string/struct.String.html

2 years agoRollup merge of #92701 - ehuss:even-more-attr-validation, r=matthewjasper
Matthias Krüger [Tue, 18 Jan 2022 03:41:59 +0000 (04:41 +0100)]
Rollup merge of #92701 - ehuss:even-more-attr-validation, r=matthewjasper

Add some more attribute validation

This adds some more validation for the position of attributes:

* `link` is only valid on an `extern` block
* `windows_subsystem` and `no_builtins` are only valid at the crate level

2 years agoRollup merge of #92640 - compiler-errors:array-deref-on-newtype, r=lcnr
Matthias Krüger [Tue, 18 Jan 2022 03:41:58 +0000 (04:41 +0100)]
Rollup merge of #92640 - compiler-errors:array-deref-on-newtype, r=lcnr

Fix ICEs related to `Deref<Target=[T; N]>` on newtypes

1. Stash a const infer's type into the canonical var during canonicalization, so we can recreate the fresh const infer with that same type.
    For example, given `[T; _]` we know `_` is a `usize`. If we go from infer => canonical => infer, we shouldn't forget that variable is a usize.
Fixes #92626
Fixes #83704

2. Don't stash the autoderef'd slice type that we get from method lookup, but instead recreate it during method confirmation. We need to do this because the type we receive back after picking the method references a type variable that does not exist after probing is done.
Fixes #92637

... A better solution for the second issue would be to actually _properly_ implement `Deref` for `[T; N]` instead of fixing this autoderef hack to stop leaking inference variables. But I actually looked into this, and there are many complications with const impls.

2 years agoRollup merge of #92629 - jsha:theme-picker-local-only-2, r=GuillaumeGomez
Matthias Krüger [Tue, 18 Jan 2022 03:41:58 +0000 (04:41 +0100)]
Rollup merge of #92629 - jsha:theme-picker-local-only-2, r=GuillaumeGomez

Pick themes on settings page, not every page

This hides the paintbrush icon on most pages by default, in preference for the settings on the settings page.  When loading from a local file, and not in mobile view, continue to show the theme picker. That's because some browsers limit access to localStorage from file:/// URLs, so choosing a theme from settings.html doesn't take effect.

Fixes #84539
Part of #59840

r? `@GuillaumeGomez`

Demo: https://rustdoc.crud.net/jsha/theme-picker-local-only-2/std/io/trait.Read.html

2 years agoAuto merge of #93001 - flip1995:clippyup, r=Manishearth
bors [Tue, 18 Jan 2022 02:32:36 +0000 (02:32 +0000)]
Auto merge of #93001 - flip1995:clippyup, r=Manishearth

Out of cycle Clippy update

I want to do an out-of-cycle sync for rust-lang/rust-clippy#8295, and possibly backport this to stable together with https://github.com/rust-lang/rust/issues/92938. If this doesn't get backported to stable, then I at least want to backport it to beta.

r? `@Manishearth`

2 years agoAuto merge of #93009 - matthiaskrgr:rollup-3fkxg6i, r=matthiaskrgr
bors [Mon, 17 Jan 2022 23:01:35 +0000 (23:01 +0000)]
Auto merge of #93009 - matthiaskrgr:rollup-3fkxg6i, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #90498 (Clarifications in the target tier policy)
 - #92164 (Implement `#[rustc_must_implement_one_of]` attribute)
 - #92729 (rustc_codegen_llvm: Remove (almost) unused span parameter from many functions in metadata.rs)
 - #92752 (Correct minor typos in some long error code explanations)
 - #92801 (Enable wrapping words by default)
 - #92825 (Rename environment variable for overriding rustc version)
 - #92877 (Remove LLVMRustMarkAllFunctionsNounwind)
 - #92936 (rustdoc: Remove `collect` in `html::markdown::parse`)
 - #92956 (Add `log2` and `log10` to `NonZeroU*`)
 - #92960 (Use `carrying_{mul|add}` in `num::bignum`)

Failed merges:

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

2 years agoAdd staged_api for tests
Jacob Hoffman-Andrews [Sat, 15 Jan 2022 03:24:21 +0000 (19:24 -0800)]
Add staged_api for tests

2 years agoStabilize vec_spare_capacity
Amanieu d'Antras [Mon, 17 Jan 2022 21:07:02 +0000 (21:07 +0000)]
Stabilize vec_spare_capacity

Closes #75017

2 years agoAbstract the pretty printer's ringbuffer to be infinitely sized
David Tolnay [Sat, 15 Jan 2022 05:29:52 +0000 (21:29 -0800)]
Abstract the pretty printer's ringbuffer to be infinitely sized

2 years agoUpdate with final comments
kadmin [Fri, 14 Jan 2022 19:01:35 +0000 (19:01 +0000)]
Update with final comments

2 years agoHide mobile sidebar on some clicks
Jacob Hoffman-Andrews [Wed, 12 Jan 2022 02:27:44 +0000 (18:27 -0800)]
Hide mobile sidebar on some clicks

When the user clicks outside the sidebar, the sidebar should close.
Also, when the user clicks an internal link in the sidebar, it should
close.

2 years agoAdd term to ExistentialProjection
kadmin [Thu, 13 Jan 2022 07:39:58 +0000 (07:39 +0000)]
Add term to ExistentialProjection

Also prevent ICE when adding a const in associated const equality.

2 years agoUpdate w/ comments
kadmin [Tue, 11 Jan 2022 19:18:18 +0000 (19:18 +0000)]
Update w/ comments

Removes uses of ty() where a method is implemented on TypeFoldable, and also directly formats
a Term.

2 years agoUpdate term for use in more places
kadmin [Mon, 10 Jan 2022 23:39:21 +0000 (23:39 +0000)]
Update term for use in more places

Replace use of `ty()` on term and use it in more places. This will allow more flexibility in the
future, but slightly worried it allows items which are consts which only accept types.

2 years agoRustdoc style cleanups
Jacob Hoffman-Andrews [Wed, 12 Jan 2022 23:05:47 +0000 (15:05 -0800)]
Rustdoc style cleanups

 - Make "since" version numbers grey again (regressed in #92602).
 - Remove unneeded selectors for when crate filter dropdown is a
   sibling of search-input.
 - Crate filter dropdown doesn't need to be 100% width on mobile.
 - Only build crate filter dropdown when there is more than one crate.
 - Remove unused addCrateDropdown.

2 years agoRollup merge of #92960 - scottmcm:carrying-bignum, r=Mark-Simulacrum
Matthias Krüger [Mon, 17 Jan 2022 19:07:10 +0000 (20:07 +0100)]
Rollup merge of #92960 - scottmcm:carrying-bignum, r=Mark-Simulacrum

Use `carrying_{mul|add}` in `num::bignum`

Now that we have (unstable) methods for this, we don't need the bespoke trait methods for it in the `bignum` implementation.

cc #85532

2 years agoRollup merge of #92956 - scottmcm:nonzero-log2, r=dtolnay
Matthias Krüger [Mon, 17 Jan 2022 19:07:09 +0000 (20:07 +0100)]
Rollup merge of #92956 - scottmcm:nonzero-log2, r=dtolnay

Add `log2` and `log10` to `NonZeroU*`

This version is nice in that it doesn't need to worry about zeros, and thus doesn't have any error cases.

cc `int_log` tracking issue #70887

(I didn't add them to `NonZeroI*` despite it being on `i*` since allowing negatives bring back the error cases again.)

2 years agoRollup merge of #92936 - vacuus:html-markdown-parse, r=GuillaumeGomez
Matthias Krüger [Mon, 17 Jan 2022 19:07:08 +0000 (20:07 +0100)]
Rollup merge of #92936 - vacuus:html-markdown-parse, r=GuillaumeGomez

rustdoc: Remove `collect` in `html::markdown::parse`

2 years agoRollup merge of #92877 - Amanieu:remove_llvm_nounwind, r=Mark-Simulacrum
Matthias Krüger [Mon, 17 Jan 2022 19:07:07 +0000 (20:07 +0100)]
Rollup merge of #92877 - Amanieu:remove_llvm_nounwind, r=Mark-Simulacrum

Remove LLVMRustMarkAllFunctionsNounwind

This was originally introduced in #10916 as a way to remove all landing
pads when performing LTO. However this is no longer necessary today
since rustc properly marks all functions and call-sites as nounwind
where appropriate.

In fact this is incorrect in the presence of `extern "C-unwind"` which
must create a landing pad when compiled with `-C panic=abort` so that
foreign exceptions are caught and properly turned into aborts.

2 years agoRollup merge of #92825 - pierwill:rustc-version-force-rename, r=Mark-Simulacrum
Matthias Krüger [Mon, 17 Jan 2022 19:07:06 +0000 (20:07 +0100)]
Rollup merge of #92825 - pierwill:rustc-version-force-rename, r=Mark-Simulacrum

Rename environment variable for overriding rustc version

2 years agoRollup merge of #92801 - jsha:overflow-wrap, r=GuillaumeGomez
Matthias Krüger [Mon, 17 Jan 2022 19:07:05 +0000 (20:07 +0100)]
Rollup merge of #92801 - jsha:overflow-wrap, r=GuillaumeGomez

Enable wrapping words by default

Faced with a very long word, browsers will let it overflow its
box horizontally rather than break it in the middle. We essentially
never want that behavior. We would rather break the word and keep it
inside its horizontal limits. So we apply a default overflow-wrap:
break-word/anywhere to the document as a while.

In some contexts we would rather add a horizontal scrollbar (code
blocks), or elide the excess text with an ellipsis (sidebar). Those
still work as expected.

Fixes #92771

[Some related discussion](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/wrap.20.2F.20overflow.20.2F.20scroll) and a related issue: #92421.

Demo: https://rustdoc.crud.net/jsha/overflow-wrap/std/iter/trait.Iterator.html#method.try_find

r? ``@GuillaumeGomez``

2 years agoRollup merge of #92752 - jamestiotio:error-codes-typos, r=nagisa
Matthias Krüger [Mon, 17 Jan 2022 19:07:04 +0000 (20:07 +0100)]
Rollup merge of #92752 - jamestiotio:error-codes-typos, r=nagisa

Correct minor typos in some long error code explanations

Just a little nitpick to improve the long explanations of the error codes. 😊

2 years agoRollup merge of #92729 - michaelwoerister:remove-unused-span-debuginfo, r=petrochenkov
Matthias Krüger [Mon, 17 Jan 2022 19:07:03 +0000 (20:07 +0100)]
Rollup merge of #92729 - michaelwoerister:remove-unused-span-debuginfo, r=petrochenkov

rustc_codegen_llvm: Remove (almost) unused span parameter from many functions in metadata.rs

Many functions and intermediate data structures in `rustc_codegen_llvm/src/debuginfo/metadata.rs` take a span parameter that is only used for providing a span to a `span_bug!()` invocation, in case the debuginfo typemap gets corrupted. However, this span does not really convey useful information as it just points to the first point a type is used -- and half of the time is initialized to `DUMMY_SP`.

This PR removes this span parameter from the module.

It also removes the following unused parameters from `composite_type_metadata()` together with an outdated comment:

```rust
    // Ignore source location information as long as it
    // can't be reconstructed for non-local crates.
    _file_metadata: &'ll DIFile,
    _definition_span: Span,
```

2 years agoRollup merge of #92164 - WaffleLapkin:rustc_must_implement_one_of_attr, r=Aaron1011
Matthias Krüger [Mon, 17 Jan 2022 19:07:02 +0000 (20:07 +0100)]
Rollup merge of #92164 - WaffleLapkin:rustc_must_implement_one_of_attr, r=Aaron1011

Implement `#[rustc_must_implement_one_of]` attribute

This PR adds a new attribute — `#[rustc_must_implement_one_of]` that allows changing the "minimal complete definition" of a trait. It's similar to GHC's minimal `{-# MINIMAL #-}` pragma, though `#[rustc_must_implement_one_of]` is weaker atm.

Such attribute was long wanted. It can be, for example, used in `Read` trait to make transitions to recently added `read_buf` easier:
```rust
#[rustc_must_implement_one_of(read, read_buf)]
pub trait Read {
    fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
        let mut buf = ReadBuf::new(buf);
        self.read_buf(&mut buf)?;
        Ok(buf.filled_len())
    }

    fn read_buf(&mut self, buf: &mut ReadBuf<'_>) -> Result<()> {
        default_read_buf(|b| self.read(b), buf)
    }
}

impl Read for Ty0 {}
//^ This will fail to compile even though all `Read` methods have default implementations

// Both of these will compile just fine
impl Read for Ty1 {
    fn read(&mut self, buf: &mut [u8]) -> Result<usize> { /* ... */ }
}
impl Read for Ty2 {
    fn read_buf(&mut self, buf: &mut ReadBuf<'_>) -> Result<()> { /* ... */ }
}
```

For now, this is implemented as an internal attribute to start experimenting on the design of this feature. In the future we may want to extend it:
- Allow arbitrary requirements like `a | (b & c)`
- Allow multiple requirements like
  - ```rust
    #[rustc_must_implement_one_of(a, b)]
    #[rustc_must_implement_one_of(c, d)]
    ```
- Make it appear in rustdoc documentation
- Change the syntax?
- Etc

Eventually, we should make an RFC and make this (or rather similar) attribute public.

---

I'm fairly new to compiler development and not at all sure if the implementation makes sense, but at least it passes tests :)

2 years agoRollup merge of #90498 - joshtriplett:target-tier-policy-draft-updates, r=Mark-Simulacrum
Matthias Krüger [Mon, 17 Jan 2022 19:07:01 +0000 (20:07 +0100)]
Rollup merge of #90498 - joshtriplett:target-tier-policy-draft-updates, r=Mark-Simulacrum

Clarifications in the target tier policy

We've added several targets since the introduction of the target tier policy. Based on experiences of those adding such targets, and discussions around such additions, clarify the target tier policy to make it easier to follow and work with.

None of these changes substantively change the requirements on targets. (In some cases the changes do direct target submitters to follow specific process requirements for the addition of a target, such as how to respond to requirements, where to put target-specific documentation, or what should appear in that documentation. Those changes are procedural in nature and document the procedures we already direct people to follow.)

- Clarify how to quote and respond to the target tier policy requirements. Several times, people have seemed unclear on how to respond to some of the policy requirements, particularly those that just state things the target developers must *not* do (e.g. not posting to PRs that break the target). Add a note that such requirements just need acknowledgement, nothing more.
- Clarify dependency requirements in the face of cross-compilation. I previously phrased this confusingly in terms of "host tools", since that is the case where an exception applies (allowing proprietary target libraries commonly used by binaries for the target). Rephrase it to apply equally to cross-compilation. This doesn't change the net effect of the requirements, since other requirements already cover the dependencies of the Rust toolchain.
- Clarify documentation about running binaries. The requirement for target documentation talks about "running tests", but tier 3 targets often don't support running the full testsuite, and in practice the documentation for how to run an individual binary may be more useful. Change "running tests" to "running binaries, or running tests".
- Explain where to place target-specific documentation (a subdirectory of platform-support, with a link from the platform-support entry for the target).
- Add a template for target-specific documentation.

2 years agoUse Term in ProjectionPredicate
kadmin [Sat, 8 Jan 2022 09:28:12 +0000 (09:28 +0000)]
Use Term in ProjectionPredicate

ProjectionPredicate should be able to handle both associated types and consts so this adds the
first step of that. It mainly just pipes types all the way down, not entirely sure how to handle
consts, but hopefully that'll come with time.

2 years agoAdd term
kadmin [Fri, 7 Jan 2022 03:58:32 +0000 (03:58 +0000)]
Add term

Instead of having a separate enum variant for types and consts have one but have either a const
or type.

2 years agoadd eq constraints on associated constants
kadmin [Fri, 30 Jul 2021 08:56:45 +0000 (08:56 +0000)]
add eq constraints on associated constants

2 years agoFix review comment
bjorn3 [Sat, 15 Jan 2022 18:57:47 +0000 (19:57 +0100)]
Fix review comment

2 years agoPass target_features set instead of has_feature closure
bjorn3 [Mon, 10 Jan 2022 14:48:05 +0000 (15:48 +0100)]
Pass target_features set instead of has_feature closure

This avoids unnecessary monomorphizations in codegen backends

2 years agoUse Symbol for target features in asm handling
bjorn3 [Mon, 10 Jan 2022 14:32:45 +0000 (15:32 +0100)]
Use Symbol for target features in asm handling

This saves a couple of Symbol::intern calls

2 years agorustc_codegen_llvm: Remove (almost) unused span parameter from many functions in...
Michael Woerister [Mon, 10 Jan 2022 14:59:52 +0000 (15:59 +0100)]
rustc_codegen_llvm: Remove (almost) unused span parameter from many functions in metadata.rs.

2 years agoupdate test assertion
Krasimir Georgiev [Mon, 17 Jan 2022 15:20:46 +0000 (16:20 +0100)]
update test assertion

2 years agoupdate codegen test for LLVM 14
Krasimir Georgiev [Mon, 17 Jan 2022 14:57:08 +0000 (15:57 +0100)]
update codegen test for LLVM 14

Fixes https://github.com/rust-lang/rust/issues/93003.

2 years agoAuto merge of #90986 - camsteffen:nested-filter, r=cjgillot
bors [Mon, 17 Jan 2022 14:50:50 +0000 (14:50 +0000)]
Auto merge of #90986 - camsteffen:nested-filter, r=cjgillot

Replace `NestedVisitorMap` with generic `NestedFilter`

This is an attempt to make the `intravisit::Visitor` API simpler and "more const" with regard to nested visiting.

With this change, `intravisit::Visitor` does not visit nested things by default, unless you specify `type NestedFilter = nested_filter::OnlyBodies` (or `All`). `nested_visit_map` returns `Self::Map` instead of `NestedVisitorMap<Self::Map>`. It panics by default (unreachable if `type NestedFilter` is omitted).

One somewhat trixty thing here is that `nested_filter::{OnlyBodies, All}` live in `rustc_middle` so that they may have `type Map = map::Map` and so that `impl Visitor`s never need to specify `type Map` - it has a default of `Self::NestedFilter::Map`.

2 years agoMerge commit '8d14c94b5c0a66241b4244f1c60ac5859cec1d97' into clippyup
flip1995 [Mon, 17 Jan 2022 12:29:07 +0000 (13:29 +0100)]
Merge commit '8d14c94b5c0a66241b4244f1c60ac5859cec1d97' into clippyup

2 years agoAuto merge of #8292 - marekdownar:8239, r=xFrednet
bors [Mon, 17 Jan 2022 12:08:30 +0000 (12:08 +0000)]
Auto merge of #8292 - marekdownar:8239, r=xFrednet

issue #8239: Printed hint for lint or_fun_call is cropped and does no…

fixes rust-lang/rust-clippy#8239

changelog: [`or_fun_call`]: if suggestion contains more lines than MAX_SUGGESTION_HIGHLIGHT_LINES it is stripped to one line

2 years agoAuto merge of #8302 - xFrednet:0000-move-return-self-not-must-use, r=flip1995
bors [Mon, 17 Jan 2022 11:35:58 +0000 (11:35 +0000)]
Auto merge of #8302 - xFrednet:0000-move-return-self-not-must-use, r=flip1995

Move `return_self_not_must_use` to `pedantic`

r? `@flip1995`

changelog: none

2 years agoMove `return_self_not_must_use` to `pedantic`
xFrednet [Mon, 17 Jan 2022 11:25:38 +0000 (12:25 +0100)]
Move `return_self_not_must_use` to `pedantic`

2 years agoremoving unsafe from test fn's && renaming shrink to sugg_span
Marek Downar [Mon, 17 Jan 2022 11:34:03 +0000 (12:34 +0100)]
removing unsafe from test fn's && renaming shrink to sugg_span

2 years agoAuto merge of #92816 - tmiasko:rm-llvm-asm, r=Amanieu
bors [Mon, 17 Jan 2022 09:40:29 +0000 (09:40 +0000)]
Auto merge of #92816 - tmiasko:rm-llvm-asm, r=Amanieu

Remove deprecated LLVM-style inline assembly

The `llvm_asm!` was deprecated back in #87590 1.56.0, with intention to remove
it once `asm!` was stabilized, which already happened in #91728 1.59.0. Now it
is time to remove `llvm_asm!` to avoid continued maintenance cost.

Closes #70173.
Closes #92794.
Closes #87612.
Closes #82065.

cc `@rust-lang/wg-inline-asm`

r? `@Amanieu`

2 years agoAuto merge of #8299 - marekdownar:8214, r=Manishearth
bors [Mon, 17 Jan 2022 07:04:06 +0000 (07:04 +0000)]
Auto merge of #8299 - marekdownar:8214, r=Manishearth

#8214 cmp_owned suggestion flips the comparison

changelog: ``[`cmp_owned`]`` fixes #8214 so that the suggestion does not flip the comparison

2 years agoAuto merge of #8297 - Jarcho:if_same_then_else_7579, r=Manishearth
bors [Mon, 17 Jan 2022 06:48:01 +0000 (06:48 +0000)]
Auto merge of #8297 - Jarcho:if_same_then_else_7579, r=Manishearth

Don't lint `if_same_then_else` with `if let` conditions

fixes #7579

changelog: Don't lint `if_same_then_else` with `if let` conditions

2 years agoAdd `~const` bound test for negative impls
woppopo [Mon, 17 Jan 2022 05:50:40 +0000 (14:50 +0900)]
Add `~const` bound test for negative impls

2 years agoAuto merge of #92996 - matthiaskrgr:rollup-50wpzva, r=matthiaskrgr
bors [Mon, 17 Jan 2022 05:46:53 +0000 (05:46 +0000)]
Auto merge of #92996 - matthiaskrgr:rollup-50wpzva, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #92795 (Link sidebar "location" heading to top of page)
 - #92799 (Remove some unnecessary uses of `FieldDef::ident`)
 - #92808 (Fix `try wrapping expression in variant` suggestion with struct field shorthand)
 - #92819 (rustdoc: remove hand-rolled isatty)
 - #92876 (Fix suggesting turbofish with lifetime arguments)
 - #92921 (Rename Printer constructor from mk_printer() to Printer::new())
 - #92937 (rustdoc: Add missing dot separator)
 - #92953 (Copy an example to PartialOrd as well)
 - #92977 (Docs: recommend VecDeque instead of Vec::remove(0))
 - #92981 (fix const_ptr_offset_from tracking issue)

Failed merges:

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

2 years agoRollup merge of #92981 - RalfJung:const_ptr_offset_from, r=dtolnay
Matthias Krüger [Mon, 17 Jan 2022 05:08:19 +0000 (06:08 +0100)]
Rollup merge of #92981 - RalfJung:const_ptr_offset_from, r=dtolnay

fix const_ptr_offset_from tracking issue

The old tracking issue #41079 was for exposing those functions at all, and got closed when they were stabilized. We had nothing tracking their `const`ness so I opened a new tracking issue: https://github.com/rust-lang/rust/issues/92980.

2 years agoRollup merge of #92977 - kornelski:popdoc, r=dtolnay
Matthias Krüger [Mon, 17 Jan 2022 05:08:18 +0000 (06:08 +0100)]
Rollup merge of #92977 - kornelski:popdoc, r=dtolnay

Docs: recommend VecDeque instead of Vec::remove(0)

Suggestion based on a [discussion](https://internals.rust-lang.org/t/should-vec-have-a-try-remove-mut-self-usize-option-t-function/15964/9?u=kornel) where user needlessly struggled with `remove(0)` and accidentally created a quadratic cost.

2 years agoRollup merge of #92953 - azdavis:azdavis-copy-example, r=dtolnay
Matthias Krüger [Mon, 17 Jan 2022 05:08:17 +0000 (06:08 +0100)]
Rollup merge of #92953 - azdavis:azdavis-copy-example, r=dtolnay

Copy an example to PartialOrd as well

In https://github.com/rust-lang/rust/pull/88202 I added an example for deriving PartialOrd on enums, but only later did I realize that I actually put the example on Ord.

This copies the example to PartialOrd as well, which is where I intended for it to be.

We could also delete the example on Ord, but I see there's already some highly similar examples shared between Ord and PartialOrd, so I figured we could leave it.

I also changed some type annotations in an example from `x : T` to the more common style (in Rust) of `x: T`.

2 years agoRollup merge of #92937 - GuillaumeGomez:dot-separator, r=jsha
Matthias Krüger [Mon, 17 Jan 2022 05:08:17 +0000 (06:08 +0100)]
Rollup merge of #92937 - GuillaumeGomez:dot-separator, r=jsha

rustdoc: Add missing dot separator

Fixes #92901.

![Screenshot from 2022-01-15 17-47-18](https://user-images.githubusercontent.com/3050060/149631249-e2c0c3a4-9ed8-48e2-92cc-79a5bb347b35.png)

r? ``@jsha``

2 years agoRollup merge of #92921 - dtolnay:printernew, r=wesleywiser
Matthias Krüger [Mon, 17 Jan 2022 05:08:16 +0000 (06:08 +0100)]
Rollup merge of #92921 - dtolnay:printernew, r=wesleywiser

Rename Printer constructor from mk_printer() to Printer::new()

The original naming is left over from 2011 which was before impl blocks and associated functions existed.

https://github.com/rust-lang/rust/blob/21313d623a505086b2973f30c19db4f1d6ec8f61/src/comp/pretty/pp.rs

2 years agoRollup merge of #92876 - compiler-errors:fix-turbofish-lifetime-suggestion, r=nagisa
Matthias Krüger [Mon, 17 Jan 2022 05:08:15 +0000 (06:08 +0100)]
Rollup merge of #92876 - compiler-errors:fix-turbofish-lifetime-suggestion, r=nagisa

Fix suggesting turbofish with lifetime arguments

Now we suggest turbofish correctly given exprs like `foo<'_>`.

Also fix suggestion when we have `let x = foo<bar, baz>;` which was broken.

2 years agoRollup merge of #92819 - euclio:atty, r=CraftSpider
Matthias Krüger [Mon, 17 Jan 2022 05:08:14 +0000 (06:08 +0100)]
Rollup merge of #92819 - euclio:atty, r=CraftSpider

rustdoc: remove hand-rolled isatty

This PR replaces bindings to the platform-specific isatty APIs with the `isatty` crate, as done elsewhere in the repository.

2 years agoRollup merge of #92808 - compiler-errors:wrap-struct-shorthand-field-in-variant,...
Matthias Krüger [Mon, 17 Jan 2022 05:08:13 +0000 (06:08 +0100)]
Rollup merge of #92808 - compiler-errors:wrap-struct-shorthand-field-in-variant, r=davidtwco

Fix `try wrapping expression in variant` suggestion with struct field shorthand

Fixes a broken suggestion: [playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=83fe2dbfe1485f8cfca1aef2a6582e77)

before:
```
error[E0308]: mismatched types
 --> src/main.rs:7:19
  |
7 |     let x = Foo { bar };
  |                   ^^^ expected enum `Option`, found integer
  |
  = note: expected enum `Option<i32>`
             found type `{integer}`
help: try wrapping the expression in `Some`
  |
7 |     let x = Foo { Some(bar) };
  |                   +++++   +
```

after:
```
error[E0308]: mismatched types
 --> src/main.rs:7:19
  |
7 |     let x = Foo { bar };
  |                   ^^^ expected enum `Option`, found integer
  |
  = note: expected enum `Option<i32>`
             found type `{integer}`
help: try wrapping the expression in `Some`
  |
7 |     let x = Foo { bar: Some(bar) };
  |                   ~~~~~~~~~~~~~~
```

r? ``@m-ou-se``
since you touched the code last in #91080

2 years agoRollup merge of #92799 - rust-lang:followup-from-92533, r=Aaron1011
Matthias Krüger [Mon, 17 Jan 2022 05:08:11 +0000 (06:08 +0100)]
Rollup merge of #92799 - rust-lang:followup-from-92533, r=Aaron1011

Remove some unnecessary uses of `FieldDef::ident`

Followup from #92533.

cc ``@Aaron1011`` ``@petrochenkov``

2 years agoRollup merge of #92795 - jsha:link-to-top, r=GuillaumeGomez
Matthias Krüger [Mon, 17 Jan 2022 05:08:10 +0000 (06:08 +0100)]
Rollup merge of #92795 - jsha:link-to-top, r=GuillaumeGomez

Link sidebar "location" heading to top of page

This makes it easy, when you are scrolled far down in a page, to jump back to the top.

Demo: https://rustdoc.crud.net/jsha/link-to-top/std/string/struct.String.html

r? ``@GuillaumeGomez``

2 years agoAuto merge of #92473 - petrochenkov:ltrattr2, r=Aaron1011
bors [Mon, 17 Jan 2022 02:06:54 +0000 (02:06 +0000)]
Auto merge of #92473 - petrochenkov:ltrattr2, r=Aaron1011

expand: Pick `cfg`s and `cfg_attrs` one by one, like other attributes

This is a rebase of https://github.com/rust-lang/rust/pull/83354, but without any language-changing parts ~(except for https://github.com/rust-lang/rust/pull/84110)~, i.e. the attribute expansion order is the same.

This is a pre-requisite for any other changes making cfg attributes closer to regular macro attributes
- Possibly changing their expansion order (https://github.com/rust-lang/rust/issues/83331)
- Keeping macro backtraces for cfg attributes, or otherwise making them visible after expansion without keeping them in place literally (https://github.com/rust-lang/rust/pull/84110).

Two exceptions to the "one by one" behavior are:
- cfgs eagerly expanded by `derive` and `cfg_eval`, they are still expanded in a batch, that's by design.
- cfgs at the crate root, they are currently expanded not during the main expansion pass, but before that, during `#![feature]` collection. I'll try to disentangle that logic later in a separate PR.

r? `@Aaron1011`

2 years agoDon't lint `if_same_then_else` with `if let` conditions
Jason Newcomb [Sun, 16 Jan 2022 14:46:02 +0000 (09:46 -0500)]
Don't lint `if_same_then_else` with `if let` conditions

2 years agoAuto merge of #92935 - Xanewok:update-rls, r=pietroalbini
bors [Sun, 16 Jan 2022 23:03:33 +0000 (23:03 +0000)]
Auto merge of #92935 - Xanewok:update-rls, r=pietroalbini

Update RLS and drop rustc-ap-packages

Closes #91543

r? `@pietroalbini`

cc `@calebcartwright` `@flip1995`

2 years agoFix Visitor::NestedFilter in Clippy
Cameron Steffen [Sat, 15 Jan 2022 22:07:52 +0000 (16:07 -0600)]
Fix Visitor::NestedFilter in Clippy

2 years agoFormat clippy
Cameron Steffen [Sun, 16 Jan 2022 21:58:54 +0000 (15:58 -0600)]
Format clippy

2 years agoReplace NestedVisitorMap with NestedFilter
Cameron Steffen [Wed, 3 Nov 2021 23:03:12 +0000 (18:03 -0500)]
Replace NestedVisitorMap with NestedFilter

2 years agofix const_ptr_offset_from tracking issue
Ralf Jung [Sun, 16 Jan 2022 19:24:46 +0000 (14:24 -0500)]
fix const_ptr_offset_from tracking issue

2 years agoAuto merge of #8203 - pmnoxx:piotr-next-lint, r=llogiq
bors [Sun, 16 Jan 2022 20:02:28 +0000 (20:02 +0000)]
Auto merge of #8203 - pmnoxx:piotr-next-lint, r=llogiq

New lint: `iter_overeager_cloned`

Closes #8202

changelog: New lint: [`iter_overeager_cloned`]

2 years ago#8214 cmp_owned suggestion flips the comparison
Marek Downar [Sun, 16 Jan 2022 19:27:00 +0000 (20:27 +0100)]
#8214 cmp_owned suggestion flips the comparison

2 years agoFix tests
Piotr Mikulski [Sun, 16 Jan 2022 18:32:45 +0000 (10:32 -0800)]
Fix tests

2 years agoFix clippy warnings
Piotr Mikulski [Sun, 16 Jan 2022 18:19:48 +0000 (10:19 -0800)]
Fix clippy warnings

2 years agoNew line: cloned_next
Piotr Mikulski [Fri, 31 Dec 2021 06:39:53 +0000 (22:39 -0800)]
New line: cloned_next

2 years agoDocs: recommend VecDeque instead of Vec::remove(0)
Kornel [Sun, 16 Jan 2022 16:51:55 +0000 (16:51 +0000)]
Docs: recommend VecDeque instead of Vec::remove(0)

2 years agoAuto merge of #92970 - matthiaskrgr:rollup-tcx7cfb, r=matthiaskrgr
bors [Sun, 16 Jan 2022 17:22:57 +0000 (17:22 +0000)]
Auto merge of #92970 - matthiaskrgr:rollup-tcx7cfb, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #92487 (Fix unclosed boxes in pretty printing of TraitAlias)
 - #92581 (ARMv6K Horizon - Enable default libraries)
 - #92619 (Add diagnostic items for macros)
 - #92635 (rustdoc: Yet more intra-doc links cleanup)
 - #92646 (feat: rustc_pass_by_value lint attribute)
 - #92706 (Clarify explicitly that BTree{Map,Set} are ordered.)
 - #92710 (Include Projections when elaborating TypeOutlives)
 - #92746 (Parse `Ty?` as `Option<Ty>` and provide structured suggestion)
 - #92792 (rustdoc: fix intra-link for generic trait impls)
 - #92814 (remove unused FIXME)

Failed merges:

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

2 years agoRollup merge of #92814 - lcnr:unused-fixme, r=Mark-Simulacrum
Matthias Krüger [Sun, 16 Jan 2022 15:58:20 +0000 (16:58 +0100)]
Rollup merge of #92814 - lcnr:unused-fixme, r=Mark-Simulacrum

remove unused FIXME

#56935 seems to be fixed.

2 years agoRollup merge of #92792 - mdibaiee:92662/fix-intra-doc-generics, r=camelid
Matthias Krüger [Sun, 16 Jan 2022 15:58:19 +0000 (16:58 +0100)]
Rollup merge of #92792 - mdibaiee:92662/fix-intra-doc-generics, r=camelid

rustdoc: fix intra-link for generic trait impls

fixes #92662

r? `````@camelid`````

2 years agoRollup merge of #92746 - estebank:question-mark-in-type, r=davidtwco
Matthias Krüger [Sun, 16 Jan 2022 15:58:18 +0000 (16:58 +0100)]
Rollup merge of #92746 - estebank:question-mark-in-type, r=davidtwco

Parse `Ty?` as `Option<Ty>` and provide structured suggestion

Swift has specific syntax that desugars to `Option<T>` similar to our
`?` operator, which means that people might try to use it in Rust. Parse
it and gracefully recover.

2 years agoRollup merge of #92710 - jackh726:issue-92280, r=nikomatsakis
Matthias Krüger [Sun, 16 Jan 2022 15:58:17 +0000 (16:58 +0100)]
Rollup merge of #92710 - jackh726:issue-92280, r=nikomatsakis

Include Projections when elaborating TypeOutlives

Fixes #92280

In `Elaborator`, we elaborate that `Foo<<Bar as Baz>::Assoc>: 'a` -> `<Bar as Baz>::Assoc: 'a`. This is the same rule that would be applied to any other `Param`. If there are escaping vars, we continue to do nothing.

r? `@nikomatsakis`

2 years agoRollup merge of #92706 - umanwizard:btree, r=dtolnay
Matthias Krüger [Sun, 16 Jan 2022 15:58:16 +0000 (16:58 +0100)]
Rollup merge of #92706 - umanwizard:btree, r=dtolnay

Clarify explicitly that BTree{Map,Set} are ordered.

One of the main reasons one would want to use a BTree{Map,Set} rather than a Hash{Map,Set} is because they maintain their keys in sorted order; but this was never explicitly stated in the top-level docs (it was only indirectly alluded to there, and stated explicitly in the docs for `iter`, `values`, etc.)

This PR states the ordering guarantee more prominently.

2 years agoRollup merge of #92646 - mdibaiee:76935/pass-by-value, r=lcnr
Matthias Krüger [Sun, 16 Jan 2022 15:58:15 +0000 (16:58 +0100)]
Rollup merge of #92646 - mdibaiee:76935/pass-by-value, r=lcnr

feat: rustc_pass_by_value lint attribute

Useful for thin wrapper attributes that are best passed as value instead
of reference.

Fixes #76935

2 years agoRollup merge of #92635 - camelid:yet-more-cleanup, r=Manishearth
Matthias Krüger [Sun, 16 Jan 2022 15:58:14 +0000 (16:58 +0100)]
Rollup merge of #92635 - camelid:yet-more-cleanup, r=Manishearth

rustdoc: Yet more intra-doc links cleanup

r? `@Manishearth`

2 years agoRollup merge of #92619 - Alexendoo:macro-diagnostic-items, r=matthewjasper
Matthias Krüger [Sun, 16 Jan 2022 15:58:14 +0000 (16:58 +0100)]
Rollup merge of #92619 - Alexendoo:macro-diagnostic-items, r=matthewjasper

Add diagnostic items for macros

For use in Clippy, it adds diagnostic items to all the stable public macros

Clippy has lints that look for almost all of these (currently by name or path), but there are a few that aren't currently part of any lint, I could remove those if it's preferred to add them as needed rather than ahead of time

2 years agoRollup merge of #92581 - Meziu:armv6k-3ds-target, r=nagisa
Matthias Krüger [Sun, 16 Jan 2022 15:58:12 +0000 (16:58 +0100)]
Rollup merge of #92581 - Meziu:armv6k-3ds-target, r=nagisa

ARMv6K Horizon - Enable default libraries

Due to the nature of the external gcc linker, default libraries are required, even for `no_std` programs.

2 years agoRollup merge of #92487 - dtolnay:traitalias, r=matthewjasper
Matthias Krüger [Sun, 16 Jan 2022 15:58:10 +0000 (16:58 +0100)]
Rollup merge of #92487 - dtolnay:traitalias, r=matthewjasper

Fix unclosed boxes in pretty printing of TraitAlias

This was causing trait aliases to not even render at all in stringified / pretty printed output.

```rust
macro_rules! repro {
    ($item:item) => {
        stringify!($item)
    };
}

fn main() {
    println!("{:?}", repro!(pub trait Trait<T> = Sized where T: 'a;));
}
```

Before:&ensp;`""`
After:&ensp;`"pub trait Trait<T> = Sized where T: 'a;"`

The fix is copied from how `head`/`end` for `ItemKind::Use`, `ItemKind::ExternCrate`, and `ItemKind::Mod` are all done in the pretty printer:

https://github.com/rust-lang/rust/blob/dd3ac41495e85a9b7b5cb3186379d02ce17e51fe/compiler/rustc_ast_pretty/src/pprust/state.rs#L1178-L1184

2 years agoUse new Racer from crates.io
Igor Matuszewski [Sat, 15 Jan 2022 17:09:29 +0000 (18:09 +0100)]
Use new Racer from crates.io

2 years agoDrop duplicate checks for now missing rustc_ast dep in tidy
Igor Matuszewski [Sat, 15 Jan 2022 16:47:09 +0000 (17:47 +0100)]
Drop duplicate checks for now missing rustc_ast dep in tidy

2 years agoUpdate RLS and drop rustc-ap-packages
Igor Matuszewski [Sat, 15 Jan 2022 16:31:37 +0000 (17:31 +0100)]
Update RLS and drop rustc-ap-packages

2 years agoAuto merge of #92245 - petrochenkov:cmrval, r=nagisa
bors [Sun, 16 Jan 2022 14:25:25 +0000 (14:25 +0000)]
Auto merge of #92245 - petrochenkov:cmrval, r=nagisa

rustc_metadata: Switch all decoder methods from vectors to iterators

To avoid allocations in some cases.

Also remove unnecessary `is_proc_macro_crate` checks from decoder, currently the general strategy is to shift all the work to the encoder and assume that all the encoded data is correct and can be decoded unconditionally in the decoder.

2 years agoAuto merge of #8295 - Jarcho:useless_format_8290, r=giraffate
bors [Sun, 16 Jan 2022 13:24:08 +0000 (13:24 +0000)]
Auto merge of #8295 - Jarcho:useless_format_8290, r=giraffate

Handle implicit named arguments in `useless_format`

fixes #8290

Ideally this would fix the macro parsing code to handle this, but this is a smaller change and easier to back port.

changelog: Handle implicit named arguments in `useless_format`

2 years agoAuto merge of #8284 - xFrednet:0000-update-copyright-year-i-am-procrastinating, r...
bors [Sun, 16 Jan 2022 12:33:08 +0000 (12:33 +0000)]
Auto merge of #8284 - xFrednet:0000-update-copyright-year-i-am-procrastinating, r=giraffate

Update copyright year for Clippy (2022 edition)

At this point, I'm just searching for small things to do instead of sleeping or working on my bachelor thesis. :sweat_smile:  Taking one day off will be fine :upside_down_face:

changelog: none