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

Don't elaborate non-obligations into obligations #109641

Merged
merged 1 commit into from Mar 27, 2023

Conversation

compiler-errors
Copy link
Member

It's suspicious to elaborate a PolyTraitRef or Predicate into an Obligation, since the former does not have a param-env associated with it, but the latter does. This is a footgun that, while not being misused currently in the compiler, easily could be misused by someone less familiar with the elaborator's inner workings.

This PR just changes the API -- ideally, the elaborator wouldn't even have to deal with obligations if we're not elaborating obligations, but that would require a bit more abstraction than I could be bothered with today.

@rustbot
Copy link
Collaborator

rustbot commented Mar 26, 2023

r? @cjgillot

(rustbot has picked a reviewer for you, use r? to override)

@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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative labels Mar 26, 2023
@rustbot
Copy link
Collaborator

rustbot commented Mar 26, 2023

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@oli-obk
Copy link
Contributor

oli-obk commented Mar 26, 2023

@bors r+

r? @oli-obk

@bors
Copy link
Contributor

bors commented Mar 26, 2023

📌 Commit 1ce4b37 has been approved by oli-obk

It is now in the queue for this repository.

@rustbot rustbot assigned oli-obk and unassigned cjgillot Mar 26, 2023
@bors
Copy link
Contributor

bors commented Mar 26, 2023

🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened.

@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 Mar 26, 2023
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Mar 27, 2023
…-obl, r=oli-obk

Don't elaborate non-obligations into obligations

It's suspicious to elaborate a `PolyTraitRef` or `Predicate` into an `Obligation`, since the former does not have a param-env associated with it, but the latter does. This is a footgun that, while not being misused *currently* in the compiler, easily could be misused by someone less familiar with the elaborator's inner workings.

This PR just changes the API -- ideally, the elaborator wouldn't even have to deal with obligations if we're not elaborating obligations, but that would require a bit more abstraction than I could be bothered with today.
@@ -1912,14 +1912,13 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> {
// Check elaborated bounds.
let implied_obligations = traits::elaborate_predicates_with_span(tcx, predicates_with_span);
Copy link
Contributor

Choose a reason for hiding this comment

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

implied_predicates

bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 27, 2023
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#97506 (Stabilize `nonnull_slice_from_raw_parts`)
 - rust-lang#98651 (Follow C-RW-VALUE in std::io::Cursor example)
 - rust-lang#102742 (Remove unnecessary raw pointer in __rust_start_panic arg)
 - rust-lang#109587 (Use an IndexVec to debug fingerprints.)
 - rust-lang#109613 (fix type suggestions in match arms)
 - rust-lang#109633 (Fix "Directly go to item in search if there is only one result" setting)
 - rust-lang#109635 (debuginfo: Get pointer size/align from tcx.data_layout instead of layout_of)
 - rust-lang#109641 (Don't elaborate non-obligations into obligations)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 6535e66 into rust-lang:master Mar 27, 2023
11 checks passed
@rustbot rustbot added this to the 1.70.0 milestone Mar 27, 2023
@compiler-errors compiler-errors deleted the dont-elaborate-non-obl branch August 11, 2023 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants