| Age | Commit message (Collapse) | Author | Lines |
|
(And added Ralf's suggested test.)
Added my own three-variant multi-variant as well.
|
|
|
|
|
|
Don't call `tcx.fn_sig` on closures
Fixes #68542
|
|
Ensure that we error when calling "const extern fn" with wrong convention
See #64926
|
|
Fixes #68542
|
|
See #64926
|
|
When encountering a multipart suggestion with spans belonging to
different contexts, skip that suggestion.
|
|
Filter and test predicates using `normalize_and_test_predicates` for const-prop
Fixes #68264
Previously, I attempted to use
`substitute_normalize_and_test_predicates` to detect unsatisfiable
bounds. Unfortunately, since const-prop runs in a generic environment
(we don't have any of the function's generic parameters substituted),
this could lead to cycle errors when attempting to normalize predicates.
This check is replaced with a more precise check. We now only call
`normalize_and_test_predicates` on predicates that have the possibility
of being proved unsatisfiable - that is, predicates that don't depend
on anything local to the function (e.g. generic parameters). This
ensures that we don't hit cycle errors when we normalize said
predicates, while still ensuring that we detect unsatisfiable
predicates.
I haven't been able to come up with a minimization of the Diesel issue - however, I've verified that it compiles successfully.
|
|
Fix some tests failing in `--pass check` mode
Warnings reported at codegen or linking time either have to be converted to errors (preferable), or the tests for them need to be marked with `// ignore-pass` (as a last resort).
https://github.com/rust-lang/rust/commit/ecd5852194f43511443f134aebf0462b58c8e197 turned them from errors to warnings, but that shouldn't be necessary because it's still clear from the `.stderr` output that the errors are lints and not hard-coded.
|
|
Remove real_drop_in_place
In https://github.com/rust-lang/rust/commit/af9b057156f610df3528a502c668cfed99ce8a1a, I added `real_drop_in_place` because Stacked Borrows at the time couldn't handle transmuting of mutable references to raw pointers and back. Stacked Borrows 2, however, doesn't have any issue with these transmutes, so it is time to remove this hack again.
|
|
|
|
Turn off const propagation of ref taking
Fixes #67529
Fixes #67640
Fixes #67641
Fixes #67862
r? @oli-obk
|
|
|
|
Do not ICE on malformed suggestion spans
Under the assumption that suggestions are by their very nature always "best effort", it is ok if we don't display them instead of having an ICE. The underlying issue of the malformed span being _created_ is left unaddressed.
Fix #67567.
r? @petrochenkov
|
|
|
|
|
|
|
|
|
|
|
|
Clean up some diagnostics by making them more consistent
In general:
- Diagnostic should start with a lowercase letter.
- Diagnostics should not end with a full stop.
- Ellipses contain three dots.
- Backticks should encode Rust code.
I also reworded a couple of messages to make them read more clearly.
It might be sensible to create a style guide for diagnostics, so these informal conventions are written down somewhere, after which we could audit the existing diagnostics.
r? @Centril
|
|
Promoteds can contain raw pointers, but these must still only point to immutable allocations
fixes #67601
r? @RalfJung
cc @wesleywiser in order to not change behaviour in this PR, const prop uses the constant rules for interning, but at least there's an explicit mode for it now that we can think about this in the future
|
|
Untangle ZST validation from integer validation and generalize it to all zsts
cc @RalfJung
r? @wesleywiser
|
|
r=matthewjasper,oli-obk
Don't run const propagation on items with inconsistent bounds
Fixes #67696
Using `#![feature(trivial_bounds)]`, it's possible to write functions
with unsatisfiable 'where' clauses, making them uncallable. However, the
user can act as if these 'where' clauses are true inside the body of the
function, leading to code that would normally be impossible to write.
Since const propgation can run even without any user-written calls to a
function, we need to explcitly check for these uncallable functions.
|
|
immutable allocations
|
|
|
|
unevaluated consts
which requires a lot of unnecessary work to evaluate them further down the line.
|
|
|
|
Fixes #67529
Fixes #67640
Fixes #67641
Fixes #67862
|
|
|
|
|
|
|
|
Promote references to constants instead of statics
r? @oli-obk
|
|
Don't require `allow_internal_unstable` unless `staged_api` is enabled.
#63770 changed `qualify_min_const_fn` to require `allow_internal_unstable` for *all* crates that used an unstable feature, regardless of whether `staged_api` was enabled or the `fn` that used that feature was stably const. In practice, this meant that every crate in the ecosystem that wanted to use nightly features added `#![feature(const_fn)]`, which skips `qualify_min_const_fn` entirely.
After this PR, crates that do not have `#![feature(staged_api)]` will only need to enable the feature they are interested in. For example, `#![feature(const_if_match)]` will be enough to enable `if` and `match` in constants. Crates with `staged_api` (e.g., `libstd`) require `#[allow_internal_unstable]` to be added to a function if it uses nightly features unless that function is also marked `#[rustc_const_unstable]`. This prevents proliferation of `#[allow_internal_unstable]` into functions that are not callable in a `const` context on stable.
r? @oli-obk (author of #63770)
cc @Centril
|
|
Clarify suggestion for E0013
Fixes https://github.com/rust-lang/rust/issues/68038.
|
|
This flag opts out of the min-const-fn checks entirely, which is usually
not what we want. The few cases where the flag is still necessary have
been annotated.
|
|
Unify output of "variant not found" errors
Fix #49566.
|
|
|
|
|
|
This also allows us to use the `const_eval` query again without causing cycles
|
|
|
|
expect `fn` after `const unsafe` / `const extern`
Fixes #68062
r? @estebank @petrochenkov
cc @Aaron1011
|
|
|
|
|
|
|
|
|
|
|
|
Introduce an option for disabling deduplication of diagnostics
With the intent of using it in UI tests (https://github.com/rust-lang/rust/pull/67122).
The option is boolean (`-Z deduplicate-diagnostics=yes/no`) and can be specified multiple times with later values overriding earlier values (`-Z deduplicate-diagnostics=no -Z deduplicate-diagnostics=yes` == `-Z deduplicate-diagnostics=yes`), so it can be set in a hierarchical way, e.g. UI testing infra may disable the deduplication by default with specific tests being able to enable it back.
|
|
|
|
Reverts part of #67676
|