- 17 8月, 2023 4 次提交
-
-
由 Matthias Krüger 提交于
rustc book: make more pleasant to search
-
由 Matthias Krüger 提交于
Improve code readability by moving fmt args directly into the string There are some of occurrences where I also transformed `write!(f, "{}", x)` into `f.write_str(x.as_str())`. r? `@notriddle`
-
由 Matthias Krüger 提交于
Improve `invalid_reference_casting` lint This PR improves the `invalid_reference_casting` lint: - by considering an unlimited number of casts instead only const to mut ptr - by also considering ptr-to-integer and integer-to-ptr casts - by also taking into account [`ptr::cast`](https://doc.rust-lang.org/std/primitive.pointer.html#method.cast), [`ptr::cast`](https://doc.rust-lang.org/std/primitive.pointer.html#method.cast-1) and [`ptr::cast_const`](https://doc.rust-lang.org/std/primitive.pointer.html#method.cast_const) Most of this improvements comes from skimming Github Code Search result for [`&mut \*.*as \*const`](https://github.com/search?q=lang%3Arust+%2F%26mut+%5C*.*as+%5C*const%2F&type=code) r? ``@est31`` (maybe)
-
由 Matthias Krüger 提交于
we are migrating to askama see https://github.com/rust-lang/rust/issues/108868
-
- 16 8月, 2023 32 次提交
-
-
由 bors 提交于
Fix argument removal suggestion around macros Fixes #112437. Fixes #113866. Helps with #114255. The issue was that `span.find_ancestor_inside(outer)` could previously return a span with a different expansion context from `outer`. This happens for example for the built-in macro `panic!`, which expands to another macro call of `panic_2021!` or `panic_2015!`. Because the call site of `panic_20xx!` has not associated source code, its span currently points to the call site of `panic!` instead. Something similar also happens items that get desugared in AST->HIR lowering. For example, `for` loops get two spans: One "inner" span that has the `.desugaring_kind()` kind set to `DesugaringKind::ForLoop` and one "outer" span that does not. Similar to the macro situation, both of these spans point to the same source code, but have different expansion contexts. This causes problems, because joining two spans with different expansion contexts will usually[^1] not actually join them together to avoid creating "spaghetti" spans that go from the macro definition to the macro call. For example, in the following snippet `full_span` might not actually contain the `adjusted_start` and `adjusted_end`. This caused the broken suggestion / debug ICE in the linked issues. ```rust let adjusted_start = start.find_ancestor_inside(shared_ancestor); let adjusted_end = end.find_ancestor_inside(shared_ancestor); let full_span = adjusted_start.to(adjusted_end) ``` To fix the issue, this PR introduces a new method, `find_ancestor_inside_same_ctxt`, which combines the functionality of `find_ancestor_inside` and `find_ancestor_in_same_ctxt`: It finds an ancestor span that is contained within the parent *and* has the same syntax context, and is therefore safe to extend. This new method should probably be used everywhere, where the returned span is extended, but for now it is just used for the argument removal suggestion. Additionally, this PR fixes a second issue where the function call itself is inside a macro but the arguments come from outside the macro. The test is added in the first commit to include stderr diff, so this is best reviewed commit by commit. [^1]: If one expansion context is the root context and the other is not.
-
由 Guillaume Gomez 提交于
-
由 Guillaume Gomez 提交于
-
由 bors 提交于
add codegen test for `trailing_zeros` comparison This PR add codegen test for https://github.com/rust-lang/rust/issues/107554#issuecomment-1677369236 Fixes #107554.
-
由 bors 提交于
Update LLVM submodule Merge the current release/17.x branch. Fixes #114691. Fixes #114312. The test for the latter is taken from #114726.
-
由 bors 提交于
Rollup of 7 pull requests Successful merges: - #114721 (Optimizing the rest of bool's Ord implementation) - #114746 (Don't add associated type bound for non-types) - #114779 (Add check before suggest removing parens) - #114859 (Add trait related queries to SMIR's rustc_internal) - #114861 (fix typo: affect -> effect) - #114867 ([nit] Fix a comment typo.) - #114871 (Update the link in the docs of `std::intrinsics`) r? `@ghost` `@rustbot` modify labels: rollup
-
由 Matthias Krüger 提交于
Update the link in the docs of `std::intrinsics` The previous link in that place, https://github.com/rust-lang/miri/blob/master/src/shims/intrinsics.rs, no longer points to an existing file.
-
由 Matthias Krüger 提交于
[nit] Fix a comment typo.
-
由 Matthias Krüger 提交于
fix typo: affect -> effect I just realized I made a silly typo when writing that comment...
-
由 Matthias Krüger 提交于
Add trait related queries to SMIR's rustc_internal r? `@oli-obk`
-
由 Matthias Krüger 提交于
Add check before suggest removing parens Fixes #114701
-
由 Matthias Krüger 提交于
Don't add associated type bound for non-types We had this fix for equality constraints (#99890), but for some reason not trait constraints
😅 Fixes #114744 -
由 Matthias Krüger 提交于
Optimizing the rest of bool's Ord implementation After coming across issue #66780, I realized that the other functions provided by Ord (`min`, `max`, and `clamp`) were similarly inefficient for bool. This change provides implementations for them in terms of boolean operators, resulting in much simpler assembly and faster code. Fixes issue #114653 [Comparison on Godbolt](https://rust.godbolt.org/z/5nb5P8e8j) `max` assembly before: ```assembly example::max: mov eax, edi mov ecx, eax neg cl mov edx, esi not dl cmp dl, cl cmove eax, esi ret ``` `max` assembly after: ```assembly example::max: mov eax, edi or eax, esi ret ``` `clamp` assembly before: ```assembly example::clamp: mov eax, esi sub al, dl inc al cmp al, 2 jae .LBB1_1 mov eax, edi sub al, sil movzx ecx, dil sub dil, dl cmp dil, 1 movzx edx, dl cmovne edx, ecx cmp al, -1 movzx eax, sil cmovne eax, edx ret .LBB1_1: ; identical assert! code ``` `clamp` assembly after: ```assembly example::clamp: test edx, edx jne .LBB1_2 test sil, sil jne .LBB1_3 .LBB1_2: or dil, sil and dil, dl mov eax, edi ret .LBB1_3: ; identical assert! code ```
-
由 khei4 提交于
specify llvm-version and bit width for int arg add missing percent simbol
-
由 Tshepang Mbambo 提交于
-
由 bors 提交于
Do not mark shallow_lint_levels_on as eval_always. It does not need it. Removing it allows to skip recomputation.
-
由 bors 提交于
Stabilize thread local cell methods. Closes #92122.
-
由 bors 提交于
Cleaner assert_eq! & assert_ne! panic messages This PR finishes refactoring of the assert messages per #94005. The panic message format change #112849 used to be part of this PR, but has been factored out and just merged. It might be better to keep both changes in the same release once FCP vote completes. Modify panic message for `assert_eq!`, `assert_ne!`, the currently unstable `assert_matches!`, as well as the corresponding `debug_assert_*` macros. ```rust assert_eq!(1 + 1, 3); assert_eq!(1 + 1, 3, "my custom message value={}!", 42); ``` #### Old messages ```plain thread 'main' panicked at $DIR/main.rs:6:5: assertion failed: `(left == right)` left: `2`, right: `3` ``` ```plain thread 'main' panicked at $DIR/main.rs:6:5: assertion failed: `(left == right)` left: `2`, right: `3`: my custom message value=42! ``` #### New messages ```plain thread 'main' panicked at $DIR/main.rs:6:5: assertion `left == right` failed left: 2 right: 3 ``` ```plain thread 'main' panicked at $DIR/main.rs:6:5: assertion `left == right` failed: my custom message value=42! left: 2 right: 3 ``` History of fixing #94005 * #94016 was a lengthy PR that was abandoned * #111030 was similar, but it stringified left and right arguments, and thus caused compile time performance issues, thus closed * #112849 factored out the two-line formatting of all panic messages Fixes #94005 r? `@m-ou-se`
-
由 Tim Kurdov 提交于
The previous link in that place, https://github.com/rust-lang/miri/blob/master/src/shims/intrinsics.rs, no longer points to an existing file.
-
由 bors 提交于
Rollup of 8 pull requests Successful merges: - #114588 (Improve docs for impl Default for ExitStatus) - #114619 (Fix pthread_attr_union layout on Wasi) - #114644 (Point out expectation even if we have `TypeError::RegionsInsufficientlyPolymorphic`) - #114668 (Deny `FnDef` in patterns) - #114819 (Point at return type when it influences non-first `match` arm) - #114826 (Fix typos) - #114837 (add missing feature(error_in_core)) - #114853 (Migrate GUI colors test to original CSS color format) r? `@ghost` `@rustbot` modify labels: rollup
-
由 Yuri Astrakhan 提交于
Modify panic message for `assert_eq!`, `assert_ne!`, the currently unstable `assert_matches!`, as well as the corresponding `debug_assert_*` macros. ```rust assert_eq!(1 + 1, 3); assert_eq!(1 + 1, 3, "my custom message value={}!", 42); ``` ```plain thread 'main' panicked at $DIR/main.rs:6:5: assertion failed: `(left == right)` left: `2`, right: `3` ``` ```plain thread 'main' panicked at $DIR/main.rs:6:5: assertion failed: `(left == right)` left: `2`, right: `3`: my custom message value=42! ``` ```plain thread 'main' panicked at $DIR/main.rs:6:5: assertion `left == right` failed left: 2 right: 3 ``` ```plain thread 'main' panicked at $DIR/main.rs:6:5: assertion `left == right` failed: my custom message value=42! left: 2 right: 3 ``` This PR is a simpler subset of the #111030, but it does NOT stringify the original left and right source code assert expressions, thus should be faster to compile.
-
由 Taras Tsugrii 提交于
-
由 Matthias Krüger 提交于
Migrate GUI colors test to original CSS color format Follow-up of https://github.com/rust-lang/rust/pull/111459. r? ``@notriddle``
-
由 Matthias Krüger 提交于
add missing feature(error_in_core) Needed to fix feature gate errors in https://github.com/rust-lang/miri-test-libstd/actions/runs/5862810459/job/15895203359. I don't know how doctests are passing in-tree without this feature gate...
-
由 Matthias Krüger 提交于
Fix typos
-
由 Matthias Krüger 提交于
Point at return type when it influences non-first `match` arm When encountering code like ```rust fn foo() -> i32 { match 0 { 1 => return 0, 2 => "", _ => 1, } } ``` Point at the return type and not at the prior arm, as that arm has type `!` which isn't influencing the arm corresponding to arm `2`. Fix #78124.
-
由 Matthias Krüger 提交于
Deny `FnDef` in patterns We can only see these via `const { .. }` patterns, which are unstable. cc #76001 (tracking issue for inline const pats) Fixes #114658 Fixes #114659
-
由 Matthias Krüger 提交于
Point out expectation even if we have `TypeError::RegionsInsufficientlyPolymorphic` just a minor tweak, since saying "one type is more general than the other" kinda sucks if we don't actually point out two types.
-
由 Matthias Krüger 提交于
Fix pthread_attr_union layout on Wasi Fixes https://github.com/rust-lang/rust/issues/114608 Ran the tests as described in https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support/wasm32-wasi-preview1-threads.md?plain=1#L125
-
由 Matthias Krüger 提交于
Improve docs for impl Default for ExitStatus This addresses a review comment in #106425 (which is on the way to being merged I think). Some of the other followup work is more complicated so I'm going to do individual MRs. ~~Note this branch is on top of #106425~~
-
由 Ralf Jung 提交于
-
由 Santiago Pastorino 提交于
-
- 15 8月, 2023 4 次提交
-
-
由 bors 提交于
Rollup of 10 pull requests Successful merges: - #114711 (Infer `Lld::No` linker hint when the linker stem is a generic compiler driver) - #114772 (Add `{Local}ModDefId` to more strongly type DefIds`) - #114800 (std: add some missing repr(transparent)) - #114820 (Add test for unknown_lints from another file.) - #114825 (Upgrade std to gimli 0.28.0) - #114827 (Only consider object candidates for object-safe dyn types in new solver) - #114828 (Probe when assembling upcast candidates so they don't step on eachother's toes in new solver) - #114829 (Separate `consider_unsize_to_dyn_candidate` from other unsize candidates) - #114830 (Clean up some bad UI testing annotations) - #114831 (Check projection args before substitution in new solver) r? `@ghost` `@rustbot` modify labels: rollup
-
由 Ian Jackson 提交于
This lets us put a version on the impl, too.
-
由 bors 提交于
Don't panic in ceil_char_boundary Implementing the alternative mentioned in this comment: https://github.com/rust-lang/rust/issues/93743#issuecomment-1579935853 Since `floor_char_boundary` will always work (rounding down to the length of the string is possible), it feels best for `ceil_char_boundary` to not panic either. However, the semantics of "rounding up" past the length of the string aren't very great, which is why the method originally panicked in these cases. Taking into account how people are using this method, it feels best to simply return the end of the string in these cases, so that the result is still a valid char boundary.
-
由 Mara Bos 提交于
Co-authored-by: NJosh Stone <cuviper@gmail.com>
-