Skip to content

Remove term "indirection" and its derivatives - #715

Open
kirtchev-adacore wants to merge 1 commit into
mainfrom
mr/fls-710-remove-indirection
Open

Remove term "indirection" and its derivatives#715
kirtchev-adacore wants to merge 1 commit into
mainfrom
mr/fls-710-remove-indirection

Conversation

@kirtchev-adacore

Copy link
Copy Markdown
Contributor

This PR removes the term "indirection" and its derivatives from the FLS as the Rust Project does not use this term. The preferred alternative is "pointer", "pointer type", etc.

Closes: #710

@kirtchev-adacore
kirtchev-adacore force-pushed the mr/fls-710-remove-indirection branch from 76e05c8 to d8a34a8 Compare July 28, 2026 07:50
This PR removes the term "indirection" and its derivatives from the FLS
as the Rust Project does not use this term. The preferred alternative is
"pointer", "pointer type", etc.

Closes: #710
@kirtchev-adacore
kirtchev-adacore force-pushed the mr/fls-710-remove-indirection branch from d8a34a8 to 5f464ca Compare July 28, 2026 07:52
@kirtchev-adacore
kirtchev-adacore marked this pull request as ready for review July 28, 2026 07:54
@kirtchev-adacore kirtchev-adacore self-assigned this Jul 28, 2026

@PLeVasseur PLeVasseur left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @kirtchev-adacore, for taking the time to adopt the Rust Project terminology.

I found a couple of places where we seem to be a bit at odds with what's written up in the Reference. Could you take a look?

View changes since this review

Comment thread src/types-and-traits.rst

:dp:`fls_3qI8FXMsyk0f`
A :t:`pointer type` is either a :t:`raw pointer type` or a :t:`reference type`.
A :t:`pointer type` is a :t:`type` whose :t:`[value]s` refer to memory locations.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I took a look at the Rust 1.96 Reference classification. It classifies function pointers as pointer types, but I don't think this PR propagates that broader meaning to existing FLS rules that use pointer type in the narrower, data-pointer sense.

In particular, the existing FLS dereference rule seems to now apply to function pointers and says that *fp denotes a pointed-to memory location, while its type rule falls back to Deref::Target.

On the other hand, the Reference's dereference-operator rule uses built-in dereference for data pointers/Box and otherwise requires Deref, while the documented function-pointer trait implementations do not include Deref.

Maybe we can define this category extensionally as function pointer, raw pointer, or reference types, then audit and narrow the existing data-pointer rules to raw pointers/references?

It seems to me that the memory-location predicate also might not characterize function pointers, which the Reference defines as referring to functions, and does not clearly account for valid null raw-pointer values such as core::ptr::null().

Comment thread src/types-and-traits.rst
A :t:`pointer` is a :t:`value` of a :t:`pointer type`.

:dp:`fls_8RBNIR0E6pnI`
A :t:`pointer` is :t:`dangling` if it is either :c:`null` or not all of the bytes at the referred memory location are part of the same allocation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Over in the Reference it derives a pointer's pointed-to bytes from its value and pointee size, then defines dangling pointers by whether all those bytes belong to one live allocation.

It explicitly says a zero-sized pointee is never dangling even when the pointer is null, so core::ptr::null::<()>() is a counterexample to this definition. Omitting "live" also leaves a pointer to deallocated storage not clearly covered.

Might be better here if we follow the Reference wording and limit this data-pointer rule to raw pointers/references, since pointer now also includes function pointers. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Change]: Remove the term "indirection", and associated derivatives

2 participants