about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2024-09-15Update cargoWeihang Lo-0/+0
2024-09-15Further clarificationMichael Howell-2/+5
2024-09-15Specify, more explicitly, the default behaviorMichael Howell-7/+6
2024-09-15Update src/rustdoc-internals/search.mdMichael Howell-1/+1
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2024-09-15Clean up misleading languageMichael Howell-3/+2
2024-09-15Minor wording improvementsMichael Howell-8/+7
2024-09-15Add docs for JS testsMichael Howell-1/+101
2024-09-15Rollup merge of #130342 - RalfJung:slice-idx-overflow, r=saethlinMatthias Krüger-31/+53
interpret, miri: fix dealing with overflow during slice indexing and allocation This is mostly to fix https://github.com/rust-lang/rust/issues/130284. I then realized we're using somewhat sketchy arguments for a similar multiplication in `copy`/`copy_nonoverlapping`/`write_bytes`, so I made them all share the same function that checks exactly the right thing. (The intrinsics would previously fail on allocations larger than `1 << 47` bytes... which are theoretically possible maybe? Anyway it seems conceptually wrong to use any other bound than `isize::MAX` here.)
2024-09-15Rollup merge of #130293 - gurry:130142-lint-level-issue, r=cjgillotMatthias Krüger-1/+9
Fix lint levels not getting overridden by attrs on `Stmt` nodes Fixes #130142. See comments on the issue for context. r? `@cjgillot`
2024-09-15Rollup merge of #130110 - onur-ozkan:configurable-dist-vendor, ↵Matthias Krüger-6/+15
r=Kobzol,Mark-Simulacrum make dist vendoring configurable Adds a new option `dist.vendor` which allows people to decide whether to vendor dependencies for their custom distribution tarball builds. Note that our builds will not be affected, as the default for this option is the same as the previous vendoring condition from bootstrap.
2024-09-15Rollup merge of #129828 - RalfJung:miri-data-race, r=saethlinMatthias Krüger-112/+483
miri: treat non-memory local variables properly for data race detection Fixes https://github.com/rust-lang/miri/issues/3242 Miri has an optimization where some local variables are not represented in memory until something forces them to be stored in memory (most notably, creating a pointer/reference to the local will do that). However, for a subsystem triggering on memory accesses -- such as the data race detector -- this means that the memory access seems to happen only when the local is moved to memory, instead of at the time that it actually happens. This can lead to UB reports in programs that do not actually have UB. This PR fixes that by adding machine hooks for reads and writes to such efficiently represented local variables. The data race system tracks those very similar to how it would track reads and writes to addressable memory, and when a local is moved to memory, the clocks get overwritten with the information stored for the local.
2024-09-15use early return for race_detecting() logicRalf Jung-156/+152
2024-09-15we can test more things on Solarish, and update its status in the READMERalf Jung-3/+3
2024-09-15test std::time APIs on FreeBSD and SolarishRalf Jung-7/+7
2024-09-15add Android pthread supportRalf Jung-7/+7
2024-09-15make pthread-threadname nicer with cfg-ifRalf Jung-18/+39
2024-09-15enable std::sync tests on SolarishRalf Jung-2/+2
2024-09-15move two tests to a better locationRalf Jung-0/+0
2024-09-15pthread: add FreeBSD, remove PTHREAD_MUTEX_NORMAL_FLAG hackRalf Jung-52/+43
On FreeBSD, DEFAULT maps to ERRORCK. This clashes with the existing PTHREAD_MUTEX_NORMAL_FLAG: hack so we replace it by a different hack that works better cross-platform. Also fix a case of "accidental early UB" in a UB test -- pthread_mutexattr_t must be initialized.
2024-09-15Rollup merge of #129195 - RalfJung:const-mut-refs, r=fee1-deadMatthias Krüger-33/+29
Stabilize `&mut` (and `*mut`) as well as `&Cell` (and `*const Cell`) in const This stabilizes `const_mut_refs` and `const_refs_to_cell`. That allows a bunch of new things in const contexts: - Mentioning `&mut` types - Creating `&mut` and `*mut` values - Creating `&T` and `*const T` values where `T` contains interior mutability - Dereferencing `&mut` and `*mut` values (both for reads and writes) The same rules as at runtime apply: mutating immutable data is UB. This includes mutation through pointers derived from shared references; the following is diagnosed with a hard error: ```rust #[allow(invalid_reference_casting)] const _: () = { let mut val = 15; let ptr = &val as *const i32 as *mut i32; unsafe { *ptr = 16; } }; ``` The main limitation that is enforced is that the final value of a const (or non-`mut` static) may not contain `&mut` values nor interior mutable `&` values. This is necessary because the memory those references point to becomes *read-only* when the constant is done computing, so (interior) mutable references to such memory would be pretty dangerous. We take a multi-layered approach here to ensuring no mutable references escape the initializer expression: - A static analysis rejects (interior) mutable references when the referee looks like it may outlive the current MIR body. - To be extra sure, this static check is complemented by a "safety net" of dynamic checks. ("Dynamic" in the sense of "running during/after const-evaluation, e.g. at runtime of this code" -- in contrast to "static" which works entirely by looking at the MIR without evaluating it.) - After the final value is computed, we do a type-driven traversal of the entire value, and if we find any `&mut` or interior-mutable `&` we error out. - However, the type-driven traversal cannot traverse `union` or raw pointers, so there is a second dynamic check where if the final value of the const contains any pointer that was not derived from a shared reference, we complain. This is currently a future-compat lint, but will become an ICE in #128543. On the off-chance that it's actually possible to trigger this lint on stable, I'd prefer if we could make it an ICE before stabilizing const_mut_refs, but it's not a hard blocker. This part of the "safety net" is only active for mutable references since with shared references, it has false positives. Altogether this should prevent people from leaking (interior) mutable references out of the const initializer. While updating the tests I learned that surprisingly, this code gets rejected: ```rust const _: Vec<i32> = { let mut x = Vec::<i32>::new(); //~ ERROR destructor of `Vec<i32>` cannot be evaluated at compile-time let r = &mut x; let y = x; y }; ``` The analysis that rejects destructors in `const` is very conservative when it sees an `&mut` being created to `x`, and then considers `x` to be always live. See [here](https://github.com/rust-lang/rust/issues/65394#issuecomment-541499219) for a longer explanation. `const_precise_live_drops` will solve this, so I consider this problem to be tracked by https://github.com/rust-lang/rust/issues/73255. Cc `@rust-lang/wg-const-eval` `@rust-lang/lang` Cc https://github.com/rust-lang/rust/issues/57349 Cc https://github.com/rust-lang/rust/issues/80384
2024-09-15add change entry for `dist.vendor`onur-ozkan-0/+5
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-09-15make dist vendoring configurableonur-ozkan-6/+10
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-09-15unix/sync: cleanupRalf Jung-81/+29
2024-09-15stabilize const_mut_refsRalf Jung-33/+29
2024-09-15also use compute_size_in_bytes for relevant multiplications in MiriRalf Jung-31/+53
2024-09-15Feed `GitInfo`s from `Config` to `Build`onur-ozkan-10/+31
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-09-15Rollup merge of #130370 - kpreid:patch-2, r=compiler-errorsStuart Cook-1/+0
unstable-book: `trait_upcasting` example should not have `#![allow(incomplete_features)]` Tracking issue: #65991 `trait_upcasting` is not currently an incomplete feature; therefore examples of its use do not require `#![allow(incomplete_features)]`.
2024-09-15Rollup merge of #130202 - onur-ozkan:force-ci-llvm-on-default-profiles, ↵Stuart Cook-2/+9
r=Mark-Simulacrum set `download-ci-llvm = true` by default on "library" and "tools" profiles It's very rare for developers to need to modify LLVM, so "if-unchanged" isn't a good default for "tools" and "library" profiles since it fetches the LLVM submodule to track changes.
2024-09-14Auto merge of #129753 - folkertdev:stabilize-const-extern-fn, r=RalfJungbors-122/+111
stabilize `const_extern_fn` closes https://github.com/rust-lang/rust/issues/64926 tracking issue: https://github.com/rust-lang/rust/issues/64926 reference PR: https://github.com/rust-lang/reference/pull/1596 ## Stabilizaton Report ### Summary Using `const extern "Rust"` and `const extern "C"` was already stabilized (since version 1.62.0, see https://github.com/rust-lang/rust/pull/95346). This PR stabilizes the other calling conventions: it is now possible to write `const unsafe extern "calling-convention" fn` and `const extern "calling-convention" fn` for any supported calling convention: ```rust const extern "C-unwind" fn foo1(val: u8) -> u8 { val + 1} const extern "stdcall" fn foo2(val: u8) -> u8 { val + 1} const unsafe extern "C-unwind" fn bar1(val: bool) -> bool { !val } const unsafe extern "stdcall" fn bar2(val: bool) -> bool { !val } ``` This can be used to const-ify an `extern fn`, or conversely, to make a `const fn` callable from external code. r? T-lang cc `@RalfJung`
2024-09-14`trait_upcasting` is not currently an incomplete feature.Kevin Reid-1/+0
2024-09-14Auto merge of #129974 - cuviper:ci-llvm-19, r=Mark-Simulacrumbors-0/+67
ci: add a runner for vanilla LLVM 19 Ubuntu 24.10 has `llvm-19` packages that we can start testing with. The `Dockerfile` is otherwise the same as the `llvm-18` runner.
2024-09-14Auto merge of #3884 - Mandragorian:detect_cond_move, r=RalfJungbors-57/+182
detect when pthread_cond_t is moved Closes #3749
2024-09-14detect when pthread_cond_t is movedKonstantinos Andrikopoulos-57/+182
Closes #3749
2024-09-14Rollup merge of #130294 - nnethercote:more-lifetimes, r=lcnrLeón Orell Valerian Liehr-2/+2
Lifetime cleanups The last commit is very opinionated, let's see how we go. r? `@oli-obk`
2024-09-14Rollup merge of #130268 - RalfJung:simd-shuffle-idx-vector, r=compiler-errorsLeón Orell Valerian Liehr-12/+1
simd_shuffle: require index argument to be a vector Remove some codegen hacks by forcing the SIMD shuffle `index` argument to be a vector, which means (thanks to https://github.com/rust-lang/rust/pull/128537) that it will automatically be passed as an immediate in LLVM. The only special-casing we still have is for the extra sanity-checks we add that ensure that the indices are all in-bounds. (And the GCC backend needs to do a bunch of work since the Rust intrinsic is modeled after what LLVM expects, which seems to be quite different from what GCC expects.) Fixes https://github.com/rust-lang/rust/issues/128738, see that issue for more context.
2024-09-14stabilize `const_extern_fn`Folkert de Vries-122/+111
2024-09-14don't warn about a missing change-id in CIbinarycat-3/+7
fixes 130352
2024-09-14simd_shuffle: require index argument to be a vectorRalf Jung-12/+1
2024-09-14Fix lint levels not getting overridden by attrs on `Stmt` nodesGurinder Singh-1/+9
2024-09-14Merge from rustcThe Miri Cronjob Bot-387/+524
2024-09-14Preparing for merge from rustcThe Miri Cronjob Bot-1/+1
2024-09-14simplify `Build::update_existing_submodule`onur-ozkan-5/+1
`Build::update_existing_submodule` is already doing the same thing.. Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-09-14Auto merge of #130332 - Zalathar:rollup-eq0qvvy, r=Zalatharbors-43/+57
Rollup of 5 pull requests Successful merges: - #130138 (bootstrap: Print more debug info when `find_initial_libdir` fails) - #130199 (Don't call closure_by_move_body_def_id on FnOnce async closures in MIR validation) - #130302 (add llvm-bitcode-linker and llvm-tools bins to ci-rustc's sysroot) - #130306 (avoid updating LLVM submodule during bootstrap unit tests) - #130317 (`ProjectionElem` and `UnOp`/`BinOp` dont need to be `PartialOrd`/`Ord`) r? `@ghost` `@rustbot` modify labels: rollup
2024-09-14Rollup merge of #130306 - onur-ozkan:avoid-submodule-updates-in-tests, r=KobzolStuart Cook-0/+2
avoid updating LLVM submodule during bootstrap unit tests To test this, make sure you don't have `src/llvm-project` fetched and then set `llvm.download-ci-llvm=true` and run `x test bootstrap`.
2024-09-14Rollup merge of #130302 - onur-ozkan:130040-with-fixes, r=KobzolStuart Cook-39/+47
add llvm-bitcode-linker and llvm-tools bins to ci-rustc's sysroot https://github.com/rust-lang/rust/pull/130040 is [reverted](https://github.com/rust-lang/rust/pull/130292) because adding component binaries directly to the dist tarball of the compiler caused conflicts (see https://github.com/rust-lang/rust/issues/130291 and https://github.com/rust-lang/rustup/issues/4019). This PR solves the original problem without touching the dist tarball. r? Kobzol
2024-09-14Rollup merge of #130138 - Zalathar:initial-libdir, r=albertlarsan68Stuart Cook-4/+8
bootstrap: Print more debug info when `find_initial_libdir` fails From looking at the failure messages printed by #129775, my hypothesis is that `rustc --print=sysroot` sometimes prints the wrong path when the rustc executable is hardlinked in multiple places, at least on my macOS system. However, currently I don't have any concrete evidence of this actually happening. This PR therefore expands on #129775 by printing even more information on failure (including the actual rustc path), in the hope that when the failure next occurs we can confirm or reject the hypothesis that `rustc --print=sysroot` is printing the wrong path.
2024-09-14Auto merge of #125419 - GuillaumeGomez:add-gcc-to-dist, r=Kobzolbors-42/+192
[bootstrap] Add support for building gcc and libgccjit As `@eholk` summarized below: > From my understanding, this change would add libgccjit as an optional component to the Rust distribution. This library is licensed under GPLv2 and currently we do not have any other components under that license so it would be a new license, and one that is generally more restrictive than the other licenses we use. It'll greatly improve the experience for anyone wanting to work on the GCC backend from the compiler. Should help with https://github.com/rust-lang/rust/issues/124172. Will unblock #124353. r? `@Kobzol`
2024-09-13Auto merge of #130121 - lolbinarycat:bootstrap-warn-old-upstream-worktree, ↵bors-25/+47
r=albertlarsan68 bootstrap: handle worktrees in warn_old_master_branch fixes #130111
2024-09-13Auto merge of #130312 - matthiaskrgr:rollup-ihwsc91, r=matthiaskrgrbors-6/+21
Rollup of 6 pull requests Successful merges: - #129320 (Fix crash when labeling arguments for call_once and friends) - #130266 (target: default to the medium code model on LoongArch targets) - #130297 (Dataflow cleanups) - #130299 (Add set_dcx to ParseSess) - #130301 (some fixes for clashing_extern_declarations lint) - #130305 (Clippy: consider msrv for const context for const_float_bits_conv) r? `@ghost` `@rustbot` modify labels: rollup
2024-09-13Rollup merge of #130305 - tspiteri:clippy-msrv-for-const_float_bits_conv, ↵Matthias Krüger-6/+21
r=flip1995 Clippy: consider msrv for const context for const_float_bits_conv When `const_float_bits_conv` was stabilized for 1.83.0, clippy lints started to be triggered in const context ignoring MSRV. This PR makes the lints trigger in const context only when the MSRV meets 1.83.0. Fixes https://github.com/rust-lang/rust-clippy/issues/13383.