about summary refs log tree commit diff
path: root/src/librustc
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-08-15 14:34:08 +0200
committerGitHub <noreply@github.com>2019-08-15 14:34:08 +0200
commit19d6178b8f44a8bee56b45df07116a6d490eb7d1 (patch)
treed23c56ca721e169fd0ba6026e01629482f49ed01 /src/librustc
parent77f2694fdc7fb469511e0ca485c164b9ef66f64f (diff)
parent7adb20e4cda94b9a726d99594afa506c6d40f453 (diff)
downloadrust-19d6178b8f44a8bee56b45df07116a6d490eb7d1.tar.gz
rust-19d6178b8f44a8bee56b45df07116a6d490eb7d1.zip
Rollup merge of #63582 - JohnTitor:fix-ice-63226, r=oli-obk
Fix ICE #63226

Fixes #63226

r? @oli-obk
Diffstat (limited to 'src/librustc')
-rw-r--r--src/librustc/middle/reachable.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs
index 76d8a6738f0..c2bcd462163 100644
--- a/src/librustc/middle/reachable.rs
+++ b/src/librustc/middle/reachable.rs
@@ -33,6 +33,9 @@ fn item_might_be_inlined(tcx: TyCtxt<'tcx>, item: &hir::Item, attrs: CodegenFnAt
     }
 
     match item.node {
+        hir::ItemKind::Fn(_, header, ..) if header.is_const() => {
+            return true;
+        }
         hir::ItemKind::Impl(..) |
         hir::ItemKind::Fn(..) => {
             let generics = tcx.generics_of(tcx.hir().local_def_id(item.hir_id));
@@ -52,6 +55,11 @@ fn method_might_be_inlined(
     if codegen_fn_attrs.requests_inline() || generics.requires_monomorphization(tcx) {
         return true
     }
+    if let hir::ImplItemKind::Method(method_sig, _) = &impl_item.node {
+        if method_sig.header.is_const() {
+            return true
+        }
+    }
     if let Some(impl_hir_id) = tcx.hir().as_local_hir_id(impl_src) {
         match tcx.hir().find(impl_hir_id) {
             Some(Node::Item(item)) =>