Skip to content

another default method ICE involving missing item ids in the AST map #7675

@thestinger

Description

@thestinger

error: internal compiler error: type_uses_for: unbound item ID {crate: 0, node: 514135}

Here's a patch to trigger it:

diff --git a/src/libstd/container.rs b/src/libstd/container.rs
index d6f4c26..4cb52f0 100644
--- a/src/libstd/container.rs
+++ b/src/libstd/container.rs
@@ -19,7 +19,7 @@ pub trait Container {
     fn len(&self) -> uint;

     /// Return true if the container contains no elements
-    fn is_empty(&self) -> bool;
+    fn is_empty(&self) -> bool { self.len() == 0 }
 }

 /// A trait to represent mutable containers
diff --git a/src/libstd/hashmap.rs b/src/libstd/hashmap.rs
index 6c93cd0..87e5082 100644
--- a/src/libstd/hashmap.rs
+++ b/src/libstd/hashmap.rs
@@ -285,9 +285,6 @@ impl<K:Hash + Eq,V> HashMap<K, V> {
 impl<K:Hash + Eq,V> Container for HashMap<K, V> {
     /// Return the number of elements in the map
     fn len(&self) -> uint { self.size }
-
-    /// Return true if the map contains no elements
-    fn is_empty(&self) -> bool { self.len() == 0 }
 }

 impl<K:Hash + Eq,V> Mutable for HashMap<K, V> {
diff --git a/src/libstd/iterator.rs b/src/libstd/iterator.rs
index 4f5f1bd..cffedd9 100644
--- a/src/libstd/iterator.rs
+++ b/src/libstd/iterator.rs
@@ -17,8 +17,6 @@ implementing the `Iterator` trait.

 */

-#[allow(default_methods)]; // solid enough for the use case here
-
 use cmp;
 use iter::Times;
 use num::{Zero, One};
diff --git a/src/libstd/std.rs b/src/libstd/std.rs
index 8f86216..b71d66c 100644
--- a/src/libstd/std.rs
+++ b/src/libstd/std.rs
@@ -60,6 +60,7 @@ they contained the following prologue:
 // Don't link to std. We are std.
 #[no_std];

+#[allow(default_methods)];
 #[deny(non_camel_case_types)];
 #[deny(missing_doc)];

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frontendArea: Compiler frontend (errors, parsing and HIR)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions