allow trait alias DefIds in implements_trait_with_env_from_iter
This commit is contained in:
parent
b5bfd1176b
commit
f746e19169
@ -5,6 +5,7 @@
|
|||||||
#![feature(lint_reasons)]
|
#![feature(lint_reasons)]
|
||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
#![feature(rustc_private)]
|
#![feature(rustc_private)]
|
||||||
|
#![feature(assert_matches)]
|
||||||
#![recursion_limit = "512"]
|
#![recursion_limit = "512"]
|
||||||
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
|
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
|
||||||
#![allow(clippy::missing_errors_doc, clippy::missing_panics_doc, clippy::must_use_candidate)]
|
#![allow(clippy::missing_errors_doc, clippy::missing_panics_doc, clippy::must_use_candidate)]
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _;
|
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _;
|
||||||
use rustc_trait_selection::traits::query::normalize::QueryNormalizeExt;
|
use rustc_trait_selection::traits::query::normalize::QueryNormalizeExt;
|
||||||
use rustc_trait_selection::traits::{Obligation, ObligationCause};
|
use rustc_trait_selection::traits::{Obligation, ObligationCause};
|
||||||
|
use std::assert_matches::debug_assert_matches;
|
||||||
use std::iter;
|
use std::iter;
|
||||||
|
|
||||||
use crate::{match_def_path, path_res, paths};
|
use crate::{match_def_path, path_res, paths};
|
||||||
@ -259,7 +260,11 @@ pub fn implements_trait_with_env_from_iter<'tcx>(
|
|||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
|
|
||||||
debug_assert_eq!(tcx.def_kind(trait_id), DefKind::Trait);
|
debug_assert_matches!(
|
||||||
|
tcx.def_kind(trait_id),
|
||||||
|
DefKind::Trait | DefKind::TraitAlias,
|
||||||
|
"`DefId` must belong to a trait or trait alias"
|
||||||
|
);
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
assert_generic_args_match(tcx, trait_id, trait_ref.args);
|
assert_generic_args_match(tcx, trait_id, trait_ref.args);
|
||||||
|
|
||||||
|
9
tests/ui/crashes/ice-11337.rs
Normal file
9
tests/ui/crashes/ice-11337.rs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#![feature(trait_alias)]
|
||||||
|
|
||||||
|
trait Confusing<F> = Fn(i32) where F: Fn(u32);
|
||||||
|
|
||||||
|
fn alias<T: Confusing<F>, F>(_: T, _: F) {}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
alias(|_| {}, |_| {});
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user