Skip to content

Introduce #[diagnostic::on_type_error(message)]#155200

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
Unique-Usman:ua/diagnostic_on_type_error
Jun 14, 2026
Merged

Introduce #[diagnostic::on_type_error(message)]#155200
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
Unique-Usman:ua/diagnostic_on_type_error

Conversation

@Unique-Usman

@Unique-Usman Unique-Usman commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

@rustbot

rustbot commented Apr 12, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred in compiler/rustc_hir/src/attrs

cc @jdonszelmann, @JonathanBrouwer

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) 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 12, 2026
@rustbot

rustbot commented Apr 12, 2026

Copy link
Copy Markdown
Collaborator

r? @davidtwco

rustbot has assigned @davidtwco.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 69 candidates
  • Random selection from 12 candidates

@Unique-Usman

Copy link
Copy Markdown
Contributor Author

r? estebank

@rustbot rustbot assigned estebank and unassigned davidtwco Apr 12, 2026
@Unique-Usman Unique-Usman marked this pull request as draft April 12, 2026 14:20
@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 12, 2026
@mejrs

mejrs commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

Before you sink more time and effort into this you should explain what you want on_type_error to do.

One expectation I have is that it can specialize for different types. For example if you put this attribute on struct A but the typeerror finds a B or C instead you'll want to emit different messages for them, similar to how the filtering in #[rustc_on_unimplemented] works. But implementing that properly is actually a lot of work and effort, and requires significant changes to rustc.

I'm not convinced this attribute can be implemented in a satisfying way at this time. I'm open to being convinced otherwise though, and am happy to hear your thoughts.

@estebank

Copy link
Copy Markdown
Contributor

@mejrs two things: I agree that we want filtering in the same way as rustc_on_unimplemented, and we need the same kind of filtering for diagnostic::on_unimplemented that we don't have today. It should work exactly the same way. I believe that we can get away with a similar (but less powerful) version of what the rustc_ attr provides. Minimally, for now, I think we can get away with supporting the following:

#[diagnostic::on_type_error(
    note = "text",
)]
struct S<T>(T);

with an eye for something along the lines of

#[diagnostic::on_type_error(
    on(expected="Self", found="crate::K", T = "i32", note = "a"),
    on(expected="crate::K", found="Self", note = "b"),
    note = "c",
)]
struct S<T>(T);

some time later.

I believe that having the minimal functionality at least lets crate authors include the "filtering information" in the text itself ("if this is the found type, then..." or "if type parameter T is blah, ..."), and that there are already several cases in the std of unconditional addition of notes during error reporting for given types, so I think the minimal functionality is already adding value.

For the filtering I would like to share the same parser between on_type_error and on_unimplemented, as it is effectively the same functionality.

Comment thread compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs Outdated
@mejrs

mejrs commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Did you two have a discussion about this beforehand? I'd like to read it.

that there are already several cases in the std of unconditional addition of notes during error reporting for given types

I presume you are talking about this?

fn suggest_unwrapping_inner_self(
&self,
err: &mut Diag<'_>,
source: SelfSource<'tcx>,
actual: Ty<'tcx>,
item_name: Ident,
) {
let tcx = self.tcx;
let SelfSource::MethodCall(expr) = source else {
return;
};
let call_expr = tcx.hir_expect_expr(tcx.parent_hir_id(expr.hir_id));
let ty::Adt(kind, args) = actual.kind() else {
return;
};
match kind.adt_kind() {
ty::AdtKind::Enum => {
let matching_variants: Vec<_> = kind
.variants()
.iter()
.flat_map(|variant| {
let [field] = &variant.fields.raw[..] else {
return None;
};
let field_ty = field.ty(tcx, args);
// Skip `_`, since that'll just lead to ambiguity.
if self.resolve_vars_if_possible(field_ty).is_ty_var() {
return None;
}
self.lookup_probe_for_diagnostic(
item_name,
field_ty,
call_expr,
ProbeScope::TraitsInScope,
None,
)
.ok()
.map(|pick| (variant, field, pick))
})
.collect();
let ret_ty_matches = |diagnostic_item| {
if let Some(ret_ty) = self
.ret_coercion
.as_ref()
.map(|c| self.resolve_vars_if_possible(c.borrow().expected_ty()))
&& let ty::Adt(kind, _) = ret_ty.kind()
&& tcx.get_diagnostic_item(diagnostic_item) == Some(kind.did())
{
true
} else {
false
}
};
match &matching_variants[..] {
[(_, field, pick)] => {
let self_ty = field.ty(tcx, args);
err.span_note(
tcx.def_span(pick.item.def_id),
format!("the method `{item_name}` exists on the type `{self_ty}`"),
);
let (article, kind, variant, question) = if tcx.is_diagnostic_item(sym::Result, kind.did())
// Do not suggest `.expect()` in const context where it's not available. rust-lang/rust#149316
&& !tcx.hir_is_inside_const_context(expr.hir_id)
{
("a", "Result", "Err", ret_ty_matches(sym::Result))
} else if tcx.is_diagnostic_item(sym::Option, kind.did()) {
("an", "Option", "None", ret_ty_matches(sym::Option))
} else {
return;
};
if question {
err.span_suggestion_verbose(
expr.span.shrink_to_hi(),
format!(
"use the `?` operator to extract the `{self_ty}` value, propagating \
{article} `{kind}::{variant}` value to the caller"
),
"?",
Applicability::MachineApplicable,
);
} else {
err.span_suggestion_verbose(
expr.span.shrink_to_hi(),
format!(
"consider using `{kind}::expect` to unwrap the `{self_ty}` value, \
panicking if the value is {article} `{kind}::{variant}`"
),
".expect(\"REASON\")",
Applicability::HasPlaceholders,
);
}
}
// FIXME(compiler-errors): Support suggestions for other matching enum variants
_ => {}
}
}
// Target wrapper types - types that wrap or pretend to wrap another type,
// perhaps this inner type is meant to be called?
ty::AdtKind::Struct | ty::AdtKind::Union => {
let [first] = ***args else {
return;
};
let ty::GenericArgKind::Type(ty) = first.kind() else {
return;
};
let Ok(pick) = self.lookup_probe_for_diagnostic(
item_name,
ty,
call_expr,
ProbeScope::TraitsInScope,
None,
) else {
return;
};
let name = self.ty_to_value_string(actual);
let inner_id = kind.did();
let mutable = if let Some(AutorefOrPtrAdjustment::Autoref { mutbl, .. }) =
pick.autoref_or_ptr_adjustment
{
Some(mutbl)
} else {
None
};
if tcx.is_diagnostic_item(sym::LocalKey, inner_id) {
err.help("use `with` or `try_with` to access thread local storage");
} else if tcx.is_lang_item(kind.did(), LangItem::MaybeUninit) {
err.help(format!(
"if this `{name}` has been initialized, \
use one of the `assume_init` methods to access the inner value"
));
} else if tcx.is_diagnostic_item(sym::RefCell, inner_id) {
let (suggestion, borrow_kind, panic_if) = match mutable {
Some(Mutability::Not) => (".borrow()", "borrow", "a mutable borrow exists"),
Some(Mutability::Mut) => {
(".borrow_mut()", "mutably borrow", "any borrows exist")
}
None => return,
};
err.span_suggestion_verbose(
expr.span.shrink_to_hi(),
format!(
"use `{suggestion}` to {borrow_kind} the `{ty}`, \
panicking if {panic_if}"
),
suggestion,
Applicability::MaybeIncorrect,
);
} else if tcx.is_diagnostic_item(sym::Mutex, inner_id) {
err.span_suggestion_verbose(
expr.span.shrink_to_hi(),
format!(
"use `.lock().unwrap()` to borrow the `{ty}`, \
blocking the current thread until it can be acquired"
),
".lock().unwrap()",
Applicability::MaybeIncorrect,
);
} else if tcx.is_diagnostic_item(sym::RwLock, inner_id) {
let (suggestion, borrow_kind) = match mutable {
Some(Mutability::Not) => (".read().unwrap()", "borrow"),
Some(Mutability::Mut) => (".write().unwrap()", "mutably borrow"),
None => return,
};
err.span_suggestion_verbose(
expr.span.shrink_to_hi(),
format!(
"use `{suggestion}` to {borrow_kind} the `{ty}`, \
blocking the current thread until it can be acquired"
),
suggestion,
Applicability::MaybeIncorrect,
);
} else {
return;
};
err.span_note(
tcx.def_span(pick.item.def_id),
format!("the method `{item_name}` exists on the type `{ty}`"),
);
}
}
}

The bit about unwrapping Option/Result is actually really impactful for learners and the way you propose the attribute it should be able to do that sort of thing (minus the inline code suggestions, obviously).

So 💯 from me.

Let's go for a minimal version for now, like estebank said:

#[diagnostic::on_type_error(
    note = "text",
)]
struct S<T>(T);

I'm a bit worried about this thing being too powerful and showing up in places where authors didn't quite expect or intend. There are after all quite a few ways and places to get type errors.

I think the following semantics would be reasonably useful but also restrictive enough to not spook me or the lang people.

  • only note is supported (not message or label)
  • no filtering (on) of any kind, that's a whole design space we should get into elsewhere
  • the annotated ADT must have exactly one generic type parameter
  • if the annotated type (here, S) is found but the type parameter type (here, T) is expected, then the note is displayed.
  • let's also do that for "S has no method named foo but T does".

Then in the future, when we evolve the attribute forwards, we can specify something like "if you dont supply any filter then this wrapper kind of thing is all it can do".

@Unique-Usman

Copy link
Copy Markdown
Contributor Author

Did you two have a discussion about this beforehand? I'd like to read it.

that there are already several cases in the std of unconditional addition of notes during error reporting for given types

There was a discussion initally, it was through video meet though, but, nothing much more than whatever is here actually.

I presume you are talking about this?

I think the following semantics would be reasonably useful but also restrictive enough to not spook me or the lang people.

  • only note is supported (not message or label)
  • no filtering (on) of any kind, that's a whole design space we should get into elsewhere
  • the annotated ADT must have exactly one generic type parameter
  • if the annotated type (here, S) is found but the type parameter type (here, T) is expected, then the note is displayed.
  • let's also do that for "S has no method named foo but T does".

Then in the future, when we evolve the attribute forwards, we can specify something like "if you dont supply any filter then this wrapper kind of thing is all it can do".

Agreed.

@Unique-Usman Unique-Usman force-pushed the ua/diagnostic_on_type_error branch from c6cbaa7 to 5b090d2 Compare April 16, 2026 09:36
@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@Unique-Usman Unique-Usman force-pushed the ua/diagnostic_on_type_error branch 2 times, most recently from 6366fc0 to 924b894 Compare April 18, 2026 11:39
@Unique-Usman Unique-Usman marked this pull request as ready for review April 18, 2026 11:41
@rustbot

rustbot commented Apr 18, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to diagnostic attributes.

cc @mejrs

Some changes occurred in src/tools/cargo

cc @ehuss

@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 18, 2026
@rustbot

This comment has been minimized.

@Unique-Usman Unique-Usman force-pushed the ua/diagnostic_on_type_error branch from 924b894 to 2392d19 Compare April 18, 2026 12:13
@rust-log-analyzer

This comment has been minimized.

Suggested-by: Esteban Küber <esteban@kuber.com.ar>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
@Unique-Usman Unique-Usman force-pushed the ua/diagnostic_on_type_error branch from 4976718 to 78d7543 Compare June 12, 2026 22:57
@mejrs

mejrs commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

I think I'm just going to go ahead and merge this now. Thanks for working on this and I'm somewhat sorry it all took so long.

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 78d7543 has been approved by mejrs

It is now in the queue for this repository.

@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 Jun 13, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 13, 2026
…_error, r=mejrs

Introduce #[diagnostic::on_type_error(message)]
@Unique-Usman

Unique-Usman commented Jun 13, 2026

Copy link
Copy Markdown
Contributor Author

I think I'm just going to go ahead and merge this now. Thanks for working on this and I'm somewhat sorry it all took so long.

Thanks for the review and the feedback, I do really appreciate. Thanks.

