rust/library
bors 743003b1a6 Auto merge of #132329 - compiler-errors:fn-and-destruct, r=lcnr
Implement `~const Destruct` effect goal in the new solver

This also fixed a subtle bug/limitation of the `NeedsConstDrop` check. Specifically, the "`Qualif`" API basically treats const drops as totally structural, even though dropping something that has an explicit `Drop` implementation cannot be structurally decomposed. For example:

```rust
#![feature(const_trait_impl)]

#[const_trait] trait Foo {
    fn foo();
}

struct Conditional<T: Foo>(T);

impl Foo for () {
    fn foo() {
        println!("uh oh");
    }
}

impl<T> const Drop for Conditional<T> where T: ~const Foo {
    fn drop(&mut self) {
        T::foo();
    }
}

const FOO: () = {
    let _ = Conditional(());
    //~^ This should error.
};

fn main() {}
```

In this example, when checking if the `Conditional(())` rvalue is const-drop, since `Conditional` has a const destructor, we would previously recurse into the `()` value and determine it has nothing to drop, which means that it is considered to *not* need a const drop -- even though dropping `Conditional(())` would mean evaluating the destructor which relies on that `T: const Foo` bound to hold!

This could be fixed alternatively by banning any const conditions on `const Drop` impls, but that really sucks -- that means that basically no *interesting* const drop impls could be written. We have the capability to totally and intuitively support the right behavior, which I've implemented here.
2024-11-23 02:03:50 +00:00
..
alloc Make PointerLike opt-in as a trait 2024-11-20 16:36:12 +00:00
backtrace@230570f2da Try latest backtrace 2024-08-29 12:13:19 -07:00
core Auto merge of #132329 - compiler-errors:fn-and-destruct, r=lcnr 2024-11-23 02:03:50 +00:00
panic_abort step cfg(bootstrap) 2024-07-28 14:46:29 -04:00
panic_unwind move strict provenance lints to new feature gate, remove old feature gates 2024-10-21 15:22:17 +01:00
portable-simd move strict provenance lints to new feature gate, remove old feature gates 2024-10-21 15:22:17 +01:00
proc_macro Add a new trait proc_macro::ToTokens 2024-10-27 03:17:05 +01:00
profiler_builtins Run cargo update and update licenses 2024-11-13 12:22:10 +00:00
rtstartup Let InstCombine remove Clone shims inside Clone shims 2024-07-25 15:14:42 -04:00
rustc-std-workspace-alloc
rustc-std-workspace-core update rustc-std-workspace crates 2024-11-04 07:45:15 +01:00
rustc-std-workspace-std
std Rollup merge of #133337 - ColinFinck:thread-scoped-fix-typo, r=joboet 2024-11-22 20:32:38 +08:00
stdarch@e5e00aab0a Bump stdarch to the latest master 2024-11-18 18:52:27 +01:00
sysroot Make profiler_builtins an optional dependency of sysroot, not std 2024-10-17 22:08:36 +11:00
test Update thread spawn hooks. 2024-11-19 18:54:20 +01:00
unwind move strict provenance lints to new feature gate, remove old feature gates 2024-10-21 15:22:17 +01:00
windows_targets Win: Add dbghelp to the list of import libraries 2024-09-06 21:21:49 +00:00
Cargo.lock Rollup merge of #131736 - hoodmane:emscripten-wasm-bigint, r=workingjubilee 2024-11-21 07:56:11 +01:00
Cargo.toml Auto merge of #129063 - the8472:cold-opt-size, r=Amanieu 2024-09-02 00:58:50 +00:00