Skip to content

Commit 34e82a7

Browse files
committed
Auto merge of #64354 - Centril:rollup-oaq0xoi, r=Centril
Rollup of 8 pull requests Successful merges: - #63786 (Make `abs`, `wrapping_abs`, `overflowing_abs` const functions) - #63989 (Add Yaah to clippy toolstain notification list) - #64256 (test/c-variadic: Fix patterns on powerpc64) - #64292 (lowering: extend temporary lifetimes around await) - #64311 (lldb: avoid mixing "Hit breakpoint" message with other output.) - #64330 (Clarify E0507 to note Fn/FnMut relationship to borrowing) - #64331 (Changed instant is earlier to instant is later) - #64344 (rustc_mir: buffer -Zdump-mir output instead of pestering the kernel constantly.) Failed merges: r? @ghost
2 parents 87b0c90 + 8d2ef19 commit 34e82a7

14 files changed

+117
-70
lines changed

src/etc/lldb_batchmode.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ def normalize_whitespace(s):
4545

4646
def breakpoint_callback(frame, bp_loc, dict):
4747
"""This callback is registered with every breakpoint and makes sure that the
48-
frame containing the breakpoint location is selected"""
48+
frame containing the breakpoint location is selected """
49+
50+
# HACK(eddyb) print a newline to avoid continuing an unfinished line.
51+
print("")
4952
print("Hit breakpoint " + str(bp_loc))
5053

5154
# Select the frame and the thread containing it

src/libcore/num/mod.rs

+9-21
Original file line numberDiff line numberDiff line change
@@ -1401,12 +1401,8 @@ $EndFeature, "
14011401
```"),
14021402
#[stable(feature = "no_panic_abs", since = "1.13.0")]
14031403
#[inline]
1404-
pub fn wrapping_abs(self) -> Self {
1405-
if self.is_negative() {
1406-
self.wrapping_neg()
1407-
} else {
1408-
self
1409-
}
1404+
pub const fn wrapping_abs(self) -> Self {
1405+
(self ^ (self >> ($BITS - 1))).wrapping_sub(self >> ($BITS - 1))
14101406
}
14111407
}
14121408

@@ -1764,12 +1760,8 @@ $EndFeature, "
17641760
```"),
17651761
#[stable(feature = "no_panic_abs", since = "1.13.0")]
17661762
#[inline]
1767-
pub fn overflowing_abs(self) -> (Self, bool) {
1768-
if self.is_negative() {
1769-
self.overflowing_neg()
1770-
} else {
1771-
(self, false)
1772-
}
1763+
pub const fn overflowing_abs(self) -> (Self, bool) {
1764+
(self ^ (self >> ($BITS - 1))).overflowing_sub(self >> ($BITS - 1))
17731765
}
17741766
}
17751767

@@ -1973,15 +1965,11 @@ $EndFeature, "
19731965
#[stable(feature = "rust1", since = "1.0.0")]
19741966
#[inline]
19751967
#[rustc_inherit_overflow_checks]
1976-
pub fn abs(self) -> Self {
1977-
if self.is_negative() {
1978-
// Note that the #[inline] above means that the overflow
1979-
// semantics of this negation depend on the crate we're being
1980-
// inlined into.
1981-
-self
1982-
} else {
1983-
self
1984-
}
1968+
pub const fn abs(self) -> Self {
1969+
// Note that the #[inline] above means that the overflow
1970+
// semantics of the subtraction depend on the crate we're being
1971+
// inlined into.
1972+
(self ^ (self >> ($BITS - 1))) - (self >> ($BITS - 1))
19851973
}
19861974
}
19871975

src/librustc/hir/lowering/expr.rs

+15-20
Original file line numberDiff line numberDiff line change
@@ -507,14 +507,13 @@ impl LoweringContext<'_> {
507507

508508
/// Desugar `<expr>.await` into:
509509
/// ```rust
510-
/// {
511-
/// let mut pinned = <expr>;
512-
/// loop {
510+
/// match <expr> {
511+
/// mut pinned => loop {
513512
/// match ::std::future::poll_with_tls_context(unsafe {
514-
/// ::std::pin::Pin::new_unchecked(&mut pinned)
513+
/// <::std::pin::Pin>::new_unchecked(&mut pinned)
515514
/// }) {
516515
/// ::std::task::Poll::Ready(result) => break result,
517-
/// ::std::task::Poll::Pending => {},
516+
/// ::std::task::Poll::Pending => {}
518517
/// }
519518
/// yield ();
520519
/// }
@@ -549,21 +548,12 @@ impl LoweringContext<'_> {
549548
self.allow_gen_future.clone(),
550549
);
551550

552-
// let mut pinned = <expr>;
553-
let expr = P(self.lower_expr(expr));
554551
let pinned_ident = Ident::with_dummy_span(sym::pinned);
555552
let (pinned_pat, pinned_pat_hid) = self.pat_ident_binding_mode(
556553
span,
557554
pinned_ident,
558555
hir::BindingAnnotation::Mutable,
559556
);
560-
let pinned_let = self.stmt_let_pat(
561-
ThinVec::new(),
562-
span,
563-
Some(expr),
564-
pinned_pat,
565-
hir::LocalSource::AwaitDesugar,
566-
);
567557

568558
// ::std::future::poll_with_tls_context(unsafe {
569559
// ::std::pin::Pin::new_unchecked(&mut pinned)
@@ -621,7 +611,7 @@ impl LoweringContext<'_> {
621611
self.arm(hir_vec![pending_pat], empty_block)
622612
};
623613

624-
let match_stmt = {
614+
let inner_match_stmt = {
625615
let match_expr = self.expr_match(
626616
span,
627617
poll_expr,
@@ -643,10 +633,11 @@ impl LoweringContext<'_> {
643633

644634
let loop_block = P(self.block_all(
645635
span,
646-
hir_vec![match_stmt, yield_stmt],
636+
hir_vec![inner_match_stmt, yield_stmt],
647637
None,
648638
));
649639

640+
// loop { .. }
650641
let loop_expr = P(hir::Expr {
651642
hir_id: loop_hir_id,
652643
node: hir::ExprKind::Loop(
@@ -658,10 +649,14 @@ impl LoweringContext<'_> {
658649
attrs: ThinVec::new(),
659650
});
660651

661-
hir::ExprKind::Block(
662-
P(self.block_all(span, hir_vec![pinned_let], Some(loop_expr))),
663-
None,
664-
)
652+
// mut pinned => loop { ... }
653+
let pinned_arm = self.arm(hir_vec![pinned_pat], loop_expr);
654+
655+
// match <expr> {
656+
// mut pinned => loop { .. }
657+
// }
658+
let expr = P(self.lower_expr(expr));
659+
hir::ExprKind::Match(expr, hir_vec![pinned_arm], hir::MatchSource::AwaitDesugar)
665660
}
666661

667662
fn lower_expr_closure(

src/librustc_mir/error_codes.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -1646,7 +1646,14 @@ fn print_fancy_ref(fancy_ref: &FancyNum){
16461646
"##,
16471647

16481648
E0507: r##"
1649-
You tried to move out of a value which was borrowed. Erroneous code example:
1649+
You tried to move out of a value which was borrowed.
1650+
1651+
This can also happen when using a type implementing `Fn` or `FnMut`, as neither
1652+
allows moving out of them (they usually represent closures which can be called
1653+
more than once). Much of the text following applies equally well to non-`FnOnce`
1654+
closure bodies.
1655+
1656+
Erroneous code example:
16501657
16511658
```compile_fail,E0507
16521659
use std::cell::RefCell;

src/librustc_mir/util/pretty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,12 @@ pub(crate) fn create_dump_file(
227227
pass_name: &str,
228228
disambiguator: &dyn Display,
229229
source: MirSource<'tcx>,
230-
) -> io::Result<fs::File> {
230+
) -> io::Result<io::BufWriter<fs::File>> {
231231
let file_path = dump_path(tcx, extension, pass_num, pass_name, disambiguator, source);
232232
if let Some(parent) = file_path.parent() {
233233
fs::create_dir_all(parent)?;
234234
}
235-
fs::File::create(&file_path)
235+
Ok(io::BufWriter::new(fs::File::create(&file_path)?))
236236
}
237237

238238
/// Write out a human-readable textual representation for the given MIR.

src/libstd/time.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ impl Instant {
216216
}
217217

218218
/// Returns the amount of time elapsed from another instant to this one,
219-
/// or None if that instant is earlier than this one.
219+
/// or None if that instant is later than this one.
220220
///
221221
/// # Examples
222222
///

src/test/codegen/c-variadic.rs

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// compile-flags: -C no-prepopulate-passes
2+
// ignore-tidy-linelength
23

34
#![crate_type = "lib"]
45
#![feature(c_variadic)]
@@ -14,13 +15,13 @@ extern "C" {
1415
#[unwind(aborts)] // FIXME(#58794)
1516
pub unsafe extern "C" fn use_foreign_c_variadic_0() {
1617
// Ensure that we correctly call foreign C-variadic functions.
17-
// CHECK: invoke void (i32, ...) @foreign_c_variadic_0(i32 0)
18+
// CHECK: invoke void (i32, ...) @foreign_c_variadic_0([[PARAM:i32( signext)?]] 0)
1819
foreign_c_variadic_0(0);
19-
// CHECK: invoke void (i32, ...) @foreign_c_variadic_0(i32 0, i32 42)
20+
// CHECK: invoke void (i32, ...) @foreign_c_variadic_0([[PARAM]] 0, [[PARAM]] 42)
2021
foreign_c_variadic_0(0, 42i32);
21-
// CHECK: invoke void (i32, ...) @foreign_c_variadic_0(i32 0, i32 42, i32 1024)
22+
// CHECK: invoke void (i32, ...) @foreign_c_variadic_0([[PARAM]] 0, [[PARAM]] 42, [[PARAM]] 1024)
2223
foreign_c_variadic_0(0, 42i32, 1024i32);
23-
// CHECK: invoke void (i32, ...) @foreign_c_variadic_0(i32 0, i32 42, i32 1024, i32 0)
24+
// CHECK: invoke void (i32, ...) @foreign_c_variadic_0([[PARAM]] 0, [[PARAM]] 42, [[PARAM]] 1024, [[PARAM]] 0)
2425
foreign_c_variadic_0(0, 42i32, 1024i32, 0i32);
2526
}
2627

@@ -34,18 +35,18 @@ pub unsafe extern "C" fn use_foreign_c_variadic_1_0(ap: VaList) {
3435

3536
#[unwind(aborts)] // FIXME(#58794)
3637
pub unsafe extern "C" fn use_foreign_c_variadic_1_1(ap: VaList) {
37-
// CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, i32 42)
38+
// CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, [[PARAM]] 42)
3839
foreign_c_variadic_1(ap, 42i32);
3940
}
4041
#[unwind(aborts)] // FIXME(#58794)
4142
pub unsafe extern "C" fn use_foreign_c_variadic_1_2(ap: VaList) {
42-
// CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, i32 2, i32 42)
43+
// CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, [[PARAM]] 2, [[PARAM]] 42)
4344
foreign_c_variadic_1(ap, 2i32, 42i32);
4445
}
4546

4647
#[unwind(aborts)] // FIXME(#58794)
4748
pub unsafe extern "C" fn use_foreign_c_variadic_1_3(ap: VaList) {
48-
// CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, i32 2, i32 42, i32 0)
49+
// CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, [[PARAM]] 2, [[PARAM]] 42, [[PARAM]] 0)
4950
foreign_c_variadic_1(ap, 2i32, 42i32, 0i32);
5051
}
5152

@@ -64,12 +65,12 @@ pub unsafe extern "C" fn c_variadic(n: i32, mut ap: ...) -> i32 {
6465
// Ensure that we generate the correct `call` signature when calling a Rust
6566
// defined C-variadic.
6667
pub unsafe fn test_c_variadic_call() {
67-
// CHECK: call i32 (i32, ...) @c_variadic(i32 0)
68+
// CHECK: call [[RET:(signext )?i32]] (i32, ...) @c_variadic([[PARAM]] 0)
6869
c_variadic(0);
69-
// CHECK: call i32 (i32, ...) @c_variadic(i32 0, i32 42)
70+
// CHECK: call [[RET]] (i32, ...) @c_variadic([[PARAM]] 0, [[PARAM]] 42)
7071
c_variadic(0, 42i32);
71-
// CHECK: call i32 (i32, ...) @c_variadic(i32 0, i32 42, i32 1024)
72+
// CHECK: call [[RET]] (i32, ...) @c_variadic([[PARAM]] 0, [[PARAM]] 42, [[PARAM]] 1024)
7273
c_variadic(0, 42i32, 1024i32);
73-
// CHECK: call i32 (i32, ...) @c_variadic(i32 0, i32 42, i32 1024, i32 0)
74+
// CHECK: call [[RET]] (i32, ...) @c_variadic([[PARAM]] 0, [[PARAM]] 42, [[PARAM]] 1024, [[PARAM]] 0)
7475
c_variadic(0, 42i32, 1024i32, 0i32);
7576
}

src/test/ui/async-await/async-fn-nonsend.stderr

+12-12
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ LL | assert_send(local_dropped_before_await());
99
|
1010
= help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<()>`
1111
= note: required because it appears within the type `impl std::fmt::Debug`
12-
= note: required because it appears within the type `{impl std::fmt::Debug, impl std::future::Future, ()}`
13-
= note: required because it appears within the type `[static generator@$DIR/async-fn-nonsend.rs:21:39: 26:2 {impl std::fmt::Debug, impl std::future::Future, ()}]`
14-
= note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/async-fn-nonsend.rs:21:39: 26:2 {impl std::fmt::Debug, impl std::future::Future, ()}]>`
12+
= note: required because it appears within the type `{impl std::fmt::Debug, fn() -> impl std::future::Future {fut}, impl std::future::Future, ()}`
13+
= note: required because it appears within the type `[static generator@$DIR/async-fn-nonsend.rs:21:39: 26:2 {impl std::fmt::Debug, fn() -> impl std::future::Future {fut}, impl std::future::Future, ()}]`
14+
= note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/async-fn-nonsend.rs:21:39: 26:2 {impl std::fmt::Debug, fn() -> impl std::future::Future {fut}, impl std::future::Future, ()}]>`
1515
= note: required because it appears within the type `impl std::future::Future`
1616
= note: required because it appears within the type `impl std::future::Future`
1717

@@ -26,9 +26,9 @@ LL | assert_send(non_send_temporary_in_match());
2626
|
2727
= help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<()>`
2828
= note: required because it appears within the type `impl std::fmt::Debug`
29-
= note: required because it appears within the type `{fn(impl std::fmt::Debug) -> std::option::Option<impl std::fmt::Debug> {std::option::Option::<impl std::fmt::Debug>::Some}, fn() -> impl std::fmt::Debug {non_send}, impl std::fmt::Debug, std::option::Option<impl std::fmt::Debug>, impl std::future::Future, ()}`
30-
= note: required because it appears within the type `[static generator@$DIR/async-fn-nonsend.rs:28:40: 37:2 {fn(impl std::fmt::Debug) -> std::option::Option<impl std::fmt::Debug> {std::option::Option::<impl std::fmt::Debug>::Some}, fn() -> impl std::fmt::Debug {non_send}, impl std::fmt::Debug, std::option::Option<impl std::fmt::Debug>, impl std::future::Future, ()}]`
31-
= note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/async-fn-nonsend.rs:28:40: 37:2 {fn(impl std::fmt::Debug) -> std::option::Option<impl std::fmt::Debug> {std::option::Option::<impl std::fmt::Debug>::Some}, fn() -> impl std::fmt::Debug {non_send}, impl std::fmt::Debug, std::option::Option<impl std::fmt::Debug>, impl std::future::Future, ()}]>`
29+
= note: required because it appears within the type `{fn(impl std::fmt::Debug) -> std::option::Option<impl std::fmt::Debug> {std::option::Option::<impl std::fmt::Debug>::Some}, fn() -> impl std::fmt::Debug {non_send}, impl std::fmt::Debug, std::option::Option<impl std::fmt::Debug>, fn() -> impl std::future::Future {fut}, impl std::future::Future, ()}`
30+
= note: required because it appears within the type `[static generator@$DIR/async-fn-nonsend.rs:28:40: 37:2 {fn(impl std::fmt::Debug) -> std::option::Option<impl std::fmt::Debug> {std::option::Option::<impl std::fmt::Debug>::Some}, fn() -> impl std::fmt::Debug {non_send}, impl std::fmt::Debug, std::option::Option<impl std::fmt::Debug>, fn() -> impl std::future::Future {fut}, impl std::future::Future, ()}]`
31+
= note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/async-fn-nonsend.rs:28:40: 37:2 {fn(impl std::fmt::Debug) -> std::option::Option<impl std::fmt::Debug> {std::option::Option::<impl std::fmt::Debug>::Some}, fn() -> impl std::fmt::Debug {non_send}, impl std::fmt::Debug, std::option::Option<impl std::fmt::Debug>, fn() -> impl std::future::Future {fut}, impl std::future::Future, ()}]>`
3232
= note: required because it appears within the type `impl std::future::Future`
3333
= note: required because it appears within the type `impl std::future::Future`
3434

@@ -45,9 +45,9 @@ LL | assert_send(non_sync_with_method_call());
4545
= note: required because of the requirements on the impl of `std::marker::Send` for `&mut dyn std::fmt::Write`
4646
= note: required because it appears within the type `std::fmt::Formatter<'_>`
4747
= note: required because of the requirements on the impl of `std::marker::Send` for `&mut std::fmt::Formatter<'_>`
48-
= note: required because it appears within the type `for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, impl std::future::Future, ()}`
49-
= note: required because it appears within the type `[static generator@$DIR/async-fn-nonsend.rs:39:38: 45:2 for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, impl std::future::Future, ()}]`
50-
= note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/async-fn-nonsend.rs:39:38: 45:2 for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, impl std::future::Future, ()}]>`
48+
= note: required because it appears within the type `for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, fn() -> impl std::future::Future {fut}, impl std::future::Future, ()}`
49+
= note: required because it appears within the type `[static generator@$DIR/async-fn-nonsend.rs:39:38: 45:2 for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, fn() -> impl std::future::Future {fut}, impl std::future::Future, ()}]`
50+
= note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/async-fn-nonsend.rs:39:38: 45:2 for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, fn() -> impl std::future::Future {fut}, impl std::future::Future, ()}]>`
5151
= note: required because it appears within the type `impl std::future::Future`
5252
= note: required because it appears within the type `impl std::future::Future`
5353

@@ -68,9 +68,9 @@ LL | assert_send(non_sync_with_method_call());
6868
= note: required because of the requirements on the impl of `std::marker::Send` for `std::slice::Iter<'_, std::fmt::ArgumentV1<'_>>`
6969
= note: required because it appears within the type `std::fmt::Formatter<'_>`
7070
= note: required because of the requirements on the impl of `std::marker::Send` for `&mut std::fmt::Formatter<'_>`
71-
= note: required because it appears within the type `for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, impl std::future::Future, ()}`
72-
= note: required because it appears within the type `[static generator@$DIR/async-fn-nonsend.rs:39:38: 45:2 for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, impl std::future::Future, ()}]`
73-
= note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/async-fn-nonsend.rs:39:38: 45:2 for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, impl std::future::Future, ()}]>`
71+
= note: required because it appears within the type `for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, fn() -> impl std::future::Future {fut}, impl std::future::Future, ()}`
72+
= note: required because it appears within the type `[static generator@$DIR/async-fn-nonsend.rs:39:38: 45:2 for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, fn() -> impl std::future::Future {fut}, impl std::future::Future, ()}]`
73+
= note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/async-fn-nonsend.rs:39:38: 45:2 for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, fn() -> impl std::future::Future {fut}, impl std::future::Future, ()}]>`
7474
= note: required because it appears within the type `impl std::future::Future`
7575
= note: required because it appears within the type `impl std::future::Future`
7676

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// check-pass
2+
// edition:2018
3+
4+
struct Test(String);
5+
6+
impl Test {
7+
async fn borrow_async(&self) {}
8+
9+
fn with(&mut self, s: &str) -> &mut Self {
10+
self.0 = s.into();
11+
self
12+
}
13+
}
14+
15+
async fn test() {
16+
Test("".to_string()).with("123").borrow_async().await;
17+
}
18+
19+
fn main() { }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// check-pass
2+
// edition:2018
3+
4+
async fn foo(x: &[Vec<u32>]) -> u32 {
5+
0
6+
}
7+
8+
async fn bar() {
9+
foo(&[vec![123]]).await;
10+
}
11+
12+
fn main() { }

src/test/ui/consts/const-int-overflowing-rpass.rs

+8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ const SHR_B: (u32, bool) = 0x10u32.overflowing_shr(132);
1818
const NEG_A: (u32, bool) = 0u32.overflowing_neg();
1919
const NEG_B: (u32, bool) = core::u32::MAX.overflowing_neg();
2020

21+
const ABS_POS: (i32, bool) = 10i32.overflowing_abs();
22+
const ABS_NEG: (i32, bool) = (-10i32).overflowing_abs();
23+
const ABS_MIN: (i32, bool) = i32::min_value().overflowing_abs();
24+
2125
fn main() {
2226
assert_eq!(ADD_A, (7, false));
2327
assert_eq!(ADD_B, (0, true));
@@ -36,4 +40,8 @@ fn main() {
3640

3741
assert_eq!(NEG_A, (0, false));
3842
assert_eq!(NEG_B, (1, true));
43+
44+
assert_eq!(ABS_POS, (10, false));
45+
assert_eq!(ABS_NEG, (10, false));
46+
assert_eq!(ABS_MIN, (i32::min_value(), true));
3947
}

src/test/ui/consts/const-int-sign-rpass.rs

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ const SIGNUM_POS: i32 = 10i32.signum();
1111
const SIGNUM_NIL: i32 = 0i32.signum();
1212
const SIGNUM_NEG: i32 = (-42i32).signum();
1313

14+
const ABS_A: i32 = 10i32.abs();
15+
const ABS_B: i32 = (-10i32).abs();
16+
1417
fn main() {
1518
assert!(NEGATIVE_A);
1619
assert!(!NEGATIVE_B);
@@ -20,4 +23,7 @@ fn main() {
2023
assert_eq!(SIGNUM_POS, 1);
2124
assert_eq!(SIGNUM_NIL, 0);
2225
assert_eq!(SIGNUM_NEG, -1);
26+
27+
assert_eq!(ABS_A, 10);
28+
assert_eq!(ABS_B, 10);
2329
}

src/test/ui/consts/const-int-wrapping-rpass.rs

+8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ const SHR_B: u32 = 128u32.wrapping_shr(128);
1818
const NEG_A: u32 = 5u32.wrapping_neg();
1919
const NEG_B: u32 = 1234567890u32.wrapping_neg();
2020

21+
const ABS_POS: i32 = 10i32.wrapping_abs();
22+
const ABS_NEG: i32 = (-10i32).wrapping_abs();
23+
const ABS_MIN: i32 = i32::min_value().wrapping_abs();
24+
2125
fn main() {
2226
assert_eq!(ADD_A, 255);
2327
assert_eq!(ADD_B, 199);
@@ -36,4 +40,8 @@ fn main() {
3640

3741
assert_eq!(NEG_A, 4294967291);
3842
assert_eq!(NEG_B, 3060399406);
43+
44+
assert_eq!(ABS_POS, 10);
45+
assert_eq!(ABS_NEG, 10);
46+
assert_eq!(ABS_MIN, i32::min_value());
3947
}

src/tools/publish_toolstate.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# List of people to ping when the status of a tool or a book changed.
2323
MAINTAINERS = {
2424
'miri': '@oli-obk @RalfJung @eddyb',
25-
'clippy-driver': '@Manishearth @llogiq @mcarton @oli-obk @phansch @flip1995',
25+
'clippy-driver': '@Manishearth @llogiq @mcarton @oli-obk @phansch @flip1995 @yaahc',
2626
'rls': '@Xanewok',
2727
'rustfmt': '@topecongiro',
2828
'book': '@carols10cents @steveklabnik',

0 commit comments

Comments
 (0)