]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoBump download-ci-llvm-stamp for LLD inclusion
Aaron Hill [Sun, 5 Dec 2021 20:25:48 +0000 (14:25 -0600)]
Bump download-ci-llvm-stamp for LLD inclusion

This will make 'lld' available locally now, instead of
needing to wait for the next LLVM submodule bump.

2 years agoAuto merge of #91555 - matthiaskrgr:rollup-pq0iaq7, r=matthiaskrgr
bors [Sun, 5 Dec 2021 15:33:44 +0000 (15:33 +0000)]
Auto merge of #91555 - matthiaskrgr:rollup-pq0iaq7, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - #90529 (Skip reborrows in AbstractConstBuilder)
 - #91437 (Pretty print empty blocks as {})
 - #91450 (Don't suggest types whose inner type is erroneous)
 - #91535 (Stabilize `-Z emit-future-incompat` as `--json future-incompat`)

Failed merges:

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

2 years agoRollup merge of #91535 - Aaron1011:stabilize-future-incompat, r=nagisa
Matthias Krüger [Sun, 5 Dec 2021 14:04:22 +0000 (15:04 +0100)]
Rollup merge of #91535 - Aaron1011:stabilize-future-incompat, r=nagisa

Stabilize `-Z emit-future-incompat` as `--json future-incompat`

The FCP was completed in https://github.com/rust-lang/rust/issues/71249

2 years agoRollup merge of #91450 - hkmatsumoto:hide-type-error, r=estebank
Matthias Krüger [Sun, 5 Dec 2021 14:04:21 +0000 (15:04 +0100)]
Rollup merge of #91450 - hkmatsumoto:hide-type-error, r=estebank

Don't suggest types whose inner type is erroneous

Currently, we check if the returned type equals to `tcx.ty_error()` not to emit
erroneous types, but this has a pitfall; for example,
`Option<[type error]> != tcx.ty_error()` holds.

Fixes #91371.

2 years agoRollup merge of #91437 - dtolnay:emptybrace, r=nagisa
Matthias Krüger [Sun, 5 Dec 2021 14:04:20 +0000 (15:04 +0100)]
Rollup merge of #91437 - dtolnay:emptybrace, r=nagisa

Pretty print empty blocks as {}

**Example:**

```rust
macro_rules! p {
    ($e:expr) => {
        println!("{}", stringify!($e));
    };
    ($i:item) => {
        println!("{}", stringify!($i));
    };
}

fn main() {
    p!(if true {});
    p!(struct S {});
}
```

**Before:**

```console
if true { }
struct S {
}
```

**After:**

```console
if true {}
struct S {}
```

This affects [`dbg!`](https://doc.rust-lang.org/std/macro.dbg.html), as well as ecosystem uses of stringify such as in [`anyhow::ensure!`](https://docs.rs/anyhow/1/anyhow/macro.ensure.html). Printing a `{ }` in today's heavily rustfmt'd world comes out looking jarring/sloppy.

2 years agoRollup merge of #90529 - b-naber:reborrows-consts, r=lcnr
Matthias Krüger [Sun, 5 Dec 2021 14:04:20 +0000 (15:04 +0100)]
Rollup merge of #90529 - b-naber:reborrows-consts, r=lcnr

Skip reborrows in AbstractConstBuilder

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

Temporary fix to prevent confusing diagnostics that refer to implicit borrows and derefs until we allow borrows and derefs on constant expressions.

r? `@oli-obk`

2 years agoAuto merge of #88611 - m-ou-se:array-into-iter-new-deprecate, r=joshtriplett
bors [Sun, 5 Dec 2021 12:53:01 +0000 (12:53 +0000)]
Auto merge of #88611 - m-ou-se:array-into-iter-new-deprecate, r=joshtriplett

Deprecate array::IntoIter::new.

2 years agobless tests
b-naber [Sun, 5 Dec 2021 10:47:07 +0000 (11:47 +0100)]
bless tests

2 years agoskip reborrows during AbstractConst building
b-naber [Thu, 2 Dec 2021 11:43:36 +0000 (12:43 +0100)]
skip reborrows during AbstractConst building

2 years agoadd test
b-naber [Wed, 3 Nov 2021 14:36:38 +0000 (15:36 +0100)]
add test

2 years agoAuto merge of #91510 - camelid:two-cleanups, r=GuillaumeGomez
bors [Sun, 5 Dec 2021 09:48:39 +0000 (09:48 +0000)]
Auto merge of #91510 - camelid:two-cleanups, r=GuillaumeGomez

rustdoc: Cleanup two things in `clean::types`

Explanations are in the individual commits.

2 years agoAuto merge of #91229 - Aaron1011:dist-lld, r=Mark-Simulacrum
bors [Sun, 5 Dec 2021 06:46:58 +0000 (06:46 +0000)]
Auto merge of #91229 - Aaron1011:dist-lld, r=Mark-Simulacrum

Include `lld` in `rust-dev` package

Fixes #88941

This will allow using `download-ci-llvm` while still having LLD
available.

2 years agoAuto merge of #91475 - ecstatic-morse:mir-pass-manager3, r=oli-obk
bors [Sun, 5 Dec 2021 03:41:18 +0000 (03:41 +0000)]
Auto merge of #91475 - ecstatic-morse:mir-pass-manager3, r=oli-obk

Add a MIR pass manager (Taylor's Version)

The final draft of #91386 and #77665.

While the compile-time constraints in #91386 are cool, I decided on a more minimal approach for now. I want to explore phase constraints and maybe relative-ordering constraints in the future, though. This should preserve existing behavior **exactly** (please let me know if it doesn't) while making the following changes to the way we organize things today:

- Each `MirPhase` now corresponds to a single MIR pass. `run_passes` is not responsible for listing the correct MIR phase.
- `run_passes` no longer silently skips passes if the declared MIR phase is greater than or equal to the body's. This has bitten me multiple times. If you want this behavior, you can always branch on `body.phase` yourself.
- If your pass is solely to emit errors, you can use the `MirLint` interface instead, which gets a shared reference to `Body` instead of a mutable one. By differentiating the two, I hope to make it clearer in the short term where lints belong in the pipeline. In the long term perhaps we could enforce this at compile-time?
- MIR is no longer dumped for passes that aren't enabled, or for lints.

I tried to check that `-Zvalidate` still works correctly, since the MIR phase is now updated as soon as the associated pass is done, instead of at the end of all the passes in `run_passes`. However, it looks like `-Zvalidate` is broken with current nightlies anyways :cry: (it spits out a bunch of errors).

cc `@oli-obk` `@wesleywiser`

r? rust-lang/wg-mir-opt

2 years agoAuto merge of #91539 - matthiaskrgr:rollup-rnl10yb, r=matthiaskrgr
bors [Sun, 5 Dec 2021 00:38:01 +0000 (00:38 +0000)]
Auto merge of #91539 - matthiaskrgr:rollup-rnl10yb, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #89642 (environ on macos uses directly libc which has the correct signature.)
 - #90022 (Explain why `Self` is invalid in generic parameters)
 - #90023 (Postpone the evaluation of constant expressions that depend on inference variables)
 - #91215 (Implement VecDeque::retain_mut)
 - #91355 (std: Stabilize the `thread_local_const_init` feature)
 - #91528 (LLVM support .insn directive)

Failed merges:

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

2 years agoRollup merge of #91528 - piegamesde:master, r=cuviper
Matthias Krüger [Sat, 4 Dec 2021 23:38:01 +0000 (00:38 +0100)]
Rollup merge of #91528 - piegamesde:master, r=cuviper

LLVM support .insn directive

Closes #90558. See also https://github.com/rust-lang/llvm-project/pull/121.

2 years agoRollup merge of #91355 - alexcrichton:stabilize-thread-local-const, r=m-ou-se
Matthias Krüger [Sat, 4 Dec 2021 23:38:00 +0000 (00:38 +0100)]
Rollup merge of #91355 - alexcrichton:stabilize-thread-local-const, r=m-ou-se

std: Stabilize the `thread_local_const_init` feature

This commit is intended to follow the stabilization disposition of the
FCP that has now finished in #84223. This stabilizes the ability to flag
thread local initializers as `const` expressions which enables the macro
to generate more efficient code for accessing it, notably removing
runtime checks for initialization.

More information can also be found in #84223 as well as the tests where
the feature usage was removed in this PR.

Closes #84223

2 years agoRollup merge of #91215 - GuillaumeGomez:vec-deque-retain-mut, r=m-ou-se
Matthias Krüger [Sat, 4 Dec 2021 23:37:59 +0000 (00:37 +0100)]
Rollup merge of #91215 - GuillaumeGomez:vec-deque-retain-mut, r=m-ou-se

Implement VecDeque::retain_mut

Part of https://github.com/rust-lang/rust/issues/90829.

In https://github.com/rust-lang/rust/pull/90772, someone suggested that `retain_mut` should also be implemented on `VecDeque`. I think that it follows the same logic (coherency). So first: is it ok? Second: should I create a new feature for it or can we put it into the same one?

r? `@joshtriplett`

2 years agoRollup merge of #90023 - b-naber:postpone_const_eval_infer_vars, r=nikomatsakis
Matthias Krüger [Sat, 4 Dec 2021 23:37:58 +0000 (00:37 +0100)]
Rollup merge of #90023 - b-naber:postpone_const_eval_infer_vars, r=nikomatsakis

Postpone the evaluation of constant expressions that depend on inference variables

Previously `delay_span_bug` calls were triggered once an inference variable was included in the substs of a constant that was to be evaluated. Some of these would merely have resulted in trait candidates being rejected, hence no real error was ever encountered, but the triggering of the `delay_span_bug` then caused an ICE in later stages of the compiler due to no error ever occurring.
We now postpone the evaluation of these constants, so any trait obligation fulfillment will simply stall on this constant and the existing type inference machinery of the compiler handles any type errors if present.

Fixes https://github.com/rust-lang/rust/issues/89320
Fixes https://github.com/rust-lang/rust/issues/89146
Fixes https://github.com/rust-lang/rust/issues/87964
Fixes https://github.com/rust-lang/rust/issues/87470
Fixes https://github.com/rust-lang/rust/issues/83288
Fixes https://github.com/rust-lang/rust/issues/83249
Fixes https://github.com/rust-lang/rust/issues/90654

I want to thank `@BoxyUwU` for cooperating on this and for providing some help.

r? `@lcnr` maybe?

2 years agoRollup merge of #90022 - hkmatsumoto:self-upper-as-generic-parameter, r=jackh726
Matthias Krüger [Sat, 4 Dec 2021 23:37:56 +0000 (00:37 +0100)]
Rollup merge of #90022 - hkmatsumoto:self-upper-as-generic-parameter, r=jackh726

Explain why `Self` is invalid in generic parameters

Close #89985.

r? `@estebank`

2 years agoRollup merge of #89642 - devnexen:macos_getenv_chng, r=m-ou-se
Matthias Krüger [Sat, 4 Dec 2021 23:37:55 +0000 (00:37 +0100)]
Rollup merge of #89642 - devnexen:macos_getenv_chng, r=m-ou-se

environ on macos uses directly libc which has the correct signature.

2 years agoInclude `lld` in `rust-dev` package
Aaron Hill [Thu, 25 Nov 2021 17:45:58 +0000 (11:45 -0600)]
Include `lld` in `rust-dev` package

Fixes #88941

This will allow using `download-ci-llvm` while still having LLD
available.

2 years agoStabilize `-Z emit-future-incompat` as `--json future-incompat`
Aaron Hill [Sat, 4 Dec 2021 19:34:20 +0000 (14:34 -0500)]
Stabilize `-Z emit-future-incompat` as `--json future-incompat`

2 years agoUpdate array::IntoIter::new deprecation version.
Mara Bos [Sat, 4 Dec 2021 18:42:37 +0000 (19:42 +0100)]
Update array::IntoIter::new deprecation version.

2 years agoUpdate docs.
Mara Bos [Fri, 3 Sep 2021 10:37:03 +0000 (12:37 +0200)]
Update docs.

2 years agoUse IntoIterator for array impl everywhere.
Mara Bos [Fri, 3 Sep 2021 10:36:33 +0000 (12:36 +0200)]
Use IntoIterator for array impl everywhere.

2 years agoSwap body of array::IntoIter::new and IntoIterator::new.
Mara Bos [Fri, 3 Sep 2021 09:44:36 +0000 (11:44 +0200)]
Swap body of array::IntoIter::new and IntoIterator::new.

2 years agoDeprecate array::IntoIter::new.
Mara Bos [Fri, 3 Sep 2021 09:31:09 +0000 (11:31 +0200)]
Deprecate array::IntoIter::new.

2 years agoLLVM support .insn directive
piegames [Wed, 17 Nov 2021 23:57:25 +0000 (00:57 +0100)]
LLVM support .insn directive

2 years agoDon't suggest types whose inner type is erroneous
Hirochika Matsumoto [Thu, 2 Dec 2021 10:22:46 +0000 (19:22 +0900)]
Don't suggest types whose inner type is erroneous

Currently, we check if the returned type equals to `tcx.ty_error()` not to emit
erroneous types, but this has a pitfall; for example,
`Option<[type error]> != tcx.ty_error()` holds.

2 years agoAuto merge of #91517 - matthiaskrgr:rollup-3fmp4go, r=matthiaskrgr
bors [Sat, 4 Dec 2021 13:23:50 +0000 (13:23 +0000)]
Auto merge of #91517 - matthiaskrgr:rollup-3fmp4go, r=matthiaskrgr

Rollup of 3 pull requests

Successful merges:

 - #87054 (Add a `try_reduce` method to the Iterator trait)
 - #89701 (Updated error message for accidental uses of derive attribute as a crate attribute)
 - #90519 (Keep spans for generics in `#[derive(_)]` desugaring)

Failed merges:

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

2 years agoRollup merge of #90519 - estebank:issue-84003, r=petrochenkov
Matthias Krüger [Sat, 4 Dec 2021 09:42:20 +0000 (10:42 +0100)]
Rollup merge of #90519 - estebank:issue-84003, r=petrochenkov

Keep spans for generics in `#[derive(_)]` desugaring

Keep the spans for generics coming from a `derive`d Item, so that errors
and suggestions have better detail.

Fix #84003.

2 years agoRollup merge of #89701 - tom7980:issue-89566-fix, r=petrochenkov
Matthias Krüger [Sat, 4 Dec 2021 09:42:19 +0000 (10:42 +0100)]
Rollup merge of #89701 - tom7980:issue-89566-fix, r=petrochenkov

Updated error message for accidental uses of derive attribute as a crate attribute

This partially fixes the original issue #89566 by adding derive to the list of invalid crate attributes and then providing an updated error message however I'm not sure how to prevent the resolution error message from emitting without causing the compiler to just abort when it finds an invalid crate attribute (which I'd prefer not to do so we can find and emit other errors).

`@petrochenkov` I have been told you may have some insight on why it's emitting the resolution error though honestly I'm not sure if we need to worry about fixing it as long as we can provide the invalid crate attribute error also (which happens first anyway)

2 years agoRollup merge of #87054 - kit-981:master, r=scottmcm
Matthias Krüger [Sat, 4 Dec 2021 09:42:19 +0000 (10:42 +0100)]
Rollup merge of #87054 - kit-981:master, r=scottmcm

Add a `try_reduce` method to the Iterator trait

Tracking issue: #87053

2 years agoAuto merge of #88439 - cynecx:unwind_asm, r=Amanieu
bors [Sat, 4 Dec 2021 05:59:16 +0000 (05:59 +0000)]
Auto merge of #88439 - cynecx:unwind_asm, r=Amanieu

Unwinding support for inline assembly

r? `@Amanieu`

2 years agoRemove single-use `GenericParamDef::get_type` function
Noah Lev [Sat, 4 Dec 2021 05:05:31 +0000 (21:05 -0800)]
Remove single-use `GenericParamDef::get_type` function

Rationale:

* The name was confusing.

* It was only used in one place.

* That place didn't actually need all the functionality of `get_type`;
  rather, removing `get_type` makes that code clearer.

2 years agoAdd a `try_reduce` method to the Iterator trait
kit [Sun, 11 Jul 2021 05:43:30 +0000 (15:43 +1000)]
Add a `try_reduce` method to the Iterator trait

2 years agorustdoc: Remove single-use `Lifetime::get_ref()` function
Noah Lev [Sat, 4 Dec 2021 04:08:11 +0000 (20:08 -0800)]
rustdoc: Remove single-use `Lifetime::get_ref()` function

2 years agoAuto merge of #91505 - matthiaskrgr:rollup-orxgsxo, r=matthiaskrgr
bors [Sat, 4 Dec 2021 02:53:54 +0000 (02:53 +0000)]
Auto merge of #91505 - matthiaskrgr:rollup-orxgsxo, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #90538 (Document how recursion is handled for `ty::Ty`)
 - #90851 (Add unchecked downcast methods)
 - #91209 (Implement ``@snapshot`` check for htmldocck)
 - #91385 (Suggest the `pat_param` specifier before `|` on 2021 edition )
 - #91478 (Remove incorrect newline from float cast suggestion)
 - #91481 (Use let_else in some more places in rustc_lint)
 - #91488 (Fix ICE when `yield`ing in function returning `impl Trait`)

Failed merges:

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

2 years agoRollup merge of #91488 - compiler-errors:issue-91477, r=estebank
Matthias Krüger [Sat, 4 Dec 2021 01:26:26 +0000 (02:26 +0100)]
Rollup merge of #91488 - compiler-errors:issue-91477, r=estebank

Fix ICE when `yield`ing in function returning `impl Trait`

Change an assert to a `delay_span_bug` and remove an unwrap, that should fix it.

Fixes #91477

2 years agoRollup merge of #91481 - est31:let_else, r=jackh726
Matthias Krüger [Sat, 4 Dec 2021 01:26:25 +0000 (02:26 +0100)]
Rollup merge of #91481 - est31:let_else, r=jackh726

Use let_else in some more places in rustc_lint

Follow-up of #91018 and #89933 . Also cc #90985 which added the first let_else uses to rustc_lint.

2 years agoRollup merge of #91478 - estebank:fix-newline-in-cast-suggestion, r=camelid
Matthias Krüger [Sat, 4 Dec 2021 01:26:24 +0000 (02:26 +0100)]
Rollup merge of #91478 - estebank:fix-newline-in-cast-suggestion, r=camelid

Remove incorrect newline from float cast suggestion

2 years agoRollup merge of #91385 - ecstatic-morse:pat-param-spec-suggest, r=estebank
Matthias Krüger [Sat, 4 Dec 2021 01:26:23 +0000 (02:26 +0100)]
Rollup merge of #91385 - ecstatic-morse:pat-param-spec-suggest, r=estebank

Suggest the `pat_param` specifier before `|` on 2021 edition

Ran into this today after writing some Rust for the first time in a while.

r? `@estebank`

2 years agoRollup merge of #91209 - camelid:snapshot, r=jyn514
Matthias Krüger [Sat, 4 Dec 2021 01:26:22 +0000 (02:26 +0100)]
Rollup merge of #91209 - camelid:snapshot, r=jyn514

Implement `@snapshot` check for htmldocck

This form of check allows performing snapshot tests (à la `src/test/ui`)
on rustdoc HTML output, making it easier to create and update tests.

See [this Zulip thread][1] for more information about the motivation for
this change.

[1]: https://zulip-archive.rust-lang.org/stream/266220-rustdoc/topic/HTML.20snapshot.20tests.html#262651142

r? `@GuillaumeGomez`

2 years agoRollup merge of #90851 - ibraheemdev:downcast-unchecked, r=scottmcm
Matthias Krüger [Sat, 4 Dec 2021 01:26:21 +0000 (02:26 +0100)]
Rollup merge of #90851 - ibraheemdev:downcast-unchecked, r=scottmcm

Add unchecked downcast methods

```rust
impl dyn Any (+ Send + Sync) {
    pub unsafe fn downcast_ref_unchecked<T: Any>(&self) -> &T;
    pub unsafe fn downcast_mut_unchecked<T: Any>(&mut self) -> &mut T;
}

impl<A: Allocator> Box<dyn Any (+ Send + Sync), A> {
    pub unsafe fn downcast_unchecked<T: Any>(&self) -> Box<T, A>;
}
```

2 years agoRollup merge of #90538 - camelid:doc-recur-ty, r=estebank
Matthias Krüger [Sat, 4 Dec 2021 01:26:20 +0000 (02:26 +0100)]
Rollup merge of #90538 - camelid:doc-recur-ty, r=estebank

Document how recursion is handled for `ty::Ty`

Based on this forum discussion:
https://internals.rust-lang.org/t/recursive-type-representation-in-rustc/15235/4

cc `@estebank`

2 years agoAuto merge of #91501 - camelid:rm-tuple-impls-2, r=GuillaumeGomez
bors [Fri, 3 Dec 2021 23:46:53 +0000 (23:46 +0000)]
Auto merge of #91501 - camelid:rm-tuple-impls-2, r=GuillaumeGomez

rustdoc: Remove Clean impls for tuples

This PR removes all nine Clean impls on tuples, converting them to
functions instead.

The fact that these are impls causes several problems:

  1. They are nameless, so it's unclear what they do.

  2. It's hard to find where they're used apart from removing them and
     seeing what errors occur (this applies to all Clean impls, not just
     the tuple ones).

  3. Rustc doesn't currently warn when impls are unused, so dead code
     can accumulate easily (all Clean impls).

  4. Their bodies often use tuple field indexing syntax (e.g., `self.1`)
     to refer to their "arguments", which makes reading the code more
     difficult.

As I noted, some of these problems apply to all Clean impls, but even
those problems are exacerbated by the tuple impls since they make
general understanding of the code harder.

Converting the impls to functions solves all four of these problems.

r? `@GuillaumeGomez`

2 years agolimit may_unwind codegen test to x86_64
cynecx [Fri, 3 Dec 2021 22:53:31 +0000 (23:53 +0100)]
limit may_unwind codegen test to x86_64

2 years agofix feature-gate test for may_unwind
cynecx [Tue, 30 Nov 2021 10:36:55 +0000 (11:36 +0100)]
fix feature-gate test for may_unwind

2 years agofix inline asm test by not hardcoding symbol names
cynecx [Sun, 28 Nov 2021 20:52:27 +0000 (21:52 +0100)]
fix inline asm test by not hardcoding symbol names

2 years agofix inline asm test because of missing attribute
cynecx [Sun, 28 Nov 2021 18:35:31 +0000 (19:35 +0100)]
fix inline asm test because of missing attribute

2 years agorustc_codegen_gcc: proper check for may_unwind
cynecx [Fri, 19 Nov 2021 22:37:09 +0000 (23:37 +0100)]
rustc_codegen_gcc: proper check for may_unwind

2 years agoadd clobber_abi("C") to may_unwind inline-asm tests
cynecx [Fri, 19 Nov 2021 21:41:16 +0000 (22:41 +0100)]
add clobber_abi("C") to may_unwind inline-asm tests

2 years agoadd tests for asm's options(may_unwind)
cynecx [Sun, 14 Nov 2021 02:08:12 +0000 (03:08 +0100)]
add tests for asm's options(may_unwind)

2 years agoadd `unwind_asm` feature gate for `may_unwind` option
cynecx [Sun, 14 Nov 2021 19:21:05 +0000 (20:21 +0100)]
add `unwind_asm` feature gate for `may_unwind` option

2 years agorustc_codegen_gcc: error on unwinding inline asm
cynecx [Fri, 12 Nov 2021 23:37:30 +0000 (00:37 +0100)]
rustc_codegen_gcc: error on unwinding inline asm

2 years agoUpdate unstable-book with recent asm changes (`may_unwind`)
cynecx [Sun, 19 Sep 2021 20:38:55 +0000 (22:38 +0200)]
Update unstable-book with recent asm changes (`may_unwind`)

2 years agocg_cranelift: check may_unwind flag instead of cleanup
cynecx [Sat, 4 Sep 2021 20:14:09 +0000 (22:14 +0200)]
cg_cranelift: check may_unwind flag instead of cleanup

2 years agoLLVM codgen support for unwinding inline assembly
cynecx [Sat, 4 Sep 2021 17:25:09 +0000 (19:25 +0200)]
LLVM codgen support for unwinding inline assembly

2 years agoAdjust llvm wrapper for unwinding support for inlineasm
cynecx [Sat, 28 Aug 2021 17:02:00 +0000 (19:02 +0200)]
Adjust llvm wrapper for unwinding support for inlineasm

2 years agoAdd initial AST and MIR support for unwinding from inline assembly
Amanieu d'Antras [Mon, 30 Aug 2021 00:23:33 +0000 (01:23 +0100)]
Add initial AST and MIR support for unwinding from inline assembly

2 years agoRemove a Clean impl for a tuple (9)
Noah Lev [Fri, 3 Dec 2021 21:58:17 +0000 (13:58 -0800)]
Remove a Clean impl for a tuple (9)

This was the last one!

2 years agoRemove a Clean impl for a tuple (8)
Noah Lev [Fri, 3 Dec 2021 21:55:59 +0000 (13:55 -0800)]
Remove a Clean impl for a tuple (8)

2 years agoRemove a Clean impl for a tuple (7)
Noah Lev [Fri, 3 Dec 2021 21:52:38 +0000 (13:52 -0800)]
Remove a Clean impl for a tuple (7)

2 years agoRemove a Clean impl for a tuple (6)
Noah Lev [Fri, 3 Dec 2021 21:46:19 +0000 (13:46 -0800)]
Remove a Clean impl for a tuple (6)

2 years agoRemove a Clean impl for a tuple (5)
Noah Lev [Fri, 3 Dec 2021 21:44:47 +0000 (13:44 -0800)]
Remove a Clean impl for a tuple (5)

2 years agoRemove a Clean impl for a tuple (4)
Noah Lev [Fri, 3 Dec 2021 21:42:38 +0000 (13:42 -0800)]
Remove a Clean impl for a tuple (4)

2 years agoClean up definition of `clean_ty_generics` a bit
Noah Lev [Fri, 3 Dec 2021 21:36:06 +0000 (13:36 -0800)]
Clean up definition of `clean_ty_generics` a bit

2 years agoRemove a Clean impl for a tuple (3)
Noah Lev [Fri, 3 Dec 2021 21:34:46 +0000 (13:34 -0800)]
Remove a Clean impl for a tuple (3)

2 years agoRemove a Clean impl for a tuple (2)
Noah Lev [Fri, 3 Dec 2021 21:26:59 +0000 (13:26 -0800)]
Remove a Clean impl for a tuple (2)

2 years agoRemove a Clean impl for a tuple (1)
Noah Lev [Fri, 3 Dec 2021 21:23:18 +0000 (13:23 -0800)]
Remove a Clean impl for a tuple (1)

This commit removes the first of nine Clean impls on tuples, converting
it to a function instead.

The fact that these are impls causes several problems:

  1. They are nameless, so it's unclear what they do.

  2. It's hard to find where they're used apart from removing them and
     seeing what errors occur (this applies to all Clean impls, not just
     the tuple ones).

  3. Rustc doesn't currently warn when impls are unused, so dead code
     can accumulate easily (all Clean impls).

  4. Their bodies often use tuple field indexing syntax (e.g., `self.1`)
     to refer to their "arguments", which makes reading the code more
     difficult.

As I noted, some of these problems apply to all Clean impls, but even
those problems are exacerbated by the tuple impls since they make
general understanding of the code harder.

Converting the impls to functions solves all four of these problems.

2 years agorustdoc: Rename bounds to bindings where appropriate
Noah Lev [Fri, 3 Dec 2021 21:18:52 +0000 (13:18 -0800)]
rustdoc: Rename bounds to bindings where appropriate

2 years agofix stability annotations for `Box::downcast`
Ibraheem Ahmed [Fri, 3 Dec 2021 21:06:13 +0000 (16:06 -0500)]
fix stability annotations for `Box::downcast`

2 years agoDocument how recursion is handled for `ty::Ty`
Noah Lev [Wed, 3 Nov 2021 18:12:39 +0000 (11:12 -0700)]
Document how recursion is handled for `ty::Ty`

Based on this forum discussion:
https://internals.rust-lang.org/t/recursive-type-representation-in-rustc/15235/4

2 years agoAuto merge of #90737 - eholk:intofuture, r=tmandry
bors [Fri, 3 Dec 2021 19:29:21 +0000 (19:29 +0000)]
Auto merge of #90737 - eholk:intofuture, r=tmandry

Reintroduce `into_future` in `.await` desugaring

This is a reintroduction of the remaining parts from https://github.com/rust-lang/rust/pull/65244 that have not been relanded yet.

This isn't quite ready to merge yet. The last attempt was reverting due to performance regressions, so we need to make sure this does not introduce those issues again.

Issues #67644, #67982

/cc `@yoshuawuyts`

2 years agoreview comment
Esteban Kuber [Fri, 3 Dec 2021 18:45:15 +0000 (18:45 +0000)]
review comment

2 years agoAnnotate `derive`d spans and move span suggestion code
Esteban Kuber [Sat, 20 Nov 2021 18:46:36 +0000 (18:46 +0000)]
Annotate `derive`d spans and move span suggestion code

* Annotate `derive`d spans from the user's code with the appropciate context
* Add `Span::can_be_used_for_suggestion` to query if the underlying span
  at the users' code

2 years agoRemove some unnecessarily verbose code
Esteban Kuber [Wed, 17 Nov 2021 23:47:47 +0000 (23:47 +0000)]
Remove some unnecessarily verbose code

2 years agoModify `bounds_span` to ignore bounds coming from a `derive` macro
Esteban Kuber [Wed, 17 Nov 2021 23:35:38 +0000 (23:35 +0000)]
Modify `bounds_span` to ignore bounds coming from a `derive` macro

2 years agoKeep spans for generics in `#[derive(_)]` desugaring
Esteban Kuber [Wed, 3 Nov 2021 04:19:06 +0000 (04:19 +0000)]
Keep spans for generics in `#[derive(_)]` desugaring

Keep the spans for generics coming from a `derive`d Item, so that errors
and suggestions have better detail.

Fix #84003.

2 years agoUpdate invalid crate attributes, add help message
Tom Farmer [Sat, 9 Oct 2021 12:13:15 +0000 (13:13 +0100)]
Update invalid crate attributes, add help message

tidy run

update invalid crate attributes, improve error

update test outputs

de-capitalise error

update tests

Update invalid crate attributes, add help message

Update - generate span without using BytePos

Add correct dependancies

Update - generate suggestion without BytePos

Tidy run

update tests

Generate Suggestion without BytePos

Add all builtin attributes

add err builtin inner attr at top of crate

fix tests

add err builtin inner attr at top of crate

tidy fix

add err builtin inner attr at top of crate

2 years agoAuto merge of #91491 - spastorino:revert-91354, r=oli-obk
bors [Fri, 3 Dec 2021 16:26:01 +0000 (16:26 +0000)]
Auto merge of #91491 - spastorino:revert-91354, r=oli-obk

Revert "Auto merge of #91354 - fee1-dead:const_env, r=spastorino"

This reverts commit 18bb8c61a975fff6424cda831ace5b0404277145, reversing
changes made to d9baa361902b172be716f96619b909f340802dea.

Reverts #91354 in order to address #91489. We would need to place this changes in a more granular way and would also be nice to address the small perf regression that was also introduced.

r? `@oli-obk`
cc `@fee1-dead`

2 years agoAuto merge of #91393 - Julian-Wollersberger:lexer_optimization, r=petrochenkov
bors [Fri, 3 Dec 2021 13:20:14 +0000 (13:20 +0000)]
Auto merge of #91393 - Julian-Wollersberger:lexer_optimization, r=petrochenkov

Optimize `rustc_lexer`

The `cursor.first()` method in `rustc_lexer` now calls the `chars.next()` method instead of `chars.nth_char(0)`.

This allows LLVM to optimize the code better. The biggest win is that `eat_while()` is now fully inlined and generates better assembly. This improves the lexer's performance by 35% in a micro-benchmark I made (Lexing all 18MB of code in the compiler directory). But lexing is only a small part of the overall compilation time, so I don't know how significant it is.

Big thanks to criterion and `cargo asm`.

2 years agoRevert "Auto merge of #91354 - fee1-dead:const_env, r=spastorino"
Santiago Pastorino [Fri, 3 Dec 2021 13:11:21 +0000 (10:11 -0300)]
Revert "Auto merge of #91354 - fee1-dead:const_env, r=spastorino"

This reverts commit 18bb8c61a975fff6424cda831ace5b0404277145, reversing
changes made to d9baa361902b172be716f96619b909f340802dea.

2 years agoAuto merge of #91286 - scottmcm:residual-trait, r=joshtriplett
bors [Fri, 3 Dec 2021 10:15:11 +0000 (10:15 +0000)]
Auto merge of #91286 - scottmcm:residual-trait, r=joshtriplett

Make `array::{try_from_fn, try_map}` and `Iterator::try_find` generic over `Try`

Fixes #85115

This only updates unstable functions.

`array::try_map` didn't actually exist before; this adds it under the still-open tracking issue #79711 from the old PR #79713.

Tracking issue for the new trait: #91285

This would also solve the return type question in for the proposed `Iterator::try_reduce` in #87054

2 years agoAuto merge of #91486 - matthiaskrgr:rollup-699fo18, r=matthiaskrgr
bors [Fri, 3 Dec 2021 07:12:36 +0000 (07:12 +0000)]
Auto merge of #91486 - matthiaskrgr:rollup-699fo18, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #88906 (Implement write() method for Box<MaybeUninit<T>>)
 - #90269 (Make `Option::expect` unstably const)
 - #90854 (Type can be unsized and uninhabited)
 - #91170 (rustdoc: preload fonts)
 - #91273 (Fix ICE #91268 by checking that the snippet ends with a `)`)
 - #91381 (Android: -ldl must appear after -lgcc when linking)
 - #91453 (Document Windows TLS drop behaviour)
 - #91462 (Use try_normalize_erasing_regions in needs_drop)
 - #91474 (suppress warning about set_errno being unused on DragonFly)
 - #91483 (Sync rustfmt subtree)

Failed merges:

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

2 years agoFix ICE when yielding in fn returning impl Trait
Michael Goulet [Fri, 3 Dec 2021 06:33:40 +0000 (22:33 -0800)]
Fix ICE when yielding in fn returning impl Trait

2 years agoRollup merge of #91483 - calebcartwright:sync-rustfmt-subtree, r=calebcartwright
Matthias Krüger [Fri, 3 Dec 2021 05:24:19 +0000 (06:24 +0100)]
Rollup merge of #91483 - calebcartwright:sync-rustfmt-subtree, r=calebcartwright

Sync rustfmt subtree

2 years agoRollup merge of #91474 - rtzoeller:dfly_set_errno, r=cuviper
Matthias Krüger [Fri, 3 Dec 2021 05:24:18 +0000 (06:24 +0100)]
Rollup merge of #91474 - rtzoeller:dfly_set_errno, r=cuviper

suppress warning about set_errno being unused on DragonFly

Other targets allow this function to be unused, DragonFly just misses out due to providing a specialization.

This fixes a build error for DragonFly.

2 years agoRollup merge of #91462 - b-naber:use-try-normalize-erasing-regions, r=jackh726
Matthias Krüger [Fri, 3 Dec 2021 05:24:17 +0000 (06:24 +0100)]
Rollup merge of #91462 - b-naber:use-try-normalize-erasing-regions, r=jackh726

Use try_normalize_erasing_regions in needs_drop

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

r? ``@jackh726``

2 years agoRollup merge of #91453 - ChrisDenton:doc-win-tls-dtors, r=dtolnay
Matthias Krüger [Fri, 3 Dec 2021 05:24:16 +0000 (06:24 +0100)]
Rollup merge of #91453 - ChrisDenton:doc-win-tls-dtors, r=dtolnay

Document Windows TLS drop behaviour

The way Windows TLS destructors are run has some "interesting" properties. They should be documented.

Fixes #74875

2 years agoRollup merge of #91381 - Amanieu:android_libdl, r=petrochenkov
Matthias Krüger [Fri, 3 Dec 2021 05:24:15 +0000 (06:24 +0100)]
Rollup merge of #91381 - Amanieu:android_libdl, r=petrochenkov

Android: -ldl must appear after -lgcc when linking

#90846 accidentally broke Android builds because it causes the standard library to no longer use `dlsym` on Android. This results in `libdl` being ignored by the linker since no symbols are needed from it. However, we later import `libgcc` for unwinding which *does* depend on `libdl` for `dl_iterate_phdr`. Since linkers don't revisit previous libraries when resolving symbols, this causes a linker error due to an undefined reference to `dl_iterate_phdr`.

This is resolved by adding a second `-ldl` after `-lgcc` in the linker command-line.

2 years agoRollup merge of #91273 - Badel2:ice-index-str, r=estebank
Matthias Krüger [Fri, 3 Dec 2021 05:24:14 +0000 (06:24 +0100)]
Rollup merge of #91273 - Badel2:ice-index-str, r=estebank

Fix ICE #91268 by checking that the snippet ends with a `)`

Fix #91268

Previously it was assumed that the last character of `snippet` will be a `)`, so using `snippet.len() - 1` as an index should be safe. However as we see in the test, it is possible to enter that branch without a closing `)`, and it will trigger the panic if the last character happens to be multibyte.

The fix is to ensure that the snippet ends with `)`, and skip the suggestion otherwise.

2 years agoRollup merge of #91170 - jsha:preload-fonts, r=GuillaumeGomez
Matthias Krüger [Fri, 3 Dec 2021 05:24:13 +0000 (06:24 +0100)]
Rollup merge of #91170 - jsha:preload-fonts, r=GuillaumeGomez

rustdoc: preload fonts

Follow-up from #82315.

I noticed that font loading was so slow that even when loading from local disk, we get a flash of unstyled text (FOUT) followed by a reflow when the fonts load. With this change, we reliably get the appropriate fonts in the first render pass when loading locally, and we get it some of the time when loading from a website.

This only preloads woff2 versions. According to https://caniuse.com/?search=preload and https://caniuse.com/?search=woff2, all browsers that support preload also support woff2, so this is fine; we will never load two copies of a font.

Don't preload italic font faces because they aren't used on all pages.

Demo: https://rustdoc.crud.net/jsha/preload-fonts/std/string/struct.String.html

2 years agoRollup merge of #90854 - sanxiyn:unsized-and-uninhabited, r=estebank
Matthias Krüger [Fri, 3 Dec 2021 05:24:12 +0000 (06:24 +0100)]
Rollup merge of #90854 - sanxiyn:unsized-and-uninhabited, r=estebank

Type can be unsized and uninhabited

Fix #88150.

2 years agoRollup merge of #90269 - woppopo:const_option_expect, r=yaahc
Matthias Krüger [Fri, 3 Dec 2021 05:24:11 +0000 (06:24 +0100)]
Rollup merge of #90269 - woppopo:const_option_expect, r=yaahc

Make `Option::expect` unstably const

Tracking issue: #67441

2 years agoRollup merge of #88906 - Kixunil:box-maybe-uninit-write, r=dtolnay
Matthias Krüger [Fri, 3 Dec 2021 05:24:11 +0000 (06:24 +0100)]
Rollup merge of #88906 - Kixunil:box-maybe-uninit-write, r=dtolnay

Implement write() method for Box<MaybeUninit<T>>

This adds method similar to `MaybeUninit::write` main difference being
it returns owned `Box`. This can be used to elide copy from stack
safely, however it's not currently tested that the optimization actually
occurs.

Analogous methods are not provided for `Rc` and `Arc` as those need to
handle the possibility of sharing. Some version of them may be added in
the future.

This was discussed in #63291 which this change extends.

2 years agoAuto merge of #91339 - cbarrete:vecdeque-remove-grow-check, r=Mark-Simulacrum
bors [Fri, 3 Dec 2021 04:14:07 +0000 (04:14 +0000)]
Auto merge of #91339 - cbarrete:vecdeque-remove-grow-check, r=Mark-Simulacrum

Remove unnecessary check in VecDeque::grow

All callers already check that the buffer is full before calling
`grow()`. This is where it makes the most sense, since `grow()` is
`inline(never)` and we don't want to pay for a function call just for
that check.
It could also be argued that it would be correct to call `grow()` even
if the buffer wasn't full yet.
This change breaks no code since `grow()` is not `pub`.

2 years agoMerge commit '8da837185714cefbb261e93e9846afb11c1dc60e' into sync-rustfmt-subtree
Caleb Cartwright [Fri, 3 Dec 2021 03:35:30 +0000 (21:35 -0600)]
Merge commit '8da837185714cefbb261e93e9846afb11c1dc60e' into sync-rustfmt-subtree

2 years agoMerge pull request #5121 from calebcartwright/subtree-sync-2021-12-02
Caleb Cartwright [Fri, 3 Dec 2021 03:29:47 +0000 (21:29 -0600)]
Merge pull request #5121 from calebcartwright/subtree-sync-2021-12-02

subtree sync

2 years agoMerge remote-tracking branch 'upstream/master' into subtree-sync-2021-12-02
Caleb Cartwright [Fri, 3 Dec 2021 03:02:14 +0000 (21:02 -0600)]
Merge remote-tracking branch 'upstream/master' into subtree-sync-2021-12-02