Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot turn UnevaluatedConst into AliasTy #2698

Open
sigurd4 opened this issue Dec 22, 2024 · 10 comments
Open

Cannot turn UnevaluatedConst into AliasTy #2698

sigurd4 opened this issue Dec 22, 2024 · 10 comments

Comments

@sigurd4
Copy link

sigurd4 commented Dec 22, 2024

Crate name

option_trait

Build failure link

https://docs.rs/crate/option_trait/1.0.0/builds/1596995

Additional details

It builds fine on my machine. Same rust nightly version too.

I think it's due to the type alias Copied that relies on a possibly not well formed associated type in the trait private::_Copied. At least that's the only case where i've used a type alias throughout the project (located in lib.rs)

@sigurd4
Copy link
Author

sigurd4 commented Dec 22, 2024

Never mind. I got rid of the type alias, and avoided doing specialization in private::_Copied, yet i get the same error on docs.rs. The original hypothesis i had for why it wont build was wrong, so now i have no idea.

Build failure link (second attempt, same error)

https://docs.rs/crate/option_trait/1.0.2/builds/1597040

@sigurd4
Copy link
Author

sigurd4 commented Dec 22, 2024

Managed to make it build on docs.rs by excluding feature opt_cell. So clearly the problem is located somewhere in opt_cell.rs. For now i'll just exclude the feature in the documentation

@syphar
Copy link
Member

syphar commented Dec 23, 2024

this is odd, especially when you are using the same nightly version. You can look up the nightly version we're using under https://docs.rs/about/builds .

What sometimes helps is running the doc-build with very similar arguments as we do it: https://github.com/dtolnay/cargo-docs-rs

@sigurd4
Copy link
Author

sigurd4 commented Dec 23, 2024

Thanks. That's a very useful tool. I ran cargo docs-rs and got the same error. Does not happen if i run cargo build normally. If i omit feature opt_cell from the crate, cargo docs-rs runs fine without errors.

@sigurd4
Copy link
Author

sigurd4 commented Dec 23, 2024

So it's clearly not a resource limit issue, it's probably due to using experimental rust language features like specialization i think. I suspect it might fail on the specialization i do on the trait _Spec. I'll try to isolate the problem.

@sigurd4
Copy link
Author

sigurd4 commented Dec 23, 2024

Weird... I tried just commenting out everything in the opt_cell.rs file except the following and i still got the same error, even after doing cargo clean.

pub struct OptCell<T>(T);

Removed the const expr and the specialized type too, yet the same error happens

@sigurd4
Copy link
Author

sigurd4 commented Dec 23, 2024

If i make a similar struct in another clean project, no error occurs, so it has to be something about my repo specifically. Very strange. It happens only when the file opt_cell.rs is included.

And i can even replace the whole file contents with this:

struct Whatever(u32);

And i get the same error. But doing so in a clean project does not produce the error.

@sigurd4
Copy link
Author

sigurd4 commented Dec 23, 2024

Rust ICE when doing cargo docs-rs:

