Skip to content

Conversation

compiler-errors
Copy link
Member

Fixes #101376

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 3, 2022
@rust-highfive
Copy link
Contributor

r? @fee1-dead

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 3, 2022
|
help: consider dereferencing the left-hand side of this operation
|
LL | *(&mut Foo) += ();
Copy link
Member Author

@compiler-errors compiler-errors Sep 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This suggestion may be a bit strange here in this minimized example, but it makes sense if &mut Foo is coming from a function argument or something.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, it looks like a function with a return type of &mut Foo can also trigger this ICE. foo() += ();

Comment on lines +1 to +19
use std::ops::AddAssign;
struct Foo;

impl AddAssign<()> for Foo {
fn add_assign(&mut self, _: ()) {}
}

impl AddAssign<()> for &mut Foo {
fn add_assign(&mut self, _: ()) {}
}

fn main() {
(&mut Foo) += ();
//~^ ERROR invalid left-hand side of assignment
//~| NOTE cannot assign to this expression
//~| HELP consider dereferencing the left-hand side of this operation
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please link this to #101376?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

|
help: consider dereferencing the left-hand side of this operation
|
LL | *(&mut Foo) += ();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, it looks like a function with a return type of &mut Foo can also trigger this ICE. foo() += ();

@fee1-dead
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Sep 4, 2022

📌 Commit 98f4b20 has been approved by fee1-dead

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 4, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 4, 2022
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#101322 (Fix internal doc link)
 - rust-lang#101385 (updated description of File struct in std::fs)
 - rust-lang#101388 (Don't delay invalid LHS bug unless it will be covered by an error in `check_overloaded_binop`)
 - rust-lang#101394 (Forbid mixing `System` with direct sytem allocator calls)
 - rust-lang#101397 (rustdoc: remove redundant mobile-sized `.source nav:not(.sidebar).sub`)
 - rust-lang#101401 (Make `char::is_lowercase` and `char::is_uppercase` const)
 - rust-lang#101407 (Remove duplicated test (superseeded by search-form-elements.goml))

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit dd35e2f into rust-lang:master Sep 4, 2022
@rustbot rustbot added this to the 1.65.0 milestone Sep 4, 2022
@compiler-errors compiler-errors deleted the issue-101376 branch November 2, 2022 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1425:13
5 participants