-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 11 pull requests #87333
Closed
Closed
Rollup of 11 pull requests #87333
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Avoid collecting an interator just to re-iterate immediately. Rather reuse the previous iterator. (clippy::needless_collect)
Following up on rust-lang#87236, add comments to the unix command-line argument support explaining that the code doesn't mutate the system-provided argc/argv, and that this is why the code doesn't need a lock or special memory ordering.
It used to allow you to mutate the key, even though that can invalidate the map by creating duplicate keys.
Since this is an example, this could really do with some review from someone familiar with unsafe stuff ! I made the example no longer `no_run` since it works for me. Fixes rust-lang#81847 Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk> Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
I attempted that with the previous code, but I misunderstdood how `shallow_resolve` works.
During function type-checking, we normalize any associated types in the function signature (argument types + return type), and then create WF obligations for each of the normalized types. The HIR wf code does not currently support this case, so any errors that we get have imprecise spans. This commit extends `ObligationCauseCode::WellFormed` to support recording a function parameter, allowing us to get the corresponding HIR type if an error occurs. Function typechecking is modified to pass this information during signature normalization and WF checking. The resulting code is fairly verbose, due to the fact that we can no longer normalize the entire signature with a single function call. As part of the refactoring, we now perform HIR-based WF checking for several other 'typed items' (statics, consts, and inherent impls). As a result, WF and projection errors in a function signature now have a precise span, which points directly at the responsible type. If a function signature is constructed via a macro, this will allow the error message to point at the code 'most responsible' for the error (e.g. a user-supplied macro argument).
Use `/etc/os-release` instead of `/etc/NIXOS`. The latter one does not exist on NixOS when using tmpfs as root.
…nieu docs: GlobalAlloc: completely replace example with one that works Since this is an example, this could really do with some review from someone familiar with unsafe stuff! I made the example no longer `no_run` since it works for me. Fixes rust-lang#81847
dont provide fwd declared params to cg defaults Fixes rust-lang#83938 ```rust #![feature(const_evaluatable_checked, const_generics, const_generics_defaults)] #![allow(incomplete_features)] pub struct Bar<const N: usize, const M: usize = { N + 1 }>; pub fn foo<const N1: usize>() -> Bar<N1> { loop {} } fn main() {} ``` This PR makes this code no longer ICE, it was ICE'ing previously because when building substs for `Bar<N1>` we would subst the anon ct: `ConstKind::Unevaluated({N + 1}, substs: [N, M])` with substs of `[N1]`. the anon const has forward declared params supplied though so we end up trying to substitute the provided `M` param which causes the ICE. This PR doesn't handle the predicates of the const so ```rust trait Foo<const N: usize> { const Assoc: usize; } pub struct Bar<const N: usize = { <()>::Assoc }> where (): Foo<N>; ``` Resolves to `<() as Foo<N>>::Assoc` which can allow for using fwd declared params indirectly. ```rust trait Foo<const N: usize> {} struct Bar<const N: usize = { 2 + 3 }> where (): Foo<N>; ``` This code also ICEs under this PR because instantiating the default's predicates causes an ICE as predicates_of contains predicates with fwd declared params PR was briefly discussed [in this zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/evil.20preds.20in.20param.20env.20.2386580)
Fix NixOS detection Use `/etc/os-release` instead of `/etc/NIXOS` for detection. The latter one does not exist on NixOS when using tmpfs as root.
…dtwco avoid temporary vectors/reuse iterators Avoid collecting an interator just to re-iterate immediately. Rather reuse the previous iterator. (clippy::needless_collect)
Support HIR wf checking for function signatures During function type-checking, we normalize any associated types in the function signature (argument types + return type), and then create WF obligations for each of the normalized types. The HIR wf code does not currently support this case, so any errors that we get have imprecise spans. This commit extends `ObligationCauseCode::WellFormed` to support recording a function parameter, allowing us to get the corresponding HIR type if an error occurs. Function typechecking is modified to pass this information during signature normalization and WF checking. The resulting code is fairly verbose, due to the fact that we can no longer normalize the entire signature with a single function call. As part of the refactoring, we now perform HIR-based WF checking for several other 'typed items' (statics, consts, and inherent impls). As a result, WF and projection errors in a function signature now have a precise span, which points directly at the responsible type. If a function signature is constructed via a macro, this will allow the error message to point at the code 'most responsible' for the error (e.g. a user-supplied macro argument).
…r=notriddle Don't display <table> in item summary Fixes rust-lang#87231. r? `@notriddle`
…=oli-obk Recognize bounds on impls as const bounds r? `@oli-obk`
…=lnicola ⬆️ rust-analyzer
…alfJung Add comments explaining the unix command-line argument support. Following up on rust-lang#87236, add comments to the unix command-line argument support explaining that the code doesn't mutate the system-provided argc/argv, and that this is why the code doesn't need a lock or special memory ordering. r? `@RalfJung`
…pes, r=spastorino Make mir borrowck's use of opaque types independent of the typeck query's result fixes rust-lang#87218 fixes rust-lang#86465 we used to use the typeck results only to generate an obligation for the mir borrowck type to be equal to the typeck result. When i removed the `fixup_opaque_types` function in rust-lang#87200, I exposed a bug that showed that mir borrowck can't doesn't get enough information from typeck in order to build the correct lifetime mapping from opaque type usage to the actual concrete type. We therefor now fully compute the information within mir borrowck (we already did that, but we only used it to verify the typeck result) and stop using the typeck information. We will likely be able to remove most opaque type information from the borrowck results in the future and just have all current callers use the mir borrowck result instead. r? `@spastorino`
…n514 Fix typo in compile.rs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Successful merges:
Failed merges:
r? @ghost
@rustbot modify labels: rollup
Create a similar rollup