Skip to content

Using include! with filename ending in '>' causes failed assertion in libspan #73419

Closed

Description

@LunarLambda

Code

Requirement:
Create an empty file called '>', i.e. using touch '>'

include!(">");

Meta

rustc --version --verbose:

rustc 1.43.1 (8d69840ab 2020-05-04)
binary: rustc
commit-hash: 8d69840ab92ea7f4d323420088dd8c9775f180cd
commit-date: 2020-05-04
host: x86_64-unknown-linux-gnu
release: 1.43.1
LLVM version: 9.0

Error output

thread 'rustc' panicked at 'assertion failed: !p.to_string_lossy().ends_with('>')', src/librustc_span/lib.rs:125:9

error: internal compiler error: unexpected panic
Backtrace

stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1063
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1426
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:204
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:224
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:474
  12: std::panicking::begin_panic
  13: <rustc_span::FileName as core::convert::From<std::path::PathBuf>>::from
  14: rustc_span::source_map::SourceMap::load_file
  15: rustc_parse::try_file_to_source_file
  16: rustc_parse::new_sub_parser_from_file
  17: rustc_builtin_macros::source_util::expand_include
  18: <F as rustc_expand::base::TTMacroExpander>::expand
  19: rustc_expand::expand::MacroExpander::fully_expand_fragment
  20: rustc_expand::expand::MacroExpander::expand_crate
  21: rustc_session::utils::<impl rustc_session::session::Session>::time
  22: rustc_interface::passes::configure_and_expand_inner
  23: rustc_interface::passes::configure_and_expand::{{closure}}
  24: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new
  25: rustc_interface::passes::configure_and_expand
  26: rustc_interface::queries::Queries::expansion
  27: rustc_interface::interface::run_compiler_in_existing_thread_pool
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Activity

  1. added
    C-bugCategory: This is a bug.
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Jun 16, 2020
  2. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Jun 16, 2020
  3. eddyb commented on Jun 16, 2020

    @eddyb
    Contributor

    Hmm, we should only disallow <...> (since that's what we use for non-real "files") although I guess </> or even just <foo> might be a valid path itself?

    Internally we can tell apart between the two, I'm guessing this is to avoid tools seeing something with < or > in it and misinterpreting it as not a real file? But in that case we'd want a real error not an assert.

    cc @ehuss

  4. added and removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Jun 16, 2020
  5. Dylan-DPC-zz commented on Jun 16, 2020

    @Dylan-DPC-zz

    Marked as p-medium based on the discussion on the prioritization thread

  6. Enselic commented on Aug 29, 2023

    @Enselic
    Member

    PR with fix: #115304

  7. added a commit that references this issue on Oct 5, 2023
    3f3de98
  8. added 2 commits that reference this issue on Oct 5, 2023
    8da4be0
    64fa0c3
  9. added a commit that references this issue on Oct 10, 2023
    645abff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions