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 5 pull requests #117627

Closed
wants to merge 12 commits into from

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

compiler-errors and others added 12 commits November 4, 2023 16:44
Previously, errors for crates with the same name would only distinguish them by the span of the source:
```
note: `HashMap<_, _, _, _>` is defined in crate `hashbrown`
   --> /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hashbrown-0.12.3/src/map.rs:188:1
note: `HashMap<u32, u32>` is defined in crate `hashbrown`
   --> /Users/jyn/.local/lib/cargo/registry/src/index.crates.io-6f17d22bba15001f/hashbrown-0.12.3/src/map.rs:188:1
```

When the same version of the crate is loaded twice, this isn't particularly helpful. Additionally
show where the .rlib was loaded from (in this case one was loaded from the sysroot and the other
from a cargo target dir).
This is the only place aside from the global_ctxt query where it is
stolen.
…ustc_type_ir, r=davidtwco

Derive `TyEncodable`/`TyDecodable` in `rustc_type_ir`

when `derive(TyEncodable)` or `derive(TyDecodable)` sees an `I` type parameter on a struct that has no `'tcx`, then parameterize the `TyEncoder`/`TyDecoder`'s interner over that variable rather than `TyCtxt<'tcx>`.

Also, emit where clauses for fields rather than generics.
Use the correct span when emitting the `env!` result

The span used for the `env!` resut changed in 1.73, due to rust-lang@75df62d (from rust-lang#114014).

This prevents [a lint in `plrustc`](https://github.com/tcdi/plrust/blob/main/plrustc/plrustc/src/lints/builtin_macros.rs#L54-L60)[^1] from working well, because the resulting span is not inside the  region where the lint is `#[deny()]`ed.

[^1]: Perhaps worth noting that the `env_macro` diagnostic item comes from [the std fork used with PL/Rust](https://github.com/tcdi/postgrestd/blob/rust-1.73.0/library/core/src/macros/mod.rs#L944).

Unfortunately, I have no idea how to write a test for this since I don't think we can have a custom lint in a test. A suggestion was made to use a custom proc macro for it, but that seems pretty involved (frankly, I might not have time to do it).

r? `@davidtwco` (since they're the author of the PR with the regression)

P.S. We generally try to avoid bothering upstream about PL/Rust-specific stuff (we don't want to nag), but this seems like an actual bug, since the other similar macros, such as `option_env` use the other span (and are lintable as a result).
Distinguish crates with the same name in type errors

Previously, errors for crates with the same name would only distinguish them by the span of the source:
```
note: `HashMap<_, _, _, _>` is defined in crate `hashbrown`
   --> /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hashbrown-0.12.3/src/map.rs:188:1
note: `HashMap<u32, u32>` is defined in crate `hashbrown`
   --> /Users/jyn/.local/lib/cargo/registry/src/index.crates.io-6f17d22bba15001f/hashbrown-0.12.3/src/map.rs:188:1
```

When the same version of the crate is loaded twice, this isn't particularly helpful. Additionally show where the .rlib was loaded from (in this case one was loaded from the sysroot and the other from a cargo target dir).

Fixes rust-lang#110055.
Remove from vacation and compiler review group

Staying on the types review rotation, but staying off the general review queue is good for me right now.

Also move `@compiler-errors` since he's a full member now.
Couple of small changes

These are unrelated to each other, but they are each small enough that opening separate PR's doesn't make sense to me either.

* Remove a place where the parse driver query is stolen.
* Update an outdated doc comment
* Use correct crate name in `-Zprint-vtable-sizes` when using `#![crate_name = "..."]`.
@rustbot rustbot added A-meta Area: Issues about the rust-lang/rust repository. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Nov 6, 2023
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Nov 6, 2023

📌 Commit e63ec25 has been approved by matthiaskrgr

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 6, 2023
@bors
Copy link
Contributor

bors commented Nov 6, 2023

⌛ Testing commit e63ec25 with merge dda6272...

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 6, 2023
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#117578 (Derive `TyEncodable`/`TyDecodable` in `rustc_type_ir`)
 - rust-lang#117592 (Use the correct span when emitting the `env!` result)
 - rust-lang#117609 (Distinguish crates with the same name in type errors)
 - rust-lang#117613 (Remove from vacation and compiler review group)
 - rust-lang#117615 (Couple of small changes)

r? `@ghost`
`@rustbot` modify labels: rollup
@rust-log-analyzer
Copy link
Collaborator

The job dist-various-1 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
---- [run-make] tests/run-make/type-mismatch-sysroot-crate stdout ----

error: make failed
status: exit status: 2
command: cd "/checkout/tests/run-make/type-mismatch-sysroot-crate" && env -u CARGO_MAKEFLAGS -u MAKEFLAGS -u MFLAGS -u RUSTFLAGS AR="arm-none-eabi-ar" CC="arm-none-eabi-gcc -ffunction-sections -fdata-sections -mthumb -march=armv6s-m" CXX="arm-none-eabi-g++ -ffunction-sections -fdata-sections -mthumb -march=armv6s-m" HOST_RPATH_DIR="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" LD_LIB_PATH_ENVVAR="LD_LIBRARY_PATH" LLVM_BIN_DIR="/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/build/bin" 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 codegentypes core coroutines coverage csky cskyasmparser cskycodegen cskydesc cskydisassembler cskyinfo debuginfobtf debuginfocodeview debuginfodwarf debuginfogsym debuginfologicalview debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker dwarflinkerparallel dwp engine executionengine extensions filecheck frontendhlsl frontendopenacc frontendopenmp fuzzercli fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interfacestub interpreter ipo irprinter irreader jitlink libdriver lineeditor linker loongarch loongarchasmparser loongarchcodegen loongarchdesc loongarchdisassembler loongarchinfo 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 objcopy object objectyaml option orcjit orcshared orctargetprocess passes powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvtargetmca runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target targetparser textapi transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo webassemblyutils windowsdriver windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86targetmca xray" LLVM_FILECHECK="/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck" PYTHON="/usr/bin/python3" RUSTC="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" RUSTC_LINKER="arm-none-eabi-gcc" RUSTDOC="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" RUST_BUILD_STAGE="stage2-thumbv6m-none-eabi" S="/checkout" TARGET="thumbv6m-none-eabi" TARGET_RPATH_DIR="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/thumbv6m-none-eabi/lib" TMPDIR="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/type-mismatch-sysroot-crate/type-mismatch-sysroot-crate" "make"
--- stdout -------------------------------
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/type-mismatch-sysroot-crate/type-mismatch-sysroot-crate:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/type-mismatch-sysroot-crate/type-mismatch-sysroot-crate -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/type-mismatch-sysroot-crate/type-mismatch-sysroot-crate  -Ainternal_features -Clinker='arm-none-eabi-gcc' hashbrown.rs --crate-type lib
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/type-mismatch-sysroot-crate/type-mismatch-sysroot-crate:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/type-mismatch-sysroot-crate/type-mismatch-sysroot-crate -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/type-mismatch-sysroot-crate/type-mismatch-sysroot-crate  -Ainternal_features -Clinker='arm-none-eabi-gcc' uses-hashbrown.rs --extern hashbrown=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/type-mismatch-sysroot-crate/type-mismatch-sysroot-crate/libhashbrown.rlib --crate-type lib
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/type-mismatch-sysroot-crate/type-mismatch-sysroot-crate:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/type-mismatch-sysroot-crate/type-mismatch-sysroot-crate -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/type-mismatch-sysroot-crate/type-mismatch-sysroot-crate  -Ainternal_features -Clinker='arm-none-eabi-gcc' mismatch.rs --extern uses_hashbrown=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/type-mismatch-sysroot-crate/type-mismatch-sysroot-crate/libuses_hashbrown.rlib 2>/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/type-mismatch-sysroot-crate/type-mismatch-sysroot-crate/stderr.txt || true
sed -e "$SED_REGEX" < /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/type-mismatch-sysroot-crate/type-mismatch-sysroot-crate/stderr.txt > /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/type-mismatch-sysroot-crate/type-mismatch-sysroot-crate/normalized.txt
diff -u --strip-trailing-cr /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/type-mismatch-sysroot-crate/type-mismatch-sysroot-crate/normalized.txt expected.txt
--- /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/type-mismatch-sysroot-crate/type-mismatch-sysroot-crate/normalized.txt 2023-11-06 10:08:30.371232364 +0000
+++ expected.txt 2023-11-06 09:49:20.310076308 +0000
@@ -1,27 +1,30 @@
- --> mismatch.rs:5:25
-  |
-  |
-5 |     uses_hashbrown::foo(hashbrown::HashMap::default())
-  |     ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `HashMap`, found `HashMap<_, _, _, _>`
-  |     arguments to this function are incorrect
-  |
-  |
-  = note: `hashbrown::HashMap<_, _, _, _>` and `hashbrown::HashMap` have similar names, but are actually distinct types
+   --> mismatch.rs:5:25
+    |
+5   |     uses_hashbrown::foo(hashbrown::HashMap::default())
+    |     ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `HashMap`, found `HashMap<_, _, _, _>`
+    |     arguments to this function are incorrect
+    |
+    |
+    = note: `hashbrown::HashMap<_, _, _, _>` and `hashbrown::HashMap` have similar names, but are actually distinct types
 note: `hashbrown::HashMap<_, _, _, _>` is defined in crate `hashbrown`
- --> /rust/deps/hashbrown-0.14.2/src/map.rs:190:1
-  = note: `hashbrown` was loaded from BUILD_DIR/HOST/stageN/lib/rustlib/TARGET/lib/libhashbrown.rlib
+   --> CARGO_REGISTRY/hashbrown-VERSION/src/map.rs:190:1
+    |
+190 | pub struct HashMap<K, V, S = DefaultHashBuilder, A: Allocator = Global> {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+    = note: `hashbrown` was loaded from BUILD_DIR/HOST/stageN/lib/rustlib/TARGET/lib/libhashbrown.rlib
 note: `hashbrown::HashMap` is defined in crate `hashbrown`
- --> TEST_DIR/type-mismatch-sysroot-crate/hashbrown.rs:1:1
-1 | pub struct HashMap;
-  | ^^^^^^^^^^^^^^^^^^
-  | ^^^^^^^^^^^^^^^^^^
-  = note: `hashbrown` was loaded from BUILD_DIR/HOST/test/run-make/type-mismatch-sysroot-crate/type-mismatch-sysroot-crate/libhashbrown.rlib
-  = note: perhaps two different versions of crate `hashbrown` are being used?
+   --> TEST_DIR/type-mismatch-sysroot-crate/hashbrown.rs:1:1
+1   | pub struct HashMap;
+    | ^^^^^^^^^^^^^^^^^^
+    | ^^^^^^^^^^^^^^^^^^
+    = note: `hashbrown` was loaded from BUILD_DIR/HOST/test/run-make/type-mismatch-sysroot-crate/type-mismatch-sysroot-crate/libhashbrown.rlib
+    = note: perhaps two different versions of crate `hashbrown` are being used?
 note: function defined here
- --> TEST_DIR/type-mismatch-sysroot-crate/uses-hashbrown.rs:1:8
-  |
-1 | pub fn foo(_: hashbrown::HashMap) {}
-  |        ^^^
+   --> TEST_DIR/type-mismatch-sysroot-crate/uses-hashbrown.rs:1:8
+    |
+1   | pub fn foo(_: hashbrown::HashMap) {}
 
 error: aborting due to previous error
------------------------------------------
--- stderr -------------------------------
---
    [run-make] tests/run-make/type-mismatch-sysroot-crate

test result: FAILED. 129 passed; 1 failed; 217 ignored; 0 measured; 0 filtered out; finished in 22.72s

Some tests failed in compiletest suite=run-make mode=run-make host=x86_64-unknown-linux-gnu target=thumbv6m-none-eabi
  local time: Mon Nov  6 10:08:43 UTC 2023
  network time: Mon, 06 Nov 2023 10:08:43 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

@bors
Copy link
Contributor

bors commented Nov 6, 2023

💔 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 Nov 6, 2023
@matthiaskrgr matthiaskrgr deleted the rollup-22w6fp8 branch March 16, 2024 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-meta Area: Issues about the rust-lang/rust repository. rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants