Closed
Description
The rust compiler segfaults when using the path attribute #[path = "this_file.rs"]
pointing to itself with an inner line documentation comment in the file.
Steps to reproduce
Install this version of rust on linux:
rustc 1.60.0 (7737e0b5c 2022-04-04)
binary: rustc
commit-hash: 7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c
commit-date: 2022-04-04
host: x86_64-unknown-linux-gnu
release: 1.60.0
LLVM version: 14.0.0
Create the following file structure:
lib.rs
:
pub mod recursive;
recursive.rs
:
//! this comment causes the circular dependency checker to break
#[path = "recursive.rs"]
mod recursive;
And compiling lib.rs
will cause the segfault:
rustc lib.rs
/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-75e5f32fc3580f6c.so(+0x4b3d23)[0x7fbfcf6b3d23]
/usr/lib/libc.so.6(+0x3e8e0)[0x7fbfcec318e0]
/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-75e5f32fc3580f6c.so(+0x1fa8e30)[0x7fbfd11a8e30]
/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-75e5f32fc3580f6c.so(+0x1f95ba6)[0x7fbfd1195ba6]
/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-75e5f32fc3580f6c.so(_RNvMs0_NtNtCsjVjzjquPLq5_11rustc_parse6parser4exprNtB7_6Parser21parse_assoc_expr_with+0x11b)[0x7fbfd11938fb]
/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-75e5f32fc3580f6c.so(+0x2005145)[0x7fbfd1205145]
/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-75e5f32fc3580f6c.so(+0x1f8ff53)[0x7fbfd118ff53]
/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-75e5f32fc3580f6c.so(_RNvMNtNtCsjVjzjquPLq5_11rustc_parse6parser4attrNtB4_6Parser15parse_attribute+0x645)[0x7fbfd118eab5]
/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-75e5f32fc3580f6c.so(+0x1f8e021)[0x7fbfd118e021]
/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-75e5f32fc3580f6c.so(_RNvMNtNtCsjVjzjquPLq5_11rustc_parse6parser4itemNtB4_6Parser9parse_mod+0x84)[0x7fbfd11baa44]
/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-75e5f32fc3580f6c.so(_RNvNtCseWJ2MiKGUQh_12rustc_expand6module18parse_external_mod+0x46e)[0x7fbfd1c0060e]
/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-75e5f32fc3580f6c.so(+0x1f20ee2)[0x7fbfd1120ee2]
/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-75e5f32fc3580f6c.so(_RNvXsk_NtCseWJ2MiKGUQh_12rustc_expand6expandNtB5_19InvocationCollectorNtNtCsnWACUGdVye_9rustc_ast9mut_visit10MutVisitor13flat_map_item+0x167)[0x7fbfd115a547]
/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-75e5f32fc3580f6c.so(+0x29ebad1)[0x7fbfd1bebad1]
/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-75e5f32fc3580f6c.so(+0x1f50ea8)[0x7fbfd1150ea8]
/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-75e5f32fc3580f6c.so(+0x1f212ce)[0x7fbfd11212ce]
...
/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-75e5f32fc3580f6c.so(_RNvXsk_NtCseWJ2MiKGUQh_12rustc_expand6expandNtB5_19InvocationCollectorNtNtCsnWACUGdVye_9rustc_ast9mut_visit10MutVisitor13flat_map_item+0x167)[0x7fbfd115a547]
/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-75e5f32fc3580f6c.so(+0x29ebad1)[0x7fbfd1bebad1]
/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-75e5f32fc3580f6c.so(+0x1f50ea8)[0x7fbfd1150ea8]
/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-75e5f32fc3580f6c.so(+0x1f212ce)[0x7fbfd11212ce]
fish: Job 1, 'rustc lib.rs' terminated by signal SIGSEGV (Address boundary error)
Notes
- Segfault does not occur without the inner line documentation comment
- Segfault does not occur with an outer line documentation comment on
pub mod recursive
inlib.rs
- Segfault does not occur with
lib.rs
containing a circular module declaration to itself, rather requires another file
Activity