| Age | Commit message (Collapse) | Author | Lines |
|
|
|
This reverts commit cb9467515b5a9b15aaa905683c6b4dd9e851056c, reversing
changes made to 57781b24c54f9548722927ba88c343ff28da94ce.
|
|
Don't suggest adding parentheses to call an inaccessible method.
Previously, code of this form would emit E0615 (attempt to use a method as a field), thus emphasizing the existence of private methods that the programmer probably does not care about. Now it ignores their existence instead, producing error E0609 (no field). The motivating example is:
```rust
let x = std::rc::Rc::new(());
x.inner;
```
which would previously mention the private method `Rc::inner()`, even though `Rc<T>` intentionally has no public methods so that it can be a transparent smart pointer for any `T`.
```rust
error[E0615]: attempted to take value of method `inner` on type `Rc<()>`
--> src/main.rs:3:3
|
3 | x.inner;
| ^^^^^ method, not a field
|
help: use parentheses to call the method
|
3 | x.inner();
| ++
```
With this change, it emits E0609 and no suggestion.
|
|
new solver: handle edge case of a recursion limit of 0
Apparently a recursion limit of 0 is possible/valid/useful/used/cute, the more you know 🌟 .
(It's somewhat interesting to me that the old solver seemingly handles this, and that the new solver currently requires a recursion limit of 2 here)
r? `@compiler-errors.`
Fixes #115351.
|
|
suggest removing `impl` in generic trait bound position
rustc already does this recovery in type param position (`<T: impl Trait>` -> `<T: Trait>`).
This PR also adds that suggestion in trait bound position (e.g. `where T: impl Trait` or `trait Trait { type Assoc: impl Trait; }`)
|
|
Make `get_return_block()` return `Some` only for HIR nodes in body
Fixes #114918
The issue occurred while compiling the following input:
```rust
fn uwu() -> [(); { () }] {
loop {}
}
```
It was caused by the code below trying to suggest a missing return type which resulted in a const eval cycle: https://github.com/rust-lang/rust/blob/1bd043098e05839afb557bd7a2858cb09a4054ca/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs#L68-L75
The root cause was `get_return_block()` returning an `Fn` node for a node in the return type (i.e. the second `()` in the return type `[(); { () }]` of the input) although it is supposed to do so only for nodes that lie in the body of the function and return `None` otherwise (at least as per my understanding).
The PR fixes the issue by fixing this behaviour of `get_return_block()`.
|
|
parser: not insert dummy field in struct
Fixes #114636
This PR eliminates the dummy field, initially introduced in #113999, thereby enabling unrestricted use of `ident.unwrap()`. A side effect of this action is that we can only report the error of the first macro invocation field within the struct node.
An alternative solution might be giving a virtual name to the macro, but it appears more complex.(https://github.com/rust-lang/rust/issues/114636#issuecomment-1670228715). Furthermore, if you think https://github.com/rust-lang/rust/issues/114636#issuecomment-1670228715 is a better solution, feel free to close this PR.
|
|
Fixes # 114918
|
|
Previously, the test code would emit E0615, thus revealing the existence
of private methods that the programmer probably does not care about.
Now it ignores their existence instead, producing error E0609 (no field).
The motivating example is:
```rust
let x = std::rc::Rc::new(());
x.inner;
```
which would previously mention the private method `Rc::inner()`, even
though `Rc<T>` intentionally has no public methods so that it can be a
transparent smart pointer for any `T`.
|
|
|
|
Add new interface to smir
Removes the boiler plate from `crate-info.rs`, and creates new interface for the smir.
Addressing https://github.com/rust-lang/project-stable-mir/issues/23
r? `@spastorino`
|
|
r=wesleywiser
tests: add test for #67992
Fixes #67992.
Just adding a regression test for this issue.
|
|
Don't ICE on layout computation failure
Fixes #111176 regression.
r? `@oli-obk`
|
|
|
|
Move tests
r? `@petrochenkov`
|
|
|
|
|
|
alignment
|
|
Use `preserve_mostcc` for `extern "rust-cold"`
As experimentation in #115242 has shown looks better than `coldcc`. Notably, clang exposes `preserve_most` (https://clang.llvm.org/docs/AttributeReference.html#preserve-most) but not `cold`, so this change should put us on a better-supported path.
And *don't* use a different convention for cold on Windows, because that actually ends up making things worse. (See comment in the code.)
cc tracking issue #97544
|
|
|
|
Rollup of 8 pull requests
Successful merges:
- #115164 (MIR validation: reject in-place argument/return for packed fields)
- #115240 (codegen_llvm/llvm_type: avoid matching on the Rust type)
- #115294 (More precisely detect cycle errors from type_of on opaque)
- #115310 (Document panic behavior across editions, and improve xrefs)
- #115311 (Revert "Suggest using `Arc` on `!Send`/`!Sync` types")
- #115317 (Devacationize oli-obk)
- #115319 (don't use SnapshotVec in Graph implementation, as it looks unused; use Vec instead)
- #115322 (Tweak output of `to_pretty_impl_header` involving only anon lifetimes)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
|
|
Make RPITITs capture all in-scope lifetimes
Much like #114616, this implements the lang team decision from this T-lang meeting on [opaque captures strategy moving forward](https://hackmd.io/sFaSIMJOQcuwCdnUvCxtuQ?view). This will be RFC'd soon, but given that RPITITs are a nightly feature, this shouldn't necessarily be blocked on that.
We unconditionally capture all lifetimes in RPITITs -- impl is not as simple as #114616, since we still need to duplicate RPIT lifetimes to make sure we reify any late-bound lifetimes in scope.
Closes #112194
|
|
Tweak output of `to_pretty_impl_header` involving only anon lifetimes
Do not print `impl<> Foo for &Bar`.
|
|
Revert "Suggest using `Arc` on `!Send`/`!Sync` types"
Closes https://github.com/rust-lang/rust/issues/114687. This is a clean revert of https://github.com/rust-lang/rust/pull/88936 + https://github.com/rust-lang/rust/pull/115210. The suggestion to Arc\<{Self}\> when Self does not implement Send is *always* wrong.
https://github.com/rust-lang/rust/pull/114842 is considering a way to make a more refined suggestion.
|
|
More precisely detect cycle errors from type_of on opaque
Not sure if this still needs work. Just putting it up for initial impressions, since it seems that a few people are frustrated with the increased error verbosity due to #113320.
Essentially we introduce a new sub-query for `type_of` specifically for opaques which returns a value that is able to distinguish "has errors" from "due to cycle recovery".
Fixes #115188
r? `@oli-obk`
|
|
Do not print `impl<> Foo for &Bar`.
|
|
add codegen test for the move before passing to nocapture, by shared-ref arg
This PR adds codegen test for https://github.com/rust-lang/rust/issues/107436#issuecomment-1685792517 (It seems like this works from llvm-16?)
Fixes #107436
|
|
Avoid duplicate `large_assignments` lints
By checking for overlapping spans.
This PR does the "reduce noisiness" task in #83518.
r? `@oli-obk` who added E-mentor and E-help-wanted and wrote the initial code.
(The fix itself is in https://github.com/rust-lang/rust/pull/114774/commits/dc82736677a134a1b52def496db111681c053e82. The two commits before that are just small refactorings.)
|
|
This reverts commit 9de1a472b68ed85f396b2e2cc79c3ef17584d6e1.
|
|
avoid triple-backtrace due to panic-during-cleanup
Supersedes https://github.com/rust-lang/rust/pull/115020
Cc https://github.com/rust-lang/rust/issues/114954
r? ``@Amanieu``
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Remove some wasm/emscripten ignores
I'm planning on landing a few PRs like this that remove ignores that aren't required. This just covers mir-opt and codegen tests.
|
|
add rustc_abi debugging attribute
This is the call ABI equivalent of `rustc_layout(debug)`.
Fixes https://github.com/rust-lang/rust/issues/115168
r? `@bjorn3`
|
|
Do not forget to pass DWARF fragment information to LLVM.
Fixes https://github.com/rust-lang/rust/issues/115113 for the rustc part
|
|
|
|
tests: Fix tests for LoongArch64
This PR fixes `lp64d abi` tests for LoongArch64.
|
|
coverage: Tidy up `run-coverage` tests in several small ways
Prior to #114875 (anonymized line numbers), these tests were very sensitive to lines being added/removed, since doing so would change the line numbers in every subsequent line of output. Therefore they ended up with a few small style issues that weren't worth the hassle of fixing.
Now that we can freely rearrange lines without needing to re-bless the entire output, we can tidy up the tests in various trivial ways.
|
|
As experimentation in 115242 has shown looks better than `coldcc`.
And *don't* use a different convention for cold on Windows, because that actually ends up making things worse.
cc tracking issue 97544
|
|
|
|
Point at type parameter that introduced unmet bound instead of full HIR node
```
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
--> $DIR/issue-87199.rs:18:15
|
LL | ref_arg::<[i32]>(&[5]);
| ^^^^^ doesn't have a size known at compile-time
```
instead of
```
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
--> $DIR/issue-87199.rs:18:22
|
LL | ref_arg::<[i32]>(&[5]);
| ---------------- ^^^^ doesn't have a size known at compile-time
| |
| required by a bound introduced by this call
```
------
```
error[E0277]: the trait bound `String: Copy` is not satisfied
--> $DIR/own-bound-span.rs:14:24
|
LL | let _: <S as D>::P<String>;
| ^^^^^^ the trait `Copy` is not implemented for `String`
|
note: required by a bound in `D::P`
--> $DIR/own-bound-span.rs:4:15
|
LL | type P<T: Copy>;
| ^^^^ required by this bound in `D::P`
```
instead of
```
error[E0277]: the trait bound `String: Copy` is not satisfied
--> $DIR/own-bound-span.rs:14:12
|
LL | let _: <S as D>::P<String>;
| ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
|
note: required by a bound in `D::P`
--> $DIR/own-bound-span.rs:4:15
|
LL | type P<T: Copy>;
| ^^^^ required by this bound in `D::P`
```
Fix #105306.
|
|
|
|
|
|
|
|
|