Great question! I found myself in similar situations as a student and likewise as a mentor for other students when talking with people working on similar topics.
A favourite quote of mine is from George Bernard Shaw:
“If you have an apple and I have an apple and we exchange these apples then you and I will still each have one apple. But if you have an idea and I have an idea and we exchange these ideas, then each of us will have two ideas.”
I believe this is an ideal philosophy for research in a sense that ideally, everyone should gain from the free exchange of ideas.
However, as you gain experience, you realize that it can be just an ideal.
My first experience concerning the cost of openly sharing results was when I was a PhD student. Early on, I had the basics of what seemed like an important result for the community and had some initial results. My supervisor urged me to try and publish but the paper was borderline rejected from the conference with comments like "nice idea but still too early". I thus published it as a poster in the informal proceedings. In the meanwhile, my supervisor and I had been in conversation about how to progress further, get more results and mature the work. He presented the poster, spoke with various people and told me that he had had lots of interesting conversations: lengthy conversations with two senior researchers in particular.
I continued working on the problem. My supervisor and I had some difference of opinion on the direction the work should go in (theoretical vs. applied CS basically). We got bogged down in some theoretical questions where I felt the impact could be on simplifying the problem and working on the applied side. I missed the next deadline for the conference in our area but lo and behold, two papers were published that pretty much had developed the applied side of the idea. I read the two papers and realized that both had, in parallel, at the same venue, developed the ideas I had been working on ... with one or two interesting side observations. Both works were from groups of the two senior researchers my supervisor had talked to. One cited my informal/preliminary results as an inspiration, the other didn't cite it at all.
Four years later, the first paper now has 175 citations in Google Scholar, the second paper has 100, my paper has 41. I published a later paper on the topic that's doing a little better, but for sure, the early birds had taken the worm.
In part I'm happy that the idea was developed and they did add new ideas, and I've worked on various things since, but I honestly still regret not having formally marked the idea further before my supervisor exposed it. I also regret not being more urgent in getting the full work published.
This is not to suggest that you should stay tight-lipped at conferences or turn down all collaborations, but if you're worried about someone entering into competition with you, you might want to listen to that concern. I don't think it's at all unreasonable to not share every idea you have when you attend a conference. There are plenty of anecdotes of tight-lipped researchers: for example, nobody knew what Andrew Wiles was working on for several years while he was working towards a proof of Fermat's Last Theorem.
If you think the person is someone you can trust and someone who could help in a collaboration, listen to your gut. Test the water and see how knowledgeable they are or how they could contribute. Be careful if you have co-authors, not to talk about their ideas. If you want to collaborate, perhaps publish a technical report or a pre-print to mark your ideas first.
If in doubt, you don't have to tell them about your ideas straight away. Maybe stay quiet for the conference and email them later if you think you want to work together or to tell them about your ideas.