Closed Bug 1779659 Opened 3 years ago Closed 3 years ago

Build fails with Rust 1.62: "lifetime may not live long enough" in $obj/$arch/debug/build/style-.../out/shorthands/border.rs

Categories

(Firefox Build System :: General, defect)

x86_64
Linux
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jimb, Unassigned)

Details

Attachments

(1 file)

Attached file full-error-message.txt

Starting with M-C changeset 5fb8ccdcbfea (2022-7-14), Rust 1.62 reports an compile-time error, and then crashes with an incremental-build-related internal compiler error.

This is obviously not affecting the treeherder build machines, but it occurs reliably on my machine (Fedora 36). I've been unable to determine what causes the difference. I've worked around the problem with rustup default beta, which I assume means that it's a rustc bug that's been fixed.

The error message is as follows:

error: lifetime may not live long enough
   --> /home/jimb/moz/central/obj-x86_64-pc-linux-gnu/x86_64-unknown-linux-gnu/debug/build/style-c9e2b88f8301d11f/out/shorthands/border.rs:157:24
    |
153 |           fn parse_value<'i, 't>(
    |                          --  -- lifetime `'t` defined here
    |                          |
    |                          lifetime `'i` defined here
...
157 |               let rect = Rect::parse_with(context, input, |c, i| -> Result<
    |  ________________________^
158 | |                 crate::properties::longhands::border_top_color::SpecifiedValue,
159 | |                 ParseError<'i>
160 | |             > {
161 | |                 specified::Color::parse_quirky(c, i, specified::AllowQuirks::Yes)
162 | |             })?;
    | |______________^ argument requires that `'t` must outlive `'i`
    |
    = help: consider adding the following bound: `'t: 'i`
    = note: requirement occurs because of a mutable reference to `cssparser::Parser<'_, '_>`
    = note: mutable references are invariant over their type parameter
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
error: internal compiler error: encountered incremental compilation error with mir_borrowck(style[943b]::properties::shorthands::border_color::parse_value)
  |
  = help: This is a known issue with the compiler. Run `cargo clean -p style` or `cargo clean` to allow your project to compile
  = note: Please follow the instructions below to create a bug report with the provided information
  = note: See <https://github.com/rust-lang/rust/issues/84970> for more information
thread 'rustc' panicked at 'Found unstable fingerprints for mir_borrowck(style[943b]::properties::shorthands::border_color::parse_value): BorrowCheckResult { concrete_opaque_types: VecMap([]), closure_requirements: None, used_mut_upvars: [], tainted_by_errors: Some(ErrorGuaranteed(())) }', compiler/rustc_query_system/src/query/plumbing.rs:626:9

I've provided the rest of the error message as an attachment.

Changeset 5fb8ccdcbfea itself doesn't touch any Rust source code, but it does affect some header files we generate Rust bindings for. The changeset affects the contents of the file obj-x86_64-pc-linux-gnu/x86_64-unknown-linux-gnu/debug/build/style-c9e2b88f8301d11f/out/gecko/structs.rs (in my build, obviously).

I have run mach bootstrap to ensure I'm using the right tools.

The rustc bug might be rust#96655.

(I'd love to know why I'm getting incremental build fingerprinting errors even when I mach clobber just before mach build. Do the various cargo invocations affect each other?)

try mach clobber --full

Oh. I didn't realize mach clobber was keeping rust incremental build artifacts around. The docs don't mention this. mach clobber --full does let me build with 1.62 stable.

This series of commands gets me the same crash:

rustup default 1.62.0
hg co 5fb8ccdcbfea
mach clobber --full
mach build
hg co .^
mach build

Is the fix just, "wait a month for Rust 1.63 to become stable, and use mach clobber --full in the meantime"? I don't see what we can actually do about this; I just wanted to file the bug in case anyone else ran into it.

1.63 can go back and forth across that commit without needing a clobber.

You can also use --disable-cargo-incremental

A couple of us hit this the other day and got around it with hg purge --all

This is fixed by the upcoming Rust 1.62.1 point release:

https://blog.rust-lang.org/inside-rust/2022/07/16/1.62.1-prerelease.html

(thanks to :glandium)

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: