Merge #9572
9572: fix: Work around older synstructure derives r=lnicola a=flodiebold Fixes #9562, until the proper fix rust-lang/chalk#717 works which requires mystor/synstructure#47 to be released. Also add an unrelated test, for #9560. Co-authored-by: Florian Diebold <flodiebold@gmail.com>
This commit is contained in:
commit
3fc5f01f59
crates
@ -448,7 +448,12 @@ impl<'a> Ctx<'a> {
|
||||
}
|
||||
|
||||
fn lower_const(&mut self, konst: &ast::Const) -> FileItemTreeId<Const> {
|
||||
let name = konst.name().map(|it| it.as_name());
|
||||
let mut name = konst.name().map(|it| it.as_name());
|
||||
if name.as_ref().map_or(false, |n| n.to_string().starts_with("_DERIVE_")) {
|
||||
// FIXME: this is a hack to treat consts generated by synstructure as unnamed
|
||||
// remove this some time in the future
|
||||
name = None;
|
||||
}
|
||||
let type_ref = self.lower_type_ref_opt(konst.ty());
|
||||
let visibility = self.lower_visibility(konst);
|
||||
let ast_id = self.source_ast_id_map.ast_id(konst);
|
||||
|
@ -500,7 +500,7 @@ fn main() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn coerce_unsize_expected_type() {
|
||||
fn coerce_unsize_expected_type_1() {
|
||||
check_no_mismatches(
|
||||
r#"
|
||||
//- minicore: coerce_unsized
|
||||
@ -520,6 +520,32 @@ fn main() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn coerce_unsize_expected_type_2() {
|
||||
// FIXME: this is wrong, #9560
|
||||
check(
|
||||
r#"
|
||||
//- minicore: coerce_unsized
|
||||
struct InFile<T>;
|
||||
impl<T> InFile<T> {
|
||||
fn with_value<U>(self, value: U) -> InFile<U> { InFile }
|
||||
}
|
||||
struct RecordField;
|
||||
trait AstNode {}
|
||||
impl AstNode for RecordField {}
|
||||
|
||||
fn takes_dyn(it: InFile<&dyn AstNode>) {}
|
||||
|
||||
fn test() {
|
||||
let x: InFile<()> = InFile;
|
||||
let n = &RecordField;
|
||||
takes_dyn(x.with_value(n));
|
||||
// ^^^^^^^^^^^^^^^ expected InFile<&dyn AstNode>, got InFile<&RecordField>
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn coerce_array_elems_lub() {
|
||||
check_no_mismatches(
|
||||
|
Loading…
x
Reference in New Issue
Block a user