Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/mir/lower/tests.rs')
-rw-r--r--crates/hir-ty/src/mir/lower/tests.rs51
1 files changed, 51 insertions, 0 deletions
diff --git a/crates/hir-ty/src/mir/lower/tests.rs b/crates/hir-ty/src/mir/lower/tests.rs
new file mode 100644
index 0000000000..38fc7ad78a
--- /dev/null
+++ b/crates/hir-ty/src/mir/lower/tests.rs
@@ -0,0 +1,51 @@
+use test_fixture::WithFixture;
+
+use crate::{db::HirDatabase, setup_tracing, test_db::TestDB};
+
+fn lower_mir(#[rust_analyzer::rust_fixture] ra_fixture: &str) {
+ let _tracing = setup_tracing();
+ let (db, file_ids) = TestDB::with_many_files(ra_fixture);
+ crate::attach_db(&db, || {
+ let file_id = *file_ids.last().unwrap();
+ let module_id = db.module_for_file(file_id.file_id(&db));
+ let def_map = module_id.def_map(&db);
+ let scope = &def_map[module_id.local_id].scope;
+ let funcs = scope.declarations().filter_map(|x| match x {
+ hir_def::ModuleDefId::FunctionId(it) => Some(it),
+ _ => None,
+ });
+ for func in funcs {
+ _ = db.mir_body(func.into());
+ }
+ })
+}
+
+#[test]
+fn dyn_projection_with_auto_traits_regression_next_solver() {
+ lower_mir(
+ r#"
+//- minicore: sized, send
+pub trait Deserializer {}
+
+pub trait Strictest {
+ type Object: ?Sized;
+}
+
+impl Strictest for dyn CustomValue {
+ type Object = dyn CustomValue + Send;
+}
+
+pub trait CustomValue: Send {}
+
+impl CustomValue for () {}
+
+struct Box<T: ?Sized>;
+
+type DeserializeFn<T> = fn(&mut dyn Deserializer) -> Box<T>;
+
+fn foo() {
+ (|deserializer| Box::new(())) as DeserializeFn<<dyn CustomValue as Strictest>::Object>;
+}
+ "#,
+ );
+}