]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agofix links
Jane Lusby [Wed, 25 May 2022 17:46:56 +0000 (10:46 -0700)]
fix links

2 years agoRespond to PR comments.
ridwanabdillahi [Wed, 25 May 2022 17:44:56 +0000 (10:44 -0700)]
Respond to PR comments.

2 years agoUpdate cargo
Arlo Siemsen [Wed, 25 May 2022 17:31:30 +0000 (10:31 -0700)]
Update cargo

2 years agoAuto merge of #97401 - Dylan-DPC:rollup-fh9e61o, r=Dylan-DPC
bors [Wed, 25 May 2022 16:39:37 +0000 (16:39 +0000)]
Auto merge of #97401 - Dylan-DPC:rollup-fh9e61o, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #97302 (Do writeback of Closure params before visiting the parent expression)
 - #97328 (rustc: Fix ICE in native library error reporting)
 - #97351 (Output correct type responsible for structural match violation)
 - #97398 (Add regression test for #82830)
 - #97400 (Fix a typo on Struct `Substructure`)

Failed merges:

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

2 years agobless existing test with compare-mode=nll and remove test
b-naber [Mon, 23 May 2022 07:50:32 +0000 (09:50 +0200)]
bless existing test with compare-mode=nll and remove test

2 years agoupdate tests
b-naber [Sun, 22 May 2022 15:07:35 +0000 (17:07 +0200)]
update tests

2 years agosuggest constraining dyn trait in impl in NLL
b-naber [Sun, 22 May 2022 15:04:49 +0000 (17:04 +0200)]
suggest constraining dyn trait in impl in NLL

2 years agomake TraitObject visitors public
b-naber [Sun, 22 May 2022 15:02:27 +0000 (17:02 +0200)]
make TraitObject visitors public

2 years agoadd def_id and substs to ConstraintCategory::CallArgument
b-naber [Sun, 22 May 2022 15:00:23 +0000 (17:00 +0200)]
add def_id and substs to ConstraintCategory::CallArgument

2 years agoRollup merge of #97400 - JohnTitor:typo-fix-substructure, r=cjgillot
Dylan DPC [Wed, 25 May 2022 15:37:23 +0000 (17:37 +0200)]
Rollup merge of #97400 - JohnTitor:typo-fix-substructure, r=cjgillot

Fix a typo on Struct `Substructure`

2 years agoRollup merge of #97398 - JohnTitor:issue-82830, r=compiler-errors
Dylan DPC [Wed, 25 May 2022 15:37:22 +0000 (17:37 +0200)]
Rollup merge of #97398 - JohnTitor:issue-82830, r=compiler-errors

Add regression test for #82830

Closes #82830
r? `@compiler-errors`

2 years agoRollup merge of #97351 - b-naber:adt-const-params-structural-match-violation, r=micha...
Dylan DPC [Wed, 25 May 2022 15:37:21 +0000 (17:37 +0200)]
Rollup merge of #97351 - b-naber:adt-const-params-structural-match-violation, r=michaelwoerister

Output correct type responsible for structural match violation

Previously we included the outermost type that caused a structural match violation in the error message and stated that that type must be annotated with `#[derive(Eq, PartialEq)]` even if it already had that annotation. This PR outputs the correct type in the error message.

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

2 years agoRollup merge of #97328 - petrochenkov:nativice, r=michaelwoerister
Dylan DPC [Wed, 25 May 2022 15:37:20 +0000 (17:37 +0200)]
Rollup merge of #97328 - petrochenkov:nativice, r=michaelwoerister

rustc: Fix ICE in native library error reporting

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

2 years agoRollup merge of #97302 - compiler-errors:writeback-ascending, r=cjgillot
Dylan DPC [Wed, 25 May 2022 15:37:18 +0000 (17:37 +0200)]
Rollup merge of #97302 - compiler-errors:writeback-ascending, r=cjgillot

Do writeback of Closure params before visiting the parent expression

This means that given the expression:

```
let x = |a: Vec<_>| {};
```

We will visit the HIR node for `a` before `x`, and report the ambiguity on the former instead of the latter. This also moves writeback for struct field ids and const blocks before, but the ordering of this and walking the expr doesn't seem to matter.

2 years agoFall through to check other arguments instead of bailing out on the first error
Oli Scherer [Wed, 25 May 2022 14:01:06 +0000 (14:01 +0000)]
Fall through to check other arguments instead of bailing out on the first error

2 years agoAuto merge of #94954 - SimonSapin:null-thin3, r=yaahc
bors [Wed, 25 May 2022 13:58:51 +0000 (13:58 +0000)]
Auto merge of #94954 - SimonSapin:null-thin3, r=yaahc

Extend ptr::null and null_mut to all thin (including extern) types

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

This change was accepted in https://rust-lang.github.io/rfcs/2580-ptr-meta.html

Note that this changes the signature of **stable** functions. The change should be backward-compatible, but it is **insta-stable** since it cannot (easily, at all?) be made available only through a `#![feature(…)]` opt-in.

The RFC also proposed the same change for `NonNull::dangling`, which makes sense it terms of its signature but not in terms of its implementation. `dangling` uses `align_of()` as an address. But what `align_of()` should be for extern types or whether it should be allowed at all remains an open question.

This commit depends on https://github.com/rust-lang/rust/pull/93977, which is not yet part of the bootstrap compiler. So `#[cfg]` is used to only apply the change in stage 1+. As far a I know bounds cannot be made conditional with `#[cfg]`, so the entire functions are duplicated. This is unfortunate but temporary.

Since this duplication makes it less obvious in the diff, the new definitions differ in:

* More permissive bounds (`Thin` instead of implied `Sized`)
* Different implementation
* Having `rustc_allow_const_fn_unstable(const_fn_trait_bound)`
* Having `rustc_allow_const_fn_unstable(ptr_metadata)`

2 years agoFix a typo on Struct `Substructure`
Yuki Okushi [Wed, 25 May 2022 13:25:37 +0000 (22:25 +0900)]
Fix a typo on Struct `Substructure`

2 years agoAdd regression test for #82830
Yuki Okushi [Wed, 25 May 2022 13:14:20 +0000 (22:14 +0900)]
Add regression test for #82830

2 years agoAdd new eslint rule "eol-last"
Guillaume Gomez [Wed, 25 May 2022 11:58:42 +0000 (13:58 +0200)]
Add new eslint rule "eol-last"

2 years agoAdd new eslint rule "max-len"
Guillaume Gomez [Wed, 25 May 2022 11:58:14 +0000 (13:58 +0200)]
Add new eslint rule "max-len"

2 years agoAdd new eslint rule "comma-style"
Guillaume Gomez [Wed, 25 May 2022 11:57:08 +0000 (13:57 +0200)]
Add new eslint rule "comma-style"

2 years agoAdd new eslint rule "comma-dangle"
Guillaume Gomez [Wed, 25 May 2022 11:56:27 +0000 (13:56 +0200)]
Add new eslint rule "comma-dangle"

2 years agoAdd new eslint rule "space-before-blocks"
Guillaume Gomez [Wed, 25 May 2022 11:55:54 +0000 (13:55 +0200)]
Add new eslint rule "space-before-blocks"

2 years agoAdd new eslint rule "space-before-function-paren"
Guillaume Gomez [Wed, 25 May 2022 11:55:09 +0000 (13:55 +0200)]
Add new eslint rule "space-before-function-paren"

2 years agoAdd eslint rule "space-infix-ops"
Guillaume Gomez [Wed, 25 May 2022 11:53:19 +0000 (13:53 +0200)]
Add eslint rule "space-infix-ops"

2 years agoAuto merge of #97388 - Dylan-DPC:rollup-tfuc4tf, r=Dylan-DPC
bors [Wed, 25 May 2022 11:17:34 +0000 (11:17 +0000)]
Auto merge of #97388 - Dylan-DPC:rollup-tfuc4tf, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #95953 (Modify MIR building to drop repeat expressions with length zero)
 - #96913 (RFC3239: Implement `cfg(target)` - Part 2)
 - #97233 ([RFC 2011] Library code)
 - #97370 (Minor improvement on else-no-if diagnostic)
 - #97384 (Fix metadata stats.)

Failed merges:

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

2 years agoRollup merge of #97384 - nnethercote:fix-metadata-stats, r=bjorn3
Dylan DPC [Wed, 25 May 2022 08:48:31 +0000 (10:48 +0200)]
Rollup merge of #97384 - nnethercote:fix-metadata-stats, r=bjorn3

Fix metadata stats.

This commit:
- Counts some things that weren't being counted previously, and adds
  an assertion that ensure everything is counted.
- Reorders things so the `eprintln`s order matches the code order.
- Adds percentages, and makes clear that the zero bytes count is orthogonal to
  the other measurements.

Example of the new output:
```
55463779 metadata bytes, of which 18054531 bytes (32.6%) are zero
             preamble:       30 bytes ( 0.0%)
                  dep:        0 bytes ( 0.0%)
          lib feature:    17458 bytes ( 0.0%)
            lang item:      337 bytes ( 0.0%)
      diagnostic item:     1788 bytes ( 0.0%)
           native lib:        0 bytes ( 0.0%)
      foreign modules:     5113 bytes ( 0.0%)
       def-path table:   720180 bytes ( 1.3%)
               traits:      359 bytes ( 0.0%)
                impls:    64624 bytes ( 0.1%)
     incoherent_impls:      130 bytes ( 0.0%)
                  mir: 16137354 bytes (29.1%)
                 item: 23773099 bytes (42.9%)
interpret_alloc_index:      599 bytes ( 0.0%)
      proc-macro-data:        0 bytes ( 0.0%)
               tables: 10081135 bytes (18.2%)
 debugger visualizers:        0 bytes ( 0.0%)
     exported symbols:     5666 bytes ( 0.0%)
              hygiene:  1539390 bytes ( 2.8%)
      def-path hashes:  2752564 bytes ( 5.0%)
           source_map:   363540 bytes ( 0.7%)
                final:      413 bytes ( 0.0%)
```
r? `@bjorn3`

2 years agoRollup merge of #97370 - compiler-errors:else-no-if-2, r=Dylan-DPC
Dylan DPC [Wed, 25 May 2022 08:48:30 +0000 (10:48 +0200)]
Rollup merge of #97370 - compiler-errors:else-no-if-2, r=Dylan-DPC

Minor improvement on else-no-if diagnostic

Don't suggest wrapping in block since it's highly likely to be a missing `if` after `else`. Also rework message a bit (open to further suggestions).

cc: https://github.com/rust-lang/rust/pull/97298#discussion_r880933431

r? `@estebank`

2 years agoRollup merge of #97233 - c410-f3r:assert-lib, r=scottmcm
Dylan DPC [Wed, 25 May 2022 08:48:29 +0000 (10:48 +0200)]
Rollup merge of #97233 - c410-f3r:assert-lib, r=scottmcm

[RFC 2011] Library code

CC https://github.com/rust-lang/rust/pull/96496

Based on https://github.com/dtolnay/case-studies/tree/master/autoref-specialization.

Basically creates two traits with the same method name. One trait is generic over any `T` and the other is specialized to any `T: Printable`.

The compiler will then call the corresponding trait method through auto reference.

```rust
fn main() {
    let mut a = Capture::new();
    let mut b = Capture::new();

    (&Wrapper(&1i32)).try_capture(&mut a); // `try_capture` from `TryCapturePrintable`
    (&Wrapper(&vec![1i32])).try_capture(&mut b); // `try_capture` from `TryCaptureGeneric`

    assert_eq!(format!("{:?}", a), "1");
    assert_eq!(format!("{:?}", b), "N/A");
}
```

r? `@scottmcm`

2 years agoRollup merge of #96913 - Urgau:rfc3239-part2, r=petrochenkov
Dylan DPC [Wed, 25 May 2022 08:48:28 +0000 (10:48 +0200)]
Rollup merge of #96913 - Urgau:rfc3239-part2, r=petrochenkov

RFC3239: Implement `cfg(target)` - Part 2

