Rust: [nll] bootstrap rustc with NLL enabled

Created on 26 Jun 2018  路  8Comments  路  Source: rust-lang/rust

As discussed in today's meeting, we need to get rustc bootstrapping with NLL enabled -- if there are problems, we should isolate them.

@lqd is going to try and push this through and report back.

NLL-complete T-compiler

Most helpful comment

Here's a summary of this adventure :)

I'll ignore the cases where MIR borrowck correctly adds new "unused mut" lint warnings which were previously not found by the AST borrowck: while they are new warnings, the unused muts were easily removed from the rustc code in order to keep building, so I marked them as ok (but can produce the list of cases if need be).

I tested by manually enabling the NLL feature in crates, #![cfg_attr(not(stage0), feature(nll))], and building. This doesn't test the submodules, stdsimd, and tools.

Interesting cases

  • liballoc: doesn't build, already tracked as #48224 (https://github.com/rust-lang/rust/issues/48224#issuecomment-365952037 mentions Niko might have a fix already)

  • librustc_passes: doesn't build right now and seems correct (apparently this pattern comes up often, so maybe we can accept this in the future, with additions to 2-phase-borrows), minimized repro here for convenience.

  • librustc_typeck: doesn't build because of incorrect "unused mut" lint warnings #51830. and because of ICE cannot convert ... to a region vid which is #51351, and has a minimized repro.

  • libsyntax_ext: doesn't build because of "broken MIR" ICE #48071, which has a minimal repro here.

