about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-02-13Use MCSubtargetInfo::getAllProcessorFeatures()Nikita Popov-4/+4
This method is now available in upstream LLVM \o/
2024-02-13Update to LLVM 18Nikita Popov-1/+1
2024-02-13Auto merge of #120938 - Ayush1325:uefi-thread, r=joboet,Nilstriebbors-1/+60
Implement sys/thread for UEFI Since UEFI has no concept of threads, most of this module can be ignored. However, implementing parts that make sense. - Implement sleep - Implement available_parallelism
2024-02-13Auto merge of #120919 - oli-obk:impl_polarity, r=compiler-errorsbors-131/+156
Merge `impl_polarity` and `impl_trait_ref` queries Hopefully this is perf neutral. I want to finish https://github.com/rust-lang/rust/pull/120835 and stop using the HIR in `coherent_trait`, which should then give us a perf improvement.
2024-02-13Auto merge of #120991 - matthiaskrgr:rollup-f8kw2st, r=matthiaskrgrbors-630/+1104
Rollup of 8 pull requests Successful merges: - #118983 (Warn on references casting to bigger memory layout) - #119451 (Gate PR CI on clippy correctness lints) - #120273 (compiletest: few naive improvements) - #120950 (Fix async closures in CTFE) - #120958 (Dejargonize `subst`) - #120965 (Add lahfsahf and prfchw target feature) - #120970 (add another test for promoteds-in-static) - #120979 (Update books) r? `@ghost` `@rustbot` modify labels: rollup
2024-02-12Rollup merge of #120979 - rustbot:docs-update, r=ehussMatthias Krüger-0/+0
Update books ## rust-lang/edition-guide 1 commits in baafacc6d8701269dab1e1e333f3547fb54b5a59..76bd48a273a0e0413a3bf22c699112d41497b99e 2024-02-10 20:50:34 UTC to 2024-02-10 20:50:34 UTC - Set up scaffolding for 2024 (rust-lang/edition-guide#288) ## rust-lang/reference 4 commits in a0b119535e7740f68494c4f0582f7ad008b00ccd..8227666de13f6e7bb32dea9dc42e841adb5ce4b7 2024-02-12 03:04:15 UTC to 2024-01-30 20:10:53 UTC - Fix a typo in external-blocks.md (rust-lang/reference#1467) - Fix syntax in `'static lifetime elision` section of `lifetime-elision.md` (rust-lang/reference#1463) - Fix markdown backslash for FLOAT_LITERAL (rust-lang/reference#1464) - C string literal expressions (rust-lang/reference#1457) ## rust-lang/rust-by-example 5 commits in 179256a445d6144f5f371fdefb993f48f33978b0..e188d5d466f7f3ff9f1d518393235f4fe951be46 2024-02-07 17:16:00 UTC to 2024-01-31 17:34:10 UTC - Update macros.md (rust-lang/rust-by-example#1815) - Update borrow.md (rust-lang/rust-by-example#1814) - Fixes the bug: https://github.com/rust-lang/rust-by-example/issues/1721 (rust-lang/rust-by-example#1811) - std_misc/process/pipe.md: Fix typo in pangram string (rust-lang/rust-by-example#1809) - Add expected error behavior into docs (rust-lang/rust-by-example#1810) ## rust-lang/rustc-dev-guide 9 commits in ec287e332777627185be4798ad22599ffe7b84aa..1f30cc7cca9a3433bc1872abdc98960b36c21ca0 2024-02-11 05:36:15 UTC to 2024-01-29 19:49:51 UTC - fix sentence (rust-lang/rustc-dev-guide#1882) - Some updates for recent diagnostics changes. (rust-lang/rustc-dev-guide#1883) - Rename occurrences of 'delay_span_bug' to 'span_delayed_bug' (rust-lang/rustc-dev-guide#1881) - Update for upcoming markdown changes. (rust-lang/rustc-dev-guide#1880) - Update uses of renamed BoxMeUp to PanicPayload (rust-lang/rustc-dev-guide#1878) - Add links for arena and interning. (rust-lang/rustc-dev-guide#1868) - Improving macro expansion section (rust-lang/rustc-dev-guide#1875) - Replace letters by foo, bar and buz in lexing example (rust-lang/rustc-dev-guide#1870) - Fix some broken links (rust-lang/rustc-dev-guide#1877)
2024-02-12Rollup merge of #120970 - RalfJung:static-promoted-test, r=oli-obkMatthias Krüger-0/+33
add another test for promoteds-in-static https://github.com/rust-lang/rust/pull/119614 led to validation of promoteds recursing into statics. These statics can point to `static mut` and interior mutable `static` and do other things we don't allow in `const`, but promoteds are validated as `const`, so we get strange errors (saying "in `const`" when there is no const) and surprising validation failures. https://github.com/rust-lang/rust/pull/120960 fixes that; this here adds another test. r? ``@oli-obk`` Fixes https://github.com/rust-lang/rust/issues/120968
2024-02-12Rollup merge of #120965 - ChrisDenton:sahf, r=michaelwoeristerMatthias Krüger-2/+13
Add lahfsahf and prfchw target feature This adds target features for LAHF/SAHF and PrefetchW. These came up. along with the existing CMPXCHG16b. as [baseline features](https://download.microsoft.com/download/c/1/5/c150e1ca-4a55-4a7e-94c5-bfc8c2e785c5/Windows%2010%20Minimum%20Hardware%20Requirements.pdf) required for x86_64 Windows 10+.
2024-02-12Rollup merge of #120958 - ShoyuVanilla:remove-subst, r=oli-obkMatthias Krüger-543/+576
Dejargonize `subst` In favor of #110793, replace almost every occurence of `subst` and `substitution` from rustc codes, but they still remains in subtrees under `src/tools/` like clippy and test codes (I'd like to replace them after this)
2024-02-12Rollup merge of #120950 - compiler-errors:miri-async-closurs, r=RalfJung,oli-obkMatthias Krüger-39/+86
Fix async closures in CTFE First commit renames `is_coroutine_or_closure` into `is_closure_like`, because `is_coroutine_or_closure_or_coroutine_closure` seems confusing and long. Second commit fixes some forgotten cases where we want to handle `TyKind::CoroutineClosure` the same as closures and coroutines. The test exercises the change to `ValidityVisitor::aggregate_field_path_elem` which is the source of #120946, but not the change to `UsedParamsNeedSubstVisitor`, though I feel like it's not that big of a deal. Let me know if you'd like for me to look into constructing a test for the latter, though I have no idea what it'd look like (we can't assert against `TooGeneric` anywhere?). Fixes #120946 r? oli-obk cc ``@RalfJung``
2024-02-12Rollup merge of #120273 - klensy:ct-run, r=onur-ozkanMatthias Krüger-11/+16
compiletest: few naive improvements Tested on `python x.py --stage=1 t tests/ui/borrowck/ --force-rerun`, see individual commits. Wall time didn't improved :-) .
2024-02-12Rollup merge of #119451 - Kobzol:ci-pr-clippy, r=Mark-SimulacrumMatthias Krüger-5/+1
Gate PR CI on clippy correctness lints Implements part of https://github.com/rust-lang/compiler-team/issues/709. Note that `x.py clippy compiler` also checks the standard library, because it needs to be checked before the compiler. This happens even with `x.py clippy --stage 0`.
2024-02-12Rollup merge of #118983 - Urgau:invalid_ref_casting-bigger-layout, r=oli-obkMatthias Krüger-30/+379
Warn on references casting to bigger memory layout This PR extends the [`invalid_reference_casting`](https://doc.rust-lang.org/rustc/lints/listing/deny-by-default.html#invalid-reference-casting) lint (*deny-by-default*) which currently lint on `&T -> &mut T` casting to also lint on `&(mut) A -> &(mut) B` where `size_of::<B>() > size_of::<A>()` (bigger memory layout requirement). The goal is to detect such cases: ```rust let u8_ref: &u8 = &0u8; let u64_ref: &u64 = unsafe { &*(u8_ref as *const u8 as *const u64) }; //~^ ERROR casting references to a bigger memory layout is undefined behavior let mat3 = Mat3 { a: Vec3(0i32, 0, 0), b: Vec3(0, 0, 0), c: Vec3(0, 0, 0) }; let mat3 = unsafe { &*(&mat3 as *const _ as *const [[i64; 3]; 3]) }; //~^ ERROR casting references to a bigger memory layout is undefined behavior ``` This is added to help people who write unsafe code, especially when people have matrix struct that they cast to simple array of arrays. EDIT: One caveat, due to the [`&Header`](https://github.com/rust-lang/unsafe-code-guidelines/issues/256) uncertainty the lint only fires when it can find the underline allocation. ~~I have manually tested all the new expressions that warn against Miri, and they all report immediate UB.~~ r? ``@est31``
2024-02-12Auto merge of #120324 - Nadrieril:remove-interior-mutability, r=compiler-errorsbors-83/+86
pattern_analysis: track usefulness without interior mutability Because of or-patterns, exhaustiveness needs to be able to lint if a sub-pattern is redundant, e.g. in `Some(_) | Some(true)`. So far the only sane solution I had found was interior mutability. This is a bit of an abstraction leak, and would become a footgun if we ever reused the same `DeconstructedPat`. This PR replaces interior mutability with an address-indexed hashmap, which is logically equivalent.
2024-02-12Allow invalid ref casting in Miri unaligned_ref_addr_of testUrgau-0/+2
2024-02-12Avoid UB in clippy transmute_ptr_to_ptr UI testUrgau-11/+11
2024-02-12Introduce small cache to avoid recomputing the same value twiceUrgau-4/+13
2024-02-12Lint on reference casting to bigger underlying allocationUrgau-18/+356
2024-02-12Auto merge of #120980 - matthiaskrgr:rollup-dsjsqql, r=matthiaskrgrbors-790/+805
Rollup of 11 pull requests Successful merges: - #120765 (Reorder diagnostics API) - #120833 (More internal emit diagnostics cleanups) - #120899 (Gracefully handle non-WF alias in `assemble_alias_bound_candidates_recur`) - #120917 (Remove a bunch of dead parameters in functions) - #120928 (Add test for recently fixed issue) - #120933 (check_consts: fix duplicate errors, make importance consistent) - #120936 (improve `btree_cursors` functions documentation) - #120944 (Check that the ABI of the instance we are inlining is correct) - #120956 (Clean inlined type alias with correct param-env) - #120962 (Add myself to library/std review) - #120972 (fix ICE for deref coercions with type errors) r? `@ghost` `@rustbot` modify labels: rollup
2024-02-12Rollup merge of #120972 - lukas-code:autoderef-type-error, r=compiler-errorsMatthias Krüger-12/+39
fix ICE for deref coercions with type errors Follow-up to https://github.com/rust-lang/rust/pull/120895, where I made types with errors go through the full coercion code, which is necessary if we want to build MIR for bodies with errors (https://github.com/rust-lang/rust/pull/120550). The code for coercing `&T` to `&U` currently assumes that autoderef for `&T` will succeed for at least two steps (`&T` and `T`): https://github.com/rust-lang/rust/blob/b17491c8f6d555386104dfd82004c01bfef09c95/compiler/rustc_hir_typeck/src/coercion.rs#L339-L464 But for types with errors, we previously only returned the no-op autoderef step (`&{type error}` -> `&{type error}`) and then stopped early. This PR changes autoderef for types with errors to still go through the built-in derefs (e.g. `&&{type error}` -> `&{type error}` -> `{type error}`) and only stop early when it would have to go looking for `Deref` trait impls. fixes https://github.com/rust-lang/rust/issues/120945 r? ``@compiler-errors`` or compiler
2024-02-12Rollup merge of #120962 - ChrisDenton:review, r=NilstriebMatthias Krüger-1/+1
Add myself to library/std review I'll see how it goes.
2024-02-12Rollup merge of #120956 - compiler-errors:clean-type-alias, r=GuillaumeGomezMatthias Krüger-1/+17
Clean inlined type alias with correct param-env We were cleaning the `hir::Ty` of a type alias item in the param-env of the item that *references* the type alias, and not the alias's own param-env. Fixes #120954
2024-02-12Rollup merge of #120944 - compiler-errors:inliner-abi, r=oli-obkMatthias Krüger-0/+56
Check that the ABI of the instance we are inlining is correct When computing the `CallSite` in the mir inliner, double check that the instance of the function that we are inlining is compatible with the signature from the trait definition that we acquire from the MIR. Fixes #120940 r? ``@oli-obk`` or ``@cjgillot``
2024-02-12Rollup merge of #120936 - ripytide:master, r=AmanieuMatthias Krüger-85/+128
improve `btree_cursors` functions documentation As suggested by ``@Amanieu`` (and others) in #107540 (https://github.com/rust-lang/rust/issues/107540#issuecomment-1937760547) Improvements: - Document exact behavior of `{upper/lower}_bound{,_mut}` with each of the three `Bound` types using unambigous words `{greatest,greater,smallest,smaller,before,after}`. - Added another doc-example for the `Bound::Unbounded` for each of the methods - Changed doc-example to use From<[T; N]> rather than lots of `insert()`s which requires a mutable map which clutters the example when `mut` may not be required for the method (such as for `{upper,lower}_bound`. - Removed `# Panics` section from `insert_{before,after}` methods since they were changed to return an error instead a while ago. - Reworded some phrases to be more consistent with the more regular `BTreeMap` methods such as calling entries "key-value" rather than "element"s.
2024-02-12Rollup merge of #120933 - RalfJung:const-check-misc, r=oli-obkMatthias Krüger-164/+15
check_consts: fix duplicate errors, make importance consistent This is stuff I noticed while working on https://github.com/rust-lang/rust/pull/120932, but it's orthogonal to that PR. r? ``@oli-obk``
2024-02-12Rollup merge of #120928 - c410-f3r:tests-tests-tests, r=davidtwcoMatthias Krüger-0/+31
Add test for recently fixed issue Adds a test for issue #116864.
2024-02-12Rollup merge of #120917 - chenyukang:yukang-dead-parameters, r=compiler-errorsMatthias Krüger-71/+30
Remove a bunch of dead parameters in functions Found this kind of issue when working on https://github.com/rust-lang/rust/pull/119650 I wrote a trivial toy lint and manual review to find these.
2024-02-12Rollup merge of #120899 - compiler-errors:non-wf-alias, r=lcnrMatthias Krüger-2/+42
Gracefully handle non-WF alias in `assemble_alias_bound_candidates_recur` See explanation in test. I think it's fine to delay a bug here -- I don't believe we ever construct a non-wf alias on the good path? If so, then we can just remove the delay. Fixes #120891 r? lcnr
2024-02-12Rollup merge of #120833 - ↵Matthias Krüger-165/+163
nnethercote:more-internal-emit_diagnostics-cleanups, r=oli-obk More internal emit diagnostics cleanups Miscellaneous improvements. r? ``@oli-obk``
2024-02-12Rollup merge of #120765 - nnethercote:reorder-diag-API, r=compiler-errorsMatthias Krüger-289/+283
Reorder diagnostics API The totally random ordering of diagnostic methods in `DiagCtxt` has been low-key driving me crazy for a while now. r? ``@compiler-errors``
2024-02-12Update booksrustbot-0/+0
2024-02-12Auto merge of #115367 - frank-king:feature/unnamed-fields-hir, r=davidtwcobors-259/+3273
Lowering unnamed fields and anonymous adt This implements #49804. Goals: - [x] lowering anonymous ADTs from AST to HIR - [x] generating definitions of anonymous ADTs - [x] uniqueness check of the unnamed fields - [x] field projection of anonymous ADTs - [x] `#[repr(C)]` check of the anonymous ADTs Non-Goals (will be in the next PRs) - capturing generic params for the anonymous ADTs from the parent ADT - pattern matching of anonymous ADTs - structural expressions of anonymous ADTs - rustdoc support of anonymous ADTs
2024-02-12add another test for promoteds-in-staticRalf Jung-0/+33
2024-02-12fix ICE for deref coercions with type errorsLukas Markeffsky-12/+39
2024-02-12Add lahfsahf and prfchw target featureChris Denton-2/+13
2024-02-12Auto merge of #120960 - RalfJung:static-promoted-cycle, r=oli-obkbors-24/+29
fix cycle error when a static and a promoted are mutually recursive This also now allows promoteds everywhere to point to 'extern static', because why not? We still check that constants cannot transitively reach 'extern static' through references. (We allow it through raw pointers.) r? `@oli-obk` Fixes https://github.com/rust-lang/rust/issues/120949
2024-02-12Auto merge of #110211 - joboet:queue_lock, r=Amanieubors-198/+571
Replace pthread `RwLock` with custom implementation This is one of the last items in #93740. I'm doing `RwLock` first because it is more self-contained and has less tradeoffs to make. The motivation is explained in the documentation, but in short: the pthread rwlock is slow and buggy and `std` can do much better. I considered implementing a parking lot, as was discussed in the tracking issue, but settled for the queue-based version because writing self-balancing binary trees is not fun in Rust... This is a rather complex change, so I have added quite a bit of documentation to help explain it. Please point out any part that could be explained better. ~~The read performance is really good, I'm getting 4x the throughput of the pthread version and about the same performance as usync/parking_lot on an Apple M1 Max in the usync benchmark suite, but the write performance still falls way behind what usync and parking_lot achieve. I tried using a separate queue lock like what usync uses, but that didn't help. I'll try to investigate further in the future, but I wanted to get some eyes on this first.~~ [Resolved](https://github.com/rust-lang/rust/pull/110211#issuecomment-1513682336) r? `@m-ou-se` CC `@kprotty`
2024-02-12Remove impl_polarity queryOli Scherer-13/+5
2024-02-12Stop calling `impl_polarity` when `impl_trait_ref` was also calledOli Scherer-77/+96
2024-02-12Eagerly dismiss binderOli Scherer-8/+5
2024-02-12Unwrap an Option that can only be Some, as inherent impls can't overlapOli Scherer-6/+6
2024-02-12Use a struct instead of a tupleOli Scherer-10/+19
2024-02-12Make impl_trait_ref into a query also returning more information about the implOli Scherer-40/+48
2024-02-12Fix failing testShoyu Vanilla-1/+1
2024-02-12fix cycle error when a static and a promoted are mutually recursiveRalf Jung-24/+29
This also now allows promoteds everywhere to point to 'extern static', because why not? We still check that constants cannot transitively reach 'extern static' through references. (We allow it through raw pointers.)
2024-02-12Change level used in `print_error_count`.Nicholas Nethercote-2/+2
From `Fatal` to `Error`. It has no functional effect, but `Error` makes more sense and lines up better with the `Warning` level used just above.
2024-02-12Tweak delayed bug mentions.Nicholas Nethercote-34/+34
Now that we have both `delayed_bug` and `span_delayed_bug`, it makes sense to use the generic term "delayed bug" more.
2024-02-12Remove `dcx` arg from `ReportErrorExt::add_args`.Nicholas Nethercote-76/+62
Because it also has a `DiagnosticBuilder` arg, which contains a `dcx` reference. Also rename some `builder` variables as `diag`, because that's the usual name.
2024-02-12Remove final unwanted `unchecked_error_guaranteed` calls.Nicholas Nethercote-53/+65
Now that error counts can't go up and down due to stashing/stealing, we have a nice property: (err_count > 0) iff (an ErrorGuaranteed has been produced) So we can now record `ErrorGuaranteed`s within `DiagCtxt` and use that in methods like `has_error`, instead of checking that the count is greater than 0 and calling `unchecked_error_guaranteed` to create the `ErrorGuaranteed`. In fact, we can record a `Vec<ErrorGuaranteed>` and use its length to count the number, instead of maintaining a separate count.
2024-02-12Auto merge of #120835 - oli-obk:no_hir_coherence, r=cjgillotbors-111/+109
Avoid accessing the HIR in the happy path of `coherent_trait` Unfortunately the hir is still used in unsafety checks, and we do not have a way to avoid that. An impl's unsafety is not part of any query other than hir. So this PR does not affect perf, but could still be considered a cleanup