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).
This commit is contained in:
parent
d792183fde
commit
bd3197c748
@ -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).
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user