-
Notifications
You must be signed in to change notification settings - Fork 61
Stacked Borrows: raw pointer usable only for T too strict? #134
Copy link
Copy link
Open
Labels
A-SB-vs-TBTopic: Design questions where SB and TB are opposite sides of the design axisTopic: Design questions where SB and TB are opposite sides of the design axisA-aliasing-modelTopic: Related to the aliasing model (e.g. Stacked/Tree Borrows)Topic: Related to the aliasing model (e.g. Stacked/Tree Borrows)C-open-questionCategory: An open question that we should revisitCategory: An open question that we should revisitS-pending-designStatus: Resolving this issue requires addressing some open design questionsStatus: Resolving this issue requires addressing some open design questions
Metadata
Metadata
Assignees
Labels
A-SB-vs-TBTopic: Design questions where SB and TB are opposite sides of the design axisTopic: Design questions where SB and TB are opposite sides of the design axisA-aliasing-modelTopic: Related to the aliasing model (e.g. Stacked/Tree Borrows)Topic: Related to the aliasing model (e.g. Stacked/Tree Borrows)C-open-questionCategory: An open question that we should revisitCategory: An open question that we should revisitS-pending-designStatus: Resolving this issue requires addressing some open design questionsStatus: Resolving this issue requires addressing some open design questions
Type
Fields
Give feedbackNo fields configured for issues without a type.
Currently, the following is illegal according to Stacked Borrows:
The problem is that the cast to
*const u8creates a raw pointer that may only be used for theu8it points to, not anything else. The most common case is to do&slice[0] as *const _instead ofslice.as_ptr().This has lead to problems:
&slice[0]thing.Rc::into_raw+Rc::from_rawdon't work well together because of this.&slice[0]patternMaybe this is too restrictive and raw pointers should be allowed to access their "surroundings"? I am not sure what exactly that would look like though. It would probably require having the raw pointer fully inherit all permissions from the reference it is created from.
I'll use this issue to collect such cases.