Skip to content

'infinite' loop of E0119 error messages #27218

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

Closed
AlisdairO opened this issue Jul 22, 2015 · 2 comments
Closed

'infinite' loop of E0119 error messages #27218

AlisdairO opened this issue Jul 22, 2015 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@AlisdairO
Copy link
Contributor

While convoluting some code to try to find error messages, I came across a loop in the errors.

The code:

impl<T: Drop> Drop for T {
fn drop(&mut self) {}
}

The errors:

120.rs:17:1: 19:2 error: the Drop trait may only be implemented on structures [E0120]
120.rs:17 impl<T: Drop> Drop for T {
120.rs:18     fn drop(&mut self) {}
120.rs:19 }
120.rs:17:1: 19:2 error: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`); only traits defined in the current crate can be implemented for a type parameter [E0210]
120.rs:17 impl<T: Drop> Drop for T {
120.rs:18     fn drop(&mut self) {}
120.rs:19 }
120.rs:17:1: 19:2 error: conflicting implementations for trait `core::ops::Drop` [E0119]
120.rs:17 impl<T: Drop> Drop for T {
120.rs:18     fn drop(&mut self) {}
120.rs:19 }
120.rs:17:1: 19:2 help: run `rustc --explain E0119` to see a detailed explanation
120.rs:17:1: 19:2 note: conflicting implementation in crate `alloc`
120.rs:17 impl<T: Drop> Drop for T {
120.rs:18     fn drop(&mut self) {}
120.rs:19 }
120.rs:17:1: 19:2 error: conflicting implementations for trait `core::ops::Drop` [E0119]
120.rs:17 impl<T: Drop> Drop for T {
120.rs:18     fn drop(&mut self) {}
120.rs:19 }
120.rs:17:1: 19:2 help: run `rustc --explain E0119` to see a detailed explanation
120.rs:17:1: 19:2 note: conflicting implementation in crate `std`
120.rs:17 impl<T: Drop> Drop for T {
120.rs:18     fn drop(&mut self) {}
120.rs:19 }
...repeat...
error: aborting due to 55 previous errors

Obviously not an especially severe issue!

@sfackler sfackler added the A-diagnostics Area: Messages for errors, warnings, and lints label Jul 22, 2015
@apasel422
Copy link
Contributor

The reason for this is that the compiler is determining that there are 53 conflicting implementations across the crates that are linked by default. There is no "loop" in the diagnostics per se. As an example, the following code only outputs 4 errors (including two for the conflicting impls for core::cell::{BorrowRef, BorrowRefMut}):

#![feature(lang_items, no_std)]
#![no_std]

extern crate core;

use core::ops::Drop;

#[lang = "panic_fmt"]
fn panic_fmt() {}

#[lang = "stack_exhausted"]
fn stack_exhausted() {}

#[lang = "eh_personality"]
fn eh_personality() {}

impl<T: Drop> Drop for T {
    fn drop(&mut self) {}
}

fn main() {}

Output:

foo.rs:17:1: 19:2 error: the Drop trait may only be implemented on structures [E0120]
foo.rs:17 impl<T: Drop> Drop for T {
foo.rs:18     fn drop(&mut self) {}
foo.rs:19 }
foo.rs:17:1: 19:2 error: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`); only traits defined in the current crate can be implemented for a type parameter [E0210]
foo.rs:17 impl<T: Drop> Drop for T {
foo.rs:18     fn drop(&mut self) {}
foo.rs:19 }
foo.rs:17:1: 19:2 error: conflicting implementations for trait `core::ops::Drop` [E0119]
foo.rs:17 impl<T: Drop> Drop for T {
foo.rs:18     fn drop(&mut self) {}
foo.rs:19 }
foo.rs:17:1: 19:2 help: run `rustc --explain E0119` to see a detailed explanation
foo.rs:17:1: 19:2 note: conflicting implementation in crate `core`
foo.rs:17 impl<T: Drop> Drop for T {
foo.rs:18     fn drop(&mut self) {}
foo.rs:19 }
foo.rs:17:1: 19:2 error: conflicting implementations for trait `core::ops::Drop` [E0119]
foo.rs:17 impl<T: Drop> Drop for T {
foo.rs:18     fn drop(&mut self) {}
foo.rs:19 }
foo.rs:17:1: 19:2 help: run `rustc --explain E0119` to see a detailed explanation
foo.rs:17:1: 19:2 note: conflicting implementation in crate `core`
foo.rs:17 impl<T: Drop> Drop for T {
foo.rs:18     fn drop(&mut self) {}
foo.rs:19 }
error: aborting due to 4 previous errors

@AlisdairO
Copy link
Contributor Author

Ah, I should have read the output more clearly - my apologies! I'll close this off.

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
Projects
None yet
Development

No branches or pull requests

3 participants