Normalize non-rigid aliases in ty_known_to_outlive - #161246
Conversation
1103014 to
b881312
Compare
This comment has been minimized.
This comment has been minimized.
d0aeadc to
8806add
Compare
8806add to
52cc388
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
r? lcnr |
|
r? adwinwhite I think |
| parent_param_env, | ||
| &wf_tys, | ||
| t, | ||
| ty::Unnormalized::new_wip(t), |
There was a problem hiding this comment.
We probably don't want to have trait solving inside liveness analysis.
The types here are actually Params so they don't need normalization.
A quick solution is to have a private ty_known_to_outlive in this module, duplicated from the original impl.
A minimal param outlives evaluator would be good but we need to handle region graph. Then it's no longer minimal :<
As a micro-optimization, we can use resolve_regions_with_outlives_env rather than resolve_regions in this private helper since the wf_tys are the same. This might not matter.
| }) | ||
| let infcx = tcx.infer_ctxt().build(TypingMode::non_body_analysis()); | ||
|
|
||
| let ty = ty.skip_norm_wip(); |
There was a problem hiding this comment.
We only need to skip in the old solver branch.
| ty: Unnormalized<'tcx, Ty<'tcx>>, | ||
| region: ty::Region<'tcx>, | ||
| ) -> bool { | ||
| test_region_obligations(tcx, id, param_env, wf_tys, |infcx| { |
There was a problem hiding this comment.
we can still use test_region_obligations and just normalize the ty?
There was a problem hiding this comment.
yeah that's the part I overlooked 😬 I reused test_region_obligations here
|
Thanks for working on this! @rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
This comment has been minimized.
This comment has been minimized.
|
b7361f8 to
ed266c7
Compare
This comment has been minimized.
This comment has been minimized.
ed266c7 to
66801ea
Compare
| @@ -0,0 +1,17 @@ | |||
| //@ compile-flags: -Zassumptions-on-binders | |||
| //@ needs-rustc-debug-assertions | |||
| //@ normalize-stderr: "(\n)\n$" -> "$1" | |||
There was a problem hiding this comment.
why this?
There was a problem hiding this comment.
this was only normalizing an extra trailing newline in stderr
There was a problem hiding this comment.
pls remove, that doesn't feel worth it
There was a problem hiding this comment.
ah, sorry, I missed that.
| param_env: ty::ParamEnv<'tcx>, | ||
| wf_tys: &FxIndexSet<Ty<'tcx>>, | ||
| add_constraints: impl FnOnce(&InferCtxt<'tcx>), | ||
| add_constraints: impl FnOnce(&InferCtxt<'tcx>) -> bool, |
There was a problem hiding this comment.
maybe Result<(), ()> instead of bool?
There was a problem hiding this comment.
the bool is only being used to signal normalization failure. I think Result is clearer here
There was a problem hiding this comment.
do you want me to update this and cleanup now ?
There was a problem hiding this comment.
either now, or in a separate PR. I guess if u fix the ui test, doing it in this PR would be easier
Signed-off-by: Amirhossein Akhlaghpour <m9.akhlaghpoor@gmail.com>
7f7e359 to
c6c7dfd
Compare
|
This pull request was unapproved. This PR was contained in a rollup (#162887), which was closed. |
| wf_tys: &FxIndexSet<Ty<'tcx>>, | ||
| add_constraints: impl FnOnce(&InferCtxt<'tcx>), | ||
| add_constraints: impl FnOnce(&InferCtxt<'tcx>) -> Result<(), ()>, | ||
| ) -> bool { |
There was a problem hiding this comment.
don't have to do it in this PR, but you can also return Result here and imo should do so then you can do ?
|
@rustbot ready |
|
@bors r=adwinwhite,lcnr |
|
@bors rollup |
…s, r=adwinwhite,lcnr Normalize non-rigid aliases in ty_known_to_outlive Fixes rust-lang#161067 `ty_known_to_outlive` directly registers a TypeOutlives region obligation without normalization. With the next solver, we do not expect non-rigid aliases in lexical region solving. Normalize non-rigid aliases before registering the obligation while avoiding trait solving for inputs that do not contain them.
…s, r=adwinwhite,lcnr Normalize non-rigid aliases in ty_known_to_outlive Fixes rust-lang#161067 `ty_known_to_outlive` directly registers a TypeOutlives region obligation without normalization. With the next solver, we do not expect non-rigid aliases in lexical region solving. Normalize non-rigid aliases before registering the obligation while avoiding trait solving for inputs that do not contain them.
…uwer Rollup of 20 pull requests Successful merges: - #160401 (sparc: make ABI consistent with clang) - #162715 (don't calculate dtors if the self ty has impossible bounds) - #162740 (stdarch subtree update) - #162824 (link Enzyme and the offload with in-tree lld if possible) - #162946 (Simplify query stack printing) - #161005 (fix: unfulfilled nested dead code lint) - #161246 (Normalize non-rigid aliases in ty_known_to_outlive) - #161803 (Fix docs of make_ascii_lowercase/make_ascii_upercase) - #162256 (Add mentions to sync back `RELEASES.md` to the `main` branch) - #162661 (simplify `Target::GenericParam`) - #162666 (Tidy footnote in `platform-support.md`) - #162803 (docs(num): add documentation for `NonZero::from_str`) - #162879 (use u64 limbs in core::num::bignum) - #162903 (PassWrapper: adapt to LLVM reading exception model from module flag) - #162905 (c-variadic: add checks for windows i686) - #162906 (Move more `rustdoc-html` tests in the right location) - #162922 (An assortment of polonius tweaks) - #162929 (Update unicode_data to Unicode version 18.0.0) - #162930 (Use niche length type for strlen to guarantee `isize::MAX` bound) - #162960 (Guard types with unstable `Allocator` params ahead of partial stabilization)
…uwer Rollup of 19 pull requests Successful merges: - #160401 (sparc: make ABI consistent with clang) - #162715 (don't calculate dtors if the self ty has impossible bounds) - #162740 (stdarch subtree update) - #162946 (Simplify query stack printing) - #161005 (fix: unfulfilled nested dead code lint) - #161246 (Normalize non-rigid aliases in ty_known_to_outlive) - #161803 (Fix docs of make_ascii_lowercase/make_ascii_upercase) - #162256 (Add mentions to sync back `RELEASES.md` to the `main` branch) - #162661 (simplify `Target::GenericParam`) - #162666 (Tidy footnote in `platform-support.md`) - #162803 (docs(num): add documentation for `NonZero::from_str`) - #162879 (use u64 limbs in core::num::bignum) - #162903 (PassWrapper: adapt to LLVM reading exception model from module flag) - #162905 (c-variadic: add checks for windows i686) - #162906 (Move more `rustdoc-html` tests in the right location) - #162922 (An assortment of polonius tweaks) - #162929 (Update unicode_data to Unicode version 18.0.0) - #162930 (Use niche length type for strlen to guarantee `isize::MAX` bound) - #162960 (Guard types with unstable `Allocator` params ahead of partial stabilization)
…uwer Rollup of 19 pull requests Successful merges: - #160401 (sparc: make ABI consistent with clang) - #162715 (don't calculate dtors if the self ty has impossible bounds) - #162740 (stdarch subtree update) - #162946 (Simplify query stack printing) - #161005 (fix: unfulfilled nested dead code lint) - #161246 (Normalize non-rigid aliases in ty_known_to_outlive) - #161803 (Fix docs of make_ascii_lowercase/make_ascii_upercase) - #162256 (Add mentions to sync back `RELEASES.md` to the `main` branch) - #162661 (simplify `Target::GenericParam`) - #162666 (Tidy footnote in `platform-support.md`) - #162803 (docs(num): add documentation for `NonZero::from_str`) - #162879 (use u64 limbs in core::num::bignum) - #162903 (PassWrapper: adapt to LLVM reading exception model from module flag) - #162905 (c-variadic: add checks for windows i686) - #162906 (Move more `rustdoc-html` tests in the right location) - #162922 (An assortment of polonius tweaks) - #162929 (Update unicode_data to Unicode version 18.0.0) - #162930 (Use niche length type for strlen to guarantee `isize::MAX` bound) - #162960 (Guard types with unstable `Allocator` params ahead of partial stabilization)
Rollup merge of #161246 - amirHdev:fix-161067-non-rigid-alias, r=adwinwhite,lcnr Normalize non-rigid aliases in ty_known_to_outlive Fixes #161067 `ty_known_to_outlive` directly registers a TypeOutlives region obligation without normalization. With the next solver, we do not expect non-rigid aliases in lexical region solving. Normalize non-rigid aliases before registering the obligation while avoiding trait solving for inputs that do not contain them.
…uwer Rollup of 19 pull requests Successful merges: - rust-lang/rust#160401 (sparc: make ABI consistent with clang) - rust-lang/rust#162715 (don't calculate dtors if the self ty has impossible bounds) - rust-lang/rust#162740 (stdarch subtree update) - rust-lang/rust#162946 (Simplify query stack printing) - rust-lang/rust#161005 (fix: unfulfilled nested dead code lint) - rust-lang/rust#161246 (Normalize non-rigid aliases in ty_known_to_outlive) - rust-lang/rust#161803 (Fix docs of make_ascii_lowercase/make_ascii_upercase) - rust-lang/rust#162256 (Add mentions to sync back `RELEASES.md` to the `main` branch) - rust-lang/rust#162661 (simplify `Target::GenericParam`) - rust-lang/rust#162666 (Tidy footnote in `platform-support.md`) - rust-lang/rust#162803 (docs(num): add documentation for `NonZero::from_str`) - rust-lang/rust#162879 (use u64 limbs in core::num::bignum) - rust-lang/rust#162903 (PassWrapper: adapt to LLVM reading exception model from module flag) - rust-lang/rust#162905 (c-variadic: add checks for windows i686) - rust-lang/rust#162906 (Move more `rustdoc-html` tests in the right location) - rust-lang/rust#162922 (An assortment of polonius tweaks) - rust-lang/rust#162929 (Update unicode_data to Unicode version 18.0.0) - rust-lang/rust#162930 (Use niche length type for strlen to guarantee `isize::MAX` bound) - rust-lang/rust#162960 (Guard types with unstable `Allocator` params ahead of partial stabilization)
View all comments
Fixes #161067
ty_known_to_outlivedirectly registers a TypeOutlives region obligation without normalization. With the next solver, we do not expect non-rigid aliases in lexical region solving.Normalize non-rigid aliases before registering the obligation while avoiding trait solving for inputs that do not contain them.