Skip to content

Add feature gate for view_types experiment#155939

Open
scrabsha wants to merge 1 commit intorust-lang:mainfrom
scrabsha:view-types/feature-gate
Open

Add feature gate for view_types experiment#155939
scrabsha wants to merge 1 commit intorust-lang:mainfrom
scrabsha:view-types/feature-gate

Conversation

@scrabsha
Copy link
Copy Markdown
Contributor

@scrabsha scrabsha commented Apr 28, 2026

Tracking issue: #155938

The goal of this feature is to experiment with the concept of view types: allowing the borrow checker to reason about borrows across function calls by having an syntax to express which fields of a struct are used by a function.

This will have the following limitations:

  • Usage of view types on pub or pub(...) functions is a hard error.
  • View groups are not considered at the moment.
  • Interaction with pattern types are not considered at the moment.

r? nikomatsakis

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 28, 2026
@scrabsha scrabsha mentioned this pull request Apr 28, 2026
8 tasks
@nikomatsakis
Copy link
Copy Markdown
Contributor

@rustbot label +I-lang-nominated

Hi y'all, I am starting up a lang-team experiment on view types as champion.

Also cc @rust-lang/types and @lqd in particular

@rustbot rustbot added the I-lang-nominated Nominated for discussion during a lang team meeting. label Apr 28, 2026
Copy link
Copy Markdown
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

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

Comment thread tests/ui/feature-gates/feature-gate-view-types.rs
@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 Apr 28, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 28, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@scrabsha scrabsha force-pushed the view-types/feature-gate branch from 711ae3e to d3992fa Compare April 28, 2026 21:57
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 28, 2026
Comment thread tests/ui/feature-gates/feature-gate-view-types.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

I-lang-nominated Nominated for discussion during a lang team meeting. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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.

4 participants