---
title: "Call for testing: Restricting trait implementability and field mutability"
url: https://daily.dev/posts/call-for-testing-restricting-trait-implementability-and-field-mutability-zncakna0d
source_url: https://blog.rust-lang.org/inside-rust/2026/08/10/call-for-testing-impl-and-mut-restrictions
type: article
source: "Inside Rust Blog"
published: 2026-08-10T10:44:09.960Z
updated: 2026-08-10T10:44:37.834Z
tags: ["rust"]
reading_time: 5
upvotes: 13
comments: 1
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Call for testing: Restricting trait implementability and field mutability

**[Inside Rust Blog](https://daily.dev/sources/insiderustblog)** · 5 min read · 13 upvotes · 1 comments

## Summary

RFC 3323 'Restrictions' is now available for testing on nightly Rust, introducing two new features: `impl_restriction` and `mut_restriction`. The `impl_restriction` feature lets library authors explicitly restrict which scopes can implement a trait (e.g., `pub impl(crate) trait Foo`), replacing the verbose sealed trait pattern with a concise, compiler-enforced alternative. The `mut_restriction` feature allows struct fields to be publicly readable but only mutable within a specified scope (e.g., `pub mut(crate) alpha: u8`), enabling invariant preservation without getter methods and working better with the borrow checker's field-level tracking. Both features produce clear compiler error messages when restrictions are violated. Struct expressions are also disallowed when any field has a mut-restriction that prevents mutation from the current scope. Developers are invited to test these features on the latest nightly and share feedback in the dedicated GitHub issue, with syntax still open for discussion.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.rust-lang.org/inside-rust/2026/08/10/call-for-testing-impl-and-mut-restrictions>

## Questions this post answers

### What is the impl_restriction feature in Rust and how does it replace the sealed trait pattern?

The `impl_restriction` feature (RFC 3323) lets you write `pub impl(crate) trait Foo {}` to prevent downstream crates from implementing a trait, replacing the sealed trait pattern. The sealed trait pattern required defining a private `Sealed` supertrait in a private module; `impl_restriction` achieves the same result in one line and produces a direct compiler error pointing to the restriction site when violated.

_Rust library authors enforcing API boundaries track nightly feature stabilization on daily.dev._

### How does mut_restriction work in Rust for making struct fields publicly readable but only internally mutable?

With `mut_restriction`, you annotate a field as `pub mut(crate) alpha: u8` to allow any code to read it while restricting mutation to the current crate. Scopes like `mut(super)` or `mut(self)` are also supported. Struct expressions are disallowed outside the permitted scope when any field carries a mut-restriction, preventing construction of unvalidated values that could violate invariants.

_Developers designing Rust APIs with invariant-preserving structs follow RFC progress on daily.dev._

## Community discussion

Top comments from developers on daily.dev.

**@agustinbarrientos** · 0 upvotes

> Thanks for putting field mutability on nightly!

## Similar posts on daily.dev

- [Maximally minimal view types · baby steps](https://daily.dev/posts/maximally-minimal-view-types-baby-steps-jjk8la3uk) · Lobsters · 1 upvotes · 0 comments

---

Tags: [#rust](https://daily.dev/tags/rust)

[View this post on daily.dev](https://daily.dev/posts/call-for-testing-restricting-trait-implementability-and-field-mutability-zncakna0d)
