Commit graph

268272 commits

Author SHA1 Message Date
Jieyou Xu
8435c75fa5 Mark numeric-types.rs as 64-bit only for now
This is to unblock the tree, a proper fix will need to be investigated.
I think the debuginfo test suite supports revisions, however debugger
directives do not respect such revisions, which is problematic.

It's that 32-bit and 64-bit msvc of course have different integer widths
for `isize` and `usize`, meaning their underlying integer is different
and thus printed differently.

(cherry picked from commit dccb6c0f27)
2024-11-21 09:26:47 -08:00
Jieyou Xu
088f06a383 Update cdb annotations for unit-type.rs with cdb 10.0.26100.2161
(cherry picked from commit e70df0909a)
2024-11-21 09:26:47 -08:00
Jieyou Xu
a3021df498 Update cdb annotations for range-types.rs with cdb 10.0.26100.2161
(cherry picked from commit 94f3dcf601)
2024-11-21 09:26:47 -08:00
Jieyou Xu
aa203c9fa0 Update cdb annotations for numeric-types with cdb 10.0.26100.2161
(cherry picked from commit 1503279593)
2024-11-21 09:26:47 -08:00
Michael Goulet
3c7babbb12 Enforce that raw lifetime identifiers must be valid raw identifiers
(cherry picked from commit 9785c7cf94)
2024-11-21 09:26:42 -08:00
bors
4ff8ff0ecd Auto merge of #133077 - cuviper:beta-next, r=cuviper
[beta] backports

- Use completion item indices instead of property matching #132987, rust-lang/rust-analyzer#18503
- Reject raw lifetime followed by `'`, like regular lifetimes do #132341
- Only disable cache if predicate has opaques within it #132625
- rustdoc-search: case-sensitive only when capitals are used #133043
- (ci) Update macOS Xcode to 15 #131570

r? cuviper
2024-11-16 02:17:19 +00:00
Eric Huss
48c21ba818 Update debuginfo test for newer lldb
For reasons I don't understand, lldb in Xcode 15 no longer prints objects as:

(long) $0 = 19

instead, it is printing them as:

(long) 19

(cherry picked from commit 16b91e887a)
2024-11-15 15:05:53 -08:00
Eric Huss
7757d32571 (ci) Update macOS to Xcode 15
(cherry picked from commit 94579ff930)
2024-11-15 15:05:52 -08:00
Michael Howell
71ed455958 rustdoc-search: case-sensitive only when capitals are used
This is the "smartcase" behavior, described by vim and dtolnay.

(cherry picked from commit 32500aa8e0)
2024-11-15 09:56:23 -08:00
Michael Goulet
80f109a80a Only disable cache if predicate has opaques within it
(cherry picked from commit 49153739fd)
2024-11-14 16:17:05 -08:00
Michael Goulet
5f7387c37e Reject raw lifetime followed by \' as well
(cherry picked from commit 1990f15608)
2024-11-14 16:17:05 -08:00
Kirill Bulatov
f0db79f31a Update the file hash 2024-11-13 09:19:26 +02:00
Kirill Bulatov
fa46a9e2b6 Use completion item indices instead of property matching when searching for the completion item to resolve 2024-11-13 09:19:14 +02:00
bors
eb6e3fa1a2 Auto merge of #132733 - cuviper:beta-next, r=cuviper
[beta] backports

- rustdoc: skip stability inheritance for some item kinds #132481
- Avoid use imports in thread_local_inner! in static #132101
- Also treat `impl` definition parent as transparent regarding modules #132453
- Revert "Avoid nested replacement ranges" from #129346. #132587

r? cuviper
2024-11-08 13:35:26 +00:00
Nicholas Nethercote
25ab47d5e6 Revert "Avoid nested replacement ranges" from #129346.
It caused a test regression in the `cfg_eval.rs` crate. (The bugfix
in #129346 was in a different commit; this commit was just a code
simplification.)

(cherry picked from commit 981dc02eaf)
2024-11-07 08:31:01 -08:00
Urgau
c77b19bf30 Also treat impl definition parent as transparent regarding modules
(cherry picked from commit 37db365948)
2024-11-07 08:30:54 -08:00
Jeong YunWon
a160d9e36a Avoid use imports in thread_local_inner! in statik
Fixes #131863 for wasm targets

All other macros were done in #131866, but this sub module is missed.

(cherry picked from commit 5368b120a1)
2024-11-07 08:30:33 -08:00
Lukas Markeffsky
12ed4c6655 rustdoc: skip stability inheritance for some item kinds
(cherry picked from commit 728315df79)
2024-11-05 14:04:25 -08:00
bors
67512dee7a Auto merge of #132468 - cuviper:beta-next, r=cuviper
[beta] backports

- Bump libc to 0.2.161 #131823
- Avoid use imports in `thread_local_inner!` #131866
- Mark `simplify_aggregate_to_copy` mir-opt as unsound #132356

r? cuviper
2024-11-02 11:14:59 +00:00
许杰友 Jieyou Xu (Joe)
0f95b22c12 Add a mir-opt GVN test for #128299
Co-authored-by: DianQK <dianqk@dianqk.net>
(cherry picked from commit cfb4c05d77)
2024-11-01 11:15:24 -07:00
许杰友 Jieyou Xu (Joe)
b5bc13a367 Mark simplify_aggregate_to_copy mir-opt as unsound
Co-authored-by: DianQK <dianqk@dianqk.net>
(cherry picked from commit 10b8ba4ecb)
2024-11-01 11:15:23 -07:00
许杰友 Jieyou Xu (Joe)
90a1f5f789 Add a regression test for #132353
To catch at least one pattern that was miscompiled. The test is a
minimization of the MCVE reported in
<https://github.com/rust-lang/rust/issues/132353>.

(cherry picked from commit 4d8bda335e)
2024-11-01 11:15:23 -07:00
许杰友 Jieyou Xu (Joe)
1766bc36f5 Avoid shadowing user provided types or type aliases in thread_local!
By using qualified imports, i.e. `$crate::...::LocalKey`.

(cherry picked from commit 7b2320c3df)
2024-11-01 11:14:59 -07:00
Jan Sommer
e0816c87aa Bump libc to 0.2.161
(cherry picked from commit a09c54d4d3)
2024-11-01 11:14:47 -07:00
bors
f41c7ed988 Auto merge of #132337 - weihanglo:update-beta-cargo, r=weihanglo
[beta-1.83] Update Cargo

1 commits in 15fbd2f607d4defc87053b8b76bf5038f2483cf4..5ffbef3211a8c378857905775a15c5b32a174d3b
2024-10-08 21:08:11 +0000 to 2024-10-29 17:19:42 +0000
- [beta-1.83] fix(publish): Downgrade version-exists error to warning on dry-run (rust-lang/cargo#14744)

r? weihanglo
2024-10-31 18:13:21 +00:00
Weihang Lo
3674580186
Update cargo 2024-10-29 18:29:46 -04:00
bors
88c1c3c110 Auto merge of #131846 - cuviper:beta-next, r=cuviper
[beta] stage0 bump and backports

- Bump stage0 to 1.82.0
- Clippy: Move `too_long_first_doc_paragraph` to `nursery` #131742
- Also use outermost const-anon for impl items in `non_local_defs` lint #131660

r? ghost
2024-10-18 01:13:29 +00:00
Urgau
d04ae764cc Also use outermost const-anon for impl items in non_local_defs lint
(cherry picked from commit b5e91a00c8)
2024-10-17 10:30:16 -07:00
Philipp Krones
601863bf30 Move too_long_first_doc_paragraph to nursery
(cherry picked from commit a365aebdf03872722b8c78bdeb62c43851f0c72f)
2024-10-17 10:29:40 -07:00
Josh Stone
a43016a6f9 bump stage0 to 1.82.0 2024-10-17 10:29:19 -07:00
bors
0125edf41b Auto merge of #131696 - cuviper:beta-1.83.0, r=cuviper
[beta] Prepare Rust 1.83.0

r? ghost
2024-10-14 22:27:23 +00:00
onur-ozkan
6af8e028a8 check stage0, channel and version files for CI rustc
These files have important role for compiler builds, so include them
in the "if-unchanged" rustc logic.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
(cherry picked from commit 6e6cbdd2df)
2024-10-14 10:23:58 -07:00
Josh Stone
9d86b49b90 bump channel to beta 2024-10-14 10:23:50 -07:00
Josh Stone
567fd9610c replace placeholder version 2024-10-14 10:22:50 -07:00
bors
36780360b6 Auto merge of #125679 - clarfonthey:escape_ascii, r=joboet
Optimize `escape_ascii` using a lookup table

Based upon my suggestion here: https://github.com/rust-lang/rust/pull/125340#issuecomment-2130441817

Effectively, we can take advantage of the fact that ASCII only needs 7 bits to make the eighth bit store whether the value should be escaped or not. This adds a 256-byte lookup table, but 256 bytes *should* be small enough that very few people will mind, according to my probably not incontrovertible opinion.

The generated assembly isn't clearly better (although has fewer branches), so, I decided to benchmark on three inputs: first on a random 200KiB, then on `/bin/cat`, then on `Cargo.toml` for this repo. In all cases, the generated code ran faster on my machine. (an old i7-8700)

But, if you want to try my benchmarking code for yourself:

<details><summary>Criterion code below. Replace <code>/home/ltdk/rustsrc</code> with the appropriate directory.</summary>

```rust
#![feature(ascii_char)]
#![feature(ascii_char_variants)]
#![feature(const_option)]
#![feature(let_chains)]
use core::ascii;
use core::ops::Range;
use criterion::{criterion_group, criterion_main, Criterion};
use rand::{thread_rng, Rng};

const HEX_DIGITS: [ascii::Char; 16] = *b"0123456789abcdef".as_ascii().unwrap();

#[inline]
const fn backslash<const N: usize>(a: ascii::Char) -> ([ascii::Char; N], Range<u8>) {
    const { assert!(N >= 2) };

    let mut output = [ascii::Char::Null; N];

    output[0] = ascii::Char::ReverseSolidus;
    output[1] = a;

    (output, 0..2)
}

#[inline]
const fn hex_escape<const N: usize>(byte: u8) -> ([ascii::Char; N], Range<u8>) {
    const { assert!(N >= 4) };

    let mut output = [ascii::Char::Null; N];

    let hi = HEX_DIGITS[(byte >> 4) as usize];
    let lo = HEX_DIGITS[(byte & 0xf) as usize];

    output[0] = ascii::Char::ReverseSolidus;
    output[1] = ascii::Char::SmallX;
    output[2] = hi;
    output[3] = lo;

    (output, 0..4)
}

#[inline]
const fn verbatim<const N: usize>(a: ascii::Char) -> ([ascii::Char; N], Range<u8>) {
    const { assert!(N >= 1) };

    let mut output = [ascii::Char::Null; N];

    output[0] = a;

    (output, 0..1)
}

/// Escapes an ASCII character.
///
/// Returns a buffer and the length of the escaped representation.
const fn escape_ascii_old<const N: usize>(byte: u8) -> ([ascii::Char; N], Range<u8>) {
    const { assert!(N >= 4) };

    match byte {
        b'\t' => backslash(ascii::Char::SmallT),
        b'\r' => backslash(ascii::Char::SmallR),
        b'\n' => backslash(ascii::Char::SmallN),
        b'\\' => backslash(ascii::Char::ReverseSolidus),
        b'\'' => backslash(ascii::Char::Apostrophe),
        b'\"' => backslash(ascii::Char::QuotationMark),
        0x00..=0x1F => hex_escape(byte),
        _ => match ascii::Char::from_u8(byte) {
            Some(a) => verbatim(a),
            None => hex_escape(byte),
        },
    }
}

/// Escapes an ASCII character.
///
/// Returns a buffer and the length of the escaped representation.
const fn escape_ascii_new<const N: usize>(byte: u8) -> ([ascii::Char; N], Range<u8>) {
    /// Lookup table helps us determine how to display character.
    ///
    /// Since ASCII characters will always be 7 bits, we can exploit this to store the 8th bit to
    /// indicate whether the result is escaped or unescaped.
    ///
    /// We additionally use 0x80 (escaped NUL character) to indicate hex-escaped bytes, since
    /// escaped NUL will not occur.
    const LOOKUP: [u8; 256] = {
        let mut arr = [0; 256];
        let mut idx = 0;
        loop {
            arr[idx as usize] = match idx {
                // use 8th bit to indicate escaped
                b'\t' => 0x80 | b't',
                b'\r' => 0x80 | b'r',
                b'\n' => 0x80 | b'n',
                b'\\' => 0x80 | b'\\',
                b'\'' => 0x80 | b'\'',
                b'"' => 0x80 | b'"',

                // use NUL to indicate hex-escaped
                0x00..=0x1F | 0x7F..=0xFF => 0x80 | b'\0',

                _ => idx,
            };
            if idx == 255 {
                break;
            }
            idx += 1;
        }
        arr
    };

    let lookup = LOOKUP[byte as usize];

    // 8th bit indicates escape
    let lookup_escaped = lookup & 0x80 != 0;

    // SAFETY: We explicitly mask out the eighth bit to get a 7-bit ASCII character.
    let lookup_ascii = unsafe { ascii::Char::from_u8_unchecked(lookup & 0x7F) };

    if lookup_escaped {
        // NUL indicates hex-escaped
        if matches!(lookup_ascii, ascii::Char::Null) {
            hex_escape(byte)
        } else {
            backslash(lookup_ascii)
        }
    } else {
        verbatim(lookup_ascii)
    }
}

fn escape_bytes(bytes: &[u8], f: impl Fn(u8) -> ([ascii::Char; 4], Range<u8>)) -> Vec<ascii::Char> {
    let mut vec = Vec::new();
    for b in bytes {
        let (buf, range) = f(*b);
        vec.extend_from_slice(&buf[range.start as usize..range.end as usize]);
    }
    vec
}

pub fn criterion_benchmark(c: &mut Criterion) {
    let mut group = c.benchmark_group("escape_ascii");

    group.sample_size(1000);

    let rand_200k = &mut [0; 200 * 1024];
    thread_rng().fill(&mut rand_200k[..]);
    let cat = include_bytes!("/bin/cat");
    let cargo_toml = include_bytes!("/home/ltdk/rustsrc/Cargo.toml");

    group.bench_function("old_rand", |b| {
        b.iter(|| escape_bytes(rand_200k, escape_ascii_old));
    });
    group.bench_function("new_rand", |b| {
        b.iter(|| escape_bytes(rand_200k, escape_ascii_new));
    });

    group.bench_function("old_bin", |b| {
        b.iter(|| escape_bytes(cat, escape_ascii_old));
    });
    group.bench_function("new_bin", |b| {
        b.iter(|| escape_bytes(cat, escape_ascii_new));
    });

    group.bench_function("old_cargo_toml", |b| {
        b.iter(|| escape_bytes(cargo_toml, escape_ascii_old));
    });
    group.bench_function("new_cargo_toml", |b| {
        b.iter(|| escape_bytes(cargo_toml, escape_ascii_new));
    });

    group.finish();
}

criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);
```

</details>

My benchmark results:

```
escape_ascii/old_rand   time:   [1.6965 ms 1.7006 ms 1.7053 ms]
Found 22 outliers among 1000 measurements (2.20%)
  4 (0.40%) high mild
  18 (1.80%) high severe
escape_ascii/new_rand   time:   [1.6749 ms 1.6953 ms 1.7158 ms]
Found 38 outliers among 1000 measurements (3.80%)
  38 (3.80%) high mild
escape_ascii/old_bin    time:   [224.59 µs 225.40 µs 226.33 µs]
Found 39 outliers among 1000 measurements (3.90%)
  17 (1.70%) high mild
  22 (2.20%) high severe
escape_ascii/new_bin    time:   [164.86 µs 165.63 µs 166.58 µs]
Found 107 outliers among 1000 measurements (10.70%)
  43 (4.30%) high mild
  64 (6.40%) high severe
escape_ascii/old_cargo_toml
                        time:   [23.397 µs 23.699 µs 24.014 µs]
Found 204 outliers among 1000 measurements (20.40%)
  21 (2.10%) high mild
  183 (18.30%) high severe
escape_ascii/new_cargo_toml
                        time:   [16.404 µs 16.438 µs 16.483 µs]
Found 88 outliers among 1000 measurements (8.80%)
  56 (5.60%) high mild
  32 (3.20%) high severe
```

Random: 1.7006ms => 1.6953ms (<1% speedup)
Binary: 225.40µs => 165.63µs (26% speedup)
Text: 23.699µs => 16.438µs (30% speedup)
2024-10-13 14:05:50 +00:00
bors
2aa26d8a72 Auto merge of #131645 - matthiaskrgr:rollup-lgr1ezu, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #131086 (Update unicode-width to 0.2.0)
 - #131585 (compiletest: Remove the one thing that was checking a directive's `original_line`)
 - #131614 (Error on trying to use revisions in `run-make` tests)
 - #131638 (compiletest: Move debugger setup code out of `lib.rs`)
 - #131641 (switch unicode-data bitsets back to 'static')
 - #131642 (Special case error message for a `build-fail` test that failed check build)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-13 11:41:12 +00:00
Matthias Krüger
0fa7101a8d
Rollup merge of #131642 - jieyouxu:build-fail-check-fail, r=Kobzol
Special case error message for a `build-fail` test that failed check build

A `build-fail` test requires that a check build (roughly `--emit=metadata`, no codegen) succeeds but fails later. Previously, if its check build failed, the user will see the error message

```
error: test compilation failed although it shouldn't!
```

which is confusing. Because the test is `build-fail`, we want the test compilation to fail! This error message doesn't account for the difference between a check build and a complete build, so let's special case the error message for a `build-fail` test whose check build failed to instead say

```
error: `build-fail` test is required to pass check build, but check build failed
```

Fixes #130894.
2024-10-13 12:32:19 +02:00
Matthias Krüger
84dd8cdb22
Rollup merge of #131641 - RalfJung:unicode-bitset-static, r=dtolnay
switch unicode-data bitsets back to 'static'

Back in https://github.com/rust-lang/rust/pull/101401, these were changed to `const` to make some functions `const fn`. However, `@dtolnay` was [not happy](https://github.com/rust-lang/rust/issues/101400#issuecomment-1742500968) about this. Meanwhile, `const fn` can access immutable statics like these, so we can change this back.

Part of https://github.com/rust-lang/rust/issues/101400.
2024-10-13 12:32:18 +02:00
Matthias Krüger
29ef664763
Rollup merge of #131638 - Zalathar:debuggers, r=jieyouxu
compiletest: Move debugger setup code out of `lib.rs`

These functions contain a few hundred lines of code for dealing with debuggers (for `debuginfo` tests), and don't really belong in the crate root.

Moving them out to their own module makes `lib.rs` easier to follow.
2024-10-13 12:32:18 +02:00
Matthias Krüger
6d5a133995
Rollup merge of #131614 - jieyouxu:rmake-no-rev, r=Kobzol
Error on trying to use revisions in `run-make` tests

Currently, `run-make` tests do not support revisions.
2024-10-13 12:32:17 +02:00
Matthias Krüger
6e1488be72
Rollup merge of #131585 - Zalathar:original-line, r=jieyouxu
compiletest: Remove the one thing that was checking a directive's `original_line`

This special handling of `ignore-tidy*` was introduced during the migration to `//`@`` directives (#120881), and has become unnecessary after the subsequent removal of the legacy directive check (#131392).
2024-10-13 12:32:17 +02:00
Matthias Krüger
587f705742
Rollup merge of #131086 - printfn:update-unicode-width, r=Mark-Simulacrum
Update unicode-width to 0.2.0

I updated the [`unicode-width`](https://github.com/unicode-rs/unicode-width) dependency to 0.2.0. See the changelog [here](https://github.com/unicode-rs/unicode-width?tab=readme-ov-file#changelog). None of the changes seem to affect rustc.
2024-10-13 12:32:16 +02:00
Ralf Jung
90e4f10f6c switch unicode-data back to 'static' 2024-10-13 11:53:06 +02:00
许杰友 Jieyou Xu (Joe)
40ca4d8cd3 Special case error message for a build-fail test that failed check build 2024-10-13 15:59:55 +08:00
Zalathar
3c6ed4e541 Move debugger setup code out of lib.rs 2024-10-13 17:55:46 +11:00
bors
ecf2d1fa4b Auto merge of #131635 - tgross35:rollup-df8il2t, r=tgross35
Rollup of 7 pull requests

Successful merges:

 - #131120 (Stabilize `const_option`)
 - #131334 (Enable sanitizers for loongarch64-unknown-*)
 - #131358 (force "HEAD" for non-CI and `git_upstream_merge_base` for CI environment)
 - #131418 (Use throw intrinsic from stdarch in wasm libunwind)
 - #131579 (Remap path prefix in the panic message of `tests/ui/meta/revision-bad.rs`)
 - #131591 (add latest crash tests)
 - #131626 (remove a couple of redundant String to String conversion)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-13 03:59:00 +00:00
Trevor Gross
39071fdc58
Rollup merge of #131626 - matthiaskrgr:dont_string, r=lqd
remove a couple of redundant String to String conversion
2024-10-12 21:38:38 -05:00
Trevor Gross
ae8342aa90
Rollup merge of #131591 - matthiaskrgr:crashtests, r=jieyouxu
add latest crash tests
2024-10-12 21:38:37 -05:00
Trevor Gross
507dd637a3
Rollup merge of #131579 - jieyouxu:ui-panic-username, r=compiler-errors
Remap path prefix in the panic message of `tests/ui/meta/revision-bad.rs`

Otherwise `error-pattern` on the test run stderr can incorrectly match if the paths in panic backtrace has a matching substring (like if we look for `bar` in the error pattern, but the username is `baron`).

Tested locally by checking run output `./x test .\tests\ui\meta\revision-bad.rs -- -- --nocapture`:

```
--- stderr -------------------------------
thread 'main' panicked at remapped\meta\revision-bad.rs:14:5:
foo
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
------------------------------------------
```

Fixes #130996.
2024-10-12 21:38:37 -05:00
Trevor Gross
415e61c209
Rollup merge of #131418 - coolreader18:wasm-exc-use-stdarch, r=bjorn3
Use throw intrinsic from stdarch in wasm libunwind

Tracking issue: #118168

This is a very belated followup to #121438; now that rust-lang/stdarch#1542 is merged, we can use the intrinsic exported from `core::arch` instead of defining it inline. I also cleaned up the cfgs a bit and added a more detailed comment.
2024-10-12 21:38:36 -05:00