rust-bors Bot pushed a commit that referenced this pull request Jun 13, 2026
Rollup of 4 pull requests

Successful merges:

 - #155200 (Introduce #[diagnostic::on_type_error(message)])
 - #157538 (std: move `PidFd` to `sys::process`)
 - #157791 (Add regression test for pclmulqdq inlining across target feature)
 - #157867 (std: sys: xous: clamp condvar wait_timeout instead of truncating)
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jun 13, 2026
…ejrs

Introduce #[diagnostic::on_type_error(message)]
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job i686-gnu-nopt-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   Compiling compiler_builtins v0.1.160 (/checkout/library/compiler-builtins/compiler-builtins)
[RUSTC-TIMING] rand test:false 1.714
[RUSTC-TIMING] build_script_build test:false 1.014
[RUSTC-TIMING] core test:false 71.766
rustc: /checkout/src/llvm-project/llvm/include/llvm/ADT/DenseMap.h:663: bool llvm::DenseMapBase<DerivedT, KeyT, ValueT, KeyInfoT, BucketT>::LookupBucketFor(const LookupKeyT&, BucketT*&) [with LookupKeyT = unsigned int; DerivedT = llvm::SmallDenseMap<unsigned int, unsigned int, 8, llvm::DenseMapInfo<unsigned int, void>, llvm::detail::DenseMapPair<unsigned int, unsigned int> >; KeyT = unsigned int; ValueT = unsigned int; KeyInfoT = llvm::DenseMapInfo<unsigned int, void>; BucketT = llvm::detail::DenseMapPair<unsigned int, unsigned int>]: Assertion `!KeyInfoT::isEqual(Val, EmptyKey) && !KeyInfoT::isEqual(Val, TombstoneKey) && "Empty/Tombstone value shouldn't be inserted into map!"' failed.
[RUSTC-TIMING] allocbenches test:true 82.662
rustc exited with signal: 6 (SIGABRT) (core dumped)
error: could not compile `alloctests` (bench "allocbenches")

Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc /checkout/obj/build/bootstrap/debug/rustc --crate-name allocbenches --edition=2024 library/alloctests/benches/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no -C codegen-units=1 --warn=unexpected_cfgs --check-cfg 'cfg(no_global_oom_handling)' --check-cfg 'cfg(no_rc)' --check-cfg 'cfg(no_sync)' --check-cfg 'cfg(randomized_layouts)' -Cembed-bitcode=yes -Zunstable-options -Cforce-frame-pointers=non-leaf -C debug-assertions=on --test --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=70d6cfbec1129dab -C extra-filename=-91bbbc78f2a4fd1e --out-dir /checkout/obj/build/i686-unknown-linux-gnu/stage2-std/i686-unknown-linux-gnu/dist/deps --target i686-unknown-linux-gnu -L dependency=/checkout/obj/build/i686-unknown-linux-gnu/stage2-std/i686-unknown-linux-gnu/dist/deps -L dependency=/checkout/obj/build/i686-unknown-linux-gnu/stage2-std/dist/deps --extern alloctests=/checkout/obj/build/i686-unknown-linux-gnu/stage2-std/i686-unknown-linux-gnu/dist/deps/liballoctests-098d122838ba12e3.rlib --extern alloctests=/checkout/obj/build/i686-unknown-linux-gnu/stage2-std/i686-unknown-linux-gnu/dist/deps/liballoctests-098d122838ba12e3.rmeta --extern rand=/checkout/obj/build/i686-unknown-linux-gnu/stage2-std/i686-unknown-linux-gnu/dist/deps/librand-3e1849e5bd9de03d.rlib --extern rand=/checkout/obj/build/i686-unknown-linux-gnu/stage2-std/i686-unknown-linux-gnu/dist/deps/librand-3e1849e5bd9de03d.rmeta --extern rand_xorshift=/checkout/obj/build/i686-unknown-linux-gnu/stage2-std/i686-unknown-linux-gnu/dist/deps/librand_xorshift-2c372656fd07b09d.rlib --extern rand_xorshift=/checkout/obj/build/i686-unknown-linux-gnu/stage2-std/i686-unknown-linux-gnu/dist/deps/librand_xorshift-2c372656fd07b09d.rmeta -Zannotate-moves '--check-cfg=cfg(feature,values(any()))' -Zunstable-options -Zmacro-backtrace -Csplit-debuginfo=off -Cprefer-dynamic -Zinline-mir -Zinline-mir-preserve-debug -Zmir_strip_debuginfo=locals-in-tiny-functions -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Alinker-messages '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/")' -Z binary-dep-depinfo` (exit status: 254)
warning: build failed, waiting for other jobs to finish...
[RUSTC-TIMING] compiler_builtins test:false 14.524
[RUSTC-TIMING] alloctests test:true 133.737
[RUSTC-TIMING] coretests test:true 234.827
Bootstrap failed while executing `--stage 2 test --skip compiler --skip src`

@rust-bors rust-bors Bot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 14, 2026
@rust-bors

rust-bors Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 83f3367 failed: CI. Failed job:

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

@bors retry

@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 Jun 14, 2026
@rust-bors

This comment has been minimized.

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 14, 2026
@rust-bors

rust-bors Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

☀️ Test successful - CI
Approved by: mejrs
Duration: 3h 25m 3s
Pushing 4f8ea98 to main...

@rust-bors rust-bors Bot merged commit 4f8ea98 into rust-lang:main Jun 14, 2026
13 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jun 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor
What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 9ae5f52 (parent) -> 4f8ea98 (this PR)

Test differences

Show 173 test diffs

Stage 1

  • [ui (polonius)] tests/ui/diagnostic_namespace/on_type_error/error_is_shown_in_downstream_crates.rs: [missing] -> pass (J1)
  • [ui (polonius)] tests/ui/diagnostic_namespace/on_type_error/on-type-error-const-generic.rs: [missing] -> pass (J1)
  • [ui (polonius)] tests/ui/diagnostic_namespace/on_type_error/on-type-error-duplicate-attributes.rs: [missing] -> pass (J1)
  • [ui (polonius)] tests/ui/diagnostic_namespace/on_type_error/on-type-error-invalid-placeholders.rs: [missing] -> pass (J1)
  • [ui (polonius)] tests/ui/diagnostic_namespace/on_type_error/on-type-error-lifetime-generic.rs: [missing] -> pass (J1)
  • [ui (polonius)] tests/ui/diagnostic_namespace/on_type_error/on_type_error_enum.rs: [missing] -> pass (J1)
  • [ui (polonius)] tests/ui/diagnostic_namespace/on_type_error/on_type_error_simple.rs: [missing] -> pass (J1)
  • [ui (polonius)] tests/ui/diagnostic_namespace/on_type_error/on_type_error_union.rs: [missing] -> pass (J1)
  • [ui (polonius)] tests/ui/diagnostic_namespace/on_type_error/on_type_error_with_too_many_generics.rs: [missing] -> pass (J1)
  • [ui (polonius)] tests/ui/diagnostic_namespace/on_type_error/report_warning_on_invalid_formats.rs: [missing] -> pass (J1)
  • [ui (polonius)] tests/ui/diagnostic_namespace/on_type_error/report_warning_on_invalid_meta_item_syntax.rs: [missing] -> pass (J1)
  • [ui (polonius)] tests/ui/diagnostic_namespace/on_type_error/report_warning_on_missing_options.rs: [missing] -> pass (J1)
  • [ui (polonius)] tests/ui/diagnostic_namespace/on_type_error/report_warning_on_non_adt.rs: [missing] -> pass (J1)
  • [ui (polonius)] tests/ui/diagnostic_namespace/on_type_error/report_warning_on_unknown_options.rs: [missing] -> pass (J1)
  • [ui (polonius)] tests/ui/feature-gates/feature-gate-diagnostic-on-type-error.rs: [missing] -> pass (J1)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/error_is_shown_in_downstream_crates.rs: [missing] -> pass (J2)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/on-type-error-const-generic.rs: [missing] -> pass (J2)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/on-type-error-duplicate-attributes.rs: [missing] -> pass (J2)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/on-type-error-invalid-placeholders.rs: [missing] -> pass (J2)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/on-type-error-lifetime-generic.rs: [missing] -> pass (J2)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/on_type_error_enum.rs: [missing] -> pass (J2)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/on_type_error_simple.rs: [missing] -> pass (J2)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/on_type_error_union.rs: [missing] -> pass (J2)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/on_type_error_with_too_many_generics.rs: [missing] -> pass (J2)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/report_warning_on_invalid_formats.rs: [missing] -> pass (J2)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/report_warning_on_invalid_meta_item_syntax.rs: [missing] -> pass (J2)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/report_warning_on_missing_options.rs: [missing] -> pass (J2)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/report_warning_on_non_adt.rs: [missing] -> pass (J2)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/report_warning_on_unknown_options.rs: [missing] -> pass (J2)
  • [ui] tests/ui/feature-gates/feature-gate-diagnostic-on-type-error.rs: [missing] -> pass (J2)

Stage 2

  • [ui] tests/ui/diagnostic_namespace/on_type_error/error_is_shown_in_downstream_crates.rs: [missing] -> pass (J0)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/on-type-error-const-generic.rs: [missing] -> pass (J0)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/on-type-error-duplicate-attributes.rs: [missing] -> pass (J0)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/on-type-error-invalid-placeholders.rs: [missing] -> pass (J0)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/on-type-error-lifetime-generic.rs: [missing] -> pass (J0)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/on_type_error_enum.rs: [missing] -> pass (J0)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/on_type_error_simple.rs: [missing] -> pass (J0)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/on_type_error_union.rs: [missing] -> pass (J0)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/on_type_error_with_too_many_generics.rs: [missing] -> pass (J0)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/report_warning_on_invalid_formats.rs: [missing] -> pass (J0)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/report_warning_on_invalid_meta_item_syntax.rs: [missing] -> pass (J0)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/report_warning_on_missing_options.rs: [missing] -> pass (J0)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/report_warning_on_non_adt.rs: [missing] -> pass (J0)
  • [ui] tests/ui/diagnostic_namespace/on_type_error/report_warning_on_unknown_options.rs: [missing] -> pass (J0)
  • [ui] tests/ui/feature-gates/feature-gate-diagnostic-on-type-error.rs: [missing] -> pass (J0)

Additionally, 128 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 4f8ea98eb3e462eec4a005a4a93dfd21b9525af2 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. dist-ohos-x86_64: 53m 16s -> 1h 18m (+47.6%)
  2. dist-powerpc64-linux-gnu: 1h 4m -> 1h 34m (+46.0%)
  3. aarch64-apple: 4h 18m -> 2h 57m (-31.4%)
  4. dist-x86_64-llvm-mingw: 2h 2m -> 1h 32m (-24.3%)
  5. dist-x86_64-msvc: 1h 44m -> 2h 8m (+23.3%)
  6. dist-android: 23m 12s -> 18m 4s (-22.2%)
  7. dist-x86_64-musl: 1h 50m -> 2h 14m (+22.1%)
  8. dist-various-1: 1h 3m -> 1h 16m (+21.5%)
  9. optional-x86_64-gnu-parallel-frontend: 2h 43m -> 2h 11m (-19.9%)
  10. dist-various-2: 44m 52s -> 36m 1s (-19.7%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (4f8ea98): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.4% [0.2%, 1.7%] 9
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.4% [-0.4%, -0.3%] 2
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (secondary -1.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.7% [-2.0%, -1.3%] 3
All ❌✅ (primary) - - 0

Cycles

Results (primary -0.0%, secondary -2.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.3% [2.3%, 2.3%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.4% [-2.4%, -2.4%] 1
Improvements ✅
(secondary)
-2.4% [-2.4%, -2.4%] 1
All ❌✅ (primary) -0.0% [-2.4%, 2.3%] 2

Binary size

Results (secondary -0.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.0% [-0.0%, -0.0%] 1
All ❌✅ (primary) - - 0

Bootstrap: 517.026s -> 517.813s (0.15%)
Artifact size: 401.47 MiB -> 400.99 MiB (-0.12%)

@rustbot rustbot added the perf-regression Performance regression. label Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. F-autodiff `#![feature(autodiff)]` merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. 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.

8 participants