thread 'rustc' panicked at /rustc/426d1734238e3c5f52e935ba4f617f3a9f43b59d/compiler/rustc_type_ir/src/predicate.rs:532:17:
Cannot turn `UnevaluatedConst` into `AliasTy`
stack backtrace:
   0:     0x7db52efcd1a5 - std::backtrace::Backtrace::create::h2021bf191a8739ac
   1:     0x7db52d4a4555 - std::backtrace::Backtrace::force_capture::h1c4a4f7d7b3cc85e
   2:     0x7db52c6306fe - std[9670bf84f1ec365]::panicking::update_hook::<alloc[6b9af05f37cecee8]::boxed::Box<rustc_driver_impl[e843f2e3b8b39cd5]::install_ice_hook::{closure#0}>>::{closure#0}
   3:     0x7db52d4bc4c8 - std::panicking::rust_panic_with_hook::h1e4476f399791006
   4:     0x7db52d4bc186 - std::panicking::begin_panic_handler::{{closure}}::hd8b76955e18606db
   5:     0x7db52d4b9e69 - std::sys::backtrace::__rust_end_short_backtrace::hc35e6bbd7a6cbefa
   6:     0x7db52d4bbe7d - rust_begin_unwind
   7:     0x7db52a19c070 - core::panicking::panic_fmt::hf53ce36a54419534
   8:     0x5b84d65867dc - rustdoc[681614ec0d172b40]::clean::clean_predicate
   9:     0x5b84d658c056 - rustdoc[681614ec0d172b40]::clean::clean_ty_generics
  10:     0x5b84d657e7ee - rustdoc[681614ec0d172b40]::clean::utils::synthesize_auto_trait_and_blanket_impls
  11:     0x5b84d66b956c - <rustdoc[681614ec0d172b40]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[681614ec0d172b40]::visit::DocVisitor>::visit_item
  12:     0x5b84d66b96ca - <rustdoc[681614ec0d172b40]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[681614ec0d172b40]::visit::DocVisitor>::visit_item
  13:     0x5b84d66b96ca - <rustdoc[681614ec0d172b40]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[681614ec0d172b40]::visit::DocVisitor>::visit_item
  14:     0x5b84d66b5cf4 - rustdoc[681614ec0d172b40]::passes::collect_trait_impls::collect_trait_impls
  15:     0x5b84d65b1083 - rustdoc[681614ec0d172b40]::core::run_global_ctxt
  16:     0x5b84d645f0be - rustc_interface[b890ba4e2d030cf2]::passes::create_and_enter_global_ctxt::<(), rustdoc[681614ec0d172b40]::main_args::{closure#2}::{closure#0}>::{closure#2}::{closure#0}
  17:     0x5b84d646c9a9 - <rustc_interface[b890ba4e2d030cf2]::passes::create_and_enter_global_ctxt<(), rustdoc[681614ec0d172b40]::main_args::{closure#2}::{closure#0}>::{closure#2} as core[3afde4322c674bff]::ops::function::FnOnce<(&rustc_session[f34cc6760836d978]::session::Session, rustc_middle[b475e519b0252996]::ty::context::CurrentGcx, &std[9670bf84f1ec365]::sync::once_lock::OnceLock<rustc_middle[b475e519b0252996]::ty::context::GlobalCtxt>, &rustc_data_structures[ad01a8bbeb531a41]::sync::worker_local::WorkerLocal<rustc_middle[b475e519b0252996]::arena::Arena>, &rustc_data_structures[ad01a8bbeb531a41]::sync::worker_local::WorkerLocal<rustc_hir[38f3bbf9692ea739]::Arena>, rustdoc[681614ec0d172b40]::main_args::{closure#2}::{closure#0})>>::call_once::{shim:vtable#0}
  18:     0x5b84d6458908 - rustc_interface[b890ba4e2d030cf2]::interface::run_compiler::<(), rustdoc[681614ec0d172b40]::main_args::{closure#2}>::{closure#1}
  19:     0x5b84d63dde29 - std[9670bf84f1ec365]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[b890ba4e2d030cf2]::util::run_in_thread_with_globals<rustc_interface[b890ba4e2d030cf2]::util::run_in_thread_pool_with_globals<rustc_interface[b890ba4e2d030cf2]::interface::run_compiler<(), rustdoc[681614ec0d172b40]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  20:     0x5b84d64688ee - <<std[9670bf84f1ec365]::thread::Builder>::spawn_unchecked_<rustc_interface[b890ba4e2d030cf2]::util::run_in_thread_with_globals<rustc_interface[b890ba4e2d030cf2]::util::run_in_thread_pool_with_globals<rustc_interface[b890ba4e2d030cf2]::interface::run_compiler<(), rustdoc[681614ec0d172b40]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[3afde4322c674bff]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  21:     0x7db52ea5df81 - std::sys::pal::unix::thread::Thread::new::thread_start::h98893ae41d9b5d0a
  22:     0x7db528db439d - <unknown>
  23:     0x7db528e3949c - <unknown>
  24:                0x0 - <unknown>


rustc version: 1.85.0-nightly (426d17342 2024-12-21)
platform: x86_64-unknown-linux-gnu

query stack during panic:
end of query stack

@syphar
Copy link
Member

syphar commented Dec 24, 2024

Rust ICE when doing cargo docs-rs:

can you report this to the compiler repo?

@sigurd4
Copy link
Author

sigurd4 commented Dec 26, 2024

Done rust-lang/rust#134775

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants