Auto merge of #72727 - JohnTitor:rollup-nni16m2, r=JohnTitor
Rollup of 11 pull requests Successful merges: - #71633 (Impl Error for Infallible) - #71843 (Tweak and stabilize AtomicN::fetch_update) - #72288 (Stabilization of weak-into-raw) - #72324 (Stabilize AtomicN::fetch_min and AtomicN::fetch_max) - #72452 (Clarified the documentation for Formatter::precision) - #72495 (Improve E0601 explanation) - #72534 (Improve missing `@` in slice binding pattern diagnostics) - #72547 (Added a codegen test for a recent optimization for overflow-checks=on) - #72711 (remove redundant `mk_const`) - #72713 (Whitelist #[allow_internal_unstable]) - #72720 (Clarify the documentation of `take`) Failed merges: r? @ghost
This commit is contained in:
commit
77f95a89a1
14 changed files with 112 additions and 57 deletions
26
src/test/codegen/integer-overflow.rs
Normal file
26
src/test/codegen/integer-overflow.rs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// no-system-llvm
|
||||
// compile-flags: -O -C overflow-checks=on
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
||||
pub struct S1<'a> {
|
||||
data: &'a [u8],
|
||||
position: usize,
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @slice_no_index_order
|
||||
#[no_mangle]
|
||||
pub fn slice_no_index_order<'a>(s: &'a mut S1, n: usize) -> &'a [u8] {
|
||||
// CHECK-NOT: slice_index_order_fail
|
||||
let d = &s.data[s.position..s.position+n];
|
||||
s.position += n;
|
||||
return d;
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @test_check
|
||||
#[no_mangle]
|
||||
pub fn test_check<'a>(s: &'a mut S1, x: usize, y: usize) -> &'a [u8] {
|
||||
// CHECK: slice_index_order_fail
|
||||
&s.data[x..y]
|
||||
}
|
||||
9
src/test/ui/issues/issue-72373.rs
Normal file
9
src/test/ui/issues/issue-72373.rs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
fn foo(c: &[u32], n: u32) -> u32 {
|
||||
match *c {
|
||||
[h, ..] if h > n => 0,
|
||||
[h, ..] if h == n => 1,
|
||||
[h, ref ts..] => foo(c, n - h) + foo(ts, n),
|
||||
//~^ ERROR expected one of `,`, `@`, `]`, or `|`, found `..`
|
||||
[] => 0,
|
||||
}
|
||||
}
|
||||
13
src/test/ui/issues/issue-72373.stderr
Normal file
13
src/test/ui/issues/issue-72373.stderr
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
error: expected one of `,`, `@`, `]`, or `|`, found `..`
|
||||
--> $DIR/issue-72373.rs:5:19
|
||||
|
|
||||
LL | [h, ref ts..] => foo(c, n - h) + foo(ts, n),
|
||||
| ^^ expected one of `,`, `@`, `]`, or `|`
|
||||
|
|
||||
help: if you meant to bind the contents of the rest of the array pattern into `ts`, use `@`
|
||||
|
|
||||
LL | [h, ref ts @ ..] => foo(c, n - h) + foo(ts, n),
|
||||
| ^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
{"message":"`main` function not found in crate `json_short`","code":{"code":"E0601","explanation":"No `main` function was found in a binary crate. To fix this error, add a
|
||||
`main` function. For example:
|
||||
{"message":"`main` function not found in crate `json_short`","code":{"code":"E0601","explanation":"No `main` function was found in a binary crate.
|
||||
|
||||
To fix this error, add a `main` function:
|
||||
|
||||
```
|
||||
fn main() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue