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 10 pull requests #108982

Closed
wants to merge 25 commits into from

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

zertosh and others added 25 commits December 20, 2022 10:55
The `asm!` and `global_asm!` macros require their operands to appear
strictly in the following order:
- Template strings
- Positional operands
- Named operands
- Explicit register operands
- `clobber_abi`
- `options`

This is overly strict and can be inconvienent when building complex
`asm!` statements with macros. This PR relaxes the ordering requirements
as follows:
- Template strings must still come before all other operands.
- Positional operands must still come before named and explicit register
operands.
- Named and explicit register operands can be freely mixed.
- `options` and `clobber_abi` can appear in any position.
SymbolWrapper.cpp doesn't use std::optional or llvm::Optional, so this
patch removes the extraneous include.  Note that llvm/ADT/Optional.h
has been deprecated upstream.  This patch ensures that
SymbolWrapper.cpp continues to compile even after the upcoming removal
of Optional.h.
Relax ordering rules for `asm!` operands

The `asm!` and `global_asm!` macros require their operands to appear strictly in the following order:
- Template strings
- Positional operands
- Named operands
- Explicit register operands
- `clobber_abi`
- `options`

This is overly strict and can be inconvienent when building complex `asm!` statements with macros. This PR relaxes the ordering requirements as follows:
- Template strings must still come before all other operands.
- Positional operands must still come before named and explicit register operands.
- Named and explicit register operands can be freely mixed.
- `options` and `clobber_abi` can appear in any position after the template strings.

r? `````@joshtriplett`````
…tr, r=dtolnay

Stabilize path_as_mut_os_str

Closes rust-lang#105021

r? `@dtolnay`
…, r=pietroalbini

use problem matchers for tidy CI
…king, r=pnkfelix

Support linking to rust dylib with --crate-type staticlib

This allows for example dynamically linking libstd, while statically linking the user crate into an executable or C dynamic library. For this two unstable flags (`-Z staticlib-allow-rdylib-deps` and `-Z staticlib-prefer-dynamic`) are introduced. Without the former you get an error. The latter is the equivalent to `-C prefer-dynamic` for the staticlib crate type to indicate that dynamically linking is preferred when both options are available, like for libstd. Care must be taken to ensure that no crate ends up being merged into two distinct staticlibs that are linked together. Doing so will cause a linker error at best and undefined behavior at worst. In addition two distinct staticlibs compiled by different rustc may not be combined under any circumstances due to some rustc private symbols not being mangled.

To successfully link a staticlib, `--print native-static-libs` can be used while compiling to ask rustc for the linker flags necessary when linking the staticlib. This is an existing flag which previously only listed native libraries. It has been extended to list rust dylibs too. Trying to locate libstd yourself to link against it is not supported and may break if for example the libstd of multiple rustc versions are put in the same directory.

For an example on how to use this see the `src/test/run-make-fulldeps/staticlib-dylib-linkage/` test.
Stabilize movbe target feature

Almost all "old" x86 target features are stable.  As far as I can tell, these are the last two unstable features in the `x86-64-v2` or `x86-64-v3` microarchitecture levels, so I'm not sure if it was an oversight or if they're still unstable for a reason (see rust-lang#106323 for `f16c`).

Note that this only stabilizes the target features, and not the intrinsics.

cc `@Amanieu`

r? `@rust-lang/lang`
Add `--no-undefined-version` link flag and fix associated breakage

LLVM upstream sets `--no-undefined-version` by default in lld: https://reviews.llvm.org/D135402.

Due to a bug in how version scripts are generated, this breaks the `dylib` output type for most crates. See rust-lang#105967 (comment) for details.

This PR adds the flag to gcc flavor linkers in anticipation of this LLVM change rolling in, and patches `rustc` to not attempt to export `__rust_*` allocator symbols when they weren't generated.

Fixes rust-lang#105967
rust-lang#107307 Implementing "<test_binary> --list --format json" for use by IDE test explorers / runners

PR 1 of 2 - wiring up just the new information + implement the command line changes i.e. --format json + tests

upcoming:
PR 2 of 2 - clean up "#[cfg(not(bootstrap))]" from PR 1

As per the discussions on
- MCP: https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Implementing.20.22.3Ctest_binary.3E.20--list.20--form.E2.80.A6.20compiler-team.23592/near/328747548
- preRFC: https://internals.rust-lang.org/t/pre-rfc-implementing-test-binary-list-format-json-for-use-by-ide-test-explorers-runners/18308
- FYI on Discord: https://discord.com/channels/442252698964721669/459149169546887178/1075581549409484820
Remove an extraneous include

SymbolWrapper.cpp doesn't use std::optional or llvm::Optional, so this patch removes the extraneous include.  Note that llvm/ADT/Optional.h has been deprecated upstream.  This patch ensures that SymbolWrapper.cpp continues to compile even after the upcoming removal of Optional.h.
Document tool lints

Add brief doc comments for the internal tool lints so a summary can be seen without needing to open source code
@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc 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. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Mar 10, 2023
@rustbot rustbot added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Mar 10, 2023
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=10

@bors
Copy link
Contributor

bors commented Mar 10, 2023

📌 Commit a2ef2e9 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 Mar 10, 2023
@bors
Copy link
Contributor

bors commented Mar 10, 2023

⌛ Testing commit a2ef2e9 with merge 90546930728442c5c106395ff36d9ee24c07f099...

@bors
Copy link
Contributor

bors commented Mar 10, 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 Mar 10, 2023
@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
      System Firmware Version: VMW71.00V.13989454.B64.1906190538
      OS Loader Version: 540.120.3~22
      Apple ROM Info: [MS_VM_CERT/SHA1/27d66596a61c48dd3dc7216fd715126e33f59ae7]Welcome to the Virtual Machine
      SMC Version (system): 2.8f0
      Serial Number (system): VM0JroWfjSS6
      Provisioning UDID: 4203018E-580F-C1B5-9525-B745CECA79EB

hw.ncpu: 12
hw.byteorder: 1234
---
test [pretty] tests/pretty/trait-inner-attr.rs ... ok
test [pretty] tests/pretty/stmt_expr_attributes.rs ... ok
test [pretty] tests/pretty/struct-tuple.rs ... ok
test [pretty] tests/pretty/trait-polarity.rs ... ok
2023-03-10T15:14:06.665790Z ERROR compiletest::runtest: fatal error, panic: "pretty-printed source does not match expected source\nexpected:\n------------------------------------------\n#![feature(prelude_import)]\n#![no_std]\n#[prelude_import]\nuse ::std::prelude::rust_2015::*;\n#[macro_use]\nextern crate std;\n// compile-flags: --crate-type=lib --test\n// pretty-compare-only\n// pretty-mode:expanded\n// pp-exact:tests-are-sorted.pp\n\nextern crate test;\n#[cfg(test)]\n#[rustc_test_marker = \"m_test\"]\npub const m_test: test::TestDescAndFn =\n    test::TestDescAndFn {\n        desc: test::TestDesc {\n            name: test::StaticTestName(\"m_test\"),\n            ignore: false,\n            ignore_message: ::core::option::Option::None,\n            source_file: \"/checkout/tests/pretty/tests-are-sorted.rs\",\n            start_line: 7usize,\n            start_col: 4usize,\n            end_line: 7usize,\n            end_col: 10usize,\n            compile_fail: false,\n            no_run: false,\n            should_panic: test::ShouldPanic::No,\n            test_type: test::TestType::Unknown,\n        },\n        testfn: test::StaticTestFn(|| test::assert_test_result(m_test())),\n    };\nfn m_test() {}\n\nextern crate test;\n#[cfg(test)]\n#[rustc_test_marker = \"z_test\"]\npub const z_test: test::TestDescAndFn =\n    test::TestDescAndFn {\n        desc: test::TestDesc {\n            name: test::StaticTestName(\"z_test\"),\n            ignore: true,\n            ignore_message: ::core::option::Option::Some(\"not yet implemented\"),\n            source_file: \"/checkout/tests/pretty/tests-are-sorted.rs\",\n            start_line: 11usize,\n            start_col: 4usize,\n            end_line: 11usize,\n            end_col: 10usize,\n            compile_fail: false,\n            no_run: false,\n            should_panic: test::ShouldPanic::No,\n            test_type: test::TestType::Unknown,\n        },\n        testfn: test::StaticTestFn(|| test::assert_test_result(z_test())),\n    };\n#[ignore = \"not yet implemented\"]\nfn z_test() {}\n\nextern crate test;\n#[cfg(test)]\n#[rustc_test_marker = \"a_test\"]\npub const a_test: test::TestDescAndFn =\n    test::TestDescAndFn {\n        desc: test::TestDesc {\n            name: test::StaticTestName(\"a_test\"),\n            ignore: false,\n            ignore_message: ::core::option::Option::None,\n            source_file: \"/checkout/tests/pretty/tests-are-sorted.rs\",\n            start_line: 14usize,\n            start_col: 4usize,\n            end_line: 14usize,\n            end_col: 10usize,\n            compile_fail: false,\n            no_run: false,\n            should_panic: test::ShouldPanic::No,\n            test_type: test::TestType::Unknown,\n        },\n        testfn: test::StaticTestFn(|| test::assert_test_result(a_test())),\n    };\nfn a_test() {}\n#[rustc_main]\npub fn main() -> () {\n    extern crate test;\n    test::test_main_static(&[&a_test, &m_test, &z_test])\n}\n\n------------------------------------------\nactual:\n------------------------------------------\n#![feature(prelude_import)]\n#![no_std]\n#[prelude_import]\nuse ::std::prelude::rust_2015::*;\n#[macro_use]\nextern crate std;\n// compile-flags: --crate-type=lib --test\n// pretty-compare-only\n// pretty-mode:expanded\n// pp-exact:tests-are-sorted.pp\n\nextern crate test;\n#[cfg(test)]\n#[rustc_test_marker = \"m_test\"]\npub const m_test: test::TestDescAndFn =\n    test::TestDescAndFn {\n        desc: test::TestDesc {\n            name: test::StaticTestName(\"m_test\"),\n            ignore: false,\n            ignore_message: ::core::option::Option::None,\n            source_file: \"/Users/runner/work/rust/rust/tests/pretty/tests-are-sorted.rs\",\n            start_line: 7usize,\n            start_col: 4usize,\n            end_line: 7usize,\n            end_col: 10usize,\n            compile_fail: false,\n            no_run: false,\n            should_panic: test::ShouldPanic::No,\n            test_type: test::TestType::Unknown,\n        },\n        testfn: test::StaticTestFn(|| test::assert_test_result(m_test())),\n    };\nfn m_test() {}\n\nextern crate test;\n#[cfg(test)]\n#[rustc_test_marker = \"z_test\"]\npub const z_test: test::TestDescAndFn =\n    test::TestDescAndFn {\n        desc: test::TestDesc {\n            name: test::StaticTestName(\"z_test\"),\n            ignore: true,\n            ignore_message: ::core::option::Option::Some(\"not yet implemented\"),\n            source_file: \"/Users/runner/work/rust/rust/tests/pretty/tests-are-sorted.rs\",\n            start_line: 11usize,\n            start_col: 4usize,\n            end_line: 11usize,\n            end_col: 10usize,\n            compile_fail: false,\n            no_run: false,\n            should_panic: test::ShouldPanic::No,\n            test_type: test::TestType::Unknown,\n        },\n        testfn: test::StaticTestFn(|| test::assert_test_result(z_test())),\n    };\n#[ignore = \"not yet implemented\"]\nfn z_test() {}\n\nextern crate test;\n#[cfg(test)]\n#[rustc_test_marker = \"a_test\"]\npub const a_test: test::TestDescAndFn =\n    test::TestDescAndFn {\n        desc: test::TestDesc {\n            name: test::StaticTestName(\"a_test\"),\n            ignore: false,\n            ignore_message: ::core::option::Option::None,\n            source_file: \"/Users/runner/work/rust/rust/tests/pretty/tests-are-sorted.rs\",\n            start_line: 14usize,\n            start_col: 4usize,\n            end_line: 14usize,\n            end_col: 10usize,\n            compile_fail: false,\n            no_run: false,\n            should_panic: test::ShouldPanic::No,\n            test_type: test::TestType::Unknown,\n        },\n        testfn: test::StaticTestFn(|| test::assert_test_result(a_test())),\n    };\nfn a_test() {}\n#[rustc_main]\npub fn main() -> () {\n    extern crate test;\n    test::test_main_static(&[&a_test, &m_test, &z_test])\n}\n\n------------------------------------------\ndiff:\n------------------------------------------\n18\t            name: test::StaticTestName(\"m_test\"),\n19\t            ignore: false,\n20\t            ignore_message: ::core::option::Option::None,\n-\t            source_file: \"/checkout/tests/pretty/tests-are-sorted.rs\",\n+\t            source_file: \"/Users/runner/work/rust/rust/tests/pretty/tests-are-sorted.rs\",\n22\t            start_line: 7usize,\n23\t            start_col: 4usize,\n24\t            end_line: 7usize,\n\n41\t            name: test::StaticTestName(\"z_test\"),\n42\t            ignore: true,\n43\t            ignore_message: ::core::option::Option::Some(\"not yet implemented\"),\n-\t            source_file: \"/checkout/tests/pretty/tests-are-sorted.rs\",\n+\t            source_file: \"/Users/runner/work/rust/rust/tests/pretty/tests-are-sorted.rs\",\n45\t            start_line: 11usize,\n46\t            start_col: 4usize,\n47\t            end_line: 11usize,\n\n65\t            name: test::StaticTestName(\"a_test\"),\n66\t            ignore: false,\n67\t            ignore_message: ::core::option::Option::None,\n-\t            source_file: \"/checkout/tests/pretty/tests-are-sorted.rs\",\n+\t            source_file: \"/Users/runner/work/rust/rust/tests/pretty/tests-are-sorted.rs\",\n69\t            start_line: 14usize,\n70\t            start_col: 4usize,\n71\t            end_line: 14usize,\n\n\n"
test [pretty] tests/pretty/use-tree.rs ... ok
test [pretty] tests/pretty/trait-safety.rs ... ok
test [pretty] tests/pretty/attr-derive.rs ... ok
test [pretty] tests/pretty/vec-comments.rs ... ok
---

error: pretty-printed source does not match expected source
expected:
------------------------------------------
#![feature(prelude_import)]
#![no_std]
#[prelude_import]
use ::std::prelude::rust_2015::*;
extern crate std;
// compile-flags: --crate-type=lib --test
// pretty-compare-only
// pretty-mode:expanded
// pretty-mode:expanded
// pp-exact:tests-are-sorted.pp
extern crate test;
#[cfg(test)]
#[cfg(test)]
#[rustc_test_marker = "m_test"]
pub const m_test: test::TestDescAndFn =
    test::TestDescAndFn {
        desc: test::TestDesc {
            name: test::StaticTestName("m_test"),
            ignore: false,
            ignore_message: ::core::option::Option::None,
            start_line: 7usize,
            start_col: 4usize,
            end_line: 7usize,
            end_col: 10usize,
            end_col: 10usize,
            compile_fail: false,
            no_run: false,
            should_panic: test::ShouldPanic::No,
            test_type: test::TestType::Unknown,
        },
        testfn: test::StaticTestFn(|| test::assert_test_result(m_test())),
fn m_test() {}

extern crate test;
#[cfg(test)]
#[cfg(test)]
#[rustc_test_marker = "z_test"]
pub const z_test: test::TestDescAndFn =
    test::TestDescAndFn {
        desc: test::TestDesc {
            name: test::StaticTestName("z_test"),
            ignore: true,
            ignore_message: ::core::option::Option::Some("not yet implemented"),
            start_line: 11usize,
            start_col: 4usize,
            end_line: 11usize,
            end_col: 10usize,
            end_col: 10usize,
            compile_fail: false,
            no_run: false,
            should_panic: test::ShouldPanic::No,
            test_type: test::TestType::Unknown,
        },
        testfn: test::StaticTestFn(|| test::assert_test_result(z_test())),
#[ignore = "not yet implemented"]
fn z_test() {}

extern crate test;
extern crate test;
#[cfg(test)]
#[rustc_test_marker = "a_test"]
pub const a_test: test::TestDescAndFn =
    test::TestDescAndFn {
        desc: test::TestDesc {
            name: test::StaticTestName("a_test"),
            ignore: false,
            ignore_message: ::core::option::Option::None,
            start_line: 14usize,
            start_col: 4usize,
            end_line: 14usize,
            end_col: 10usize,
            end_col: 10usize,
            compile_fail: false,
            no_run: false,
            should_panic: test::ShouldPanic::No,
            test_type: test::TestType::Unknown,
        },
        testfn: test::StaticTestFn(|| test::assert_test_result(a_test())),
fn a_test() {}
#[rustc_main]
pub fn main() -> () {
    extern crate test;
    extern crate test;
    test::test_main_static(&[&a_test, &m_test, &z_test])

------------------------------------------
actual:
------------------------------------------
------------------------------------------
#![feature(prelude_import)]
#![no_std]
#[prelude_import]
use ::std::prelude::rust_2015::*;
extern crate std;
// compile-flags: --crate-type=lib --test
// pretty-compare-only
// pretty-mode:expanded
// pretty-mode:expanded
// pp-exact:tests-are-sorted.pp
extern crate test;
#[cfg(test)]
#[cfg(test)]
#[rustc_test_marker = "m_test"]
pub const m_test: test::TestDescAndFn =
    test::TestDescAndFn {
        desc: test::TestDesc {
            name: test::StaticTestName("m_test"),
            ignore: false,
            ignore_message: ::core::option::Option::None,
            start_line: 7usize,
            start_col: 4usize,
            end_line: 7usize,
            end_col: 10usize,
            end_col: 10usize,
            compile_fail: false,
            no_run: false,
            should_panic: test::ShouldPanic::No,
            test_type: test::TestType::Unknown,
        },
        testfn: test::StaticTestFn(|| test::assert_test_result(m_test())),
fn m_test() {}

extern crate test;
#[cfg(test)]
#[cfg(test)]
#[rustc_test_marker = "z_test"]
pub const z_test: test::TestDescAndFn =
    test::TestDescAndFn {
        desc: test::TestDesc {
            name: test::StaticTestName("z_test"),
            ignore: true,
            ignore_message: ::core::option::Option::Some("not yet implemented"),
            start_line: 11usize,
            start_col: 4usize,
            end_line: 11usize,
            end_col: 10usize,
            end_col: 10usize,
            compile_fail: false,
            no_run: false,
            should_panic: test::ShouldPanic::No,
            test_type: test::TestType::Unknown,
        },
        testfn: test::StaticTestFn(|| test::assert_test_result(z_test())),
#[ignore = "not yet implemented"]
fn z_test() {}

extern crate test;
extern crate test;
#[cfg(test)]
#[rustc_test_marker = "a_test"]
pub const a_test: test::TestDescAndFn =
    test::TestDescAndFn {
        desc: test::TestDesc {
            name: test::StaticTestName("a_test"),
            ignore: false,
            ignore_message: ::core::option::Option::None,
            start_line: 14usize,
            start_col: 4usize,
            end_line: 14usize,
            end_col: 10usize,
            end_col: 10usize,
            compile_fail: false,
            no_run: false,
            should_panic: test::ShouldPanic::No,
            test_type: test::TestType::Unknown,
        },
        testfn: test::StaticTestFn(|| test::assert_test_result(a_test())),
fn a_test() {}
#[rustc_main]
pub fn main() -> () {
    extern crate test;
    extern crate test;
    test::test_main_static(&[&a_test, &m_test, &z_test])

------------------------------------------
diff:
------------------------------------------
------------------------------------------
18             name: test::StaticTestName("m_test"),
19             ignore: false,
20             ignore_message: ::core::option::Option::None,
+             source_file: "/Users/runner/work/rust/rust/tests/pretty/tests-are-sorted.rs",
22             start_line: 7usize,
23             start_col: 4usize,
24             end_line: 7usize,
24             end_line: 7usize,

41             name: test::StaticTestName("z_test"),
42             ignore: true,
43             ignore_message: ::core::option::Option::Some("not yet implemented"),
+             source_file: "/Users/runner/work/rust/rust/tests/pretty/tests-are-sorted.rs",
45             start_line: 11usize,
46             start_col: 4usize,
47             end_line: 11usize,
47             end_line: 11usize,

65             name: test::StaticTestName("a_test"),
66             ignore: false,
67             ignore_message: ::core::option::Option::None,
+             source_file: "/Users/runner/work/rust/rust/tests/pretty/tests-are-sorted.rs",
69             start_line: 14usize,
70             start_col: 4usize,
71             end_line: 14usize,

@matthiaskrgr matthiaskrgr deleted the rollup-egy22qb branch March 16, 2024 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc 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. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.