about summary refs log tree commit diff
path: root/src/librustc/traits
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-03-25 19:28:09 +0100
committerGitHub <noreply@github.com>2020-03-25 19:28:09 +0100
commit1154023118c81237fad4498d9ddbaf277fe41ab5 (patch)
treed22a9408ecd1deb8bbf59815f97b8c1cd8a7fa80 /src/librustc/traits
parent97f0a9ef8d3a563eeae1966ff5549400783d8e1f (diff)
parentf8e3da5ea22268dd9f7ff61c133aca3e8c64206f (diff)
downloadrust-1154023118c81237fad4498d9ddbaf277fe41ab5.tar.gz
rust-1154023118c81237fad4498d9ddbaf277fe41ab5.zip
Rollup merge of #70319 - lcnr:issue63695, r=eddyb
correctly normalize constants

closes #70317

implements https://github.com/rust-lang/rust/issues/70125#issuecomment-602133708

r? eddyb cc @varkor
Diffstat (limited to 'src/librustc/traits')
-rw-r--r--src/librustc/traits/structural_impls.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/librustc/traits/structural_impls.rs b/src/librustc/traits/structural_impls.rs
index a5efea9e5fa..b1fb02a67b3 100644
--- a/src/librustc/traits/structural_impls.rs
+++ b/src/librustc/traits/structural_impls.rs
@@ -273,6 +273,20 @@ impl<'tcx> TypeVisitor<'tcx> for BoundNamesCollector {
         t.super_visit_with(self)
     }
 
+    fn visit_const(&mut self, c: &'tcx ty::Const<'tcx>) -> bool {
+        match c.val {
+            ty::ConstKind::Bound(debruijn, bound_var) if debruijn == self.binder_index => {
+                self.types.insert(
+                    bound_var.as_u32(),
+                    Symbol::intern(&format!("^{}", bound_var.as_u32())),
+                );
+            }
+            _ => (),
+        }
+
+        c.super_visit_with(self)
+    }
+
     fn visit_region(&mut self, r: ty::Region<'tcx>) -> bool {
         match r {
             ty::ReLateBound(index, br) if *index == self.binder_index => match br {