mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-27 18:26:19 +00:00
Merge pull request #19127 from ChayimFriedman2/different-generic-args
feat: Refactor path lowering and serve a new path diagnostic
This commit is contained in:
commit
09db657439
19 changed files with 1222 additions and 1144 deletions
|
|
@ -250,6 +250,7 @@ bitflags::bitflags! {
|
|||
const RUSTC_HAS_INCOHERENT_INHERENT_IMPLS = 1 << 3;
|
||||
const SKIP_ARRAY_DURING_METHOD_DISPATCH = 1 << 4;
|
||||
const SKIP_BOXED_SLICE_DURING_METHOD_DISPATCH = 1 << 5;
|
||||
const RUSTC_PAREN_SUGAR = 1 << 6;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -294,6 +295,9 @@ impl TraitData {
|
|||
if attrs.by_key(&sym::rustc_has_incoherent_inherent_impls).exists() {
|
||||
flags |= TraitFlags::RUSTC_HAS_INCOHERENT_INHERENT_IMPLS;
|
||||
}
|
||||
if attrs.by_key(&sym::rustc_paren_sugar).exists() {
|
||||
flags |= TraitFlags::RUSTC_PAREN_SUGAR;
|
||||
}
|
||||
|
||||
let mut skip_array_during_method_dispatch =
|
||||
attrs.by_key(&sym::rustc_skip_array_during_method_dispatch).exists();
|
||||
|
|
|
|||
|
|
@ -173,10 +173,7 @@ impl Path {
|
|||
segments: path.mod_path().segments(),
|
||||
generic_args: Some(path.generic_args()),
|
||||
},
|
||||
Path::LangItem(_, seg) => PathSegments {
|
||||
segments: seg.as_ref().map_or(&[], |seg| std::slice::from_ref(seg)),
|
||||
generic_args: None,
|
||||
},
|
||||
Path::LangItem(_, seg) => PathSegments { segments: seg.as_slice(), generic_args: None },
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -240,6 +237,11 @@ pub struct PathSegment<'a> {
|
|||
pub args_and_bindings: Option<&'a GenericArgs>,
|
||||
}
|
||||
|
||||
impl PathSegment<'_> {
|
||||
pub const MISSING: PathSegment<'static> =
|
||||
PathSegment { name: &Name::missing(), args_and_bindings: None };
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct PathSegments<'a> {
|
||||
segments: &'a [Name],
|
||||
|
|
|
|||
|
|
@ -327,8 +327,9 @@ impl Resolver {
|
|||
| LangItemTarget::ImplDef(_)
|
||||
| LangItemTarget::Static(_) => return None,
|
||||
};
|
||||
// Remaining segments start from 0 because lang paths have no segments other than the remaining.
|
||||
return Some((
|
||||
ResolveValueResult::Partial(type_ns, 1, None),
|
||||
ResolveValueResult::Partial(type_ns, 0, None),
|
||||
ResolvePathResultPrefixInfo::default(),
|
||||
));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue