-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Description
There are two sets of problematic messages here. First, take this code:
struct S;
trait A
{
priv fn foo(); // Error 1
}
priv impl S // Error 2
{
}
priv impl A for S // Error 3
{
priv fn foo() {} // Error 4
}
All of the marked lines give this error:
error: obsolete syntax: `priv` not necessary
note: an item without a visibility qualifier is private by default
This is wrong in all those cases, as the said items are not private by default. In case of Error 1, the visibility is set by the visibility of the trait. In case of Error 2, there's no such thing as a private implementation, you're meant to put visibility on individual functions. In case of Error 3 there's no such thing as a private implementation of a trait, but unlike Error 2 you're not allowed to put visibility on individual functions as the visibility is inherited from the implemented trait. Error 4, thus, is also wrong. Obviously if the priv keyword goes (#8122) then these are invalidated.
The other problematic error comes from this code:
struct S;
trait A
{
fn foo();
}
pub impl A for S // Error 5
{
}
The error text:
error: obsolete syntax: visibility-qualified implementation
note: `pub` or `priv` goes on individual functions; remove the `pub` or `priv`
This is not correct, as you're not allowed to put it on the individual functions either.