Fallback to primitive when path doesn't resolve

This commit is contained in:
Jonas Schievink 2022-04-14 15:51:38 +02:00
parent 63573d47aa
commit d764e134d5
3 changed files with 39 additions and 0 deletions

View file

@ -1767,3 +1767,26 @@ fn foo() {
"#,
);
}
#[test]
fn primitive_assoc_fn_shadowed_by_use() {
check_types(
r#"
//- /lib.rs crate:lib deps:core
use core::u16;
fn f() -> u16 {
let x = u16::from_le_bytes();
x
//^ u16
}
//- /core.rs crate:core
pub mod u16 {}
impl u16 {
pub fn from_le_bytes() -> Self { 0 }
}
"#,
)
}