about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-12-10Rollup merge of #131558 - ↵León Orell Valerian Liehr-5/+143
sassman:feat/warnin-for-no-mangle-together-with-export-name, r=Urgau Lint on combining `#[no_mangle]` and `#[export_name]` This is my very first contribution to the compiler, even though I read the [chapter about lints](https://rustc-dev-guide.rust-lang.org/diagnostics.html) I'm not very certain that this ~~new lint is done right as a builtin lint~~ PR is right. I appreciate any guidance on how to improve the code. - Add test for issue #47446 - ~~Implement the new lint `mixed_export_name_and_no_mangle` as a builtin lint (not sure if that is the right way to go)~~ Extend `unused_attributes` lint - Add suggestion how to fix it <details> <summary>Old proposed new lint</summary> > The `mixed_export_name_and_no_mangle` lint detects usage of both `#[export_name]` and `#[no_mangle]` on the same item which results on `#[no_mangle]` being ignored. > > *warn-by-default* > > ### Example > > ```rust > #[no_mangle] // ignored > #[export_name = "foo"] // takes precedences > pub fn bar() {} > ``` > > ### Explanation > > The compiler will not respect the `#[no_mangle]` attribute when generating the symbol name for the function, as the `#[export_name]` attribute takes precedence. This can lead to confusion and is unnecessary. </details>
2024-12-10Auto merge of #134096 - fmease:rollup-0asgoo8, r=fmeasebors-465/+412
Rollup of 9 pull requests Successful merges: - #133996 (Move most tests for `-l` and `#[link(..)]` into `tests/ui/link-native-libs`) - #134012 (Grammar fixes) - #134032 (docs: better examples for `std::ops::ControlFlow`) - #134040 (bootstrap: print{ln}! -> eprint{ln}! (take 2)) - #134043 (Add test to check unicode identifier version) - #134053 (rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 10)) - #134055 (interpret: clean up deduplicating allocation functions) - #134073 (dataflow_const_prop: do not eval a ptr address in SwitchInt) - #134084 (Fix typo in RFC mention 3598 -> 3593) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-10Auto merge of #129514 - estebank:default-field-values, r=compiler-errorsbors-394/+1569
Introduce `default_field_values` feature Initial implementation of `#[feature(default_field_values]`, proposed in https://github.com/rust-lang/rfcs/pull/3681. We now parse const expressions after a `=` in a field definition, to specify a `struct` field default value. We now allow `Struct { field, .. }` where there's no base after `..`. `#[derive(Default)]` now uses the default value if present, continuing to use `Default::default()` if not. ```rust #[derive(Debug)] pub struct S; #[derive(Debug, Default)] pub struct Foo { pub bar: S = S, pub baz: i32 = 42 + 3, } fn main () { let x = Foo { .. }; let y = Foo::default(); let z = Foo { baz: 1, .. }; assert_eq!(45, x.baz); assert_eq!(45, y.baz); assert_eq!(1, z.baz); } ```
2024-12-09Rollup merge of #134084 - estebank:typo, r=compiler-errorsLeón Orell Valerian Liehr-1/+1
Fix typo in RFC mention 3598 -> 3593 https://github.com/rust-lang/rfcs/blob/master/text/3593-unprefixed-guarded-strings.md
2024-12-09Rollup merge of #134073 - DianQK:fix-131227, r=oli-obkLeón Orell Valerian Liehr-18/+26
dataflow_const_prop: do not eval a ptr address in SwitchInt Fixes #131227.
2024-12-09Rollup merge of #134055 - RalfJung:interpret-alloc-dedup, r=oli-obkLeón Orell Valerian Liehr-138/+24
interpret: clean up deduplicating allocation functions The "align" and "kind" arguments would be largely ignored in the "dedup" case, so let's move that to entirely separate function. Let's also remove support for old-style miri_resolve_frame while we are at it. The docs have already said for a while that this must be set to 1.
2024-12-09Rollup merge of #134053 - notriddle:notriddle/issue-d, r=GuillaumeGomezLeón Orell Valerian Liehr-86/+95
rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 10) Follow up https://github.com/rust-lang/rust/pull/130287 et al As always, it's easier to review the commits one at a time. Don't use the Files Changed tab. It's confusing.
2024-12-09Rollup merge of #134043 - ehuss:unicode-version, r=jieyouxuLeón Orell Valerian Liehr-0/+40
Add test to check unicode identifier version This adds a test to verify which version of Unicode is used for identifiers. This is part of the language, documented at https://doc.rust-lang.org/nightly/reference/identifiers.html#r-ident.unicode. The version here often changes implicitly due to dependency updates pulling in new versions, and thus we often don't notice it has changed leaving the documentation out of date. The intent here is to have a canary to give us a notification when it changes so that we can update the documentation.
2024-12-09Rollup merge of #134040 - clubby789:bootstrap-eprintln, r=jieyouxuLeón Orell Valerian Liehr-207/+211
bootstrap: print{ln}! -> eprint{ln}! (take 2) r? `@jieyouxu` Reland of #133817 with the `print!`s changed as well.
2024-12-09Rollup merge of #134032 - snprajwal:fix-docs, r=joboetLeón Orell Valerian Liehr-8/+8
docs: better examples for `std::ops::ControlFlow` Fixes #133963. Lesson learnt, never force-push from a bare clone of a repo :skull:
2024-12-09Rollup merge of #134012 - aarikpokras:patch-1, r=saethlinLeón Orell Valerian Liehr-1/+1
Grammar fixes Fixed some grammar in README.md
2024-12-09Rollup merge of #133996 - Zalathar:ui-link-native-libs, r=jieyouxuLeón Orell Valerian Liehr-6/+6
Move most tests for `-l` and `#[link(..)]` into `tests/ui/link-native-libs` Tests for the closely-related `-l` flag and `#[link(..)]` attribute are spread across a few different directories, and in some cases have ended up in a test directory intended for other linker-related functionality. This PR moves most of them into a single `tests/ui/link-native-libs` directory. --- Part of #133895. try-job: i686-mingw r? jieyouxu
2024-12-09Grammar fixesAarik Pokras-1/+1
2024-12-09Support x-crate default fieldsEsteban Küber-1/+24
2024-12-09Unconditionally error at definition if default field value has const errorsEsteban Küber-148/+29
Emit E0080 always on struct definition with default fields that have unconditional const errors and remove `default_field_always_invalid_const` lint.
2024-12-09Disallow `#[default] Variant {}` regardless of feature flagEsteban Küber-11/+38
2024-12-09review comments: rewordingsEsteban Küber-50/+50
2024-12-09Provide diagnostic for `Struct(a, .., z)` expressionEsteban Küber-8/+123
People might extrapolate from `Struct { .. }` that `Struct(..)` would work, but it doesn't.
2024-12-09Detect `struct S(ty = val);`Esteban Küber-11/+63
Emit a specific error for unsupported default field value syntax in tuple structs.
2024-12-09Introduce `default_field_values` featureEsteban Küber-369/+1446
Initial implementation of `#[feature(default_field_values]`, proposed in https://github.com/rust-lang/rfcs/pull/3681. Support default fields in enum struct variant Allow default values in an enum struct variant definition: ```rust pub enum Bar { Foo { bar: S = S, baz: i32 = 42 + 3, } } ``` Allow using `..` without a base on an enum struct variant ```rust Bar::Foo { .. } ``` `#[derive(Default)]` doesn't account for these as it is still gating `#[default]` only being allowed on unit variants. Support `#[derive(Default)]` on enum struct variants with all defaulted fields ```rust pub enum Bar { #[default] Foo { bar: S = S, baz: i32 = 42 + 3, } } ``` Check for missing fields in typeck instead of mir_build. Expand test with `const` param case (needs `generic_const_exprs` enabled). Properly instantiate MIR const The following works: ```rust struct S<A> { a: Vec<A> = Vec::new(), } S::<i32> { .. } ``` Add lint for default fields that will always fail const-eval We *allow* this to happen for API writers that might want to rely on users' getting a compile error when using the default field, different to the error that they would get when the field isn't default. We could change this to *always* error instead of being a lint, if we wanted. This will *not* catch errors for partially evaluated consts, like when the expression relies on a const parameter. Suggestions when encountering `Foo { .. }` without `#[feature(default_field_values)]`: - Suggest adding a base expression if there are missing fields. - Suggest enabling the feature if all the missing fields have optional values. - Suggest removing `..` if there are no missing fields.
2024-12-09Apply suggestions from code reviewSven Kanoldt-8/+8
commit suggestion of not always pretty printing Co-authored-by: Urgau <3616612+Urgau@users.noreply.github.com>
2024-12-09Fix typo in RFC mention 3598 -> 3593Esteban Küber-1/+1
https://github.com/rust-lang/rfcs/blob/master/text/3593-unprefixed-guarded-strings.md
2024-12-09Auto merge of #134064 - jieyouxu:revert-131669, r=ChrisDentonbors-490/+208
Revert #131669 due to ICEs Revert [lint: change help for pointers to dyn types in FFI #131669](https://github.com/rust-lang/rust/pull/131669) due to ICE reports: - <https://github.com/rust-lang/rust/issues/134059> (real-world) - <https://github.com/rust-lang/rust/issues/134060> (fuzzing) Closes #134060. The revert criteria I used to assess whether to post this revert was: 1. It's not trivial to fix-forward. (1) The implementation itself is tricky due to `tcx.is_sized` query not being very trivial. (2) It will need more extensive test coverage for different ty kinds. 2. It is impacting real-world crates, i.e. #134059. 3. `improper_ctypes_definitions` is a warn-by-default lint. This revert is without prejudice to relanding the changes. The changes can be re-landed with those cases addressed and stronger test coverage. A rough regression test corresponding to the fuzzed example reported in #134060 is added to check that the revert worked, it is not sufficient for the lint test coverage when the lint improvements are to be relanded. Please feel free to improve the test in the reland. r? `@workingjubilee` (or compiler) cc `@niacdoial` (PR author)
2024-12-09Add test to check unicode identifier versionEric Huss-0/+40
2024-12-09interpret: clean up deduplicating allocation functionsRalf Jung-138/+24
2024-12-09dataflow_const_prop: do not eval a ptr address in SwitchIntDianQK-18/+26
2024-12-09compiletest: `print{,ln}!` -> `eprint{,ln}!`clubby789-57/+57
Co-authored-by: Jieyou Xu <jieyouxu@outlook.com>
2024-12-09bootstrap: `print{,ln}!` -> `eprint{,ln}!`clubby789-150/+154
2024-12-09Add regression test for #134060许杰友 Jieyou Xu (Joe)-0/+27
Mostly just to check that the lint impl doesn't ICE from an easy case.
2024-12-09Revert #131669 due to ICEs许杰友 Jieyou Xu (Joe)-490/+181
Revert <https://github.com/rust-lang/rust/pull/131669> due to ICE reports: - <https://github.com/rust-lang/rust/issues/134059> (real-world) - <https://github.com/rust-lang/rust/issues/134060> (fuzzing) The changes can be re-landed with those cases addressed. This reverts commit 703bb982303ecab02fec593899639b4c3faecddd, reversing changes made to f415c07494b98e4559e4b13a9c5f867b0e6b2444.
2024-12-09Auto merge of #133891 - nnethercote:MixedBitSet, r=Mark-Simulacrumbors-169/+347
Introduce `MixedBitSet` `ChunkedBitSet` is good at avoiding excessive memory usage for programs with very large functgions where dataflow bitsets have very large domain sizes. But it's overly heavyweight for small bitsets, because any non-empty `ChunkedBitSet` takes up at least 256 bytes. This PR introduces `MixedBitSet`, which is a simple bitset that uses `BitSet` for small/medium bitsets and `ChunkedBitSet` for large bitsets. It's a speed and memory usage win. r? `@Mark-Simulacrum`
2024-12-08rustdoc: rename `issue-\d+.rs` tests to have meaningful namesMichael Howell-80/+80
2024-12-08Add URL to test casesMichael Howell-0/+9
2024-12-09Auto merge of #134052 - matthiaskrgr:rollup-puxwqrk, r=matthiaskrgrbors-1542/+2107
Rollup of 7 pull requests Successful merges: - #133567 (A bunch of cleanups) - #133789 (Add doc alias 'then_with' for `then` method on `bool`) - #133880 (Expand home_dir docs) - #134036 (crash tests: use individual mir opts instead of mir-opt-level where easily possible) - #134045 (Fix some triagebot mentions paths) - #134046 (Remove ignored tests for hangs w/ new solver) - #134050 (Miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-09Rollup merge of #134050 - RalfJung:miri-sync, r=RalfJungMatthias Krüger-1164/+1755
Miri subtree update r? `@ghost`
2024-12-09Rollup merge of #134046 - lqd:new-solver-hangs, r=compiler-errorsMatthias Krüger-24/+24
Remove ignored tests for hangs w/ new solver As asked on zulip [here](https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/needs_help.3A.20look.20through.20compare-mode.20hangs). As far as I can tell there are no more UI tests that hang anymore, so this removes the ignore directives for the compare mode. (As I was using `--compare-mode new-solver` and that failed in an obscure way without any info about what to do, I've also fixed its error handling in `compiletest`: it didn't show the invalid `--compare-mode`, nor the valid values one can pass). r? lcnr
2024-12-09Rollup merge of #134045 - ehuss:triagebot-path-fixes, r=compiler-errorsMatthias Krüger-10/+2
Fix some triagebot mentions paths This fixes some mentions paths in `triagebot.toml` that are no longer valid. * rustdoc themes were merged into rustdoc.css (which already has a mention, and unfortunately can't independently mention the ayu theme). https://github.com/rust-lang/rust/pull/115829 cc `@GuillaumeGomez` `@Cldfire` * The entry for `inspect_obligations.rs` was never correct, from https://github.com/rust-lang/rust/pull/122385. cc `@lcnr` `@compiler-errors` * The entry for `need_type_info.rs` was moved in https://github.com/rust-lang/rust/pull/127501
2024-12-09Rollup merge of #134036 - matthiaskrgr:opppt, r=saethlinMatthias Krüger-7/+7
crash tests: use individual mir opts instead of mir-opt-level where easily possible r? `@saethlin`
2024-12-09Rollup merge of #133880 - ChrisDenton:homedir, r=Mark-SimulacrumMatthias Krüger-0/+7
Expand home_dir docs Since `home_dir` is set to be undeprecated, let's make the docs a bit more thorough.
2024-12-09Rollup merge of #133789 - rossmacarthur:then-with-doc-alias, r=Mark-SimulacrumMatthias Krüger-0/+1
Add doc alias 'then_with' for `then` method on `bool` I think its logical to search for this name since `Ordering::then_with` exists as well.
2024-12-09Rollup merge of #133567 - bjorn3:various_cleanups, r=cjgillotMatthias Krüger-337/+311
A bunch of cleanups These are all extracted from a branch I have to get rid of driver queries. Most of the commits are not directly necessary for this, but were found in the process of implementing the removal of driver queries. Previous PR: https://github.com/rust-lang/rust/pull/132410
2024-12-08Auto merge of #134039 - matthiaskrgr:rollup-ix8kdg1, r=matthiaskrgrbors-301/+739
Rollup of 7 pull requests Successful merges: - #133424 (Parse guard patterns) - #133733 ( compiletest: show the difference between the normalized output and the actual output for lines which didn't match) - #133993 (Fix: typo in E0751 error explanation) - #134013 (Adds new intrinsic declaration) - #134020 (Remove unnecessary `int_type_width_signed` function) - #134024 (Advent of `tests/ui` (misc cleanups and improvements) [2/N]) - #134038 (deps: Update psm) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-08update lockfileRalf Jung-1/+0
2024-12-09Remove `ChunkedBitSet` impls that are no longer needed.Nicholas Nethercote-24/+2
`ChunkedBitSet` is no longer used directly by dataflow analyses, with `MixedBitSet` replacing it in those contexts.
2024-12-09Use `MixedBitSet` instead of `ChunkedBitSet` in `fmt.rs`.Nicholas Nethercote-6/+6
Just minimizing uses of `ChunkedBitSet`.
2024-12-09Use `BitSet` in `SparseBitMatrix`.Nicholas Nethercote-13/+13
A `ChunkedBitSet` has to be at least 2048 bits for it to outperform a `BitSet`, because that's the chunk size. The largest `SparseBitMatrix` encountered when compiling the compiler and the entire rustc-perf benchmark suite is less than 600 bits. This change is a tiny perf win, but the motivation is more about avoiding uses of `ChunkedBitSet` outside of `MixedBitSet`. The test change is necessary to avoid hitting the `<BitSet<T> as BitRelations<ChunkedBitSet<T>>>::subtract` method that has `unimplemented!` in its body and isn't otherwise used.
2024-12-08Fix some triagebot mentions pathsEric Huss-10/+2
2024-12-08bless test expectationsRémy Rakic-11/+11
(in a separate commit for easier review, one of them is huge)
2024-12-08mark previously hanging tests as good to goRémy Rakic-8/+1
2024-12-08improve `--compare-mode` error handlingRémy Rakic-5/+12
- show the erroneous value - show the valid values