]> git.lizzy.rs Git - rust.git/commit - src/tools/rust-analyzer
Rollup merge of #89738 - eddyb:extern-crate-recursion, r=nagisa
authorMatthias Krüger <matthias.krueger@famsik.de>
Sun, 17 Oct 2021 16:18:55 +0000 (18:18 +0200)
committerGitHub <noreply@github.com>
Sun, 17 Oct 2021 16:18:55 +0000 (18:18 +0200)
commit59dc2187adebcbe6fca9073b5410c51c64915f95
treedaffe2d01cd3dee5df22ffa1330f94bb7ff8ec25
parent6f53ddfa74ac3c10ceb63ad4a7a9c95e55853c87
parentf14e8dd4e719bd29c6f559ffffa9a17317f4af1e
Rollup merge of #89738 - eddyb:extern-crate-recursion, r=nagisa

ty::pretty: prevent infinite recursion for `extern crate` paths.

Fixes #55779, fixes #87932.

This fix is based on `@estebank's` idea in https://github.com/rust-lang/rust/issues/55779#issuecomment-614758510 - but instead of trying to get `try_print_visible_def_path_recur`'s cycle detection to work in this case, this PR "just" disables the "visible path" feature when printing the path to an `extern crate`, so that the old recursion chain of `try_print_visible_def_path -> print_def_path -> try_print_visible_def_path`, is now impossible.

Both tests have been confirmed to crash `rustc` because of a stack overflow, without the fix.