Negative impls in stable Rust 
https://docs.rs/negative
image
60 messages · Page 1 of 1 (latest)
Negative impls in stable Rust 
https://docs.rs/negative
image
Looking for negative reviews 
the documentation does not show what the macro expands to
this isn't really a critique, I just like to know how the magic works xD
I guess I can cargo add negative and do some cargo expanding
it's probably annoying to maintain such an example as that could change over time without changing the semantics 
It's rather cursed so I didn't want to advertise it much 
Hopefully the proc-macro logic is self-explanatory enough, though:
https://docs.rs/negative-proc_macros/0.1.1/src/negative_proc_macros/_mod.rs.html#127-135
what's the point of this comment in the macro source code?
that looks like it’s to unconfuse bad syntax highlighters that think there is a single quoted string/character literal involved (which is not a thing in Rust)…
Absolutely cursed 
No
most the reason i hate this is that I absolutely despise that specific style of presumably-AI-generated image
Indeed!
That seems so ... negative of you
Yep, AI generated. Such a silly crate deserved some flavor, and there aren't that many good "negativity-suggesting" ferris pictures, and since I lack any ounce of drawing skills myselfs, I fell back to AI indeed
Would be awesome if this could support cross-crate negative coherence 
Try it out! Been a bit lazy to explore that area myself, but I have a strong suspicion it will work to also convince donwstream dependents that your trait is not and will not be implemented
Uh, this is unexpected:
error[E0046]: not all trait items implemented, missing: `fmt`
--> src/lib.rs:5:1
|
5 | impl !std::fmt::Display for NotDisplay {}
| ^^^^^^ missing `fmt` in implementation
|
= help: implement the missing item: `fn fmt(&self, _: &mut Formatter<'_>) -> Result<(), std::fmt::Error> { todo!() }`
😅
Nope, doesn't work.
upstream crate:
#[derive(Clone)]
pub struct NotCopy;
#[::negative::negative_impl]
impl !Copy for NotCopy {}
foo crate:
use upstream::NotCopy;
trait Foo {
fn foo() -> &'static str;
}
impl<T: Copy> Foo for T {
fn foo() -> &'static str {
std::any::type_name::<T>()
}
}
impl Foo for NotCopy {
fn foo() -> &'static str {
"it's NotCopy"
}
}
error:
error[E0119]: conflicting implementations of trait `Foo` for type `NotCopy`
--> src/lib.rs:13:1
|
7 | impl<T: Copy> Foo for T {
| ----------------------- first implementation here
...
13 | impl Foo for NotCopy {
| ^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `NotCopy`
|
= note: upstream crates may add a new impl of trait `std::marker::Copy` for type `upstream::NotCopy` in future versions
Yeah, I thought of that, let's just say this currently only works for trait with no mandatory methods 
(tried it on a recent nightly, and current stable)
Oh damn, that's disappointing

I've thought about this, and I think that negative_impls, in general, does not suffice here (and hence why my hack doesn't either). The downstream crate needs to have #![feature(with_negative_coherence)], probably, since that's the companion feature usually needed here
Nevermind, with_negative_coherence only works with verbatim negative impls 🥲: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=5fb41ff142599e1b9182bc9a7b5a2051
A browser interface to the Rust compiler to experiment with the language
nice hack, sucks that you used the plagiarism machine though
Somebody draw me a negative crab 
there u have a negative crab
it has been 2 seconds work 
Updated the discord post with it, will do so for the crate later on 
Automatic plagiarism to manual plagiarism?
inverted the crab from https://rustacean.net/assets/rustacean-orig-noshadow.png the original is public domain, so is this modification
Copyright status is irrelevant for instances of plagiarism. I don't mean to be harsh though because I don't really care what's being used either way as long as there's no profit. I take minor annoyance with the wording from earlier going into this swap of resources. It just irks me that one thing is considered bad here while the other isn't.
To be clear this is really just me being needlessly picky about wanting to hate something "correctly". I think the inverted color Ferris is the better design.
thats totally fair. i think AI is considered bad since it doesnt ask/look for copyright and just yoinks it
i most certainly agree that inverted crab > sad crab for negative implementations
it’s not plagiarism because it’s obviously not intending to represent an original work
Nobody reading the docs of this crate will look at that and not recognize it as that particular artwork of Ferris
If a college wouldn't agree it's probably a bad idea. That's why teachers push so hard with "cite ALL your sources". It's unlikely that would've happened here.
Credit to @FlawlessDeveloper for the picture, a modification from a public domain one, see #1301567644171767890 message
Oh, the embed mentions the description of the picture 
::negative
AMONG US
i like it as a DONT TOUCH indicator
sussy
might be the same as https://github.com/taiki-e/negative-impl, haven't checked
Oh indeed it is 
I'm very surprised by this; taiki-e had two issues on pin-project which are affected by this (one was a "soundness issue", the other, a missed feature), and I've had to bring this up to them in one, and very recentoy in the other, and they hadn't told me about [their knowing/having authored] this crate/pattern whatsoever 😅
Ah nevermind
I mind 