Cases of incorrect "unused mut" lint warnings

  • libcore: used to ICE with region_obligations not empty (known issue #51649).
    This error has, after I started, become less prominent on master, and now 4 denied warnings prevent building. These are incorrect "unused mut" lint warnings when using move closures, and occurrences of known issue #51801 (which might be a more minimal reproduction of #50897)

  • librustc doesn't build because of incorrect "unused mut" lint warnings #51801 and #51830, the latter mentions removing a "mut" that doesn't exist in the surface code, and minimized in the issues and for convenience here

  • librustc_data_structures: used to ICE with region_obligations not empty (known issue #51649). Now doesn't build because of incorrect "unused mut" lint warnings #51801.

  • librustc_driver: doesn't build because of incorrect "unused mut" lint warnings #51801.

  • librustc_lint: doesn't build because of incorrect "unused mut" lint warnings #51830.

  • librustc_traits: doesn't build because of incorrect "unused mut" lint warnings #51830.

  • libserialize: doesn't build because of incorrect "unused mut" lint warnings #51801.

  • libsyntax: doesn't build because of incorrect "unused mut" lint warnings which I'm not sure we tracked so I filed it as #51904. A reduced repro is available here. The fact that there are 2 closures seem important here.


Crates without issues

  • liballoc_jemalloc: seems ok (unsure whether it's built when jemalloc is disabled in the config.toml)
  • liballoc_system: seems ok
  • libarena: ok
  • libfmt_macros: ok
  • libgraphviz: ok
  • libpanic_abort: ok
  • libpanic_unwind: ok
  • libproc_macro: ok
  • libprofiler_builtins: ok
  • librustc_allocator: ok
  • librustc_apfloat: ok
  • librustc_asan: ok
  • librustc_borrowck: ok
  • librustc_codegen_llvm: ok
  • librustc_codegen_utils: ok
  • librustc_cratesio_shim: ok, but it's just 2 extern crates
  • librustc_errors: ok
  • librustc_incremental: ok
  • librustc_llvm: ok
  • librustc_lsan: ok
  • librustc_metadata: ok
  • librustc_mir: used to ICE with region_obligations not empty (known issue #51649). Now ok.
  • librustc_msan: ok
  • librustc_platform_intrinsics: ok
  • librustc_plugin: ok
  • librustc_privacy: ok
  • librustc_resolve: ok
  • librustc_save_analysis: ok
  • librustc_target: ok
  • librustc_tsan: ok
  • librustdoc: ok
  • libstd: ok
  • libstd_unicode: the little of what is there is ok :)
  • libsyntax_pos: ok
  • libterm: ok
  • libtest: ok
  • libunwind: ok
  • rustc: if it is built by x.py build, then it is ok.

All 8 comments

Here's a summary of this adventure :)

I'll ignore the cases where MIR borrowck correctly adds new "unused mut" lint warnings which were previously not found by the AST borrowck: while they are new warnings, the unused muts were easily removed from the rustc code in order to keep building, so I marked them as ok (but can produce the list of cases if need be).

I tested by manually enabling the NLL feature in crates, #![cfg_attr(not(stage0), feature(nll))], and building. This doesn't test the submodules, stdsimd, and tools.

Interesting cases

  • liballoc: doesn't build, already tracked as #48224 (https://github.com/rust-lang/rust/issues/48224#issuecomment-365952037 mentions Niko might have a fix already)

  • librustc_passes: doesn't build right now and seems correct (apparently this pattern comes up often, so maybe we can accept this in the future, with additions to 2-phase-borrows), minimized repro here for convenience.

  • librustc_typeck: doesn't build because of incorrect "unused mut" lint warnings #51830. and because of ICE cannot convert ... to a region vid which is #51351, and has a minimized repro.

  • libsyntax_ext: doesn't build because of "broken MIR" ICE #48071, which has a minimal repro here.

Cases of incorrect "unused mut" lint warnings

  • libcore: used to ICE with region_obligations not empty (known issue #51649).
    This error has, after I started, become less prominent on master, and now 4 denied warnings prevent building. These are incorrect "unused mut" lint warnings when using move closures, and occurrences of known issue #51801 (which might be a more minimal reproduction of #50897)

  • librustc doesn't build because of incorrect "unused mut" lint warnings #51801 and #51830, the latter mentions removing a "mut" that doesn't exist in the surface code, and minimized in the issues and for convenience here

  • librustc_data_structures: used to ICE with region_obligations not empty (known issue #51649). Now doesn't build because of incorrect "unused mut" lint warnings #51801.

  • librustc_driver: doesn't build because of incorrect "unused mut" lint warnings #51801.

  • librustc_lint: doesn't build because of incorrect "unused mut" lint warnings #51830.

  • librustc_traits: doesn't build because of incorrect "unused mut" lint warnings #51830.

  • libserialize: doesn't build because of incorrect "unused mut" lint warnings #51801.

  • libsyntax: doesn't build because of incorrect "unused mut" lint warnings which I'm not sure we tracked so I filed it as #51904. A reduced repro is available here. The fact that there are 2 closures seem important here.


Crates without issues

  • liballoc_jemalloc: seems ok (unsure whether it's built when jemalloc is disabled in the config.toml)
  • liballoc_system: seems ok
  • libarena: ok
  • libfmt_macros: ok
  • libgraphviz: ok
  • libpanic_abort: ok
  • libpanic_unwind: ok
  • libproc_macro: ok
  • libprofiler_builtins: ok
  • librustc_allocator: ok
  • librustc_apfloat: ok
  • librustc_asan: ok
  • librustc_borrowck: ok
  • librustc_codegen_llvm: ok
  • librustc_codegen_utils: ok
  • librustc_cratesio_shim: ok, but it's just 2 extern crates
  • librustc_errors: ok
  • librustc_incremental: ok
  • librustc_llvm: ok
  • librustc_lsan: ok
  • librustc_metadata: ok
  • librustc_mir: used to ICE with region_obligations not empty (known issue #51649). Now ok.
  • librustc_msan: ok
  • librustc_platform_intrinsics: ok
  • librustc_plugin: ok
  • librustc_privacy: ok
  • librustc_resolve: ok
  • librustc_save_analysis: ok
  • librustc_target: ok
  • librustc_tsan: ok
  • librustdoc: ok
  • libstd: ok
  • libstd_unicode: the little of what is there is ok :)
  • libsyntax_pos: ok
  • libterm: ok
  • libtest: ok
  • libunwind: ok
  • rustc: if it is built by x.py build, then it is ok.

Now that all of those issues are fixed, I've added #52671 to the list since it is also blocking bootstrap.

With that fix bootstrapping still breaks due to the unused mut lint and a case where two phase borrows don't track activation through unsized coercions. I've created PRs for those.

Ok so rustc almost bootstraps, but changes since my last comment prevent it from doing so (more unused mut that AST misses, an issue with incorrect lifetime annotations). At this point I think that this will have to be checked with CI.

@Mark-Simulacrum @nikomatsakis @pnkfelix was there a decision on how we want to move rustc/CI towards nll?

I sort of presume that we can enable -Zborrowck=mir across all compilations in rust-lang/rust as soon as we believe the performance is good enough and the compiler works with it.

Or at least -Z borrowck=migrate -Z two-phase-borrows. I'm not sure about going all the way to -Z borrowck=mir -Z two-phase-borrows in our first step here.

Although, what am I talking about, we control our own code, we don't need to use the migration path.

Closing in favor of #53172

Was this page helpful?
0 / 5 - 0 ratings