Closed
Description
Code
#![feature(generic_associated_types)]
trait Monad {
type Unwrapped;
type Wrapped<B>;
fn bind<B, F>(self, f: F) -> Self::Wrapped<B> {
todo!()
}
}
fn join<MOuter, MInner, A>(outer: MOuter) -> MOuter::Wrapped<A>
where
MOuter: Monad<Unwrapped = MInner>,
MInner: Monad<Unwrapped = A, Wrapped = MOuter::Wrapped<A>>,
{
outer.bind(|inner| inner)
}
fn main() {
assert_eq!(join(Some(Some(true))), Some(true));
}
Meta
rustc --version --verbose
:
rustc 1.50.0-nightly (b7ebc6b0c 2020-11-30)
binary: rustc
commit-hash: b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18
commit-date: 2020-11-30
host: x86_64-pc-windows-msvc
release: 1.50.0-nightly
Error output
warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
--> join.rs:1:12
|
1 | #![feature(generic_associated_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
error: internal compiler error: compiler\rustc_middle\src\ty\subst.rs:529:17: type parameter `B/#1` (B/1) out of range when substituting, substs=[MInner]
thread 'rustc' panicked at 'Box<Any>', /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18\compiler\rustc_errors\src\lib.rs:904:9
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.50.0-nightly (b7ebc6b0c 2020-11-30) running on x86_64-pc-windows-msvc
query stack during panic:
#0 [check_item_well_formed] checking that `join` is well-formed
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error; 1 warning emitted
Notes
I recognize this is an unstable compiler feature, and have no problem if it would be better to just close this. Also, if it would be better to include this report elsewhere, please let me know.
Metadata
Metadata
Assignees
Labels
Area: Generic associated types (GATs)Category: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.`#![feature(generic_associated_types)]` a.k.a. GATsIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.