I would like to contribute just an anecdote from my personal experience that I would like you to consider...
Before I became a professor, I was only really ever around highly talented students. I went to a pretty good school, and I guess I just implicitly assumed that all students were like us. Thus when I started as a professor, I was under the impression that, "Anybody can get a PhD if they tried hard, and wanted it enough". However, that hypothesis was quickly disproved by one of my first PhD students. After about a year of lots and lots of effort on my part, it was clear that one of my students lacked the fundamental skills (programming, mathematics) needed to graduate during the funding period I had allotted. Although it must be said, they were by far the most enthusiast student, and "really wanted it".
How did I come to that conclusion? After working with them for a few months, it was clear that they had a really bad grasp on some core mathematical principles and were extremely bad at programming, both of which were core components of the work. Still, being young and naive, I thought that I could just do some extra mentoring to bridge the gap. However, after a year, the student was only falling further behind where they should have been, and so I had a sit down meeting to inform the student that I did not think that they would be capable of getting a PhD. But I left the door open for them to stay if they wanted to stick it out and try...
Well long story short... they said that they wanted to stay and put in the extra work. However, years later, the funding that I had secured for them expired, and they did not have a PhD. At that point they transferred to another advisor and to my knowledge, they never obtained a PhD.
After transferring to another group, the student harbored a lot of anger toward me, feeling that I should just "give them" a PhD because of all of the work they put in. In fact, it is not uncommon for professors to do this even if the work is not really up to snuff. But really there is a threshold that should be met, and the fact is that I did not believe that the student met that requirement. People seem to be handing out PhDs freely these days, and I despise the grade-inflation in academia. The insidious side effect of this is that giving PhDs to everybody devalues the degree for everyone else.
I do not have contact with the student anymore, but I wonder what they think now. Should they have heeded my advice?
Honestly, I would expect that they would blame me for their failings, saying that I did not give them enough mentoring. But if you take such an answer at face value, then it ignores the fact that I was already putting much more time into mentoring that student than the others, and it was at the point that mentoring that student was taking away from my other responsibilities (grant writing, teaching, mentoring other students). This while I was already working more hours than most of my other colleagues. I had no more time to give.
One parting thought that I would like you to consider...
Do you think that your professor came to this decision lightly?
It took me a week to finally work up the courage to tell my student this. It was nerve-wracking. It was an admission that I had failed to get the student up to speed, and that I did not think that I ever could. I was devastated. I had failed.
If your professor got the courage to tell you this, I doubt that they did this lightly. I would guess that they came to this decision upon seeing repeated issues. You should certainly talk to them about this. But please take to heart what they are saying. How will you feel if you are there for 2,3,4 more years, and still don't have a PhD? Make sure that you are not just falling into the sunken cost fallacy. And make absolutely sure that you are clear that lots of people do lots of hard work every day. It just does not rise to the level of warranting a PhD.