Skip to content

Commit fbcd534

Browse files
committed
Rollup merge of #25251 - nham:whitespace_lang_items, r=Manishearth
In my opinion this looks nicer, but also it matches the whitespace generally used for stability markers.
2 parents 1f1348e + 7984074 commit fbcd534

File tree

12 files changed

+48
-48
lines changed

12 files changed

+48
-48
lines changed

src/doc/reference.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2028,7 +2028,7 @@ makes it possible to declare these operations. For example, the `str` module
20282028
in the Rust standard library defines the string equality function:
20292029

20302030
```{.ignore}
2031-
#[lang="str_eq"]
2031+
#[lang = "str_eq"]
20322032
pub fn eq_slice(a: &str, b: &str) -> bool {
20332033
// details elided
20342034
}

src/doc/trpl/lang-items.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
The `rustc` compiler has certain pluggable operations, that is,
88
functionality that isn't hard-coded into the language, but is
99
implemented in libraries, with a special marker to tell the compiler
10-
it exists. The marker is the attribute `#[lang="..."]` and there are
10+
it exists. The marker is the attribute `#[lang = "..."]` and there are
1111
various different values of `...`, i.e. various different 'lang
1212
items'.
1313

@@ -28,7 +28,7 @@ extern {
2828
#[lang = "owned_box"]
2929
pub struct Box<T>(*mut T);
3030
31-
#[lang="exchange_malloc"]
31+
#[lang = "exchange_malloc"]
3232
unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
3333
let p = libc::malloc(size as libc::size_t) as *mut u8;
3434
@@ -39,7 +39,7 @@ unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
3939
4040
p
4141
}
42-
#[lang="exchange_free"]
42+
#[lang = "exchange_free"]
4343
unsafe fn deallocate(ptr: *mut u8, _size: usize, _align: usize) {
4444
libc::free(ptr as *mut libc::c_void)
4545
}

src/liballoc/heap.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pub const EMPTY: *mut () = 0x1 as *mut ();
9595