This pull-request implements the compact `cfg(target(..))` part of [RFC 3239](https://github.com/rust-lang/rust/issues/96901).

I recommend reviewing this PR on a per commit basics, because of some moving parts.

cc `@GuillaumeGomez`
r? `@petrochenkov`

2 years agoRollup merge of #95953 - JakobDegen:repeat-leak, r=oli-obk
Dylan DPC [Wed, 25 May 2022 08:48:27 +0000 (10:48 +0200)]
Rollup merge of #95953 - JakobDegen:repeat-leak, r=oli-obk

Modify MIR building to drop repeat expressions with length zero

Closes #74836 .

Previously, when a user wrote `[foo; 0]` we used to simply leak `foo`. The goal is to fix that. This PR changes MIR building to make `[foo; 0]` equivalent to `{ drop(foo); [] }` in all cases. Of course, this is a breaking change (see below). A crater run did not indicate any regressions though, and given that the previous behavior was almost definitely not what any user wanted, it seems unlikely that anyone was relying on this.

Note that const generics are in general unaffected by this. Inserting the extra `drop` is only meaningful/necessary when `foo` is of a non-`Copy` type, and array repeat expressions with const generic repetition count must always be `Copy`.

Besides the obvious change to behavior associated with the additional drop, there are three categories of examples where this also changes observable behavior. In all of these cases, the new behavior is consistent with what you would get by replacing `[foo; 0]` with `{ drop(foo); [] }`. As such, none of these give the user new powers to express more things.

**No longer allowed in const (breaking)**:

```rust
const _: [String; 0] = [String::new(); 0];
```

This compiles on stable today. Because we now introduce the drop of `String`, this no longer compiles as `String` may not be dropped in a const context.

**Reduced dataflow (non-breaking)**:

```rust
let mut x: i32 = 0;
let r = &x;
let a = [r; 0];
x = 5;
let _b = a;
```

Borrowck rejects this code on stable because it believes there is dataflow between `a` and `r`, and so the lifetime of `r` has to extend to the last statement. This change removes the dataflow and the above code is allowed to compile.

**More const promotion (non-breaking)**:

```rust
let _v: &'static [String; 0] = &[String::new(); 0];
```

This does not compile today because `String` having drop glue keeps it from being const promoted (despite that drop glue never being executed). After this change, this is allowed to compile.

### Alternatives

A previous attempt at this tried to reduce breakage by various tricks. This is still a possibility, but given that crater showed no regressions it seems unclear why we would want to introduce this complexity.

Disallowing `[foo; 0]` completely is also an option, but obviously this is more of a breaking change. I do not know how often this is actually used though.

r? `@oli-obk`

2 years agoAuto merge of #97345 - lcnr:fast_reject, r=nnethercote
bors [Wed, 25 May 2022 08:36:46 +0000 (08:36 +0000)]
Auto merge of #97345 - lcnr:fast_reject, r=nnethercote

add a deep fast_reject routine

continues the work on #97136.

r? `@nnethercote`

Actually agree with you on the match structure :laughing: let's see how that impacted perf :sweat_smile:

2 years agorustc_codegen_ssa: derive copy and clone for various enums
Tomasz Miąsko [Tue, 24 May 2022 00:00:00 +0000 (00:00 +0000)]
rustc_codegen_ssa: derive copy and clone for various enums

2 years agorustc_codegen_ssa: cleanup `AtomicOrdering`
Tomasz Miąsko [Tue, 24 May 2022 00:00:00 +0000 (00:00 +0000)]
rustc_codegen_ssa: cleanup `AtomicOrdering`

* Remove unused `NotAtomic` ordering.
* Rename `Monotonic` to `Relaxed` - a Rust specific name.

2 years agoFix metadata stats.
Nicholas Nethercote [Wed, 25 May 2022 06:24:07 +0000 (16:24 +1000)]
Fix metadata stats.

This commit:
- Counts some things that weren't being counted previously, and adds
  an assertion that ensure everything is counted.
- Reorders things so the `eprintln`s order matches the code order.
- Adds percentages, and makes clear that the zero bytes count is orthogonal to
  the other measurements.

Example of the new output:
```
55463779 metadata bytes, of which 18054531 bytes (32.6%) are zero
             preamble:       30 bytes ( 0.0%)
                  dep:        0 bytes ( 0.0%)
          lib feature:    17458 bytes ( 0.0%)
            lang item:      337 bytes ( 0.0%)
      diagnostic item:     1788 bytes ( 0.0%)
           native lib:        0 bytes ( 0.0%)
      foreign modules:     5113 bytes ( 0.0%)
       def-path table:   720180 bytes ( 1.3%)
               traits:      359 bytes ( 0.0%)
                impls:    64624 bytes ( 0.1%)
     incoherent_impls:      130 bytes ( 0.0%)
                  mir: 16137354 bytes (29.1%)
                 item: 23773099 bytes (42.9%)
interpret_alloc_index:      599 bytes ( 0.0%)
      proc-macro-data:        0 bytes ( 0.0%)
               tables: 10081135 bytes (18.2%)
 debugger visualizers:        0 bytes ( 0.0%)
     exported symbols:     5666 bytes ( 0.0%)
              hygiene:  1539390 bytes ( 2.8%)
      def-path hashes:  2752564 bytes ( 5.0%)
           source_map:   363540 bytes ( 0.7%)
                final:      413 bytes ( 0.0%)
```

2 years agoupdate jemalloc-sys to jemalloc v5.3
Rémy Rakic [Fri, 6 May 2022 21:20:04 +0000 (23:20 +0200)]
update jemalloc-sys to jemalloc v5.3

2 years agoAuto merge of #97382 - Dylan-DPC:rollup-2t4ov4z, r=Dylan-DPC
bors [Wed, 25 May 2022 06:14:15 +0000 (06:14 +0000)]
Auto merge of #97382 - Dylan-DPC:rollup-2t4ov4z, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #93604 (Make llvm-libunwind a per-target option)
 - #97026 (Change orderings of `Debug` for the Atomic types to `Relaxed`.)
 - #97105 (Add tests for lint on type dependent on consts)
 - #97323 (Introduce stricter checks for might_permit_raw_init under a debug flag )
 - #97379 (Add aliases for `current_dir`)

Failed merges:

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

2 years agotry to cache region_scope_tree as a query
Ding Xiang Fei [Wed, 25 May 2022 05:52:32 +0000 (13:52 +0800)]
try to cache region_scope_tree as a query

2 years agomove fast reject test out of `SelectionContext::match_impl`.
lcnr [Tue, 24 May 2022 07:22:24 +0000 (09:22 +0200)]
move fast reject test out of `SelectionContext::match_impl`.

`match_impl` has two call sites. For one of them (within `rematch_impl`)
the fast reject test isn't necessary, because any rejection would
represent a compiler bug.

This commit moves the fast reject test to the other `match_impl` call
site, in `assemble_candidates_from_impls`. This lets us move the fast
reject test outside the `probe` call in that function. This avoids the
taking of useless snapshots when the fast reject test succeeds, which
gives a performance win when compiling the `bitmaps` and `nalgebra`
crates.

Co-authored-by: name <n.nethercote@gmail.com>
2 years agoadd a deep fast_reject routine
lcnr [Tue, 24 May 2022 07:15:19 +0000 (09:15 +0200)]
add a deep fast_reject routine

2 years agoRollup merge of #97379 - ear7h:master, r=thomcc
Dylan DPC [Wed, 25 May 2022 05:31:45 +0000 (07:31 +0200)]
Rollup merge of #97379 - ear7h:master, r=thomcc

Add aliases for `current_dir`

Aliases were added for the equivalent C/C++ APIs for POSIX and Windows. Also, I added one for `pwd` which users may be more familiar with, from the command line.

2 years agoRollup merge of #97323 - 5225225:strict_init_checks, r=oli-obk
Dylan DPC [Wed, 25 May 2022 05:31:44 +0000 (07:31 +0200)]
Rollup merge of #97323 - 5225225:strict_init_checks, r=oli-obk

Introduce stricter checks for might_permit_raw_init under a debug flag

This is intended to be a version of the strict checks tried out in #79296, but also checking number validity (under the assumption that `let _ = std::mem::uninitialized::<u32>()` is UB, which seems to be what https://github.com/rust-lang/unsafe-code-guidelines/issues/71 is leaning towards.)

2 years agoRollup merge of #97105 - JulianKnodt:const_dep_gen_const_expr, r=lcnr
Dylan DPC [Wed, 25 May 2022 05:31:43 +0000 (07:31 +0200)]
Rollup merge of #97105 - JulianKnodt:const_dep_gen_const_expr, r=lcnr

Add tests for lint on type dependent on consts

r? `@lcnr`

2 years agoRollup merge of #97026 - Nilstrieb:make-atomic-debug-relaxed, r=scottmcm
Dylan DPC [Wed, 25 May 2022 05:31:42 +0000 (07:31 +0200)]
Rollup merge of #97026 - Nilstrieb:make-atomic-debug-relaxed, r=scottmcm

Change orderings of `Debug` for the Atomic types to `Relaxed`.

This reduces synchronization between threads when debugging the atomic types.  Reducing the synchronization means that executions with and without the debug calls will be more consistent, making it easier to debug.

We discussed this on the Rust Community Discord with `@ibraheemdev` before.

2 years agoRollup merge of #93604 - tmandry:libunwind-fuchsia-default, r=Mark-Simulacrum
Dylan DPC [Wed, 25 May 2022 05:31:41 +0000 (07:31 +0200)]
Rollup merge of #93604 - tmandry:libunwind-fuchsia-default, r=Mark-Simulacrum

Make llvm-libunwind a per-target option

Fuchsia doesn't ship libunwind in its SDK, so we must provide it statically.

2 years agoAuto merge of #97376 - compiler-errors:lazy-polymorphic, r=jackh726
bors [Wed, 25 May 2022 03:53:39 +0000 (03:53 +0000)]
Auto merge of #97376 - compiler-errors:lazy-polymorphic, r=jackh726

Make `Lazy*<T>` types in `rustc_metadata` not care about lifetimes until decode

This allows us to remove the `'tcx` lifetime from `CrateRoot`. This is necessary because of #97287, which makes the `'tcx` lifetime on `Ty` invariant instead of covariant, so [this hack](https://github.com/rust-lang/rust/blob/0a437b2ca081bc12425a3318cb66aade9824cbae/compiler/rustc_metadata/src/rmeta/decoder.rs#L89-92) no longer holds under that PR.

Introduces a trait called `ParameterizedOverTcx` which has a generic associated type that allows a type to be parameterized over that lifetime. This means we can decode, for example, `Lazy<Ty<'static>>` into any `Ty<'tcx>` depending on the `TyCtxt<'tcx>` we pass into the decode function.

2 years agoFix/bless tests broken by DSE
Jakob Degen [Wed, 18 May 2022 23:06:40 +0000 (19:06 -0400)]
Fix/bless tests broken by DSE

2 years agoAdd dead store elimination pass
Jakob Degen [Tue, 10 May 2022 00:12:03 +0000 (20:12 -0400)]
Add dead store elimination pass

2 years agoadd aliases for current_dir
julio [Wed, 25 May 2022 02:41:40 +0000 (19:41 -0700)]
add aliases for current_dir

2 years agotweak doctests
Артём Павлов [Artyom Pavlov] [Wed, 25 May 2022 02:14:30 +0000 (05:14 +0300)]
tweak doctests

2 years agoimplement tie to even
Артём Павлов [Artyom Pavlov] [Wed, 25 May 2022 02:01:11 +0000 (05:01 +0300)]
implement tie to even

2 years agoAuto merge of #97365 - klensy:rustdoc-vs-clippy, r=notriddle
bors [Wed, 25 May 2022 01:12:54 +0000 (01:12 +0000)]
Auto merge of #97365 - klensy:rustdoc-vs-clippy, r=notriddle

rustdoc: fix few clippy lints

Fix few clippy lints: second commit - perf ones, first - other ones.

2 years agoMake llvm-libunwind a per-target option
Tyler Mandry [Wed, 2 Feb 2022 22:48:09 +0000 (22:48 +0000)]
Make llvm-libunwind a per-target option

2 years agoMake Lazy not care about lifetimes until decode
Michael Goulet [Sun, 22 May 2022 19:34:34 +0000 (12:34 -0700)]
Make Lazy not care about lifetimes until decode

2 years agoexplained unwrap vs expect
Jane Losare-Lusby [Tue, 24 May 2022 22:51:54 +0000 (22:51 +0000)]
explained unwrap vs expect

2 years agoAuto merge of #97372 - JohnTitor:rollup-6owv1v0, r=JohnTitor
bors [Tue, 24 May 2022 22:32:57 +0000 (22:32 +0000)]
Auto merge of #97372 - JohnTitor:rollup-6owv1v0, r=JohnTitor

Rollup of 6 pull requests

Successful merges:

 - #93966 (document expectations for Waker::wake)
 - #97266 (Make weird name lints trigger behind cfg_attr)
 - #97355 (Remove unused brush image)
 - #97358 (Update minifier-rs version to 0.1.0)
 - #97363 (Fix a small mistake in `SliceIndex`'s documentation)
 - #97364 (Fix weird indentation in continue_keyword docs)

Failed merges:

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

2 years agoMinor improvement on else-no-if diagnostic
Michael Goulet [Tue, 24 May 2022 21:14:41 +0000 (14:14 -0700)]
Minor improvement on else-no-if diagnostic

2 years agoRollup merge of #97364 - notriddle:continue-keyword, r=JohnTitor
Yuki Okushi [Tue, 24 May 2022 22:08:45 +0000 (07:08 +0900)]
Rollup merge of #97364 - notriddle:continue-keyword, r=JohnTitor

Fix weird indentation in continue_keyword docs

This format was causing every line in the code examples to have a space at the start.

2 years agoRollup merge of #97363 - wackbyte:sliceindex-doc-typo, r=JohnTitor
Yuki Okushi [Tue, 24 May 2022 22:08:44 +0000 (07:08 +0900)]
Rollup merge of #97363 - wackbyte:sliceindex-doc-typo, r=JohnTitor

Fix a small mistake in `SliceIndex`'s documentation

Originally, it said "`get_(mut_)unchecked`," but the method's actual name is `get_unchecked_mut`.

2 years agoRollup merge of #97358 - GuillaumeGomez:update-minifier, r=Dylan-DPC
Yuki Okushi [Tue, 24 May 2022 22:08:44 +0000 (07:08 +0900)]
Rollup merge of #97358 - GuillaumeGomez:update-minifier, r=Dylan-DPC

Update minifier-rs version to 0.1.0

It fixes a bug with regex parsing.

r? `@notriddle`

2 years agoRollup merge of #97355 - GuillaumeGomez:remove-brush, r=Dylan-DPC
Yuki Okushi [Tue, 24 May 2022 22:08:43 +0000 (07:08 +0900)]
Rollup merge of #97355 - GuillaumeGomez:remove-brush, r=Dylan-DPC

Remove unused brush image

r? `@notriddle`

2 years agoRollup merge of #97266 - est31:unknown_lints_cfg_attr, r=lcnr
Yuki Okushi [Tue, 24 May 2022 22:08:42 +0000 (07:08 +0900)]
Rollup merge of #97266 - est31:unknown_lints_cfg_attr, r=lcnr

Make weird name lints trigger behind cfg_attr

The weird name lints (`unknown_lints`, `renamed_and_removed_lints`), the lints that lint the linting, were previously not firing for lint level declarations behind `cfg_attr`, as they were only running before expansion.

Now, this will give a `unknown_lints` warning:

```Rust
#[cfg_attr(all(), allow(this_lint_does_not_exist))]
fn foo() {}
```

Lint level declarations behind a `cfg_attr` whose condition is not applying are still ignored. So this still won't give a warning:

```Rust
#[cfg_attr(any(), allow(this_lint_does_not_exist))]
fn foo() {}
```

Furthermore, this PR also makes the weird name lints respect level delcarations for *them* that were hidden by `cfg_attr`, making them consistent to other lints. So this will now not issue a warning:

```Rust
#[cfg_attr(all(), allow(unknown_lints))]
mod foo {
    #[allow(does_not_exist)]
    fn foo() {
    }
}
```

Fixes #97094

2 years agoRollup merge of #93966 - rkuhn:patch-1, r=tmandry
Yuki Okushi [Tue, 24 May 2022 22:08:41 +0000 (07:08 +0900)]
Rollup merge of #93966 - rkuhn:patch-1, r=tmandry

document expectations for Waker::wake

fixes #93961

Opened PR for a discussion on the precise wording.

2 years agoModify MIR building to drop `foo` in `[foo; 0]`
Jakob Degen [Wed, 13 Apr 2022 11:08:58 +0000 (07:08 -0400)]
Modify MIR building to drop `foo` in `[foo; 0]`

2 years agoAuto merge of #97360 - RalfJung:rustup, r=RalfJung
bors [Tue, 24 May 2022 19:05:20 +0000 (19:05 +0000)]
Auto merge of #97360 - RalfJung:rustup, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/97348
r? `@ghost` Cc `@rust-lang/miri`

2 years agoUpdate documentation.
ridwanabdillahi [Tue, 24 May 2022 18:22:14 +0000 (11:22 -0700)]
Update documentation.

2 years agoAdd support for embedding pretty printers via the `#[debugger_visualizer]` attribute...
ridwanabdillahi [Tue, 24 May 2022 18:14:48 +0000 (11:14 -0700)]
Add support for embedding pretty printers via the `#[debugger_visualizer]` attribute. Add tests for embedding pretty printers and update documentation.

Ensure all error checking for `#[debugger_visualizer]` is done up front and not when the `debugger_visualizer` query is run.

Clean up potential ODR violations when embedding pretty printers into the `__rustc_debug_gdb_scripts_section__` section.

Respond to PR comments and update documentation.

2 years agoFix weird indentation in continue_keyword docs
Michael Howell [Tue, 24 May 2022 18:09:24 +0000 (11:09 -0700)]
Fix weird indentation in continue_keyword docs

This format was causing every line in the code examples to have a space
at the start.

2 years agofix clippy perf lints
klensy [Tue, 24 May 2022 17:35:54 +0000 (13:35 -0400)]
fix clippy perf lints

2 years agoFix a mistake in `SliceIndex`'s documentation
wackbyte [Tue, 24 May 2022 17:22:41 +0000 (13:22 -0400)]
Fix a mistake in `SliceIndex`'s documentation

2 years agoUpdate messages
Oli Scherer [Tue, 24 May 2022 16:33:06 +0000 (16:33 +0000)]
Update messages

2 years agoMake a test independent of 64/32 bit
Oli Scherer [Thu, 14 Apr 2022 13:29:42 +0000 (13:29 +0000)]
Make a test independent of 64/32 bit

2 years agoRemove outdated comment
Oli Scherer [Thu, 14 Apr 2022 13:23:45 +0000 (13:23 +0000)]
Remove outdated comment

2 years agoAdd the transmute and asm checks to typeck as deferred checks
Oli Scherer [Thu, 14 Apr 2022 12:07:36 +0000 (12:07 +0000)]
Add the transmute and asm checks to typeck as deferred checks

2 years agofix simple clippy lints
klensy [Sat, 21 May 2022 18:07:18 +0000 (14:07 -0400)]
fix simple clippy lints

2 years agoAuto merge of #97356 - Dylan-DPC:rollup-bhceawj, r=Dylan-DPC
bors [Tue, 24 May 2022 16:23:32 +0000 (16:23 +0000)]
Auto merge of #97356 - Dylan-DPC:rollup-bhceawj, r=Dylan-DPC

Rollup of 4 pull requests

Successful merges:

 - #97288 (Lifetime variance fixes for rustdoc)
 - #97298 (Parse expression after `else` as a condition if followed by `{`)
 - #97308 (Stabilize `cell_filter_map`)
 - #97321 (explain how to turn integers into fn ptrs)

Failed merges:

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

2 years agotypeck: use typed fluent identifiers for diags
David Wood [Mon, 23 May 2022 17:37:27 +0000 (18:37 +0100)]
typeck: use typed fluent identifiers for diags

Use new typed Fluent identifiers for the "missing type parameters"
diagnostic in the typeck crate which was manually creating
`DiagnosticMessage`s previously.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agomacros: introduce `fluent_messages` macro
David Wood [Mon, 23 May 2022 17:24:55 +0000 (18:24 +0100)]
macros: introduce `fluent_messages` macro

Adds a new `fluent_messages` macro which performs compile-time
validation of the compiler's Fluent resources (i.e. that the resources
parse and don't multiply define the same messages) and generates
constants that make using those messages in diagnostics more ergonomic.

For example, given the following invocation of the macro..

```ignore (rust)
fluent_messages! {
    typeck => "./typeck.ftl",
}
```
..where `typeck.ftl` has the following contents..

```fluent
typeck-field-multiply-specified-in-initializer =
    field `{$ident}` specified more than once
    .label = used more than once
    .label-previous-use = first use of `{$ident}`
```
...then the macro parse the Fluent resource, emitting a diagnostic if it
fails to do so, and will generate the following code:

```ignore (rust)
pub static DEFAULT_LOCALE_RESOURCES: &'static [&'static str] = &[
    include_str!("./typeck.ftl"),
];

mod fluent_generated {
    mod typeck {
        pub const field_multiply_specified_in_initializer: DiagnosticMessage =
            DiagnosticMessage::fluent("typeck-field-multiply-specified-in-initializer");
        pub const field_multiply_specified_in_initializer_label_previous_use: DiagnosticMessage =
            DiagnosticMessage::fluent_attr(
                "typeck-field-multiply-specified-in-initializer",
                "previous-use-label"
            );
    }
}
```

When emitting a diagnostic, the generated constants can be used as
follows:

```ignore (rust)
let mut err = sess.struct_span_err(
    span,
    fluent::typeck::field_multiply_specified_in_initializer
);
err.span_default_label(span);
err.span_label(
    previous_use_span,
    fluent::typeck::field_multiply_specified_in_initializer_label_previous_use
);
err.emit();
```

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agomacros: change code block language
David Wood [Mon, 23 May 2022 17:25:57 +0000 (18:25 +0100)]
macros: change code block language

With `ignore (rust)` rather than `ignore (pseudo-Rust)` my editor
highlights the code in the block, which is nicer.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agoRemove the check_mod_intrinsics query
Oli Scherer [Wed, 13 Apr 2022 14:49:03 +0000 (14:49 +0000)]
Remove the check_mod_intrinsics query

2 years agoupdate Miri
Ralf Jung [Tue, 24 May 2022 15:44:11 +0000 (17:44 +0200)]
update Miri

2 years agomove intrinsicck to typeck
Oli Scherer [Wed, 4 May 2022 07:56:57 +0000 (07:56 +0000)]
move intrinsicck to typeck

2 years agotrait selection errors should poison the typeck results, too, so that const eval...
Oli Scherer [Wed, 13 Apr 2022 14:37:36 +0000 (14:37 +0000)]
trait selection errors should poison the typeck results, too, so that const eval can avoid running at all

2 years agoEmit weird lint name lints after expansion
est31 [Sun, 22 May 2022 02:25:40 +0000 (04:25 +0200)]
Emit weird lint name lints after expansion

Previously, we were emitting weird name lints (for renamed or unknown lints)
before expansion, most importantly before cfg expansion.
This meant that the weird name lints would not fire
for lint attributes hidden inside cfg_attr. The same applied
for lint level specifications of those lints.

By moving the lints for the lint names to the post-expansion
phase, these issues are resolved.

2 years agoUpdate minifier-rs version to 0.1.0
Guillaume Gomez [Tue, 24 May 2022 14:55:29 +0000 (16:55 +0200)]
Update minifier-rs version to 0.1.0

2 years agoRollup merge of #97321 - RalfJung:int-to-fnptr, r=Dylan-DPC
Dylan DPC [Tue, 24 May 2022 13:58:26 +0000 (15:58 +0200)]
Rollup merge of #97321 - RalfJung:int-to-fnptr, r=Dylan-DPC

explain how to turn integers into fn ptrs

(with an intermediate raw ptr, not a direct transmute)
Direct int2ptr transmute, under the semantics I am imagining, will produce a ptr with "invalid" provenance that is invalid to deref or call. We cannot give it the same semantics as int2ptr casts since those do [something complicated](https://www.ralfj.de/blog/2022/04/11/provenance-exposed.html).

To my great surprise, that is already what the example in the `transmute` docs does. :)  I still added a comment to say that that part is important, and I added a section explicitly talking about this to the `fn()` type docs.

With https://github.com/rust-lang/miri/pull/2151, Miri will start complaining about direct int-to-fnptr transmutes (in the sense that it is UB to call the resulting pointer).

2 years agoRollup merge of #97308 - JohnTitor:stabilize-cell-filter-map, r=Mark-Simulacrum
Dylan DPC [Tue, 24 May 2022 13:58:25 +0000 (15:58 +0200)]
Rollup merge of #97308 - JohnTitor:stabilize-cell-filter-map, r=Mark-Simulacrum

Stabilize `cell_filter_map`

FCP has been completed: https://github.com/rust-lang/rust/issues/81061#issuecomment-1081806326
Closes #81061

2 years agoRollup merge of #97298 - compiler-errors:if-else-stmt-braces, r=davidtwco
Dylan DPC [Tue, 24 May 2022 13:58:24 +0000 (15:58 +0200)]
Rollup merge of #97298 - compiler-errors:if-else-stmt-braces, r=davidtwco

Parse expression after `else` as a condition if followed by `{`

Fixes #49361.

Two things:
1. This wording needs help. I can never find a natural/intuitive phrasing when I write diagnostics :sweat_smile:
2. Do we even want to show the "wrap in braces" case? I would assume most of the time the "add an `if`" case is the right one.

2 years agoRollup merge of #97288 - compiler-errors:tcxify-rustdoc, r=Dylan-DPC
Dylan DPC [Tue, 24 May 2022 13:58:24 +0000 (15:58 +0200)]
Rollup merge of #97288 - compiler-errors:tcxify-rustdoc, r=Dylan-DPC

Lifetime variance fixes for rustdoc

#97287 migrates rustc to a `Ty` type that is invariant over its lifetime `'tcx`, so I need to fix a bunch of places that assume that `Ty<'a>` and `Ty<'b>` can be unified by shortening both to some common lifetime.

This is doable, since everything is already `'tcx`, so all this PR does is be a bit more explicit that elided lifetimes are actually `'tcx`.

Split out from #97287 so the rustdoc team can review independently.

2 years agoRemove unused brush image
Guillaume Gomez [Tue, 24 May 2022 13:55:01 +0000 (15:55 +0200)]
Remove unused brush image

2 years agoAllow to pass more arguments to tester.js
Guillaume Gomez [Tue, 24 May 2022 11:23:58 +0000 (13:23 +0200)]
Allow to pass more arguments to tester.js

2 years agoAuto merge of #97291 - compiler-errors:lazy-is-actually-3-types-in-a-trenchcoat,...
bors [Tue, 24 May 2022 13:42:33 +0000 (13:42 +0000)]
Auto merge of #97291 - compiler-errors:lazy-is-actually-3-types-in-a-trenchcoat, r=cjgillot

Split out the various responsibilities of `rustc_metadata::Lazy`

`Lazy<T>` actually acts like three different types -- a pointer in the crate metadata to a single value, a pointer to a list/array of values, and an indexable pointer of a list of values (a table).

We currently overload `Lazy<T>` to work differently than `Lazy<[T]>` and the same for `Lazy<Table<I, T>>`. All is well with some helper adapter traits such as [`LazyQueryDecodable`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/rmeta/decoder/trait.LazyQueryDecodable.html) and [`EncodeContentsForLazy`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/rmeta/encoder/trait.EncodeContentsForLazy.html).

Well, changes in #97287 that make `Lazy` work with the now invariant lifetime `'tcx` make these adapters fall apart because of coherence reasons. So we split out these three types and rework some of the helper traits so it's both 1. more clear to understand, and 2. compatible with the changes later in that PR.

Split out from #97287 so it can be reviewed separately, since this PR stands on its own.

2 years agoUpdate browser-ui-test version to 0.9.5
Guillaume Gomez [Tue, 24 May 2022 13:41:24 +0000 (15:41 +0200)]
Update browser-ui-test version to 0.9.5

2 years agoUpdate browser-ui-test version to 0.9.5
Guillaume Gomez [Tue, 24 May 2022 13:41:24 +0000 (15:41 +0200)]
Update browser-ui-test version to 0.9.5

2 years agoAllow to pass more arguments to tester.js
Guillaume Gomez [Tue, 24 May 2022 11:23:58 +0000 (13:23 +0200)]
Allow to pass more arguments to tester.js

2 years agoAdd GUI test for click on setting text
Guillaume Gomez [Mon, 23 May 2022 14:53:44 +0000 (16:53 +0200)]
Add GUI test for click on setting text

2 years agoAllow to click on toggle text to update it
Guillaume Gomez [Mon, 23 May 2022 21:06:36 +0000 (23:06 +0200)]
Allow to click on toggle text to update it

2 years agoAdd flag for stricter checks on uninit/zeroed
5225225 [Mon, 23 May 2022 15:44:05 +0000 (16:44 +0100)]
Add flag for stricter checks on uninit/zeroed

2 years agoRFC3239: Add tests for compact `cfg(target(..))`
Loïc BRANSTETT [Mon, 25 Apr 2022 10:07:21 +0000 (12:07 +0200)]
RFC3239: Add tests for compact `cfg(target(..))`

2 years agoRFC3239: Implement compact `cfg(target(..))`
Loïc BRANSTETT [Fri, 22 Apr 2022 14:34:56 +0000 (16:34 +0200)]
RFC3239: Implement compact `cfg(target(..))`