Skip to content
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

Bad ambigous error typechecking #3215

Open
philberty opened this issue Oct 24, 2024 · 4 comments
Open

Bad ambigous error typechecking #3215

philberty opened this issue Oct 24, 2024 · 4 comments
Assignees
Labels

Comments

@philberty
Copy link
Member

we're also running into this with this code example - I suspect the fix would be the same and there is something wrong when it comes to references/pointers and mutability:

#![feature(intrinsics)]

#[lang = "sized"]
trait Sized {}

pub struct VaListImpl<'f>;

mod sealed_trait {
    pub trait VaArgSafe {}
}

impl<T> sealed_trait::VaArgSafe for *mut T {}
impl<T> sealed_trait::VaArgSafe for *const T {}

impl<'f> VaListImpl<'f> {
    /// Advance to the next arg.
    #[inline]
    pub unsafe fn arg<T: sealed_trait::VaArgSafe>(&mut self) {
        va_arg2(self);
    }
}

fn va_arg2<T: sealed_trait::VaArgSafe>(ap: &mut VaListImpl<'_>) {}

Originally posted by @CohenArthur in #3032 (comment)

@powerboat9
Copy link
Collaborator

It looks like rustc might also find an ambiguity here

@CohenArthur
Copy link
Member

if rustc finds an ambiguity, then my testcase was reduced too far. there was definitely an issue with the original code which was taken directly from core when trying to compile it. I can try and get an old gccrs build to see what it was exactly

@philberty
Copy link
Member Author

yeah i think there is something wrong with the testcase: https://godbolt.org/z/f65f3Wq3r

rustc 1.49 gives:

error[E0282]: type annotations needed
  --> <source>:14:9
   |
14 |         va_arg2(self);
   |         ^^^^^^^ cannot infer type for type parameter `T` declared on the function `va_arg2`

error: aborting due to previous error

@philberty
Copy link
Member Author

feel free to update the test case and re assign it back to me @CohenArthur

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants