about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-08-20readdir_r shim: assume FreeBSD v12+Ralf Jung-10/+10
needs a libc version bump
2024-08-20Auto merge of #3828 - rust-lang:rustup-2024-08-20, r=RalfJungbors-10441/+12093
Automatic Rustup
2024-08-20Merge from rustcThe Miri Cronjob Bot-10440/+12092
2024-08-20Preparing for merge from rustcThe Miri Cronjob Bot-1/+1
2024-08-20Auto merge of #129226 - RalfJung:libc, r=Mark-Simulacrumbors-2/+2
library: bump libc dependency This pulls in https://github.com/rust-lang/libc/pull/3723, which hopefully unblocks https://github.com/rust-lang/miri/pull/3748.
2024-08-19Auto merge of #122551 - RayMuir:copy_fmt, r=saethlinbors-3924/+3926
Added "copy" to Debug fmt for copy operands In MIR's debug mode (--emit mir) the printing for Operands is slightly inconsistent. The RValues - values on the right side of an Assign - are usually printed with their Operand when they are Places. Example: _2 = move _3 But for arguments, the operand is omitted. _2 = _1 I propose a change be made, to display the place with the operand. _2 = copy _1 Move and copy have different semantics, meaning this difference is important and helpful to the user. It also adds consistency to the pretty printing. -- EDIT -- Consider this example Rust program and its MIR output with the **updated pretty printer.** This was generated with the arguments --emit mir --crate-type lib -Zmir-opt-level=0 (Otherwise, it's optimised away since it's a junk program). ```rust fn main(foo: i32) { let v = 10; if v == 20 { foo; } else { v; } } ``` ```MIR // WARNING: This output format is intended for human consumers only // and is subject to change without notice. Knock yourself out. fn main(_1: i32) -> () { debug foo => _1; let mut _0: (); let _2: i32; let mut _3: bool; let mut _4: i32; let _5: i32; let _6: i32; scope 1 { debug v => _2; } bb0: { StorageLive(_2); _2 = const 10_i32; StorageLive(_3); StorageLive(_4); _4 = copy _2; _3 = Eq(move _4, const 20_i32); switchInt(move _3) -> [0: bb2, otherwise: bb1]; } bb1: { StorageDead(_4); StorageLive(_5); _5 = copy _1; StorageDead(_5); _0 = const (); goto -> bb3; } bb2: { StorageDead(_4); StorageLive(_6); _6 = copy _2; StorageDead(_6); _0 = const (); goto -> bb3; } bb3: { StorageDead(_3); StorageDead(_2); return; } } ``` In this example program, we can see that when we move a place, it is preceded by "move". e.g. ``` _3 = Eq(move _4, const 20_i32);```. However, when we copy a place such as ```_5 = _1;```, it is not preceded by the operand in the original printout. I propose to change the print to include the copy ```_5 = copy _1``` as in this example. Regarding the arguments part. When I originally submitted this PR, I was under the impression this only affected the print for arguments to a function, but actually, it affects anything that uses a copy. This is preferable anyway with regard to consistency. The PR is about making ```copy``` explicit.
2024-08-19Auto merge of #129275 - matthiaskrgr:rollup-qv64hg6, r=matthiaskrgrbors-150/+746
Rollup of 6 pull requests Successful merges: - #129194 (Fix bootstrap test `detect_src_and_out` on Windows) - #129217 (safe transmute: check lifetimes) - #129223 ( Fix wrong argument for `get_fn_decl`) - #129235 (Check that `#[may_dangle]` is properly applied) - #129245 (Fix a typo in `rustc_hir` doc comment) - #129271 (Prevent double panic in query system, improve diagnostics) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-19Auto merge of #128588 - onur-ozkan:clean-up-bootstrap-internals, ↵bors-56/+52
r=albertlarsan68 bootstrap minor improvements and clean-ups 3rd commit fixes https://github.com/rust-lang/rust/issues/128553#issuecomment-2266119948.
2024-08-19Rollup merge of #129271 - futile:query-system/prevent-double-panic, ↵Matthias Krüger-4/+17
r=michaelwoerister Prevent double panic in query system, improve diagnostics I stumbled upon a double-panic in the query system while working on something else (#129102), which hid the real error cause for what I was debugging. This PR remedies that, so unwinding should be able to present more errors. It shouldn't really be relevant for code that doesn't ICE.
2024-08-19Rollup merge of #129245 - smoelius:patch-1, r=lqdMatthias Krüger-1/+1
Fix a typo in `rustc_hir` doc comment Fix a typo in a comment.
2024-08-19Rollup merge of #129235 - GoldsteinE:check-may-dangle, r=compiler-errorsMatthias Krüger-8/+142
Check that `#[may_dangle]` is properly applied It's only valid when applied to a type or lifetime parameter in `Drop` trait implementation. Tracking issue: https://github.com/rust-lang/rust/issues/34761 cc https://github.com/rust-lang/rust/issues/34761#issuecomment-1208185551
2024-08-19Rollup merge of #129223 - wafarm:fix-129215, r=compiler-errorsMatthias Krüger-3/+49
Fix wrong argument for `get_fn_decl` Closes #129215 (seems to be introduced in #129168)
2024-08-19Rollup merge of #129217 - jswrenn:transmute-lifetimes, r=compiler-errorsMatthias Krüger-132/+535
safe transmute: check lifetimes Modifies `BikeshedIntrinsicFrom` to forbid lifetime extensions on references. This static check can be opted out of with the `Assume::lifetimes` flag. Fixes #129097 Tracking Issue: https://github.com/rust-lang/rust/issues/99571 r​? `@compiler-errors`
2024-08-19Rollup merge of #129194 - ChrisDenton:detect-src, r=Mark-SimulacrumMatthias Krüger-2/+2
Fix bootstrap test `detect_src_and_out` on Windows Fixes #129188 by making sure it's properly testing the right path for the platform.
2024-08-19Prevent double panic in query system, improve diagnosticsFelix Rath-4/+17
2024-08-19Auto merge of #129218 - saethlin:gdb-supports-rust-now, r=jieyouxubors-2567/+1210
Delete debuginfo test suite infra for gdb without Rust support and lldb with Rust support Implements https://github.com/rust-lang/rust/issues/128953 I also deleted all the `min-lldb-version: 310` comments, because the oldest compatible distro I can find is Ubuntu 16.04 which ships lldb 3.8, though of course the package that the Ubuntu maintainers put together for that is broken. Rocky Linux 8 amusingly ships lldb 17, even though it has a similar glibc and kernel version. This PR is multiple highly mechanical changes. Some of the commits were created by just running `sed`. You may find it easier to review each commit separately.
2024-08-19Auto merge of #128722 - tgross35:new-resolver-root, r=Mark-Simulacrumbors-1933/+3437
Switch to using the v2 resolver in most workspaces Pinning the resolver to v1 was done in 5abff3753a7c ("Explicit set workspace.resolver ...") in order to suppress warnings. Since there is no specific reason not to use the new resolver and since it fixes issues, change to `resolver = "2"` everywhere except library.
2024-08-19library: bump libc dependencyRalf Jung-2/+2
2024-08-19Auto merge of #129261 - tgross35:rollup-xjbvqx7, r=tgross35bors-363/+381
Rollup of 7 pull requests Successful merges: - #127679 (Stabilize `raw_ref_op` (RFC 2582)) - #128084 (Suggest adding Result return type for associated method in E0277.) - #128628 (When deduplicating unreachable blocks, erase the source information.) - #128902 (doc: std::env::var: Returns None for names with '=' or NUL byte) - #129048 (Update `crosstool-ng` for loongarch64) - #129116 (Include a copy of `compiler-rt` source in the `download-ci-llvm` tarball) - #129208 (Fix order of normalization and recursion in const folding.) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-18Rollup merge of #129208 - veluca93:adt_const_fix, r=BoxyUwUTrevor Gross-4/+29
Fix order of normalization and recursion in const folding. Fixes #126831. Without this patch, type normalization is not always idempotent, which leads to all sorts of bugs in places that assume that normalizing a normalized type does nothing. Tracking issue: https://github.com/rust-lang/rust/issues/95174 r? BoxyUwU
2024-08-18Rollup merge of #129116 - Zalathar:compiler-rt, r=Mark-SimulacrumTrevor Gross-1/+14
Include a copy of `compiler-rt` source in the `download-ci-llvm` tarball This will make it possible to experiment with allowing `download-ci-llvm` builds to build `library/profiler_builtins`, without needing to check out the `src/llvm-project` submodule. By itself, this PR just adds the files to the tarball, but doesn't actually do anything with them. The idea is that once this is merged, it will then be much easier to proceed with work on the necessary bootstrap changes (using the real downloaded tarball), without having to rig up weird hacks to simulate downloading a modified tarball. --- Adding these files to the compressed tarballs appears to increase its size by a negligible amount (<1 MB out of 400/800+ MB). The uncompressed size is about 14 MB (out of 2+ GB for the whole tarball). (The excluded test files would have been another 35 MB.)
2024-08-18Rollup merge of #129048 - heiher:update-crosstool-loongarch64, r=Mark-SimulacrumTrevor Gross-7/+7
Update `crosstool-ng` for loongarch64 The current cross-compilation toolchain for the LoongArch64 target consists of GCC 13.2.0, Binutils 2.40, and Glibc 2.36. However, Binutils 2.40 has known issues that in broken binaries without any error reports: - https://github.com/rust-lang/rust/issues/121289 - https://github.com/cross-rs/cross/issues/1538 This patch upgrades the cross-compilation toolchain for the LoongArch64 target to resolve these issues. - GCC: 13.2.0 -> 14.2.0 - Binutils: 2.40 -> 2.42 The new binaries remain compatible with the existing GCC 13.2.0/Glibc 2.36 distribution, and no issues have been identified. try-job: dist-loongarch64-linux
2024-08-18Rollup merge of #128902 - evanj:evan.jones/env-var-doc, r=workingjubileeTrevor Gross-6/+5
doc: std::env::var: Returns None for names with '=' or NUL byte The documentation incorrectly stated that std::env::var could return an error for variable names containing '=' or the NUL byte. Copy the correct documentation from var_os. var_os was fixed in Commit 8a7a665, Pull Request #109894, which closed Issue #109893. This documentation was incorrectly added in commit f2c0f292, which replaced a panic in var_os by returning None, but documented the change as "May error if ...". Reference the specific error values and link to them.
2024-08-18Rollup merge of #128628 - khuey:simply-cfg-erase-source-info, r=nnethercoteTrevor Gross-0/+11
When deduplicating unreachable blocks, erase the source information. After deduplication the block conceptually belongs to multiple locations in the source. Although these blocks are unreachable, in #123341 we did come across a real side effect, an unreachable block that survives into the compiled code can cause a debugger to set a breakpoint on the wrong instruction. Erasing the source information ensures that a debugger will never be misled into thinking that the unreachable block is worth setting a breakpoint on, especially after #128627. Technically we don't need to erase the source information if all the deduplicated blocks have identical source information, but tracking that seems like more effort than it's worth. I'll let njn redirect this one too. r? `@nnethercote`
2024-08-18Rollup merge of #128084 - surechen:fix_125997_v1, r=cjgillotTrevor Gross-7/+111
Suggest adding Result return type for associated method in E0277. Recommit #126515 because I messed up during rebase, Suggest adding Result return type for associated method in E0277. For following: ```rust struct A; impl A { fn test4(&self) { let mut _file = File::create("foo.txt")?; //~^ ERROR the `?` operator can only be used in a method } ``` Suggest: ```rust impl A { fn test4(&self) -> Result<(), Box<dyn std::error::Error>> { let mut _file = File::create("foo.txt")?; //~^ ERROR the `?` operator can only be used in a method Ok(()) } } ``` For #125997 r? `@cjgillot`
2024-08-18Rollup merge of #127679 - RalfJung:raw_ref_op, r=jieyouxuTrevor Gross-338/+204
Stabilize `raw_ref_op` (RFC 2582) This stabilizes the syntax `&raw const $expr` and `&raw mut $expr`. It has existed unstably for ~4 years now, and has been exposed on stable via the `addr_of` and `addr_of_mut` macros since Rust 1.51 (released more than 3 years ago). I think it has become clear that these operations are here to stay. So it is about time we give them proper primitive syntax. This has two advantages over the macro: - Being macros, `addr_of`/`addr_of_mut` could in theory do arbitrary magic with the expression on which they work. The only "magic" they actually do is using the argument as a place expression rather than as a value expression. Place expressions are already a subtle topic and poorly understood by many programmers; having this hidden behind a macro using unstable language features makes this even worse. Conversely, people do have an idea of what happens below `&`/`&mut`, so we can make the subtle topic a lot more approachable by connecting to existing intuition. - The name `addr_of` is quite unfortunate from today's perspective, given that we have accepted provenance as a reality, which means that a pointer is *not* just an address. Strict provenance has a method, `addr`, which extracts the address of a pointer; using the term `addr` in two different ways is quite unfortunate. That's why this PR soft-deprecates `addr_of` -- we will wait a long time before actually showing any warning here, but we should start telling people that the "addr" part of this name is somewhat misleading, and `&raw` avoids that potential confusion. In summary, this syntax improves developers' ability to conceptualize the operational semantics of Rust, while making a fundamental operation frequently used in unsafe code feel properly built in. Possible questions to consider, based on the RFC and [this](https://github.com/rust-lang/rust/issues/64490#issuecomment-1163802912) great summary by `@CAD97:` - Some questions are entirely about the semantics. The semantics are the same as with the macros so I don't think this should have any impact on this syntax PR. Still, for completeness' sake: - Should `&raw const *mut_ref` give a read-only pointer? - Tracked at: https://github.com/rust-lang/unsafe-code-guidelines/issues/257 - I think ideally the answer is "no". Stacked Borrows says that pointer is read-only, but Tree Borrows says it is mutable. - What exactly does `&raw const (*ptr).field` require? Answered in [the reference](https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html): the arithmetic to compute the field offset follows the rules of `ptr::offset`, making it UB if it goes out-of-bounds. Making this a safe operation (using `wrapping_offset` rules) is considered too much of a loss for alias analysis. - Choose a different syntax? I don't want to re-litigate the RFC. The only credible alternative that has been proposed is `&raw $place` instead of `&raw const $place`, which (IIUC) could be achieved by making `raw` a contextual keyword in a new edition. The type is named `*const T`, so the explicit `const` is consistent in that regard. `&raw expr` lacks the explicit indication of immutability. However, `&raw const expr` is quite a but longer than `addr_of!(expr)`. - Shouldn't we have a completely new, better raw pointer type instead? Yes we all want to see that happen -- but I don't think we should block stabilization on that, given that such a nicer type is not on the horizon currently and given the issues with `addr_of!` mentioned above. (If we keep the `&raw $place` syntax free for this, we could use it in the future for that new type.) - What about the lint the RFC talked about? It hasn't been implemented yet. Given that the problematic code is UB with or without this stabilization, I don't think the lack of the lint should block stabilization. - I created an issue to track adding it: https://github.com/rust-lang/rust/issues/127724 - Other points from the "future possibilites of the RFC - "Syntactic sugar" extension: this has not been implemented. I'd argue this is too confusing, we should stick to what the RFC suggested and if we want to do anything about such expressions, add the lint. - Encouraging / requiring `&raw` in situations where references are often/definitely incorrect: this has been / is being implemented. On packed fields this already is a hard error, and for `static mut` a lint suggesting raw pointers is being rolled out. - Lowering of casts: this has been implemented. (It's also an invisible implementation detail.) - `offsetof` woes: we now have native `offset_of` so this is not relevant any more. To be done before landing: - [x] Suppress `unused_parens` lint around `&raw {const|mut}` expressions - See bottom of https://github.com/rust-lang/rust/pull/127679#issuecomment-2264073752 for rationale - Implementation: https://github.com/rust-lang/rust/pull/128782 - [ ] Update the Reference. - https://github.com/rust-lang/reference/pull/1567 Fixes https://github.com/rust-lang/rust/issues/64490 cc `@rust-lang/lang` `@rust-lang/opsem` try-job: x86_64-msvc try-job: test-various try-job: dist-various-1 try-job: armhf-gnu try-job: aarch64-apple
2024-08-18Generate completions after version updatesTrevor Gross-1471/+2988
Running `cargo update` changed completion output. Regenerate them here.
2024-08-18Adjust expected errors for a `rustdoc` testTrevor Gross-22/+5
`pulldown-cmark` has slightly different behavior between 0.11.0 and 0.11.2, causing one of the `unportable-markdown` tests to no longer emit an error. Per [1], remove the error annotation and bless the output. [1]: https://github.com/rust-lang/rust/pull/128722#issuecomment-2295522292
2024-08-19Fix wrong argument for `get_fn_decl`Wafarm-3/+49
2024-08-19Auto merge of #129228 - matthiaskrgr:oopsie, r=jieyouxubors-0/+98
crashes: more tests r? `@jieyouxu`
2024-08-18Exclude the copy blessing from git blameScott McMurray-0/+2
2024-08-18Bless *all* the mir-opt testsScott McMurray-3567/+3567
2024-08-18Update mir-opt filechecksScott McMurray-356/+356
2024-08-19crashes: more testsMatthias Krüger-0/+98
2024-08-18Auto merge of #125854 - beetrees:zst-arg-abi, r=estebankbors-43/+766
Move ZST ABI handling to `rustc_target` Currently, target specific handling of ZST function call ABI (specifically passing them indirectly instead of ignoring them) is handled in `rustc_ty_utils`, whereas all other target specific function call ABI handling is located in `rustc_target`. This PR moves the ZST handling to `rustc_target` so that all the target-specific function call ABI handling is in one place. In the process of doing so, this PR fixes #125850 by ensuring that ZST arguments are always correctly ignored in the x86-64 `"sysv64"` ABI; any code which would be affected by this fix would have ICEd before this PR. Tests are also added using `#[rustc_abi(debug)]` to ensure this behaviour does not regress. Fixes #125850
2024-08-18Fixup testsBen Kimock-13/+13
2024-08-18Added "copy" to Debug fmt for copy operandsRayMuir-1/+1
2024-08-18Convert lldbg- to lldb-Ben Kimock-716/+716
2024-08-18Delete lldbr annotationsBen Kimock-677/+0
2024-08-18Delete min-lldb-version: 310Ben Kimock-158/+2
2024-08-18Clean up compiletestBen Kimock-59/+19
2024-08-18Delete redundant gdb-version requirements and related commentsBen Kimock-47/+0
2024-08-18Grep for enabled and clean up those hitsBen Kimock-22/+0
2024-08-18Adjust licensing exceptions for WASM componentsTrevor Gross-7/+1
Recent versions of wasm-tools are now Apache-2.0 or MIT or Apache-2.0 with the LLVM exception, rather than strictly Apache-2.0 with the LLVM exception. The only component with the exception has moved to a new dependency `wasi-preview1-component-adapter-provider`.
2024-08-18Run `cargo update` with the new v2 resolverTrevor Gross-427/+437
v2 resolves some dependencies differently, and we adjusted some dependency versions. Run `cargo update` to make sure everything is in sync.
2024-08-18Update some dependency versions that allow better licensingTrevor Gross-4/+4
With the new resolver, a few dependencies get brought in twice with different licenses. For example, all dependencies from `wasm-tools` gained Apache-2.0 and MIT options, and with the v2 resolver we were using one version from before and one version from after this change. This made tidy's license check difficult. Update some minimum versions to remove duplicate dependencies and smooth out license checking.
2024-08-18Switch to using the v2 resolver in most workspacesTrevor Gross-2/+2
Pinning the resolver to v1 was done in 5abff3753a7c ("Explicit set workspace.resolver ...") in order to suppress warnings. Since there is no specific reason not to use the new resolver and since it fixes issues, change to `resolver = "2"` everywhere except library and submodules.
2024-08-18safe transmute: forbid reference lifetime extensionJack Wrenn-132/+535
Modifies `BikeshedIntrinsicFrom` to forbid lifetime extensions on references. This static check can be opted out of with the `Assume::lifetimes` flag. Fixes #129097
2024-08-18rename AddressOf -> RawBorrow inside the compilerRalf Jung-92/+92
2024-08-18soft-deprecate the addr_of macrosRalf Jung-0/+6