Skip to content
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

Some initial normalization method changes #104905

Merged
merged 6 commits into from
Nov 30, 2022

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Nov 25, 2022

  1. Rename AtExt::normalize to QueryNormalizeExt::query_normalize (using the QueryNormalizer)
  2. Introduce NormalizeExt::normalize to replace partially_normalize_associated_types_in (using the AssocTypeNormalizer)
  3. Rename FnCtxt::normalize_associated_types_in to FnCtxt::normalize
  4. Remove some unused other normalization fns in Inherited and FnCtxt

Also includes one drive-by where we're no longer creating a FnCtxt inside of check_fn, but passing it in. This means we don't need such weird FnCtxt construction logic.

Stacked on top of #104835 for convenience.

r? types

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Nov 25, 2022
@rustbot
Copy link
Collaborator

rustbot commented Nov 25, 2022

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

debug!(
"instantiate_bounds(bounds={:?}, substs={:?}) = {:?}, {:?}",
bounds, substs, result, spans,
);
(result, spans)
}

pub(in super::super) fn normalize_associated_types_in<T>(&self, span: Span, value: T) -> T
pub(in super::super) fn normalize<T>(&self, span: Span, value: T) -> T
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This intentionally takes a span instead of an ObligationCause because all of FnCtxt::normalize callers would be creating misc causes.

@rust-log-analyzer

This comment has been minimized.

param_env,
fn_sig,
);
// FIXME(compiler-errors): Remove
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should have been fixed in the next commit

@spastorino
Copy link
Member

Looks good to me, as soon as #104835 lands r=me

@compiler-errors
Copy link
Member Author

@bors r=spastorino

@bors
Copy link
Contributor

bors commented Nov 25, 2022

📌 Commit ba76acdd38645f7fc29a602436cfcdff4a13a840 has been approved by spastorino

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 25, 2022
@bors
Copy link
Contributor

bors commented Nov 26, 2022

☔ The latest upstream changes (presumably #104935) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 26, 2022
@compiler-errors
Copy link
Member Author

@bors r=spastorino

@bors
Copy link
Contributor

bors commented Nov 26, 2022

📌 Commit c5e677eb2c182b87ed8d7d9788d1f7f71d7dcc0e has been approved by spastorino

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 26, 2022
@bors
Copy link
Contributor

bors commented Nov 28, 2022

☔ The latest upstream changes (presumably #105008) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 28, 2022
@rustbot
Copy link
Collaborator

rustbot commented Nov 28, 2022

Some changes occurred in engine.rs, potentially modifying the public API of ObligationCtxt.

cc @lcnr

@compiler-errors
Copy link
Member Author

Trivial rebase

@bors r=spastorino

@bors
Copy link
Contributor

bors commented Nov 28, 2022

📌 Commit 1e236ac has been approved by spastorino

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 28, 2022
Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

general notes:

  • we should probably remove struct Normalized and always use InferOk
  • we have to add/update the comments for the normalization routines
  • remove normalize_to and normalize in favor of normalize_with_depth_to and normalize_with_depth

apart from that r=me

thanks ❤️

@compiler-errors
Copy link
Member Author

Alright, I'll do that in a follow-up PR ✨

@bors
Copy link
Contributor

bors commented Nov 30, 2022

⌛ Testing commit 1e236ac with merge 24606de...

@bors
Copy link
Contributor

bors commented Nov 30, 2022

☀️ Test successful - checks-actions
Approved by: spastorino
Pushing 24606de to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 30, 2022
@bors bors merged commit 24606de into rust-lang:master Nov 30, 2022
@rustbot rustbot added this to the 1.67.0 milestone Nov 30, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (24606de): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.9% [-1.0%, -0.8%] 2
Improvements ✅
(secondary)
-2.2% [-2.8%, -0.3%] 7
All ❌✅ (primary) -0.9% [-1.0%, -0.8%] 2

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.0% [2.0%, 2.0%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.0% [-2.0%, -2.0%] 1
All ❌✅ (primary) 2.0% [2.0%, 2.0%] 1

Cycles

This benchmark run did not return any relevant results for this metric.

flip1995 pushed a commit to flip1995/rust that referenced this pull request Dec 1, 2022
…s, r=spastorino

Some initial normalization method changes

1. Rename `AtExt::normalize` to `QueryNormalizeExt::query_normalize` (using the `QueryNormalizer`)
2. Introduce `NormalizeExt::normalize` to replace `partially_normalize_associated_types_in` (using the `AssocTypeNormalizer`)
3. Rename `FnCtxt::normalize_associated_types_in` to `FnCtxt::normalize`
4. Remove some unused other normalization fns in `Inherited` and `FnCtxt`

Also includes one drive-by where we're no longer creating a `FnCtxt` inside of `check_fn`, but passing it in. This means we don't need such weird `FnCtxt` construction logic.

Stacked on top of rust-lang#104835 for convenience.

r? types
Aaron1011 pushed a commit to Aaron1011/rust that referenced this pull request Jan 6, 2023
…s, r=spastorino

Some initial normalization method changes

1. Rename `AtExt::normalize` to `QueryNormalizeExt::query_normalize` (using the `QueryNormalizer`)
2. Introduce `NormalizeExt::normalize` to replace `partially_normalize_associated_types_in` (using the `AssocTypeNormalizer`)
3. Rename `FnCtxt::normalize_associated_types_in` to `FnCtxt::normalize`
4. Remove some unused other normalization fns in `Inherited` and `FnCtxt`

Also includes one drive-by where we're no longer creating a `FnCtxt` inside of `check_fn`, but passing it in. This means we don't need such weird `FnCtxt` construction logic.

Stacked on top of rust-lang#104835 for convenience.

r? types
@compiler-errors compiler-errors deleted the normalization-changes branch August 11, 2023 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants