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

We should use a () constant instead of Rvalue::Aggregate(box AggregateKind::Tuple, vec![]). #70886

Closed
eddyb opened this issue Apr 7, 2020 · 1 comment · Fixed by #70891
Closed
Assignees
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@eddyb
Copy link
Member

eddyb commented Apr 7, 2020

This should be changed to return a () Operand::Const (not Rvalue::Use of that operand):

crate fn unit_rvalue(&mut self) -> Rvalue<'tcx> {
Rvalue::Aggregate(box AggregateKind::Tuple, vec![])
}

These two other places should switch to a () Rvalue::Use(Operand::Const(...)):

Rvalue::Aggregate(box AggregateKind::Tuple, vec![]),
let unit = Rvalue::Aggregate(box AggregateKind::Tuple, vec![]);

This issue has been assigned to @lcnr via this comment.

@eddyb eddyb added C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html labels Apr 7, 2020
@lcnr
Copy link
Contributor

lcnr commented Apr 7, 2020

@rustbot claim

@rustbot rustbot self-assigned this Apr 7, 2020
Centril added a commit to Centril/rust that referenced this issue Apr 15, 2020
unit rvalue, use constant `()` instead of tuple

fixes rust-lang#70886

r? @eddyb
@bors bors closed this as completed in 629e51b Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants