From d6bccac835837a36827a61269cd463f143e0b60e Mon Sep 17 00:00:00 2001 From: mejrs <59372212+mejrs@users.noreply.github.com> Date: Wed, 15 Apr 2026 13:50:43 +0200 Subject: [PATCH] Fix error code example --- .../rustc_error_codes/src/error_codes/E0232.md | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/compiler/rustc_error_codes/src/error_codes/E0232.md b/compiler/rustc_error_codes/src/error_codes/E0232.md index 0e50cf589ee6..cb0797006092 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0232.md +++ b/compiler/rustc_error_codes/src/error_codes/E0232.md @@ -1,19 +1,14 @@ The `#[rustc_on_unimplemented]` attribute lets you specify a custom error message for when a particular trait isn't implemented on a type placed in a -position that needs that trait. For example, when the following code is -compiled: +position that needs that trait. The attribute will let you filter on +various types, with `on`: ```compile_fail,E0232 #![feature(rustc_attrs)] #![allow(internal_features)] -#[rustc_on_unimplemented(lorem="")] // error! +#[rustc_on_unimplemented(on(blah, message = "foo"))] // error! trait BadAnnotation {} ``` - -there will be an error about `bool` not implementing `Index`, followed by a -note saying "the type `bool` cannot be indexed by `u8`". - -For this to work, some note must be specified. An empty attribute will not do -anything, please remove the attribute or add some helpful note for users of the -trait. +For this to work a cfg-like predicate must be supplied. A malformed filter +will not do anything.