Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose the Freeze trait again (unstably) and forbid implementing it manually #121501

Closed
wants to merge 652 commits into from

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Feb 23, 2024

cc #60715

This trait is useful for generic constants (associated consts of generic traits). See the test (tests/ui/associated-consts/freeze.rs) added in this PR for a usage example. The builtin Freeze trait is the only way to do it, users cannot work around this issue.

It's also a useful trait for building some very specific abstrations, as shown by the usage by the zerocopy crate: google/zerocopy#941

cc @RalfJung

r? libs-api

Open questions

  • naming: Could also have a name that contains Cell, as the trait signals the absence of UnsafeCell.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 23, 2024
@rust-log-analyzer

This comment has been minimized.

@oli-obk
Copy link
Contributor Author

oli-obk commented Feb 23, 2024

I broke github :( I already pushed to this branch, but it hasn't updated in two hours

@rustbot
Copy link
Collaborator

rustbot commented Feb 23, 2024

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo, @GuillaumeGomez

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Enselic and others added 18 commits February 24, 2024 16:18
In `auxiliary/sigpipe-utils.rs`, all we want to know is the current
`SIGPIPE` disposition. We should not change it. So use `libc::sigaction`
instead of `libc::signal`. That way we can also remove the code that
restores it.
This allows for Windows users to use miri-script without pain
Windows miri-script execution egronomics

This allows for Windows users to use miri-script without pain. As working on miri earlier I was doing
`.\miri-script\target\debug\miri-script.exe { install | build | ... }` which wasn't fun.
Add "cargo miri clean" command

My first reaction when my miri cache was messed up was to attempt run this, which obviously failed. This helps paper over platform differences and such.
compiletest: call cargo-miri directly rather than via 'cargo run'

Fixes rust-lang/miri#3297. Thanks to `@bjorn3` for figuring out the cause of this.

r? `@oli-obk`
Co-authored-by: Ben Kimock <kimockb@gmail.com>
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#121435 (Account for RPITIT in E0310 explicit lifetime constraint suggestion)
 - rust-lang#121490 (Rustdoc: include crate name in links for local primitives)
 - rust-lang#121520 (delay cloning of iterator items)
 - rust-lang#121522 (check that simd_insert/extract indices are in-bounds)
 - rust-lang#121531 (Ignore less tests in debug builds)
 - rust-lang#121539 (compiler/rustc_target/src/spec/base/apple/tests.rs: Avoid unnecessary large move)
 - rust-lang#121542 (update stdarch)

r? `@ghost`
`@rustbot` modify labels: rollup
…slice, r=Mark-Simulacrum

Add examples for some methods on slices

Adds some examples to some methods on slice.

`is_empty` didn't have an example for an empty slice, even though `str` and the collections all have one, so I added that in.

`first_mut` and `last_mut` didn't have an example for what happens when the slice is empty, whereas `first` and `last` do, so I added that too.
…wjasper

match lowering: Split off `test_candidates` into several functions and improve comments

The logic of `test_candidates` has three steps: pick a test, sort the candidates, and generate code for everything. So I split it off into three methods.

I also ended up reworking the comments that explain the algorithm. In particular I added detailed examples. I removed the digression about rust-lang#29740 because it's no longer relevant to how the code is structured today.

r? ``@matthewjasper``
…on, r=Mark-Simulacrum

Ignore compiletest test directive migration commits

Not sure if the corresponding bors commit need to be included as well, assuming not.
…-obk

promotion: don't promote int::MIN / -1

Looks like I entirely forgot about this case when adding the div-by-zero check, which was supposed to ensure that we never promote operations that can fail...
Cc rust-lang#80619

This is a breaking change, so needs a crater run.
r? ``@oli-obk``
Fix incorrect doc of ScopedJoinHandle::is_finished

Fixes the explanation how to use `is_finished` to achieve a non-blocking join. The updated version matches the documentation of the non-scoped JoinHandle::is_finished.
Forbid use of `extern "C-unwind"` inside standard library

Those libraries are build with `-C panic=unwind` and is expected to be linkable to `-C panic=abort` library. To ensure unsoundness compiler needs to prevent a `C-unwind` call to exist, as doing so may leak foreign exceptions into `-C panic=abort`.

r? ``@RalfJung``
@rustbot rustbot added O-hermit Operating System: Hermit O-SGX Target: SGX O-unix Operating system: Unix-like O-wasi Operating system: Wasi, Webassembly System Interface O-windows Operating system: Windows T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Feb 29, 2024
@rustbot

This comment was marked as resolved.

@oli-obk
Copy link
Contributor Author

oli-obk commented Feb 29, 2024

wtf, sorry everyone...

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Feb 29, 2024

triagebot.toml has been modified, there may have been changes to the review queue.

cc @davidtwco, @wesleywiser

Some changes occurred in engine.rs, potentially modifying the public API of ObligationCtxt.

cc @lcnr, @compiler-errors

@rustbot rustbot added has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 29, 2024
@rustbot
Copy link
Collaborator

rustbot commented Feb 29, 2024

@oli-obk
Copy link
Contributor Author

oli-obk commented Feb 29, 2024

At this point I have to assume that GitHub chokes on the emoji branch name. It takes 3h to accept a force push, and I am certain the branch is correctly based off master

@lnicola
Copy link
Member

lnicola commented Feb 29, 2024

You could also try filing a new one (with fewer than 1000 commits).

@oli-obk
Copy link
Contributor Author

oli-obk commented Mar 1, 2024

Yea, must be the emoji 💀

I opened #121840 at the same commit as this PR, and it works just fine ™️

@oli-obk oli-obk closed this Mar 1, 2024
jhpratt added a commit to jhpratt/rust that referenced this pull request Mar 10, 2024
Expose the Freeze trait again (unstably) and forbid implementing it manually

non-emoji version of rust-lang#121501

cc rust-lang#60715

This trait is useful for generic constants (associated consts of generic traits). See the test (`tests/ui/associated-consts/freeze.rs`) added in this PR for a usage example. The builtin `Freeze` trait is the only way to do it, users cannot work around this issue.

It's also a useful trait for building some very specific abstrations, as shown by the usage by the `zerocopy` crate: google/zerocopy#941

cc `@RalfJung`

T-lang signed off on reexposing this unstably: rust-lang#121501 (comment)
jhpratt added a commit to jhpratt/rust that referenced this pull request Mar 11, 2024
Expose the Freeze trait again (unstably) and forbid implementing it manually

non-emoji version of rust-lang#121501

cc rust-lang#60715

This trait is useful for generic constants (associated consts of generic traits). See the test (`tests/ui/associated-consts/freeze.rs`) added in this PR for a usage example. The builtin `Freeze` trait is the only way to do it, users cannot work around this issue.

It's also a useful trait for building some very specific abstrations, as shown by the usage by the `zerocopy` crate: google/zerocopy#941

cc ``@RalfJung``

T-lang signed off on reexposing this unstably: rust-lang#121501 (comment)
jhpratt added a commit to jhpratt/rust that referenced this pull request Mar 11, 2024
Expose the Freeze trait again (unstably) and forbid implementing it manually

non-emoji version of rust-lang#121501

cc rust-lang#60715

This trait is useful for generic constants (associated consts of generic traits). See the test (`tests/ui/associated-consts/freeze.rs`) added in this PR for a usage example. The builtin `Freeze` trait is the only way to do it, users cannot work around this issue.

It's also a useful trait for building some very specific abstrations, as shown by the usage by the `zerocopy` crate: google/zerocopy#941

cc ```@RalfJung```

T-lang signed off on reexposing this unstably: rust-lang#121501 (comment)
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 11, 2024
Rollup merge of rust-lang#121840 - oli-obk:freeze, r=dtolnay

Expose the Freeze trait again (unstably) and forbid implementing it manually

non-emoji version of rust-lang#121501

cc rust-lang#60715

This trait is useful for generic constants (associated consts of generic traits). See the test (`tests/ui/associated-consts/freeze.rs`) added in this PR for a usage example. The builtin `Freeze` trait is the only way to do it, users cannot work around this issue.

It's also a useful trait for building some very specific abstrations, as shown by the usage by the `zerocopy` crate: google/zerocopy#941

cc ```@RalfJung```

T-lang signed off on reexposing this unstably: rust-lang#121501 (comment)
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Mar 12, 2024
Expose the Freeze trait again (unstably) and forbid implementing it manually

non-emoji version of rust-lang/rust#121501

cc #60715

This trait is useful for generic constants (associated consts of generic traits). See the test (`tests/ui/associated-consts/freeze.rs`) added in this PR for a usage example. The builtin `Freeze` trait is the only way to do it, users cannot work around this issue.

It's also a useful trait for building some very specific abstrations, as shown by the usage by the `zerocopy` crate: google/zerocopy#941

cc ```@RalfJung```

T-lang signed off on reexposing this unstably: rust-lang/rust#121501 (comment)
bjorn3 pushed a commit to rust-lang/rustc_codegen_cranelift that referenced this pull request Mar 16, 2024
Expose the Freeze trait again (unstably) and forbid implementing it manually

non-emoji version of rust-lang/rust#121501

cc #60715

This trait is useful for generic constants (associated consts of generic traits). See the test (`tests/ui/associated-consts/freeze.rs`) added in this PR for a usage example. The builtin `Freeze` trait is the only way to do it, users cannot work around this issue.

It's also a useful trait for building some very specific abstrations, as shown by the usage by the `zerocopy` crate: google/zerocopy#941

cc ```@RalfJung```

T-lang signed off on reexposing this unstably: rust-lang/rust#121501 (comment)
GuillaumeGomez pushed a commit to GuillaumeGomez/rustc_codegen_gcc that referenced this pull request Mar 26, 2024
Expose the Freeze trait again (unstably) and forbid implementing it manually

non-emoji version of rust-lang/rust#121501

cc #60715

This trait is useful for generic constants (associated consts of generic traits). See the test (`tests/ui/associated-consts/freeze.rs`) added in this PR for a usage example. The builtin `Freeze` trait is the only way to do it, users cannot work around this issue.

It's also a useful trait for building some very specific abstrations, as shown by the usage by the `zerocopy` crate: google/zerocopy#941

cc ```@RalfJung```

T-lang signed off on reexposing this unstably: rust-lang/rust#121501 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-testsuite Area: The testsuite used to check the correctness of rustc A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic has-merge-commits PR has merge commits, merge with caution. O-hermit Operating System: Hermit O-SGX Target: SGX O-unix Operating system: Unix-like O-wasi Operating system: Wasi, Webassembly System Interface O-windows Operating system: Windows S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-lang Relevant to the language team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.