| Age | Commit message (Collapse) | Author | Lines |
|
Rollup of 7 pull requests
Successful merges:
- #108244 (Add test for semicolon recovery ICE)
- #108746 (Don't project to RPITIT that has no default value)
- #108764 (Tweaks to -Zdrop-tracking-mir)
- #108770 (Improve documentation and argument naming of some TyCtxt methods)
- #108773 (x fmt: Only check modified files locally)
- #108775 (Use the correct bound vars in return type suggestion.)
- #108776 (Make `x test tidy` less noisy)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Use `partial_cmp` to implement tuple `lt`/`le`/`ge`/`gt`
In today's implementation, `(A, B)::gt` contains calls to *both* `A::eq` *and* `A::gt`.
That's fine for primitives, but for things like `String`s it's kinda weird -- `(String, usize)::gt` has a call to both `bcmp` and `memcmp` (<https://rust.godbolt.org/z/7jbbPMesf>) because when `bcmp` says the `String`s aren't equal, it turns around and calls `memcmp` to find out which one's bigger.
This PR changes the implementation to instead implement `(A, …, C, Z)::gt` using `A::partial_cmp`, `…::partial_cmp`, `C::partial_cmp`, and `Z::gt`. (And analogously for `lt`, `le`, and `ge`.) That way expensive comparisons don't need to be repeated.
Technically this is an observable change on stable, so I've marked it `needs-fcp` + `T-libs-api` and will
r? rust-lang/libs-api
I'm hoping that this will be non-controversial, however, since it's very similar to the observable changes that were made to the derives (#81384 #98655) -- like those, this only changes behaviour if a type overrode behaviour in a way inconsistent with the rules for the various traits involved.
(The first commit here is #108156, adding the codegen test, which I used to make sure this doesn't regress behaviour for primitives.)
Zulip conversation about this change: <https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/.60.3E.60.20on.20Tuples/near/328392927>.
|
|
Use the correct bound vars in return type suggestion.
Fixes https://github.com/rust-lang/rust/issues/107860
|
|
Tweaks to -Zdrop-tracking-mir
Split from https://github.com/rust-lang/rust/pull/107421
3 commits: 1 diagnostic improvement and 2 ICEs.
|
|
compiler-errors:rpitit-dont-project-default-w-no-valu, r=cjgillot
Don't project to RPITIT that has no default value
Replicates this behavior, but for RPITIT projection logic (which currently is separate)
https://github.com/rust-lang/rust/blob/b1719530f44e3c8ec903f76020a52bd8764d5d10/compiler/rustc_trait_selection/src/traits/project.rs#L2105-L2115
Fixes #108738
|
|
Add test for semicolon recovery ICE
closes https://github.com/rust-lang/rust/issues/108242
|
|
|
|
compiler-errors:non_lifetime_binders-bad-copy-clone, r=jackh726
Don't ICE when encountering bound var in builtin copy/clone bounds
Fixes #108742
|
|
rustdoc-json: switch from HashMap to FxHashMap to fix non-determinism
Using `HashMap` in `rustdoc_json_types::Crate` were causing creating randomly ordered objects in the json doc files. Which might cause problems to people who are doing comparison on those files specially in CI pipelines. See https://github.com/rust-lang/rust/issues/103785#issuecomment-1307425590
This PR fixes that issue and extends the coverage of `tests/run-make/rustdoc-verify-output-files` testing ability.
|
|
|
|
|
|
Desugaring of drop and replace at MIR build
This commit desugars the drop and replace deriving from an
assignment at MIR build, avoiding the construction of the
`DropAndReplace` terminator (which will be removed in a following PR).
In order to retain the same error messages for replaces a new
`DesugaringKind::Replace` variant is introduced.
The changes in the borrowck are also useful for future work in moving drop elaboration
before borrowck, as no `DropAndReplace` would be present there anymore.
Notes on test diffs:
* `tests/ui/borrowck/issue-58776-borrowck-scans-children`: the assignment deriving from the desugaring kills the borrow.
* `tests/ui/async-await/async-fn-size-uninit-locals.rs`, `tests/mir-opt/issue_41110.test.ElaborateDrops.after.mir`, `tests/mir-opt/issue_41888.main.ElaborateDrops.after.mir`: drop elaboration generates (or reads from) a useless drop flag due to an issue with the dataflow analysis. Will be fixed independently by https://github.com/rust-lang/rust/pull/106430.
See https://github.com/rust-lang/rust/pull/104488 for more context
|
|
Signed-off-by: ozkanonur <work@onurozkan.dev>
|
|
rustdoc: Note in a type's layout/size if it is uninhabited
Closes #87008

|
|
rustdoc: function signature search with traits in `where` clause
## Before

## After

|
|
Properly colorize multi-part suggestions in the same line
Fix #108547.
|
|
|
|
|
|
|
|
|
|
r=notriddle
Rustdoc search: Emit an error for unclosed generic
Now, search like `a<` will error as it should (and as written in the eBNF).
r? `@notriddle`
|
|
Fix ICE: check if snippet is `)`
Fixes #107705
|
|
Fix #108547.
|
|
Rollup of 8 pull requests
Successful merges:
- #104549 (add -Zexport-executable-symbols to unstable book)
- #108292 (Label opaque type for 'captures lifetime' error message)
- #108540 (Add `Atomic*::from_ptr`)
- #108634 (Add link to component dashboard)
- #108647 (Remove dead pgo.sh file)
- #108678 (Use `Option::as_slice` where applicable)
- #108681 (Improve comments in `needs_process_obligation`.)
- #108688 (Match unmatched backticks in library/)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
|
|
Label opaque type for 'captures lifetime' error message
Providing more information may help make this somewhat opaque (lol) error message a bit clearer.
|
|
Match unmatched backticks in compiler/
Found with GNU grep:
```
grep -rEn '^(([^`]*`){2})*[^`]*`[^`]*$' compiler/ | rg -v '\s*[//]?.{1,2}```'
```
|
|
Clippy Fix array-size-threshold config deserialization error
Complementary PR to https://github.com/rust-lang/rust/pull/108673 in order to also get this into the **next** beta.
r? ``@Mark-Simulacrum``
|
|
Fix another ICE in `point_at_expr_source_of_inferred_type`
Types coming from method probes must only be investigated *structurally*, since they often contain escaping infer variables from generalization and autoderef. We already have a hack in this PR that erases variables from types, so just use that.
Fixes #108664
The note attached to this error is pretty bad:
```
here the type of `primes` is inferred to be `[_]`
```
But that's unrelated to the PR.
---
Side-note: This is a pretty easy to trigger beta regression, so I've nominated it. Alternatively, I'm slightly inclined to remove this code altogether until it can be reformulated to be more accurate and less ICEy.
|
|
r=petrochenkov
Deny capturing late-bound non-lifetime param in anon const
Introduce a new AnonConstBoundary so we can detect when we capture a late-bound non-lifetime param with `non_lifetime_binders` enabled.
In the future, we could technically do something like introduce an early-bound parameter on the anon const, and stick the late-bound param in its substs (kinda like how we turn late-bound lifetimes in opaques into early-bound ones). But for now, just deny it so we don't ICE.
Fixes #108191
|
|
|
|
|
|
This commit desugars the drop and replace deriving from an
assignment at MIR build, avoiding the construction of the
DropAndReplace terminator (which will be removed in a followign PR)
In order to retain the same error messages for replaces a new
DesugaringKind::Replace variant is introduced.
|
|
|
|
|
|
|
|
Feed queries on impl side for RPITITs when using lower_impl_trait_in_trait_to_assoc_ty
I've added a test for traits that were already working and what I think is probably the last bit of infrastructure work needed.
In following PRs I'm going to start adding things TDD style, tests and code that make it work.
r? `@compiler-errors`
|
|
Make `ExprKind` the first field in `thir::Expr`
This makes its `Debug` impl print it first which is useful, as it's the most important part when looking at an expr.
|
|
Put backtick content from rustdoc search errors into a <code> elements
Some screenshots of the result:



You can test it [here](https://rustdoc.crud.net/imperio/rustdoc-search-background/foo/index.html?search=%22).
r? ```@notriddle```
|
|
Explain compile-time vs run-time difference in env!() error message
This PR is clarifying error message of `env!()` based on this user question: https://users.rust-lang.org/t/environment-variable-out-dir-is-undefined/90067
It makes it clear that `env!()` is for env variables defined at compile-time. There's special-case help text for common Cargo build script variables.
I've also rearranged the code to avoid allocating error message on the happy path when the env var is defined.
|
|
r=WaffleLapkin
Point error span at Some constructor argument when trait resolution fails
This is a follow up to #108254 and #106477 which extends error span refinement to handle a case which I mistakenly believed was handled in #106477. The goal is to refine the error span depicted below:
```rs
trait Fancy {}
impl <T> Fancy for Option<T> where T: Iterator {}
fn want_fancy<F>(f: F) where F: Fancy {}
fn example() {
want_fancy(Some(5));
// (BEFORE) ^^^^^^^ `{integer}` is not an iterator
// (AFTER) ^ `{integer}` is not an iterator
}
```
I had used a (slightly more complex) example as an illustrative example in #108254 , but hadn't actually turned it into a test, because I had (incorrectly) believed at the time it was covered by existing behavior. It turns out that `Some` is slightly "special" in that it resolves differently from the other `enum` constructors I had tried, and therefore this test was actually broken.
I've now updated the tests to include this example, and fixed the code to correctly resolve the `Some` constructor so that the span of the error is reduced.
|
|
|
|
|
|
|
|
This makes its `Debug` impl print it first which is useful, as it's the
most important part when looking at an expr.
|
|
Revert stabilization of `#![feature(target_feature_11)]`
This reverts #99767 due to the presence of bugs #108645 and #108646.
cc `@joshtriplett`
cc tracking issue #69098
r? `@ghost`
|
|
Rollup of 5 pull requests
Successful merges:
- #108516 (Restrict `#[rustc_box]` to `Box::new` calls)
- #108575 (Erase **all** regions when probing for associated types on ambiguity in astconv)
- #108585 (Run compiler test suite in parallel on Fuchsia)
- #108606 (Add test case for mismatched open/close delims)
- #108609 (Highlight whole expression for E0599)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
This reverts commit b379d216eefaba083a0627b1724d73f99d4bdf5c.
|
|
|
|
Highlight whole expression for E0599
Fixes #108603
This adds a secondary label to highlight the whole expression leading to the error. It also prevents empty labels being recognised as 'unexpected' by compiletest - otherwise, tests with NOTE annotations would pick up empty labels.
`@rustbot` label +A-diagnostics
|