-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Stability annotation on defaulted generics fails #79499
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
Comments
The error is occurring here, for reference: rust/compiler/rustc_passes/src/stability.rs Lines 156 to 161 in 1d27267
Off the top of my head, I'm not sure which part of the condition is satisfied. There's no reason I see to expect this not to work, so it could well have been a case overlooked in #77118. @Avi-D-coder: would you be interested in taking a look to see what's going wrong? I should be able to give more immediate response than last time (it'd just take me a little while to find time to debug, myself) :) |
If I remove Specifically, for this code (outside of stdlib, because IDK how to #![feature(allocator_api)]
#![feature(std_internals)]
use std::alloc::{Allocator, Global};
#[derive(PartialOrd, Eq, Ord)]
pub struct String<#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
vec: Vec<u8, A>,
}
impl<A: Allocator, B: Allocator> PartialEq<String<B>> for String<A> {
fn eq(&self, other: &String<B>) -> bool { todo!() }
}
// error "stability attributes may not be used outside of the standard library" ignored
// .. etc
impl<#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator>
::core::marker::StructuralEq for String<A>
{
}
// .. etc (None of the other impls have the stability annotation) and I think this If this is correct, maybe this issue should be renamed to something like " (Either way, if |
If work here has stalled, I'd like to make progress on this issue |
I'm adding
<A: AllocRef = Global>
to string types. Strings don't have a generic parameter, so the defaulted generic parameter is the first parameter:However, the compiler complains, that this annotation is "useless":
Was this simply not added by #77118 or is this a false positive in general?
cc @varkor @Avi-D-coder
The text was updated successfully, but these errors were encountered: