diff options
| author | Michael Goulet <michael@errs.io> | 2023-08-21 22:39:34 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-09-19 05:42:23 +0000 |
| commit | a30ad3a5a6362c31b16d3bd3f21bbae1315bfaec (patch) | |
| tree | 5dedf5cc643e184ade7eb3da7d05e6d0990e02aa /compiler/rustc_middle | |
| parent | 55ce976e06e1dc9590a41cdc262688d4db8d93e4 (diff) | |
Don't resolve generic instances if they may be shadowed by dyn
Diffstat (limited to 'compiler/rustc_middle')
| -rw-r--r-- | compiler/rustc_middle/src/ty/sty.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index edab7fe58ba..a14d09bbb70 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -2945,6 +2945,33 @@ impl<'tcx> Ty<'tcx> { _ => false, } } + + pub fn is_known_rigid(self) -> bool { + match self.kind() { + Bool + | Char + | Int(_) + | Uint(_) + | Float(_) + | Adt(_, _) + | Foreign(_) + | Str + | Array(_, _) + | Slice(_) + | RawPtr(_) + | Ref(_, _, _) + | FnDef(_, _) + | FnPtr(_) + | Dynamic(_, _, _) + | Closure(_, _) + | Generator(_, _, _) + | GeneratorWitness(_) + | GeneratorWitnessMIR(_, _) + | Never + | Tuple(_) => true, + Error(_) | Infer(_) | Alias(_, _) | Param(_) | Bound(_, _) | Placeholder(_) => false, + } + } } /// Extra information about why we ended up with a particular variance. |