9696
/// The allocator for unique pointers.
9797
#[cfg(not(test))]
98-
#[lang="exchange_malloc"]
98+
#[lang = "exchange_malloc"]
9999
#[inline]
100100
unsafe fn exchange_malloc(size: usize, align: usize) -> *mut u8 {
101101
if size == 0 {
@@ -108,7 +108,7 @@ unsafe fn exchange_malloc(size: usize, align: usize) -> *mut u8 {
108108
}
109109

110110
#[cfg(not(test))]
111-
#[lang="exchange_free"]
111+
#[lang = "exchange_free"]
112112
#[inline]
113113
unsafe fn exchange_free(ptr: *mut u8, old_size: usize, align: usize) {
114114
deallocate(ptr, old_size, align);

src/libcore/cell.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ impl<'b, T: ?Sized> DerefMut for RefMut<'b, T> {
634634
///
635635
/// **NOTE:** `UnsafeCell<T>`'s fields are public to allow static initializers. It is not
636636
/// recommended to access its fields directly, `get` should be used instead.
637-
#[lang="unsafe_cell"]
637+
#[lang = "unsafe_cell"]
638638
#[stable(feature = "rust1", since = "1.0.0")]
639639
pub struct UnsafeCell<T: ?Sized> {
640640
/// Wrapped value

src/libcore/cmp.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ use option::Option::{self, Some, None};
4141
/// PartialEq only requires the `eq` method to be implemented; `ne` is defined in terms of it by
4242
/// default. Any manual implementation of `ne` *must* respect the rule that `eq` is a strict
4343
/// inverse of `ne`; that is, `!(a == b)` if and only if `a != b`.
44-
#[lang="eq"]
44+
#[lang = "eq"]
4545
#[stable(feature = "rust1", since = "1.0.0")]
4646
pub trait PartialEq<Rhs: ?Sized = Self> {
4747
/// This method tests for `self` and `other` values to be equal, and is used by `==`.
@@ -222,7 +222,7 @@ impl PartialOrd for Ordering {
222222
/// However it remains possible to implement the others separately for types which do not have a
223223
/// total order. For example, for floating point numbers, `NaN < 0 == false` and `NaN >= 0 ==
224224
/// false` (cf. IEEE 754-2008 section 5.11).
225-
#[lang="ord"]
225+
#[lang = "ord"]
226226
#[stable(feature = "rust1", since = "1.0.0")]
227227
pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
228228
/// This method returns an ordering between `self` and `other` values if one exists.

src/libcore/iter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ fn _assert_is_object_safe(_: &Iterator<Item=()>) {}
8282
/// is returned. A concrete Iterator implementation may choose to behave however
8383
/// it wishes, either by returning `None` infinitely, or by doing something
8484
/// else.
85-
#[lang="iterator"]
85+
#[lang = "iterator"]
8686
#[stable(feature = "rust1", since = "1.0.0")]
8787
#[rustc_on_unimplemented = "`{Self}` is not an iterator; maybe try calling \
8888
`.iter()` or a similar method"]

src/libcore/marker.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use hash::Hasher;
3333

3434
/// Types able to be transferred across thread boundaries.
3535
#[stable(feature = "rust1", since = "1.0.0")]
36-
#[lang="send"]
36+
#[lang = "send"]
3737
#[rustc_on_unimplemented = "`{Self}` cannot be sent between threads safely"]
3838
pub unsafe trait Send {
3939
// empty.
@@ -46,7 +46,7 @@ impl<T> !Send for *mut T { }
4646

4747
/// Types with a constant size known at compile-time.
4848
#[stable(feature = "rust1", since = "1.0.0")]
49-
#[lang="sized"]
49+
#[lang = "sized"]
5050
#[rustc_on_unimplemented = "`{Self}` does not have a constant size known at compile-time"]
5151
#[fundamental] // for Default, for example, which requires that `[T]: !Default` be evaluatable
5252
pub trait Sized {
@@ -154,7 +154,7 @@ pub trait Sized {
154154
/// then it might be prudent to not implement `Copy`. This is because removing `Copy` is a breaking
155155
/// change: that second example would fail to compile if we made `Foo` non-`Copy`.
156156
#[stable(feature = "rust1", since = "1.0.0")]
157-
#[lang="copy"]
157+
#[lang = "copy"]
158158
pub trait Copy : Clone {
159159
// Empty.
160160
}
@@ -201,7 +201,7 @@ pub trait Copy : Clone {
201201
/// reference; not doing this is undefined behaviour (for example,
202202
/// `transmute`-ing from `&T` to `&mut T` is illegal).
203203
#[stable(feature = "rust1", since = "1.0.0")]
204-
#[lang="sync"]
204+
#[lang = "sync"]
205205
#[rustc_on_unimplemented = "`{Self}` cannot be shared between threads safely"]
206206
pub unsafe trait Sync {
207207
// Empty
@@ -217,7 +217,7 @@ impl<T> !Sync for *mut T { }
217217
/// ensure that they are never copied, even if they lack a destructor.
218218
#[unstable(feature = "core",
219219
reason = "likely to change with new variance strategy")]
220-
#[lang="no_copy_bound"]
220+
#[lang = "no_copy_bound"]
221221
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
222222
pub struct NoCopy;
223223

@@ -359,7 +359,7 @@ macro_rules! impls{
359359
/// better to use a reference type, like `PhantomData<&'a T>`
360360
/// (ideally) or `PhantomData<*const T>` (if no lifetime applies), so
361361
/// as not to indicate ownership.
362-
#[lang="phantom_data"]
362+
#[lang = "phantom_data"]
363363
#[stable(feature = "rust1", since = "1.0.0")]
364364
pub struct PhantomData<T:?Sized>;
365365

src/libcore/nonzero.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ unsafe impl Zeroable for u64 {}
3131

3232
/// A wrapper type for raw pointers and integers that will never be
3333
/// NULL or 0 that might allow certain optimizations.
34-
#[lang="non_zero"]
34+
#[lang = "non_zero"]
3535
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
3636
#[unstable(feature = "core")]
3737
pub struct NonZero<T: Zeroable>(T);

src/libcore/ops.rs

+24-24
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ use fmt;
9191
/// let _x = HasDrop;
9292
/// }
9393
/// ```
94-
#[lang="drop"]
94+
#[lang = "drop"]
9595
#[stable(feature = "rust1", since = "1.0.0")]
9696
pub trait Drop {
9797
/// The `drop` method, called when the value goes out of scope.
@@ -181,7 +181,7 @@ macro_rules! forward_ref_binop {
181181
/// Foo + Foo;
182182
/// }
183183
/// ```
184-
#[lang="add"]
184+
#[lang = "add"]
185185
#[stable(feature = "rust1", since = "1.0.0")]
186186
pub trait Add<RHS=Self> {
187187
/// The resulting type after applying the `+` operator
@@ -235,7 +235,7 @@ add_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
235235
/// Foo - Foo;
236236
/// }
237237
/// ```
238-
#[lang="sub"]
238+
#[lang = "sub"]
239239
#[stable(feature = "rust1", since = "1.0.0")]
240240
pub trait Sub<RHS=Self> {
241241
/// The resulting type after applying the `-` operator
@@ -289,7 +289,7 @@ sub_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
289289
/// Foo * Foo;
290290
/// }
291291
/// ```
292-
#[lang="mul"]
292+
#[lang = "mul"]
293293
#[stable(feature = "rust1", since = "1.0.0")]
294294
pub trait Mul<RHS=Self> {
295295
/// The resulting type after applying the `*` operator
@@ -343,7 +343,7 @@ mul_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
343343
/// Foo / Foo;
344344
/// }
345345
/// ```
346-
#[lang="div"]
346+
#[lang = "div"]
347347
#[stable(feature = "rust1", since = "1.0.0")]
348348
pub trait Div<RHS=Self> {
349349
/// The resulting type after applying the `/` operator
@@ -397,7 +397,7 @@ div_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
397397
/// Foo % Foo;
398398
/// }
399399
/// ```
400-
#[lang="rem"]
400+
#[lang = "rem"]
401401
#[stable(feature = "rust1", since = "1.0.0")]
402402
pub trait Rem<RHS=Self> {
403403
/// The resulting type after applying the `%` operator
@@ -470,7 +470,7 @@ rem_float_impl! { f64, fmod }
470470
/// -Foo;
471471
/// }
472472
/// ```
473-
#[lang="neg"]
473+
#[lang = "neg"]
474474
#[stable(feature = "rust1", since = "1.0.0")]
475475
pub trait Neg {
476476
/// The resulting type after applying the `-` operator
@@ -541,7 +541,7 @@ neg_impl_numeric! { isize i8 i16 i32 i64 f32 f64 }
541541
/// !Foo;
542542
/// }
543543
/// ```
544-
#[lang="not"]
544+
#[lang = "not"]
545545
#[stable(feature = "rust1", since = "1.0.0")]
546546
pub trait Not {
547547
/// The resulting type after applying the `!` operator
@@ -595,7 +595,7 @@ not_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
595595
/// Foo & Foo;
596596
/// }
597597
/// ```
598-
#[lang="bitand"]
598+
#[lang = "bitand"]
599599
#[stable(feature = "rust1", since = "1.0.0")]
600600
pub trait BitAnd<RHS=Self> {
601601
/// The resulting type after applying the `&` operator
@@ -649,7 +649,7 @@ bitand_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
649649
/// Foo | Foo;
650650
/// }
651651
/// ```
652-
#[lang="bitor"]
652+
#[lang = "bitor"]
653653
#[stable(feature = "rust1", since = "1.0.0")]
654654
pub trait BitOr<RHS=Self> {
655655
/// The resulting type after applying the `|` operator
@@ -703,7 +703,7 @@ bitor_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
703703
/// Foo ^ Foo;
704704
/// }
705705
/// ```
706-
#[lang="bitxor"]
706+
#[lang = "bitxor"]
707707
#[stable(feature = "rust1", since = "1.0.0")]
708708
pub trait BitXor<RHS=Self> {
709709
/// The resulting type after applying the `^` operator
@@ -757,7 +757,7 @@ bitxor_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
757757
/// Foo << Foo;
758758
/// }
759759
/// ```
760-
#[lang="shl"]
760+
#[lang = "shl"]
761761
#[stable(feature = "rust1", since = "1.0.0")]
762762
pub trait Shl<RHS> {
763763
/// The resulting type after applying the `<<` operator
@@ -829,7 +829,7 @@ shl_impl_all! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize }
829829
/// Foo >> Foo;
830830
/// }
831831
/// ```
832-
#[lang="shr"]
832+
#[lang = "shr"]
833833
#[stable(feature = "rust1", since = "1.0.0")]
834834
pub trait Shr<RHS> {
835835
/// The resulting type after applying the `>>` operator
@@ -902,7 +902,7 @@ shr_impl_all! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize }
902902
/// Foo[Bar];
903903
/// }
904904
/// ```
905-
#[lang="index"]
905+
#[lang = "index"]
906906
#[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Idx}`"]
907907
#[stable(feature = "rust1", since = "1.0.0")]
908908
pub trait Index<Idx: ?Sized> {
@@ -949,7 +949,7 @@ pub trait Index<Idx: ?Sized> {
949949
/// &mut Foo[Bar];
950950
/// }
951951
/// ```
952-
#[lang="index_mut"]
952+
#[lang = "index_mut"]
953953
#[rustc_on_unimplemented = "the type `{Self}` cannot be mutably indexed by `{Idx}`"]
954954
#[stable(feature = "rust1", since = "1.0.0")]
955955
pub trait IndexMut<Idx: ?Sized>: Index<Idx> {
@@ -960,7 +960,7 @@ pub trait IndexMut<Idx: ?Sized>: Index<Idx> {
960960

961961
/// An unbounded range.
962962
#[derive(Copy, Clone, PartialEq, Eq)]
963-
#[lang="range_full"]
963+
#[lang = "range_full"]
964964
#[stable(feature = "rust1", since = "1.0.0")]
965965
pub struct RangeFull;
966966

@@ -973,7 +973,7 @@ impl fmt::Debug for RangeFull {
973973

974974
/// A (half-open) range which is bounded at both ends.
975975
#[derive(Clone, PartialEq, Eq)]
976-
#[lang="range"]
976+
#[lang = "range"]
977977
#[stable(feature = "rust1", since = "1.0.0")]
978978
pub struct Range<Idx> {
979979
/// The lower bound of the range (inclusive).
@@ -993,7 +993,7 @@ impl<Idx: fmt::Debug> fmt::Debug for Range<Idx> {
993993

994994
/// A range which is only bounded below.
995995
#[derive(Clone, PartialEq, Eq)]
996-
#[lang="range_from"]
996+
#[lang = "range_from"]
997997
#[stable(feature = "rust1", since = "1.0.0")]
998998
pub struct RangeFrom<Idx> {
999999
/// The lower bound of the range (inclusive).
@@ -1010,7 +1010,7 @@ impl<Idx: fmt::Debug> fmt::Debug for RangeFrom<Idx> {
10101010

10111011
/// A range which is only bounded above.
10121012
#[derive(Copy, Clone, PartialEq, Eq)]
1013-
#[lang="range_to"]
1013+
#[lang = "range_to"]
10141014
#[stable(feature = "rust1", since = "1.0.0")]
10151015
pub struct RangeTo<Idx> {
10161016
/// The upper bound of the range (exclusive).
@@ -1053,7 +1053,7 @@ impl<Idx: fmt::Debug> fmt::Debug for RangeTo<Idx> {
10531053
/// assert_eq!('a', *x);
10541054
/// }
10551055
/// ```
1056-
#[lang="deref"]
1056+
#[lang = "deref"]
10571057
#[stable(feature = "rust1", since = "1.0.0")]
10581058
pub trait Deref {
10591059
/// The resulting type after dereferencing
@@ -1114,7 +1114,7 @@ impl<'a, T: ?Sized> Deref for &'a mut T {
11141114
/// assert_eq!('b', *x);
11151115
/// }
11161116
/// ```
1117-
#[lang="deref_mut"]
1117+
#[lang = "deref_mut"]
11181118
#[stable(feature = "rust1", since = "1.0.0")]
11191119
pub trait DerefMut: Deref {
11201120
/// The method called to mutably dereference a value
@@ -1128,7 +1128,7 @@ impl<'a, T: ?Sized> DerefMut for &'a mut T {
11281128
}
11291129

11301130
/// A version of the call operator that takes an immutable receiver.
1131-
#[lang="fn"]
1131+
#[lang = "fn"]
11321132
#[stable(feature = "rust1", since = "1.0.0")]
11331133
#[rustc_paren_sugar]
11341134
#[fundamental] // so that regex can rely that `&str: !FnMut`
@@ -1138,7 +1138,7 @@ pub trait Fn<Args> : FnMut<Args> {
11381138
}
11391139

11401140
/// A version of the call operator that takes a mutable receiver.
1141-
#[lang="fn_mut"]
1141+
#[lang = "fn_mut"]
11421142
#[stable(feature = "rust1", since = "1.0.0")]
11431143
#[rustc_paren_sugar]
11441144
#[fundamental] // so that regex can rely that `&str: !FnMut`
@@ -1148,7 +1148,7 @@ pub trait FnMut<Args> : FnOnce<Args> {
11481148
}
11491149

11501150
/// A version of the call operator that takes a by-value receiver.
1151-
#[lang="fn_once"]
1151+
#[lang = "fn_once"]
11521152
#[stable(feature = "rust1", since = "1.0.0")]
11531153
#[rustc_paren_sugar]
11541154
#[fundamental] // so that regex can rely that `&str: !FnMut`

src/libcore/panicking.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
use fmt;
3434

3535
#[cold] #[inline(never)] // this is the slow path, always
36-
#[lang="panic"]
36+
#[lang = "panic"]
3737
pub fn panic(expr_file_line: &(&'static str, &'static str, u32)) -> ! {
3838
// Use Arguments::new_v1 instead of format_args!("{}", expr) to potentially
3939
// reduce size overhead. The format_args! macro uses str's Display trait to
@@ -46,7 +46,7 @@ pub fn panic(expr_file_line: &(&'static str, &'static str, u32)) -> ! {
4646
}
4747

4848
#[cold] #[inline(never)]
49-
#[lang="panic_bounds_check"]
49+
#[lang = "panic_bounds_check"]
5050
fn panic_bounds_check(file_line: &(&'static str, u32),
5151
index: usize, len: usize) -> ! {
5252
panic_fmt(format_args!("index out of bounds: the len is {} but the index is {}",

src/libcore/str/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ fn eq_slice_(a: &str, b: &str) -> bool {
11851185
/// Bytewise slice equality
11861186
/// NOTE: This function is (ab)used in rustc::middle::trans::_match
11871187
/// to compare &[u8] byte slices that are not necessarily valid UTF-8.
1188-
#[lang="str_eq"]
1188+
#[lang = "str_eq"]
11891189
#[inline]
11901190
fn eq_slice(a: &str, b: &str) -> bool {
11911191
eq_slice_(a, b)

0 commit comments

Comments
 (0)