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

Optimize implicit casts from string literals to ReadOnlySpan<char> #23358

Closed
VSadov opened this issue Nov 22, 2017 · 3 comments
Closed

Optimize implicit casts from string literals to ReadOnlySpan<char> #23358

VSadov opened this issue Nov 22, 2017 · 3 comments
Assignees
Labels
Area-Compilers Bug Language-C# New Language Feature - Readonly References Readonly References Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Milestone

Comments

@VSadov
Copy link
Member

VSadov commented Nov 22, 2017

If possible, we should just point to the underlying data of the string.

Ideally there is a helper that takes a string token or something like that - to avoid directly dealing with pointers, which us formally unsafe.

realted to: https://github.com/dotnet/corefx/issues/25413

@VSadov VSadov self-assigned this Nov 22, 2017
@jcouv jcouv added this to the 15.7 milestone Jan 16, 2018
VSadov added a commit to VSadov/roslyn that referenced this issue Feb 3, 2018
…ys of primitive literals.

No need to allocate anything in this case.

Fixes:dotnet#23358
Related:dotnet/corefx#25413
@jcouv
Copy link
Member

jcouv commented Mar 6, 2018

@VSadov fixed with #24621 for 15.7. Closing

@jcouv jcouv closed this as completed Mar 6, 2018
@jcouv jcouv added the Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented label Mar 6, 2018
@MichalStrehovsky
Copy link
Member

Is this really done? I thought Vlad only fixed this for arrays with single byte element types and strings etc. got out of scope due to endinaness issues.

@VSadov
Copy link
Member Author

VSadov commented Mar 6, 2018

It is fixed to the degree that is possible. It is an optional optimization after all.

1+ byte elements will require new APIs. That is not going to happen soon and for that there is a separate bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Bug Language-C# New Language Feature - Readonly References Readonly References Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Projects
None yet
Development

No branches or pull requests

3 participants