Skip to content

crater: drop implied bound with non-universal region - #159706

Draft
tiif wants to merge 3 commits into
rust-lang:mainfrom
tiif:is_this_universal
Draft

crater: drop implied bound with non-universal region#159706
tiif wants to merge 3 commits into
rust-lang:mainfrom
tiif:is_this_universal

Conversation

@tiif

@tiif tiif commented Jul 22, 2026

Copy link
Copy Markdown
Member

Implied bound could wind up having non-universal region and this behavior is kind of baffling to me. Currently, dropping implied bound with non-universal region won't break any ui test, so I am opening this PR to run crater to see if it breaks anything in the ecosystem.

cc @lcnr

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 22, 2026
@tiif

tiif commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 22, 2026
crater: drop implied bound with non-universal region
@rust-bors

rust-bors Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: e3d12f3 (e3d12f3322cb00126b2208c6b9df3ac4467951f5)
Base parent: 1af98b7 (1af98b7cdf86932b76182a387f52f1be6f0c1be0)

@tiif

tiif commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

@craterbot check

@craterbot

Copy link
Copy Markdown
Collaborator

👌 Experiment pr-159706 created and queued.
🤖 Automatically detected try build e3d12f3
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 22, 2026
@craterbot

Copy link
Copy Markdown
Collaborator

🚧 Experiment pr-159706 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot

Copy link
Copy Markdown
Collaborator

🎉 Experiment pr-159706 is completed!
📊 2 regressed and 5 fixed (1041933 total)
📊 5785 spurious results on the retry-regressed-list.txt, consider a retry1 if this is a significant amount.
📰 Open the summary report.

⚠️ If you notice any spurious failure please add them to the denylist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

Footnotes

  1. re-run the experiment with crates=https://crater-reports.s3.amazonaws.com/pr-159706/retry-regressed-list.txt

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Aug 9, 2026
@lcnr

lcnr commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

The fact that these exist is quite dubious. Interesting that they don't matter for any crate, can you summarize the tests where we encounter these regions?

@tiif

tiif commented Aug 18, 2026

Copy link
Copy Markdown
Member Author

ok! i will look into it this week.

@lcnr

lcnr commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

@rustbot author

@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 Aug 25, 2026
@tiif
tiif force-pushed the is_this_universal branch from b356a17 to e11f8d5 Compare August 29, 2026 10:37
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
---- [ui] tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.rs stdout ----

error: Error: expected failure status (Some(1)) but received status Some(101).
status: exit status: 101
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
##[error]  --> /checkout/tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.rs:17:6
   |
LL | impl<'a, I> UnwrapItemsExt for I {
   |      ^^ unconstrained lifetime parameter


thread 'rustc' (173115) panicked at compiler/rustc_borrowck/src/type_check/free_region_relations.rs:582:25:
case one: '_ <= '_
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <rustc_borrowck::type_check::free_region_relations::UniversalRegionRelationsBuilder>::add_implied_bounds
   3: <rustc_borrowck::type_check::free_region_relations::UniversalRegionRelationsBuilder>::create
   4: rustc_borrowck::type_check::free_region_relations::create
   5: rustc_borrowck::type_check::type_check
   6: rustc_borrowck::borrowck_collect_region_constraints
   7: <rustc_borrowck::root_cx::BorrowCheckRootCtxt>::do_mir_borrowck
   8: rustc_borrowck::mir_borrowck
      [... omitted 2 frames ...]
   9: <rustc_hir_analysis::collect::type_of::opaque::TaitConstraintLocator>::check
  10: rustc_hir_analysis::collect::type_of::opaque::find_opaque_ty_constraints_for_impl_trait_in_assoc_type
  11: rustc_hir_analysis::collect::type_of::type_of_opaque
      [... omitted 2 frames ...]
  12: rustc_hir_analysis::collect::type_of::type_of
      [... omitted 2 frames ...]
  13: rustc_hir_analysis::check::check::check_opaque
  14: rustc_hir_analysis::check::check::check_item_type
  15: rustc_hir_analysis::check::wfcheck::check_well_formed
      [... omitted 2 frames ...]
  16: rustc_middle::query::calls::query_ensure_result::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 1]>, rustc_middle::dep_graph::graph::DepNodeIndex>, ()>
  17: std::panicking::catch_unwind::<core::result::Result<(), rustc_span::ErrorGuaranteed>, core::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures::sync::parallel::try_par_for_each_in<&[rustc_span::def_id::LocalDefId], rustc_span::ErrorGuaranteed, <rustc_middle::hir::ModuleItems>::par_nested_bodies<rustc_hir_analysis::check::wfcheck::check_type_wf::{closure#4}>::{closure#0}>::{closure#0}::{closure#1}::{closure#0}>>
  18: rustc_data_structures::sync::parallel::try_par_for_each_in::<&[rustc_span::def_id::LocalDefId], rustc_span::ErrorGuaranteed, <rustc_middle::hir::ModuleItems>::par_opaques<rustc_hir_analysis::check::wfcheck::check_type_wf::{closure#5}>::{closure#0}>
  19: rustc_hir_analysis::check::wfcheck::check_type_wf
      [... omitted 2 frames ...]
  20: <rustc_session::session::Session>::time::<(), rustc_hir_analysis::check_crate::{closure#0}>
  21: rustc_hir_analysis::check_crate
  22: rustc_interface::passes::analysis
      [... omitted 2 frames ...]
  23: std::panicking::catch_unwind::<core::option::Option<rustc_interface::queries::Linker>, core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>::{closure#2}::{closure#0}>>
  24: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<<rustc_middle::ty::context::GlobalCtxt>::enter<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>::{closure#2}, core::option::Option<rustc_interface::queries::Linker>>::{closure#1}, core::option::Option<rustc_interface::queries::Linker>>::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>
  25: <rustc_middle::ty::context::TyCtxt>::create_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>::{closure#2}>
  26: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>
  27: std::panicking::catch_unwind::<(), core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}::{closure#0}>>
  28: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}
  29: rustc_span::create_session_globals_then::<(), rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---
note: please make sure that you have updated to the latest nightly

note: rustc 1.100.0-nightly (96f9bc21e 2026-08-29) running on aarch64-unknown-linux-gnu

note: compiler flags: -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -Z ignore-directory-in-diagnostics-source-blocks=/cargo -Z ignore-directory-in-diagnostics-source-blocks=/checkout/vendor -C codegen-units=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z write-long-types-to-disk=no -C strip=debuginfo -C prefer-dynamic -Z next-solver=coherence -C rpath -C debuginfo=0

query stack during panic:
#0 [mir_borrowck] borrow-checking `<impl at /checkout/tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.rs:17:1: 17:33>::unwrap_items`
#1 [type_of_opaque] computing type of opaque `<impl at /checkout/tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.rs:17:1: 17:33>::Iter::{opaque#0}`
#2 [type_of] computing type of `<impl at /checkout/tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.rs:17:1: 17:33>::Iter::{opaque#0}`
#3 [check_well_formed] checking that `<impl at /checkout/tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.rs:17:1: 17:33>::Iter::{opaque#0}` is well-formed
#4 [check_type_wf] checking that types are well-formed
#5 [analysis] running analysis passes on crate `assoc_type_lifetime_unconstrained`
end of query stack
error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0207`.
------------------------------------------

---- [ui] tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.rs stdout end ----
---- [ui] tests/ui/type-alias-impl-trait/issue-74761-2.rs stdout ----

error: Error: expected failure status (Some(1)) but received status Some(101).
status: exit status: 101
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/type-alias-impl-trait/issue-74761-2.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/type-alias-impl-trait/issue-74761-2" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
##[error]  --> /checkout/tests/ui/type-alias-impl-trait/issue-74761-2.rs:7:6
   |
---
LL | impl<'a, 'b> A for () {
   |          ^^ unconstrained lifetime parameter


thread 'rustc' (174029) panicked at compiler/rustc_borrowck/src/type_check/free_region_relations.rs:582:25:
case one: '_ <= '_
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <rustc_borrowck::type_check::free_region_relations::UniversalRegionRelationsBuilder>::add_implied_bounds
   3: <rustc_borrowck::type_check::free_region_relations::UniversalRegionRelationsBuilder>::create
   4: rustc_borrowck::type_check::free_region_relations::create
   5: rustc_borrowck::type_check::type_check
   6: rustc_borrowck::borrowck_collect_region_constraints
   7: <rustc_borrowck::root_cx::BorrowCheckRootCtxt>::do_mir_borrowck
   8: rustc_borrowck::mir_borrowck
      [... omitted 2 frames ...]
   9: <rustc_hir_analysis::collect::type_of::opaque::TaitConstraintLocator>::check
  10: rustc_hir_analysis::collect::type_of::opaque::find_opaque_ty_constraints_for_impl_trait_in_assoc_type
  11: rustc_hir_analysis::collect::type_of::type_of_opaque
      [... omitted 2 frames ...]
  12: rustc_hir_analysis::collect::type_of::type_of
      [... omitted 2 frames ...]
  13: rustc_hir_analysis::check::check::check_opaque
  14: rustc_hir_analysis::check::check::check_item_type
  15: rustc_hir_analysis::check::wfcheck::check_well_formed
      [... omitted 2 frames ...]
  16: rustc_middle::query::calls::query_ensure_result::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 1]>, rustc_middle::dep_graph::graph::DepNodeIndex>, ()>
  17: std::panicking::catch_unwind::<core::result::Result<(), rustc_span::ErrorGuaranteed>, core::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures::sync::parallel::try_par_for_each_in<&[rustc_span::def_id::LocalDefId], rustc_span::ErrorGuaranteed, <rustc_middle::hir::ModuleItems>::par_nested_bodies<rustc_hir_analysis::check::wfcheck::check_type_wf::{closure#4}>::{closure#0}>::{closure#0}::{closure#1}::{closure#0}>>
  18: rustc_data_structures::sync::parallel::try_par_for_each_in::<&[rustc_span::def_id::LocalDefId], rustc_span::ErrorGuaranteed, <rustc_middle::hir::ModuleItems>::par_opaques<rustc_hir_analysis::check::wfcheck::check_type_wf::{closure#5}>::{closure#0}>
  19: rustc_hir_analysis::check::wfcheck::check_type_wf
      [... omitted 2 frames ...]
  20: <rustc_session::session::Session>::time::<(), rustc_hir_analysis::check_crate::{closure#0}>
  21: rustc_hir_analysis::check_crate
  22: rustc_interface::passes::analysis
      [... omitted 2 frames ...]
  23: std::panicking::catch_unwind::<core::option::Option<rustc_interface::queries::Linker>, core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>::{closure#2}::{closure#0}>>
  24: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<<rustc_middle::ty::context::GlobalCtxt>::enter<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>::{closure#2}, core::option::Option<rustc_interface::queries::Linker>>::{closure#1}, core::option::Option<rustc_interface::queries::Linker>>::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>
  25: <rustc_middle::ty::context::TyCtxt>::create_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>::{closure#2}>
  26: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>
  27: std::panicking::catch_unwind::<(), core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}::{closure#0}>>
  28: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}
  29: rustc_span::create_session_globals_then::<(), rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---
note: please make sure that you have updated to the latest nightly

note: rustc 1.100.0-nightly (96f9bc21e 2026-08-29) running on aarch64-unknown-linux-gnu

note: compiler flags: -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -Z ignore-directory-in-diagnostics-source-blocks=/cargo -Z ignore-directory-in-diagnostics-source-blocks=/checkout/vendor -C codegen-units=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z write-long-types-to-disk=no -C strip=debuginfo -C prefer-dynamic -Z next-solver=coherence -C rpath -C debuginfo=0

query stack during panic:
#0 [mir_borrowck] borrow-checking `<impl at /checkout/tests/ui/type-alias-impl-trait/issue-74761-2.rs:7:1: 7:22>::f`
#1 [type_of_opaque] computing type of opaque `<impl at /checkout/tests/ui/type-alias-impl-trait/issue-74761-2.rs:7:1: 7:22>::B::{opaque#0}`
#2 [type_of] computing type of `<impl at /checkout/tests/ui/type-alias-impl-trait/issue-74761-2.rs:7:1: 7:22>::B::{opaque#0}`
#3 [check_well_formed] checking that `<impl at /checkout/tests/ui/type-alias-impl-trait/issue-74761-2.rs:7:1: 7:22>::B::{opaque#0}` is well-formed
#4 [check_type_wf] checking that types are well-formed
#5 [analysis] running analysis passes on crate `issue_74761_2`
end of query stack
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0207`.
------------------------------------------

---- [ui] tests/ui/type-alias-impl-trait/issue-74761-2.rs stdout end ----
---- [ui] tests/ui/type-alias-impl-trait/issue-74761.rs stdout ----

error: Error: expected failure status (Some(1)) but received status Some(101).
status: exit status: 101
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/type-alias-impl-trait/issue-74761.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/type-alias-impl-trait/issue-74761" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
##[error]  --> /checkout/tests/ui/type-alias-impl-trait/issue-74761.rs:7:6
   |
---
LL | impl<'a, 'b> A for () {
   |          ^^ unconstrained lifetime parameter


thread 'rustc' (174031) panicked at compiler/rustc_borrowck/src/type_check/free_region_relations.rs:582:25:
case one: '_ <= '_
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <rustc_borrowck::type_check::free_region_relations::UniversalRegionRelationsBuilder>::add_implied_bounds
   3: <rustc_borrowck::type_check::free_region_relations::UniversalRegionRelationsBuilder>::create
   4: rustc_borrowck::type_check::free_region_relations::create
   5: rustc_borrowck::type_check::type_check
   6: rustc_borrowck::borrowck_collect_region_constraints
   7: <rustc_borrowck::root_cx::BorrowCheckRootCtxt>::do_mir_borrowck
   8: rustc_borrowck::mir_borrowck
      [... omitted 2 frames ...]
   9: <rustc_hir_analysis::collect::type_of::opaque::TaitConstraintLocator>::check
  10: rustc_hir_analysis::collect::type_of::opaque::find_opaque_ty_constraints_for_impl_trait_in_assoc_type
  11: rustc_hir_analysis::collect::type_of::type_of_opaque
      [... omitted 2 frames ...]
  12: rustc_hir_analysis::collect::type_of::type_of
      [... omitted 2 frames ...]
  13: rustc_hir_analysis::check::check::check_opaque
  14: rustc_hir_analysis::check::check::check_item_type
  15: rustc_hir_analysis::check::wfcheck::check_well_formed
      [... omitted 2 frames ...]
  16: rustc_middle::query::calls::query_ensure_result::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 1]>, rustc_middle::dep_graph::graph::DepNodeIndex>, ()>
  17: std::panicking::catch_unwind::<core::result::Result<(), rustc_span::ErrorGuaranteed>, core::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures::sync::parallel::try_par_for_each_in<&[rustc_span::def_id::LocalDefId], rustc_span::ErrorGuaranteed, <rustc_middle::hir::ModuleItems>::par_nested_bodies<rustc_hir_analysis::check::wfcheck::check_type_wf::{closure#4}>::{closure#0}>::{closure#0}::{closure#1}::{closure#0}>>
  18: rustc_data_structures::sync::parallel::try_par_for_each_in::<&[rustc_span::def_id::LocalDefId], rustc_span::ErrorGuaranteed, <rustc_middle::hir::ModuleItems>::par_opaques<rustc_hir_analysis::check::wfcheck::check_type_wf::{closure#5}>::{closure#0}>
  19: rustc_hir_analysis::check::wfcheck::check_type_wf
      [... omitted 2 frames ...]
  20: <rustc_session::session::Session>::time::<(), rustc_hir_analysis::check_crate::{closure#0}>
  21: rustc_hir_analysis::check_crate
  22: rustc_interface::passes::analysis
      [... omitted 2 frames ...]
  23: std::panicking::catch_unwind::<core::option::Option<rustc_interface::queries::Linker>, core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>::{closure#2}::{closure#0}>>
  24: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<<rustc_middle::ty::context::GlobalCtxt>::enter<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>::{closure#2}, core::option::Option<rustc_interface::queries::Linker>>::{closure#1}, core::option::Option<rustc_interface::queries::Linker>>::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>
  25: <rustc_middle::ty::context::TyCtxt>::create_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>::{closure#2}>
  26: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>
  27: std::panicking::catch_unwind::<(), core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}::{closure#0}>>
  28: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}
  29: rustc_span::create_session_globals_then::<(), rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---
note: please make sure that you have updated to the latest nightly

note: rustc 1.100.0-nightly (96f9bc21e 2026-08-29) running on aarch64-unknown-linux-gnu

note: compiler flags: -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -Z ignore-directory-in-diagnostics-source-blocks=/cargo -Z ignore-directory-in-diagnostics-source-blocks=/checkout/vendor -C codegen-units=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z write-long-types-to-disk=no -C strip=debuginfo -C prefer-dynamic -Z next-solver=coherence -C rpath -C debuginfo=0

query stack during panic:
#0 [mir_borrowck] borrow-checking `<impl at /checkout/tests/ui/type-alias-impl-trait/issue-74761.rs:7:1: 7:22>::f`
#1 [type_of_opaque] computing type of opaque `<impl at /checkout/tests/ui/type-alias-impl-trait/issue-74761.rs:7:1: 7:22>::B::{opaque#0}`
#2 [type_of] computing type of `<impl at /checkout/tests/ui/type-alias-impl-trait/issue-74761.rs:7:1: 7:22>::B::{opaque#0}`
#3 [check_well_formed] checking that `<impl at /checkout/tests/ui/type-alias-impl-trait/issue-74761.rs:7:1: 7:22>::B::{opaque#0}` is well-formed
#4 [check_type_wf] checking that types are well-formed
#5 [analysis] running analysis passes on crate `issue_74761`
end of query stack
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0207`.
------------------------------------------

---- [ui] tests/ui/type-alias-impl-trait/issue-74761.rs stdout end ----
---- [ui] tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.rs stdout ----

error: Error: expected failure status (Some(1)) but received status Some(101).
status: exit status: 101
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
##[error]  --> /checkout/tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.rs:10:6
   |
LL | impl<'a, I: Iterator<Item = i32>> Trait for (i32, I) {
   |      ^^ unconstrained lifetime parameter


thread 'rustc' (174536) panicked at compiler/rustc_borrowck/src/type_check/free_region_relations.rs:582:25:
case one: '_ <= '_
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <rustc_borrowck::type_check::free_region_relations::UniversalRegionRelationsBuilder>::add_implied_bounds
   3: <rustc_borrowck::type_check::free_region_relations::UniversalRegionRelationsBuilder>::create
   4: rustc_borrowck::type_check::free_region_relations::create
   5: rustc_borrowck::type_check::type_check
   6: rustc_borrowck::borrowck_collect_region_constraints
   7: <rustc_borrowck::root_cx::BorrowCheckRootCtxt>::do_mir_borrowck
   8: rustc_borrowck::mir_borrowck
      [... omitted 2 frames ...]
   9: <rustc_hir_analysis::collect::type_of::opaque::TaitConstraintLocator>::check
  10: rustc_hir_analysis::collect::type_of::opaque::find_opaque_ty_constraints_for_impl_trait_in_assoc_type
  11: rustc_hir_analysis::collect::type_of::type_of_opaque
      [... omitted 2 frames ...]
  12: rustc_hir_analysis::collect::type_of::type_of
      [... omitted 2 frames ...]
  13: rustc_hir_analysis::check::check::check_opaque
  14: rustc_hir_analysis::check::check::check_item_type
  15: rustc_hir_analysis::check::wfcheck::check_well_formed
      [... omitted 2 frames ...]
  16: rustc_middle::query::calls::query_ensure_result::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 1]>, rustc_middle::dep_graph::graph::DepNodeIndex>, ()>
  17: std::panicking::catch_unwind::<core::result::Result<(), rustc_span::ErrorGuaranteed>, core::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures::sync::parallel::try_par_for_each_in<&[rustc_span::def_id::LocalDefId], rustc_span::ErrorGuaranteed, <rustc_middle::hir::ModuleItems>::par_nested_bodies<rustc_hir_analysis::check::wfcheck::check_type_wf::{closure#4}>::{closure#0}>::{closure#0}::{closure#1}::{closure#0}>>
  18: rustc_data_structures::sync::parallel::try_par_for_each_in::<&[rustc_span::def_id::LocalDefId], rustc_span::ErrorGuaranteed, <rustc_middle::hir::ModuleItems>::par_opaques<rustc_hir_analysis::check::wfcheck::check_type_wf::{closure#5}>::{closure#0}>
  19: rustc_hir_analysis::check::wfcheck::check_type_wf
      [... omitted 2 frames ...]
  20: <rustc_session::session::Session>::time::<(), rustc_hir_analysis::check_crate::{closure#0}>
  21: rustc_hir_analysis::check_crate
  22: rustc_interface::passes::analysis
      [... omitted 2 frames ...]
  23: std::panicking::catch_unwind::<core::option::Option<rustc_interface::queries::Linker>, core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>::{closure#2}::{closure#0}>>
  24: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<<rustc_middle::ty::context::GlobalCtxt>::enter<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>::{closure#2}, core::option::Option<rustc_interface::queries::Linker>>::{closure#1}, core::option::Option<rustc_interface::queries::Linker>>::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>
  25: <rustc_middle::ty::context::TyCtxt>::create_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>::{closure#2}>
  26: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>
  27: std::panicking::catch_unwind::<(), core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}::{closure#0}>>
  28: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}
  29: rustc_span::create_session_globals_then::<(), rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---
note: please make sure that you have updated to the latest nightly

note: rustc 1.100.0-nightly (96f9bc21e 2026-08-29) running on aarch64-unknown-linux-gnu

note: compiler flags: -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -Z ignore-directory-in-diagnostics-source-blocks=/cargo -Z ignore-directory-in-diagnostics-source-blocks=/checkout/vendor -C codegen-units=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z write-long-types-to-disk=no -C strip=debuginfo -C prefer-dynamic -Z next-solver=coherence -C rpath -C debuginfo=0

query stack during panic:
#0 [mir_borrowck] borrow-checking `<impl at /checkout/tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.rs:10:1: 10:53>::into`
#1 [type_of_opaque] computing type of opaque `<impl at /checkout/tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.rs:10:1: 10:53>::Associated::{opaque#0}`
#2 [type_of] computing type of `<impl at /checkout/tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.rs:10:1: 10:53>::Associated::{opaque#0}`
#3 [check_well_formed] checking that `<impl at /checkout/tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.rs:10:1: 10:53>::Associated::{opaque#0}` is well-formed
#4 [check_type_wf] checking that types are well-formed
#5 [analysis] running analysis passes on crate `type_alias_impl_trait_unconstrained_lifetime`
end of query stack
error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0207`.

@tiif

tiif commented Aug 29, 2026

Copy link
Copy Markdown
Member Author

I re-based this PR on top of #160491 as the main branch will have cases where assertion is fired because hidden type of opaque for implied bound is used, which is less interesting as it will be fixed after #160491.

Here's the result:

Test failed

  • tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.rs
  • tests/ui/type-alias-impl-trait/issue-74761-2.rs
  • tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.rs
  • tests/ui/type-alias-impl-trait/issue-74761.rs

The implied bounds that trigger the assertion are the type of OutlivesBound::RegionSubRegion and all of them have unconstrained region from the impl header. Also, all of them are implied bounds of a region relating to itself as shown below:

test 1: add_outlives_bounds(bound=RegionSubRegion('?18, '?18))
test 2: add_outlives_bounds(bound=RegionSubRegion('?10, '?10))
test 3: add_outlives_bounds(bound=RegionSubRegion('?5, '?5))
test 4: add_outlives_bounds(bound=RegionSubRegion('?10, '?10))

While I guess that the non-universal region is the unconstrained region from impl header, I am not sure how to verify it yet. I wasn't able to trace where ?18, ?10, ?5 and ?10 come from.

Comment on lines +577 to +583
let r1 = self.universal_regions.to_region_vid(ra);
let r2 = self.universal_regions.to_region_vid(rb);
if !(self.universal_regions.is_universal_region(r1)
|| self.universal_regions.is_universal_region(r2))
{
assert!(false, "case one: {} <= {}", ra, rb);
}

@tiif tiif Aug 29, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Looking at this again, I noticed I missed the case where r1 xor r2 is non-universal region, I will open a follow-up PR with crater run that only includes this case that I missed.

View changes since the review

@tiif tiif Aug 30, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There isn't any case in our test suite where r1 xor r2 is non-universal region, I guess we can just safely ignore it?

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

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

5 participants