Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 60c2e8d

Browse files
committedAug 4, 2020
Auto merge of #75126 - JohnTitor:rollup-aejluzx, r=JohnTitor
Rollup of 8 pull requests Successful merges: - #74759 (add `unsigned_abs` to signed integers) - #75043 (rustc_ast: `(Nested)MetaItem::check_name` -> `has_name`) - #75056 (Lint path statements to suggest using drop when the type needs drop) - #75081 (Fix logging for rustdoc) - #75083 (Do not trigger `unused_braces` for `while let`) - #75084 (Stabilize Ident::new_raw) - #75103 (Disable building rust-analyzer on riscv64) - #75106 (Enable docs on in the x86_64-unknown-linux-musl manifest) Failed merges: r? @ghost
2 parents 1d601d6 + aa84a76 commit 60c2e8d

File tree

46 files changed

+297
-149
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+297
-149
lines changed
 

‎library/core/src/num/mod.rs

+23
Original file line numberDiff line numberDiff line change
@@ -1601,6 +1601,29 @@ $EndFeature, "
16011601
}
16021602
}
16031603

1604+
doc_comment! {
1605+
concat!("Computes the absolute value of `self` without any wrapping
1606+
or panicking.
1607+
1608+
1609+
# Examples
1610+
1611+
Basic usage:
1612+
1613+
```
1614+
", $Feature, "#![feature(unsigned_abs)]
1615+
assert_eq!(100", stringify!($SelfT), ".unsigned_abs(), 100", stringify!($UnsignedT), ");
1616+
assert_eq!((-100", stringify!($SelfT), ").unsigned_abs(), 100", stringify!($UnsignedT), ");
1617+
assert_eq!((-128i8).unsigned_abs(), 128u8);",
1618+
$EndFeature, "
1619+
```"),
1620+
#[unstable(feature = "unsigned_abs", issue = "74913")]
1621+
#[inline]
1622+
pub const fn unsigned_abs(self) -> $UnsignedT {
1623+
self.wrapping_abs() as $UnsignedT
1624+
}
1625+
}
1626+
16041627
doc_comment! {
16051628
concat!("Wrapping (modular) exponentiation. Computes `self.pow(exp)`,
16061629
wrapping around at the boundary of the type.

‎library/proc_macro/src/lib.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ impl Ident {
848848
/// Creates a new `Ident` with the given `string` as well as the specified
849849
/// `span`.
850850
/// The `string` argument must be a valid identifier permitted by the
851-
/// language, otherwise the function will panic.
851+
/// language (including keywords, e.g. `self` or `fn`). Otherwise, the function will panic.
852852
///
853853
/// Note that `span`, currently in rustc, configures the hygiene information
854854
/// for this identifier.
@@ -870,7 +870,10 @@ impl Ident {
870870
}
871871

872872
/// Same as `Ident::new`, but creates a raw identifier (`r#ident`).
873-
#[unstable(feature = "proc_macro_raw_ident", issue = "54723")]
873+
/// The `string` argument be a valid identifier permitted by the language
874+
/// (including keywords, e.g. `fn`). Keywords which are usable in path segments
875+
/// (e.g. `self`, `super`) are not supported, and will cause a panic.
876+
#[stable(feature = "proc_macro_raw_ident", since = "1.47.0")]
874877
pub fn new_raw(string: &str, span: Span) -> Ident {
875878
Ident(bridge::client::Ident::new(string, span.0, true))
876879
}

0 commit comments

Comments
 (0)
Please sign in to comment.