about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2023-05-06Always const-eval the gcd in `slice::align_to_offsets`Markus Everling-37/+6
2023-05-06Auto merge of #109421 - mhammerly:extern-force-option, r=petrochenkovbors-2/+78
Add `force` option for `--extern` flag When `--extern force:foo=libfoo.so` is passed to `rustc` and `foo` is not actually used in the crate, ~inject an `extern crate foo;` statement into the AST~ force it to be resolved anyway in `CrateLoader::postprocess()`. This allows you to, for instance, inject a `#[panic_handler]` implementation into a `#![no_std]` crate without modifying its source so that it can be built as a `dylib`. It may also be useful for `#![panic_runtime]` or `#[global_allocator]`/`#![default_lib_allocator]` implementations. My work previously involved integrating Rust into an existing C/C++ codebase which was built with Buck and shipped on, among other platforms, Android. When targeting Android, Buck builds all "native" code with shared linkage* so it can be loaded from Java/Kotlin. My project was not itself `#![no_std]`, but many of our dependencies were, and they would fail to build with shared linkage due to a lack of a panic handler. With this change, that project can add the new `force` option to the `std` dependency it already explicitly provides to every crate to solve this problem. *This is an oversimplification - Buck has a couple features for aggregating dependencies into larger shared libraries, but none that I think sustainably solve this problem. ~The AST injection happens after macro expansion around where we similarly inject a test harness and proc-macro harness. The resolver's list of actually-used extern flags is populated during macro expansion, and if any of our `--extern` arguments have the `force` option and weren't already used, we inject an `extern crate` statement for them. The injection logic was added in `rustc_builtin_macros` as that's where similar injections for tests, proc-macros, and std/core already live.~ (New contributor - grateful for feedback and guidance!)
2023-05-06Auto merge of #104872 - luqmana:packed-union-align, r=oli-obkbors-81/+397
Avoid alignment mismatch between ABI and layout for unions. Fixes #104802 Fixes #103634 r? `@eddyb` cc `@RalfJung`
2023-05-06Auto merge of #107129 - wesleywiser:musl_1.2_upgrade, r=petrochenkovbors-16/+7
Update the version of musl used on `*-linux-musl` targets to 1.2.3 Update the version of musl used on our Linux musl targets from 1.1.24 to 1.2.3 as proposed in rust-lang/compiler-team#572. musl 1.2.3 is the latest version of musl and supports the same range of Linux kernels as the 1.1 series. As such, it does not affect the minimum supported version of Linux for any of the musl targets. One of the major musl 1.2 features is support for [time64](https://musl.libc.org/time64.html). This support is both source and ABI compatible with programs built against musl 1.1 and so updating the musl version for these targets should not cause Rust programs to fail to run or compile (a [crater run](https://github.com/rust-lang/rust/pull/107129#issuecomment-1407196104) has been completed which demonstrates this for the `i686-unknown-linux-musl` target). Once this change reaches stable, the `libc` crate will then be able to [update their definitions to support 64-bit time](https://github.com/rust-lang/libc/pull/3068), matching the default musl 1.2 APIs exactly. Fixes #91178
2023-05-06Auto merge of #111271 - JohnTitor:rollup-t07qk1c, r=JohnTitorbors-387/+403
Rollup of 8 pull requests Successful merges: - #109677 (Stabilize raw-dylib, link_ordinal, import_name_type and -Cdlltool) - #110780 (rustdoc-search: add slices and arrays to index) - #110830 (Add FreeBSD cpuset support to `std::thread::available_concurrency`) - #111139 (Fix MXCSR configuration dependent timing) - #111239 (Remove unnecessary attribute from a diagnostic) - #111246 (forbid escaping bound vars in combine) - #111251 (Issue 109502 follow up, remove unnecessary Vec::new() from compile_test()) - #111261 (Mark `ErrorGuaranteed` constructor as deprecated so people don't use it) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-05-06Rollup merge of #111261 - ↵Yuki Okushi-16/+35
compiler-errors:error-guaranteed-should-be-scarier-to-construct, r=BoxyUwU Mark `ErrorGuaranteed` constructor as deprecated so people don't use it You should never ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever use this function unless you know what you're doing, so make it harder to accidentally use it! Alternatives are to change the name to sound scarier, make it `unsafe` (though it's not really a soundness thing), or work on deeper refactors to make it private. r? `@BoxyUwU`
2023-05-06Rollup merge of #111251 - mj10021:issue-109502-follow-up, r=oli-obkYuki Okushi-13/+21
Issue 109502 follow up, remove unnecessary Vec::new() from compile_test() As mentioned in comment on PR #110773 , adding a separate function to pass the test passes into the `dump-mir` is a bit nicer
2023-05-06Rollup merge of #111246 - lcnr:no-escaping-bound-vars, r=compiler-errorsYuki Okushi-131/+46
forbid escaping bound vars in combine removes the `CollectAllMismatches` in favor of a slightly more manual approach. r? types cc ``@estebank``
2023-05-06Rollup merge of #111239 - TaKO8Ki:fix-111232, r=compiler-errorsYuki Okushi-1/+22
Remove unnecessary attribute from a diagnostic Fixes #111232 ref: https://github.com/rust-lang/rust/commit/06ff310cf95349da078e4cac0c5377172766fa94
2023-05-06Rollup merge of #111139 - ↵Yuki Okushi-1/+5
fortanix:raoul/fix_mxcsr_configuration_dependent_timing, r=thomcc Fix MXCSR configuration dependent timing Dependent on the (potentially secret) data some vector instructions operate on, and the content in MXCSR, instruction retirement may be delayed by one cycle. This is a potential side channel. This PR fixes this vulnerability for the `x86_64-fortanix-unknown-sgx` platform by loading MXCSR with `0x1fbf` through an `xrstor` instruction when the enclave is entered and executing an `lfence` immediately after. Other changes of the MXCSR happen only when the enclave is about to be exited and no vector instructions will be executed before it will actually do so. Users of EDP who change the MXCSR and do wish to defend against this side channel, will need to implement the software mitigation described [here](https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/best-practices/mxcsr-configuration-dependent-timing.html). cc: `@jethrogb` `@monokles`
2023-05-06Rollup merge of #110830 - Freaky:freebsd-cpuset, r=thomccYuki Okushi-0/+19
Add FreeBSD cpuset support to `std::thread::available_concurrency` Use libc::cpuset_getaffinity to determine the CPUs available to the current process. The existing sysconf and sysctl paths are left as fallback.
2023-05-06Rollup merge of #110780 - notriddle:notriddle/slice-index, r=GuillaumeGomezYuki Okushi-2/+109
rustdoc-search: add slices and arrays to index This indexes them as primitives with generics, so `slice<u32>` is how you search for `[u32]`, and `array<u32>` for `[u32; 1]`. A future commit will desugar the square bracket syntax to search both arrays and slices at once.
2023-05-06Rollup merge of #109677 - dpaoliello:rawdylib, r=michaelwoerister,wesleywiserYuki Okushi-223/+146
Stabilize raw-dylib, link_ordinal, import_name_type and -Cdlltool This stabilizes the `raw-dylib` feature (#58713) for all architectures (i.e., `x86` as it is already stable for all other architectures). Changes: * Permit the use of the `raw-dylib` link kind for x86, the `link_ordinal` attribute and the `import_name_type` key for the `link` attribute. * Mark the `raw_dylib` feature as stable. * Stabilized the `-Zdlltool` argument as `-Cdlltool`. * Note the path to `dlltool` if invoking it failed (we don't need to do this if `dlltool` returns an error since it prints its path in the error message). * Adds tests for `-Cdlltool`. * Adds tests for being unable to find the dlltool executable, and dlltool failing. * Fixes a bug where we were checking the exit code of dlltool to see if it failed, but dlltool always returns 0 (indicating success), so instead we need to check if anything was written to `stderr`. NOTE: As previously noted (https://github.com/rust-lang/rust/pull/104218#issuecomment-1315895618) using dlltool within rustc is temporary, but this is not the first time that Rust has added a temporary tool use and argument: https://github.com/rust-lang/rust/pull/104218#issuecomment-1318720482 Big thanks to ``````@tbu-`````` for the first version of this PR (#104218)
2023-05-05Reorder to keep duplicate checks in sync.Luqman Aden-7/+12
2023-05-05Review feedbackLuqman Aden-14/+23
2023-05-05Don't discard preferred alignment in scalar pair.Luqman Aden-4/+2
2023-05-05Factor out checks in layout check and add helper inherent_size.Luqman Aden-55/+63
2023-05-05Add additional test case for repr(packed) allowing union abi opt to kick in.Luqman Aden-2/+33
2023-05-05Add test cases for #104802.Luqman Aden-11/+120
2023-05-05Incorporate review feedback from 103926.Luqman Aden-38/+33
2023-05-05Add helper methods inherent_align and to_union on Abi.Luqman Aden-1/+26
2023-05-05Do not use scalar layout if there are ZSTs with alignment > 1Oli Scherer-21/+157
2023-05-05Auto merge of #111255 - flip1995:clippyup, r=Manishearthbors-444/+2230
Update Clippy r? `@Manishearth`
2023-05-05add "force" option to --externMatt Hammerly-2/+78
2023-05-05add fn compile_test_with_passes()James Dietz-13/+21
2023-05-05Auto merge of #111258 - weihanglo:update-cargo, r=weihanglobors-0/+0
Update cargo 10 commits in ac84010322a31f4a581dafe26258aa4ac8dea9cd..569b648b5831ae8a515e90c80843a5287c3304ef 2023-05-02 13:41:16 +0000 to 2023-05-05 15:49:44 +0000 - xtask-unpublished: output a markdown table (rust-lang/cargo#12085) - fix: hack around `libsysroot` instead of `libtest` (rust-lang/cargo#12088) - Optimize usage under rustup. (rust-lang/cargo#11917) - Update lock to normalize `home` dep (rust-lang/cargo#12084) - fix: doc-test failures (rust-lang/cargo#12055) - feat(cargo-metadata): add `workspace_default_members` (rust-lang/cargo#11978) - doc: clarify implications of `cargo-yank` (rust-lang/cargo#11862) - chore: Use `[workspace.dependencies]` (rust-lang/cargo#12057) - support for shallow clones and fetches with `gitoxide` (rust-lang/cargo#11840) - Build by PackageIdSpec, not name, to avoid ambiguity (rust-lang/cargo#12015) r? `@ghost`
2023-05-05Mark `ErrorGuaranteed` constructor as deprecated so people don't use itMichael Goulet-16/+35
2023-05-05Update cargoWeihang Lo-0/+0
2023-05-05Auto merge of #111248 - Dylan-DPC:rollup-lbp0ui3, r=Dylan-DPCbors-524/+1164
Rollup of 6 pull requests Successful merges: - #103056 (Fix `checked_{add,sub}_duration` incorrectly returning `None` when `other` has more than `i64::MAX` seconds) - #108801 (Implement RFC 3348, `c"foo"` literals) - #110773 (Reduce MIR dump file count for MIR-opt tests) - #110876 (Added default target cpu to `--print target-cpus` output and updated docs) - #111068 (Improve check-cfg implementation) - #111238 (btree_map: `Cursor{,Mut}::peek_prev` must agree) Failed merges: - #110694 (Implement builtin # syntax and use it for offset_of!(...)) r? `@ghost` `@rustbot` modify labels: rollup
2023-05-05Update Cargo.lockPhilipp Krones-4/+4
2023-05-05Merge commit '371120bdbf58a331db5dcfb2d9cddc040f486de8' into clippyupPhilipp Krones-440/+2226
2023-05-05Auto merge of #10749 - flip1995:rustup, r=flip1995bors-227/+109
Rustup r? `@ghost` changelog: none
2023-05-05Bump nightly version -> 2023-05-05Philipp Krones-1/+1
2023-05-05Merge remote-tracking branch 'upstream/master' into rustupPhilipp Krones-434/+2212
2023-05-05Rollup merge of #111238 - workingjubilee:fix-btree-cursormut-peek-prev, ↵Dylan DPC-2/+21
r=Amanieu btree_map: `Cursor{,Mut}::peek_prev` must agree Our `Cursor::peek_prev` and `CursorMut::peek_prev` must agree on how to behave when they are called on the "null element". This will fix rust-lang#111228. r? `@Amanieu`
2023-05-05Rollup merge of #111068 - Urgau:check-cfg-improvements, r=petrochenkovDylan DPC-236/+420
Improve check-cfg implementation This PR makes multiple improvements into the implementation of check-cfg, it is a prerequisite to a follow-up PR that will introduce a simpler and more explicit syntax. The 2 main area of improvements are: 1. Internal representation of expected values: - now uses `FxHashSet<Option<Symbol>>` instead of `FxHashSet<Symbol>`, it made the no value expected case only possible when no values where in the `HashSet` which is now represented as `None` (same as cfg represent-it). - a enum with `Some` and `Any` makes it now clear if some values are expected or not, necessary for `feature` and `target_feature`. 2. Diagnostics: Improve the diagnostics in multiple case and fix case where a missing value could have had a new name suggestion instead of the value diagnostic; and some drive by improvements I highly recommend reviewing commit by commit. r? `@petrochenkov`
2023-05-05Rollup merge of #110876 - mj10021:issue-110647-fix, r=b-naberDylan DPC-7/+24
Added default target cpu to `--print target-cpus` output and updated docs Added default target cpu info as requested in issue #110647 and noted the new output in the documentation
2023-05-05Rollup merge of #110773 - mj10021:issue-109502-fix, r=oli-obkDylan DPC-102/+164
Reduce MIR dump file count for MIR-opt tests As referenced in issue #109502 , mir-opt tests previously used the -Zdump-mir=all flag, which generates very large output. This PR only dumps the passes under test, greatly reducing dump output.
2023-05-05Rollup merge of #108801 - fee1-dead-contrib:c-str, r=compiler-errorsDylan DPC-153/+500
Implement RFC 3348, `c"foo"` literals RFC: https://github.com/rust-lang/rfcs/pull/3348 Tracking issue: #105723
2023-05-05Rollup merge of #103056 - beetrees:timespec-bug-fix, r=thomccDylan DPC-24/+35
Fix `checked_{add,sub}_duration` incorrectly returning `None` when `other` has more than `i64::MAX` seconds Use `checked_{add,sub}_unsigned` in `checked_{add,sub}_duration` so that the correct result is returned when adding/subtracting durations with more than `i64::MAX` seconds.
2023-05-05Auto merge of #111113 - scottmcm:assume-align-offset, r=thomccbors-4/+89
`assume` the runtime range of `align_offset` Found when I saw code with `align_to` having extraneous checks. Demo that LLVM can't do this today: <https://rust.godbolt.org/z/6dnG749bq> (It's filed as https://github.com/llvm/llvm-project/issues/62502.)
2023-05-05Auto merge of #10747 - Alexendoo:cargo-dev-dogfood-stdout, r=flip1995bors-19/+19
Inherit stdout/stderr for `cargo dev dogfood` changelog: none Prints progress as it happens and in colour, and will also show anything printed to stderr
2023-05-05Inherit stdout/stderr for `cargo dev dogfood`Alex Macleod-19/+19
2023-05-05forbid escaping bound vars in combinelcnr-131/+46
removes the `CollectAllMismatches` in favor of a slightly more manual approach.
2023-05-05`assume` the runtime range of `align_offset`Scott McMurray-4/+89
Found when I saw code with `align_to` having extraneous checks.
2023-05-05Improve check-cfg diagnostics (part 2)Urgau-47/+192
2023-05-05Improve check-cfg diagnostics (part 1)Urgau-38/+40
2023-05-05Improve internal representation of check-cfgUrgau-153/+173
This is done to simplify to relationship between names() and values() but also make thing clearer (having an Any to represent that any values are allowed) but also to allow the (none) + values expected cases that wasn't possible before.
2023-05-05Use explicit instead of implicit control-flow for check-cfg parsingUrgau-23/+40
2023-05-05remove unnecessary attribute from a diagnosticTakayuki Maeda-1/+22