Skip to content

Internal compiler error: cannot relate bound region (likely caused by conservative_impl_trait) #39872

Closed
@jmegaffin

Description

@jmegaffin

Related code:

pub struct PhysicalDevice<'a> {
	instance: &'a ::Instance<'a>,
	physical_device: VkPhysicalDevice,
	queue_families: Box<[QueueFamily]>
}

#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub struct QueueFamily {
	pub graphics: bool,
	pub compute: bool,
	pub transfer: bool,
	pub sparse_binding: bool
}

impl<'a> PhysicalDevice<'a> {
	// broken type signature
	pub fn queue_families(&self) -> impl Iterator<Item=&QueueFamily> {
		self.queue_families.iter()
	}
}

Compiler panic:

error: internal compiler error: C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\librustc\infer\region_inference/mod.rs:744: cannot relate bound region: '_#4r <= ReLateBound(DebruijnIndex { depth: 2 }, BrAnon(0))
  --> galvan\src\instance\device/mod.rs:56:34
   |
56 |    pub fn queue_families(&self) -> impl Iterator<Item=&QueueFamily> {
   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Note that everything is fine if I annotate the lifetimes:

// working type signature
pub fn queue_families(&'a self) -> impl Iterator<Item=&'a QueueFamily> {
	self.queue_families.iter()
}

I am running rustc 1.17.0-nightly (ba7cf7cc5 2017-02-11), the MSVC x64 version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions