about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2025-02-20Merge pull request #19190 from BenjaminBrienen/patch-4Laurențiu Nicola-3/+2
Update editor_features.md
2025-02-20Update docs for default features of wasm targetsAlex Crichton-0/+2
LLVM 20 enabled the `nontrapping-fptoint` and `bulk-memory` features by default, so this updates the corresponding documentation for the `wasm32-*` targets (which all point to `wasm32-unknown-unknown`). cc #137315
2025-02-21Resolve some FIXME from socketpair testtiif-6/+2
2025-02-20Update editor_features.mdBenjamin Brienen-3/+2
fix typos in snippets
2025-02-20Merge pull request #19151 from infiniteregrets/infi/fix-proc-macroLukas Wirth-31/+159
Use correct working directory for non-workspace proc-macro execution
2025-02-20Rewrite effects checking chapterDeadbeef-67/+131
2025-02-20Add explanation commentJakub Beránek-0/+1
Co-authored-by: Ralf Jung <post@ralfj.de>
2025-02-20Remove GitHub job summariesJakub Beránek-9/+4
They don't seem to be used by miri contributors, and they pollute job summaries in rust-lang/rust.
2025-02-20Merge pull request #19188 from lnicola/ubuntu-latestLaurențiu Nicola-3/+3
internal: Use ubuntu-latest workers for releases
2025-02-20Use ubuntu-latest workers for releasesLaurențiu Nicola-3/+3
2025-02-20Merge pull request #19185 from BenjaminBrienen/patch-3Laurențiu Nicola-1/+1
Update architecture.md
2025-02-20Merge pull request #19187 from BenjaminBrienen/patch-4Laurențiu Nicola-3/+3
Update configuration.md
2025-02-20Auto merge of #137023 - Kobzol:bump-sccache, r=marcoienibors-5/+11
Bump sccache in CI to 0.9.1 We haven't updated the used sccache version for years, it has accrued a bunch of fixes and features in the meantime. It now supports the `--show-adv-stats` flag, which gives a more detailed summary of the results of caching. And it can also cache Rust code, which could be useful in the future (https://github.com/rust-lang/rust/pull/136942 - although now there are no large wins). It also supports caching PGO now, but since the PGO profiles are always different, it won't make any real difference. https://github.com/rust-lang/rust/pull/133076 previously tried to update the version to 0.3 (CC `@klensy)` r? `@marcoieni`
2025-02-20Simplify `Postorder` customization.Nicholas Nethercote-1/+1
`Postorder` has a `C: Customization<'tcx>` parameter, that gives it flexibility about how it computes successors. But in practice, there are only two `impls` of `Customization`, and one is for the unit type. This commit simplifies things by removing the generic parameter and replacing it with an `Option`.
2025-02-20Auto merge of #137295 - matthiaskrgr:rollup-tdu3t39, r=matthiaskrgrbors-1/+92
Rollup of 9 pull requests Successful merges: - #135296 (interpret: adjust vtable validity check for higher-ranked types) - #137106 (Add customized compare for Link in rustdoc) - #137253 (Restrict `bevy_ecs` `ParamSet` hack) - #137262 (Make fewer crates depend on `rustc_ast_ir`) - #137263 (Register `USAGE_OF_TYPE_IR_INHERENT`, remove inherent usages) - #137266 (MIR visitor tweaks) - #137269 (Pattern Migration 2024: properly label `&` patterns whose subpatterns are from macro expansions) - #137277 (stabilize `inherent_str_constructors`) - #137281 (Tweak "expected ident" parse error to avoid talking about doc comments) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-20Update configuration.mdBenjamin Brienen-3/+3
fix dead links
2025-02-19missed the L for the line numberJosh Rotenberg-1/+1
2025-02-20Update architecture.mdBenjamin Brienen-1/+1
it is stable since 1.52
2025-02-20Rollup merge of #137106 - chenyukang:yukang-fix-sidebar-sort, r=notriddleMatthias Krüger-1/+17
Add customized compare for Link in rustdoc Maybe some other types in sidebar need to be sorted in this way, maybe add this crate `natord` is ok? r? clubby789 Fixes #137098
2025-02-20Rollup merge of #135296 - lukas-code:dyn-leak-check, r=compiler-errorsMatthias Krüger-0/+75
interpret: adjust vtable validity check for higher-ranked types ## What Transmuting between trait objects where a generic argument or associated type only differs in bound regions (not bound at or above the trait object's binder) is now UB. For example * transmuting between `&dyn Trait<for<'a> fn(&'a u8)>` and `&dyn Trait<fn(&'static u8)>` is UB. * transmuting between `&dyn Trait<Assoc = for<'a> fn(&'a u8)>` and `&dyn Trait<Assoc = fn(&'static u8)>` is UB. * transmuting between `&dyn Trait<for<'a> fn(&'a u8) -> (&'a u8, &'static u8)>` and `&dyn Trait<for<'a> fn(&'a u8) -> (&'static u8, &'a u8)>` is UB. Transmuting between subtypes (in either direction) is still allowed, which means that bound regions that are bound at or above the trait object's binder can still be changed: * transmuting between `&dyn for<'a> Trait<fn(&'a u8)>` and `&dyn for Trait<fn(&'static u8)>` is fine. * transmuting between `&dyn for<'a> Trait<dyn Trait<fn(&'a u8)>>` and `&dyn for Trait<dyn Trait<fn(&'static u8)>>` is fine. ## Why Very similar to https://github.com/rust-lang/rust/issues/120217 and https://github.com/rust-lang/rust/issues/120222, changing a trait object's generic argument to a type that only differs in bound regions can still affect the vtable layout and lead to segfaults at runtime (for an example see `src/tools/miri/tests/fail/validity/dyn-transmute-inner-binder.rs`). Since we already already require that the trait object predicates must be equal modulo bound regions, it is only natural to extend this check to also require type equality considering bound regions. However, it also makes sense to allow transmutes between a type and a subtype thereof. For example `&dyn for<'a> Trait<&'a u8>` is a subtype of `&dyn Trait<&'static ()>` and they are guaranteed to have the same vtable, so it makes sense to allow this transmute. So that's why bound lifetimes that are bound to the trait object itself are treated as free lifetime for the purpose of this check. Note that codegen already relies on the property that subtyping cannot change the the vtable and this is asserted here (note the leak check): https://github.com/rust-lang/rust/blob/251206c27b619ccf3a08e2ac4c525dc343f08492/compiler/rustc_codegen_ssa/src/base.rs#L106-L153 Furthermore, we allow some pointer-to-pointer casts like `*const dyn for<'a> Trait<&'a u8>` to `*const Wrapper<dyn Trait<&'static u8>>` that instantiate the trait object binder and are currently lowered to a single pointer-to-pointer cast in MIR (`CastKind::PtrToPtr`) and *not* an unsizing coercion (`CastKind::PointerCoercion(Unsize)`), so the current MIR lowering of these would be UB if we didn't allow subtyping transmutes. --- fixes https://github.com/rust-lang/rust/issues/135230 cc `@rust-lang/opsem` r? `@compiler-errors` for the implementation
2025-02-20Explicitly compare `TypesMap` as ptrsShoyu Vanilla-12/+17
2025-02-19Auto merge of #137290 - matthiaskrgr:rollup-a7xdbi4, r=matthiaskrgrbors-9/+12
Rollup of 8 pull requests Successful merges: - #120580 (Add `MAX_LEN_UTF8` and `MAX_LEN_UTF16` Constants) - #132268 (Impl TryFrom<Vec<u8>> for String) - #136093 (Match Ergonomics 2024: update old-edition behavior of feature gates) - #136344 (Suggest replacing `.` with `::` in more error diagnostics.) - #136690 (Use more explicit and reliable ptr select in sort impls) - #136815 (CI: Stop /msys64/bin from being prepended to PATH in msys2 shell) - #136923 (Lint `#[must_use]` attributes applied to methods in trait impls) - #137155 (Organize `OsString`/`OsStr` shims) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-19Rollup merge of #136923 - samueltardieu:push-vxxqvqwspssv, r=davidtwcoMatthias Krüger-4/+0
Lint `#[must_use]` attributes applied to methods in trait impls The `#[must_use]` attribute has no effect when applied to methods in trait implementations. This PR adds it to the unused `#[must_use]` lint, and cleans the extra attributes in portable-simd and Clippy.
2025-02-19Rollup merge of #136815 - ChrisDenton:fix-mingw-ci, r=KobzolMatthias Krüger-0/+6
CI: Stop /msys64/bin from being prepended to PATH in msys2 shell We used to do this along time ago but we stopped doing it when we started installing msys2 manually. https://github.com/rust-lang/rust/blob/4fd3cf96a1db7771ef4f332b9eb1ad17fa0fd091/src/ci/scripts/install-msys2.sh#L11-L13 Fixes #136795 try-job: dist-i686-mingw
2025-02-19Rollup merge of #136344 - zachs18:dot_notation_more_defkinds_3, r=davidtwcoMatthias Krüger-1/+0
Suggest replacing `.` with `::` in more error diagnostics. First commit makes the existing "help: use the path separator to refer to an item" also work when the base is a type alias, not just a trait/module/struct. The existing unconditional `DefKind::Mod | DefKind::Trait` match arm is changed to a conditional `DefKind::Mod | DefKind::Trait | DefKind::TyAlias` arm that only matches if the `path_sep` suggestion-adding closure succeeds, so as not to stop the later `DefKind::TyAlias`-specific suggestions if the path-sep suggestion does not apply. This shouldn't change behavior for `Mod` or `Trait` (due to the default arm's `return false` etc). This commit also updates `tests/ui/resolve/issue-22692.rs` to reflect this, and also renames it to something more meaningful. This commit also makes the `bad_struct_syntax_suggestion` closure take `err` as a parameter instead of capturing it, since otherwise caused borrowing errors due to the change to using `path_sep` in a pattern guard. <details> <summary> Type alias diagnostic example </summary> ```rust type S = String; fn main() { let _ = S.new; } ``` ```diff error[E0423]: expected value, found type alias `S` --> diag7.rs:4:13 | 4 | let _ = S.new; | ^ | - = note: can't use a type alias as a constructor + help: use the path separator to refer to an item + | +4 | let _ = S::new; + | ~~ ``` </details> Second commit adds some cases for `enum`s, where if there is a field/method expression where the field/method has the name of a unit/tuple variant, we assume the user intended to create that variant[^1] and suggest replacing the `.` from the field/method suggestion with a `::` path separator. If no such variant is found (or if the error is not a field/method expression), we give the existing suggestion that suggests adding `::TupleVariant(/* fields */)` after the enum. <details> <summary> Enum diagnostic example </summary> ```rust enum Foo { A(u32), B, C { x: u32 }, } fn main() { let _ = Foo.A(42); // changed let _ = Foo.B; // changed let _ = Foo.D(42); // no change let _ = Foo.D; // no change let _ = Foo(42); // no change } ``` ```diff error[E0423]: expected value, found enum `Foo` --> diag8.rs:8:13 | 8 | let _ = Foo.A(42); // changed | ^^^ | note: the enum is defined here --> diag8.rs:1:1 | 1 | / enum Foo { 2 | | A(u32), 3 | | B, 4 | | C { x: u32 }, 5 | | } | |_^ -help: you might have meant to use the following enum variant - | -8 | let _ = Foo::B.A(42); // changed - | ~~~~~~ -help: alternatively, the following enum variant is available +help: use the path separator to refer to a variant | -8 | let _ = (Foo::A(/* fields */)).A(42); // changed - | ~~~~~~~~~~~~~~~~~~~~~~ +8 | let _ = Foo::A(42); // changed + | ~~ error[E0423]: expected value, found enum `Foo` --> diag8.rs:9:13 | 9 | let _ = Foo.B; // changed | ^^^ | note: the enum is defined here --> diag8.rs:1:1 | 1 | / enum Foo { 2 | | A(u32), 3 | | B, 4 | | C { x: u32 }, 5 | | } | |_^ -help: you might have meant to use the following enum variant - | -9 | let _ = Foo::B.B; // changed - | ~~~~~~ -help: alternatively, the following enum variant is available +help: use the path separator to refer to a variant | -9 | let _ = (Foo::A(/* fields */)).B; // changed - | ~~~~~~~~~~~~~~~~~~~~~~ +9 | let _ = Foo::B; // changed + | ~~ error[E0423]: expected value, found enum `Foo` --> diag8.rs:10:13 | 10 | let _ = Foo.D(42); // no change | ^^^ | note: the enum is defined here --> diag8.rs:1:1 | 1 | / enum Foo { 2 | | A(u32), 3 | | B, 4 | | C { x: u32 }, 5 | | } | |_^ help: you might have meant to use the following enum variant | 10 | let _ = Foo::B.D(42); // no change | ~~~~~~ help: alternatively, the following enum variant is available | 10 | let _ = (Foo::A(/* fields */)).D(42); // no change | ~~~~~~~~~~~~~~~~~~~~~~ error[E0423]: expected value, found enum `Foo` --> diag8.rs:11:13 | 11 | let _ = Foo.D; // no change | ^^^ | note: the enum is defined here --> diag8.rs:1:1 | 1 | / enum Foo { 2 | | A(u32), 3 | | B, 4 | | C { x: u32 }, 5 | | } | |_^ help: you might have meant to use the following enum variant | 11 | let _ = Foo::B.D; // no change | ~~~~~~ help: alternatively, the following enum variant is available | 11 | let _ = (Foo::A(/* fields */)).D; // no change | ~~~~~~~~~~~~~~~~~~~~~~ error[E0423]: expected function, tuple struct or tuple variant, found enum `Foo` --> diag8.rs:12:13 | 12 | let _ = Foo(42); // no change | ^^^ help: try to construct one of the enum's variants: `Foo::A` | = help: you might have meant to construct the enum's non-tuple variant note: the enum is defined here --> diag8.rs:1:1 | 1 | / enum Foo { 2 | | A(u32), 3 | | B, 4 | | C { x: u32 }, 5 | | } | |_^ error: aborting due to 5 previous errors ``` </details> [^1]: or if it's a field expression and a tuple variant, that they meant to refer the variant constructor.
2025-02-19Rollup merge of #136093 - dianne:match-2024-for-edition-2021, r=NadrierilMatthias Krüger-4/+6
Match Ergonomics 2024: update old-edition behavior of feature gates This updates the behavior of the feature gates `ref_pat_eat_one_layer_2024_structural` and `ref_pat_eat_one_layer_2024` in Editions 2021 and earlier to correspond to the left and right typing rules compared [here](https://nadrieril.github.io/typing-rust-patterns/?opts1=AQEBAQIBAQEBAAAAAAAAAAAAAAAAAAA%3D&style=UserVisible&compare=true&opts2=AQEBAQIBAQABAAAAAQEBAAEBAAABAAA%3D&mode=rules), respectively. Compared to the `stable_rust` rules: - they both allow reference patterns to match a lone inherited ref, - they both allow `&` patterns to eat `&mut` reference types (and lone `&mut` inherited refs) as if they're shared, - they both allow `&mut` patterns to eat `&` reference types when there's a `&mut` inherited reference to also eat, - and the left ruleset has RFC 3627's Rule 3: after encountering a shared reference type in the scrutinee, the default binding mode will be treated as by-shared-ref when it would otherwise be by-mutable-ref. I think there's already tests for all of those typing rules, so I've added revisions to use the existing tests with the new rulesets. Additionally, I've added a few tests to make sure we handle mixed-edition patterns appropriately, and I've added references to the unstable book. Relevant tracking issue: #123076 r? ``@ghost``
2025-02-19librustdoc: Use `pulldown-cmark-escape` for HTML escapingYotam Ofek-48/+4
2025-02-20Merge pull request #2256 from torfsen/fix-examples-for-nightly-2025-02-13许杰友 Jieyou Xu (Joe)-14/+37
2025-02-19Create a generic AVR target: avr-nonePatryk Wychowaniec-1/+92
This commit removes the `avr-unknown-gnu-atmega328` target and replaces it with a more generic `avr-none` variant that must be specialized with the `-C target-cpu` flag (e.g. `-C target-cpu=atmega328p`).
2025-02-19Rollup merge of #137227 - epage:features_untracked, r=compiler-errorsMatthias Krüger-3/+1
docs(dev): Update the feature-gate instructions `features_untracked` was removed in #114723 features are now functions as of #132027
2025-02-19Rollup merge of #127793 - ChaiTRex:zed_support, r=KobzolMatthias Krüger-39/+128
Added project-specific Zed IDE settings This repository currently has project-specific VS Code IDE settings in `.vscode` and `compiler/rustc_codegen_cranelift/.vscode`. Now there are equivalent project-specific Zed IDE settings alongside those. This fixes `rust-analyzer` not being able to properly handle this project. Note that: 1. The contents of `src/tools/rust-analyzer/.vscode` could not be translated to Zed, as they aren't basic IDE settings. 2. One of the VS Code settings in `.vscode` has no corresponding setting in Zed, and so this has been noted like this: ```json "_settings_only_in_vs_code_not_yet_in_zed": { "git.detectSubmodulesLimit": 20 }, ```
2025-02-19print warning and help messagesonur-ozkan-0/+10
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-02-19add change-entry for tools profile updateonur-ozkan-0/+5
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-02-19set `build.test-stage = 2` for `tools` profileonur-ozkan-0/+2
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-02-20fix: Binding wrong assoc ty when lowering trait ref boundShoyu Vanilla-10/+45
2025-02-19Merge pull request #19180 from joshrotenberg/fix-source-file-urlLukas Wirth-1/+7
doc: use fully qualified url for source path
2025-02-19add rustc-dev doc about bootstrap toolsonur-ozkan-0/+24
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-02-19Merge from rustcThe Miri Cronjob Bot-3461/+10449
2025-02-19Preparing for merge from rustcThe Miri Cronjob Bot-1/+1
2025-02-18"classic2021" ruleset: experimentally add fallback-to-outer (eat both)dianne-1/+1
My reasoning: the ruleset implemented by the same feature gate in Edition 2024 always tries to eat the inherited reference first. For consistency, it makes sense to me to say across all editions that users should consider the inherited reference's mutability when wondering if a `&mut` pattern will type.
2025-02-18update unstable bookdianne-4/+6
2025-02-19Add custom sort for link in rustdocyukang-1/+17
2025-02-19Rollup merge of #137177 - GuillaumeGomez:update-minifier, r=notriddleMatthias Krüger-1/+1
Update `minifier-rs` version to `0.3.5` Encountered a bug around handling of `*` which blocked me for something I'm working on. Also includes multiple fixes from ```@notriddle.``` r? ```@notriddle```
2025-02-18Merge pull request #19179 from alibektas/19090_newChayim Refael Friedman-2/+98
Ignore assists with many results if grouping not supported
2025-02-18Auto merge of #137235 - matthiaskrgr:rollup-2kjua2t, r=matthiaskrgrbors-71/+83
Rollup of 10 pull requests Successful merges: - #135711 (Do not ICE on default_field_value const with lifetimes) - #136599 (librustdoc: more usages of `Joined::joined`) - #136876 (Locking documentation updates) - #137000 (Deeply normalize item bounds in new solver) - #137126 (fix docs for inherent str constructors) - #137161 (Pattern Migration 2024: fix incorrect messages/suggestions when errors arise in macro expansions) - #137191 (Update mdbook and move error_index_generator) - #137203 (Improve MIR modification) - #137206 (Make E0599 a structured error) - #137218 (misc `layout_of` cleanup) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-18Add a check_assist_* overload and move tests under assistsAli Bektas-37/+66
2025-02-18use fully qualified url for source pathJosh Rotenberg-1/+7
2025-02-18Fix 19090Ali Bektas-0/+67
2025-02-18Suggest using :: instead of . in more cases.Zachary S-1/+0
When `Foo.field` or `Foo.method()` exprs are encountered, suggest `Foo::field` or `Foo::method()` when Foo is a type alias, not just a struct, trait, or module. Also rename test for this suggestion from issue-22692.rs to something more meaningful.
2025-02-18Rollup merge of #137191 - ehuss:update-mdbook, r=jieyouxuMatthias Krüger-20/+13
Update mdbook and move error_index_generator This moves error_index_generator to the rustbook workspace so that it can share the dependency with mdbook. I had forgotten that error_index_generator is using mdbook. This includes a corresponding update to mdbook which avoids a regression in error_index_generator. Closes https://github.com/rust-lang/rust/issues/137052