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

Weird sentence in comments in compiler/rustc_trait_selection/src/traits/coherence.rs #88231

Closed
steffahn opened this issue Aug 22, 2021 · 1 comment · Fixed by #126525
Closed
Assignees
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@steffahn
Copy link
Member

steffahn commented Aug 22, 2021

/// 3. For non-`#[fundamental]` traits, they guarantee that parent crates can
/// add "non-blanket" impls without breaking negative reasoning in dependent
/// crates. This is the "rebalancing coherence" (RFC 1023) restriction.
///
/// For that, we only a allow crate to perform negative reasoning on
/// non-local-non-`#[fundamental]` only if there's a local key parameter as per (2).
///
/// Because we never perform negative reasoning generically (coherence does
/// not involve type parameters), this can be interpreted as doing the full
/// orphan check (using InCrate::Local mode), substituting non-local known
/// types for all inference variables.
///
/// This allows for crates to future-compatibly add impls as long as they
/// can't apply to types with a key parameter in a child crate - applying
/// the rules, this basically means that every type parameter in the impl
/// must appear behind a non-fundamental type (because this is not a
/// type-system requirement, crate owners might also go for "semantic
/// future-compatibility" involving things such as sealed traits, but
/// the above requirement is sufficient, and is necessary in "open world"
/// cases).

The sentence

For that, we only a allow crate to perform negative reasoning on non-local-non-#[fundamental] only if there's a local key parameter as per (2).

Has a weirdly placed “a” and twice “only”. I’m not immediately sure how to best fix it without changing the meaning to something that isn’t meant.


Found while doing #88230

@rustbot label T-compiler


I suppose it might be correct as

 ///    For that, we only allow a crate to perform negative reasoning on 
 ///    non-local-non-`#[fundamental]` if there's a local key parameter as per (2). 

but it would be nice to get confirmation from someone who knows what this comment is talking about.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Aug 22, 2021
@Enselic Enselic added the A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools label Dec 20, 2023
@jieyouxu
Copy link
Member

@rustbot claim

@bors bors closed this as completed in b6311b3 Jun 15, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jun 15, 2024
Rollup merge of rust-lang#126525 - jieyouxu:traitsel-docs, r=compiler-errors

trait_selection: remove extra words

Tiny doc cleanup.

Fixes rust-lang#88231.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants