Skip to content

Conversation

@Human9000-bit
Copy link
Contributor

Fixes #150168

  • initial changes for mcga literals
  • rustfmt

r? @BoxyUwU

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jan 5, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 5, 2026

BoxyUwU is currently at their maximum review capacity.
They may take a while to respond.

@Human9000-bit
Copy link
Contributor Author

Human9000-bit commented Jan 5, 2026

rn this is very basic changes, lots of todo!() s
took me some time to figure out what to do

@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@BoxyUwU BoxyUwU left a comment

Choose a reason for hiding this comment

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

This is looking good already! You've touched pretty much everywhere that will be necessary for this change so it's only filling out these todo!s now :)

View changes since this review

ConstArgKind::Path(qpath) => visitor.visit_qpath(qpath, *hir_id, qpath.span()),
ConstArgKind::Anon(anon) => visitor.visit_anon_const(*anon),
ConstArgKind::Error(_, _) => V::Result::output(), // errors and spans are not important
ConstArgKind::Literal(_, _) => todo!(),
Copy link
Member

Choose a reason for hiding this comment

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

In theory we should be calling visitor.visit_lit here. I don't think we actually can right now though as lots of implementers of Visitor expect that visit_lit is only called on literals inside of function bodies.

For now I think you can return the default result with V::Result::output() and leave a // FIXME(mgca) to handle const arg literals in HIR visitors at some point

@Human9000-bit Human9000-bit marked this pull request as ready for review January 6, 2026 11:35
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 6, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 6, 2026

HIR ty lowering was modified

cc @fmease

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jan 6, 2026
@rustbot

This comment has been minimized.

@rustbot rustbot added the has-merge-commits PR has merge commits, merge with caution. label Jan 6, 2026
@Human9000-bit
Copy link
Contributor Author

too bad I have made a merge commit

@rust-log-analyzer

This comment has been minimized.

@Human9000-bit Human9000-bit force-pushed the literals-as-direct-const-args branch from acd1271 to 78149e6 Compare January 6, 2026 12:31
@rustbot

This comment has been minimized.

@rustbot rustbot removed the has-merge-commits PR has merge commits, merge with caution. label Jan 6, 2026
@Human9000-bit Human9000-bit marked this pull request as draft January 6, 2026 12:31
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 6, 2026
@Human9000-bit Human9000-bit force-pushed the literals-as-direct-const-args branch 2 times, most recently from d60c5dd to 37f084a Compare January 6, 2026 13:05
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@Human9000-bit Human9000-bit force-pushed the literals-as-direct-const-args branch from 28fc1a0 to fafe96e Compare January 8, 2026 15:21
@rustbot

This comment has been minimized.

@Human9000-bit Human9000-bit force-pushed the literals-as-direct-const-args branch from fafe96e to 1d10a8f Compare January 8, 2026 15:25
@rustbot
Copy link
Collaborator

rustbot commented Jan 8, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Human9000-bit
Copy link
Contributor Author

@BoxyUwU we are ready to merge

@Human9000-bit
Copy link
Contributor Author

Human9000-bit commented Jan 8, 2026

😅 I've noticed i named it MCGA instead of MGCA

@Human9000-bit Human9000-bit force-pushed the literals-as-direct-const-args branch from 1d10a8f to 9f3956f Compare January 8, 2026 15:29
@BoxyUwU
Copy link
Member

BoxyUwU commented Jan 8, 2026

@bors r+ rollup

there's definitely follow up work here:

  • negated literals (important for isize const generics)
  • lit_to_const is very ICEy on wrong types and we should have proper diagnostics

so if you're interested in doing more work here that'd be very cool :)

@rust-bors rust-bors bot 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 Jan 8, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 8, 2026

📌 Commit 9f3956f has been approved by BoxyUwU

It is now in the queue for this repository.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 8, 2026
…oxyUwU

MGCA: Support literals as direct const arguments

Fixes [rust-lang#150168](rust-lang#150618)

- **initial changes for mcga literals**
- **rustfmt**

r? @BoxyUwU
rust-bors bot added a commit that referenced this pull request Jan 8, 2026
Rollup of 12 pull requests

Successful merges:

 - #149961 (tidy: add if-installed prefix condition to extra checks system)
 - #150475 (std: sys: fs: uefi: Implement initial File)
 - #150533 (std: sys: fs: uefi: Implement remove_dir_all)
 - #150549 (fix missing_panics_doc in `std::os::fd::owned`)
 - #150699 (MGCA: Support literals as direct const arguments)
 - #150721 (Deprecated doc intra link)
 - #150752 (Update libc to v0.2.180)
 - #150802 (Minor cleanups to fn_abi_new_uncached)
 - #150803 (compiler-builtins subtree update)
 - #150809 (Update `literal-escaper` version to `0.0.7`)
 - #150811 (Store defids instead of symbol names in the aliases list)
 - #150825 (Query associated_item_def_ids when needed)

r? @ghost
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 8, 2026
…oxyUwU

MGCA: Support literals as direct const arguments

Fixes [rust-lang#150168](rust-lang#150618)

- **initial changes for mcga literals**
- **rustfmt**

r? @BoxyUwU
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 8, 2026
…oxyUwU

MGCA: Support literals as direct const arguments

Fixes [rust-lang#150168](rust-lang#150618)

- **initial changes for mcga literals**
- **rustfmt**

r? @BoxyUwU
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 8, 2026
…oxyUwU

MGCA: Support literals as direct const arguments

Fixes [rust-lang#150168](rust-lang#150618)

- **initial changes for mcga literals**
- **rustfmt**

r? @BoxyUwU
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 8, 2026
…oxyUwU

MGCA: Support literals as direct const arguments

Fixes [rust-lang#150168](rust-lang#150618)

- **initial changes for mcga literals**
- **rustfmt**

r? @BoxyUwU
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 8, 2026
…oxyUwU

MGCA: Support literals as direct const arguments

Fixes [rust-lang#150168](rust-lang#150618)

- **initial changes for mcga literals**
- **rustfmt**

r? @BoxyUwU
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 8, 2026
…oxyUwU

MGCA: Support literals as direct const arguments

Fixes [rust-lang#150168](rust-lang#150618)

- **initial changes for mcga literals**
- **rustfmt**

r? @BoxyUwU
rust-bors bot added a commit that referenced this pull request Jan 8, 2026
Rollup of 11 pull requests

Successful merges:

 - #149961 (tidy: add if-installed prefix condition to extra checks system)
 - #150475 (std: sys: fs: uefi: Implement initial File)
 - #150533 (std: sys: fs: uefi: Implement remove_dir_all)
 - #150549 (fix missing_panics_doc in `std::os::fd::owned`)
 - #150699 (MGCA: Support literals as direct const arguments)
 - #150721 (Deprecated doc intra link)
 - #150802 (Minor cleanups to fn_abi_new_uncached)
 - #150803 (compiler-builtins subtree update)
 - #150809 (Update `literal-escaper` version to `0.0.7`)
 - #150811 (Store defids instead of symbol names in the aliases list)
 - #150825 (Query associated_item_def_ids when needed)

r? @ghost
@rust-bors rust-bors bot merged commit cb3b2d8 into rust-lang:main Jan 9, 2026
11 checks passed
@rustbot rustbot added this to the 1.94.0 milestone Jan 9, 2026
rust-timer added a commit that referenced this pull request Jan 9, 2026
Rollup merge of #150699 - literals-as-direct-const-args, r=BoxyUwU

MGCA: Support literals as direct const arguments

Fixes [#150168](#150618)

- **initial changes for mcga literals**
- **rustfmt**

r? @BoxyUwU
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-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MGCA: Support literals as direct const arguments

5 participants