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

rustc producing huge irrelevant errors on attempt to impl on foreign type #131030

Closed
CrashAndSideburns opened this issue Sep 29, 2024 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@CrashAndSideburns
Copy link

Code

I am not sure about the possibility of a minimal reproduction case, since the number of errors seems to be at least partially a function of the size of the rest of the codebase. It should be possibly to reproduce by cloning https://github.com/CrashAndSideburns/ilo-binutils, and adding the following snippet of code to pali/src/poki.rs:

impl Vec<Export<'_>> {
    fn foo(&self) -> u16 {
        todo!()
    }
}

then running cargo r at the root of the repo.

Current output

    Compiling pali v0.1.0 (/home/mra/ilo-binutils/pali)
error[E0116]: cannot define inherent `impl` for a type outside of the crate where the type is defined
   --> pali/src/poki.rs:247:1
    |
247 | impl Vec<Export<'_>> {
    | ^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate
    |
    = note: define and implement a trait or new type instead

error[E0599]: no method named `eq_ignore_ascii_case` found for reference `&str` in the current scope
 --> pali/src/lex.rs:9:51
  |
9 | #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, EnumString)]
  |                                                   ^^^^^^^^^^ method not found in `&str`
  |
  = help: items from traits can only be used if the trait is in scope
  = note: this error originates in the derive macro `EnumString` (in Nightly builds, run with -Z macro-backtrace for more info)
help: trait `AsciiExt` which provides `eq_ignore_ascii_case` is implemented but not in scope; perhaps you want to import it
  |
1 + use std::ascii::AsciiExt;
  |

error[E0599]: no method named `eq_ignore_ascii_case` found for reference `&str` in the current scope
  --> pali/src/lex.rs:57:51
   |
57 | #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, EnumString)]
   |                                                   ^^^^^^^^^^ method not found in `&str`
   |
   = help: items from traits can only be used if the trait is in scope
   = note: this error originates in the derive macro `EnumString` (in Nightly builds, run with -Z macro-backtrace for more info)
help: trait `AsciiExt` which provides `eq_ignore_ascii_case` is implemented but not in scope; perhaps you want to import it
   |
1  + use std::ascii::AsciiExt;
   |

error[E0599]: no method named `eq_ignore_ascii_case` found for reference `&str` in the current scope
  --> pali/src/lex.rs:95:51
   |
95 | #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, EnumString)]
   |                                                   ^^^^^^^^^^ method not found in `&str`
   |
   = help: items from traits can only be used if the trait is in scope
   = note: this error originates in the derive macro `EnumString` (in Nightly builds, run with -Z macro-backtrace for more info)
help: trait `AsciiExt` which provides `eq_ignore_ascii_case` is implemented but not in scope; perhaps you want to import it
   |
1  + use std::ascii::AsciiExt;
   |

error[E0599]: no method named `chars` found for reference `&'a str` in the current scope
   --> pali/src/lex.rs:258:34
    |
258 |             let c = self.unlexed.chars().nth(0)?;
    |                                  ^^^^^ method not found in `&'a str`

error[E0599]: no function or associated item named `new` found for struct `Token` in the current scope
   --> pali/src/lex.rs:275:43
    |
204 | pub struct Token<'a> {
    | -------------------- function or associated item `new` not found for this struct
...
275 |                     return Some(Ok(Token::new(TokenKind::LeftParen, source_span)));
    |                                           ^^^ function or associated item not found in `Token<'_>`
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `new`, perhaps you need to implement it:
            candidate #1: `gimli::read::lookup::PubStuffEntry`
help: there is a method `ne` with a similar name, but with different arguments
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/cmp.rs:262:5

error[E0599]: no function or associated item named `new` found for struct `Token` in the current scope
   --> pali/src/lex.rs:281:43
    |
204 | pub struct Token<'a> {
    | -------------------- function or associated item `new` not found for this struct
...
281 |                     return Some(Ok(Token::new(TokenKind::RightParen, source_span)));
    |                                           ^^^ function or associated item not found in `Token<'_>`
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `new`, perhaps you need to implement it:
            candidate #1: `gimli::read::lookup::PubStuffEntry`
help: there is a method `ne` with a similar name, but with different arguments
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/cmp.rs:262:5

error[E0599]: no method named `lines` found for reference `&'a str` in the current scope
   --> pali/src/lex.rs:286:45
    |
286 |                     let line = self.unlexed.lines().next().unwrap();
    |                                             ^^^^^ method not found in `&'a str`

error[E0599]: no function or associated item named `into_vec` found for slice `[_]` in the current scope
   --> pali/src/lex.rs:307:34
    |
307 |                         labels = vec![LabeledSpan::underline(source_span)],
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `[_]`
    |
help: there is an associated function `to_vec` with a similar name
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/slice.rs:116:9
    = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no method named `find` found for type `str` in the current scope
   --> pali/src/lex.rs:325:61
    |
325 |                     let end_index = match self.unlexed[1..].find('"') {
    |                                                             ^^^^ method not found in `str`

error[E0599]: no function or associated item named `into_vec` found for slice `[_]` in the current scope
   --> pali/src/lex.rs:330:46
    |
330 |   ...                   labels = vec![
    |  ________________________________^
331 | | ...                       LabeledSpan::underline(self.index..self.index+self.unlexed.len())
332 | | ...                   ],
    | |_______________________^ function or associated item not found in `[_]`
    |
help: there is an associated function `to_vec` with a similar name
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/slice.rs:116:9
    = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no method named `len` found for reference `&'a str` in the current scope
   --> pali/src/lex.rs:331:100
    |
331 | ...                   LabeledSpan::underline(self.index..self.index+self.unlexed.len())
    |                                                                                  ^^^
    |
help: there is a method `le` with a similar name, but with different arguments
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/cmp.rs:1197:5

error[E0599]: no method named `len` found for reference `&str` in the current scope
   --> pali/src/lex.rs:338:72
    |
338 |                     let source_span = self.index..self.index + literal.len();
    |                                                                        ^^^
    |
help: there is a method `le` with a similar name, but with different arguments
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/cmp.rs:1197:5

error[E0599]: no method named `len` found for reference `&str` in the current scope
   --> pali/src/lex.rs:339:43
    |
339 |                     self.index += literal.len();
    |                                           ^^^
    |
help: there is a method `le` with a similar name, but with different arguments
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/cmp.rs:1197:5

error[E0599]: no function or associated item named `new` found for struct `Token` in the current scope
   --> pali/src/lex.rs:346:43
    |
204 | pub struct Token<'a> {
    | -------------------- function or associated item `new` not found for this struct
...
346 |                     return Some(Ok(Token::new(TokenKind::String(literal), source_span)));
    |                                           ^^^ function or associated item not found in `Token<'_>`
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `new`, perhaps you need to implement it:
            candidate #1: `gimli::read::lookup::PubStuffEntry`
help: there is a method `ne` with a similar name, but with different arguments
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/cmp.rs:262:5

error[E0599]: no method named `chars` found for reference `&'a str` in the current scope
   --> pali/src/lex.rs:357:52
    |
357 |                     let radix = match self.unlexed.chars().nth(1) {
    |                                                    ^^^^^ method not found in `&'a str`

error[E0599]: no method named `find` found for reference `&'a str` in the current scope
   --> pali/src/lex.rs:365:30
    |
364 | /                         self.unlexed
365 | |                             .find(|c: char| !c.is_digit(radix))
    | |                             -^^^^ method not found in `&'a str`
    | |_____________________________|
    |

error[E0599]: no method named `is_digit` found for type `char` in the current scope
   --> pali/src/lex.rs:365:48
    |
365 | ...                   .find(|c: char| !c.is_digit(radix))
    |                                          ^^^^^^^^ method not found in `char`

error[E0599]: no method named `len` found for reference `&'a str` in the current scope
   --> pali/src/lex.rs:366:53
    |
366 | ...                   .unwrap_or(self.unlexed.len())
    |                                               ^^^
    |
help: there is a method `le` with a similar name, but with different arguments
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/cmp.rs:1197:5

error[E0599]: no method named `find` found for type `str` in the current scope
   --> pali/src/lex.rs:369:30
    |
368 | /                         self.unlexed[2..]
369 | |                             .find(|c: char| !c.is_digit(radix))
    | |                             -^^^^ method not found in `str`
    | |_____________________________|
    |

error[E0599]: no method named `is_digit` found for type `char` in the current scope
   --> pali/src/lex.rs:369:48
    |
369 | ...                   .find(|c: char| !c.is_digit(radix))
    |                                          ^^^^^^^^ method not found in `char`

error[E0599]: no method named `len` found for reference `&'a str` in the current scope
   --> pali/src/lex.rs:370:53
    |
370 | ...                   .unwrap_or(self.unlexed.len())
    |                                               ^^^
    |
help: there is a method `le` with a similar name, but with different arguments
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/cmp.rs:1197:5

error[E0599]: no function or associated item named `from_str_radix` found for type `u16` in the current scope
   --> pali/src/lex.rs:384:30
    |
384 |                         u16::from_str_radix(literal, radix)
    |                              ^^^^^^^^^^^^^^ function or associated item not found in `u16`
    |
help: there is an associated function `from_str` with a similar name
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/str/traits.rs:832:5

error[E0599]: no function or associated item named `new` found for struct `Token` in the current scope
   --> pali/src/lex.rs:387:45
    |
204 | pub struct Token<'a> {
    | -------------------- function or associated item `new` not found for this struct
...
387 |                             .map(|n| Token::new(TokenKind::Number(n), source_span)),
    |                                             ^^^ function or associated item not found in `Token<'_>`
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `new`, perhaps you need to implement it:
            candidate #1: `gimli::read::lookup::PubStuffEntry`
help: there is a method `ne` with a similar name, but with different arguments
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/cmp.rs:262:5

error[E0599]: no method named `find` found for reference `&'a str` in the current scope
   --> pali/src/lex.rs:395:26
    |
393 |                       let end_index = self
    |  _____________________________________-
394 | |                         .unlexed
395 | |                         .find(|c| !(unicode_ident::is_xid_continue(c) | (c == '.')))
    | |                         -^^^^ method not found in `&'a str`
    | |_________________________|
    |

error[E0599]: no method named `len` found for reference `&'a str` in the current scope
   --> pali/src/lex.rs:396:49
    |
396 |                         .unwrap_or(self.unlexed.len());
    |                                                 ^^^
    |
help: there is a method `le` with a similar name, but with different arguments
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/cmp.rs:1197:5

error[E0599]: no function or associated item named `new` found for struct `Token` in the current scope
   --> pali/src/lex.rs:406:32
    |
204 | pub struct Token<'a> {
    | -------------------- function or associated item `new` not found for this struct
...
406 |                         Token::new(TokenKind::Opcode(opcode), source_span)
    |                                ^^^ function or associated item not found in `Token<'_>`
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `new`, perhaps you need to implement it:
            candidate #1: `gimli::read::lookup::PubStuffEntry`
help: there is a method `ne` with a similar name, but with different arguments
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/cmp.rs:262:5

error[E0599]: no function or associated item named `new` found for struct `Token` in the current scope
   --> pali/src/lex.rs:408:32
    |
204 | pub struct Token<'a> {
    | -------------------- function or associated item `new` not found for this struct
...
408 |                         Token::new(TokenKind::Register(register), source_span)
    |                                ^^^ function or associated item not found in `Token<'_>`
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `new`, perhaps you need to implement it:
            candidate #1: `gimli::read::lookup::PubStuffEntry`
help: there is a method `ne` with a similar name, but with different arguments
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/cmp.rs:262:5

error[E0599]: no function or associated item named `new` found for struct `Token` in the current scope
   --> pali/src/lex.rs:412:32
    |
204 | pub struct Token<'a> {
    | -------------------- function or associated item `new` not found for this struct
...
412 |                         Token::new(
    |                                ^^^ function or associated item not found in `Token<'_>`
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `new`, perhaps you need to implement it:
            candidate #1: `gimli::read::lookup::PubStuffEntry`
help: there is a method `ne` with a similar name, but with different arguments
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/cmp.rs:262:5

error[E0599]: no function or associated item named `new` found for struct `Token` in the current scope
   --> pali/src/lex.rs:417:32
    |
204 | pub struct Token<'a> {
    | -------------------- function or associated item `new` not found for this struct
...
417 |                         Token::new(
    |                                ^^^ function or associated item not found in `Token<'_>`
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `new`, perhaps you need to implement it:
            candidate #1: `gimli::read::lookup::PubStuffEntry`
help: there is a method `ne` with a similar name, but with different arguments
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/cmp.rs:262:5

error[E0599]: no function or associated item named `new` found for struct `Token` in the current scope
   --> pali/src/lex.rs:422:32
    |
204 | pub struct Token<'a> {
    | -------------------- function or associated item `new` not found for this struct
...
422 |                         Token::new(TokenKind::Segment, source_span)
    |                                ^^^ function or associated item not found in `Token<'_>`
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `new`, perhaps you need to implement it:
            candidate #1: `gimli::read::lookup::PubStuffEntry`
help: there is a method `ne` with a similar name, but with different arguments
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/cmp.rs:262:5

error[E0599]: no function or associated item named `new` found for struct `Token` in the current scope
   --> pali/src/lex.rs:424:32
    |
204 | pub struct Token<'a> {
    | -------------------- function or associated item `new` not found for this struct
...
424 |                         Token::new(TokenKind::Block, source_span)
    |                                ^^^ function or associated item not found in `Token<'_>`
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `new`, perhaps you need to implement it:
            candidate #1: `gimli::read::lookup::PubStuffEntry`
help: there is a method `ne` with a similar name, but with different arguments
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/cmp.rs:262:5

error[E0599]: no function or associated item named `new` found for struct `Token` in the current scope
   --> pali/src/lex.rs:426:32
    |
204 | pub struct Token<'a> {
    | -------------------- function or associated item `new` not found for this struct
...
426 |                         Token::new(TokenKind::Export, source_span)
    |                                ^^^ function or associated item not found in `Token<'_>`
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `new`, perhaps you need to implement it:
            candidate #1: `gimli::read::lookup::PubStuffEntry`
help: there is a method `ne` with a similar name, but with different arguments
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/cmp.rs:262:5

error[E0599]: no function or associated item named `new` found for struct `Token` in the current scope
   --> pali/src/lex.rs:428:32
    |
204 | pub struct Token<'a> {
    | -------------------- function or associated item `new` not found for this struct
...
428 |                         Token::new(TokenKind::Label(literal), source_span)
    |                                ^^^ function or associated item not found in `Token<'_>`
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `new`, perhaps you need to implement it:
            candidate #1: `gimli::read::lookup::PubStuffEntry`
help: there is a method `ne` with a similar name, but with different arguments
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/cmp.rs:262:5

error[E0599]: no method named `len` found for reference `&str` in the current scope
   --> pali/src/lex.rs:439:39
    |
439 |     &string_literal[1..string_literal.len() - 1]
    |                                       ^^^
    |
help: there is a method `le` with a similar name, but with different arguments
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/cmp.rs:1197:5

error[E0599]: no function or associated item named `new` found for struct `Lexer` in the current scope
   --> pali/src/parse.rs:18:27
    |
18  |             lexer: Lexer::new(source).peekable(),
    |                           ^^^ function or associated item not found in `Lexer<'_>`
    |
   ::: pali/src/lex.rs:219:1
    |
219 | pub struct Lexer<'a> {
    | -------------------- function or associated item `new` not found for this struct
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `new`, perhaps you need to implement it:
            candidate #1: `gimli::read::lookup::PubStuffEntry`

error[E0599]: no function or associated item named `into_vec` found for slice `[_]` in the current scope
  --> pali/src/parse.rs:38:42
   |
38 | ...                   labels = vec![LabeledSpan::underline(token.source_span)],
   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `[_]`
   |
help: there is an associated function `to_vec` with a similar name
  --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/slice.rs:116:9
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no function or associated item named `into_vec` found for slice `[_]` in the current scope
  --> pali/src/parse.rs:67:62
   |
67 |   ...                   labels = vec![LabeledSpan::underline(
   |  ________________________________^
68 | | ...                       token.source_span
69 | | ...                   )],
   | |________________________^ function or associated item not found in `[_]`
   |
help: there is an associated function `to_vec` with a similar name
  --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/slice.rs:116:9
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no function or associated item named `into_vec` found for slice `[_]` in the current scope
  --> pali/src/parse.rs:78:54
   |
78 |   ...                   labels = vec![LabeledSpan::at(
   |  ________________________________^
79 | | ...                       opening_parenthesis.source_span,
80 | | ...                       "unpaired opening parenthesis"
81 | | ...                   )],
   | |________________________^ function or associated item not found in `[_]`
   |
help: there is an associated function `to_vec` with a similar name
  --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/slice.rs:116:9
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no function or associated item named `into_vec` found for slice `[_]` in the current scope
  --> pali/src/parse.rs:93:42
   |
93 | ...                   labels = vec![LabeledSpan::underline(token.source_span)],
   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `[_]`
   |
help: there is an associated function `to_vec` with a similar name
  --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/slice.rs:116:9
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no function or associated item named `into_vec` found for slice `[_]` in the current scope
   --> pali/src/parse.rs:117:38
    |
117 | ...                   labels = vec![LabeledSpan::underline(token.source_span)],
    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `[_]`
    |
help: there is an associated function `to_vec` with a similar name
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/slice.rs:116:9
    = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no function or associated item named `into_vec` found for slice `[_]` in the current scope
   --> pali/src/parse.rs:126:34
    |
126 |                           labels = vec![LabeledSpan::at(
    |  __________________________________^
127 | |                             opening_parenthesis.source_span,
128 | |                             "unpaired opening parenthesis"
129 | |                         )],
    | |__________________________^ function or associated item not found in `[_]`
    |
help: there is an associated function `to_vec` with a similar name
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/slice.rs:116:9
    = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no method named `parse_code` found for struct `parse::Parser` in the current scope
   --> pali/src/parse.rs:157:85
    |
9   | pub struct Parser<'a> {
    | --------------------- method `parse_code` not found for this struct
...
157 |                             segments[usize::from(u16::from(permissions))].push(self.parse_code()?);
    |                                                                                     ^^^^^^^^^^ method not found in `Parser<'a>`

error[E0599]: no function or associated item named `into_vec` found for slice `[_]` in the current scope
   --> pali/src/parse.rs:162:38
    |
162 |   ...                   labels = vec![LabeledSpan::at(
    |  ________________________________^
163 | | ...                       opening_parenthesis.source_span,
164 | | ...                       "unpaired opening parenthesis"
165 | | ...                   )],
    | |________________________^ function or associated item not found in `[_]`
    |
help: there is an associated function `to_vec` with a similar name
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/slice.rs:116:9
    = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no function or associated item named `into_vec` found for slice `[_]` in the current scope
   --> pali/src/parse.rs:186:34
    |
186 |                         labels = vec![LabeledSpan::underline(token.source_span)],
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `[_]`
    |
help: there is an associated function `to_vec` with a similar name
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/slice.rs:116:9
    = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no function or associated item named `into_vec` found for slice `[_]` in the current scope
   --> pali/src/parse.rs:206:34
    |
206 |                         labels = vec![LabeledSpan::underline(token.source_span)],
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `[_]`
    |
help: there is an associated function `to_vec` with a similar name
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/slice.rs:116:9
    = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no function or associated item named `into_vec` found for slice `[_]` in the current scope
   --> pali/src/parse.rs:231:38
    |
231 | ...                   labels = vec![LabeledSpan::underline(token.source_span)],
    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `[_]`
    |
help: there is an associated function `to_vec` with a similar name
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/slice.rs:116:9
    = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no method named `parse_immediate` found for mutable reference `&mut parse::Parser<'a>` in the current scope
   --> pali/src/parse.rs:255:48
    |
255 | ...                   let imm = self.parse_immediate()?;
    |                                      ^^^^^^^^^^^^^^^ method not found in `&mut Parser<'a>`

error[E0599]: no method named `parse_control_status_register` found for mutable reference `&mut parse::Parser<'a>` in the current scope
   --> pali/src/parse.rs:259:48
    |
259 | ...                   let dst = self.parse_control_status_register()?;
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ method not found in `&mut Parser<'a>`

error[E0599]: no method named `parse_register` found for mutable reference `&mut parse::Parser<'a>` in the current scope
   --> pali/src/parse.rs:260:48
    |
260 | ...                   let src = self.parse_register()?;
    |                                      ^^^^^^^^^^^^^^ method not found in `&mut Parser<'a>`

error[E0599]: no method named `parse_register` found for mutable reference `&mut parse::Parser<'a>` in the current scope
   --> pali/src/parse.rs:265:48
    |
265 | ...                   let dst = self.parse_register()?;
    |                                      ^^^^^^^^^^^^^^ method not found in `&mut Parser<'a>`

error[E0599]: no method named `parse_control_status_register` found for mutable reference `&mut parse::Parser<'a>` in the current scope
   --> pali/src/parse.rs:266:48
    |
266 | ...                   let src = self.parse_control_status_register()?;
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ method not found in `&mut Parser<'a>`

error[E0599]: no method named `takes_immediate` found for enum `Opcode` in the current scope
   --> pali/src/parse.rs:270:41
    |
270 | ...                   _ if opcode.takes_immediate() => {
    |                                   ^^^^^^^^^^^^^^^ method not found in `Opcode`
    |
   ::: pali/src/lex.rs:12:1
    |
12  | pub enum Opcode {
    | --------------- method `takes_immediate` not found for this enum

error[E0599]: no method named `parse_register` found for mutable reference `&mut parse::Parser<'a>` in the current scope
   --> pali/src/parse.rs:271:48
    |
271 | ...                   let dst = self.parse_register()?;
    |                                      ^^^^^^^^^^^^^^ method not found in `&mut Parser<'a>`

error[E0599]: no method named `parse_register` found for mutable reference `&mut parse::Parser<'a>` in the current scope
   --> pali/src/parse.rs:272:48
    |
272 | ...                   let src = self.parse_register()?;
    |                                      ^^^^^^^^^^^^^^ method not found in `&mut Parser<'a>`

error[E0599]: no method named `parse_immediate` found for mutable reference `&mut parse::Parser<'a>` in the current scope
   --> pali/src/parse.rs:273:48
    |
273 | ...                   let imm = self.parse_immediate()?;
    |                                      ^^^^^^^^^^^^^^^ method not found in `&mut Parser<'a>`

error[E0599]: no method named `parse_register` found for mutable reference `&mut parse::Parser<'a>` in the current scope
   --> pali/src/parse.rs:283:48
    |
283 | ...                   let dst = self.parse_register()?;
    |                                      ^^^^^^^^^^^^^^ method not found in `&mut Parser<'a>`

error[E0599]: no method named `parse_register` found for mutable reference `&mut parse::Parser<'a>` in the current scope
   --> pali/src/parse.rs:284:48
    |
284 | ...                   let src = self.parse_register()?;
    |                                      ^^^^^^^^^^^^^^ method not found in `&mut Parser<'a>`

error[E0599]: no function or associated item named `into_vec` found for slice `[_]` in the current scope
   --> pali/src/parse.rs:298:54
    |
298 |   ...                   labels = vec![
    |  ________________________________^
299 | | ...                       LabeledSpan::at(
300 | | ...                           opening_parenthesis.source_span,
301 | | ...                           "unpaired opening parenthesis"
...   |
306 | | ...                       )
307 | | ...                   ],
    | |_______________________^ function or associated item not found in `[_]`
    |
help: there is an associated function `to_vec` with a similar name
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/slice.rs:116:9
    = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no function or associated item named `into_vec` found for slice `[_]` in the current scope
   --> pali/src/parse.rs:316:46
    |
316 |   ...                   labels = vec![LabeledSpan::at(
    |  ________________________________^
317 | | ...                       opening_parenthesis.source_span,
318 | | ...                       "unpaired opening parenthesis"
319 | | ...                   )],
    | |________________________^ function or associated item not found in `[_]`
    |
help: there is an associated function `to_vec` with a similar name
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/slice.rs:116:9
    = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no function or associated item named `into_vec` found for slice `[_]` in the current scope
   --> pali/src/parse.rs:331:38
    |
331 | ...                   labels = vec![LabeledSpan::underline(token.source_span)],
    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `[_]`
    |
help: there is an associated function `to_vec` with a similar name
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/slice.rs:116:9
    = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no function or associated item named `into_vec` found for slice `[_]` in the current scope
   --> pali/src/parse.rs:355:38
    |
355 | ...                   labels = vec![LabeledSpan::underline(token.source_span)],
    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `[_]`
    |
help: there is an associated function `to_vec` with a similar name
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/slice.rs:116:9
    = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no method named `parse_code` found for mutable reference `&mut parse::Parser<'a>` in the current scope
   --> pali/src/parse.rs:383:44
    |
383 |                         contents.push(self.parse_code()?);
    |                                            ^^^^^^^^^^ method not found in `&mut Parser<'a>`

error[E0599]: no function or associated item named `into_vec` found for slice `[_]` in the current scope
   --> pali/src/parse.rs:388:34
    |
388 |                           labels = vec![LabeledSpan::at(
    |  __________________________________^
389 | |                             opening_parenthesis.source_span,
390 | |                             "unpaired opening parenthesis"
391 | |                         )],
    | |__________________________^ function or associated item not found in `[_]`
    |
help: there is an associated function `to_vec` with a similar name
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/slice.rs:116:9
    = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no function or associated item named `into_vec` found for slice `[_]` in the current scope
   --> pali/src/parse.rs:411:34
    |
411 |                         labels = vec![LabeledSpan::underline(token.source_span)],
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `[_]`
    |
help: there is an associated function `to_vec` with a similar name
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/slice.rs:116:9
    = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no method named `size` found for reference `&Code<'_>` in the current scope
   --> pali/src/parse.rs:464:37
    |
464 |                 segment_offset += n.size();
    |                                     ^^^^ method not found in `&Code<'_>`
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following traits define an item `size`, perhaps you need to implement one of them:
            candidate #1: `object::read::macho::fat::FatArch`
            candidate #2: `object::read::macho::section::Section`
            candidate #3: `object::read::traits::ObjectSection`
            candidate #4: `object::read::traits::ObjectSegment`
            candidate #5: `object::read::traits::ObjectSymbol`
            candidate #6: `std::os::unix::fs::MetadataExt`

error[E0599]: no method named `iter` found for reference `&Vec<Code<'_>>` in the current scope
   --> pali/src/parse.rs:519:54
    |
519 |             Code::Block { contents, .. } => contents.iter().map(Self::size).sum(),
    |                                                      ^^^^ method not found in `&Vec<Code<'_>>`

error[E0599]: no variant or associated item named `size` found for enum `Code` in the current scope
   --> pali/src/parse.rs:519:71
    |
485 | pub enum Code<'a> {
    | ----------------- variant or associated item `size` not found for this enum
...
519 |             Code::Block { contents, .. } => contents.iter().map(Self::size).sum(),
    |                                                                       ^^^^ variant or associated item not found in `Code<'_>`
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following traits define an item `size`, perhaps you need to implement one of them:
            candidate #1: `object::read::macho::fat::FatArch`
            candidate #2: `object::read::macho::section::Section`
            candidate #3: `object::read::traits::ObjectSection`
            candidate #4: `object::read::traits::ObjectSegment`
            candidate #5: `object::read::traits::ObjectSymbol`
            candidate #6: `std::os::unix::fs::MetadataExt`

error[E0599]: no method named `encode_utf16` found for reference `&&str` in the current scope
   --> pali/src/parse.rs:525:33
    |
525 |                 u16::try_from(s.encode_utf16().collect::<Vec<_>>().len()).unwrap()
    |                                 ^^^^^^^^^^^^ method not found in `&&str`

error[E0599]: no method named `symbol_table` found for struct `Program` in the current scope
   --> pali/src/poki.rs:16:36
    |
16  |         let symbol_table = program.symbol_table()?;
    |                                    ^^^^^^^^^^^^ method not found in `Program<'a>`
    |
   ::: pali/src/parse.rs:423:1
    |
423 | pub struct Program<'a> {
    | ---------------------- method `symbol_table` not found for this struct
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `symbol_table`, perhaps you need to implement it:
            candidate #1: `object::read::traits::Object`

error[E0599]: no function or associated item named `new` found for struct `Segment` in the current scope
  --> pali/src/poki.rs:18:46
   |
18 |         let mut segments = [const { Segment::new() }; 8];
   |                                              ^^^ function or associated item not found in `Segment<'_>`
...
98 | struct Segment<'a> {
   | ------------------ function or associated item `new` not found for this struct
   |
   = help: items from traits can only be used if the trait is implemented and in scope
   = note: the following trait defines an item `new`, perhaps you need to implement it:
           candidate #1: `gimli::read::lookup::PubStuffEntry`
help: there is a method `ne` with a similar name, but with different arguments
  --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/cmp.rs:262:5

error[E0599]: no method named `to_ne_bytes` found for type `u16` in the current scope
  --> pali/src/poki.rs:44:74
   |
44 |             buffer.extend(u16::try_from(segment.contents.len()).unwrap().to_ne_bytes());
   |                                                                          ^^^^^^^^^^^ method not found in `u16`

error[E0599]: no method named `to_ne_bytes` found for type `u16` in the current scope
  --> pali/src/poki.rs:48:22
   |
46 | /                 u16::try_from(3 * segment.relocation_table.len())
47 | |                     .unwrap()
48 | |                     .to_ne_bytes(),
   | |                     -^^^^^^^^^^^ method not found in `u16`
   | |_____________________|
   |

error[E0599]: no method named `iter` found for struct `Vec<Export<'_>>` in the current scope
  --> pali/src/poki.rs:53:22
   |
51 | /                 segment
52 | |                     .exported_symbols
53 | |                     .iter()
   | |                     -^^^^ method not found in `Vec<Export<'_>>`
   | |_____________________|
   |

error[E0599]: no function or associated item named `size` found for struct `Export` in the current scope
   --> pali/src/poki.rs:54:34
    |
54  |                     .map(Export::size)
    |                                  ^^^^ function or associated item not found in `Export<'_>`
...
236 | struct Export<'a> {
    | ----------------- function or associated item `size` not found for this struct
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following traits define an item `size`, perhaps you need to implement one of them:
            candidate #1: `object::read::macho::fat::FatArch`
            candidate #2: `object::read::macho::section::Section`
            candidate #3: `object::read::traits::ObjectSection`
            candidate #4: `object::read::traits::ObjectSegment`
            candidate #5: `object::read::traits::ObjectSymbol`
            candidate #6: `std::os::unix::fs::MetadataExt`

error[E0599]: no method named `to_ne_bytes` found for reference `&u16` in the current scope
  --> pali/src/poki.rs:63:36
   |
63 |                 buffer.extend(word.to_ne_bytes());
   |                                    ^^^^^^^^^^^ method not found in `&u16`

error[E0599]: no method named `to_ne_bytes` found for type `u16` in the current scope
  --> pali/src/poki.rs:67:61
   |
67 |                 buffer.extend(relocation_table_entry.offset.to_ne_bytes());
   |                                                             ^^^^^^^^^^^ method not found in `u16`

error[E0599]: no method named `to_ne_bytes` found for type `u16` in the current scope
  --> pali/src/poki.rs:68:68
   |
68 |                 buffer.extend(relocation_table_entry.segment_index.to_ne_bytes());
   |                                                                    ^^^^^^^^^^^ method not found in `u16`

error[E0599]: no method named `to_ne_bytes` found for type `u16` in the current scope
  --> pali/src/poki.rs:69:69
   |
69 |                 buffer.extend(relocation_table_entry.segment_offset.to_ne_bytes());
   |                                                                     ^^^^^^^^^^^ method not found in `u16`

error[E0599]: no method named `size` found for reference `&Export<'_>` in the current scope
  --> pali/src/poki.rs:73:39
   |
73 |                 buffer.extend((export.size() - 2).to_ne_bytes());
   |                                       ^^^^ method not found in `&Export<'_>`
   |
   = help: items from traits can only be used if the trait is implemented and in scope
   = note: the following traits define an item `size`, perhaps you need to implement one of them:
           candidate #1: `object::read::macho::fat::FatArch`
           candidate #2: `object::read::macho::section::Section`
           candidate #3: `object::read::traits::ObjectSection`
           candidate #4: `object::read::traits::ObjectSegment`
           candidate #5: `object::read::traits::ObjectSymbol`
           candidate #6: `std::os::unix::fs::MetadataExt`

error[E0599]: no method named `encode_utf16` found for reference `&str` in the current scope
  --> pali/src/poki.rs:74:39
   |
74 |                 for c in export.label.encode_utf16() {
   |                                       ^^^^^^^^^^^^ method not found in `&str`

error[E0599]: no method named `to_ne_bytes` found for type `u16` in the current scope
  --> pali/src/poki.rs:77:45
   |
77 |                 buffer.extend(export.offset.to_ne_bytes());
   |                                             ^^^^^^^^^^^ method not found in `u16`

error[E0599]: no method named `encode_utf16` found for reference `&&str` in the current scope
  --> pali/src/poki.rs:84:38
   |
84 |                 u16::try_from(symbol.encode_utf16().count())
   |                                      ^^^^^^^^^^^^ method not found in `&&str`

error[E0599]: no method named `encode_utf16` found for reference `&&str` in the current scope
  --> pali/src/poki.rs:88:29
   |
88 |             for c in symbol.encode_utf16() {
   |                             ^^^^^^^^^^^^ method not found in `&&str`

error[E0599]: no method named `contains` found for reference `&Vec<&'a str>` in the current scope
   --> pali/src/poki.rs:124:32
    |
124 |                     if exports.contains(label) {
    |                                ^^^^^^^^ method not found in `&Vec<&str>`

error[E0599]: no method named `add_code` found for mutable reference `&mut Segment<'a>` in the current scope
   --> pali/src/poki.rs:127:26
    |
127 |                     self.add_code(contents, symbol_table, unresolved_symbols, exports);
    |                          ^^^^^^^^ method not found in `&mut Segment<'a>`

error[E0599]: no method named `encode_utf16` found for reference `&&str` in the current scope
   --> pali/src/poki.rs:130:44
    |
130 |                     self.contents.extend(s.encode_utf16());
    |                                            ^^^^^^^^^^^^ method not found in `&&str`

error[E0599]: no method named `iter` found for mutable reference `&mut Vec<&'a str>` in the current scope
   --> pali/src/poki.rs:162:66
    |
162 | ...                   match unresolved_symbols.iter().position(|s| s == label) {
    |                                                ^^^^ method not found in `&mut Vec<&str>`

error[E0599]: no method named `iter` found for mutable reference `&mut Vec<&'a str>` in the current scope
   --> pali/src/poki.rs:207:66
    |
207 | ...                   match unresolved_symbols.iter().position(|s| s == label) {
    |                                                ^^^^ method not found in `&mut Vec<&str>`

error[E0599]: no method named `size` found for reference `&Code<'_>` in the current scope
   --> pali/src/poki.rs:230:28
    |
230 |             offset += code.size();
    |                            ^^^^ method not found in `&Code<'_>`
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following traits define an item `size`, perhaps you need to implement one of them:
            candidate #1: `object::read::macho::fat::FatArch`
            candidate #2: `object::read::macho::section::Section`
            candidate #3: `object::read::traits::ObjectSection`
            candidate #4: `object::read::traits::ObjectSegment`
            candidate #5: `object::read::traits::ObjectSymbol`
            candidate #6: `std::os::unix::fs::MetadataExt`

error[E0599]: no method named `encode_utf16` found for reference `&'a str` in the current scope
   --> pali/src/poki.rs:243:34
    |
243 |         u16::try_from(self.label.encode_utf16().count() + 2).unwrap()
    |                                  ^^^^^^^^^^^^ method not found in `&'a str`

error[E0599]: no function or associated item named `new` found for struct `parse::Parser` in the current scope
  --> pali/src/main.rs:30:33
   |
30 |     let parser = parse::Parser::new(&source);
   |                                 ^^^ function or associated item not found in `Parser<'_>`
   |
  ::: pali/src/parse.rs:9:1
   |
9  | pub struct Parser<'a> {
   | --------------------- function or associated item `new` not found for this struct
   |
   = help: items from traits can only be used if the trait is implemented and in scope
   = note: the following trait defines an item `new`, perhaps you need to implement it:
           candidate #1: `gimli::read::lookup::PubStuffEntry`

error[E0599]: no function or associated item named `from_program` found for struct `Poki` in the current scope
  --> pali/src/main.rs:33:28
   |
33 |     let poki = poki::Poki::from_program(program)?.to_bytes();
   |                            ^^^^^^^^^^^^ function or associated item not found in `Poki<'_>`
   |
  ::: pali/src/poki.rs:9:1
   |
9  | pub struct Poki<'a> {
   | ------------------- function or associated item `from_program` not found for this struct

warning: unused import: `WrapErr`
 --> pali/src/lex.rs:1:63
  |
1 | use miette::{IntoDiagnostic, LabeledSpan, Result, SourceSpan, WrapErr};
  |                                                               ^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `IntoDiagnostic`
 --> pali/src/lex.rs:1:14
  |
1 | use miette::{IntoDiagnostic, LabeledSpan, Result, SourceSpan, WrapErr};
  |              ^^^^^^^^^^^^^^

Some errors have detailed explanations: E0116, E0599.
For more information about an error, try `rustc --explain E0116`.
warning: `pali` (bin "pali") generated 2 warnings
error: could not compile `pali` (bin "pali") due to 93 previous errors; 2 warnings emitted

Desired output

Only the relevant error should be printed, namely:

error[E0116]: cannot define inherent `impl` for a type outside of the crate where the type is defined
   --> pali/src/poki.rs:247:1
    |
247 | impl Vec<Export<'_>> {
    | ^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate
    |
    = note: define and implement a trait or new type instead

Rationale and extra context

No response

Other cases

No response

Rust Version

rustc 1.81.0 (eeb90cd 2024-09-04)
binary: rustc
commit-hash: eeb90cd
commit-date: 2024-09-04
host: x86_64-unknown-linux-gnu
release: 1.81.0
LLVM version: 18.1.7

Anything else?

No response

@CrashAndSideburns CrashAndSideburns added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 29, 2024
@compiler-errors
Copy link
Member

compiler-errors commented Sep 29, 2024

This should be fixed by #130764.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants