Skip to content

internal: Require rustc citation for analysis changes when using AI - #23233

Merged
ChayimFriedman2 merged 2 commits into
masterfrom
require-rustc-citation
Aug 26, 2026
Merged

internal: Require rustc citation for analysis changes when using AI#23233
ChayimFriedman2 merged 2 commits into
masterfrom
require-rustc-citation

Conversation

@ChayimFriedman2

Copy link
Copy Markdown
Contributor

As I asked on Zulip.

Do you think we should exempt maintainers from this? I have no problem with doing that (due to the higher trust), and I myself barely use AI at all, but treating maintainers differently might seem unfair to some.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 25, 2026
@ShoyuVanilla

Copy link
Copy Markdown
Member

I think we should impose it to maintainers as well, not only because the fairness but also b/c when we scrutinize the implementation status quo later on, it would be helpful to look into the cited rustc code with the exact revision as they change from time to time.

BTW, should we separate the new paragraph from This policy was adapted from uv's AI policy. part?

Comment thread AI_POLICY.md
Comment on lines +33 to +36
When using AI to author changes to *analysis* - the code responsible for analyzing Rust code and not for implementing IDE features, including
but not limited to: type inference, MIR, name resolution, macro expansion - generally anything in the crates `parser`, `mbe`, `hir-expand`, `hir-def`, `hir-ty`,
although there are exceptions; **including when using AI only to analyze bugs and not to write code**, you are required to include a citation
of the rustc code responsible for the change you did, along with an explanation of how your change follows from it in case this is not immediately clear.

@Veykril Veykril Aug 26, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

to be honest I fail to see how this is AI specific, if I make the change manually myself I'd assume I would need to back the change up with citations all the same?

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Like I said, it isn't AI specific; it's just that for human-authored changes I am more willing to do that myself (seeing this as part of my job as a reviewer), and that people are sending AI-generated PRs in too big volumes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In fact, I think we should move or duplicate this into our agents.md file as a hard rule. That will make the LLM dig into rustc sources immediately.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wanted to have a policy so I can require that from contributors; and this is the place from that. Putting this in AGENTS.md is helpful but not my goal.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yea, moving it is the wrong call sorry, duplicating would be beneficial though. Or frankly we should probably just hard link the policy in the agents file with read instructions to also force-feed it to the llm.

Comment thread AI_POLICY.md Outdated
Comment on lines +39 to +40
how to fix bugs in analysis without looking at the rustc code. When not using AI, the maintainers agree to take the responsibility to verify that
(although of course providing this information is still appreciated). When using AI, partially due to trusting it less (especially for new contributors)

@Veykril Veykril Aug 26, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I guess due to this, but that also confuses me. Authoring with AI does not free you from responsibility of the code change?

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That said, I follow now, but I think the wording of this paragraph should be touched up

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I welcome suggestions.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think I would just drop the

When not using AI, the maintainers agree to take the responsibility to verify that
(although of course providing this information is still appreciated). When using AI, partially due to trusting it less (especially for new contributors)
and partially due to the easiness and amount of the process when AI is used, we require the contributor to do that instead.

part altogether. I don't see a reason to justify this in the text. We just require the contributor to backup their AI generated claims.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

@ChayimFriedman2

Copy link
Copy Markdown
Contributor Author

BTW, should we separate the new paragraph from This policy was adapted from uv's AI policy. part?

We already made some changes from uv's policy, so maybe we should just drop it, or mention it only as inspiration?

@Veykril

Veykril commented Aug 26, 2026

Copy link
Copy Markdown
Member

Yea I think we can reword it as inspiration or so

@ChayimFriedman2

Copy link
Copy Markdown
Contributor Author

I think I've got enough agreements so merging.

@ChayimFriedman2
ChayimFriedman2 added this pull request to the merge queue Aug 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 26, 2026
@ChayimFriedman2
ChayimFriedman2 added this pull request to the merge queue Aug 26, 2026
Merged via the queue into master with commit 3003cfb Aug 26, 2026
19 checks passed
@ChayimFriedman2
ChayimFriedman2 deleted the require-rustc-citation branch August 26, 2026 09:20
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 26, 2026
Comment thread AI_POLICY.md
This policy was adapted from [uv's AI policy].
When using AI to author changes to *analysis* - the code responsible for analyzing Rust code and not for implementing IDE features, including
but not limited to: type inference, MIR, name resolution, macro expansion - generally anything in the crates `parser`, `mbe`, `hir-expand`, `hir-def`, `hir-ty`,
although there are exceptions; **including when using AI only to analyze bugs and not to write code**, you are required to include a citation

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm struggling slightly to parse this: does "exceptions" mean that sometimes those crates don't need references to rustc, or that analysing bugs with AI is an exception?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The former - some parts of those crates (e.g. import maps) actually implements IDE functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants