document difference between T:: and <T>:: in paths
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 58/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- rust
- Domain
- documentation
Research direction
Start in the Reference's Paths section and compare the PathInExpression and QualifiedPathInExpression definitions, using the linked playground example to verify their behavior. Document the semantic difference between T::func and ::func, including generic argument inference and why ::func is invalid; the section is done when these cases are explained with a clear example.
Written by the indexing model from the issue text.
Description
Background: this is something that I stumbled across while researching #24.
The Paths section has distinct syntax for PathInExpression and QualifiedPathInExpression. What isn't clear is the semantic difference between, say, T::func and <T>::func where T is a type.
I think T in <T>::func is not subject to inference, and therefore all of its generic type arguments must be explicitly specified, or defaulted. I'm not quite able to conclusively show it to my satisfaction, though.
It is clear that <Trait>::func isn't valid, and possibly this should be documented (even though it's implied by the production names).
#[derive(Debug)]
struct S(u8);
trait Tr {
fn foo() -> Self;
}
impl Tr for S {
fn foo() -> Self { Self(1) }
}
fn main() {
// The following is an error, because Tr is a trait, not a type.
// let x: S = <Tr>::foo();
let x: S = Tr::foo();
println!("{:?}", x);
}
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 607
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 12
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rust-lang/reference
-
A-const-eval A-undefined-behavior
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
A-resolve
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
A-coercions
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
All issues in rust-lang/reference
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
gitbutlerapp/gitbutler#15998 · 1 comment ·
-
bug triage:deciding
Difficulty 1/5 Under an hour Newbie friendliness 88/100
open-telemetry/otel-arrow#4132 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100