about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlex Burka <aburka@seas.upenn.edu>2016-01-13 01:27:07 -0500
committerAlex Burka <aburka@seas.upenn.edu>2016-02-27 02:01:41 -0500
commitbd3197c748e7bfa652fb636fbb78fa7a42d826ca (patch)
tree3aa37cd62129b8d7b936479141a8c87ca645b2ab /src
parentd792183fdeea5623c7ec909d5aa2eccf9171582c (diff)
downloadrust-bd3197c748e7bfa652fb636fbb78fa7a42d826ca.tar.gz
rust-bd3197c748e7bfa652fb636fbb78fa7a42d826ca.zip
remove range lang items
The range desugaring does not use the lang items. Hence I did not add
lang items for inclusive ranges. This cleanup commit removes the old
unused ones as well.

Whether the desugaring _should_ use lang items is another question:
see #30809. But if we decide on a strategy there we can add back these
lang items, and new ones for inclusive ranges.

For stage0 we need to keep the attributes as the lang items still exist
even if they are never used.

This is surprisingly not a breaking change. Unused #[lang] attributes do
not even trigger a lint (see #30881).
Diffstat (limited to 'src')
-rw-r--r--src/libcore/ops.rs8
-rw-r--r--src/librustc/middle/lang_items.rs4
-rw-r--r--src/librustc_typeck/diagnostics.rs4
3 files changed, 6 insertions, 10 deletions
diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs
index cf8f4279a1d..b5bec316947 100644
--- a/src/libcore/ops.rs
+++ b/src/libcore/ops.rs
@@ -1468,7 +1468,7 @@ pub trait IndexMut<Idx: ?Sized>: Index<Idx> {
 
 /// An unbounded range.
 #[derive(Copy, Clone, PartialEq, Eq)]
-#[lang = "range_full"]
+#[cfg_attr(stage0, lang = "range_full")] // TODO remove attribute after next snapshot
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct RangeFull;
 
@@ -1481,7 +1481,7 @@ impl fmt::Debug for RangeFull {
 
 /// A (half-open) range which is bounded at both ends.
 #[derive(Clone, PartialEq, Eq)]
-#[lang = "range"]
+#[cfg_attr(stage0, lang = "range")] // TODO remove attribute after next snapshot
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct Range<Idx> {
     /// The lower bound of the range (inclusive).
@@ -1501,7 +1501,7 @@ impl<Idx: fmt::Debug> fmt::Debug for Range<Idx> {
 
 /// A range which is only bounded below.
 #[derive(Clone, PartialEq, Eq)]
-#[lang = "range_from"]
+#[cfg_attr(stage0, lang = "range_from")] // TODO remove attribute after next snapshot
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct RangeFrom<Idx> {
     /// The lower bound of the range (inclusive).
@@ -1518,7 +1518,7 @@ impl<Idx: fmt::Debug> fmt::Debug for RangeFrom<Idx> {
 
 /// A range which is only bounded above.
 #[derive(Copy, Clone, PartialEq, Eq)]
-#[lang = "range_to"]
+#[cfg_attr(stage0, lang = "range_to")] // TODO remove attribute after next snapshot
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct RangeTo<Idx> {
     /// The upper bound of the range (exclusive).
diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs
index 6cbb90627ea..8d407d0aa44 100644
--- a/src/librustc/middle/lang_items.rs
+++ b/src/librustc/middle/lang_items.rs
@@ -302,10 +302,6 @@ lets_do_this! {
     ShrAssignTraitLangItem,          "shr_assign",              shr_assign_trait;
     IndexTraitLangItem,              "index",                   index_trait;
     IndexMutTraitLangItem,           "index_mut",               index_mut_trait;
-    RangeStructLangItem,             "range",                   range_struct;
-    RangeFromStructLangItem,         "range_from",              range_from_struct;
-    RangeToStructLangItem,           "range_to",                range_to_struct;
-    RangeFullStructLangItem,         "range_full",              range_full_struct;
 
     UnsafeCellTypeLangItem,          "unsafe_cell",             unsafe_cell_type;
 
diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs
index 0ff6dcccde6..01f7d6b4565 100644
--- a/src/librustc_typeck/diagnostics.rs
+++ b/src/librustc_typeck/diagnostics.rs
@@ -3643,8 +3643,8 @@ register_diagnostics! {
 //  E0233,
 //  E0234,
 //  E0235, // structure constructor specifies a structure of type but
-    E0236, // no lang item for range syntax
-    E0237, // no lang item for range syntax
+//  E0236, // no lang item for range syntax
+//  E0237, // no lang item for range syntax
     E0238, // parenthesized parameters may only be used with a trait
 //  E0239, // `next` method of `Iterator` trait has unexpected type
 //  E0240,