Fix TyKind::is_simple_path
.
PR #98758 introduced code to avoid redundant assertions in derived code like this: ``` let _: ::core::clone::AssertParamIsClone<u32>; let _: ::core::clone::AssertParamIsClone<u32>; ``` But the predicate `is_simple_path` introduced as part of this failed to account for generic arguments. Therefore the deriving code erroneously considers types like `Option<bool>` and `Option<f32>` to be the same. This commit fixes `is_simple_path`. Fixes #103157.
This commit is contained in:
parent
dfa9d5c971
commit
9a23f60f9c
4 changed files with 49 additions and 2 deletions
|
@ -2060,8 +2060,11 @@ impl TyKind {
|
|||
}
|
||||
|
||||
pub fn is_simple_path(&self) -> Option<Symbol> {
|
||||
if let TyKind::Path(None, Path { segments, .. }) = &self && segments.len() == 1 {
|
||||
Some(segments[0].ident.name)
|
||||
if let TyKind::Path(None, Path { segments, .. }) = &self
|
||||
&& let [segment] = &segments[..]
|
||||
&& segment.args.is_none()
|
||||
{
|
||||
Some(segment.ident.name)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue