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

Diagnostic around conforming to a protocol with a noncopyable type has no source location info #76573

Open
fwcd opened this issue Sep 19, 2024 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels

Comments

@fwcd
Copy link
Member

fwcd commented Sep 19, 2024

Description

Some ownership-related diagnostics seem to be missing source location information. See e.g. the example below

Reproduction

protocol TypedPointer<Pointee> {
    associatedtype Pointee
    
    var pointee: Pointee { get }
}

extension UnsafePointer: TypedPointer {}

Expected behavior

I would expect the associated diagnostic:

<unknown>:0: error: 'self.pointee' is borrowed and cannot be consumed

...to have location/line information, e.g. in this case probably the line conforming UnsafePointer to the protocol.

Environment

swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)
Target: arm64-apple-macosx15.0

Additional information

I was a bit surprised that this broke in Swift 6, it looks like the issue is that UnsafePointer's Pointee is ~Copyable and that the interaction between noncopyable types and protocols/generics isn't good enough to let us spell out this conformance anymore: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0390-noncopyable-structs-and-enums.md#declaring-noncopyable-types

@fwcd fwcd added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Sep 19, 2024
@fwcd fwcd changed the title Diagnostic that member is borrowed and cannot be consumed has no source location info Diagnostic around conforming to a protocol with a noncopyable type has no source location info Sep 19, 2024
@flash1729
Copy link

there is a good first issue which i am working on rn and i found its related to Diagnostics so is there any way i can also look into this one
this is the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

2 participants