Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 6 pull requests #91414

Closed
wants to merge 14 commits into from

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

nbdd0121 and others added 14 commits September 24, 2021 22:55
... if they use arbitrary enum discriminant. Code like

```rust
enum Enum {
    Foo = 1,
    Bar(),
    Baz{}
}
```

seems to be unintentionally allowed so we couldn't disallow them now,
but we could disallow them if arbitrary enum discriminant is used before
1.56 hits stable.
Version 5 adds Branch Regions which are a prerequisite for branch coverage.
Version 6 can use the zeroth filename as prefix for other relative files.
This commit augments Swatinem's initial commit in uncommitted PR rust-lang#90047,
which was a great starting point, but did not fully support LLVM
Coverage Mapping Format version 6.

Version 6 requires adding the compilation directory when file paths are
relative, and since Rustc coverage maps use relative paths, we should
add the expected compilation directory entry.

Note, however, that with the compilation directory, coverage reports
from `llvm-cov show` can now report file names (when the report includes
more than one file) with the full absolute path to the file.

This would be a problem for test results, but the workaround (for the
rust coverage tests) is to include an additional `llvm-cov show`
parameter: `--compilation-dir=.`
When recovering from a `:` in a pattern, use adequate AST pattern

If the suggestion to use `::` instead of `:` in the pattern isn't correct, a second resolution error will be emitted.
Disallow non-c-like but "fieldless" ADTs from being casted to integer if they use arbitrary enum discriminant

Code like

```rust
#[repr(u8)]
enum Enum {
    Foo /* = 0 */,
    Bar(),
    Baz{}
}

let x = Enum::Bar() as u8;
```

seems to be unintentionally allowed so we couldn't disallow them now ~~, but we could disallow them if arbitrary enum discriminant is used before 1.56 hits stable~~ (stabilization was reverted).

Related: rust-lang#88621

``@rustbot`` label +T-lang
…kh726

Remove all migrate.nll.stderr files

There are a few ui tests that setup the revisions like:
```rust
// revisions: migrate nll`
// [nll]compile-flags: -Zborrowck=mir
```

However most of them fail to disable the nll compare mode like this:
```rust
// ignore-compare-mode-nll
```

This ends up generating confusing files ending in `.migrate.nll.stderr` because the nll compare mode is run on top of the migrate revision.

This PR fixes this by adding `ignore-compare-mode-nll` to these tests.

I would have just made these tests use compare modes instead but I assume the reason these tests are messing around with revisions instead of just letting the nll compare mode do its thing is to enforce error annotations for both migrate and nll.
Relying on just compare modes would only have the error annotations for migrate.
… r=tmandry

Add support for LLVM coverage mapping format versions 5 and 6

This PR cherry-pick's Swatinem's initial commit in unsubmitted PR rust-lang#90047.

My additional commit augments Swatinem's great starting point, but adds full support for LLVM
Coverage Mapping Format version 6, conditionally, if compiling with LLVM 13.

Version 6 requires adding the compilation directory when file paths are
relative, and since Rustc coverage maps use relative paths, we should
add the expected compilation directory entry.

Note, however, that with the compilation directory, coverage reports
from `llvm-cov show` can now report file names (when the report includes
more than one file) with the full absolute path to the file.

This would be a problem for test results, but the workaround (for the
rust coverage tests) is to include an additional `llvm-cov show`
parameter: `--compilation-dir=.`
…l, r=cjgillot

Improve error message for `E0659` if the source is not available

Fixes rust-lang#91028. The fix is similar to those in rust-lang#89233 and rust-lang#87088. With this change, instead of the dangling
```
note: `Option` could also refer to the enum defined here
```
I get
```
note: `Option` could also refer to an enum from prelude
```
If the standard library source code _is_ available, the output does not change.
@rustbot rustbot added the rollup A PR which is a rollup label Dec 1, 2021
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=6

@bors
Copy link
Contributor

bors commented Dec 1, 2021

📌 Commit d51eeef has been approved by matthiaskrgr

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Dec 1, 2021
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-12 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
+ LL |     Foo() = 1,
+    |             ^
+    |
+    = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information
+    = help: add `#![feature(arbitrary_enum_discriminant)]` to the crate attributes to enable
+ error[E0658]: discriminants on non-unit variants are experimental
+   --> $DIR/issue-88621.rs:4:13
+    |
+    |
+ LL |     Bar{} = 2,
+    |
+    = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information
+    = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information
+    = help: add `#![feature(arbitrary_enum_discriminant)]` to the crate attributes to enable
+ 
+ error[E0658]: custom discriminant values are not allowed in enums with tuple or struct variants
+    |
+ LL |     Foo() = 1,
+    |     --------- tuple variant defined here
+    |     --------- tuple variant defined here
+ LL |     Bar{} = 2,
+    |     --------- struct variant defined here
+ LL |     Baz = 3,
+    |           ^ disallowed custom discriminant
+    = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information
+    = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information
+    = help: add `#![feature(arbitrary_enum_discriminant)]` to the crate attributes to enable
+ 
1 error[E0605]: non-primitive cast: `Kind2` as `u8`
3    |


4 LL |     let _ = Kind2::Foo() as u8;
5    |             ^^^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
- error: aborting due to previous error
+ error: aborting due to 4 previous errors
8 
- For more information about this error, try `rustc --explain E0605`.
---
To only update this specific test, also pass `--test-args cast/issue-88621.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/cast/issue-88621.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/cast/issue-88621" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/cast/issue-88621/auxiliary"
------------------------------------------

------------------------------------------
stderr:
---
LL |     Foo() = 1,
   |             ^
   |
   = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information
   = help: add `#![feature(arbitrary_enum_discriminant)]` to the crate attributes to enable
error[E0658]: discriminants on non-unit variants are experimental
  --> /checkout/src/test/ui/cast/issue-88621.rs:4:13
   |
   |
LL |     Bar{} = 2,
   |
   = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information
   = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information
   = help: add `#![feature(arbitrary_enum_discriminant)]` to the crate attributes to enable

error[E0658]: custom discriminant values are not allowed in enums with tuple or struct variants
   |
LL |     Foo() = 1,
   |     --------- tuple variant defined here
   |     --------- tuple variant defined here
LL |     Bar{} = 2,
   |     --------- struct variant defined here
LL |     Baz = 3,
   |           ^ disallowed custom discriminant
   = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information
   = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information
   = help: add `#![feature(arbitrary_enum_discriminant)]` to the crate attributes to enable

error[E0605]: non-primitive cast: `Kind2` as `u8`
   |
   |
LL |     let _ = Kind2::Foo() as u8;
   |             ^^^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
error: aborting due to 4 previous errors

Some errors have detailed explanations: E0605, E0658.
For more information about an error, try `rustc --explain E0605`.
---
test result: FAILED. 12307 passed; 1 failed; 115 ignored; 0 measured; 0 filtered out; finished in 116.09s



command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--suite" "ui" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-12/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python3" "--lldb-python" "/usr/bin/python3" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "12.0.0" "--llvm-components" "aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu amdgpuasmparser amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo cfguard codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker engine executionengine extensions filecheck frontendopenacc frontendopenmp fuzzmutate globalisel hellonew hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interfacestub interpreter ipo irreader jitlink lanai lanaiasmparser lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit orcshared orctargetprocess passes perfjitevents powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info xcore xcorecodegen xcoredesc xcoredisassembler xcoreinfo xray" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--channel" "nightly" "--color" "always"


Build completed unsuccessfully in 0:10:57

@bors
Copy link
Contributor

bors commented Dec 1, 2021

⌛ Testing commit d51eeef with merge 882574740b37536b966e47cbb1c5fef6bec166f4...

@rust-log-analyzer
Copy link
Collaborator

The job dist-i586-gnu-i586-i686-musl failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
+ LL |     Foo() = 1,
+    |             ^
+    |
+    = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information
+    = help: add `#![feature(arbitrary_enum_discriminant)]` to the crate attributes to enable
+ error[E0658]: discriminants on non-unit variants are experimental
+   --> $DIR/issue-88621.rs:4:13
+    |
+    |
+ LL |     Bar{} = 2,
+    |
+    = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information
+    = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information
+    = help: add `#![feature(arbitrary_enum_discriminant)]` to the crate attributes to enable
Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=i586-unknown-linux-gnu
Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=i586-unknown-linux-gnu
+ error[E0658]: custom discriminant values are not allowed in enums with tuple or struct variants
+    |
+ LL |     Foo() = 1,
+    |     --------- tuple variant defined here
+    |     --------- tuple variant defined here
+ LL |     Bar{} = 2,
+    |     --------- struct variant defined here
+ LL |     Baz = 3,
+    |           ^ disallowed custom discriminant
+    = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information
+    = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information
+    = help: add `#![feature(arbitrary_enum_discriminant)]` to the crate attributes to enable
+ 
1 error[E0605]: non-primitive cast: `Kind2` as `u8`
3    |


4 LL |     let _ = Kind2::Foo() as u8;
5    |             ^^^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
- error: aborting due to previous error
+ error: aborting due to 4 previous errors
8 
- For more information about this error, try `rustc --explain E0605`.
---
To only update this specific test, also pass `--test-args cast/issue-88621.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/cast/issue-88621.rs" "-Zthreads=1" "--target=i586-unknown-linux-gnu" "--error-format" "json" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/cast/issue-88621" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/i586-unknown-linux-gnu/native/rust-test-helpers" "-Clinker=cc" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/cast/issue-88621/auxiliary"
------------------------------------------

------------------------------------------
stderr:
---
LL |     Foo() = 1,
   |             ^
   |
   = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information
   = help: add `#![feature(arbitrary_enum_discriminant)]` to the crate attributes to enable
error[E0658]: discriminants on non-unit variants are experimental
  --> /checkout/src/test/ui/cast/issue-88621.rs:4:13
   |
   |
LL |     Bar{} = 2,
   |
   = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information
   = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information
   = help: add `#![feature(arbitrary_enum_discriminant)]` to the crate attributes to enable

error[E0658]: custom discriminant values are not allowed in enums with tuple or struct variants
   |
LL |     Foo() = 1,
   |     --------- tuple variant defined here
   |     --------- tuple variant defined here
LL |     Bar{} = 2,
   |     --------- struct variant defined here
LL |     Baz = 3,
   |           ^ disallowed custom discriminant
   = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information
   = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information
   = help: add `#![feature(arbitrary_enum_discriminant)]` to the crate attributes to enable

error[E0605]: non-primitive cast: `Kind2` as `u8`
   |
   |
LL |     let _ = Kind2::Foo() as u8;
   |             ^^^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
error: aborting due to 4 previous errors

Some errors have detailed explanations: E0605, E0658.
For more information about an error, try `rustc --explain E0605`.
---
test result: FAILED. 12255 passed; 1 failed; 167 ignored; 0 measured; 0 filtered out; finished in 124.79s



command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/i586-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-i586-unknown-linux-gnu" "--suite" "ui" "--mode" "ui" "--target" "i586-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck" "--linker" "cc" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0  -Lnative=/checkout/obj/build/i586-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python3" "--lldb-python" "/usr/bin/python3" "--gdb" "/usr/bin/gdb" "--llvm-version" "13.0.0-rust-1.59.0-nightly" "--llvm-components" "aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo cfguard codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker dwp engine executionengine extensions filecheck frontendopenacc frontendopenmp fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interfacestub interpreter ipo irreader jitlink libdriver lineeditor linker lto m68k m68kasmparser m68kcodegen m68kdesc m68kdisassembler m68kinfo mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit orcshared orctargetprocess passes powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo webassemblyutils windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info xray" "--cc" "" "--cxx" "" "--cflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--channel" "nightly" "--color" "always"


Build completed unsuccessfully in 0:17:35

@bors
Copy link
Contributor

bors commented Dec 1, 2021

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 1, 2021
@matthiaskrgr matthiaskrgr deleted the rollup-tc59aqv branch December 12, 2021 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.