-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
(spawned off of #58291)
Reduced example (play):
use std::panic::RefUnwindSafe;
trait Database { type Storage; }
trait HasQueryGroup { }
trait Query<DB> { type Data; }
trait SourceDatabase { fn parse(&self) { loop { } } }
struct ParseQuery;
struct RootDatabase { _runtime: Runtime<RootDatabase>, }
struct Runtime<DB: Database> { _storage: Box<DB::Storage> }
struct SalsaStorage { _parse: <ParseQuery as Query<RootDatabase>>::Data, }
impl Database for RootDatabase { type Storage = SalsaStorage; }
impl HasQueryGroup for RootDatabase {}
impl<DB> Query<DB> for ParseQuery where DB: SourceDatabase, DB: Database { type Data = RootDatabase; }
impl<T> SourceDatabase for T where T: RefUnwindSafe, T: HasQueryGroup {}
pub(crate) fn goto_implementation(db: &RootDatabase) -> u32 { db.parse(); loop { } }
fn main() { }
original code:
https://gist.github.com/dc3f0f8568ca093d9750653578bb8026
% rustc +nightly-2018-04-27 --allow dead_code src/main.rs
% rustc +nightly-2018-04-28 --allow dead_code src/main.rs
error[E0599]: no method named `parse` found for type `&RootDatabase` in the current scope
--> src/main.rs:231:6
|
231 | { db.parse(); loop { } }
| ^^^^^
|
= note: the method `parse` exists but the following trait bounds were not satisfied:
`RootDatabase : SourceDatabase`
`&RootDatabase : SourceDatabase`
`RootDatabase : SourceDatabase`
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `parse`, perhaps you need to implement it:
candidate #1: `SourceDatabase`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0599`.
%
Metadata
Metadata
Assignees
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.