Commit Graph

997 Commits

Author SHA1 Message Date
Esteban Küber
b2e7ae1f65 Detect multiple crate versions on method not found
When a type comes indirectly from one crate version but the imported trait comes from a separate crate version, the called method won't be found. We now show additional context:

```
error[E0599]: no method named `foo` found for struct `dep_2_reexport::Type` in the current scope
 --> multiple-dep-versions.rs:8:10
  |
8 |     Type.foo();
  |          ^^^ method not found in `Type`
  |
note: you have multiple different versions of crate `dependency` in your dependency graph
 --> multiple-dep-versions.rs:4:32
  |
4 | use dependency::{do_something, Trait};
  |                                ^^^^^ `dependency` imported here doesn't correspond to the right crate version
  |
 ::: ~/rust/build/x86_64-unknown-linux-gnu/test/run-make/crate-loading/rmake_out/multiple-dep-versions-1.rs:4:1
  |
4 | pub trait Trait {
  | --------------- this is the trait that was imported
  |
 ::: ~/rust/build/x86_64-unknown-linux-gnu/test/run-make/crate-loading/rmake_out/multiple-dep-versions-2.rs:4:1
  |
4 | pub trait Trait {
  | --------------- this is the trait that is needed
5 |     fn foo(&self);
  |        --- the method is available for `dep_2_reexport::Type` here
```
2024-08-12 19:29:47 +00:00
Guillaume Gomez
bb35b888b5
Rollup merge of #128937 - lqd:clean-rmake-tests, r=jieyouxu
Fix warnings in rmake tests on `x86_64-unknown-linux-gnu`

r? `@jieyouxu`

This PR fixes some warnings I saw in rmake tests. I didn't deny more warnings in this PR until `@jieyouxu` gives their opinion, but maybe we should actually deny all warnings in `rmake.rs` files?

I've also only looked at non-ignored tests on `x86_64-unknown-linux-gnu`, and denying warnings would require a try build for all targets 😓.
2024-08-12 17:09:19 +02:00
许杰友 Jieyou Xu (Joe)
6dc300ba45 tests: ignore dump-ice-to-disk on windows 2024-08-11 11:11:22 +00:00
Rémy Rakic
dcd6170c89 use rfs in rustdoc io rmake test 2024-08-11 09:45:47 +00:00
许杰友 Jieyou Xu (Joe)
960e7b55e1 tests: tidy up dump-ice-to-disk and make assertion failures extremely verbose 2024-08-11 03:42:38 +00:00
Rémy Rakic
f4cb0de44e remove other warnings from rmake tests 2024-08-10 18:16:15 +00:00
Rémy Rakic
141d9dc3a5 remove unused imports from rmake tests 2024-08-10 18:06:10 +00:00
Guillaume Gomez
48fd9fdd42
Rollup merge of #128909 - saethlin:run-make-ice-yes, r=jieyouxu
Fix dump-ice-to-disk for RUSTC_ICE=0 users

Before this change, the test fails if you run it with `RUSTC_ICE=0`.
2024-08-10 16:23:54 +02:00
Guillaume Gomez
a7e188a8f6
Rollup merge of #128807 - ChrisDenton:bloat, r=jieyouxu
run-make: explaing why fmt-write-bloat is ignore-windows

The trouble here is that libc doesn't exist on Windows. Well it kinda does but it isn't called that so we substitute a name that works. Ideally finding necessary libs for the platform would be done at a higher level but until then this should work.

try-job: x86_64-msvc
try-job: x86_64-mingw
try-job: i686-msvc
try-job: i686-mingw
2024-08-10 16:23:52 +02:00
Ben Kimock
f595539b81 Fix dump-ice-to-disk for RUSTC_ICE=0 users 2024-08-09 20:01:25 -04:00
Chris Denton
ef90df6904
Update reason why fmt-write-bloat ignores windows 2024-08-09 21:21:43 +00:00
Chris Denton
2cc029edf5
Only link libc on *nix platforms 2024-08-09 21:17:32 +00:00
Kyle Huey
9f3376eaf2 Test --compress-debug-sections with rust-lld. 2024-08-09 05:55:39 -07:00
Matthias Krüger
521e75412f
Rollup merge of #128823 - ChrisDenton:staticlib, r=jieyouxu
run-make: enable msvc for staticlib-dylib-linkage

`-Zstaticlib-allow-rdylib-deps` on MSVC returns things like `/LIBPATH:R:\rust\build\x86_64-pc-windows-msvc\test\run-make\staticlib-dylib-linkage\rmake_out`. That is a linker argument rather than a `cc` argument. Which makes sense because rustc interacts directly with the linker on MSVC targets. So we need to tell the C compiler to pass on the arguments to the linker.

try-job: x86_64-msvc
try-job: i686-msvc
2024-08-09 05:52:16 +02:00
Matthias Krüger
408baccd0d
Rollup merge of #128804 - ChrisDenton:redudant, r=jieyouxu
run-make: enable msvc for redundant-libs

The issue here was that `foo` was not exporting any functions therefore creating an import library was unnecessary and elided by the linker.

I fixed it by exporting the functions.

try-job: x86_64-msvc
try-job: i686-msvc
2024-08-09 05:52:15 +02:00
Chris Denton
8725f7ee4c
run-make: enable msvc for staticlib-dylib-linkage 2024-08-08 12:17:15 +00:00
Folkert
3e5885f7d2
changes after review 2024-08-08 10:21:47 +02:00
Folkert
ae68b2fc56
migrate thumb-none-qemu to rmake 2024-08-08 10:21:38 +02:00
Trevor Gross
ca5e8a7c4d
Rollup merge of #128702 - yaahc:metrics-flag, r=estebank
Add -Zmetrics-dir=PATH to save diagnostic metadata to disk

r? ``@estebank``
2024-08-07 20:49:03 -05:00
Chris Denton
599bcb5cf1
run-make: enable msvc for redundant-libs 2024-08-08 01:42:29 +00:00
Jane Losare-Lusby
5212c75907 Add -Zerror-metrics=PATH to save diagnostic metadata to disk 2024-08-07 11:16:55 -07:00
Matthias Krüger
26787a8c0d
Rollup merge of #128696 - Oneirical:second-linkage-rampage, r=jieyouxu
Migrate `staticlib-dylib-linkage` `run-make` test to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

I'm quite sure this has the same issue as the one brought up in [this discussion](https://github.com/rust-lang/rust/pull/128407#discussion_r1702439172), so I elected to keep the ignore MSVC.

try-job: aarch64-apple
try-job: x86_64-gnu-llvm-17
try-job: armhf-gnu
2024-08-07 19:35:07 +02:00
Matthias Krüger
38dc3b2621
Rollup merge of #128636 - folkertdev:rmake-thumb-none-cortex-m, r=jieyouxu
migrate `thumb-none-cortex-m` to rmake

tracking issue: https://github.com/rust-lang/rust/issues/121876

I'll leave some comments/questions inline

r? ```@jieyouxu```

try-job: armhf-gnu
try-job: dist-various-1
try-job: test-various
2024-08-07 19:35:06 +02:00
Matthias Krüger
b817900087
Rollup merge of #128384 - dheaton-arm:mte-test, r=jieyouxu
Add tests to ensure MTE tags are preserved across FFI boundaries

Added run-make tests to verify that, between a Rust-C FFI boundary in both directions, any MTE tags included in a pointer are preserved for the following pointer types, as well as any information stored using TBI:
- int
- float
- string
- function

try-job: aarch64-gnu
2024-08-07 19:35:05 +02:00
Oneirical
7d1a97fae9 rewrite pgo-indirect-call-promotion to rmake 2024-08-07 12:57:34 -04:00
Oneirical
7e5a2ea583 rewrite pdb-buildinfo-cl-cmd to rmake 2024-08-07 12:57:26 -04:00
Guillaume Gomez
c0efd51396
Rollup merge of #128757 - Oneirical:calm-before-the-sltorm, r=jieyouxu
Migrate `pgo-gen-lto` `run-make` test to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

This one is so easy, I'm surprised I missed it.

try-job: aarch64-apple
try-job: x86_64-msvc
try-job: x86_64-mingw
try-job: i686-msvc
try-job: i686-mingw
try-job: x86_64-gnu-llvm-17
2024-08-07 15:59:39 +02:00
Guillaume Gomez
f739c00f4a
Rollup merge of #128700 - Oneirical:i-ffind-these-tests-quite-simdple, r=jieyouxu
Migrate `simd-ffi` `run-make` test to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

try-job: x86_64-msvc
try-job: x86_64-mingw
try-job: i686-msvc
try-job: armhf-gnu
try-job: test-various
try-job: aarch64-apple
try-job: x86_64-gnu-llvm-17
2024-08-07 15:59:38 +02:00
Guillaume Gomez
a05f187b15
Rollup merge of #128656 - ChrisDenton:rust-lld, r=lqd
Enable msvc for run-make/rust-lld

This is simply a matter of using the right argument for lld-link.

As a bonus, I also fixed a typo.

try-job: i686-msvc
try-job: x86_64-msvc
2024-08-07 15:59:37 +02:00
bors
9bad7ba324 Auto merge of #128196 - Oneirical:poltergeist-manitestation, r=jieyouxu
Migrate `cross-lang-lto-upstream-rlibs`, `long-linker-command-lines` and `long-linker-command-lines-cmd-exe` `run-make` tests to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

The `long-linker` tests are certainly doing something... interesting - they summon `rustc` calls with obscene quantities of arguments and check that this is appropriately handled. I removed the `RUSTC_ORIGINAL` magic - it's equivalent to `RUSTC` in `tools.mk`, so what is the purpose? Making it so the massive pile of flags doesn't modify rustc itself and start leaking into other tests? Tell me what you think.

Please try:

try-job: x86_64-msvc
try-job: i686-msvc
try-job: x86_64-mingw
try-job: i686-mingw
try-job: aarch64-apple
try-job: test-various
try-job: x86_64-gnu-debug
try-job: x86_64-gnu-llvm-17
2024-08-07 10:58:10 +00:00
Trevor Gross
6ccb3569f8
Rollup merge of #128649 - ChrisDenton:param-passing, r=jieyouxu
run-make: Enable msvc for `no-duplicate-libs` and `zero-extend-abi-param-passing`

The common thing between these two tests is to use `#[link(..., kind="static")]` so that it doesn't try to do a DLL import.

`zero-extend-abi-param-passing` also needs to have an optimized static library but there's only helper function for a non-optimized version. Rather than copy/pasting the code (and adding the optimization flag) I reused the same code so that it more easily be kept in sync.

try-job: i686-msvc
try-job: x86_64-msvc
2024-08-06 22:17:34 -05:00
Trevor Gross
0761d2af61
Rollup merge of #128647 - ChrisDenton:link-args-order, r=jieyouxu
Enable msvc for link-args-order

I could not see any reason in #70665 why this test needs to specifically use `ld`. Maybe to provide a consistent linker input line? In any case, the test does work for the MSVC linker.

try-job: i686-msvc
try-job: x86_64-msvc
2024-08-06 22:17:33 -05:00
Trevor Gross
cc42e34391
Rollup merge of #128638 - ChrisDenton:link-dedup, r=jieyouxu
run-make: enable msvc for `link-dedup`

This is just a case of differing style of linker arguments.

I also cleaned up a bit where we were running the same command three times in a row. Instead I reused the output.

One thing that confused me is why we were testing for the same lib three times in a row but not two. After figuring that out I added a note to hopefully save future readers some confusion.

try-job: x86_64-msvc
try-job: i686-msvc
2024-08-06 22:17:33 -05:00
Trevor Gross
10a7f93f12
Rollup merge of #128362 - folkertdev:naked-function-symbol-visibility, r=bjorn3
add test for symbol visibility of `#[naked]` functions

tracking issue: #90957

This test is extracted from https://github.com/rust-lang/rust/pull/128004

That PR attempts to generated naked functions as an extern function declaration, combined with a global asm block that provides the implementation for that declaration.

In order to link declaration and definition together, some flavor of external linking must be used: LLVM will error for other linkage types. Specifically the allowed options are `#[linkage = "external"]` and `#[linkage = "extern_weak"]`. That is kind of an implementation detail though: to the user, a naked function should just behave like a normal function.

Hence it should be visible to the linker under the same circumstances as a normal, vanilla function and have the same attributes (Weak, External). Getting this behavior right will require some care, so I think it's a good idea to lock it in now, before making any changes, to make sure we don't regress.

Are there any interesting cases that I missed here? E.g. is checking on different architectures worth it? I don't think the other binary types (rlib etc) are relevant here, but may be missing something.

r? ``@bjorn3``
2024-08-06 22:17:32 -05:00
Trevor Gross
0aaffdb25f
Rollup merge of #128107 - Oneirical:tomato-hartester, r=jieyouxu
Migrate `raw-dylib-alt-calling-convention`, `raw-dylib-c` and `redundant-libs` `run-make` tests to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

Please try:

// try-job: x86_64-msvc
// try-job: x86_64-mingw
// try-job: i686-msvc
try-job: x86_64-gnu-llvm-17
try-job: aarch64-apple
2024-08-06 22:17:31 -05:00
Matthias Krüger
f9325b72d9
Rollup merge of #128710 - ChrisDenton:null, r=jieyouxu
Don't ICE when getting an input file name's stem fails

Fixes #128681

The file stem is only used as a user-friendly prefix on intermediary files. While nice to have, it's not the end of the world if it fails so there's no real reason to emit an error here. We can continue with a fixed name as we do when an anonymous string is used.
2024-08-07 00:34:14 +02:00
Oneirical
0149ba33bb rewrite pgo-gen-lto to rmake 2024-08-06 16:35:08 -04:00
Folkert
201ca3f65c
changes after review 2024-08-06 22:08:28 +02:00
Esteban Küber
034b73ba54 fix test 2024-08-06 19:09:52 +00:00
Esteban Küber
5e26c8d3c9 Move test to be make instead of ui 2024-08-06 17:58:12 +00:00
Oneirical
fe4cd9aa8d rewrite long-linker-command-lines-cmd-exe to rmake 2024-08-06 11:03:18 -04:00
Oneirical
fe6feb8c6e rewrite long-linker-command-lines to rmake 2024-08-06 11:03:17 -04:00
Oneirical
342b807e1a rewrite cross-lang-lto-upstream-rlibs to rmake 2024-08-06 11:03:17 -04:00
Oneirical
608b322f49 rewrite staticlib-dylib-linkage to rmake 2024-08-06 10:59:14 -04:00
Chris Denton
3fd645e254
Check staticlib name falls back to rust_out 2024-08-05 23:50:15 +00:00
Chris Denton
c8d50ef2ee
Windows: Test if \\.\NUL works as an input file 2024-08-05 22:13:17 +00:00
Oneirical
1054054a46 rewrite simd-ffi to rmake 2024-08-05 15:07:33 -04:00
Folkert
19679510c7
add test for symbol visibility of #[naked] functions 2024-08-05 19:55:35 +02:00
Oneirical
20332dae2f rewrite cdylib-dylib-linkage to rmake 2024-08-05 10:39:17 -04:00
Oneirical
011727f14e rewrite redundant-libs to rmake 2024-08-05 10:11:53 -04:00