-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rollup of 8 pull requests #123429
Rollup of 8 pull requests #123429
Commits on Mar 15, 2024
-
Added ability to report on generic argument mismatch better
Needs some checking over and some tests have altered that need sanity checking, but overall this is starting to get somewhere now.
Configuration menu - View commit details
-
Copy full SHA for df93364 - Browse repository at this point
Copy the full SHA df93364View commit details -
- Firstly get all the information about generics matching out of the HIR - Secondly the labelling for the function is more coherent now - Lastly a few error message improvements
Configuration menu - View commit details
-
Copy full SHA for 8a5245e - Browse repository at this point
Copy the full SHA 8a5245eView commit details
Commits on Mar 17, 2024
-
extend extern tests to include FiveU16s
As described in the code, this extends just beyond a 64bit reg, but isn't a round number, so it triggers some edge cases in the cast ABI.
Configuration menu - View commit details
-
Copy full SHA for 4498cd6 - Browse repository at this point
Copy the full SHA 4498cd6View commit details -
sparc64: fix crash in ABI code for { f64, f32 } struct
This would trigger a `Size::sub: 0 - 8 would result in negative size` abort, if `data.last_offset > offset`. This is almost hilariously easy to trigger (https://godbolt.org/z/8rbv57xET): ```rust #[repr(C)] pub struct DoubleFloat { f: f64, g: f32, } #[no_mangle] pub extern "C" fn foo(x: DoubleFloat) {} ``` Tests for this will be covered by the cast-target-abi.rs test added in a later commit.
Configuration menu - View commit details
-
Copy full SHA for 41c6fa8 - Browse repository at this point
Copy the full SHA 41c6fa8View commit details -
make CastTarget::size and CastTarget::llvm_type consistent, remove
special case that's not present in Clang Making the methods consistent doesn't require much justification. It's required for us to generate correct code. The special case was present near the end of `CastTarget::llvm_type`, and resulted in the final integer component of the ABI type being shrunk to the smallest integer that fits. You can see this in action here (https://godbolt.org/z/Pe73cr91d), where, for a struct with 5 u16 elements, rustc generates `{ i64, i16 }`, while Clang generates `[2 x i64]`. This special case was added a long time ago, when the function was originally written [1]. That commit consolidated logic from many backends, and in some of the code it deleted, sparc64 [2] and powerpc64 [3] had similar special cases. However, looking at Clang today, it doesn't have this special case for sparc64 (https://godbolt.org/z/YaafvYWdf) or powerpc64 (https://godbolt.org/z/5c3YePTje), so this change just removes it. [1]: rust-lang@f0636b6#diff-183c4dadf10704bd1f521b71f71d89bf755c9603a93f894d66c03bb1effc6021R231 [2]: rust-lang@f0636b6#diff-2d8f87ea6db6d7f0a6fbeb1d5549adc07e93331278d951a1e051a40f92914436L163-L166 [3]: rust-lang@f0636b6#diff-88af4a9df9ead503a5c7774a0455d270dea3ba60e9b0ec1ce550b4c53d3bce3bL172-L175
Configuration menu - View commit details
-
Copy full SHA for 74ef47e - Browse repository at this point
Copy the full SHA 74ef47eView commit details -
make PassMode::Cast consistently copy between Rust/ABI representation
Previously, we did this slightly incorrectly for return values, and didn't do it at all for arguments.
Configuration menu - View commit details
-
Copy full SHA for 8841315 - Browse repository at this point
Copy the full SHA 8841315View commit details -
add tests for PassMode::Cast fixes
Tests added in cast-target-abi.rs, covering the single element, array, and prefix cases in `CastTarget::llvm_type`, and the Rust-is-larger/smaller cases in the Rust<->ABI copying code. ffi-out-of-bounds-loads.rs was overhauled to be runnable on any platform. Its alignment also increases due to the removal of a `min` in the previous commit; this was probably an insufficient workaround for this issue or similar. The higher alignment is fine, since the alloca is actually aligned to 8 bytes, as the test checks now confirm.
Configuration menu - View commit details
-
Copy full SHA for 8d5fd94 - Browse repository at this point
Copy the full SHA 8d5fd94View commit details -
Revert "sparc64: fix crash in ABI code for { f64, f32 } struct"
This reverts commit 41c6fa8.
Configuration menu - View commit details
-
Copy full SHA for 6577aef - Browse repository at this point
Copy the full SHA 6577aefView commit details -
Configuration menu - View commit details
-
Copy full SHA for dec81ac - Browse repository at this point
Copy the full SHA dec81acView commit details
Commits on Mar 31, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 4c0aea0 - Browse repository at this point
Copy the full SHA 4c0aea0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8cf2c0d - Browse repository at this point
Copy the full SHA 8cf2c0dView commit details -
Configuration menu - View commit details
-
Copy full SHA for db9b4ea - Browse repository at this point
Copy the full SHA db9b4eaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 27704c7 - Browse repository at this point
Copy the full SHA 27704c7View commit details
Commits on Apr 2, 2024
-
Configuration menu - View commit details
-
Copy full SHA for ab821ae - Browse repository at this point
Copy the full SHA ab821aeView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4cb5643 - Browse repository at this point
Copy the full SHA 4cb5643View commit details
Commits on Apr 3, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 989660c - Browse repository at this point
Copy the full SHA 989660cView commit details -
rustc_index: Add a
ZERO
constant to index typesIt is commonly used.
Configuration menu - View commit details
-
Copy full SHA for b40ea03 - Browse repository at this point
Copy the full SHA b40ea03View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6edb021 - Browse repository at this point
Copy the full SHA 6edb021View commit details -
Rollup merge of rust-lang#121595 - strottos:issue_116615, r=compiler-…
…errors Better reporting on generic argument mismatchs This allows better reporting as per issue rust-lang#116615 . If you have a function: ``` fn foo(a: T, b: T) {} ``` and call it like so: ``` foo(1, 2.) ``` it'll give improved error reported similar to the following: ``` error[E0308]: mismatched types --> generic-mismatch-reporting-issue-116615.rs:6:12 | 6 | foo(1, 2.); | --- - ^^ expected integer, found floating-point number | | | | | expected argument `b` to be an integer because that argument needs to match the type of this parameter | arguments to this function are incorrect | note: function defined here --> generic-mismatch-reporting-issue-116615.rs:1:4 | 1 | fn foo<T>(a: T, b: T) {} | ^^^ - ---- ---- | | | | | | | this parameter needs to match the integer type of `a` | | `b` needs to match the type of this parameter | `a` and `b` all reference this parameter T ``` Open question, do we need to worry about error message translation into other languages? Not sure what the status of that is in Rust. NB: Needs some checking over and some tests have altered that need sanity checking, but overall this is starting to get somewhere now. Will take out of draft PR status when this has been done, raising now to allow feedback at this stage, probably 90% ready.
Configuration menu - View commit details
-
Copy full SHA for 32c8c5c - Browse repository at this point
Copy the full SHA 32c8c5cView commit details -
Rollup merge of rust-lang#122619 - erikdesjardins:cast, r=compiler-er…
…rors Fix some unsoundness with PassMode::Cast ABI Fixes rust-lang#122617 Reviewable commit-by-commit. More info in each commit message.
Configuration menu - View commit details
-
Copy full SHA for bc8415b - Browse repository at this point
Copy the full SHA bc8415bView commit details -
Rollup merge of rust-lang#122964 - joboet:pointer_expose, r=Amanieu
Rename `expose_addr` to `expose_provenance` `expose_addr` is a bad name, an address is just a number and cannot be exposed. The operation is actually about the provenance of the pointer. This PR thus changes the name of the method to `expose_provenance` without changing its return type. There is sufficient precedence for returning a useful value from an operation that does something else without the name indicating such, e.g. [`Option::insert`](https://doc.rust-lang.org/nightly/std/option/enum.Option.html#method.insert) and [`MaybeUninit::write`](https://doc.rust-lang.org/nightly/std/mem/union.MaybeUninit.html#method.write). Returning the address is merely convenient, not a fundamental part of the operation. This is implied by the fact that integers do not have provenance since ```rust let addr = ptr.addr(); ptr.expose_provenance(); let new = ptr::with_exposed_provenance(addr); ``` must behave exactly like ```rust let addr = ptr.expose_provenance(); let new = ptr::with_exposed_provenance(addr); ``` as the result of `ptr.expose_provenance()` and `ptr.addr()` is the same integer. Therefore, this PR removes the `#[must_use]` annotation on the function and updates the documentation to reflect the important part. ~~An alternative name would be `expose_provenance`. I'm not at all opposed to that, but it makes a stronger implication than we might want that the provenance of the pointer returned by `ptr::with_exposed_provenance`[^1] is the same as that what was exposed, which is not yet specified as such IIUC. IMHO `expose` does not make that connection.~~ A previous version of this PR suggested `expose` as name, libs-api [decided on](rust-lang#122964 (comment)) `expose_provenance` to keep the symmetry with `with_exposed_provenance`. CC `@RalfJung` r? libs-api [^1]: I'm using the new name for `from_exposed_addr` suggested by rust-lang#122935 here.
Configuration menu - View commit details
-
Copy full SHA for 80d592c - Browse repository at this point
Copy the full SHA 80d592cView commit details -
Rollup merge of rust-lang#123291 - c410-f3r:testsssssss, r=petrochenkov
Move some tests r? `@petrochenkov`
Configuration menu - View commit details
-
Copy full SHA for 0c8c18f - Browse repository at this point
Copy the full SHA 0c8c18fView commit details -
Rollup merge of rust-lang#123301 - Nadrieril:unions, r=compiler-errors
pattern analysis: fix union handling Little known fact: rust supports union patterns. Exhaustiveness handles them soundly but reports nonsensical missing patterns. This PR fixes the reported patterns and documents what we're doing. r? `@compiler-errors`
Configuration menu - View commit details
-
Copy full SHA for 5f74403 - Browse repository at this point
Copy the full SHA 5f74403View commit details -
Rollup merge of rust-lang#123395 - compiler-errors:postfix-matches-fi…
…xes-2, r=petrochenkov More postfix match fixes These affect diagnostics only, as far as I can tell. I'm too lazy to come up with UI tests, but I could be convinced otherwise. Specifically, I think changing the precedence computation actually doesn't change anything, but tweaking `contains_exterior_struct_lit` does mean that some diagnostics will begin parenthesizing `S {}.match {}`.
Configuration menu - View commit details
-
Copy full SHA for 202509b - Browse repository at this point
Copy the full SHA 202509bView commit details -
Rollup merge of rust-lang#123419 - petrochenkov:zeroindex, r=compiler…
…-errors rustc_index: Add a `ZERO` constant to index types It is commonly used.
Configuration menu - View commit details
-
Copy full SHA for 25b0e84 - Browse repository at this point
Copy the full SHA 25b0e84View commit details -
Rollup merge of rust-lang#123421 - taiki-e:netbsd-doc, r=Nilstrieb
Fix target name in NetBSD platform-support doc NetBSD platform-support doc currently mentions `amd64-unknown-netbsd`, but it is not a valid target name (the correct name is `x86_64-unknown-netbsd`). https://github.com/rust-lang/rust/blob/ceab6128fa48a616bfd3e3adf4bc80133b8ee223/src/doc/rustc/src/platform-support/netbsd.md?plain=1#L16 ```console $ rustc --print target-list | grep netbsd aarch64-unknown-netbsd aarch64_be-unknown-netbsd armv6-unknown-netbsd-eabihf armv7-unknown-netbsd-eabihf i586-unknown-netbsd i686-unknown-netbsd mipsel-unknown-netbsd powerpc-unknown-netbsd riscv64gc-unknown-netbsd sparc64-unknown-netbsd x86_64-unknown-netbsd ```
Configuration menu - View commit details
-
Copy full SHA for 65398c4 - Browse repository at this point
Copy the full SHA 65398c4View commit details