| Age | Commit message (Collapse) | Author | Lines |
|
Stabilize `let` bindings and destructuring in constants and const fn
r? @Centril
This PR stabilizes the following features in constants and `const` functions:
* irrefutable destructuring patterns (e.g. `const fn foo((x, y): (u8, u8)) { ... }`)
* `let` bindings (e.g. `let x = 1;`)
* mutable `let` bindings (e.g. `let mut x = 1;`)
* assignment (e.g. `x = y`) and assignment operator (e.g. `x += y`) expressions, even where the assignment target is a projection (e.g. a struct field or index operation like `x[3] = 42`)
* expression statements (e.g. `3;`)
This PR does explicitly *not* stabilize:
* mutable references (i.e. `&mut T`)
* dereferencing mutable references
* refutable patterns (e.g. `Some(x)`)
* operations on `UnsafeCell` types (as that would need raw pointers and mutable references and such, not because it is explicitly forbidden. We can't explicitly forbid it as such values are OK as long as they aren't mutated.)
* We are not stabilizing `let` bindings in constants that use `&&` and `||` short circuiting operations. These are treated as `&` and `|` inside `const` and `static` items right now. If we stopped treating them as `&` and `|` after stabilizing `let` bindings, we'd break code like `let mut x = false; false && { x = true; false };`. So to use `let` bindings in constants you need to change `&&` and `||` to `&` and `|` respectively.
|
|
|
|
Const-stabilize `const_int_ops` + `const_ip`
r? @oli-obk
## Note for relnotes: This PR includes https://github.com/rust-lang/rust/pull/57105.
I've added T-lang since this affects intrinsics and the operational semantics of Rust's `const fn` fragment.
## Stable APIs proposed for constification
+ `const_int_ops`:
+ `count_ones`
+ `count_zeros`
+ `leading_zeros`
+ `trailing_zeros`
+ `swap_bytes`
+ `from_be`
+ `from_le`
+ `to_be`
+ `to_le`
+ `const_ip`
+ `Ipv4Addr::new`
## Unstable APIs constified
+ `const_int_conversion`:
+ `reverse_bits`
|
|
|
|
|
|
|
|
Fix broken links to second edition TRPL.
Fixes https://github.com/rust-lang/rust/issues/57104.
Remove `second-edition/` from TRPL hyperlinks.
|
|
Fixes https://github.com/rust-lang/rust/issues/57104.
|
|
Replace "integral variable" with "integer" and replace
"floating-point variable" with "floating-point number" to make the
message less confusing.
|
|
|
|
Co-Authored-By: Dylan-DPC <dylan.dpc@gmail.com>
|
|
|
|
|
|
|
|
Stabilize min_const_unsafe_fn in 1.33
Fixes #55607
r? @oli-obk
|
|
Fix mutable references in `static mut`
fixes #56903
|
|
|
|
|
|
|
|
Update migrate warning wording.
This PR modifies the wording of the warning for backwards-incompatible changes in migrate mode. The warning messages are changed to be lowercase and not include line-breaks in order to be consistent with other compiler diagnostics.
|
|
Remove a wrong multiplier on relocation offset computation
r? @RalfJung
fixes #56800
|
|
This commit modifies the wording of the warning for
backwards-incompatible changes in migrate mode. The warning messages are
changed to be lowercase and not include line-breaks in order to be
consistent with other compiler diagnostics.
|
|
|
|
|
|
|
|
r=nikomatsakis
Less conservative uninhabitedness check
Extends the uninhabitedness check to structs, non-empty enums, tuples and arrays.
Pulled out of #47291 and #50262.
Fixes https://github.com/rust-lang/rust/issues/54586.
r? @nikomatsakis
|
|
Fix various aspects around `let` bindings inside const functions
* forbid `let` bindings in const contexts that use short circuiting operators
* harden analysis code against derefs of mutable references
Initially this PR was about stabilizing `let` bindings, but too many flaws were exposed that need some more testing on nightly
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rollup of 11 pull requests
Successful merges:
- #56315 (Rustdoc inline macro reexport)
- #56332 ([rustdoc] Specific crate search)
- #56362 (Stabilise exhaustive integer patterns)
- #56426 (libsyntax_pos: A few tweaks)
- #56441 (rustbuild: Fix issues with compiler docs)
- #56446 (pass the parameter environment to `traits::find_associated_item`)
- #56500 (cleanup: remove static lifetimes from consts)
- #56525 (Avoid extra copy and syscall in std::env::current_exe)
- #56528 (Remove unused dependency (rustc_lint -> rustc_mir))
- #56548 (Optimized string FromIterator + Extend impls)
- #56553 (Don't print the profiling summary to stdout when -Zprofile-json is set)
Failed merges:
r? @ghost
|
|
Allow calling `const unsafe fn` in `const fn` behind a feature gate
cc #55607
r? @Centril
|
|
r=nikomatsakis
Stabilise exhaustive integer patterns
This is dependent on the FCP for https://github.com/rust-lang/rfcs/pull/2591 being completed, but that should happen tomorrow, so there's little harm in opening this PR early.
Closes #50907.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|