#`#[::negative::negative_impl]`

60 messages · Page 1 of 1 (latest)

weary field
#

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 ferrisThink

terse hamlet
weary field
#

omg, this is genious

#

I just cargo expanded

#

and this is hilarious

weary field
errant relic
#

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)…

trail hedge
#

Absolutely cursed ralfAware

vital lichen
#

HUH

#

how

#

this is magic

cedar finch
#

No

#

most the reason i hate this is that I absolutely despise that specific style of presumably-AI-generated image

fringe hull
terse hamlet
fringe hull
#

Would be awesome if this could support cross-crate negative coherence ferrisOwO

terse hamlet
fringe hull
#

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
terse hamlet
fringe hull
#

(tried it on a recent nightly, and current stable)

terse hamlet
terse hamlet
# fringe hull (tried it on a recent nightly, and current stable)

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

worthy drum
#

nice hack, sucks that you used the plagiarism machine though

terse hamlet
spring estuary
terse hamlet
robust garnet
#

Automatic plagiarism to manual plagiarism?

spring estuary
robust garnet
#

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.

spring estuary
spring estuary
cedar finch
#

Nobody reading the docs of this crate will look at that and not recognize it as that particular artwork of Ferris

robust garnet
#

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.

terse hamlet
#

Oh, the embed mentions the description of the picture ferrisClueless

visual wadi
spring estuary
visual wadi
#

sussy

steady valve
terse hamlet
#

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 😅

terse hamlet
cedar finch
#

I mind ferrisLove

terse hamlet
#

The "limitations" of their crate is the very point of my crate

#

As in, they did not use a 100% trivially_false predicate